]>
Commit | Line | Data |
---|---|---|
ff66d28f | 1 | |
92eabea2 PE |
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 | |
f214923c | 11 | AC_DEFUN([GLIBCXX_CONDITIONAL], [dnl |
92eabea2 PE |
12 | m4_divert_text([glibcxx_diversion],dnl |
13 | AM_CONDITIONAL([$1],[$2]) | |
14 | )dnl | |
15 | ])dnl | |
f214923c | 16 | AC_DEFUN([GLIBCXX_EVALUATE_CONDITIONALS], [m4_undivert([glibcxx_diversion])])dnl |
92eabea2 PE |
17 | |
18 | ||
ff66d28f PE |
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 | |
f214923c | 24 | AC_DEFUN([GLIBCXX_CHECK_HOST], [ |
ff66d28f | 25 | . $glibcxx_srcdir/configure.host |
f214923c BK |
26 | AC_MSG_NOTICE([CPU config directory is $cpu_include_dir]) |
27 | AC_MSG_NOTICE([OS config directory is $os_include_dir]) | |
ff66d28f PE |
28 | ]) |
29 | ||
ff66d28f PE |
30 | dnl |
31 | dnl Initialize the rest of the library configury. At this point we have | |
32 | dnl variables like $host. | |
aebb8c22 | 33 | dnl |
ff66d28f | 34 | dnl Sets: |
82ba99d5 | 35 | dnl SUBDIRS |
ff66d28f PE |
36 | dnl Substs: |
37 | dnl glibcxx_builddir (absolute path) | |
38 | dnl glibcxx_srcdir (absolute path) | |
39 | dnl toplevel_srcdir (absolute path) | |
40 | dnl with_cross_host | |
41 | dnl with_newlib | |
42 | dnl with_target_subdir | |
43 | dnl plus | |
44 | dnl - the variables in GLIBCXX_CHECK_HOST / configure.host | |
45 | dnl - default settings for all AM_CONFITIONAL test variables | |
46 | dnl - lots of tools, like CC and CXX | |
aebb8c22 | 47 | dnl |
f214923c | 48 | AC_DEFUN([GLIBCXX_CONFIGURE], [ |
82ba99d5 PE |
49 | # Keep these sync'd with the list in Makefile.am. The first provides an |
50 | # expandable list at autoconf time; the second provides an expandable list | |
51 | # (i.e., shell variable) at configure time. | |
41850419 | 52 | m4_define([glibcxx_SUBDIRS],[include libsupc++ python src doc po testsuite]) |
82ba99d5 PE |
53 | SUBDIRS='glibcxx_SUBDIRS' |
54 | ||
d2caef2e PE |
55 | # These need to be absolute paths, yet at the same time need to |
56 | # canonicalize only relative paths, because then amd will not unmount | |
57 | # drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd. | |
3d7c150e | 58 | glibcxx_builddir=`${PWDCMD-pwd}` |
d2caef2e | 59 | case $srcdir in |
ff66d28f PE |
60 | [\\/$]* | ?:[\\/]*) glibcxx_srcdir=${srcdir} ;; |
61 | *) glibcxx_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;; | |
d2caef2e | 62 | esac |
ff66d28f | 63 | toplevel_srcdir=${glibcxx_srcdir}/.. |
3d7c150e BK |
64 | AC_SUBST(glibcxx_builddir) |
65 | AC_SUBST(glibcxx_srcdir) | |
ff66d28f | 66 | AC_SUBST(toplevel_srcdir) |
d2caef2e | 67 | |
ff66d28f PE |
68 | # We use these options to decide which functions to include. They are |
69 | # set from the top level. | |
70 | AC_ARG_WITH([target-subdir], | |
71 | AC_HELP_STRING([--with-target-subdir=SUBDIR], | |
72 | [configuring in a subdirectory])) | |
73 | ||
74 | AC_ARG_WITH([cross-host], | |
75 | AC_HELP_STRING([--with-cross-host=HOST], | |
76 | [configuring with a cross compiler])) | |
77 | ||
78 | AC_ARG_WITH([newlib], | |
79 | AC_HELP_STRING([--with-newlib], | |
80 | [assume newlib as a system C library])) | |
81 | ||
ff66d28f PE |
82 | # Will set LN_S to either 'ln -s', 'ln', or 'cp -p' (if linking isn't |
83 | # available). Uncomment the next line to force a particular method. | |
84 | AC_PROG_LN_S | |
85 | #LN_S='cp -p' | |
86 | ||
5780a46b BK |
87 | AC_CHECK_TOOL(AS, as) |
88 | AC_CHECK_TOOL(AR, ar) | |
46840bcd | 89 | AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error) |
b2dad0e3 | 90 | |
5780a46b | 91 | AM_MAINTAINER_MODE |
b2dad0e3 | 92 | |
92eabea2 PE |
93 | # Set up safe default values for all subsequent AM_CONDITIONAL tests |
94 | # which are themselves conditionally expanded. | |
95 | ## (Right now, this only matters for enable_wchar_t, but nothing prevents | |
96 | ## other macros from doing the same. This should be automated.) -pme | |
16da539b | 97 | |
464aea98 JM |
98 | # Check for uClibc since Linux platforms use different configuration |
99 | # directories depending on the C library in use. | |
100 | AC_EGREP_CPP([_using_uclibc], [ | |
101 | #include <stdio.h> | |
102 | #if __UCLIBC__ | |
103 | _using_uclibc | |
104 | #endif | |
105 | ], uclibc=yes, uclibc=no) | |
106 | ||
ff66d28f PE |
107 | # Find platform-specific directories containing configuration info. |
108 | # Also possibly modify flags used elsewhere, as needed by the platform. | |
3d7c150e | 109 | GLIBCXX_CHECK_HOST |
b2dad0e3 BK |
110 | ]) |
111 | ||
112 | ||
c470c17d | 113 | dnl |
52b55e7d PE |
114 | dnl Tests for newer compiler features, or features that are present in newer |
115 | dnl compiler versions but not older compiler versions still in use, should | |
116 | dnl be placed here. | |
b2dad0e3 | 117 | dnl |
ff66d28f PE |
118 | dnl Defines: |
119 | dnl WERROR='-Werror' if requested and possible; g++'s that lack the | |
120 | dnl new inlining code or the new system_header pragma will die on -Werror. | |
121 | dnl Leave it out by default and use maint-mode to use it. | |
122 | dnl SECTION_FLAGS='-ffunction-sections -fdata-sections' if | |
123 | dnl compiler supports it and the user has not requested debug mode. | |
c21b6f87 | 124 | dnl |
f214923c | 125 | AC_DEFUN([GLIBCXX_CHECK_COMPILER_FEATURES], [ |
a4e99046 | 126 | # All these tests are for C++; save the language and the compiler flags. |
52b55e7d | 127 | # The CXXFLAGS thing is suspicious, but based on similar bits previously |
3d7c150e | 128 | # found in GLIBCXX_CONFIGURE. |
a4e99046 PE |
129 | AC_LANG_SAVE |
130 | AC_LANG_CPLUSPLUS | |
131 | ac_test_CXXFLAGS="${CXXFLAGS+set}" | |
132 | ac_save_CXXFLAGS="$CXXFLAGS" | |
a4e99046 | 133 | |
7f586614 BK |
134 | # Check for maintainer-mode bits. |
135 | if test x"$USE_MAINTAINER_MODE" = xno; then | |
136 | WERROR='' | |
8bd636c5 | 137 | else |
7f586614 | 138 | WERROR='-Werror' |
8bd636c5 PE |
139 | fi |
140 | ||
c470c17d BK |
141 | # Check for -ffunction-sections -fdata-sections |
142 | AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections]) | |
85ee35ca BK |
143 | CXXFLAGS='-g -Werror -ffunction-sections -fdata-sections' |
144 | AC_TRY_COMPILE([int foo; void bar() { };],, [ac_fdsections=yes], [ac_fdsections=no]) | |
c470c17d BK |
145 | if test "$ac_test_CXXFLAGS" = set; then |
146 | CXXFLAGS="$ac_save_CXXFLAGS" | |
147 | else | |
148 | # this is the suspicious part | |
149 | CXXFLAGS='' | |
150 | fi | |
6aa43d99 | 151 | if test x"$ac_fdsections" = x"yes"; then |
c470c17d BK |
152 | SECTION_FLAGS='-ffunction-sections -fdata-sections' |
153 | fi | |
154 | AC_MSG_RESULT($ac_fdsections) | |
155 | ||
a4e99046 | 156 | AC_LANG_RESTORE |
8bd636c5 | 157 | AC_SUBST(WERROR) |
c470c17d | 158 | AC_SUBST(SECTION_FLAGS) |
b2dad0e3 BK |
159 | ]) |
160 | ||
c470c17d BK |
161 | |
162 | dnl | |
421173e6 PE |
163 | dnl If GNU ld is in use, check to see if tricky linker opts can be used. If |
164 | dnl the native linker is in use, all variables will be defined to something | |
165 | dnl safe (like an empty string). | |
166 | dnl | |
ff66d28f PE |
167 | dnl Defines: |
168 | dnl SECTION_LDFLAGS='-Wl,--gc-sections' if possible | |
a429affe | 169 | dnl OPT_LDFLAGS='-Wl,-O1' and '-z,relro' if possible |
ff66d28f PE |
170 | dnl LD (as a side effect of testing) |
171 | dnl Sets: | |
172 | dnl with_gnu_ld | |
d60a2d4d | 173 | dnl glibcxx_ld_is_gold (set to "no" or "yes") |
ff66d28f PE |
174 | dnl glibcxx_gnu_ld_version (possibly) |
175 | dnl | |
176 | dnl The last will be a single integer, e.g., version 1.23.45.0.67.89 will | |
177 | dnl set glibcxx_gnu_ld_version to 12345. Zeros cause problems. | |
c470c17d | 178 | dnl |
f214923c | 179 | AC_DEFUN([GLIBCXX_CHECK_LINKER_FEATURES], [ |
421173e6 PE |
180 | # If we're not using GNU ld, then there's no point in even trying these |
181 | # tests. Check for that first. We should have already tested for gld | |
182 | # by now (in libtool), but require it now just to be safe... | |
654421eb DE |
183 | test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS='' |
184 | test -z "$OPT_LDFLAGS" && OPT_LDFLAGS='' | |
421173e6 | 185 | AC_REQUIRE([AC_PROG_LD]) |
ff66d28f | 186 | AC_REQUIRE([AC_PROG_AWK]) |
5bd17d39 | 187 | |
c98b201b PE |
188 | # The name set by libtool depends on the version of libtool. Shame on us |
189 | # for depending on an impl detail, but c'est la vie. Older versions used | |
190 | # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on | |
191 | # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually | |
192 | # makes sense). We'll test with_gnu_ld everywhere else, so if that isn't | |
193 | # set (hence we're using an older libtool), then set it. | |
194 | if test x${with_gnu_ld+set} != xset; then | |
195 | if test x${ac_cv_prog_gnu_ld+set} != xset; then | |
196 | # We got through "ac_require(ac_prog_ld)" and still not set? Huh? | |
197 | with_gnu_ld=no | |
198 | else | |
199 | with_gnu_ld=$ac_cv_prog_gnu_ld | |
200 | fi | |
201 | fi | |
202 | ||
203 | # Start by getting the version number. I think the libtool test already | |
204 | # does some of this, but throws away the result. | |
d60a2d4d | 205 | glibcxx_ld_is_gold=no |
e2c104d8 BK |
206 | if test x"$with_gnu_ld" = x"yes"; then |
207 | AC_MSG_CHECKING([for ld version]) | |
208 | changequote(,) | |
d60a2d4d ILT |
209 | if $LD --version 2>/dev/null | grep 'GNU gold' >/dev/null 2>&1; then |
210 | glibcxx_ld_is_gold=yes | |
211 | fi | |
c82852f7 | 212 | ldver=`$LD --version 2>/dev/null | |
89c74f4a | 213 | sed -e 's/GNU gold /GNU ld /;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'` |
e2c104d8 BK |
214 | changequote([,]) |
215 | glibcxx_gnu_ld_version=`echo $ldver | \ | |
216 | $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'` | |
217 | AC_MSG_RESULT($glibcxx_gnu_ld_version) | |
218 | fi | |
c98b201b | 219 | |
5bd17d39 | 220 | # Set --gc-sections. |
d60a2d4d ILT |
221 | glibcxx_have_gc_sections=no |
222 | if test "$glibcxx_ld_is_gold" = "yes"; then | |
223 | if $LD --help 2>/dev/null | grep gc-sections >/dev/null 2>&1; then | |
224 | glibcxx_have_gc_sections=yes | |
225 | fi | |
226 | else | |
227 | glibcxx_gcsections_min_ld=21602 | |
228 | if test x"$with_gnu_ld" = x"yes" && | |
ac2b2479 | 229 | test $glibcxx_gnu_ld_version -gt $glibcxx_gcsections_min_ld ; then |
d60a2d4d ILT |
230 | glibcxx_have_gc_sections=yes |
231 | fi | |
232 | fi | |
233 | if test "$glibcxx_have_gc_sections" = "yes"; then | |
ac2b2479 BK |
234 | # Sufficiently young GNU ld it is! Joy and bunny rabbits! |
235 | # NB: This flag only works reliably after 2.16.1. Configure tests | |
236 | # for this are difficult, so hard wire a value that should work. | |
421173e6 | 237 | |
421173e6 PE |
238 | ac_test_CFLAGS="${CFLAGS+set}" |
239 | ac_save_CFLAGS="$CFLAGS" | |
2a0ab51c | 240 | CFLAGS='-Wl,--gc-sections' |
421173e6 PE |
241 | |
242 | # Check for -Wl,--gc-sections | |
243 | AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections]) | |
acb6e9be BK |
244 | AC_TRY_LINK([ int one(void) { return 1; } |
245 | int two(void) { return 2; } | |
246 | ], [ two(); ] , [ac_gcsections=yes], [ac_gcsections=no]) | |
360e8759 L |
247 | if test "$ac_gcsections" = "yes"; then |
248 | rm -f conftest.c | |
249 | touch conftest.c | |
250 | if $CC -c conftest.c; then | |
251 | if $LD --gc-sections -o conftest conftest.o 2>&1 | \ | |
252 | grep "Warning: gc-sections option ignored" > /dev/null; then | |
253 | ac_gcsections=no | |
254 | fi | |
255 | fi | |
256 | rm -f conftest.c conftest.o conftest | |
257 | fi | |
acb6e9be BK |
258 | if test "$ac_gcsections" = "yes"; then |
259 | SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS" | |
260 | fi | |
261 | AC_MSG_RESULT($ac_gcsections) | |
262 | ||
421173e6 PE |
263 | if test "$ac_test_CFLAGS" = set; then |
264 | CFLAGS="$ac_save_CFLAGS" | |
265 | else | |
266 | # this is the suspicious part | |
267 | CFLAGS='' | |
268 | fi | |
5bd17d39 | 269 | fi |
a9117427 | 270 | |
a429affe | 271 | # Set -z,relro. |
952c7b74 | 272 | # Note this is only for shared objects. |
a429affe BK |
273 | ac_ld_relro=no |
274 | if test x"$with_gnu_ld" = x"yes"; then | |
275 | AC_MSG_CHECKING([for ld that supports -Wl,-z,relro]) | |
276 | cxx_z_relo=`$LD -v --help 2>/dev/null | grep "z relro"` | |
277 | if test -n "$cxx_z_relo"; then | |
278 | OPT_LDFLAGS="-Wl,-z,relro" | |
279 | ac_ld_relro=yes | |
280 | fi | |
281 | AC_MSG_RESULT($ac_ld_relro) | |
282 | fi | |
283 | ||
5bd17d39 | 284 | # Set linker optimization flags. |
6aa43d99 | 285 | if test x"$with_gnu_ld" = x"yes"; then |
654421eb | 286 | OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS" |
421173e6 | 287 | fi |
5bd17d39 | 288 | |
c470c17d | 289 | AC_SUBST(SECTION_LDFLAGS) |
421173e6 | 290 | AC_SUBST(OPT_LDFLAGS) |
c470c17d BK |
291 | ]) |
292 | ||
293 | ||
b2dad0e3 | 294 | dnl |
ff66d28f PE |
295 | dnl Check for headers for, and arguments to, the setrlimit() function. |
296 | dnl Used only in testsuite_hooks.h. Called from GLIBCXX_CONFIGURE_TESTSUITE. | |
6aa43d99 | 297 | dnl |
ff66d28f | 298 | dnl Defines: |
2ae6e982 PC |
299 | dnl _GLIBCXX_RES_LIMITS if we can set artificial resource limits |
300 | dnl various HAVE_LIMIT_* for individual limit names | |
6aa43d99 | 301 | dnl |
f214923c | 302 | AC_DEFUN([GLIBCXX_CHECK_SETRLIMIT_ancilliary], [ |
e0103440 | 303 | AC_MSG_CHECKING([for RLIMIT_$1]) |
ff66d28f PE |
304 | AC_TRY_COMPILE( |
305 | [#include <unistd.h> | |
306 | #include <sys/time.h> | |
307 | #include <sys/resource.h> | |
308 | ], | |
309 | [ int f = RLIMIT_$1 ; ], | |
310 | [glibcxx_mresult=1], [glibcxx_mresult=0]) | |
2ae6e982 | 311 | AC_DEFINE_UNQUOTED(HAVE_LIMIT_$1, $glibcxx_mresult, |
ff66d28f | 312 | [Only used in build directory testsuite_hooks.h.]) |
e0103440 GK |
313 | if test $glibcxx_mresult = 1 ; then res=yes ; else res=no ; fi |
314 | AC_MSG_RESULT($res) | |
ff66d28f PE |
315 | ]) |
316 | ||
f214923c | 317 | AC_DEFUN([GLIBCXX_CHECK_SETRLIMIT], [ |
ff66d28f PE |
318 | setrlimit_have_headers=yes |
319 | AC_CHECK_HEADERS(unistd.h sys/time.h sys/resource.h, | |
320 | [], | |
321 | [setrlimit_have_headers=no]) | |
322 | # If don't have the headers, then we can't run the tests now, and we | |
323 | # won't be seeing any of these during testsuite compilation. | |
324 | if test $setrlimit_have_headers = yes; then | |
325 | # Can't do these in a loop, else the resulting syntax is wrong. | |
326 | GLIBCXX_CHECK_SETRLIMIT_ancilliary(DATA) | |
327 | GLIBCXX_CHECK_SETRLIMIT_ancilliary(RSS) | |
328 | GLIBCXX_CHECK_SETRLIMIT_ancilliary(VMEM) | |
329 | GLIBCXX_CHECK_SETRLIMIT_ancilliary(AS) | |
2ae6e982 | 330 | GLIBCXX_CHECK_SETRLIMIT_ancilliary(FSIZE) |
ff66d28f PE |
331 | |
332 | # Check for rlimit, setrlimit. | |
6d26724a | 333 | AC_CACHE_VAL(glibcxx_cv_setrlimit, [ |
ff66d28f PE |
334 | AC_TRY_COMPILE( |
335 | [#include <unistd.h> | |
336 | #include <sys/time.h> | |
337 | #include <sys/resource.h> | |
338 | ], | |
339 | [struct rlimit r; | |
340 | setrlimit(0, &r);], | |
6d26724a | 341 | [glibcxx_cv_setrlimit=yes], [glibcxx_cv_setrlimit=no]) |
ff66d28f PE |
342 | ]) |
343 | fi | |
344 | ||
2ae6e982 | 345 | AC_MSG_CHECKING([for testsuite resource limits support]) |
6d26724a | 346 | if test $setrlimit_have_headers = yes && test $glibcxx_cv_setrlimit = yes; then |
2ae6e982 | 347 | ac_res_limits=yes |
4651e622 KC |
348 | AC_DEFINE(_GLIBCXX_RES_LIMITS, 1, |
349 | [Define if using setrlimit to set resource limits during | |
350 | "make check"]) | |
ff66d28f | 351 | else |
2ae6e982 | 352 | ac_res_limits=no |
ff66d28f | 353 | fi |
2ae6e982 | 354 | AC_MSG_RESULT($ac_res_limits) |
6aa43d99 BK |
355 | ]) |
356 | ||
357 | ||
6aa43d99 | 358 | dnl |
ff66d28f PE |
359 | dnl Check whether S_ISREG (Posix) or S_IFREG is available in <sys/stat.h>. |
360 | dnl Define HAVE_S_ISREG / HAVE_S_IFREG appropriately. | |
6aa43d99 | 361 | dnl |
f214923c | 362 | AC_DEFUN([GLIBCXX_CHECK_S_ISREG_OR_S_IFREG], [ |
74745ec5 PC |
363 | |
364 | AC_LANG_SAVE | |
365 | AC_LANG_CPLUSPLUS | |
366 | ac_save_CXXFLAGS="$CXXFLAGS" | |
367 | CXXFLAGS="$CXXFLAGS -fno-exceptions" | |
368 | ||
e0103440 | 369 | AC_MSG_CHECKING([for S_ISREG or S_IFREG]) |
ff66d28f | 370 | AC_CACHE_VAL(glibcxx_cv_S_ISREG, [ |
74745ec5 | 371 | GCC_TRY_COMPILE_OR_LINK( |
ff66d28f PE |
372 | [#include <sys/stat.h>], |
373 | [struct stat buffer; | |
374 | fstat(0, &buffer); | |
375 | S_ISREG(buffer.st_mode);], | |
376 | [glibcxx_cv_S_ISREG=yes], | |
377 | [glibcxx_cv_S_ISREG=no]) | |
378 | ]) | |
379 | AC_CACHE_VAL(glibcxx_cv_S_IFREG, [ | |
74745ec5 | 380 | GCC_TRY_COMPILE_OR_LINK( |
ff66d28f PE |
381 | [#include <sys/stat.h>], |
382 | [struct stat buffer; | |
383 | fstat(0, &buffer); | |
384 | S_IFREG & buffer.st_mode;], | |
385 | [glibcxx_cv_S_IFREG=yes], | |
386 | [glibcxx_cv_S_IFREG=no]) | |
387 | ]) | |
e0103440 | 388 | res=no |
ff66d28f | 389 | if test $glibcxx_cv_S_ISREG = yes; then |
4651e622 KC |
390 | AC_DEFINE(HAVE_S_ISREG, 1, |
391 | [Define if S_IFREG is available in <sys/stat.h>.]) | |
e0103440 | 392 | res=S_ISREG |
ff66d28f | 393 | elif test $glibcxx_cv_S_IFREG = yes; then |
4651e622 KC |
394 | AC_DEFINE(HAVE_S_IFREG, 1, |
395 | [Define if S_IFREG is available in <sys/stat.h>.]) | |
e0103440 | 396 | res=S_IFREG |
ff66d28f | 397 | fi |
e0103440 | 398 | AC_MSG_RESULT($res) |
74745ec5 PC |
399 | |
400 | CXXFLAGS="$ac_save_CXXFLAGS" | |
401 | AC_LANG_RESTORE | |
b2dad0e3 BK |
402 | ]) |
403 | ||
404 | ||
dcfa0bc8 | 405 | dnl |
ff66d28f | 406 | dnl Check whether poll is available in <poll.h>, and define HAVE_POLL. |
dcfa0bc8 | 407 | dnl |
f214923c | 408 | AC_DEFUN([GLIBCXX_CHECK_POLL], [ |
74745ec5 PC |
409 | |
410 | AC_LANG_SAVE | |
411 | AC_LANG_CPLUSPLUS | |
412 | ac_save_CXXFLAGS="$CXXFLAGS" | |
413 | CXXFLAGS="$CXXFLAGS -fno-exceptions" | |
414 | ||
e0103440 | 415 | AC_MSG_CHECKING([for poll]) |
ff66d28f | 416 | AC_CACHE_VAL(glibcxx_cv_POLL, [ |
74745ec5 | 417 | GCC_TRY_COMPILE_OR_LINK( |
ff66d28f PE |
418 | [#include <poll.h>], |
419 | [struct pollfd pfd[1]; | |
420 | pfd[0].events = POLLIN; | |
421 | poll(pfd, 1, 0);], | |
422 | [glibcxx_cv_POLL=yes], | |
423 | [glibcxx_cv_POLL=no]) | |
424 | ]) | |
425 | if test $glibcxx_cv_POLL = yes; then | |
4651e622 | 426 | AC_DEFINE(HAVE_POLL, 1, [Define if poll is available in <poll.h>.]) |
ff66d28f | 427 | fi |
e0103440 | 428 | AC_MSG_RESULT($glibcxx_cv_POLL) |
74745ec5 PC |
429 | |
430 | CXXFLAGS="$ac_save_CXXFLAGS" | |
431 | AC_LANG_RESTORE | |
ff66d28f PE |
432 | ]) |
433 | ||
434 | ||
435 | dnl | |
436 | dnl Check whether writev is available in <sys/uio.h>, and define HAVE_WRITEV. | |
437 | dnl | |
f214923c | 438 | AC_DEFUN([GLIBCXX_CHECK_WRITEV], [ |
74745ec5 PC |
439 | |
440 | AC_LANG_SAVE | |
441 | AC_LANG_CPLUSPLUS | |
442 | ac_save_CXXFLAGS="$CXXFLAGS" | |
443 | CXXFLAGS="$CXXFLAGS -fno-exceptions" | |
444 | ||
e0103440 | 445 | AC_MSG_CHECKING([for writev]) |
ff66d28f | 446 | AC_CACHE_VAL(glibcxx_cv_WRITEV, [ |
74745ec5 | 447 | GCC_TRY_COMPILE_OR_LINK( |
ff66d28f PE |
448 | [#include <sys/uio.h>], |
449 | [struct iovec iov[2]; | |
450 | writev(0, iov, 0);], | |
451 | [glibcxx_cv_WRITEV=yes], | |
452 | [glibcxx_cv_WRITEV=no]) | |
453 | ]) | |
454 | if test $glibcxx_cv_WRITEV = yes; then | |
4651e622 | 455 | AC_DEFINE(HAVE_WRITEV, 1, [Define if writev is available in <sys/uio.h>.]) |
ff66d28f | 456 | fi |
e0103440 | 457 | AC_MSG_RESULT($glibcxx_cv_WRITEV) |
74745ec5 PC |
458 | |
459 | CXXFLAGS="$ac_save_CXXFLAGS" | |
460 | AC_LANG_RESTORE | |
ff66d28f PE |
461 | ]) |
462 | ||
463 | ||
3d05b345 PC |
464 | dnl |
465 | dnl Check whether int64_t is available in <stdint.h>, and define HAVE_INT64_T. | |
fc9ab7b4 | 466 | dnl Also check whether int64_t is actually a typedef to long or long long. |
3d05b345 | 467 | dnl |
f214923c | 468 | AC_DEFUN([GLIBCXX_CHECK_INT64_T], [ |
fc9ab7b4 PC |
469 | |
470 | AC_LANG_SAVE | |
471 | AC_LANG_CPLUSPLUS | |
472 | ||
e0103440 | 473 | AC_MSG_CHECKING([for int64_t]) |
3d05b345 PC |
474 | AC_CACHE_VAL(glibcxx_cv_INT64_T, [ |
475 | AC_TRY_COMPILE( | |
476 | [#include <stdint.h>], | |
477 | [int64_t var;], | |
478 | [glibcxx_cv_INT64_T=yes], | |
479 | [glibcxx_cv_INT64_T=no]) | |
480 | ]) | |
fc9ab7b4 | 481 | |
3d05b345 | 482 | if test $glibcxx_cv_INT64_T = yes; then |
4651e622 | 483 | AC_DEFINE(HAVE_INT64_T, 1, [Define if int64_t is available in <stdint.h>.]) |
fc9ab7b4 PC |
484 | AC_MSG_RESULT($glibcxx_cv_INT64_T) |
485 | ||
486 | AC_MSG_CHECKING([for int64_t as long]) | |
487 | AC_CACHE_VAL(glibcxx_cv_int64_t_long, [ | |
488 | AC_TRY_COMPILE( | |
489 | [#include <stdint.h> | |
490 | template<typename, typename> struct same { enum { value = -1 }; }; | |
491 | template<typename Tp> struct same<Tp, Tp> { enum { value = 1 }; }; | |
492 | int array[same<int64_t, long>::value];], [], | |
493 | [glibcxx_cv_int64_t_long=yes], [glibcxx_cv_int64_t_long=no]) | |
494 | ]) | |
495 | ||
496 | if test $glibcxx_cv_int64_t_long = yes; then | |
497 | AC_DEFINE(HAVE_INT64_T_LONG, 1, [Define if int64_t is a long.]) | |
498 | AC_MSG_RESULT($glibcxx_cv_int64_t_long) | |
499 | fi | |
500 | ||
501 | AC_MSG_CHECKING([for int64_t as long long]) | |
502 | AC_CACHE_VAL(glibcxx_cv_int64_t_long_long, [ | |
503 | AC_TRY_COMPILE( | |
504 | [#include <stdint.h> | |
505 | template<typename, typename> struct same { enum { value = -1 }; }; | |
506 | template<typename Tp> struct same<Tp, Tp> { enum { value = 1 }; }; | |
507 | int array[same<int64_t, long long>::value];], [], | |
508 | [glibcxx_cv_int64_t_long_long=yes], [glibcxx_cv_int64_t_long_long=no]) | |
509 | ]) | |
510 | ||
511 | if test $glibcxx_cv_int64_t_long_long = yes; then | |
512 | AC_DEFINE(HAVE_INT64_T_LONG_LONG, 1, [Define if int64_t is a long long.]) | |
513 | AC_MSG_RESULT($glibcxx_cv_int64_t_long_long) | |
514 | fi | |
3d05b345 | 515 | fi |
fc9ab7b4 PC |
516 | |
517 | AC_LANG_RESTORE | |
3d05b345 PC |
518 | ]) |
519 | ||
520 | ||
521 | dnl | |
522 | dnl Check whether LFS support is available. | |
523 | dnl | |
f214923c | 524 | AC_DEFUN([GLIBCXX_CHECK_LFS], [ |
0c6b814a | 525 | AC_LANG_SAVE |
9d47bc51 PC |
526 | AC_LANG_CPLUSPLUS |
527 | ac_save_CXXFLAGS="$CXXFLAGS" | |
528 | CXXFLAGS="$CXXFLAGS -fno-exceptions" | |
e0103440 | 529 | AC_MSG_CHECKING([for LFS support]) |
3d05b345 | 530 | AC_CACHE_VAL(glibcxx_cv_LFS, [ |
74745ec5 | 531 | GCC_TRY_COMPILE_OR_LINK( |
0c6b814a PC |
532 | [#include <unistd.h> |
533 | #include <stdio.h> | |
dd5d134b | 534 | #include <sys/stat.h> |
0c6b814a | 535 | ], |
5c89246d PC |
536 | [FILE* fp; |
537 | fopen64("t", "w"); | |
538 | fseeko64(fp, 0, SEEK_CUR); | |
539 | ftello64(fp); | |
dd5d134b PC |
540 | lseek64(1, 0, SEEK_CUR); |
541 | struct stat64 buf; | |
542 | fstat64(1, &buf);], | |
3d05b345 PC |
543 | [glibcxx_cv_LFS=yes], |
544 | [glibcxx_cv_LFS=no]) | |
545 | ]) | |
546 | if test $glibcxx_cv_LFS = yes; then | |
4651e622 | 547 | AC_DEFINE(_GLIBCXX_USE_LFS, 1, [Define if LFS support is available.]) |
3d05b345 | 548 | fi |
e0103440 | 549 | AC_MSG_RESULT($glibcxx_cv_LFS) |
9d47bc51 PC |
550 | CXXFLAGS="$ac_save_CXXFLAGS" |
551 | AC_LANG_RESTORE | |
3d05b345 PC |
552 | ]) |
553 | ||
554 | ||
1165dc50 PC |
555 | dnl |
556 | dnl Check for whether a fully dynamic basic_string implementation should | |
557 | dnl be turned on, that does not put empty objects in per-process static | |
558 | dnl memory (mostly useful together with shared memory allocators, see PR | |
559 | dnl libstdc++/16612 for details). | |
560 | dnl | |
561 | dnl --enable-fully-dynamic-string defines _GLIBCXX_FULLY_DYNAMIC_STRING | |
562 | dnl --disable-fully-dynamic-string leaves _GLIBCXX_FULLY_DYNAMIC_STRING undefined | |
563 | dnl + Usage: GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING[(DEFAULT)] | |
564 | dnl Where DEFAULT is either `yes' or `no'. | |
565 | dnl | |
566 | AC_DEFUN([GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING], [ | |
567 | GLIBCXX_ENABLE(fully-dynamic-string,$1,,[do not put empty strings in per-process static memory]) | |
568 | if test $enable_fully_dynamic_string = yes; then | |
4651e622 KC |
569 | AC_DEFINE(_GLIBCXX_FULLY_DYNAMIC_STRING, 1, |
570 | [Define if a fully dynamic basic_string is wanted.]) | |
1165dc50 PC |
571 | fi |
572 | ]) | |
573 | ||
574 | ||
ff66d28f PE |
575 | dnl |
576 | dnl Does any necessary configuration of the testsuite directory. Generates | |
577 | dnl the testsuite_hooks.h header. | |
578 | dnl | |
579 | dnl GLIBCXX_ENABLE_SYMVERS and GLIBCXX_IS_NATIVE must be done before this. | |
580 | dnl | |
581 | dnl Sets: | |
84946e72 | 582 | dnl enable_abi_check |
e3f78d9b BK |
583 | dnl GLIBCXX_TEST_WCHAR_T |
584 | dnl GLIBCXX_TEST_THREAD | |
ff66d28f PE |
585 | dnl Substs: |
586 | dnl baseline_dir | |
587 | dnl | |
f214923c | 588 | AC_DEFUN([GLIBCXX_CONFIGURE_TESTSUITE], [ |
0646b059 | 589 | if $GLIBCXX_IS_NATIVE ; then |
2ae6e982 | 590 | # Do checks for resource limit functions. |
ff66d28f PE |
591 | GLIBCXX_CHECK_SETRLIMIT |
592 | ||
593 | # Look for setenv, so that extended locale tests can be performed. | |
594 | GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_3(setenv) | |
0646b059 | 595 | fi |
dbc66058 | 596 | |
0646b059 GK |
597 | if $GLIBCXX_IS_NATIVE && test $is_hosted = yes && |
598 | test $enable_symvers != no; then | |
599 | case "$host" in | |
600 | *-*-cygwin*) | |
601 | enable_abi_check=no ;; | |
602 | *) | |
603 | enable_abi_check=yes ;; | |
604 | esac | |
dbc66058 DJ |
605 | else |
606 | # Only build this as native, since automake does not understand | |
607 | # CXX_FOR_BUILD. | |
608 | enable_abi_check=no | |
ff66d28f | 609 | fi |
84946e72 | 610 | |
ff66d28f | 611 | # Export file names for ABI checking. |
68c512f6 | 612 | baseline_dir="$glibcxx_srcdir/config/abi/post/${abi_baseline_pair}" |
ff66d28f | 613 | AC_SUBST(baseline_dir) |
ff66d28f PE |
614 | ]) |
615 | ||
616 | ||
617 | dnl | |
618 | dnl Set up *_INCLUDES variables for all sundry Makefile.am's. | |
619 | dnl | |
620 | dnl Substs: | |
621 | dnl GLIBCXX_INCLUDES | |
622 | dnl TOPLEVEL_INCLUDES | |
ff66d28f | 623 | dnl |
f214923c | 624 | AC_DEFUN([GLIBCXX_EXPORT_INCLUDES], [ |
0df3f383 PE |
625 | # Used for every C++ compile we perform. |
626 | GLIBCXX_INCLUDES="\ | |
627 | -I$glibcxx_builddir/include/$host_alias \ | |
628 | -I$glibcxx_builddir/include \ | |
629 | -I$glibcxx_srcdir/libsupc++" | |
ff66d28f | 630 | |
0df3f383 | 631 | # For Canadian crosses, pick this up too. |
ff66d28f | 632 | if test $CANADIAN = yes; then |
37e0ff11 | 633 | GLIBCXX_INCLUDES="$GLIBCXX_INCLUDES -I\${includedir}" |
ff66d28f PE |
634 | fi |
635 | ||
0df3f383 PE |
636 | # Stuff in the actual top level. Currently only used by libsupc++ to |
637 | # get unwind* headers from the gcc dir. | |
638 | #TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc -I$(toplevel_srcdir)/include' | |
639 | TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc' | |
ff66d28f PE |
640 | |
641 | # Now, export this to all the little Makefiles.... | |
642 | AC_SUBST(GLIBCXX_INCLUDES) | |
643 | AC_SUBST(TOPLEVEL_INCLUDES) | |
ff66d28f PE |
644 | ]) |
645 | ||
646 | ||
647 | dnl | |
648 | dnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's. | |
649 | dnl (SECTION_FLAGS is done under CHECK_COMPILER_FEATURES.) | |
650 | dnl | |
651 | dnl Substs: | |
652 | dnl OPTIMIZE_CXXFLAGS | |
653 | dnl WARN_FLAGS | |
654 | dnl | |
f214923c | 655 | AC_DEFUN([GLIBCXX_EXPORT_FLAGS], [ |
ff66d28f PE |
656 | # Optimization flags that are probably a good idea for thrill-seekers. Just |
657 | # uncomment the lines below and make, everything else is ready to go... | |
62801a96 | 658 | # Alternatively OPTIMIZE_CXXFLAGS can be set in configure.host. |
ff66d28f | 659 | # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc |
ff66d28f PE |
660 | AC_SUBST(OPTIMIZE_CXXFLAGS) |
661 | ||
dc7c62ae | 662 | WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual' |
ff66d28f PE |
663 | AC_SUBST(WARN_FLAGS) |
664 | ]) | |
665 | ||
666 | ||
667 | dnl | |
668 | dnl All installation directory information is determined here. | |
669 | dnl | |
670 | dnl Substs: | |
671 | dnl gxx_install_dir | |
672 | dnl glibcxx_prefixdir | |
673 | dnl glibcxx_toolexecdir | |
674 | dnl glibcxx_toolexeclibdir | |
675 | dnl | |
676 | dnl Assumes cross_compiling bits already done, and with_cross_host in | |
677 | dnl particular. | |
678 | dnl | |
0f57bf40 | 679 | dnl This logic must match gcc/configure.ac's setting of gcc_gxx_include_dir. |
505692b0 | 680 | dnl config/gxx-include-dir.m4 must be kept consistant with this as well. |
f214923c | 681 | AC_DEFUN([GLIBCXX_EXPORT_INSTALL_INFO], [ |
ff66d28f PE |
682 | glibcxx_toolexecdir=no |
683 | glibcxx_toolexeclibdir=no | |
684 | glibcxx_prefixdir=$prefix | |
685 | ||
686 | AC_MSG_CHECKING([for gxx-include-dir]) | |
687 | AC_ARG_WITH([gxx-include-dir], | |
688 | AC_HELP_STRING([--with-gxx-include-dir=DIR], | |
689 | [installation directory for include files]), | |
690 | [case "$withval" in | |
691 | yes) AC_MSG_ERROR([Missing directory for --with-gxx-include-dir]) ;; | |
692 | no) gxx_include_dir=no ;; | |
693 | *) gxx_include_dir=$withval ;; | |
694 | esac], | |
695 | [gxx_include_dir=no]) | |
696 | AC_MSG_RESULT($gxx_include_dir) | |
697 | ||
698 | AC_MSG_CHECKING([for --enable-version-specific-runtime-libs]) | |
699 | AC_ARG_ENABLE([version-specific-runtime-libs], | |
700 | AC_HELP_STRING([--enable-version-specific-runtime-libs], | |
701 | [Specify that runtime libraries should be installed in a compiler-specific directory]), | |
702 | [case "$enableval" in | |
703 | yes) version_specific_libs=yes ;; | |
704 | no) version_specific_libs=no ;; | |
705 | *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);; | |
706 | esac], | |
707 | [version_specific_libs=no]) | |
708 | AC_MSG_RESULT($version_specific_libs) | |
709 | ||
710 | # Default case for install directory for include files. | |
711 | if test $version_specific_libs = no && test $gxx_include_dir = no; then | |
0f57bf40 MM |
712 | gxx_include_dir='include/c++/${gcc_version}' |
713 | if test -n "$with_cross_host" && | |
714 | test x"$with_cross_host" != x"no"; then | |
715 | gxx_include_dir='${prefix}/${target_alias}/'"$gxx_include_dir" | |
716 | else | |
717 | gxx_include_dir='${prefix}/'"$gxx_include_dir" | |
718 | fi | |
ff66d28f PE |
719 | fi |
720 | ||
721 | # Version-specific runtime libs processing. | |
722 | if test $version_specific_libs = yes; then | |
723 | # Need the gcc compiler version to know where to install libraries | |
724 | # and header files if --enable-version-specific-runtime-libs option | |
0314451d GK |
725 | # is selected. FIXME: these variables are misnamed, there are |
726 | # no executables installed in _toolexecdir or _toolexeclibdir. | |
ff66d28f | 727 | if test x"$gxx_include_dir" = x"no"; then |
47194af4 | 728 | gxx_include_dir='${libdir}/gcc/${host_alias}/${gcc_version}/include/c++' |
ff66d28f | 729 | fi |
0314451d | 730 | glibcxx_toolexecdir='${libdir}/gcc/${host_alias}' |
47194af4 | 731 | glibcxx_toolexeclibdir='${toolexecdir}/${gcc_version}$(MULTISUBDIR)' |
ff66d28f PE |
732 | fi |
733 | ||
734 | # Calculate glibcxx_toolexecdir, glibcxx_toolexeclibdir | |
735 | # Install a library built with a cross compiler in tooldir, not libdir. | |
736 | if test x"$glibcxx_toolexecdir" = x"no"; then | |
737 | if test -n "$with_cross_host" && | |
738 | test x"$with_cross_host" != x"no"; then | |
fbe057bb PE |
739 | glibcxx_toolexecdir='${exec_prefix}/${host_alias}' |
740 | glibcxx_toolexeclibdir='${toolexecdir}/lib' | |
ff66d28f | 741 | else |
0314451d | 742 | glibcxx_toolexecdir='${libdir}/gcc/${host_alias}' |
fbe057bb | 743 | glibcxx_toolexeclibdir='${libdir}' |
ff66d28f | 744 | fi |
fbe057bb | 745 | multi_os_directory=`$CXX -print-multi-os-directory` |
ff66d28f PE |
746 | case $multi_os_directory in |
747 | .) ;; # Avoid trailing /. | |
748 | *) glibcxx_toolexeclibdir=$glibcxx_toolexeclibdir/$multi_os_directory ;; | |
749 | esac | |
750 | fi | |
751 | ||
752 | AC_MSG_CHECKING([for install location]) | |
753 | AC_MSG_RESULT($gxx_include_dir) | |
754 | ||
755 | AC_SUBST(glibcxx_prefixdir) | |
756 | AC_SUBST(gxx_include_dir) | |
757 | AC_SUBST(glibcxx_toolexecdir) | |
758 | AC_SUBST(glibcxx_toolexeclibdir) | |
759 | ]) | |
760 | ||
761 | ||
762 | dnl | |
763 | dnl GLIBCXX_ENABLE | |
764 | dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING) | |
765 | dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, permit a|b|c) | |
766 | dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, SHELL-CODE-HANDLER) | |
767 | dnl | |
768 | dnl See docs/html/17_intro/configury.html#enable for documentation. | |
769 | dnl | |
770 | m4_define([GLIBCXX_ENABLE],[dnl | |
771 | m4_define([_g_switch],[--enable-$1])dnl | |
772 | m4_define([_g_help],[AC_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl | |
773 | AC_ARG_ENABLE($1,_g_help, | |
774 | m4_bmatch([$5], | |
775 | [^permit ], | |
776 | [[ | |
777 | case "$enableval" in | |
778 | m4_bpatsubst([$5],[permit ])) ;; | |
779 | *) AC_MSG_ERROR(Unknown argument to enable/disable $1) ;; | |
780 | dnl Idea for future: generate a URL pointing to | |
781 | dnl "onlinedocs/configopts.html#whatever" | |
782 | esac | |
783 | ]], | |
784 | [^$], | |
785 | [[ | |
786 | case "$enableval" in | |
787 | yes|no) ;; | |
788 | *) AC_MSG_ERROR(Argument to enable/disable $1 must be yes or no) ;; | |
789 | esac | |
790 | ]], | |
791 | [[$5]]), | |
792 | [enable_]m4_bpatsubst([$1],-,_)[=][$2]) | |
793 | m4_undefine([_g_switch])dnl | |
794 | m4_undefine([_g_help])dnl | |
795 | ]) | |
796 | ||
797 | ||
798 | dnl | |
799 | dnl Check for ISO/IEC 9899:1999 "C99" support. | |
800 | dnl | |
801 | dnl --enable-c99 defines _GLIBCXX_USE_C99 | |
802 | dnl --disable-c99 leaves _GLIBCXX_USE_C99 undefined | |
803 | dnl + Usage: GLIBCXX_ENABLE_C99[(DEFAULT)] | |
804 | dnl Where DEFAULT is either `yes' or `no'. | |
805 | dnl + If 'C99' stuff is not available, ignores DEFAULT and sets `no'. | |
806 | dnl | |
f214923c | 807 | AC_DEFUN([GLIBCXX_ENABLE_C99], [ |
ff66d28f PE |
808 | GLIBCXX_ENABLE(c99,$1,,[turns on ISO/IEC 9899:1999 support]) |
809 | ||
347669a0 BK |
810 | if test x"$enable_c99" = x"yes"; then |
811 | ||
ff66d28f PE |
812 | AC_LANG_SAVE |
813 | AC_LANG_CPLUSPLUS | |
814 | ||
18f310b7 PC |
815 | # Use -std=c++98 because the default (-std=gnu++98) leaves __STRICT_ANSI__ |
816 | # undefined and fake C99 facilities - like pre-standard snprintf - may be | |
817 | # spuriously enabled. | |
818 | # Long term, -std=c++0x could be even better, could manage to explicitely | |
819 | # request C99 facilities to the underlying C headers. | |
b6f914f6 | 820 | ac_save_CXXFLAGS="$CXXFLAGS" |
18f310b7 | 821 | CXXFLAGS="$CXXFLAGS -std=c++98" |
b6f914f6 RS |
822 | ac_save_LIBS="$LIBS" |
823 | ac_save_gcc_no_link="$gcc_no_link" | |
824 | ||
825 | if test x$gcc_no_link != xyes; then | |
826 | # Use -fno-exceptions to that the C driver can link these tests without | |
827 | # hitting undefined references to personality routines. | |
828 | CXXFLAGS="$CXXFLAGS -fno-exceptions" | |
829 | AC_CHECK_LIB(m, sin, [ | |
830 | LIBS="$LIBS -lm" | |
831 | ], [ | |
832 | # Use the default compile-only tests in GCC_TRY_COMPILE_OR_LINK | |
833 | gcc_no_link=yes | |
834 | ]) | |
835 | fi | |
836 | ||
ff66d28f | 837 | # Check for the existence of <math.h> functions used if C99 is enabled. |
ff66d28f | 838 | AC_MSG_CHECKING([for ISO C99 support in <math.h>]) |
6d26724a | 839 | AC_CACHE_VAL(glibcxx_cv_c99_math, [ |
b6f914f6 RS |
840 | GCC_TRY_COMPILE_OR_LINK( |
841 | [#include <math.h> | |
842 | volatile double d1, d2; | |
843 | volatile int i;], | |
844 | [i = fpclassify(d1); | |
845 | i = isfinite(d1); | |
846 | i = isinf(d1); | |
847 | i = isnan(d1); | |
848 | i = isnormal(d1); | |
849 | i = signbit(d1); | |
850 | i = isgreater(d1, d2); | |
851 | i = isgreaterequal(d1, d2); | |
852 | i = isless(d1, d2); | |
853 | i = islessequal(d1, d2); | |
854 | i = islessgreater(d1, d2); | |
855 | i = islessgreater(d1, d2); | |
856 | i = isunordered(d1, d2); | |
6d26724a | 857 | ],[glibcxx_cv_c99_math=yes], [glibcxx_cv_c99_math=no]) |
347669a0 | 858 | ]) |
6d26724a RW |
859 | AC_MSG_RESULT($glibcxx_cv_c99_math) |
860 | if test x"$glibcxx_cv_c99_math" = x"yes"; then | |
4651e622 KC |
861 | AC_DEFINE(_GLIBCXX_USE_C99_MATH, 1, |
862 | [Define if C99 functions or macros in <math.h> should be imported | |
863 | in <cmath> in namespace std.]) | |
517da0ce MM |
864 | fi |
865 | ||
225962a0 | 866 | # Check for the existence of <complex.h> complex math functions. |
52e6723c BK |
867 | # This is necessary even though libstdc++ uses the builtin versions |
868 | # of these functions, because if the builtin cannot be used, a reference | |
869 | # to the library function is emitted. | |
5ad2f32d | 870 | AC_CHECK_HEADERS(tgmath.h, ac_has_tgmath_h=yes, ac_has_tgmath_h=no) |
52e6723c | 871 | AC_CHECK_HEADERS(complex.h, ac_has_complex_h=yes, ac_has_complex_h=no) |
6d26724a | 872 | glibcxx_cv_c99_complex=no; |
52e6723c | 873 | if test x"$ac_has_complex_h" = x"yes"; then |
52e6723c | 874 | AC_MSG_CHECKING([for ISO C99 support in <complex.h>]) |
b6f914f6 RS |
875 | GCC_TRY_COMPILE_OR_LINK( |
876 | [#include <complex.h> | |
877 | typedef __complex__ float float_type; | |
878 | typedef __complex__ double double_type; | |
879 | typedef __complex__ long double ld_type; | |
880 | volatile float_type tmpf; | |
881 | volatile double_type tmpd; | |
882 | volatile ld_type tmpld; | |
883 | volatile float f; | |
884 | volatile double d; | |
885 | volatile long double ld;], | |
886 | [f = cabsf(tmpf); | |
887 | f = cargf(tmpf); | |
888 | tmpf = ccosf(tmpf); | |
889 | tmpf = ccoshf(tmpf); | |
890 | tmpf = cexpf(tmpf); | |
891 | tmpf = clogf(tmpf); | |
892 | tmpf = csinf(tmpf); | |
893 | tmpf = csinhf(tmpf); | |
894 | tmpf = csqrtf(tmpf); | |
895 | tmpf = ctanf(tmpf); | |
896 | tmpf = ctanhf(tmpf); | |
897 | tmpf = cpowf(tmpf, tmpf); | |
3cd54fc9 | 898 | tmpf = cprojf(tmpf); |
b6f914f6 RS |
899 | d = cabs(tmpd); |
900 | d = carg(tmpd); | |
901 | tmpd = ccos(tmpd); | |
902 | tmpd = ccosh(tmpd); | |
903 | tmpd = cexp(tmpd); | |
904 | tmpd = clog(tmpd); | |
905 | tmpd = csin(tmpd); | |
906 | tmpd = csinh(tmpd); | |
907 | tmpd = csqrt(tmpd); | |
908 | tmpd = ctan(tmpd); | |
909 | tmpd = ctanh(tmpd); | |
910 | tmpd = cpow(tmpd, tmpd); | |
3cd54fc9 | 911 | tmpd = cproj(tmpd); |
b6f914f6 RS |
912 | ld = cabsl(tmpld); |
913 | ld = cargl(tmpld); | |
914 | tmpld = ccosl(tmpld); | |
915 | tmpld = ccoshl(tmpld); | |
916 | tmpld = cexpl(tmpld); | |
917 | tmpld = clogl(tmpld); | |
918 | tmpld = csinl(tmpld); | |
919 | tmpld = csinhl(tmpld); | |
920 | tmpld = csqrtl(tmpld); | |
921 | tmpld = ctanl(tmpld); | |
922 | tmpld = ctanhl(tmpld); | |
923 | tmpld = cpowl(tmpld, tmpld); | |
3cd54fc9 | 924 | tmpld = cprojl(tmpld); |
6d26724a | 925 | ],[glibcxx_cv_c99_complex=yes], [glibcxx_cv_c99_complex=no]) |
52e6723c | 926 | fi |
6d26724a RW |
927 | AC_MSG_RESULT($glibcxx_cv_c99_complex) |
928 | if test x"$glibcxx_cv_c99_complex" = x"yes"; then | |
4651e622 KC |
929 | AC_DEFINE(_GLIBCXX_USE_C99_COMPLEX, 1, |
930 | [Define if C99 functions in <complex.h> should be used in | |
931 | <complex>. Using compiler builtins for these functions requires | |
932 | corresponding C99 library functions to be present.]) | |
52e6723c BK |
933 | fi |
934 | ||
ff66d28f | 935 | # Check for the existence in <stdio.h> of vscanf, et. al. |
ff66d28f | 936 | AC_MSG_CHECKING([for ISO C99 support in <stdio.h>]) |
6d26724a | 937 | AC_CACHE_VAL(glibcxx_cv_c99_stdio, [ |
b6f914f6 RS |
938 | GCC_TRY_COMPILE_OR_LINK( |
939 | [#include <stdio.h> | |
940 | #include <stdarg.h> | |
941 | void foo(char* fmt, ...) | |
942 | { | |
943 | va_list args; va_start(args, fmt); | |
944 | vfscanf(stderr, "%i", args); | |
945 | vscanf("%i", args); | |
946 | vsnprintf(fmt, 0, "%i", args); | |
947 | vsscanf(fmt, "%i", args); | |
948 | }], | |
949 | [snprintf("12", 0, "%i");], | |
6d26724a | 950 | [glibcxx_cv_c99_stdio=yes], [glibcxx_cv_c99_stdio=no]) |
347669a0 | 951 | ]) |
6d26724a | 952 | AC_MSG_RESULT($glibcxx_cv_c99_stdio) |
ff66d28f PE |
953 | |
954 | # Check for the existence in <stdlib.h> of lldiv_t, et. al. | |
ff66d28f | 955 | AC_MSG_CHECKING([for ISO C99 support in <stdlib.h>]) |
6d26724a | 956 | AC_CACHE_VAL(glibcxx_cv_c99_stdlib, [ |
b6f914f6 RS |
957 | GCC_TRY_COMPILE_OR_LINK( |
958 | [#include <stdlib.h> | |
959 | volatile float f; | |
960 | volatile long double ld; | |
961 | volatile unsigned long long ll; | |
962 | lldiv_t mydivt;], | |
963 | [char* tmp; | |
964 | f = strtof("gnu", &tmp); | |
965 | ld = strtold("gnu", &tmp); | |
966 | ll = strtoll("gnu", &tmp, 10); | |
967 | ll = strtoull("gnu", &tmp, 10); | |
968 | ll = llabs(10); | |
969 | mydivt = lldiv(10,1); | |
970 | ll = mydivt.quot; | |
971 | ll = mydivt.rem; | |
972 | ll = atoll("10"); | |
973 | _Exit(0); | |
6d26724a | 974 | ],[glibcxx_cv_c99_stdlib=yes], [glibcxx_cv_c99_stdlib=no]) |
347669a0 | 975 | ]) |
6d26724a | 976 | AC_MSG_RESULT($glibcxx_cv_c99_stdlib) |
ff66d28f | 977 | |
8a9b2875 | 978 | # Check for the existence in <wchar.h> of wcstold, etc. |
6d26724a | 979 | glibcxx_cv_c99_wchar=no; |
347669a0 BK |
980 | if test x"$ac_has_wchar_h" = xyes && |
981 | test x"$ac_has_wctype_h" = xyes; then | |
8a9b2875 | 982 | AC_MSG_CHECKING([for ISO C99 support in <wchar.h>]) |
347669a0 | 983 | AC_TRY_COMPILE([#include <wchar.h> |
347669a0 BK |
984 | namespace test |
985 | { | |
347669a0 BK |
986 | using ::wcstold; |
987 | using ::wcstoll; | |
347669a0 | 988 | using ::wcstoull; |
347669a0 | 989 | } |
6d26724a | 990 | ],[],[glibcxx_cv_c99_wchar=yes], [glibcxx_cv_c99_wchar=no]) |
347669a0 BK |
991 | |
992 | # Checks for wide character functions that may not be present. | |
993 | # Injection of these is wrapped with guard macros. | |
994 | # NB: only put functions here, instead of immediately above, if | |
995 | # absolutely necessary. | |
996 | AC_TRY_COMPILE([#include <wchar.h> | |
997 | namespace test { using ::vfwscanf; } ], [], | |
998 | [AC_DEFINE(HAVE_VFWSCANF,1, | |
999 | [Defined if vfwscanf exists.])],[]) | |
1000 | ||
1001 | AC_TRY_COMPILE([#include <wchar.h> | |
1002 | namespace test { using ::vswscanf; } ], [], | |
1003 | [AC_DEFINE(HAVE_VSWSCANF,1, | |
1004 | [Defined if vswscanf exists.])],[]) | |
1005 | ||
1006 | AC_TRY_COMPILE([#include <wchar.h> | |
1007 | namespace test { using ::vwscanf; } ], [], | |
1008 | [AC_DEFINE(HAVE_VWSCANF,1,[Defined if vwscanf exists.])],[]) | |
1009 | ||
1010 | AC_TRY_COMPILE([#include <wchar.h> | |
1011 | namespace test { using ::wcstof; } ], [], | |
1012 | [AC_DEFINE(HAVE_WCSTOF,1,[Defined if wcstof exists.])],[]) | |
1013 | ||
1014 | AC_TRY_COMPILE([#include <wctype.h>], | |
1015 | [ wint_t t; int i = iswblank(t);], | |
1016 | [AC_DEFINE(HAVE_ISWBLANK,1, | |
1017 | [Defined if iswblank exists.])],[]) | |
1018 | ||
6d26724a | 1019 | AC_MSG_RESULT($glibcxx_cv_c99_wchar) |
347669a0 | 1020 | fi |
ff66d28f | 1021 | |
347669a0 | 1022 | # Option parsed, now set things appropriately. |
6d26724a RW |
1023 | if test x"$glibcxx_cv_c99_math" = x"no" || |
1024 | test x"$glibcxx_cv_c99_complex" = x"no" || | |
1025 | test x"$glibcxx_cv_c99_stdio" = x"no" || | |
1026 | test x"$glibcxx_cv_c99_stdlib" = x"no" || | |
1027 | test x"$glibcxx_cv_c99_wchar" = x"no"; then | |
ff66d28f | 1028 | enable_c99=no; |
347669a0 | 1029 | else |
4651e622 KC |
1030 | AC_DEFINE(_GLIBCXX_USE_C99, 1, |
1031 | [Define if C99 functions or macros from <wchar.h>, <math.h>, | |
1032 | <complex.h>, <stdio.h>, and <stdlib.h> can be used or exposed.]) | |
ff66d28f PE |
1033 | fi |
1034 | ||
b6f914f6 RS |
1035 | gcc_no_link="$ac_save_gcc_no_link" |
1036 | LIBS="$ac_save_LIBS" | |
1037 | CXXFLAGS="$ac_save_CXXFLAGS" | |
ff66d28f | 1038 | AC_LANG_RESTORE |
347669a0 BK |
1039 | fi |
1040 | ||
1041 | AC_MSG_CHECKING([for fully enabled ISO C99 support]) | |
1042 | AC_MSG_RESULT($enable_c99) | |
dcfa0bc8 PE |
1043 | ]) |
1044 | ||
1045 | ||
15e38d0d | 1046 | dnl |
959d14e1 CF |
1047 | dnl Check for clock_gettime, nanosleep and sched_yield, used in the |
1048 | dnl implementation of 20.8.5 [time.clock], and 30.2.2 [thread.thread.this] | |
1049 | dnl in the current C++0x working draft. | |
15e38d0d | 1050 | dnl |
959d14e1 CF |
1051 | dnl --enable-libstdcxx-time |
1052 | dnl --enable-libstdcxx-time=yes | |
1053 | dnl checks for the availability of monotonic and realtime clocks, | |
1054 | dnl nanosleep and sched_yield in libc and libposix4 and, in case, links | |
1055 | dnl the latter | |
1056 | dnl --enable-libstdcxx-time=rt | |
6c3385c1 | 1057 | dnl also searches (and, in case, links) librt. Note that this is |
610870b2 | 1058 | dnl not always desirable because, in glibc, for example, in turn it |
6c3385c1 PC |
1059 | dnl triggers the linking of libpthread too, which activates locking, |
1060 | dnl a large overhead for single-thread programs. | |
959d14e1 CF |
1061 | dnl --enable-libstdcxx-time=no |
1062 | dnl --disable-libstdcxx-time | |
610870b2 PC |
1063 | dnl disables the checks completely |
1064 | dnl | |
959d14e1 | 1065 | AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [ |
610870b2 | 1066 | |
959d14e1 CF |
1067 | AC_MSG_CHECKING([for clock_gettime, nanosleep and sched_yield]) |
1068 | GLIBCXX_ENABLE(libstdcxx-time,$1,[=KIND], | |
610870b2 PC |
1069 | [use KIND for check type], |
1070 | [permit yes|no|rt]) | |
15e38d0d CF |
1071 | |
1072 | AC_LANG_SAVE | |
1073 | AC_LANG_CPLUSPLUS | |
1074 | ac_save_CXXFLAGS="$CXXFLAGS" | |
1075 | CXXFLAGS="$CXXFLAGS -fno-exceptions" | |
ec6fa56a PB |
1076 | ac_save_LIBS="$LIBS" |
1077 | ||
959d14e1 | 1078 | ac_has_clock_monotonic=no; |
610870b2 | 1079 | ac_has_clock_realtime=no; |
ec6fa56a | 1080 | |
959d14e1 | 1081 | if test x"$enable_libstdcxx_time" != x"no"; then |
ec6fa56a | 1082 | |
959d14e1 | 1083 | if test x"$enable_libstdcxx_time" = x"rt"; then |
610870b2 | 1084 | AC_SEARCH_LIBS(clock_gettime, [rt posix4]) |
959d14e1 | 1085 | AC_SEARCH_LIBS(nanosleep, [rt posix4]) |
610870b2 PC |
1086 | else |
1087 | AC_SEARCH_LIBS(clock_gettime, [posix4]) | |
959d14e1 | 1088 | AC_SEARCH_LIBS(nanosleep, [posix4]) |
610870b2 PC |
1089 | fi |
1090 | ||
1091 | case "$ac_cv_search_clock_gettime" in | |
1092 | -l*) GLIBCXX_LIBS=$ac_cv_search_clock_gettime | |
959d14e1 CF |
1093 | ;; |
1094 | esac | |
1095 | case "$ac_cv_search_nanosleep" in | |
1096 | -l*) GLIBCXX_LIBS="$GLIBCXX_LIBS $ac_cv_search_nanosleep" | |
1097 | ;; | |
1098 | esac | |
1099 | ||
1100 | AC_SEARCH_LIBS(sched_yield, [rt posix4]) | |
1101 | ||
1102 | case "$ac_cv_search_sched_yield" in | |
1103 | -lposix4*) | |
1104 | GLIBCXX_LIBS="$GLIBCXX_LIBS $ac_cv_search_sched_yield" | |
1105 | AC_DEFINE(_GLIBCXX_USE_SCHED_YIELD, 1, | |
1106 | [ Defined if sched_yield is available. ]) | |
1107 | ;; | |
1108 | -lrt*) | |
1109 | if test x"$enable_libstdcxx_time" = x"rt"; then | |
1110 | GLIBCXX_LIBS="$GLIBCXX_LIBS $ac_cv_search_sched_yield" | |
1111 | AC_DEFINE(_GLIBCXX_USE_SCHED_YIELD, 1, | |
1112 | [ Defined if sched_yield is available. ]) | |
1113 | fi | |
1114 | ;; | |
1115 | *) | |
1116 | AC_DEFINE(_GLIBCXX_USE_SCHED_YIELD, 1, | |
1117 | [ Defined if sched_yield is available. ]) | |
1118 | ;; | |
610870b2 PC |
1119 | esac |
1120 | ||
1121 | AC_CHECK_HEADERS(unistd.h, ac_has_unistd_h=yes, ac_has_unistd_h=no) | |
1122 | ||
1123 | if test x"$ac_has_unistd_h" = x"yes"; then | |
1124 | AC_MSG_CHECKING([for monotonic clock]) | |
1125 | AC_TRY_LINK( | |
1126 | [#include <unistd.h> | |
1127 | #include <time.h> | |
1128 | ], | |
1129 | [#if _POSIX_TIMERS > 0 && defined(_POSIX_MONOTONIC_CLOCK) | |
1130 | timespec tp; | |
1131 | #endif | |
1132 | clock_gettime(CLOCK_MONOTONIC, &tp); | |
1133 | ], [ac_has_clock_monotonic=yes], [ac_has_clock_monotonic=no]) | |
1134 | ||
1135 | AC_MSG_RESULT($ac_has_clock_monotonic) | |
15e38d0d | 1136 | |
610870b2 PC |
1137 | AC_MSG_CHECKING([for realtime clock]) |
1138 | AC_TRY_LINK( | |
1139 | [#include <unistd.h> | |
1140 | #include <time.h> | |
1141 | ], | |
1142 | [#if _POSIX_TIMERS > 0 | |
1143 | timespec tp; | |
1144 | #endif | |
1145 | clock_gettime(CLOCK_REALTIME, &tp); | |
1146 | ], [ac_has_clock_realtime=yes], [ac_has_clock_realtime=no]) | |
1147 | ||
1148 | AC_MSG_RESULT($ac_has_clock_realtime) | |
610870b2 | 1149 | |
959d14e1 CF |
1150 | AC_MSG_CHECKING([for nanosleep]) |
1151 | AC_TRY_LINK( | |
1152 | [#include <unistd.h> | |
1153 | #include <time.h> | |
1154 | ], | |
1155 | [#if _POSIX_TIMERS > 0 | |
1156 | timespec tp; | |
1157 | #endif | |
1158 | nanosleep(&tp, 0); | |
1159 | ], [ac_has_nanosleep=yes], [ac_has_nanosleep=no]) | |
1160 | ||
1161 | AC_MSG_RESULT($ac_has_nanosleep) | |
1162 | fi | |
610870b2 PC |
1163 | fi |
1164 | ||
15e38d0d CF |
1165 | if test x"$ac_has_clock_monotonic" = x"yes"; then |
1166 | AC_DEFINE(_GLIBCXX_USE_CLOCK_MONOTONIC, 1, | |
1167 | [ Defined if clock_gettime has monotonic clock support. ]) | |
1168 | fi | |
ec6fa56a | 1169 | |
15e38d0d CF |
1170 | if test x"$ac_has_clock_realtime" = x"yes"; then |
1171 | AC_DEFINE(_GLIBCXX_USE_CLOCK_REALTIME, 1, | |
1172 | [ Defined if clock_gettime has realtime clock support. ]) | |
1173 | fi | |
ec6fa56a | 1174 | |
959d14e1 CF |
1175 | if test x"$ac_has_nanosleep" = x"yes"; then |
1176 | AC_DEFINE(_GLIBCXX_USE_NANOSLEEP, 1, | |
1177 | [ Defined if nanosleep is available. ]) | |
1178 | fi | |
1179 | ||
ec6fa56a PB |
1180 | AC_SUBST(GLIBCXX_LIBS) |
1181 | ||
15e38d0d | 1182 | CXXFLAGS="$ac_save_CXXFLAGS" |
ec6fa56a | 1183 | LIBS="$ac_save_LIBS" |
15e38d0d CF |
1184 | AC_LANG_RESTORE |
1185 | ]) | |
1186 | ||
1187 | dnl | |
610870b2 PC |
1188 | dnl Check for gettimeofday, used in the implementation of 20.8.5 |
1189 | dnl [time.clock] in the current C++0x working draft. | |
15e38d0d CF |
1190 | dnl |
1191 | AC_DEFUN([GLIBCXX_CHECK_GETTIMEOFDAY], [ | |
1192 | ||
610870b2 PC |
1193 | AC_MSG_CHECKING([for gettimeofday]) |
1194 | ||
15e38d0d CF |
1195 | AC_LANG_SAVE |
1196 | AC_LANG_CPLUSPLUS | |
1197 | ac_save_CXXFLAGS="$CXXFLAGS" | |
1198 | CXXFLAGS="$CXXFLAGS -fno-exceptions" | |
1199 | ||
1200 | ac_has_gettimeofday=no; | |
1201 | AC_CHECK_HEADERS(sys/time.h, ac_has_sys_time_h=yes, ac_has_sys_time_h=no) | |
1202 | if test x"$ac_has_sys_time_h" = x"yes"; then | |
1203 | AC_MSG_CHECKING([for gettimeofday]) | |
610870b2 | 1204 | GCC_TRY_COMPILE_OR_LINK([#include <sys/time.h>], |
15e38d0d CF |
1205 | [timeval tv; gettimeofday(&tv, 0);], |
1206 | [ac_has_gettimeofday=yes], [ac_has_gettimeofday=no]) | |
1207 | ||
1208 | AC_MSG_RESULT($ac_has_gettimeofday) | |
1209 | fi | |
1210 | ||
1211 | if test x"$ac_has_gettimeofday" = x"yes"; then | |
1212 | AC_DEFINE(_GLIBCXX_USE_GETTIMEOFDAY, 1, | |
1213 | [ Defined if gettimeofday is available. ]) | |
1214 | fi | |
1215 | ||
1216 | CXXFLAGS="$ac_save_CXXFLAGS" | |
1217 | AC_LANG_RESTORE | |
1218 | ]) | |
1219 | ||
bd2bb1ea PC |
1220 | dnl |
1221 | dnl Check for ISO/IEC 9899:1999 "C99" support to ISO/IEC DTR 19768 "TR1" | |
1222 | dnl facilities in Chapter 8, "C compatibility". | |
1223 | dnl | |
1224 | AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [ | |
1225 | ||
1226 | AC_LANG_SAVE | |
1227 | AC_LANG_CPLUSPLUS | |
1228 | ||
18f310b7 PC |
1229 | # Use -std=c++98 because the default (-std=gnu++98) leaves __STRICT_ANSI__ |
1230 | # undefined and fake C99 facilities may be spuriously enabled. | |
1231 | ac_save_CXXFLAGS="$CXXFLAGS" | |
1232 | CXXFLAGS="$CXXFLAGS -std=c++98" | |
1233 | ||
bd2bb1ea PC |
1234 | # Check for the existence of <complex.h> complex math functions used |
1235 | # by tr1/complex. | |
1236 | AC_CHECK_HEADERS(complex.h, ac_has_complex_h=yes, ac_has_complex_h=no) | |
1237 | ac_c99_complex_tr1=no; | |
1238 | if test x"$ac_has_complex_h" = x"yes"; then | |
1239 | AC_MSG_CHECKING([for ISO C99 support to TR1 in <complex.h>]) | |
1240 | AC_TRY_COMPILE([#include <complex.h>], | |
1241 | [typedef __complex__ float float_type; float_type tmpf; | |
1242 | cacosf(tmpf); | |
1243 | casinf(tmpf); | |
1244 | catanf(tmpf); | |
1245 | cacoshf(tmpf); | |
1246 | casinhf(tmpf); | |
1247 | catanhf(tmpf); | |
1248 | typedef __complex__ double double_type; double_type tmpd; | |
1249 | cacos(tmpd); | |
1250 | casin(tmpd); | |
1251 | catan(tmpd); | |
1252 | cacosh(tmpd); | |
1253 | casinh(tmpd); | |
1254 | catanh(tmpd); | |
1255 | typedef __complex__ long double ld_type; ld_type tmpld; | |
1256 | cacosl(tmpld); | |
1257 | casinl(tmpld); | |
1258 | catanl(tmpld); | |
1259 | cacoshl(tmpld); | |
1260 | casinhl(tmpld); | |
1261 | catanhl(tmpld); | |
1262 | ],[ac_c99_complex_tr1=yes], [ac_c99_complex_tr1=no]) | |
1263 | fi | |
1264 | AC_MSG_RESULT($ac_c99_complex_tr1) | |
1265 | if test x"$ac_c99_complex_tr1" = x"yes"; then | |
1266 | AC_DEFINE(_GLIBCXX_USE_C99_COMPLEX_TR1, 1, | |
1267 | [Define if C99 functions in <complex.h> should be used in | |
1268 | <tr1/complex>. Using compiler builtins for these functions | |
1269 | requires corresponding C99 library functions to be present.]) | |
1270 | fi | |
1271 | ||
1272 | # Check for the existence of <ctype.h> functions. | |
1273 | AC_MSG_CHECKING([for ISO C99 support to TR1 in <ctype.h>]) | |
6d26724a | 1274 | AC_CACHE_VAL(glibcxx_cv_c99_ctype_tr1, [ |
bd2bb1ea | 1275 | AC_TRY_COMPILE([#include <ctype.h>], |
20921e53 | 1276 | [int ch; |
98fb1d29 PC |
1277 | int ret; |
1278 | ret = isblank(ch); | |
0f24e8de PC |
1279 | ],[glibcxx_cv_c99_ctype_tr1=yes], |
1280 | [glibcxx_cv_c99_ctype_tr1=no]) | |
bd2bb1ea | 1281 | ]) |
6d26724a RW |
1282 | AC_MSG_RESULT($glibcxx_cv_c99_ctype_tr1) |
1283 | if test x"$glibcxx_cv_c99_ctype_tr1" = x"yes"; then | |
bd2bb1ea PC |
1284 | AC_DEFINE(_GLIBCXX_USE_C99_CTYPE_TR1, 1, |
1285 | [Define if C99 functions in <ctype.h> should be imported in | |
1286 | <tr1/cctype> in namespace std::tr1.]) | |
1287 | fi | |
1288 | ||
20921e53 PC |
1289 | # Check for the existence of <fenv.h> functions. |
1290 | AC_CHECK_HEADERS(fenv.h, ac_has_fenv_h=yes, ac_has_fenv_h=no) | |
1291 | ac_c99_fenv_tr1=no; | |
1292 | if test x"$ac_has_fenv_h" = x"yes"; then | |
1293 | AC_MSG_CHECKING([for ISO C99 support to TR1 in <fenv.h>]) | |
1294 | AC_TRY_COMPILE([#include <fenv.h>], | |
1295 | [int except, mode; | |
1296 | fexcept_t* pflag; | |
1297 | fenv_t* penv; | |
98fb1d29 PC |
1298 | int ret; |
1299 | ret = feclearexcept(except); | |
1300 | ret = fegetexceptflag(pflag, except); | |
1301 | ret = feraiseexcept(except); | |
1302 | ret = fesetexceptflag(pflag, except); | |
1303 | ret = fetestexcept(except); | |
1304 | ret = fegetround(); | |
1305 | ret = fesetround(mode); | |
1306 | ret = fegetenv(penv); | |
1307 | ret = feholdexcept(penv); | |
1308 | ret = fesetenv(penv); | |
1309 | ret = feupdateenv(penv); | |
20921e53 PC |
1310 | ],[ac_c99_fenv_tr1=yes], [ac_c99_fenv_tr1=no]) |
1311 | fi | |
1312 | AC_MSG_RESULT($ac_c99_fenv_tr1) | |
1313 | if test x"$ac_c99_fenv_tr1" = x"yes"; then | |
1314 | AC_DEFINE(_GLIBCXX_USE_C99_FENV_TR1, 1, | |
1315 | [Define if C99 functions in <fenv.h> should be imported in | |
1316 | <tr1/cfenv> in namespace std::tr1.]) | |
1317 | fi | |
1318 | ||
2a1d6346 PC |
1319 | # Check for the existence of <stdint.h> types. |
1320 | AC_MSG_CHECKING([for ISO C99 support to TR1 in <stdint.h>]) | |
6d26724a | 1321 | AC_CACHE_VAL(glibcxx_cv_c99_stdint_tr1, [ |
5289e808 PC |
1322 | AC_TRY_COMPILE([#define __STDC_LIMIT_MACROS |
1323 | #define __STDC_CONSTANT_MACROS | |
1324 | #include <stdint.h>], | |
2a1d6346 | 1325 | [typedef int8_t my_int8_t; |
5289e808 PC |
1326 | my_int8_t i8 = INT8_MIN; |
1327 | i8 = INT8_MAX; | |
2a1d6346 | 1328 | typedef int16_t my_int16_t; |
5289e808 PC |
1329 | my_int16_t i16 = INT16_MIN; |
1330 | i16 = INT16_MAX; | |
2a1d6346 | 1331 | typedef int32_t my_int32_t; |
5289e808 PC |
1332 | my_int32_t i32 = INT32_MIN; |
1333 | i32 = INT32_MAX; | |
2a1d6346 | 1334 | typedef int64_t my_int64_t; |
5289e808 PC |
1335 | my_int64_t i64 = INT64_MIN; |
1336 | i64 = INT64_MAX; | |
2a1d6346 | 1337 | typedef int_fast8_t my_int_fast8_t; |
5289e808 PC |
1338 | my_int_fast8_t if8 = INT_FAST8_MIN; |
1339 | if8 = INT_FAST8_MAX; | |
2a1d6346 | 1340 | typedef int_fast16_t my_int_fast16_t; |
5289e808 PC |
1341 | my_int_fast16_t if16 = INT_FAST16_MIN; |
1342 | if16 = INT_FAST16_MAX; | |
2a1d6346 | 1343 | typedef int_fast32_t my_int_fast32_t; |
5289e808 PC |
1344 | my_int_fast32_t if32 = INT_FAST32_MIN; |
1345 | if32 = INT_FAST32_MAX; | |
1346 | typedef int_fast64_t my_int_fast64_t; | |
1347 | my_int_fast64_t if64 = INT_FAST64_MIN; | |
1348 | if64 = INT_FAST64_MAX; | |
2a1d6346 | 1349 | typedef int_least8_t my_int_least8_t; |
5289e808 PC |
1350 | my_int_least8_t il8 = INT_LEAST8_MIN; |
1351 | il8 = INT_LEAST8_MAX; | |
2a1d6346 | 1352 | typedef int_least16_t my_int_least16_t; |
5289e808 PC |
1353 | my_int_least16_t il16 = INT_LEAST16_MIN; |
1354 | il16 = INT_LEAST16_MAX; | |
2a1d6346 | 1355 | typedef int_least32_t my_int_least32_t; |
5289e808 PC |
1356 | my_int_least32_t il32 = INT_LEAST32_MIN; |
1357 | il32 = INT_LEAST32_MAX; | |
2a1d6346 | 1358 | typedef int_least64_t my_int_least64_t; |
5289e808 PC |
1359 | my_int_least64_t il64 = INT_LEAST64_MIN; |
1360 | il64 = INT_LEAST64_MAX; | |
2a1d6346 | 1361 | typedef intmax_t my_intmax_t; |
5289e808 PC |
1362 | my_intmax_t im = INTMAX_MAX; |
1363 | im = INTMAX_MIN; | |
2a1d6346 | 1364 | typedef intptr_t my_intptr_t; |
5289e808 PC |
1365 | my_intptr_t ip = INTPTR_MAX; |
1366 | ip = INTPTR_MIN; | |
2a1d6346 | 1367 | typedef uint8_t my_uint8_t; |
5289e808 PC |
1368 | my_uint8_t ui8 = UINT8_MAX; |
1369 | ui8 = UINT8_MAX; | |
2a1d6346 | 1370 | typedef uint16_t my_uint16_t; |
5289e808 PC |
1371 | my_uint16_t ui16 = UINT16_MAX; |
1372 | ui16 = UINT16_MAX; | |
2a1d6346 | 1373 | typedef uint32_t my_uint32_t; |
5289e808 PC |
1374 | my_uint32_t ui32 = UINT32_MAX; |
1375 | ui32 = UINT32_MAX; | |
2a1d6346 | 1376 | typedef uint64_t my_uint64_t; |
5289e808 PC |
1377 | my_uint64_t ui64 = UINT64_MAX; |
1378 | ui64 = UINT64_MAX; | |
2a1d6346 | 1379 | typedef uint_fast8_t my_uint_fast8_t; |
5289e808 PC |
1380 | my_uint_fast8_t uif8 = UINT_FAST8_MAX; |
1381 | uif8 = UINT_FAST8_MAX; | |
2a1d6346 | 1382 | typedef uint_fast16_t my_uint_fast16_t; |
5289e808 PC |
1383 | my_uint_fast16_t uif16 = UINT_FAST16_MAX; |
1384 | uif16 = UINT_FAST16_MAX; | |
2a1d6346 | 1385 | typedef uint_fast32_t my_uint_fast32_t; |
5289e808 PC |
1386 | my_uint_fast32_t uif32 = UINT_FAST32_MAX; |
1387 | uif32 = UINT_FAST32_MAX; | |
1388 | typedef uint_fast64_t my_uint_fast64_t; | |
1389 | my_uint_fast64_t uif64 = UINT_FAST64_MAX; | |
1390 | uif64 = UINT_FAST64_MAX; | |
2a1d6346 | 1391 | typedef uint_least8_t my_uint_least8_t; |
5289e808 PC |
1392 | my_uint_least8_t uil8 = UINT_LEAST8_MAX; |
1393 | uil8 = UINT_LEAST8_MAX; | |
2a1d6346 | 1394 | typedef uint_least16_t my_uint_least16_t; |
5289e808 PC |
1395 | my_uint_least16_t uil16 = UINT_LEAST16_MAX; |
1396 | uil16 = UINT_LEAST16_MAX; | |
2a1d6346 | 1397 | typedef uint_least32_t my_uint_least32_t; |
5289e808 PC |
1398 | my_uint_least32_t uil32 = UINT_LEAST32_MAX; |
1399 | uil32 = UINT_LEAST32_MAX; | |
2a1d6346 | 1400 | typedef uint_least64_t my_uint_least64_t; |
5289e808 PC |
1401 | my_uint_least64_t uil64 = UINT_LEAST64_MAX; |
1402 | uil64 = UINT_LEAST64_MAX; | |
2a1d6346 | 1403 | typedef uintmax_t my_uintmax_t; |
5289e808 PC |
1404 | my_uintmax_t uim = UINTMAX_MAX; |
1405 | uim = UINTMAX_MAX; | |
2a1d6346 | 1406 | typedef uintptr_t my_uintptr_t; |
5289e808 PC |
1407 | my_uintptr_t uip = UINTPTR_MAX; |
1408 | uip = UINTPTR_MAX; | |
0f24e8de PC |
1409 | ],[glibcxx_cv_c99_stdint_tr1=yes], |
1410 | [glibcxx_cv_c99_stdint_tr1=no]) | |
2a1d6346 | 1411 | ]) |
6d26724a RW |
1412 | AC_MSG_RESULT($glibcxx_cv_c99_stdint_tr1) |
1413 | if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then | |
2a1d6346 PC |
1414 | AC_DEFINE(_GLIBCXX_USE_C99_STDINT_TR1, 1, |
1415 | [Define if C99 types in <stdint.h> should be imported in | |
1416 | <tr1/cstdint> in namespace std::tr1.]) | |
1417 | fi | |
1418 | ||
4f0de5dd PC |
1419 | # Check for the existence of <math.h> functions. |
1420 | AC_MSG_CHECKING([for ISO C99 support to TR1 in <math.h>]) | |
6d26724a | 1421 | AC_CACHE_VAL(glibcxx_cv_c99_math_tr1, [ |
4f0de5dd | 1422 | AC_TRY_COMPILE([#include <math.h>], |
9a7ab578 PC |
1423 | [typedef double_t my_double_t; |
1424 | typedef float_t my_float_t; | |
1425 | acosh(0.0); | |
4f0de5dd PC |
1426 | acoshf(0.0f); |
1427 | acoshl(0.0l); | |
1428 | asinh(0.0); | |
1429 | asinhf(0.0f); | |
1430 | asinhl(0.0l); | |
1431 | atanh(0.0); | |
1432 | atanhf(0.0f); | |
1433 | atanhl(0.0l); | |
1434 | cbrt(0.0); | |
1435 | cbrtf(0.0f); | |
1436 | cbrtl(0.0l); | |
1437 | copysign(0.0, 0.0); | |
1438 | copysignf(0.0f, 0.0f); | |
1439 | copysignl(0.0l, 0.0l); | |
1440 | erf(0.0); | |
1441 | erff(0.0f); | |
1442 | erfl(0.0l); | |
1443 | erfc(0.0); | |
1444 | erfcf(0.0f); | |
1445 | erfcl(0.0l); | |
1446 | exp2(0.0); | |
1447 | exp2f(0.0f); | |
1448 | exp2l(0.0l); | |
1449 | expm1(0.0); | |
1450 | expm1f(0.0f); | |
1451 | expm1l(0.0l); | |
1452 | fdim(0.0, 0.0); | |
1453 | fdimf(0.0f, 0.0f); | |
1454 | fdiml(0.0l, 0.0l); | |
1455 | fma(0.0, 0.0, 0.0); | |
1456 | fmaf(0.0f, 0.0f, 0.0f); | |
1457 | fmal(0.0l, 0.0l, 0.0l); | |
1458 | fmax(0.0, 0.0); | |
1459 | fmaxf(0.0f, 0.0f); | |
1460 | fmaxl(0.0l, 0.0l); | |
1461 | fmin(0.0, 0.0); | |
1462 | fminf(0.0f, 0.0f); | |
1463 | fminl(0.0l, 0.0l); | |
1464 | hypot(0.0, 0.0); | |
1465 | hypotf(0.0f, 0.0f); | |
1466 | hypotl(0.0l, 0.0l); | |
1467 | ilogb(0.0); | |
1468 | ilogbf(0.0f); | |
1469 | ilogbl(0.0l); | |
1470 | lgamma(0.0); | |
1471 | lgammaf(0.0f); | |
1472 | lgammal(0.0l); | |
1473 | llrint(0.0); | |
1474 | llrintf(0.0f); | |
1475 | llrintl(0.0l); | |
1476 | llround(0.0); | |
1477 | llroundf(0.0f); | |
1478 | llroundl(0.0l); | |
1479 | log1p(0.0); | |
1480 | log1pf(0.0f); | |
1481 | log1pl(0.0l); | |
1482 | log2(0.0); | |
1483 | log2f(0.0f); | |
1484 | log2l(0.0l); | |
1485 | logb(0.0); | |
1486 | logbf(0.0f); | |
1487 | logbl(0.0l); | |
1488 | lrint(0.0); | |
1489 | lrintf(0.0f); | |
1490 | lrintl(0.0l); | |
1491 | lround(0.0); | |
1492 | lroundf(0.0f); | |
1493 | lroundl(0.0l); | |
1494 | nan(0); | |
1495 | nanf(0); | |
1496 | nanl(0); | |
1497 | nearbyint(0.0); | |
1498 | nearbyintf(0.0f); | |
1499 | nearbyintl(0.0l); | |
1500 | nextafter(0.0, 0.0); | |
1501 | nextafterf(0.0f, 0.0f); | |
1502 | nextafterl(0.0l, 0.0l); | |
1503 | nexttoward(0.0, 0.0); | |
1504 | nexttowardf(0.0f, 0.0f); | |
1505 | nexttowardl(0.0l, 0.0l); | |
1506 | remainder(0.0, 0.0); | |
1507 | remainderf(0.0f, 0.0f); | |
1508 | remainderl(0.0l, 0.0l); | |
1509 | remquo(0.0, 0.0, 0); | |
a5d137be PC |
1510 | remquof(0.0f, 0.0f, 0); |
1511 | remquol(0.0l, 0.0l, 0); | |
4f0de5dd PC |
1512 | rint(0.0); |
1513 | rintf(0.0f); | |
1514 | rintl(0.0l); | |
1515 | round(0.0); | |
1516 | roundf(0.0f); | |
1517 | roundl(0.0l); | |
1518 | scalbln(0.0, 0l); | |
1519 | scalblnf(0.0f, 0l); | |
1520 | scalblnl(0.0l, 0l); | |
1521 | scalbn(0.0, 0); | |
1522 | scalbnf(0.0f, 0); | |
1523 | scalbnl(0.0l, 0); | |
1524 | tgamma(0.0); | |
1525 | tgammaf(0.0f); | |
1526 | tgammal(0.0l); | |
1527 | trunc(0.0); | |
1528 | truncf(0.0f); | |
1529 | truncl(0.0l); | |
6d26724a | 1530 | ],[glibcxx_cv_c99_math_tr1=yes], [glibcxx_cv_c99_math_tr1=no]) |
4f0de5dd | 1531 | ]) |
6d26724a RW |
1532 | AC_MSG_RESULT($glibcxx_cv_c99_math_tr1) |
1533 | if test x"$glibcxx_cv_c99_math_tr1" = x"yes"; then | |
4f0de5dd PC |
1534 | AC_DEFINE(_GLIBCXX_USE_C99_MATH_TR1, 1, |
1535 | [Define if C99 functions or macros in <math.h> should be imported | |
1536 | in <tr1/cmath> in namespace std::tr1.]) | |
1537 | fi | |
1538 | ||
03bf3bc1 | 1539 | # Check for the existence of <inttypes.h> functions (NB: doesn't make |
a834e097 | 1540 | # sense if the glibcxx_cv_c99_stdint_tr1 check fails, per C99, 7.8/1). |
03bf3bc1 | 1541 | ac_c99_inttypes_tr1=no; |
6d26724a | 1542 | if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then |
03bf3bc1 PC |
1543 | AC_MSG_CHECKING([for ISO C99 support to TR1 in <inttypes.h>]) |
1544 | AC_TRY_COMPILE([#include <inttypes.h>], | |
1545 | [intmax_t i, numer, denom, base; | |
1546 | const char* s; | |
1547 | char** endptr; | |
af66a43e PC |
1548 | intmax_t ret = imaxabs(i); |
1549 | imaxdiv_t dret = imaxdiv(numer, denom); | |
03bf3bc1 | 1550 | ret = strtoimax(s, endptr, base); |
af66a43e | 1551 | uintmax_t uret = strtoumax(s, endptr, base); |
03bf3bc1 PC |
1552 | ],[ac_c99_inttypes_tr1=yes], [ac_c99_inttypes_tr1=no]) |
1553 | fi | |
52a64bd3 PC |
1554 | AC_MSG_RESULT($ac_c99_inttypes_tr1) |
1555 | if test x"$ac_c99_inttypes_tr1" = x"yes"; then | |
1556 | AC_DEFINE(_GLIBCXX_USE_C99_INTTYPES_TR1, 1, | |
1557 | [Define if C99 functions in <inttypes.h> should be imported in | |
03bf3bc1 | 1558 | <tr1/cinttypes> in namespace std::tr1.]) |
52a64bd3 PC |
1559 | fi |
1560 | ||
a834e097 PC |
1561 | # Check for the existence of whcar_t <inttypes.h> functions (NB: doesn't |
1562 | # make sense if the glibcxx_cv_c99_stdint_tr1 check fails, per C99, 7.8/1). | |
1563 | ac_c99_inttypes_wchar_t_tr1=no; | |
1564 | if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then | |
1565 | AC_MSG_CHECKING([for wchar_t ISO C99 support to TR1 in <inttypes.h>]) | |
1566 | AC_TRY_COMPILE([#include <inttypes.h>], | |
1567 | [intmax_t base; | |
1568 | const wchar_t* s; | |
1569 | wchar_t** endptr; | |
1570 | intmax_t ret = wcstoimax(s, endptr, base); | |
1571 | uintmax_t uret = wcstoumax(s, endptr, base); | |
1572 | ],[ac_c99_inttypes_wchar_t_tr1=yes], | |
1573 | [ac_c99_inttypes_wchar_t_tr1=no]) | |
1574 | fi | |
1575 | AC_MSG_RESULT($ac_c99_inttypes_wchar_t_tr1) | |
1576 | if test x"$ac_c99_inttypes_wchar_t_tr1" = x"yes"; then | |
1577 | AC_DEFINE(_GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1, 1, | |
1578 | [Define if wchar_t C99 functions in <inttypes.h> should be | |
1579 | imported in <tr1/cinttypes> in namespace std::tr1.]) | |
1580 | fi | |
1581 | ||
1e41a98c PC |
1582 | # Check for the existence of the <stdbool.h> header. |
1583 | AC_CHECK_HEADERS(stdbool.h) | |
1584 | ||
18f310b7 | 1585 | CXXFLAGS="$ac_save_CXXFLAGS" |
bd2bb1ea PC |
1586 | AC_LANG_RESTORE |
1587 | ]) | |
1588 | ||
d8bc9819 | 1589 | dnl |
9ce0a22e | 1590 | dnl Check whether "/dev/random" and "/dev/urandom" are available for the |
d8bc9819 PC |
1591 | dnl random_device of "TR1" (Chapter 5.1, "Random number generation"). |
1592 | dnl | |
1593 | AC_DEFUN([GLIBCXX_CHECK_RANDOM_TR1], [ | |
1594 | ||
9ce0a22e | 1595 | AC_MSG_CHECKING([for "/dev/random" and "/dev/urandom" for TR1 random_device]) |
6d26724a | 1596 | AC_CACHE_VAL(glibcxx_cv_random_tr1, [ |
9ce0a22e PC |
1597 | if test -r /dev/random && test -r /dev/urandom; then |
1598 | glibcxx_cv_random_tr1=yes; | |
1599 | else | |
1600 | glibcxx_cv_random_tr1=no; | |
1601 | fi | |
d8bc9819 | 1602 | ]) |
6d26724a | 1603 | AC_MSG_RESULT($glibcxx_cv_random_tr1) |
9ce0a22e | 1604 | |
6d26724a | 1605 | if test x"$glibcxx_cv_random_tr1" = x"yes"; then |
d8bc9819 | 1606 | AC_DEFINE(_GLIBCXX_USE_RANDOM_TR1, 1, |
9ce0a22e | 1607 | [Define if /dev/random and /dev/urandom are available for |
d8bc9819 PC |
1608 | the random_device of TR1 (Chapter 5.1).]) |
1609 | fi | |
1610 | ||
1611 | ]) | |
bd2bb1ea | 1612 | |
1814157e PC |
1613 | dnl |
1614 | dnl Check whether EOF, SEEK_CUR, and SEEK_END have the most common values: | |
1615 | dnl in that case including <cstdio> in some C++ headers can be avoided. | |
1616 | dnl | |
1617 | AC_DEFUN([GLIBCXX_CHECK_STDIO_MACROS], [ | |
1618 | ||
1619 | AC_MSG_CHECKING([for EOF == -1, SEEK_CUR == 1, SEEK_END == 2]) | |
1620 | AC_CACHE_VAL(glibcxx_cv_stdio_macros, [ | |
1621 | AC_TRY_COMPILE([#include <stdio.h>], | |
1622 | [#if ((EOF != -1) || (SEEK_CUR != 1) || (SEEK_END != 2)) | |
1623 | unusual values... | |
1624 | #endif | |
1625 | ], [glibcxx_cv_stdio_macros=yes], | |
1626 | [glibcxx_cv_stdio_macros=no]) | |
1627 | ]) | |
1628 | AC_MSG_RESULT($glibcxx_cv_stdio_macros) | |
1629 | if test x"$glibcxx_cv_stdio_macros" = x"yes"; then | |
1630 | AC_DEFINE(_GLIBCXX_STDIO_MACROS, 1, | |
1631 | [Define if EOF == -1, SEEK_CUR == 1, SEEK_END == 2.]) | |
1632 | fi | |
1633 | ||
1634 | ]) | |
1635 | ||
0646d8a3 BK |
1636 | dnl |
1637 | dnl Check whether macros, etc are present for <system_error> | |
1638 | dnl | |
1639 | AC_DEFUN([GLIBCXX_CHECK_SYSTEM_ERROR], [ | |
1640 | ||
6d26724a RW |
1641 | m4_pushdef([n_syserr], [1])dnl |
1642 | m4_foreach([syserr], [EOWNERDEAD, ENOTRECOVERABLE, ENOLINK, EPROTO, ENODATA, | |
70593ad2 | 1643 | ENOSR, ENOSTR, ETIME, EBADMSG, ECANCELED, |
6d26724a RW |
1644 | EOVERFLOW, ENOTSUP, EIDRM, ETXTBSY], |
1645 | [m4_pushdef([SYSERR], m4_toupper(syserr))dnl | |
1646 | AC_MSG_CHECKING([for syserr]) | |
1647 | AC_CACHE_VAL([glibcxx_cv_system_error[]n_syserr], [ | |
1648 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <errno.h>]], | |
1649 | [int i = syserr;])], | |
1650 | [glibcxx_cv_system_error[]n_syserr=yes], | |
1651 | [glibcxx_cv_system_error[]n_syserr=no]) | |
1652 | ]) | |
1653 | AC_MSG_RESULT([$glibcxx_cv_system_error[]n_syserr]) | |
1654 | if test x"$glibcxx_cv_system_error[]n_syserr" = x"yes"; then | |
1655 | AC_DEFINE([HAVE_]SYSERR, 1, [Define if ]syserr[ exists.]) | |
1656 | fi | |
1657 | m4_define([n_syserr], m4_incr(n_syserr))dnl | |
1658 | m4_popdef([SYSERR])dnl | |
1659 | ]) | |
1660 | m4_popdef([n_syserr])dnl | |
0646d8a3 BK |
1661 | ]) |
1662 | ||
0214010c | 1663 | dnl |
ff66d28f PE |
1664 | dnl Check for what type of C headers to use. |
1665 | dnl | |
1666 | dnl --enable-cheaders= [does stuff]. | |
1667 | dnl --disable-cheaders [does not do anything, really]. | |
1668 | dnl + Usage: GLIBCXX_ENABLE_CHEADERS[(DEFAULT)] | |
af13a7a6 | 1669 | dnl Where DEFAULT is either 'c' or 'c_std' or 'c_global'. |
ff66d28f | 1670 | dnl |
f214923c | 1671 | AC_DEFUN([GLIBCXX_ENABLE_CHEADERS], [ |
ff66d28f | 1672 | GLIBCXX_ENABLE(cheaders,$1,[=KIND], |
af13a7a6 | 1673 | [construct "C" headers for g++], [permit c|c_std|c_global]) |
ff66d28f PE |
1674 | AC_MSG_NOTICE("C" header strategy set to $enable_cheaders) |
1675 | ||
1676 | C_INCLUDE_DIR='${glibcxx_srcdir}/include/'$enable_cheaders | |
1677 | ||
af13a7a6 BK |
1678 | # Allow overrides to configure.host here. |
1679 | if test $enable_cheaders = c_global; then | |
1680 | c_compatibility=yes | |
1681 | fi | |
1682 | ||
1683 | if test $enable_cheaders = c_global || test $enable_cheaders = c_std; then | |
1684 | c_extra=yes | |
1685 | fi | |
1686 | ||
ff66d28f | 1687 | AC_SUBST(C_INCLUDE_DIR) |
92eabea2 PE |
1688 | GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C, test $enable_cheaders = c) |
1689 | GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C_STD, test $enable_cheaders = c_std) | |
af13a7a6 | 1690 | GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C_GLOBAL, test $enable_cheaders = c_global) |
92eabea2 | 1691 | GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_COMPATIBILITY, test $c_compatibility = yes) |
af13a7a6 | 1692 | GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_EXTRA, test $c_extra = yes) |
ff66d28f PE |
1693 | ]) |
1694 | ||
1695 | ||
0214010c | 1696 | dnl |
ff66d28f PE |
1697 | dnl Check for which locale library to use. The choice is mapped to |
1698 | dnl a subdirectory of config/locale. | |
37bc6ca2 | 1699 | dnl |
ff66d28f | 1700 | dnl Default is generic. |
0214010c | 1701 | dnl |
f214923c | 1702 | AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [ |
ff66d28f PE |
1703 | GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@], |
1704 | [use MODEL for target locale package], | |
1705 | [permit generic|gnu|ieee_1003.1-2001|yes|no|auto]) | |
0258dc3a BK |
1706 | |
1707 | # Deal with gettext issues. Default to not using it (=no) until we detect | |
1708 | # support for it later. Let the user turn it off via --e/d, but let that | |
1709 | # default to on for easier handling. | |
1710 | USE_NLS=no | |
1711 | AC_ARG_ENABLE(nls, | |
1712 | AC_HELP_STRING([--enable-nls],[use Native Language Support (default)]), | |
1713 | [], | |
1714 | [enable_nls=yes]) | |
ff66d28f | 1715 | |
0258dc3a | 1716 | # Either a known packaage, or "auto" |
ff66d28f PE |
1717 | if test $enable_clocale = no || test $enable_clocale = yes; then |
1718 | enable_clocale=auto | |
1719 | fi | |
0214010c BK |
1720 | enable_clocale_flag=$enable_clocale |
1721 | ||
0258dc3a | 1722 | # Probe for locale model to use if none specified. |
ff66d28f PE |
1723 | # Default to "generic". |
1724 | if test $enable_clocale_flag = auto; then | |
7d3998a4 PE |
1725 | case ${target_os} in |
1726 | linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) | |
0258dc3a | 1727 | enable_clocale_flag=gnu |
56deb74c | 1728 | ;; |
a7f7b334 | 1729 | darwin* | freebsd*) |
f9686024 GK |
1730 | enable_clocale_flag=darwin |
1731 | ;; | |
56deb74c | 1732 | *) |
ff66d28f PE |
1733 | enable_clocale_flag=generic |
1734 | ;; | |
56deb74c BK |
1735 | esac |
1736 | fi | |
1737 | ||
0258dc3a BK |
1738 | # Sanity check model, and test for special functionality. |
1739 | if test $enable_clocale_flag = gnu; then | |
1740 | AC_EGREP_CPP([_GLIBCXX_ok], [ | |
1741 | #include <features.h> | |
1742 | #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) | |
1743 | _GLIBCXX_ok | |
1744 | #endif | |
1745 | ], enable_clocale_flag=gnu, enable_clocale_flag=generic) | |
1746 | ||
1ba74130 PC |
1747 | if test $enable_clocale = auto; then |
1748 | # Test for bugs early in glibc-2.2.x series | |
1749 | AC_TRY_RUN([ | |
1750 | #define _GNU_SOURCE 1 | |
1751 | #include <locale.h> | |
1752 | #include <string.h> | |
1753 | #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) | |
1754 | extern __typeof(newlocale) __newlocale; | |
1755 | extern __typeof(duplocale) __duplocale; | |
1756 | extern __typeof(strcoll_l) __strcoll_l; | |
1757 | #endif | |
1758 | int main() | |
1759 | { | |
1760 |