]>
Commit | Line | Data |
---|---|---|
92eabea2 PE |
1 | dnl |
2 | dnl GLIBCXX_CONDITIONAL (NAME, SHELL-TEST) | |
3 | dnl | |
4 | dnl Exactly like AM_CONDITIONAL, but delays evaluation of the test until the | |
5 | dnl end of configure. This lets tested variables be reassigned, and the | |
6 | dnl conditional will depend on the final state of the variable. For a simple | |
7 | dnl example of why this is needed, see GLIBCXX_ENABLE_HOSTED. | |
8 | dnl | |
9 | m4_define([_m4_divert(glibcxx_diversion)], 8000)dnl | |
f214923c | 10 | AC_DEFUN([GLIBCXX_CONDITIONAL], [dnl |
92eabea2 PE |
11 | m4_divert_text([glibcxx_diversion],dnl |
12 | AM_CONDITIONAL([$1],[$2]) | |
13 | )dnl | |
14 | ])dnl | |
f214923c | 15 | AC_DEFUN([GLIBCXX_EVALUATE_CONDITIONALS], [m4_undivert([glibcxx_diversion])])dnl |
92eabea2 PE |
16 | |
17 | ||
ff66d28f PE |
18 | dnl |
19 | dnl Check to see what architecture and operating system we are compiling | |
20 | dnl for. Also, if architecture- or OS-specific flags are required for | |
21 | dnl compilation, pick them up here. | |
22 | dnl | |
f214923c | 23 | AC_DEFUN([GLIBCXX_CHECK_HOST], [ |
ff66d28f | 24 | . $glibcxx_srcdir/configure.host |
f214923c BK |
25 | AC_MSG_NOTICE([CPU config directory is $cpu_include_dir]) |
26 | AC_MSG_NOTICE([OS config directory is $os_include_dir]) | |
ff66d28f PE |
27 | ]) |
28 | ||
ff66d28f PE |
29 | dnl |
30 | dnl Initialize the rest of the library configury. At this point we have | |
31 | dnl variables like $host. | |
aebb8c22 | 32 | dnl |
ff66d28f | 33 | dnl Sets: |
82ba99d5 | 34 | dnl SUBDIRS |
ff66d28f PE |
35 | dnl Substs: |
36 | dnl glibcxx_builddir (absolute path) | |
37 | dnl glibcxx_srcdir (absolute path) | |
5d1c8e77 | 38 | dnl toplevel_builddir (absolute path) |
ff66d28f PE |
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. | |
ea63396f | 52 | m4_define([glibcxx_SUBDIRS],[include libsupc++ src src/c++98 src/c++11 src/c++17 src/c++20 src/filesystem src/libbacktrace src/experimental doc po testsuite python]) |
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 |
5d1c8e77 | 63 | toplevel_builddir=${glibcxx_builddir}/.. |
ff66d28f | 64 | toplevel_srcdir=${glibcxx_srcdir}/.. |
3d7c150e BK |
65 | AC_SUBST(glibcxx_builddir) |
66 | AC_SUBST(glibcxx_srcdir) | |
5d1c8e77 | 67 | AC_SUBST(toplevel_builddir) |
ff66d28f | 68 | AC_SUBST(toplevel_srcdir) |
d2caef2e | 69 | |
ff66d28f PE |
70 | # We use these options to decide which functions to include. They are |
71 | # set from the top level. | |
72 | AC_ARG_WITH([target-subdir], | |
73 | AC_HELP_STRING([--with-target-subdir=SUBDIR], | |
b329dd10 | 74 | [configuring in a subdirectory])) |
ff66d28f PE |
75 | |
76 | AC_ARG_WITH([cross-host], | |
77 | AC_HELP_STRING([--with-cross-host=HOST], | |
b329dd10 | 78 | [configuring with a cross compiler])) |
ff66d28f PE |
79 | |
80 | AC_ARG_WITH([newlib], | |
81 | AC_HELP_STRING([--with-newlib], | |
b329dd10 | 82 | [assume newlib as a system C library])) |
ff66d28f | 83 | |
ff66d28f PE |
84 | # Will set LN_S to either 'ln -s', 'ln', or 'cp -p' (if linking isn't |
85 | # available). Uncomment the next line to force a particular method. | |
86 | AC_PROG_LN_S | |
87 | #LN_S='cp -p' | |
88 | ||
5780a46b BK |
89 | AC_CHECK_TOOL(AS, as) |
90 | AC_CHECK_TOOL(AR, ar) | |
46840bcd | 91 | AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error) |
b2dad0e3 | 92 | |
5780a46b | 93 | AM_MAINTAINER_MODE |
b2dad0e3 | 94 | |
92eabea2 PE |
95 | # Set up safe default values for all subsequent AM_CONDITIONAL tests |
96 | # which are themselves conditionally expanded. | |
97 | ## (Right now, this only matters for enable_wchar_t, but nothing prevents | |
98 | ## other macros from doing the same. This should be automated.) -pme | |
16da539b | 99 | |
176d6eb0 GP |
100 | # Check for C library flavor since GNU/Linux platforms use different |
101 | # configuration directories depending on the C library in use. | |
464aea98 JM |
102 | AC_EGREP_CPP([_using_uclibc], [ |
103 | #include <stdio.h> | |
104 | #if __UCLIBC__ | |
105 | _using_uclibc | |
106 | #endif | |
107 | ], uclibc=yes, uclibc=no) | |
108 | ||
aa6a73b9 MK |
109 | AC_EGREP_CPP([_using_bionic], [ |
110 | #include <stdio.h> | |
111 | #if __BIONIC__ | |
112 | _using_bionic | |
113 | #endif | |
114 | ], bionic=yes, bionic=no) | |
115 | ||
ff66d28f PE |
116 | # Find platform-specific directories containing configuration info. |
117 | # Also possibly modify flags used elsewhere, as needed by the platform. | |
3d7c150e | 118 | GLIBCXX_CHECK_HOST |
b2dad0e3 BK |
119 | ]) |
120 | ||
121 | ||
c470c17d | 122 | dnl |
52b55e7d PE |
123 | dnl Tests for newer compiler features, or features that are present in newer |
124 | dnl compiler versions but not older compiler versions still in use, should | |
125 | dnl be placed here. | |
b2dad0e3 | 126 | dnl |
ff66d28f PE |
127 | dnl Defines: |
128 | dnl WERROR='-Werror' if requested and possible; g++'s that lack the | |
129 | dnl new inlining code or the new system_header pragma will die on -Werror. | |
130 | dnl Leave it out by default and use maint-mode to use it. | |
131 | dnl SECTION_FLAGS='-ffunction-sections -fdata-sections' if | |
132 | dnl compiler supports it and the user has not requested debug mode. | |
c21b6f87 | 133 | dnl |
f214923c | 134 | AC_DEFUN([GLIBCXX_CHECK_COMPILER_FEATURES], [ |
a4e99046 | 135 | # All these tests are for C++; save the language and the compiler flags. |
52b55e7d | 136 | # The CXXFLAGS thing is suspicious, but based on similar bits previously |
3d7c150e | 137 | # found in GLIBCXX_CONFIGURE. |
a4e99046 PE |
138 | AC_LANG_SAVE |
139 | AC_LANG_CPLUSPLUS | |
140 | ac_test_CXXFLAGS="${CXXFLAGS+set}" | |
141 | ac_save_CXXFLAGS="$CXXFLAGS" | |
a4e99046 | 142 | |
c470c17d BK |
143 | # Check for -ffunction-sections -fdata-sections |
144 | AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections]) | |
85ee35ca BK |
145 | CXXFLAGS='-g -Werror -ffunction-sections -fdata-sections' |
146 | AC_TRY_COMPILE([int foo; void bar() { };],, [ac_fdsections=yes], [ac_fdsections=no]) | |
c470c17d BK |
147 | if test "$ac_test_CXXFLAGS" = set; then |
148 | CXXFLAGS="$ac_save_CXXFLAGS" | |
149 | else | |
150 | # this is the suspicious part | |
151 | CXXFLAGS='' | |
152 | fi | |
6aa43d99 | 153 | if test x"$ac_fdsections" = x"yes"; then |
c470c17d BK |
154 | SECTION_FLAGS='-ffunction-sections -fdata-sections' |
155 | fi | |
156 | AC_MSG_RESULT($ac_fdsections) | |
157 | ||
a4e99046 | 158 | AC_LANG_RESTORE |
c470c17d | 159 | AC_SUBST(SECTION_FLAGS) |
b2dad0e3 BK |
160 | ]) |
161 | ||
c470c17d BK |
162 | |
163 | dnl | |
421173e6 PE |
164 | dnl If GNU ld is in use, check to see if tricky linker opts can be used. If |
165 | dnl the native linker is in use, all variables will be defined to something | |
166 | dnl safe (like an empty string). | |
167 | dnl | |
ff66d28f PE |
168 | dnl Defines: |
169 | dnl SECTION_LDFLAGS='-Wl,--gc-sections' if possible | |
a429affe | 170 | dnl OPT_LDFLAGS='-Wl,-O1' and '-z,relro' if possible |
ff66d28f PE |
171 | dnl LD (as a side effect of testing) |
172 | dnl Sets: | |
173 | dnl with_gnu_ld | |
d60a2d4d | 174 | dnl glibcxx_ld_is_gold (set to "no" or "yes") |
c99a6eb0 | 175 | dnl glibcxx_ld_is_mold (set to "no" or "yes") |
ff66d28f PE |
176 | dnl glibcxx_gnu_ld_version (possibly) |
177 | dnl | |
178 | dnl The last will be a single integer, e.g., version 1.23.45.0.67.89 will | |
179 | dnl set glibcxx_gnu_ld_version to 12345. Zeros cause problems. | |
c470c17d | 180 | dnl |
f214923c | 181 | AC_DEFUN([GLIBCXX_CHECK_LINKER_FEATURES], [ |
421173e6 PE |
182 | # If we're not using GNU ld, then there's no point in even trying these |
183 | # tests. Check for that first. We should have already tested for gld | |
184 | # by now (in libtool), but require it now just to be safe... | |
654421eb DE |
185 | test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS='' |
186 | test -z "$OPT_LDFLAGS" && OPT_LDFLAGS='' | |
421173e6 | 187 | AC_REQUIRE([AC_PROG_LD]) |
ff66d28f | 188 | AC_REQUIRE([AC_PROG_AWK]) |
5bd17d39 | 189 | |
c98b201b PE |
190 | # The name set by libtool depends on the version of libtool. Shame on us |
191 | # for depending on an impl detail, but c'est la vie. Older versions used | |
192 | # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on | |
193 | # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually | |
194 | # makes sense). We'll test with_gnu_ld everywhere else, so if that isn't | |
195 | # set (hence we're using an older libtool), then set it. | |
196 | if test x${with_gnu_ld+set} != xset; then | |
197 | if test x${ac_cv_prog_gnu_ld+set} != xset; then | |
198 | # We got through "ac_require(ac_prog_ld)" and still not set? Huh? | |
199 | with_gnu_ld=no | |
200 | else | |
201 | with_gnu_ld=$ac_cv_prog_gnu_ld | |
202 | fi | |
203 | fi | |
204 | ||
205 | # Start by getting the version number. I think the libtool test already | |
206 | # does some of this, but throws away the result. | |
d60a2d4d | 207 | glibcxx_ld_is_gold=no |
c99a6eb0 | 208 | glibcxx_ld_is_mold=no |
e2c104d8 BK |
209 | if test x"$with_gnu_ld" = x"yes"; then |
210 | AC_MSG_CHECKING([for ld version]) | |
211 | changequote(,) | |
d60a2d4d ILT |
212 | if $LD --version 2>/dev/null | grep 'GNU gold' >/dev/null 2>&1; then |
213 | glibcxx_ld_is_gold=yes | |
c99a6eb0 ML |
214 | elif $LD --version 2>/dev/null | grep 'mold' >/dev/null 2>&1; then |
215 | glibcxx_ld_is_mold=yes | |
d60a2d4d | 216 | fi |
c82852f7 | 217 | ldver=`$LD --version 2>/dev/null | |
c6c2d1bc | 218 | sed -e 's/[. ][0-9]\{8\}$//;s/.* \([^ ]\{1,\}\)$/\1/; q'` |
e2c104d8 BK |
219 | changequote([,]) |
220 | glibcxx_gnu_ld_version=`echo $ldver | \ | |
b329dd10 | 221 | $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'` |
e2c104d8 BK |
222 | AC_MSG_RESULT($glibcxx_gnu_ld_version) |
223 | fi | |
c98b201b | 224 | |
5bd17d39 | 225 | # Set --gc-sections. |
d60a2d4d | 226 | glibcxx_have_gc_sections=no |
c99a6eb0 | 227 | if test "$glibcxx_ld_is_gold" = "yes" || test "$glibcxx_ld_is_mold" = "yes" ; then |
d60a2d4d ILT |
228 | if $LD --help 2>/dev/null | grep gc-sections >/dev/null 2>&1; then |
229 | glibcxx_have_gc_sections=yes | |
230 | fi | |
231 | else | |
232 | glibcxx_gcsections_min_ld=21602 | |
b329dd10 | 233 | if test x"$with_gnu_ld" = x"yes" && |
ac2b2479 | 234 | test $glibcxx_gnu_ld_version -gt $glibcxx_gcsections_min_ld ; then |
d60a2d4d ILT |
235 | glibcxx_have_gc_sections=yes |
236 | fi | |
237 | fi | |
238 | if test "$glibcxx_have_gc_sections" = "yes"; then | |
ac2b2479 BK |
239 | # Sufficiently young GNU ld it is! Joy and bunny rabbits! |
240 | # NB: This flag only works reliably after 2.16.1. Configure tests | |
241 | # for this are difficult, so hard wire a value that should work. | |
421173e6 | 242 | |
421173e6 PE |
243 | ac_test_CFLAGS="${CFLAGS+set}" |
244 | ac_save_CFLAGS="$CFLAGS" | |
2a0ab51c | 245 | CFLAGS='-Wl,--gc-sections' |
421173e6 PE |
246 | |
247 | # Check for -Wl,--gc-sections | |
248 | AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections]) | |
acb6e9be BK |
249 | AC_TRY_LINK([ int one(void) { return 1; } |
250 | int two(void) { return 2; } | |
251 | ], [ two(); ] , [ac_gcsections=yes], [ac_gcsections=no]) | |
360e8759 L |
252 | if test "$ac_gcsections" = "yes"; then |
253 | rm -f conftest.c | |
254 | touch conftest.c | |
255 | if $CC -c conftest.c; then | |
256 | if $LD --gc-sections -o conftest conftest.o 2>&1 | \ | |
257 | grep "Warning: gc-sections option ignored" > /dev/null; then | |
258 | ac_gcsections=no | |
259 | fi | |
260 | fi | |
261 | rm -f conftest.c conftest.o conftest | |
262 | fi | |
acb6e9be BK |
263 | if test "$ac_gcsections" = "yes"; then |
264 | SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS" | |
265 | fi | |
266 | AC_MSG_RESULT($ac_gcsections) | |
267 | ||
421173e6 PE |
268 | if test "$ac_test_CFLAGS" = set; then |
269 | CFLAGS="$ac_save_CFLAGS" | |
270 | else | |
271 | # this is the suspicious part | |
272 | CFLAGS='' | |
273 | fi | |
5bd17d39 | 274 | fi |
a9117427 | 275 | |
a429affe | 276 | # Set -z,relro. |
952c7b74 | 277 | # Note this is only for shared objects. |
a429affe BK |
278 | ac_ld_relro=no |
279 | if test x"$with_gnu_ld" = x"yes"; then | |
505ea909 JY |
280 | # cygwin and mingw uses PE, which has no ELF relro support, |
281 | # multi target ld may confuse configure machinery | |
282 | case "$host" in | |
283 | *-*-cygwin*) | |
284 | ;; | |
285 | *-*-mingw*) | |
286 | ;; | |
287 | *) | |
288 | AC_MSG_CHECKING([for ld that supports -Wl,-z,relro]) | |
289 | cxx_z_relo=`$LD -v --help 2>/dev/null | grep "z relro"` | |
290 | if test -n "$cxx_z_relo"; then | |
291 | OPT_LDFLAGS="-Wl,-z,relro" | |
292 | ac_ld_relro=yes | |
293 | fi | |
294 | AC_MSG_RESULT($ac_ld_relro) | |
295 | esac | |
a429affe BK |
296 | fi |
297 | ||
5bd17d39 | 298 | # Set linker optimization flags. |
6aa43d99 | 299 | if test x"$with_gnu_ld" = x"yes"; then |
654421eb | 300 | OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS" |
421173e6 | 301 | fi |
5bd17d39 | 302 | |
c470c17d | 303 | AC_SUBST(SECTION_LDFLAGS) |
421173e6 | 304 | AC_SUBST(OPT_LDFLAGS) |
c470c17d BK |
305 | ]) |
306 | ||
307 | ||
b2dad0e3 | 308 | dnl |
ff66d28f PE |
309 | dnl Check for headers for, and arguments to, the setrlimit() function. |
310 | dnl Used only in testsuite_hooks.h. Called from GLIBCXX_CONFIGURE_TESTSUITE. | |
6aa43d99 | 311 | dnl |
ff66d28f | 312 | dnl Defines: |
b329dd10 | 313 | dnl _GLIBCXX_RES_LIMITS if we can set artificial resource limits |
2ae6e982 | 314 | dnl various HAVE_LIMIT_* for individual limit names |
6aa43d99 | 315 | dnl |
f214923c | 316 | AC_DEFUN([GLIBCXX_CHECK_SETRLIMIT_ancilliary], [ |
e0103440 | 317 | AC_MSG_CHECKING([for RLIMIT_$1]) |
ff66d28f PE |
318 | AC_TRY_COMPILE( |
319 | [#include <unistd.h> | |
320 | #include <sys/time.h> | |
321 | #include <sys/resource.h> | |
322 | ], | |
323 | [ int f = RLIMIT_$1 ; ], | |
324 | [glibcxx_mresult=1], [glibcxx_mresult=0]) | |
2ae6e982 | 325 | AC_DEFINE_UNQUOTED(HAVE_LIMIT_$1, $glibcxx_mresult, |
b329dd10 | 326 | [Only used in build directory testsuite_hooks.h.]) |
e0103440 GK |
327 | if test $glibcxx_mresult = 1 ; then res=yes ; else res=no ; fi |
328 | AC_MSG_RESULT($res) | |
ff66d28f PE |
329 | ]) |
330 | ||
f214923c | 331 | AC_DEFUN([GLIBCXX_CHECK_SETRLIMIT], [ |
84de780d JL |
332 | AC_LANG_SAVE |
333 | AC_LANG_CPLUSPLUS | |
ff66d28f PE |
334 | setrlimit_have_headers=yes |
335 | AC_CHECK_HEADERS(unistd.h sys/time.h sys/resource.h, | |
b329dd10 BK |
336 | [], |
337 | [setrlimit_have_headers=no]) | |
ff66d28f PE |
338 | # If don't have the headers, then we can't run the tests now, and we |
339 | # won't be seeing any of these during testsuite compilation. | |
340 | if test $setrlimit_have_headers = yes; then | |
341 | # Can't do these in a loop, else the resulting syntax is wrong. | |
342 | GLIBCXX_CHECK_SETRLIMIT_ancilliary(DATA) | |
343 | GLIBCXX_CHECK_SETRLIMIT_ancilliary(RSS) | |
344 | GLIBCXX_CHECK_SETRLIMIT_ancilliary(VMEM) | |
345 | GLIBCXX_CHECK_SETRLIMIT_ancilliary(AS) | |
2ae6e982 | 346 | GLIBCXX_CHECK_SETRLIMIT_ancilliary(FSIZE) |
ff66d28f PE |
347 | |
348 | # Check for rlimit, setrlimit. | |
9646a322 JW |
349 | AC_CACHE_CHECK([for testsuite resource limits support], |
350 | glibcxx_cv_setrlimit, [ | |
ff66d28f | 351 | AC_TRY_COMPILE( |
b329dd10 BK |
352 | [#include <unistd.h> |
353 | #include <sys/time.h> | |
354 | #include <sys/resource.h> | |
355 | ], | |
356 | [struct rlimit r; | |
357 | setrlimit(0, &r);], | |
358 | [glibcxx_cv_setrlimit=yes], [glibcxx_cv_setrlimit=no]) | |
ff66d28f | 359 | ]) |
ff66d28f | 360 | |
9646a322 JW |
361 | if test $glibcxx_cv_setrlimit = yes; then |
362 | AC_DEFINE(_GLIBCXX_RES_LIMITS, 1, | |
363 | [Define if using setrlimit to set resource limits during | |
364 | "make check"]) | |
365 | fi | |
ff66d28f | 366 | fi |
84de780d | 367 | AC_LANG_RESTORE |
6aa43d99 BK |
368 | ]) |
369 | ||
370 | ||
6aa43d99 | 371 | dnl |
ff66d28f PE |
372 | dnl Check whether S_ISREG (Posix) or S_IFREG is available in <sys/stat.h>. |
373 | dnl Define HAVE_S_ISREG / HAVE_S_IFREG appropriately. | |
6aa43d99 | 374 | dnl |
f214923c | 375 | AC_DEFUN([GLIBCXX_CHECK_S_ISREG_OR_S_IFREG], [ |
74745ec5 PC |
376 | |
377 | AC_LANG_SAVE | |
378 | AC_LANG_CPLUSPLUS | |
379 | ac_save_CXXFLAGS="$CXXFLAGS" | |
380 | CXXFLAGS="$CXXFLAGS -fno-exceptions" | |
381 | ||
e0103440 | 382 | AC_MSG_CHECKING([for S_ISREG or S_IFREG]) |
ff66d28f | 383 | AC_CACHE_VAL(glibcxx_cv_S_ISREG, [ |
74745ec5 | 384 | GCC_TRY_COMPILE_OR_LINK( |
ff66d28f PE |
385 | [#include <sys/stat.h>], |
386 | [struct stat buffer; | |
387 | fstat(0, &buffer); | |
388 | S_ISREG(buffer.st_mode);], | |
389 | [glibcxx_cv_S_ISREG=yes], | |
390 | [glibcxx_cv_S_ISREG=no]) | |
391 | ]) | |
392 | AC_CACHE_VAL(glibcxx_cv_S_IFREG, [ | |
74745ec5 | 393 | GCC_TRY_COMPILE_OR_LINK( |
ff66d28f PE |
394 | [#include <sys/stat.h>], |
395 | [struct stat buffer; | |
396 | fstat(0, &buffer); | |
397 | S_IFREG & buffer.st_mode;], | |
398 | [glibcxx_cv_S_IFREG=yes], | |
399 | [glibcxx_cv_S_IFREG=no]) | |
400 | ]) | |
e0103440 | 401 | res=no |
ff66d28f | 402 | if test $glibcxx_cv_S_ISREG = yes; then |
b329dd10 | 403 | AC_DEFINE(HAVE_S_ISREG, 1, |
64e1a55d | 404 | [Define if S_ISREG is available in <sys/stat.h>.]) |
e0103440 | 405 | res=S_ISREG |
ff66d28f | 406 | elif test $glibcxx_cv_S_IFREG = yes; then |
4651e622 | 407 | AC_DEFINE(HAVE_S_IFREG, 1, |
b329dd10 | 408 | [Define if S_IFREG is available in <sys/stat.h>.]) |
e0103440 | 409 | res=S_IFREG |
ff66d28f | 410 | fi |
e0103440 | 411 | AC_MSG_RESULT($res) |
74745ec5 PC |
412 | |
413 | CXXFLAGS="$ac_save_CXXFLAGS" | |
414 | AC_LANG_RESTORE | |
b2dad0e3 BK |
415 | ]) |
416 | ||
417 | ||
dcfa0bc8 | 418 | dnl |
ff66d28f | 419 | dnl Check whether poll is available in <poll.h>, and define HAVE_POLL. |
dcfa0bc8 | 420 | dnl |
f214923c | 421 | AC_DEFUN([GLIBCXX_CHECK_POLL], [ |
74745ec5 PC |
422 | |
423 | AC_LANG_SAVE | |
424 | AC_LANG_CPLUSPLUS | |
425 | ac_save_CXXFLAGS="$CXXFLAGS" | |
426 | CXXFLAGS="$CXXFLAGS -fno-exceptions" | |
427 | ||
9646a322 | 428 | AC_CACHE_CHECK([for poll], glibcxx_cv_POLL, [ |
74745ec5 | 429 | GCC_TRY_COMPILE_OR_LINK( |
ff66d28f PE |
430 | [#include <poll.h>], |
431 | [struct pollfd pfd[1]; | |
432 | pfd[0].events = POLLIN; | |
433 | poll(pfd, 1, 0);], | |
434 | [glibcxx_cv_POLL=yes], | |
435 | [glibcxx_cv_POLL=no]) | |
436 | ]) | |
437 | if test $glibcxx_cv_POLL = yes; then | |
4651e622 | 438 | AC_DEFINE(HAVE_POLL, 1, [Define if poll is available in <poll.h>.]) |
ff66d28f | 439 | fi |
74745ec5 PC |
440 | |
441 | CXXFLAGS="$ac_save_CXXFLAGS" | |
442 | AC_LANG_RESTORE | |
ff66d28f PE |
443 | ]) |
444 | ||
445 | ||
446 | dnl | |
447 | dnl Check whether writev is available in <sys/uio.h>, and define HAVE_WRITEV. | |
448 | dnl | |
f214923c | 449 | AC_DEFUN([GLIBCXX_CHECK_WRITEV], [ |
74745ec5 PC |
450 | |
451 | AC_LANG_SAVE | |
452 | AC_LANG_CPLUSPLUS | |
453 | ac_save_CXXFLAGS="$CXXFLAGS" | |
454 | CXXFLAGS="$CXXFLAGS -fno-exceptions" | |
455 | ||
9646a322 | 456 | AC_CACHE_CHECK([for writev], glibcxx_cv_WRITEV, [ |
74745ec5 | 457 | GCC_TRY_COMPILE_OR_LINK( |
ff66d28f PE |
458 | [#include <sys/uio.h>], |
459 | [struct iovec iov[2]; | |
460 | writev(0, iov, 0);], | |
461 | [glibcxx_cv_WRITEV=yes], | |
462 | [glibcxx_cv_WRITEV=no]) | |
463 | ]) | |
464 | if test $glibcxx_cv_WRITEV = yes; then | |
4651e622 | 465 | AC_DEFINE(HAVE_WRITEV, 1, [Define if writev is available in <sys/uio.h>.]) |
ff66d28f | 466 | fi |
74745ec5 PC |
467 | |
468 | CXXFLAGS="$ac_save_CXXFLAGS" | |
469 | AC_LANG_RESTORE | |
ff66d28f PE |
470 | ]) |
471 | ||
472 | ||
3d05b345 PC |
473 | dnl |
474 | dnl Check whether LFS support is available. | |
475 | dnl | |
f214923c | 476 | AC_DEFUN([GLIBCXX_CHECK_LFS], [ |
0c6b814a | 477 | AC_LANG_SAVE |
9d47bc51 PC |
478 | AC_LANG_CPLUSPLUS |
479 | ac_save_CXXFLAGS="$CXXFLAGS" | |
b329dd10 | 480 | CXXFLAGS="$CXXFLAGS -fno-exceptions" |
9646a322 | 481 | AC_CACHE_CHECK([for LFS support], glibcxx_cv_LFS, [ |
74745ec5 | 482 | GCC_TRY_COMPILE_OR_LINK( |
0c6b814a PC |
483 | [#include <unistd.h> |
484 | #include <stdio.h> | |
dd5d134b | 485 | #include <sys/stat.h> |
0c6b814a | 486 | ], |
5c89246d PC |
487 | [FILE* fp; |
488 | fopen64("t", "w"); | |
489 | fseeko64(fp, 0, SEEK_CUR); | |
490 | ftello64(fp); | |
dd5d134b PC |
491 | lseek64(1, 0, SEEK_CUR); |
492 | struct stat64 buf; | |
493 | fstat64(1, &buf);], | |
3d05b345 PC |
494 | [glibcxx_cv_LFS=yes], |
495 | [glibcxx_cv_LFS=no]) | |
496 | ]) | |
497 | if test $glibcxx_cv_LFS = yes; then | |
4651e622 | 498 | AC_DEFINE(_GLIBCXX_USE_LFS, 1, [Define if LFS support is available.]) |
3d05b345 | 499 | fi |
9d47bc51 PC |
500 | CXXFLAGS="$ac_save_CXXFLAGS" |
501 | AC_LANG_RESTORE | |
3d05b345 PC |
502 | ]) |
503 | ||
504 | ||
1165dc50 | 505 | dnl |
5f3c0ee9 JW |
506 | dnl Check whether the old Copy-On-Write basic_string should allocate a new |
507 | dnl empty representation for every default-constructed basic_string. Without | |
508 | dnl this option, COW strings share a single empty rep in static storage, | |
509 | dnl but this only works if the linker can guarantee the static storage has | |
510 | dnl a unique definition in the process. It also doesn't work if basic_string | |
511 | dnl objects are stored in shared memory (see PR libstdc++/16612). | |
512 | dnl When fully dynamic strings are enabled, the static storage is not used | |
513 | dnl and a new empty string with reference-count == 1 is allocated each time. | |
514 | dnl Enabling this changes the libstdc++.so ABI. | |
1165dc50 | 515 | dnl |
d7a3ef97 JY |
516 | dnl --enable-fully-dynamic-string defines _GLIBCXX_FULLY_DYNAMIC_STRING to 1 |
517 | dnl --disable-fully-dynamic-string defines _GLIBCXX_FULLY_DYNAMIC_STRING to 0 | |
5f3c0ee9 | 518 | dnl otherwise the macro is not defined. |
1165dc50 PC |
519 | dnl + Usage: GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING[(DEFAULT)] |
520 | dnl Where DEFAULT is either `yes' or `no'. | |
521 | dnl | |
522 | AC_DEFUN([GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING], [ | |
5f3c0ee9 | 523 | GLIBCXX_ENABLE(fully-dynamic-string,$1,,[do not put empty strings in per-process static memory], [permit yes|no]) |
1165dc50 | 524 | if test $enable_fully_dynamic_string = yes; then |
d7a3ef97 JY |
525 | enable_fully_dynamic_string_def=1 |
526 | else | |
527 | enable_fully_dynamic_string_def=0 | |
1165dc50 | 528 | fi |
d7a3ef97 JY |
529 | AC_DEFINE_UNQUOTED([_GLIBCXX_FULLY_DYNAMIC_STRING], [${enable_fully_dynamic_string_def}], |
530 | [Define to 1 if a fully dynamic basic_string is wanted, 0 to disable, undefined for platform defaults]) | |
1165dc50 PC |
531 | ]) |
532 | ||
533 | ||
ff66d28f PE |
534 | dnl |
535 | dnl Does any necessary configuration of the testsuite directory. Generates | |
536 | dnl the testsuite_hooks.h header. | |
537 | dnl | |
538 | dnl GLIBCXX_ENABLE_SYMVERS and GLIBCXX_IS_NATIVE must be done before this. | |
539 | dnl | |
540 | dnl Sets: | |
b329dd10 | 541 | dnl enable_abi_check |
e3f78d9b BK |
542 | dnl GLIBCXX_TEST_WCHAR_T |
543 | dnl GLIBCXX_TEST_THREAD | |
ff66d28f PE |
544 | dnl Substs: |
545 | dnl baseline_dir | |
00fc1bf6 | 546 | dnl baseline_subdir_switch |
ff66d28f | 547 | dnl |
f214923c | 548 | AC_DEFUN([GLIBCXX_CONFIGURE_TESTSUITE], [ |
5a810362 MK |
549 | # Do checks for resource limit functions. |
550 | GLIBCXX_CHECK_SETRLIMIT | |
ff66d28f | 551 | |
5a810362 | 552 | if $GLIBCXX_IS_NATIVE ; then |
ff66d28f PE |
553 | # Look for setenv, so that extended locale tests can be performed. |
554 | GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_3(setenv) | |
0646b059 | 555 | fi |
dbc66058 | 556 | |
0646b059 GK |
557 | if $GLIBCXX_IS_NATIVE && test $is_hosted = yes && |
558 | test $enable_symvers != no; then | |
559 | case "$host" in | |
560 | *-*-cygwin*) | |
b329dd10 | 561 | enable_abi_check=no ;; |
0646b059 | 562 | *) |
b329dd10 | 563 | enable_abi_check=yes ;; |
0646b059 | 564 | esac |
dbc66058 DJ |
565 | else |
566 | # Only build this as native, since automake does not understand | |
567 | # CXX_FOR_BUILD. | |
568 | enable_abi_check=no | |
ff66d28f | 569 | fi |
b329dd10 | 570 | |
ff66d28f | 571 | # Export file names for ABI checking. |
68c512f6 | 572 | baseline_dir="$glibcxx_srcdir/config/abi/post/${abi_baseline_pair}" |
ff66d28f | 573 | AC_SUBST(baseline_dir) |
00fc1bf6 RO |
574 | baseline_subdir_switch="$abi_baseline_subdir_switch" |
575 | AC_SUBST(baseline_subdir_switch) | |
ff66d28f PE |
576 | ]) |
577 | ||
578 | ||
b329dd10 | 579 | dnl |
c1e0e100 | 580 | dnl Does any necessary configuration for docbook in the docs directory. |
b329dd10 BK |
581 | dnl |
582 | dnl XSLTPROC must be set before this | |
583 | dnl | |
584 | dnl Sets: | |
585 | dnl glibcxx_stylesheets | |
586 | dnl Substs: | |
587 | dnl XSL_STYLE_DIR | |
588 | dnl | |
589 | AC_DEFUN([GLIBCXX_CONFIGURE_DOCBOOK], [ | |
590 | ||
a4395a84 | 591 | glibcxx_docbook_url=http://docbook.sourceforge.net/release/xsl-ns/current/ |
b329dd10 BK |
592 | |
593 | AC_MSG_CHECKING([for local stylesheet directory]) | |
594 | glibcxx_local_stylesheets=no | |
a4395a84 JW |
595 | if test x${XMLCATALOG} = xyes && xsl_style_dir=`xmlcatalog "" $glibcxx_docbook_url 2>/dev/null` |
596 | then | |
597 | XSL_STYLE_DIR=`echo $xsl_style_dir | sed -n 's;^file://;;p'` | |
598 | glibcxx_local_stylesheets=yes | |
599 | else | |
600 | for dir in \ | |
601 | /usr/share/sgml/docbook/xsl-ns-stylesheets \ | |
602 | /usr/share/xml/docbook/stylesheet/docbook-xsl-ns \ | |
603 | /usr/share/xml/docbook/stylesheet/nwalsh5/current \ | |
604 | /usr/share/xml/docbook/stylesheet/nwalsh/current | |
605 | do | |
606 | if test -d $dir; then | |
607 | glibcxx_local_stylesheets=yes | |
608 | XSL_STYLE_DIR=$dir | |
609 | break | |
610 | fi | |
611 | done | |
b329dd10 BK |
612 | fi |
613 | AC_MSG_RESULT($glibcxx_local_stylesheets) | |
614 | ||
615 | if test x"$glibcxx_local_stylesheets" = x"yes"; then | |
616 | AC_SUBST(XSL_STYLE_DIR) | |
617 | AC_MSG_NOTICE($XSL_STYLE_DIR) | |
a4395a84 JW |
618 | |
619 | AC_MSG_CHECKING([for docbook stylesheets for documentation creation]) | |
620 | glibcxx_stylesheets=no | |
621 | if test x${XMLCATALOG} = xno || xmlcatalog "" $glibcxx_docbook_url/xhtml/docbook.xsl >/dev/null 2>&1; then | |
622 | if test x${XSLTPROC} = xyes && echo '<title/>' | xsltproc --noout --nonet --xinclude $glibcxx_docbook_url/xhtml/docbook.xsl - 2>/dev/null; then | |
623 | glibcxx_stylesheets=yes | |
624 | fi | |
625 | fi | |
626 | AC_MSG_RESULT($glibcxx_stylesheets) | |
627 | ||
b329dd10 BK |
628 | else |
629 | glibcxx_stylesheets=no | |
630 | fi | |
c1e0e100 BK |
631 | |
632 | # Check for epub3 dependencies. | |
633 | AC_MSG_CHECKING([for epub3 stylesheets for documentation creation]) | |
634 | glibcxx_epub_stylesheets=no | |
635 | if test x"$glibcxx_local_stylesheets" = x"yes"; then | |
e9469833 | 636 | if test -f "$XSL_STYLE_DIR/epub3/chunk.xsl"; then |
c1e0e100 BK |
637 | glibcxx_epub_stylesheets=yes |
638 | fi | |
639 | fi | |
640 | AC_MSG_RESULT($glibcxx_epub_stylesheets) | |
e9469833 | 641 | AM_CONDITIONAL(BUILD_EPUB, test x"$glibcxx_epub_stylesheets" = x"yes") |
c1e0e100 | 642 | |
b329dd10 BK |
643 | ]) |
644 | ||
645 | ||
ff66d28f PE |
646 | dnl |
647 | dnl Set up *_INCLUDES variables for all sundry Makefile.am's. | |
648 | dnl | |
649 | dnl Substs: | |
650 | dnl GLIBCXX_INCLUDES | |
651 | dnl TOPLEVEL_INCLUDES | |
ff66d28f | 652 | dnl |
f214923c | 653 | AC_DEFUN([GLIBCXX_EXPORT_INCLUDES], [ |
0df3f383 PE |
654 | # Used for every C++ compile we perform. |
655 | GLIBCXX_INCLUDES="\ | |
656 | -I$glibcxx_builddir/include/$host_alias \ | |
657 | -I$glibcxx_builddir/include \ | |
658 | -I$glibcxx_srcdir/libsupc++" | |
ff66d28f | 659 | |
0df3f383 | 660 | # For Canadian crosses, pick this up too. |
ff66d28f | 661 | if test $CANADIAN = yes; then |
37e0ff11 | 662 | GLIBCXX_INCLUDES="$GLIBCXX_INCLUDES -I\${includedir}" |
ff66d28f PE |
663 | fi |
664 | ||
0df3f383 | 665 | # Stuff in the actual top level. Currently only used by libsupc++ to |
201cdb74 RO |
666 | # get unwind* headers from the libgcc dir. |
667 | #TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/libgcc -I$(toplevel_srcdir)/include' | |
668 | TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/libgcc' | |
ff66d28f PE |
669 | |
670 | # Now, export this to all the little Makefiles.... | |
671 | AC_SUBST(GLIBCXX_INCLUDES) | |
672 | AC_SUBST(TOPLEVEL_INCLUDES) | |
ff66d28f PE |
673 | ]) |
674 | ||
675 | ||
676 | dnl | |
677 | dnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's. | |
678 | dnl (SECTION_FLAGS is done under CHECK_COMPILER_FEATURES.) | |
679 | dnl | |
680 | dnl Substs: | |
9149a5b7 | 681 | dnl CPPFLAGS |
ff66d28f PE |
682 | dnl OPTIMIZE_CXXFLAGS |
683 | dnl WARN_FLAGS | |
684 | dnl | |
f214923c | 685 | AC_DEFUN([GLIBCXX_EXPORT_FLAGS], [ |
9149a5b7 EB |
686 | AC_SUBST(CPPFLAGS) |
687 | ||
ff66d28f PE |
688 | # Optimization flags that are probably a good idea for thrill-seekers. Just |
689 | # uncomment the lines below and make, everything else is ready to go... | |
62801a96 | 690 | # Alternatively OPTIMIZE_CXXFLAGS can be set in configure.host. |
ff66d28f | 691 | # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc |
ff66d28f PE |
692 | AC_SUBST(OPTIMIZE_CXXFLAGS) |
693 | ||
c3be340e | 694 | WARN_FLAGS="-Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2" |
ff66d28f PE |
695 | AC_SUBST(WARN_FLAGS) |
696 | ]) | |
697 | ||
698 | ||
699 | dnl | |
700 | dnl All installation directory information is determined here. | |
701 | dnl | |
702 | dnl Substs: | |
703 | dnl gxx_install_dir | |
704 | dnl glibcxx_prefixdir | |
705 | dnl glibcxx_toolexecdir | |
706 | dnl glibcxx_toolexeclibdir | |
707 | dnl | |
708 | dnl Assumes cross_compiling bits already done, and with_cross_host in | |
709 | dnl particular. | |
710 | dnl | |
0f57bf40 | 711 | dnl This logic must match gcc/configure.ac's setting of gcc_gxx_include_dir. |
505692b0 | 712 | dnl config/gxx-include-dir.m4 must be kept consistant with this as well. |
f214923c | 713 | AC_DEFUN([GLIBCXX_EXPORT_INSTALL_INFO], [ |
ff66d28f PE |
714 | glibcxx_toolexecdir=no |
715 | glibcxx_toolexeclibdir=no | |
716 | glibcxx_prefixdir=$prefix | |
717 | ||
718 | AC_MSG_CHECKING([for gxx-include-dir]) | |
719 | AC_ARG_WITH([gxx-include-dir], | |
720 | AC_HELP_STRING([--with-gxx-include-dir=DIR], | |
b329dd10 | 721 | [installation directory for include files]), |
ff66d28f PE |
722 | [case "$withval" in |
723 | yes) AC_MSG_ERROR([Missing directory for --with-gxx-include-dir]) ;; | |
724 | no) gxx_include_dir=no ;; | |
725 | *) gxx_include_dir=$withval ;; | |
726 | esac], | |
727 | [gxx_include_dir=no]) | |
728 | AC_MSG_RESULT($gxx_include_dir) | |
729 | ||
730 | AC_MSG_CHECKING([for --enable-version-specific-runtime-libs]) | |
731 | AC_ARG_ENABLE([version-specific-runtime-libs], | |
732 | AC_HELP_STRING([--enable-version-specific-runtime-libs], | |
b329dd10 | 733 | [Specify that runtime libraries should be installed in a compiler-specific directory]), |
ff66d28f PE |
734 | [case "$enableval" in |
735 | yes) version_specific_libs=yes ;; | |
736 | no) version_specific_libs=no ;; | |
737 | *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);; | |
738 | esac], | |
739 | [version_specific_libs=no]) | |
740 | AC_MSG_RESULT($version_specific_libs) | |
741 | ||
e8e66971 MR |
742 | GCC_WITH_TOOLEXECLIBDIR |
743 | ||
ff66d28f PE |
744 | # Default case for install directory for include files. |
745 | if test $version_specific_libs = no && test $gxx_include_dir = no; then | |
0f57bf40 | 746 | gxx_include_dir='include/c++/${gcc_version}' |
b329dd10 BK |
747 | if test -n "$with_cross_host" && |
748 | test x"$with_cross_host" != x"no"; then | |
0f57bf40 MM |
749 | gxx_include_dir='${prefix}/${target_alias}/'"$gxx_include_dir" |
750 | else | |
751 | gxx_include_dir='${prefix}/'"$gxx_include_dir" | |
752 | fi | |
ff66d28f PE |
753 | fi |
754 | ||
755 | # Version-specific runtime libs processing. | |
756 | if test $version_specific_libs = yes; then | |
757 | # Need the gcc compiler version to know where to install libraries | |
758 | # and header files if --enable-version-specific-runtime-libs option | |
0314451d GK |
759 | # is selected. FIXME: these variables are misnamed, there are |
760 | # no executables installed in _toolexecdir or _toolexeclibdir. | |
ff66d28f | 761 | if test x"$gxx_include_dir" = x"no"; then |
47194af4 | 762 | gxx_include_dir='${libdir}/gcc/${host_alias}/${gcc_version}/include/c++' |
ff66d28f | 763 | fi |
0314451d | 764 | glibcxx_toolexecdir='${libdir}/gcc/${host_alias}' |
47194af4 | 765 | glibcxx_toolexeclibdir='${toolexecdir}/${gcc_version}$(MULTISUBDIR)' |
ff66d28f PE |
766 | fi |
767 | ||
768 | # Calculate glibcxx_toolexecdir, glibcxx_toolexeclibdir | |
769 | # Install a library built with a cross compiler in tooldir, not libdir. | |
770 | if test x"$glibcxx_toolexecdir" = x"no"; then | |
771 | if test -n "$with_cross_host" && | |
772 | test x"$with_cross_host" != x"no"; then | |
fbe057bb | 773 | glibcxx_toolexecdir='${exec_prefix}/${host_alias}' |
e8e66971 MR |
774 | case ${with_toolexeclibdir} in |
775 | no) | |
776 | glibcxx_toolexeclibdir='${toolexecdir}/lib' | |
777 | ;; | |
778 | *) | |
779 | glibcxx_toolexeclibdir=${with_toolexeclibdir} | |
780 | ;; | |
781 | esac | |
ff66d28f | 782 | else |
0314451d | 783 | glibcxx_toolexecdir='${libdir}/gcc/${host_alias}' |
fbe057bb | 784 | glibcxx_toolexeclibdir='${libdir}' |
ff66d28f | 785 | fi |
fbe057bb | 786 | multi_os_directory=`$CXX -print-multi-os-directory` |
ff66d28f PE |
787 | case $multi_os_directory in |
788 | .) ;; # Avoid trailing /. | |
789 | *) glibcxx_toolexeclibdir=$glibcxx_toolexeclibdir/$multi_os_directory ;; | |
790 | esac | |
791 | fi | |
792 | ||
793 | AC_MSG_CHECKING([for install location]) | |
794 | AC_MSG_RESULT($gxx_include_dir) | |
795 | ||
796 | AC_SUBST(glibcxx_prefixdir) | |
797 | AC_SUBST(gxx_include_dir) | |
798 | AC_SUBST(glibcxx_toolexecdir) | |
799 | AC_SUBST(glibcxx_toolexeclibdir) | |
800 | ]) | |
801 | ||
802 | ||
803 | dnl | |
804 | dnl GLIBCXX_ENABLE | |
805 | dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING) | |
806 | dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, permit a|b|c) | |
807 | dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, SHELL-CODE-HANDLER) | |
808 | dnl | |
88b1a025 JW |
809 | dnl See manual/appendix_porting.html#appendix.porting.build_hacking for |
810 | dnl documentation. | |
ff66d28f PE |
811 | dnl |
812 | m4_define([GLIBCXX_ENABLE],[dnl | |
813 | m4_define([_g_switch],[--enable-$1])dnl | |
b453ace3 AS |
814 | m4_define([_g_help],[AC_HELP_STRING([_g_switch$3],[$4 @<:@default=$2@:>@])])dnl |
815 | AC_ARG_ENABLE([$1],m4_dquote(_g_help), | |
ff66d28f PE |
816 | m4_bmatch([$5], |
817 | [^permit ], | |
818 | [[ | |
819 | case "$enableval" in | |
820 | m4_bpatsubst([$5],[permit ])) ;; | |
821 | *) AC_MSG_ERROR(Unknown argument to enable/disable $1) ;; | |
b329dd10 BK |
822 | dnl Idea for future: generate a URL pointing to |
823 | dnl "onlinedocs/configopts.html#whatever" | |
ff66d28f PE |
824 | esac |
825 | ]], | |
826 | [^$], | |
827 | [[ | |
828 | case "$enableval" in | |
829 | yes|no) ;; | |
830 | *) AC_MSG_ERROR(Argument to enable/disable $1 must be yes or no) ;; | |
831 | esac | |
832 | ]], | |
833 | [[$5]]), | |
834 | [enable_]m4_bpatsubst([$1],-,_)[=][$2]) | |
835 | m4_undefine([_g_switch])dnl | |
836 | m4_undefine([_g_help])dnl | |
837 | ]) | |
838 | ||
839 | ||
840 | dnl | |
841 | dnl Check for ISO/IEC 9899:1999 "C99" support. | |
842 | dnl | |
843 | dnl --enable-c99 defines _GLIBCXX_USE_C99 | |
844 | dnl --disable-c99 leaves _GLIBCXX_USE_C99 undefined | |
845 | dnl + Usage: GLIBCXX_ENABLE_C99[(DEFAULT)] | |
846 | dnl Where DEFAULT is either `yes' or `no'. | |
847 | dnl + If 'C99' stuff is not available, ignores DEFAULT and sets `no'. | |
848 | dnl | |
f214923c | 849 | AC_DEFUN([GLIBCXX_ENABLE_C99], [ |
ff66d28f PE |
850 | GLIBCXX_ENABLE(c99,$1,,[turns on ISO/IEC 9899:1999 support]) |
851 | ||
347669a0 | 852 | if test x"$enable_c99" = x"yes"; then |
23c64853 JY |
853 | AC_LANG_SAVE |
854 | AC_LANG_CPLUSPLUS | |
855 | ||
856 | # Use -std=c++98 (instead of -std=gnu++98) because leaving __STRICT_ANSI__ | |
857 | # undefined may cause fake C99 facilities, like pre-standard snprintf, | |
858 | # to be spuriously enabled. | |
859 | ac_save_CXXFLAGS="$CXXFLAGS" | |
860 | CXXFLAGS="$CXXFLAGS -std=c++98" | |
861 | ac_save_LIBS="$LIBS" | |
862 | ac_save_gcc_no_link="$gcc_no_link" | |
863 | ||
864 | if test x$gcc_no_link != xyes; then | |
865 | # Use -fno-exceptions to that the C driver can link these tests without | |
866 | # hitting undefined references to personality routines. | |
867 | CXXFLAGS="$CXXFLAGS -fno-exceptions" | |
868 | AC_CHECK_LIB(m, sin, [LIBS="$LIBS -lm"], [ | |
869 | # Use the default compile-only tests in GCC_TRY_COMPILE_OR_LINK | |
870 | gcc_no_link=yes | |
871 | ]) | |
872 | fi | |
347669a0 | 873 | |
23c64853 | 874 | # Check for the existence of <math.h> functions used if C99 is enabled. |
9646a322 JW |
875 | AC_CACHE_CHECK([for ISO C99 support in <math.h> for C++98], |
876 | glibcxx_cv_c99_math_cxx98, [ | |
23c64853 JY |
877 | GCC_TRY_COMPILE_OR_LINK( |
878 | [#include <math.h> | |
879 | volatile double d1, d2; | |
880 | volatile int i;], | |
881 | [i = fpclassify(d1); | |
882 | i = isfinite(d1); | |
883 | i = isinf(d1); | |
884 | i = isnan(d1); | |
885 | i = isnormal(d1); | |
886 | i = signbit(d1); | |
887 | i = isgreater(d1, d2); | |
888 | i = isgreaterequal(d1, d2); | |
889 | i = isless(d1, d2); | |
890 | i = islessequal(d1, d2); | |
891 | i = islessgreater(d1, d2); | |
892 | i = islessgreater(d1, d2); | |
893 | i = isunordered(d1, d2); | |
894 | ], [glibcxx_cv_c99_math_cxx98=yes], [glibcxx_cv_c99_math_cxx98=no]) | |
895 | ]) | |
23c64853 JY |
896 | if test x"$glibcxx_cv_c99_math_cxx98" = x"yes"; then |
897 | AC_DEFINE(_GLIBCXX98_USE_C99_MATH, 1, | |
898 | [Define if C99 functions or macros in <math.h> should be imported | |
899 | in <cmath> in namespace std for C++98.]) | |
900 | fi | |
ff66d28f | 901 | |
23c64853 JY |
902 | # Check for the existence of <complex.h> complex math functions. |
903 | # This is necessary even though libstdc++ uses the builtin versions | |
904 | # of these functions, because if the builtin cannot be used, a reference | |
905 | # to the library function is emitted. | |
906 | AC_CHECK_HEADERS(tgmath.h, ac_has_tgmath_h=yes, ac_has_tgmath_h=no) | |
907 | AC_CHECK_HEADERS(complex.h, ac_has_complex_h=yes, ac_has_complex_h=no) | |
908 | if test x"$ac_has_complex_h" = x"yes"; then | |
9646a322 JW |
909 | AC_CACHE_CHECK([for ISO C99 support in <complex.h> for C++98], |
910 | glibcxx_cv_c99_complex_cxx98, [ | |
23c64853 JY |
911 | GCC_TRY_COMPILE_OR_LINK( |
912 | [#include <complex.h> | |
913 | typedef __complex__ float float_type; | |
914 | typedef __complex__ double double_type; | |
915 | typedef __complex__ long double ld_type; | |
916 | volatile float_type tmpf; | |
917 | volatile double_type tmpd; | |
918 | volatile ld_type tmpld; | |
919 | volatile float f; | |
920 | volatile double d; | |
921 | volatile long double ld;], | |
922 | [f = cabsf(tmpf); | |
923 | f = cargf(tmpf); | |
924 | tmpf = ccosf(tmpf); | |
925 | tmpf = ccoshf(tmpf); | |
926 | tmpf = cexpf(tmpf); | |
927 | tmpf = clogf(tmpf); | |
928 | tmpf = csinf(tmpf); | |
929 | tmpf = csinhf(tmpf); | |
930 | tmpf = csqrtf(tmpf); | |
931 | tmpf = ctanf(tmpf); | |
932 | tmpf = ctanhf(tmpf); | |
933 | tmpf = cpowf(tmpf, tmpf); | |
934 | tmpf = cprojf(tmpf); | |
935 | d = cabs(tmpd); | |
936 | d = carg(tmpd); | |
937 | tmpd = ccos(tmpd); | |
938 | tmpd = ccosh(tmpd); | |
939 | tmpd = cexp(tmpd); | |
940 | tmpd = clog(tmpd); | |
941 | tmpd = csin(tmpd); | |
942 | tmpd = csinh(tmpd); | |
943 | tmpd = csqrt(tmpd); | |
944 | tmpd = ctan(tmpd); | |
945 | tmpd = ctanh(tmpd); | |
946 | tmpd = cpow(tmpd, tmpd); | |
947 | tmpd = cproj(tmpd); | |
948 | ld = cabsl(tmpld); | |
949 | ld = cargl(tmpld); | |
950 | tmpld = ccosl(tmpld); | |
951 | tmpld = ccoshl(tmpld); | |
952 | tmpld = cexpl(tmpld); | |
953 | tmpld = clogl(tmpld); | |
954 | tmpld = csinl(tmpld); | |
955 | tmpld = csinhl(tmpld); | |
956 | tmpld = csqrtl(tmpld); | |
957 | tmpld = ctanl(tmpld); | |
958 | tmpld = ctanhl(tmpld); | |
959 | tmpld = cpowl(tmpld, tmpld); | |
960 | tmpld = cprojl(tmpld); | |
961 | ], [glibcxx_cv_c99_complex_cxx98=yes], [glibcxx_cv_c99_complex_cxx98=no]) | |
962 | ]) | |
963 | fi | |
23c64853 JY |
964 | if test x"$glibcxx_cv_c99_complex_cxx98" = x"yes"; then |
965 | AC_DEFINE(_GLIBCXX98_USE_C99_COMPLEX, 1, | |
966 | [Define if C99 functions in <complex.h> should be used in | |
967 | <complex> for C++98. Using compiler builtins for these functions | |
968 | requires corresponding C99 library functions to be present.]) | |
969 | fi | |
970 | ||
971 | # Check for the existence in <stdio.h> of vscanf, et. al. | |
9646a322 JW |
972 | AC_CACHE_CHECK([for ISO C99 support in <stdio.h> for C++98], |
973 | glibcxx_cv_c99_stdio_cxx98, [ | |
23c64853 JY |
974 | GCC_TRY_COMPILE_OR_LINK( |
975 | [#include <stdio.h> | |
976 | #include <stdarg.h> | |
977 | void foo(char* fmt, ...) | |
978 | { | |
979 | va_list args; va_start(args, fmt); | |
980 | vfscanf(stderr, "%i", args); | |
981 | vscanf("%i", args); | |
982 | vsnprintf(fmt, 0, "%i", args); | |
983 | vsscanf(fmt, "%i", args); | |
984 | snprintf(fmt, 0, "%i"); | |
985 | }], [], | |
986 | [glibcxx_cv_c99_stdio_cxx98=yes], [glibcxx_cv_c99_stdio_cxx98=no]) | |
b6f914f6 | 987 | ]) |
23c64853 JY |
988 | if test x"$glibcxx_cv_c99_stdio_cxx98" = x"yes"; then |
989 | AC_DEFINE(_GLIBCXX98_USE_C99_STDIO, 1, | |
990 | [Define if C99 functions or macros in <stdio.h> should be imported | |
991 | in <cstdio> in namespace std for C++98.]) | |
992 | fi | |
b6f914f6 | 993 | |
3555173f | 994 | # Check for the existence in <stdlib.h> of lldiv_t, et. al. |
9646a322 JW |
995 | AC_CACHE_CHECK([for ISO C99 support in <stdlib.h> for C++98], |
996 | glibcxx_cv_c99_stdlib_cxx98, [ | |
3555173f JW |
997 | GCC_TRY_COMPILE_OR_LINK( |
998 | [#include <stdlib.h> | |
999 | volatile float f; | |
1000 | volatile long double ld; | |
1001 | volatile unsigned long long ll; | |
1002 | lldiv_t mydivt;], | |
1003 | [char* tmp; | |
1004 | f = strtof("gnu", &tmp); | |
1005 | ld = strtold("gnu", &tmp); | |
1006 | ll = strtoll("gnu", &tmp, 10); | |
1007 | ll = strtoull("gnu", &tmp, 10); | |
1008 | ll = llabs(10); | |
1009 | mydivt = lldiv(10,1); | |
1010 | ll = mydivt.quot; | |
1011 | ll = mydivt.rem; | |
1012 | ll = atoll("10"); | |
1013 | _Exit(0); | |
1014 | ], [glibcxx_cv_c99_stdlib_cxx98=yes], [glibcxx_cv_c99_stdlib_cxx98=no]) | |
1015 | ]) | |
3555173f JW |
1016 | if test x"$glibcxx_cv_c99_stdlib_cxx98" = x"yes"; then |
1017 | AC_DEFINE(_GLIBCXX98_USE_C99_STDLIB, 1, | |
1018 | [Define if C99 functions or macros in <stdlib.h> should be imported | |
1019 | in <cstdlib> in namespace std for C++98.]) | |
1020 | fi | |
1021 | ||
23c64853 JY |
1022 | # Check for the existence in <wchar.h> of wcstold, etc. |
1023 | if test x"$ac_has_wchar_h" = xyes && | |
1024 | test x"$ac_has_wctype_h" = xyes; then | |
9646a322 JW |
1025 | AC_CACHE_CHECK([for ISO C99 support in <wchar.h> for C++98], |
1026 | glibcxx_cv_c99_wchar_cxx98, [ | |
23c64853 JY |
1027 | AC_TRY_COMPILE([#include <wchar.h> |
1028 | namespace test | |
1029 | { | |
1030 | using ::wcstold; | |
1031 | using ::wcstoll; | |
1032 | using ::wcstoull; | |
1033 | } | |
1034 | ], [], [glibcxx_cv_c99_wchar_cxx98=yes], [glibcxx_cv_c99_wchar_cxx98=no]) | |
1035 | ]) | |
1036 | ||
1037 | # Checks for wide character functions that may not be present. | |
1038 | # Injection of these is wrapped with guard macros. | |
1039 | # NB: only put functions here, instead of immediately above, if | |
1040 | # absolutely necessary. | |
1041 | AC_TRY_COMPILE([#include <wchar.h> | |
1042 | namespace test { using ::vfwscanf; }], [], | |
1043 | [AC_DEFINE(HAVE_VFWSCANF, 1, [Defined if vfwscanf exists.])], []) | |
1044 | ||
1045 | AC_TRY_COMPILE([#include <wchar.h> | |
1046 | namespace test { using ::vswscanf; }], [], | |
1047 | [AC_DEFINE(HAVE_VSWSCANF, 1, [Defined if vswscanf exists.])], []) | |
1048 | ||
1049 | AC_TRY_COMPILE([#include <wchar.h> | |
1050 | namespace test { using ::vwscanf; }], [], | |
1051 | [AC_DEFINE(HAVE_VWSCANF, 1, [Defined if vwscanf exists.])], []) | |
1052 | ||
1053 | AC_TRY_COMPILE([#include <wchar.h> | |
1054 | namespace test { using ::wcstof; }], [], | |
1055 | [AC_DEFINE(HAVE_WCSTOF, 1, [Defined if wcstof exists.])], []) | |
1056 | ||
1057 | AC_TRY_COMPILE([#include <wctype.h>], | |
1058 | [wint_t t; int i = iswblank(t);], | |
1059 | [AC_DEFINE(HAVE_ISWBLANK, 1, [Defined if iswblank exists.])], []) | |
1060 | ||
23c64853 JY |
1061 | if test x"$glibcxx_cv_c99_wchar_cxx98" = x"yes"; then |
1062 | AC_DEFINE(_GLIBCXX98_USE_C99_WCHAR, 1, | |
1063 | [Define if C99 functions or macros in <wchar.h> should be imported | |
1064 | in <cwchar> in namespace std for C++98.]) | |
1065 | fi | |
1066 | fi | |
517da0ce | 1067 | |
23c64853 JY |
1068 | # Option parsed, now set things appropriately. |
1069 | if test x"$glibcxx_cv_c99_math_cxx98" = x"no" || | |
1070 | test x"$glibcxx_cv_c99_complex_cxx98" = x"no" || | |
1071 | test x"$glibcxx_cv_c99_stdio_cxx98" = x"no" || | |
1072 | test x"$glibcxx_cv_c99_stdlib_cxx98" = x"no" || | |
1073 | test x"$glibcxx_cv_c99_wchar_cxx98" = x"no"; then | |
1074 | enable_c99=no; | |
1075 | else | |
1076 | AC_DEFINE(_GLIBCXX_USE_C99, 1, | |
1077 | [Define if C99 functions or macros from <wchar.h>, <math.h>, | |
1078 | <complex.h>, <stdio.h>, and <stdlib.h> can be used or exposed.]) | |
1079 | fi | |
52e6723c | 1080 | |
23c64853 JY |
1081 | gcc_no_link="$ac_save_gcc_no_link" |
1082 | LIBS="$ac_save_LIBS" | |
1083 | CXXFLAGS="$ac_save_CXXFLAGS" | |
1084 | AC_LANG_RESTORE | |
1085 | ||
1086 | AC_LANG_SAVE | |
1087 | AC_LANG_CPLUSPLUS | |
1088 | ||
1089 | # Use -std=c++11 and test again for C99 library feature in C++11 mode. | |
1090 | # For the reasons given above we use -std=c++11 not -std=gnu++11. | |
1091 | ac_save_CXXFLAGS="$CXXFLAGS" | |
1092 | CXXFLAGS="$CXXFLAGS -std=c++11" | |
1093 | ac_save_LIBS="$LIBS" | |
1094 | ac_save_gcc_no_link="$gcc_no_link" | |
1095 | ||
1096 | if test x$gcc_no_link != xyes; then | |
1097 | # Use -fno-exceptions to that the C driver can link these tests without | |
1098 | # hitting undefined references to personality routines. | |
1099 | CXXFLAGS="$CXXFLAGS -fno-exceptions" | |
1100 | AC_CHECK_LIB(m, sin, [LIBS="$LIBS -lm"], [ | |
1101 | # Use the default compile-only tests in GCC_TRY_COMPILE_OR_LINK | |
1102 | gcc_no_link=yes | |
1103 | ]) | |
1104 | fi | |
ff66d28f | 1105 | |
5baabdb1 JW |
1106 | # Check for the existence of <stdint.h> types. |
1107 | AC_CACHE_CHECK([for ISO C99 support in <stdint.h> for C++11], | |
1108 | glibcxx_cv_c99_stdint, [ | |
1109 | AC_TRY_COMPILE([#define __STDC_LIMIT_MACROS | |
1110 | #define __STDC_CONSTANT_MACROS | |
1111 | #include <stdint.h>], | |
1112 | [typedef int8_t my_int8_t; | |
1113 | my_int8_t i8 = INT8_MIN; | |
1114 | i8 = INT8_MAX; | |
1115 | typedef int16_t my_int16_t; | |
1116 | my_int16_t i16 = INT16_MIN; | |
1117 | i16 = INT16_MAX; | |
1118 | typedef int32_t my_int32_t; | |
1119 | my_int32_t i32 = INT32_MIN; | |
1120 | i32 = INT32_MAX; | |
1121 | typedef int64_t my_int64_t; | |
1122 | my_int64_t i64 = INT64_MIN; | |
1123 | i64 = INT64_MAX; | |
1124 | typedef int_fast8_t my_int_fast8_t; | |
1125 | my_int_fast8_t if8 = INT_FAST8_MIN; | |
1126 | if8 = INT_FAST8_MAX; | |
1127 | typedef int_fast16_t my_int_fast16_t; | |
1128 | my_int_fast16_t if16 = INT_FAST16_MIN; | |
1129 | if16 = INT_FAST16_MAX; | |
1130 | typedef int_fast32_t my_int_fast32_t; | |
1131 | my_int_fast32_t if32 = INT_FAST32_MIN; | |
1132 | if32 = INT_FAST32_MAX; | |
1133 | typedef int_fast64_t my_int_fast64_t; | |
1134 | my_int_fast64_t if64 = INT_FAST64_MIN; | |
1135 | if64 = INT_FAST64_MAX; | |
1136 | typedef int_least8_t my_int_least8_t; | |
1137 | my_int_least8_t il8 = INT_LEAST8_MIN; | |
1138 | il8 = INT_LEAST8_MAX; | |
1139 | typedef int_least16_t my_int_least16_t; | |
1140 | my_int_least16_t il16 = INT_LEAST16_MIN; | |
1141 | il16 = INT_LEAST16_MAX; | |
1142 | typedef int_least32_t my_int_least32_t; | |
1143 | my_int_least32_t il32 = INT_LEAST32_MIN; | |
1144 | il32 = INT_LEAST32_MAX; | |
1145 | typedef int_least64_t my_int_least64_t; | |
1146 | my_int_least64_t il64 = INT_LEAST64_MIN; | |
1147 | il64 = INT_LEAST64_MAX; | |
1148 | typedef intmax_t my_intmax_t; | |
1149 | my_intmax_t im = INTMAX_MAX; | |
1150 | im = INTMAX_MIN; | |
1151 | typedef intptr_t my_intptr_t; | |
1152 | my_intptr_t ip = INTPTR_MAX; | |
1153 | ip = INTPTR_MIN; | |
1154 | typedef uint8_t my_uint8_t; | |
1155 | my_uint8_t ui8 = UINT8_MAX; | |
1156 | ui8 = UINT8_MAX; | |
1157 | typedef uint16_t my_uint16_t; | |
1158 | my_uint16_t ui16 = UINT16_MAX; | |
1159 | ui16 = UINT16_MAX; | |
1160 | typedef uint32_t my_uint32_t; | |
1161 | my_uint32_t ui32 = UINT32_MAX; | |
1162 | ui32 = UINT32_MAX; | |
1163 | typedef uint64_t my_uint64_t; | |
1164 | my_uint64_t ui64 = UINT64_MAX; | |
1165 | ui64 = UINT64_MAX; | |
1166 | typedef uint_fast8_t my_uint_fast8_t; | |
1167 | my_uint_fast8_t uif8 = UINT_FAST8_MAX; | |
1168 | uif8 = UINT_FAST8_MAX; | |
1169 | typedef uint_fast16_t my_uint_fast16_t; | |
1170 | my_uint_fast16_t uif16 = UINT_FAST16_MAX; | |
1171 | uif16 = UINT_FAST16_MAX; | |
1172 | typedef uint_fast32_t my_uint_fast32_t; | |
1173 | my_uint_fast32_t uif32 = UINT_FAST32_MAX; | |
1174 | uif32 = UINT_FAST32_MAX; | |
1175 | typedef uint_fast64_t my_uint_fast64_t; | |
1176 | my_uint_fast64_t uif64 = UINT_FAST64_MAX; | |
1177 | uif64 = UINT_FAST64_MAX; | |
1178 | typedef uint_least8_t my_uint_least8_t; | |
1179 | my_uint_least8_t uil8 = UINT_LEAST8_MAX; | |
1180 | uil8 = UINT_LEAST8_MAX; | |
1181 | typedef uint_least16_t my_uint_least16_t; | |
1182 | my_uint_least16_t uil16 = UINT_LEAST16_MAX; | |
1183 | uil16 = UINT_LEAST16_MAX; | |
1184 | typedef uint_least32_t my_uint_least32_t; | |
1185 | my_uint_least32_t uil32 = UINT_LEAST32_MAX; | |
1186 | uil32 = UINT_LEAST32_MAX; | |
1187 | typedef uint_least64_t my_uint_least64_t; | |
1188 | my_uint_least64_t uil64 = UINT_LEAST64_MAX; | |
1189 | uil64 = UINT_LEAST64_MAX; | |
1190 | typedef uintmax_t my_uintmax_t; | |
1191 | my_uintmax_t uim = UINTMAX_MAX; | |
1192 | uim = UINTMAX_MAX; | |
1193 | typedef uintptr_t my_uintptr_t; | |
1194 | my_uintptr_t uip = UINTPTR_MAX; | |
1195 | uip = UINTPTR_MAX; | |
1196 | ],[glibcxx_cv_c99_stdint=yes], | |
1197 | [glibcxx_cv_c99_stdint=no]) | |
1198 | ]) | |
1199 | if test x"$glibcxx_cv_c99_stdint" = x"yes"; then | |
1200 | AC_DEFINE(_GLIBCXX_USE_C99_STDINT, 1, | |
1201 | [Define if C99 types in <stdint.h> should be imported in | |
1202 | <cstdint> in namespace std for C++11.]) | |
1203 | fi | |
1204 | ||
1205 | # Check for the existence of <inttypes.h> functions (NB: doesn't make | |
1206 | # sense if the glibcxx_cv_c99_stdint check fails, per C99, 7.8/1). | |
1207 | ac_c99_inttypes=no; | |
1208 | if test x"$glibcxx_cv_c99_stdint" = x"yes"; then | |
1209 | AC_MSG_CHECKING([for ISO C99 support for C++11 in <inttypes.h>]) | |
1210 | AC_TRY_COMPILE([#include <inttypes.h>], | |
1211 | [intmax_t i, numer, denom, base; | |
1212 | const char* s; | |
1213 | char** endptr; | |
1214 | intmax_t ret = imaxabs(i); | |
1215 | imaxdiv_t dret = imaxdiv(numer, denom); | |
1216 | ret = strtoimax(s, endptr, base); | |
1217 | uintmax_t uret = strtoumax(s, endptr, base); | |
1218 | ],[ac_c99_inttypes=yes], [ac_c99_inttypes=no]) | |
1219 | AC_MSG_RESULT($ac_c99_inttypes) | |
1220 | fi | |
1221 | if test x"$ac_c99_inttypes" = x"yes"; then | |
1222 | AC_DEFINE(_GLIBCXX_USE_C99_INTTYPES, 1, | |
1223 | [Define if C99 functions in <inttypes.h> should be imported in | |
1224 | <cinttypes> in namespace std in C++11.]) | |
1225 | fi | |
1226 | ||
1227 | # Check for the existence of wchar_t <inttypes.h> functions (NB: doesn't | |
1228 | # make sense if the glibcxx_cv_c99_stdint check fails, per C99, 7.8/1). | |
1229 | ac_c99_inttypes_wchar_t=no; | |
1230 | if test x"$glibcxx_cv_c99_stdint" = x"yes"; then | |
1231 | AC_MSG_CHECKING([for wchar_t ISO C99 support for C++11 in <inttypes.h>]) | |
1232 | AC_TRY_COMPILE([#include <inttypes.h>], | |
1233 | [intmax_t base; | |
1234 | const wchar_t* s; | |
1235 | wchar_t** endptr; | |
1236 | intmax_t ret = wcstoimax(s, endptr, base); | |
1237 | uintmax_t uret = wcstoumax(s, endptr, base); | |
1238 | ],[ac_c99_inttypes_wchar_t=yes], | |
1239 | [ac_c99_inttypes_wchar_t=no]) | |
1240 | AC_MSG_RESULT($ac_c99_inttypes_wchar_t) | |
1241 | fi | |
1242 | if test x"$ac_c99_inttypes_wchar_t" = x"yes"; then | |
1243 | AC_DEFINE(_GLIBCXX_USE_C99_INTTYPES_WCHAR_T, 1, | |
1244 | [Define if wchar_t C99 functions in <inttypes.h> should be | |
1245 | imported in <cinttypes> in namespace std in C++11.]) | |
1246 | fi | |
1247 | ||
1f378f6d JW |
1248 | # Check for the existence of <math.h> generic macros used if C99 is enabled. |
1249 | AC_CACHE_CHECK([for ISO C99 generic macro support in <math.h> for C++11], | |
9646a322 | 1250 | glibcxx_cv_c99_math_cxx11, [ |
23c64853 JY |
1251 | GCC_TRY_COMPILE_OR_LINK( |
1252 | [#include <math.h> | |
1253 | volatile double d1, d2; | |
1254 | volatile int i;], | |
1255 | [i = fpclassify(d1); | |
1256 | i = isfinite(d1); | |
1257 | i = isinf(d1); | |
1258 | i = isnan(d1); | |
1259 | i = isnormal(d1); | |
1260 | i = signbit(d1); | |
1261 | i = isgreater(d1, d2); | |
1262 | i = isgreaterequal(d1, d2); | |
1263 | i = isless(d1, d2); | |
1264 | i = islessequal(d1, d2); | |
1265 | i = islessgreater(d1, d2); | |
1266 | i = islessgreater(d1, d2); | |
1267 | i = isunordered(d1, d2); | |
1268 | ], [glibcxx_cv_c99_math_cxx11=yes], [glibcxx_cv_c99_math_cxx11=no]) | |
1269 | ]) | |
23c64853 JY |
1270 | if test x"$glibcxx_cv_c99_math_cxx11" = x"yes"; then |
1271 | AC_DEFINE(_GLIBCXX11_USE_C99_MATH, 1, | |
1f378f6d | 1272 | [Define if C99 generic macros in <math.h> should be imported |
23c64853 JY |
1273 | in <cmath> in namespace std for C++11.]) |
1274 | fi | |
ff66d28f | 1275 | |
49f59826 JW |
1276 | # Check for the existence of <math.h> typedefs. |
1277 | AC_CACHE_CHECK([for ISO C99 float types for C++11 in <math.h>], | |
1278 | glibcxx_cv_c99_flt_eval_types, [ | |
1f378f6d JW |
1279 | AC_TRY_COMPILE([#include <math.h>], |
1280 | [// Types | |
1281 | typedef double_t my_double_t; | |
1282 | typedef float_t my_float_t; | |
49f59826 JW |
1283 | ], |
1284 | [glibcxx_cv_c99_flt_eval_types=yes], | |
1285 | [glibcxx_cv_c99_flt_eval_types=no]) | |
1286 | ]) | |
1287 | if test x"$glibcxx_cv_c99_flt_eval_types" = x"yes"; then | |
1288 | AC_DEFINE(HAVE_C99_FLT_EVAL_TYPES, 1, | |
1289 | [Define if C99 float_t and double_t in <math.h> should be | |
1290 | imported in <cmath> in namespace std for C++11.]) | |
1291 | fi | |
1292 | ||
1293 | # Check for the existence of <math.h> functions. | |
1294 | AC_CACHE_CHECK([for ISO C99 function support for C++11 in <math.h>], | |
1295 | glibcxx_cv_c99_math_funcs, [ | |
1296 | AC_TRY_COMPILE([#include <math.h>], | |
1297 | [ | |
1f378f6d JW |
1298 | // Hyperbolic |
1299 | acosh(0.0); | |
1300 | acoshf(0.0f); | |
1301 | acoshl(0.0l); | |
1302 | asinh(0.0); | |
1303 | asinhf(0.0f); | |
1304 | asinhl(0.0l); | |
1305 | atanh(0.0); | |
1306 | atanhf(0.0f); | |
1307 | atanhl(0.0l); | |
1308 | // Exponential and logarithmic | |
1309 | exp2(0.0); | |
1310 | exp2f(0.0f); | |
1311 | exp2l(0.0l); | |
1312 | expm1(0.0); | |
1313 | expm1f(0.0f); | |
1314 | expm1l(0.0l); | |
1315 | ilogb(0.0); | |
1316 | ilogbf(0.0f); | |
1317 | ilogbl(0.0l); | |
1318 | log1p(0.0); | |
1319 | log1pf(0.0f); | |
1320 | log1pl(0.0l); | |
1321 | log2(0.0); | |
1322 | log2f(0.0f); | |
1323 | log2l(0.0l); | |
1324 | logb(0.0); | |
1325 | logbf(0.0f); | |
1326 | logbl(0.0l); | |
1327 | scalbln(0.0, 0l); | |
1328 | scalblnf(0.0f, 0l); | |
1329 | scalblnl(0.0l, 0l); | |
1330 | scalbn(0.0, 0); | |
1331 | scalbnf(0.0f, 0); | |
1332 | scalbnl(0.0l, 0); | |
1333 | // Power and absolute-value | |
1334 | cbrt(0.0); | |
1335 | cbrtf(0.0f); | |
1336 | cbrtl(0.0l); | |
1337 | hypot(0.0, 0.0); | |
1338 | hypotf(0.0f, 0.0f); | |
1339 | hypotl(0.0l, 0.0l); | |
1340 | // Error and gamma | |
1341 | erf(0.0); | |
1342 | erff(0.0f); | |
1343 | erfl(0.0l); | |
1344 | erfc(0.0); | |
1345 | erfcf(0.0f); | |
1346 | erfcl(0.0l); | |
1347 | lgamma(0.0); | |
1348 | lgammaf(0.0f); | |
1349 | lgammal(0.0l); | |
1350 | tgamma(0.0); | |
1351 | tgammaf(0.0f); | |
1352 | tgammal(0.0l); | |
1353 | // Nearest integer | |
1354 | nearbyint(0.0); | |
1355 | nearbyintf(0.0f); | |
1356 | nearbyintl(0.0l); | |
1357 | rint(0.0); | |
1358 | rintf(0.0f); | |
1359 | rintl(0.0l); | |
1360 | round(0.0); | |
1361 | roundf(0.0f); | |
1362 | roundl(0.0l); | |
1363 | lrint(0.0); | |
1364 | lrintf(0.0f); | |
1365 | lrintl(0.0l); | |
1366 | lround(0.0); | |
1367 | lroundf(0.0f); | |
1368 | lroundl(0.0l); | |
1369 | #ifndef __APPLE__ /* see below */ | |
1370 | llrint(0.0); | |
1371 | llrintf(0.0f); | |
1372 | llrintl(0.0l); | |
1373 | llround(0.0); | |
1374 | llroundf(0.0f); | |
1375 | llroundl(0.0l); | |
1376 | #endif | |
1377 | trunc(0.0); | |
1378 | truncf(0.0f); | |
1379 | truncl(0.0l); | |
1380 | // Remainder | |
1381 | remainder(0.0, 0.0); | |
1382 | remainderf(0.0f, 0.0f); | |
1383 | remainderl(0.0l, 0.0l); | |
1384 | remquo(0.0, 0.0, 0); | |
1385 | remquof(0.0f, 0.0f, 0); | |
1386 | remquol(0.0l, 0.0l, 0); | |
1387 | // Manipulation | |
1388 | copysign(0.0, 0.0); | |
1389 | copysignf(0.0f, 0.0f); | |
1390 | copysignl(0.0l, 0.0l); | |
1391 | nan(""); | |
1392 | nanf(""); | |
1393 | nanl(""); | |
1394 | nextafter(0.0, 0.0); | |
1395 | nextafterf(0.0f, 0.0f); | |
1396 | nextafterl(0.0l, 0.0l); | |
1397 | nexttoward(0.0, 0.0); | |
1398 | nexttowardf(0.0f, 0.0f); | |
1399 | nexttowardl(0.0l, 0.0l); | |
1400 | // Max, min, positive difference | |
1401 | fdim(0.0, 0.0); | |
1402 | fdimf(0.0f, 0.0f); | |
1403 | fdiml(0.0l, 0.0l); | |
1404 | fmax(0.0, 0.0); | |
1405 | fmaxf(0.0f, 0.0f); | |
1406 | fmaxl(0.0l, 0.0l); | |
1407 | fmin(0.0, 0.0); | |
1408 | fminf(0.0f, 0.0f); | |
1409 | fminl(0.0l, 0.0l); | |
1410 | // FP Multiply-add | |
1411 | fma(0.0, 0.0, 0.0); | |
1412 | fmaf(0.0f, 0.0f, 0.0f); | |
1413 | fmal(0.0l, 0.0l, 0.0l); | |
1414 | ], | |
1415 | [glibcxx_cv_c99_math_funcs=yes], | |
1416 | [glibcxx_cv_c99_math_funcs=no]) | |
1417 | ]) | |
1418 | if test x"$glibcxx_cv_c99_math_funcs" = x"yes"; then | |
1419 | AC_DEFINE(_GLIBCXX_USE_C99_MATH_FUNCS, 1, | |
1420 | [Define if C99 functions in <math.h> should be imported | |
1421 | in <cmath> in namespace std for C++11.]) | |
1422 | ||
1423 | case "${target_os}" in | |
1424 | darwin*) | |
1425 | AC_CACHE_CHECK([for ISO C99 rounding functions in <math.h>], | |
1426 | glibcxx_cv_c99_math_llround, [ | |
1427 | AC_TRY_COMPILE([#include <math.h>], | |
1428 | [llrint(0.0); | |
1429 | llrintf(0.0f); | |
1430 | llrintl(0.0l); | |
1431 | llround(0.0); | |
1432 | llroundf(0.0f); | |
1433 | llroundl(0.0l); | |
1434 | ], | |
1435 | [glibcxx_cv_c99_math_llround=yes], | |
1436 | [glibcxx_cv_c99_math_llround=no]) | |
1437 | ]) | |
1438 | ;; | |
1439 | esac | |
1440 | if test x"$glibcxx_cv_c99_math_llround" = x"no"; then | |
1441 | AC_DEFINE(_GLIBCXX_NO_C99_ROUNDING_FUNCS, 1, | |
1442 | [Define if C99 llrint and llround functions are missing from <math.h>.]) | |
1443 | fi | |
1444 | fi | |
1445 | ||
23c64853 JY |
1446 | # Check for the existence of <complex.h> complex math functions. |
1447 | # This is necessary even though libstdc++ uses the builtin versions | |
1448 | # of these functions, because if the builtin cannot be used, a reference | |
1449 | # to the library function is emitted. | |
1450 | AC_CHECK_HEADERS(tgmath.h, ac_has_tgmath_h=yes, ac_has_tgmath_h=no) | |
1451 | AC_CHECK_HEADERS(complex.h, ac_has_complex_h=yes, ac_has_complex_h=no) | |
1452 | if test x"$ac_has_complex_h" = x"yes"; then | |
9646a322 JW |
1453 | AC_CACHE_CHECK([for ISO C99 support in <complex.h> for C++11], |
1454 | glibcxx_cv_c99_complex_cxx11, [ | |
23c64853 JY |
1455 | GCC_TRY_COMPILE_OR_LINK( |
1456 | [#include <complex.h> | |
1457 | typedef __complex__ float float_type; | |
1458 | typedef __complex__ double double_type; | |
1459 | typedef __complex__ long double ld_type; | |
1460 | volatile float_type tmpf; | |
1461 | volatile double_type tmpd; | |
1462 | volatile ld_type tmpld; | |
1463 | volatile float f; | |
1464 | volatile double d; | |
1465 | volatile long double ld;], | |
1466 | [f = cabsf(tmpf); | |
1467 | f = cargf(tmpf); | |
1468 | tmpf = ccosf(tmpf); | |
1469 | tmpf = ccoshf(tmpf); | |
1470 | tmpf = cexpf(tmpf); | |
1471 | tmpf = clogf(tmpf); | |
1472 | tmpf = csinf(tmpf); | |
1473 | tmpf = csinhf(tmpf); | |
1474 | tmpf = csqrtf(tmpf); | |
1475 | tmpf = ctanf(tmpf); | |
1476 | tmpf = ctanhf(tmpf); | |
1477 | tmpf = cpowf(tmpf, tmpf); | |
1478 | tmpf = cprojf(tmpf); | |
1479 | d = cabs(tmpd); | |
1480 | d = carg(tmpd); | |
1481 | tmpd = ccos(tmpd); | |
1482 | tmpd = ccosh(tmpd); | |
1483 | tmpd = cexp(tmpd); | |
1484 | tmpd = clog(tmpd); | |
1485 | tmpd = csin(tmpd); | |
1486 | tmpd = csinh(tmpd); | |
1487 | tmpd = csqrt(tmpd); | |
1488 | tmpd = ctan(tmpd); | |
1489 | tmpd = ctanh(tmpd); | |
1490 | tmpd = cpow(tmpd, tmpd); | |
1491 | tmpd = cproj(tmpd); | |
1492 | ld = cabsl(tmpld); | |
1493 | ld = cargl(tmpld); | |
1494 | tmpld = ccosl(tmpld); | |
1495 | tmpld = ccoshl(tmpld); | |
1496 | tmpld = cexpl(tmpld); | |
1497 | tmpld = clogl(tmpld); | |
1498 | tmpld = csinl(tmpld); | |
1499 | tmpld = csinhl(tmpld); | |
1500 | tmpld = csqrtl(tmpld); | |
1501 | tmpld = ctanl(tmpld); | |
1502 | tmpld = ctanhl(tmpld); | |
1503 | tmpld = cpowl(tmpld, tmpld); | |
1504 | tmpld = cprojl(tmpld); | |
1505 | ], [glibcxx_cv_c99_complex_cxx11=yes], [glibcxx_cv_c99_complex_cxx11=no]) | |
1506 | ]) | |
1507 | fi | |
23c64853 JY |
1508 | if test x"$glibcxx_cv_c99_complex_cxx11" = x"yes"; then |
1509 | AC_DEFINE(_GLIBCXX11_USE_C99_COMPLEX, 1, | |
1510 | [Define if C99 functions in <complex.h> should be used in | |
1511 | <complex> for C++11. Using compiler builtins for these functions | |
1512 | requires corresponding C99 library functions to be present.]) | |
1513 | fi | |
1514 | ||
0d76fb15 JW |
1515 | # Check for the existence of <complex.h> complex inverse trigonometric |
1516 | # math functions used by <complex> for C++11 and later. | |
1517 | ac_c99_complex_arc=no; | |
1518 | if test x"$ac_has_complex_h" = x"yes"; then | |
1519 | AC_MSG_CHECKING([for ISO C99 support for inverse trig functions in <complex.h>]) | |
1520 | AC_TRY_COMPILE([#include <complex.h>], | |
1521 | [typedef __complex__ float float_type; float_type tmpf; | |
1522 | cacosf(tmpf); | |
1523 | casinf(tmpf); | |
1524 | catanf(tmpf); | |
1525 | cacoshf(tmpf); | |
1526 | casinhf(tmpf); | |
1527 | catanhf(tmpf); | |
1528 | typedef __complex__ double double_type; double_type tmpd; | |
1529 | cacos(tmpd); | |
1530 | casin(tmpd); | |
1531 | catan(tmpd); | |
1532 | cacosh(tmpd); | |
1533 | casinh(tmpd); | |
1534 | catanh(tmpd); | |
1535 | typedef __complex__ long double ld_type; ld_type tmpld; | |
1536 | cacosl(tmpld); | |
1537 | casinl(tmpld); | |
1538 | catanl(tmpld); | |
1539 | cacoshl(tmpld); | |
1540 | casinhl(tmpld); | |
1541 | catanhl(tmpld); | |
1542 | ],[ac_c99_complex_arc=yes], [ac_c99_complex_arc=no]) | |
1543 | fi | |
1544 | AC_MSG_RESULT($ac_c99_complex_arc) | |
1545 | if test x"$ac_c99_complex_arc" = x"yes"; then | |
1546 | AC_DEFINE(_GLIBCXX_USE_C99_COMPLEX_ARC, 1, | |
1547 | [Define if C99 inverse trig functions in <complex.h> should be | |
1548 | used in <complex>. Using compiler builtins for these functions | |
1549 | requires corresponding C99 library functions to be present.]) | |
1550 | fi | |
1551 | ||
23c64853 | 1552 | # Check for the existence in <stdio.h> of vscanf, et. al. |
9646a322 JW |
1553 | AC_CACHE_CHECK([for ISO C99 support in <stdio.h> for C++11], |
1554 | glibcxx_cv_c99_stdio_cxx11, [ | |
23c64853 JY |
1555 | GCC_TRY_COMPILE_OR_LINK( |
1556 | [#include <stdio.h> | |
1557 | #include <stdarg.h> | |
1558 | void foo(char* fmt, ...) | |
1559 | { | |
1560 | va_list args; va_start(args, fmt); | |
1561 | vfscanf(stderr, "%i", args); | |
1562 | vscanf("%i", args); | |
1563 | vsnprintf(fmt, 0, "%i", args); | |
1564 | vsscanf(fmt, "%i", args); | |
1565 | snprintf(fmt, 0, "%i"); | |
1566 | }], [], | |
1567 | [glibcxx_cv_c99_stdio_cxx11=yes], [glibcxx_cv_c99_stdio_cxx11=no]) | |
1568 | ]) | |
23c64853 JY |
1569 | if test x"$glibcxx_cv_c99_stdio_cxx11" = x"yes"; then |
1570 | AC_DEFINE(_GLIBCXX11_USE_C99_STDIO, 1, | |
1571 | [Define if C99 functions or macros in <stdio.h> should be imported | |
1572 | in <cstdio> in namespace std for C++11.]) | |
1573 | fi | |
1574 | ||
1575 | # Check for the existence in <stdlib.h> of lldiv_t, et. al. | |
9646a322 JW |
1576 | AC_CACHE_CHECK([for ISO C99 support in <stdlib.h> for C++11], |
1577 | glibcxx_cv_c99_stdlib_cxx11, [ | |
23c64853 JY |
1578 | GCC_TRY_COMPILE_OR_LINK( |
1579 | [#include <stdlib.h> | |
1580 | volatile float f; | |
1581 | volatile long double ld; | |
1582 | volatile unsigned long long ll; | |
1583 | lldiv_t mydivt;], | |
1584 | [char* tmp; | |
1585 | f = strtof("gnu", &tmp); | |
1586 | ld = strtold("gnu", &tmp); | |
1587 | ll = strtoll("gnu", &tmp, 10); | |
1588 | ll = strtoull("gnu", &tmp, 10); | |
1589 | ll = llabs(10); | |
1590 | mydivt = lldiv(10,1); | |
1591 | ll = mydivt.quot; | |
1592 | ll = mydivt.rem; | |
1593 | ll = atoll("10"); | |
1594 | _Exit(0); | |
1595 | ], [glibcxx_cv_c99_stdlib_cxx11=yes], [glibcxx_cv_c99_stdlib_cxx11=no]) | |
1596 | ]) | |
23c64853 JY |
1597 | if test x"$glibcxx_cv_c99_stdlib_cxx11" = x"yes"; then |
1598 | AC_DEFINE(_GLIBCXX11_USE_C99_STDLIB, 1, | |
1599 | [Define if C99 functions or macros in <stdlib.h> should be imported | |
1600 | in <cstdlib> in namespace std for C++11.]) | |
1601 | fi | |
1602 | ||
1603 | # Check for the existence in <wchar.h> of wcstold, etc. | |
1604 | if test x"$ac_has_wchar_h" = xyes && | |
1605 | test x"$ac_has_wctype_h" = xyes; then | |
9646a322 JW |
1606 | AC_CACHE_CHECK([for ISO C99 support in <wchar.h> for C++11], |
1607 | glibcxx_cv_c99_wchar_cxx11, [ | |
23c64853 JY |
1608 | AC_TRY_COMPILE([#include <wchar.h> |
1609 | namespace test | |
1610 | { | |
1611 | using ::wcstold; | |
1612 | using ::wcstoll; | |
1613 | using ::wcstoull; | |
1614 | } | |
1615 | ], [], [glibcxx_cv_c99_wchar_cxx11=yes], [glibcxx_cv_c99_wchar_cxx11=no]) | |
1616 | ]) | |
1617 | ||
1618 | # Checks for wide character functions that may not be present. | |
1619 | # Injection of these is wrapped with guard macros. | |
1620 | # NB: only put functions here, instead of immediately above, if | |
1621 | # absolutely necessary. | |
1622 | AC_TRY_COMPILE([#include <wchar.h> | |
1623 | namespace test { using ::vfwscanf; }], [], | |
1624 | [AC_DEFINE(HAVE_VFWSCANF, 1, [Defined if vfwscanf exists.])], []) | |
1625 | ||
1626 | AC_TRY_COMPILE([#include <wchar.h> | |
1627 | namespace test { using ::vswscanf; }], [], | |
1628 | [AC_DEFINE(HAVE_VSWSCANF, 1, [Defined if vswscanf exists.])], []) | |
1629 | ||
1630 | AC_TRY_COMPILE([#include <wchar.h> | |
1631 | namespace test { using ::vwscanf; }], [], | |
1632 | [AC_DEFINE(HAVE_VWSCANF, 1, [Defined if vwscanf exists.])], []) | |
1633 | ||
1634 | AC_TRY_COMPILE([#include <wchar.h> | |
1635 | namespace test { using ::wcstof; }], [], | |
1636 | [AC_DEFINE(HAVE_WCSTOF, 1, [Defined if wcstof exists.])], []) | |
1637 | ||
1638 | AC_TRY_COMPILE([#include <wctype.h>], | |
1639 | [wint_t t; int i = iswblank(t);], | |
1640 | [AC_DEFINE(HAVE_ISWBLANK, 1, [Defined if iswblank exists.])], []) | |
1641 | ||
23c64853 JY |
1642 | if test x"$glibcxx_cv_c99_wchar_cxx11" = x"yes"; then |
1643 | AC_DEFINE(_GLIBCXX11_USE_C99_WCHAR, 1, | |
1644 | [Define if C99 functions or macros in <wchar.h> should be imported | |
1645 | in <cwchar> in namespace std for C++11.]) | |
1646 | fi | |
1647 | fi | |
1648 | ||
ac3a5bbc JW |
1649 | # Check for the existence of <ctype.h> functions. |
1650 | AC_CACHE_CHECK([for ISO C99 support for C++11 in <ctype.h>], | |
1651 | glibcxx_cv_c99_ctype, [ | |
1652 | AC_TRY_COMPILE([#include <ctype.h>], | |
1653 | [int ch; | |
1654 | int ret; | |
1655 | ret = isblank(ch); | |
1656 | ],[glibcxx_cv_c99_ctype=yes], | |
1657 | [glibcxx_cv_c99_ctype=no]) | |
1658 | ]) | |
1659 | if test x"$glibcxx_cv_c99_ctype" = x"yes"; then | |
1660 | AC_DEFINE(_GLIBCXX_USE_C99_CTYPE, 1, | |
1661 | [Define if C99 functions in <ctype.h> should be imported in | |
1662 | <cctype> in namespace std for C++11.]) | |
1663 | fi | |
1664 | ||
1665 | # Check for the existence of <fenv.h> functions. | |
1666 | AC_CHECK_HEADERS(fenv.h, ac_has_fenv_h=yes, ac_has_fenv_h=no) | |
1667 | ac_c99_fenv=no; | |
1668 | if test x"$ac_has_fenv_h" = x"yes"; then | |
1669 | AC_MSG_CHECKING([for ISO C99 support for C++11 in <fenv.h>]) | |
1670 | AC_TRY_COMPILE([#include <fenv.h>], | |
1671 | [int except, mode; | |
1672 | fexcept_t* pflag; | |
1673 | fenv_t* penv; | |
1674 | int ret; | |
1675 | ret = feclearexcept(except); | |
1676 | ret = fegetexceptflag(pflag, except); | |
1677 | ret = feraiseexcept(except); | |
1678 | ret = fesetexceptflag(pflag, except); | |
1679 | ret = fetestexcept(except); | |
1680 | ret = fegetround(); | |
1681 | ret = fesetround(mode); | |
1682 | ret = fegetenv(penv); | |
1683 | ret = feholdexcept(penv); | |
1684 | ret = fesetenv(penv); | |
1685 | ret = feupdateenv(penv); | |
1686 | ],[ac_c99_fenv=yes], [ac_c99_fenv=no]) | |
1687 | AC_MSG_RESULT($ac_c99_fenv) | |
1688 | fi | |
1689 | if test x"$ac_c99_fenv" = x"yes"; then | |
1690 | AC_DEFINE(_GLIBCXX_USE_C99_FENV, 1, | |
1691 | [Define if C99 functions in <fenv.h> should be imported in | |
1692 | <cfenv> in namespace std for C++11.]) | |
1693 | fi | |
1694 | ||
23c64853 JY |
1695 | gcc_no_link="$ac_save_gcc_no_link" |
1696 | LIBS="$ac_save_LIBS" | |
1697 | CXXFLAGS="$ac_save_CXXFLAGS" | |
1698 | AC_LANG_RESTORE | |
b329dd10 | 1699 | fi |
347669a0 BK |
1700 | |
1701 | AC_MSG_CHECKING([for fully enabled ISO C99 support]) | |
1702 | AC_MSG_RESULT($enable_c99) | |
dcfa0bc8 PE |
1703 | ]) |
1704 | ||
1705 | ||
15e38d0d | 1706 | dnl |
959d14e1 | 1707 | dnl Check for clock_gettime, nanosleep and sched_yield, used in the |
9ab48d6e JW |
1708 | dnl implementation of 20.11.7 [time.clock], and 30.3.2 [thread.thread.this] |
1709 | dnl in the C++11 standard. | |
15e38d0d | 1710 | dnl |
959d14e1 CF |
1711 | dnl --enable-libstdcxx-time |
1712 | dnl --enable-libstdcxx-time=yes | |
1713 | dnl checks for the availability of monotonic and realtime clocks, | |
55ebb0d6 | 1714 | dnl nanosleep and sched_yield in libc. |
959d14e1 | 1715 | dnl --enable-libstdcxx-time=rt |
9ab48d6e | 1716 | dnl also searches (and, if needed, links) librt. Note that this is |
88b1a025 JW |
1717 | dnl not always desirable because, in glibc 2.16 and earlier, for |
1718 | dnl example, in turn it triggers the linking of libpthread too, | |
1719 | dnl which activates locking, | |
6c3385c1 | 1720 | dnl a large overhead for single-thread programs. |
959d14e1 CF |
1721 | dnl --enable-libstdcxx-time=no |
1722 | dnl --disable-libstdcxx-time | |
610870b2 PC |
1723 | dnl disables the checks completely |
1724 | dnl | |
0d184995 JH |
1725 | dnl N.B. Darwin provides nanosleep but doesn't support the whole POSIX |
1726 | dnl Timers option, so doesn't define _POSIX_TIMERS. Because the test | |
1727 | dnl below fails Darwin unconditionally defines _GLIBCXX_USE_NANOSLEEP in | |
1728 | dnl os_defines.h and also defines _GLIBCXX_USE_SCHED_YIELD. | |
1729 | dnl | |
959d14e1 | 1730 | AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [ |
610870b2 | 1731 | |
88b1a025 | 1732 | GLIBCXX_ENABLE(libstdcxx-time,auto,[[[=KIND]]], |
610870b2 PC |
1733 | [use KIND for check type], |
1734 | [permit yes|no|rt]) | |
15e38d0d CF |
1735 | |
1736 | AC_LANG_SAVE | |
1737 | AC_LANG_CPLUSPLUS | |
1738 | ac_save_CXXFLAGS="$CXXFLAGS" | |
1739 | CXXFLAGS="$CXXFLAGS -fno-exceptions" | |
ec6fa56a PB |
1740 | ac_save_LIBS="$LIBS" |
1741 | ||
1ac5e52c MK |
1742 | ac_has_clock_monotonic=no |
1743 | ac_has_clock_realtime=no | |
88b1a025 JW |
1744 | ac_has_nanosleep=no |
1745 | ac_has_sched_yield=no | |
1746 | ||
1747 | if test x"$enable_libstdcxx_time" = x"auto"; then | |
1748 | ||
1749 | case "${target_os}" in | |
1750 | cygwin*) | |
1751 | ac_has_nanosleep=yes | |
1752 | ;; | |
9149a5b7 EB |
1753 | mingw*) |
1754 | ac_has_win32_sleep=yes | |
1755 | ac_has_sched_yield=yes | |
1756 | ;; | |
88b1a025 JW |
1757 | darwin*) |
1758 | ac_has_nanosleep=yes | |
1759 | ac_has_sched_yield=yes | |
1760 | ;; | |
784daa97 CG |
1761 | # VxWorks has nanosleep as soon as the kernel is configured with |
1762 | # INCLUDE_POSIX_TIMERS, which is normally/most-often the case. | |
1763 | vxworks*) | |
1764 | ac_has_nanosleep=yes | |
1765 | ;; | |
88b1a025 | 1766 | gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu) |
759812fd JW |
1767 | # Don't use link test for freestanding library, in case gcc_no_link=yes |
1768 | if test x"$is_hosted" = xyes; then | |
1769 | # Versions of glibc before 2.17 needed -lrt for clock_gettime. | |
1770 | AC_SEARCH_LIBS(clock_gettime, [rt]) | |
1771 | if test x"$ac_cv_search_clock_gettime" = x"none required"; then | |
1772 | ac_has_clock_monotonic=yes | |
1773 | ac_has_clock_realtime=yes | |
1774 | fi | |
88b1a025 JW |
1775 | fi |
1776 | ac_has_nanosleep=yes | |
1777 | ac_has_sched_yield=yes | |
1778 | ;; | |
b76602dc | 1779 | freebsd*|netbsd*|dragonfly*|rtems*) |
88b1a025 JW |
1780 | ac_has_clock_monotonic=yes |
1781 | ac_has_clock_realtime=yes | |
1782 | ac_has_nanosleep=yes | |
1783 | ac_has_sched_yield=yes | |
1784 | ;; | |
1785 | openbsd*) | |
1786 | ac_has_clock_monotonic=yes | |
1787 | ac_has_clock_realtime=yes | |
1788 | ac_has_nanosleep=yes | |
1789 | ;; | |
1790 | solaris*) | |
88b1a025 JW |
1791 | ac_has_clock_monotonic=yes |
1792 | ac_has_clock_realtime=yes | |
1793 | ac_has_nanosleep=yes | |
1794 | ac_has_sched_yield=yes | |
1795 | ;; | |
6508fa9c CL |
1796 | uclinux*) |
1797 | ac_has_nanosleep=yes | |
1798 | ac_has_sched_yield=yes | |
88b1a025 | 1799 | esac |
ec6fa56a | 1800 | |
88b1a025 | 1801 | elif test x"$enable_libstdcxx_time" != x"no"; then |
ec6fa56a | 1802 | |
959d14e1 | 1803 | if test x"$enable_libstdcxx_time" = x"rt"; then |
55ebb0d6 RO |
1804 | AC_SEARCH_LIBS(clock_gettime, [rt]) |
1805 | AC_SEARCH_LIBS(nanosleep, [rt]) | |
610870b2 | 1806 | else |
55ebb0d6 RO |
1807 | AC_CHECK_FUNC(clock_gettime) |
1808 | AC_CHECK_FUNC(nanosleep) | |
610870b2 PC |
1809 | fi |
1810 | ||
1811 | case "$ac_cv_search_clock_gettime" in | |
1812 | -l*) GLIBCXX_LIBS=$ac_cv_search_clock_gettime | |
959d14e1 CF |
1813 | ;; |
1814 | esac | |
1815 | case "$ac_cv_search_nanosleep" in | |
1816 | -l*) GLIBCXX_LIBS="$GLIBCXX_LIBS $ac_cv_search_nanosleep" | |
1817 | ;; | |
1818 | esac | |
1819 | ||
55ebb0d6 | 1820 | AC_SEARCH_LIBS(sched_yield, [rt]) |
959d14e1 CF |
1821 | |
1822 | case "$ac_cv_search_sched_yield" in | |
959d14e1 CF |
1823 | -lrt*) |
1824 | if test x"$enable_libstdcxx_time" = x"rt"; then | |
b329dd10 | 1825 | GLIBCXX_LIBS="$GLIBCXX_LIBS $ac_cv_search_sched_yield" |
88b1a025 | 1826 | ac_has_sched_yield=yes |
959d14e1 CF |
1827 | fi |
1828 | ;; | |
1829 | *) | |
88b1a025 | 1830 | ac_has_sched_yield=yes |
959d14e1 | 1831 | ;; |
610870b2 PC |
1832 | esac |
1833 | ||
1834 | AC_CHECK_HEADERS(unistd.h, ac_has_unistd_h=yes, ac_has_unistd_h=no) | |
1835 | ||
1836 | if test x"$ac_has_unistd_h" = x"yes"; then | |
1837 | AC_MSG_CHECKING([for monotonic clock]) | |
1838 | AC_TRY_LINK( | |
b329dd10 BK |
1839 | [#include <unistd.h> |
1840 | #include <time.h> | |
1841 | ], | |
1842 | [#if _POSIX_TIMERS > 0 && defined(_POSIX_MONOTONIC_CLOCK) | |
1843 | timespec tp; | |
1844 | #endif | |
1845 | clock_gettime(CLOCK_MONOTONIC, &tp); | |
1846 | ], [ac_has_clock_monotonic=yes], [ac_has_clock_monotonic=no]) | |
1847 | ||
1848 | AC_MSG_RESULT($ac_has_clock_monotonic) | |
1849 | ||
610870b2 PC |
1850 | AC_MSG_CHECKING([for realtime clock]) |
1851 | AC_TRY_LINK( | |
b329dd10 BK |
1852 | [#include <unistd.h> |
1853 | #include <time.h> | |
1854 | ], | |
1855 | [#if _POSIX_TIMERS > 0 | |
1856 | timespec tp; | |
1857 | #endif | |
1858 | clock_gettime(CLOCK_REALTIME, &tp); | |
1859 | ], [ac_has_clock_realtime=yes], [ac_has_clock_realtime=no]) | |
610870b2 PC |
1860 | |
1861 | AC_MSG_RESULT($ac_has_clock_realtime) | |
610870b2 | 1862 | |
959d14e1 CF |
1863 | AC_MSG_CHECKING([for nanosleep]) |
1864 | AC_TRY_LINK( | |
b329dd10 BK |
1865 | [#include <unistd.h> |
1866 | #include <time.h> | |
1867 | ], | |
1868 | [#if _POSIX_TIMERS > 0 | |
1869 | timespec tp; | |
1870 | #endif | |
1871 | nanosleep(&tp, 0); | |
1872 | ], [ac_has_nanosleep=yes], [ac_has_nanosleep=no]) | |
959d14e1 CF |
1873 | |
1874 | AC_MSG_RESULT($ac_has_nanosleep) | |
1875 | fi | |
610870b2 PC |
1876 | fi |
1877 | ||
2e8a9734 JJ |
1878 | if test x"$ac_has_clock_monotonic" != x"yes"; then |
1879 | case ${target_os} in | |
6508fa9c | 1880 | linux* | uclinux*) |
2e8a9734 JJ |
1881 | AC_MSG_CHECKING([for clock_gettime syscall]) |
1882 | AC_TRY_COMPILE( | |
1883 | [#include <unistd.h> | |
1884 | #include <time.h> | |
1885 | #include <sys/syscall.h> | |
1886 | ], | |
1887 | [#if _POSIX_TIMERS > 0 && defined(_POSIX_MONOTONIC_CLOCK) | |
1888 | timespec tp; | |
1889 | #endif | |
1890 | syscall(SYS_clock_gettime, CLOCK_MONOTONIC, &tp); | |
1891 | syscall(SYS_clock_gettime, CLOCK_REALTIME, &tp); | |
1e3e6c70 JW |
1892 | ], [ac_has_clock_gettime_syscall=yes], [ac_has_clock_gettime_syscall=no]) |
1893 | AC_MSG_RESULT($ac_has_clock_gettime_syscall) | |
1894 | if test x"$ac_has_clock_gettime_syscall" = x"yes"; then | |
2e8a9734 | 1895 | AC_DEFINE(_GLIBCXX_USE_CLOCK_GETTIME_SYSCALL, 1, |
1e3e6c70 | 1896 | [Defined if clock_gettime syscall has monotonic and realtime clock support. ]) |
2e8a9734 JJ |
1897 | ac_has_clock_monotonic=yes |
1898 | ac_has_clock_realtime=yes | |
1e3e6c70 JW |
1899 | AC_MSG_CHECKING([for struct timespec that matches syscall]) |
1900 | AC_TRY_COMPILE( | |
1901 | [#include <time.h> | |
1902 | #include <sys/syscall.h> | |
1903 | ], | |
1904 | [#ifdef SYS_clock_gettime64 | |
1905 | #if SYS_clock_gettime64 != SYS_clock_gettime | |
1906 | // We need to use SYS_clock_gettime and libc appears to | |
1907 | // also know about the SYS_clock_gettime64 syscall. | |
1908 | // Check that userspace doesn't use time64 version of timespec. | |
1909 | static_assert(sizeof(timespec::tv_sec) == sizeof(long), | |
1910 | "struct timespec must be compatible with SYS_clock_gettime"); | |
1911 | #endif | |
1912 | #endif | |
1913 | ], | |
1914 | [ac_timespec_matches_syscall=yes], | |
1915 | [ac_timespec_matches_syscall=no]) | |
1916 | AC_MSG_RESULT($ac_timespec_matches_syscall) | |
1917 | if test x"$ac_timespec_matches_syscall" = no; then | |
1918 | AC_MSG_ERROR([struct timespec is not compatible with SYS_clock_gettime, please report a bug to http://gcc.gnu.org/bugzilla]) | |
1919 | fi | |
2e8a9734 JJ |
1920 | fi;; |
1921 | esac | |
1922 | fi | |
1923 | ||
15e38d0d CF |
1924 | if test x"$ac_has_clock_monotonic" = x"yes"; then |
1925 | AC_DEFINE(_GLIBCXX_USE_CLOCK_MONOTONIC, 1, | |
1926 | [ Defined if clock_gettime has monotonic clock support. ]) | |
1927 | fi | |
ec6fa56a | 1928 | |
15e38d0d CF |
1929 | if test x"$ac_has_clock_realtime" = x"yes"; then |
1930 | AC_DEFINE(_GLIBCXX_USE_CLOCK_REALTIME, 1, | |
1931 | [ Defined if clock_gettime has realtime clock support. ]) | |
1932 | fi | |
ec6fa56a | 1933 | |
88b1a025 JW |
1934 | if test x"$ac_has_sched_yield" = x"yes"; then |
1935 | AC_DEFINE(_GLIBCXX_USE_SCHED_YIELD, 1, | |
1936 | [ Defined if sched_yield is available. ]) | |
1937 | fi | |
1938 | ||
959d14e1 CF |
1939 | if test x"$ac_has_nanosleep" = x"yes"; then |
1940 | AC_DEFINE(_GLIBCXX_USE_NANOSLEEP, 1, | |
1941 | [ Defined if nanosleep is available. ]) | |
9149a5b7 EB |
1942 | elif test x"$ac_has_win32_sleep" = x"yes"; then |
1943 | AC_DEFINE(_GLIBCXX_USE_WIN32_SLEEP, 1, | |
1944 | [Defined if Sleep exists.]) | |
aa66b299 JW |
1945 | else |
1946 | AC_MSG_CHECKING([for sleep]) | |
1947 | AC_TRY_COMPILE([#include <unistd.h>], | |
1948 | [sleep(1)], | |
1949 | [ac_has_sleep=yes],[ac_has_sleep=no]) | |
1950 | if test x"$ac_has_sleep" = x"yes"; then | |
1951 | AC_DEFINE(HAVE_SLEEP,1, [Defined if sleep exists.]) | |
1952 | fi | |
1953 | AC_MSG_RESULT($ac_has_sleep) | |
1954 | AC_MSG_CHECKING([for usleep]) | |
1955 | AC_TRY_COMPILE([#include <unistd.h>], | |
1956 | [sleep(1); | |
1957 | usleep(100);], | |
1958 | [ac_has_usleep=yes],[ac_has_usleep=no]) | |
1959 | if test x"$ac_has_usleep" = x"yes"; then | |
1960 | AC_DEFINE(HAVE_USLEEP,1, [Defined if usleep exists.]) | |
1961 | fi | |
1962 | AC_MSG_RESULT($ac_has_usleep) | |
959d14e1 CF |
1963 | fi |
1964 | ||
9149a5b7 | 1965 | if test x"$ac_has_nanosleep$ac_has_win32_sleep$ac_has_sleep" = x"nonono"; then |
ca1c7065 | 1966 | AC_DEFINE(_GLIBCXX_NO_SLEEP,1, [Defined if no way to sleep is available.]) |
0aa1786d JW |
1967 | fi |
1968 | ||
ec6fa56a PB |
1969 | AC_SUBST(GLIBCXX_LIBS) |
1970 | ||
15e38d0d | 1971 | CXXFLAGS="$ac_save_CXXFLAGS" |
ec6fa56a | 1972 | LIBS="$ac_save_LIBS" |
15e38d0d CF |
1973 | AC_LANG_RESTORE |
1974 | ]) | |
1975 | ||
1976 | dnl | |
9ab48d6e JW |
1977 | dnl Check for gettimeofday, used in the implementation of 20.11.7 |
1978 | dnl [time.clock] in the C++11 standard. | |
15e38d0d CF |
1979 | dnl |
1980 | AC_DEFUN([GLIBCXX_CHECK_GETTIMEOFDAY], [ | |
b329dd10 | 1981 | |
610870b2 PC |
1982 | AC_MSG_CHECKING([for gettimeofday]) |
1983 | ||
15e38d0d CF |
1984 | AC_LANG_SAVE |
1985 | AC_LANG_CPLUSPLUS | |
1986 | ac_save_CXXFLAGS="$CXXFLAGS" | |
1987 | CXXFLAGS="$CXXFLAGS -fno-exceptions" | |
b329dd10 | 1988 | |
15e38d0d CF |
1989 | ac_has_gettimeofday=no; |
1990 | AC_CHECK_HEADERS(sys/time.h, ac_has_sys_time_h=yes, ac_has_sys_time_h=no) | |
1991 | if test x"$ac_has_sys_time_h" = x"yes"; then | |
1992 | AC_MSG_CHECKING([for gettimeofday]) | |
610870b2 | 1993 | GCC_TRY_COMPILE_OR_LINK([#include <sys/time.h>], |
15e38d0d CF |
1994 | [timeval tv; gettimeofday(&tv, 0);], |
1995 | [ac_has_gettimeofday=yes], [ac_has_gettimeofday=no]) | |
b329dd10 | 1996 | |
15e38d0d CF |
1997 | AC_MSG_RESULT($ac_has_gettimeofday) |
1998 | fi | |
b329dd10 | 1999 | |
15e38d0d CF |
2000 | if test x"$ac_has_gettimeofday" = x"yes"; then |
2001 | AC_DEFINE(_GLIBCXX_USE_GETTIMEOFDAY, 1, | |
2002 | [ Defined if gettimeofday is available. ]) | |
2003 | fi | |
b329dd10 | 2004 | |
15e38d0d CF |
2005 | CXXFLAGS="$ac_save_CXXFLAGS" |
2006 | AC_LANG_RESTORE | |
2007 | ]) | |
2008 | ||
bd2bb1ea PC |
2009 | dnl |
2010 | dnl Check for ISO/IEC 9899:1999 "C99" support to ISO/IEC DTR 19768 "TR1" | |
2011 | dnl facilities in Chapter 8, "C compatibility". | |
2012 | dnl | |
2013 | AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [ | |
2014 | ||
2015 | AC_LANG_SAVE | |
2016 | AC_LANG_CPLUSPLUS | |
2017 | ||
6190a74e | 2018 | # Use -std=c++98 because -std=gnu++98 leaves __STRICT_ANSI__ |
18f310b7 PC |
2019 | # undefined and fake C99 facilities may be spuriously enabled. |
2020 | ac_save_CXXFLAGS="$CXXFLAGS" | |
2021 | CXXFLAGS="$CXXFLAGS -std=c++98" | |
2022 | ||
bd2bb1ea PC |
2023 | # Check for the existence of <complex.h> complex math functions used |
2024 | # by tr1/complex. | |
2025 | AC_CHECK_HEADERS(complex.h, ac_has_complex_h=yes, ac_has_complex_h=no) | |
2026 | ac_c99_complex_tr1=no; | |
2027 | if test x"$ac_has_complex_h" = x"yes"; then | |
2028 | AC_MSG_CHECKING([for ISO C99 support to TR1 in <complex.h>]) | |
2029 | AC_TRY_COMPILE([#include <complex.h>], | |
b329dd10 BK |
2030 | [typedef __complex__ float float_type; float_type tmpf; |
2031 | cacosf(tmpf); | |
2032 | casinf(tmpf); | |
2033 | catanf(tmpf); | |
2034 | cacoshf(tmpf); | |
2035 | casinhf(tmpf); | |
2036 | catanhf(tmpf); | |
bd2bb1ea | 2037 | typedef __complex__ double double_type; double_type tmpd; |
b329dd10 BK |
2038 | cacos(tmpd); |
2039 | casin(tmpd); | |
2040 | catan(tmpd); | |
2041 | cacosh(tmpd); | |
2042 | casinh(tmpd); | |
2043 | catanh(tmpd); | |
bd2bb1ea | 2044 | typedef __complex__ long double ld_type; ld_type tmpld; |
b329dd10 BK |
2045 | cacosl(tmpld); |
2046 | casinl(tmpld); | |
2047 | catanl(tmpld); | |
2048 | cacoshl(tmpld); | |
2049 | casinhl(tmpld); | |
2050 | catanhl(tmpld); | |
bd2bb1ea PC |
2051 | ],[ac_c99_complex_tr1=yes], [ac_c99_complex_tr1=no]) |
2052 | fi | |
2053 | AC_MSG_RESULT($ac_c99_complex_tr1) | |
2054 | if test x"$ac_c99_complex_tr1" = x"yes"; then | |
2055 | AC_DEFINE(_GLIBCXX_USE_C99_COMPLEX_TR1, 1, | |
b329dd10 BK |
2056 | [Define if C99 functions in <complex.h> should be used in |
2057 | <tr1/complex>. Using compiler builtins for these functions | |
bd2bb1ea PC |
2058 | requires corresponding C99 library functions to be present.]) |
2059 | fi | |
2060 | ||
2061 | # Check for the existence of <ctype.h> functions. | |
9646a322 JW |
2062 | AC_CACHE_CHECK([for ISO C99 support to TR1 in <ctype.h>], |
2063 | glibcxx_cv_c99_ctype_tr1, [ | |
bd2bb1ea | 2064 | AC_TRY_COMPILE([#include <ctype.h>], |
b329dd10 BK |
2065 | [int ch; |
2066 | int ret; | |
2067 | ret = isblank(ch); | |
0f24e8de PC |
2068 | ],[glibcxx_cv_c99_ctype_tr1=yes], |
2069 | [glibcxx_cv_c99_ctype_tr1=no]) | |
bd2bb1ea | 2070 | ]) |
6d26724a | 2071 | if test x"$glibcxx_cv_c99_ctype_tr1" = x"yes"; then |
bd2bb1ea | 2072 | AC_DEFINE(_GLIBCXX_USE_C99_CTYPE_TR1, 1, |
b329dd10 | 2073 | [Define if C99 functions in <ctype.h> should be imported in |
bd2bb1ea PC |
2074 | <tr1/cctype> in namespace std::tr1.]) |
2075 | fi | |
2076 | ||
20921e53 PC |
2077 | # Check for the existence of <fenv.h> functions. |
2078 | AC_CHECK_HEADERS(fenv.h, ac_has_fenv_h=yes, ac_has_fenv_h=no) | |
2079 | ac_c99_fenv_tr1=no; | |
2080 | if test x"$ac_has_fenv_h" = x"yes"; then | |
2081 | AC_MSG_CHECKING([for ISO C99 support to TR1 in <fenv.h>]) | |
2082 | AC_TRY_COMPILE([#include <fenv.h>], | |
b329dd10 BK |
2083 | [int except, mode; |
2084 | fexcept_t* pflag; | |
2085 | fenv_t* penv; | |
2086 | int ret; | |
2087 | ret = feclearexcept(except); | |
2088 | ret = fegetexceptflag(pflag, except); | |
2089 | ret = feraiseexcept(except); | |
2090 | ret = fesetexceptflag(pflag, except); | |
2091 | ret = fetestexcept(except); | |
2092 | ret = fegetround(); | |
2093 | ret = fesetround(mode); | |
2094 | ret = fegetenv(penv); | |
2095 | ret = feholdexcept(penv); | |
2096 | ret = fesetenv(penv); | |
2097 | ret = feupdateenv(penv); | |
20921e53 | 2098 | ],[ac_c99_fenv_tr1=yes], [ac_c99_fenv_tr1=no]) |
9646a322 | 2099 | AC_MSG_RESULT($ac_c99_fenv_tr1) |
20921e53 | 2100 | fi |
20921e53 PC |
2101 | if test x"$ac_c99_fenv_tr1" = x"yes"; then |
2102 | AC_DEFINE(_GLIBCXX_USE_C99_FENV_TR1, 1, | |
b329dd10 | 2103 | [Define if C99 functions in <fenv.h> should be imported in |
20921e53 PC |
2104 | <tr1/cfenv> in namespace std::tr1.]) |
2105 | fi | |
2106 | ||
2a1d6346 | 2107 | # Check for the existence of <stdint.h> types. |
9646a322 JW |
2108 | AC_CACHE_CHECK([for ISO C99 support to TR1 in <stdint.h>], |
2109 | glibcxx_cv_c99_stdint_tr1, [ | |
5289e808 | 2110 | AC_TRY_COMPILE([#define __STDC_LIMIT_MACROS |
b329dd10 BK |
2111 | #define __STDC_CONSTANT_MACROS |
2112 | #include <stdint.h>], | |
2113 | [typedef int8_t my_int8_t; | |
5289e808 PC |
2114 | my_int8_t i8 = INT8_MIN; |
2115 | i8 = INT8_MAX; | |
b329dd10 | 2116 | typedef int16_t my_int16_t; |
5289e808 PC |
2117 | my_int16_t i16 = INT16_MIN; |
2118 | i16 = INT16_MAX; | |
b329dd10 | 2119 | typedef int32_t my_int32_t; |
5289e808 PC |
2120 | my_int32_t i32 = INT32_MIN; |
2121 | i32 = INT32_MAX; | |
b329dd10 | 2122 | typedef int64_t my_int64_t; |
5289e808 PC |
2123 | my_int64_t i64 = INT64_MIN; |
2124 | i64 = INT64_MAX; | |
b329dd10 | 2125 | typedef int_fast8_t my_int_fast8_t; |
5289e808 PC |
2126 | my_int_fast8_t if8 = INT_FAST8_MIN; |
2127 | if8 = INT_FAST8_MAX; | |
b329dd10 | 2128 | typedef int_fast16_t my_int_fast16_t; |
5289e808 PC |
2129 | my_int_fast16_t if16 = INT_FAST16_MIN; |
2130 | if16 = INT_FAST16_MAX; | |
b329dd10 | 2131 | typedef int_fast32_t my_int_fast32_t; |
5289e808 PC |
2132 | my_int_fast32_t if32 = INT_FAST32_MIN; |
2133 | if32 = INT_FAST32_MAX; | |
b329dd10 | 2134 | typedef int_fast64_t my_int_fast64_t; |
5289e808 PC |
2135 | my_int_fast64_t if64 = INT_FAST64_MIN; |
2136 | if64 = INT_FAST64_MAX; | |
b329dd10 | 2137 | typedef int_least8_t my_int_least8_t; |
5289e808 PC |
2138 | my_int_least8_t il8 = INT_LEAST8_MIN; |
2139 | il8 = INT_LEAST8_MAX; | |
b329dd10 | 2140 | typedef int_least16_t my_int_least16_t; |
5289e808 PC |
2141 | my_int_least16_t il16 = INT_LEAST16_MIN; |
2142 | il16 = INT_LEAST16_MAX; | |
b329dd10 | 2143 | typedef int_least32_t my_int_least32_t; |
5289e808 PC |
2144 | my_int_least32_t il32 = INT_LEAST32_MIN; |
2145 | il32 = INT_LEAST32_MAX; | |
b329dd10 | 2146 | typedef int_least64_t my_int_least64_t; |
5289e808 PC |
2147 | my_int_least64_t il64 = INT_LEAST64_MIN; |
2148 | il64 = INT_LEAST64_MAX; | |
2a1d6346 | 2149 | typedef intmax_t my_intmax_t; |
5289e808 PC |
2150 | my_intmax_t im = INTMAX_MAX; |
2151 | im = INTMAX_MIN; | |
2a1d6346 | 2152 | typedef intptr_t my_intptr_t; |
5289e808 PC |
2153 | my_intptr_t ip = INTPTR_MAX; |
2154 | ip = INTPTR_MIN; | |
b329dd10 | 2155 | typedef uint8_t my_uint8_t; |
5289e808 PC |
2156 | my_uint8_t ui8 = UINT8_MAX; |
2157 | ui8 = UINT8_MAX; | |
b329dd10 | 2158 | typedef uint16_t my_uint16_t; |
5289e808 PC |
2159 | my_uint16_t ui16 = UINT16_MAX; |
2160 | ui16 = UINT16_MAX; | |
b329dd10 | 2161 | typedef uint32_t my_uint32_t; |
5289e808 PC |
2162 | my_uint32_t ui32 = UINT32_MAX; |
2163 | ui32 = UINT32_MAX; | |
b329dd10 | 2164 | typedef uint64_t my_uint64_t; |
5289e808 PC |
2165 | my_uint64_t ui64 = UINT64_MAX; |
2166 | ui64 = UINT64_MAX; | |
b329dd10 | 2167 | typedef uint_fast8_t my_uint_fast8_t; |
5289e808 PC |
2168 | my_uint_fast8_t uif8 = UINT_FAST8_MAX; |
2169 | uif8 = UINT_FAST8_MAX; | |
b329dd10 | 2170 | typedef uint_fast16_t my_uint_fast16_t; |
5289e808 PC |
2171 | my_uint_fast16_t uif16 = UINT_FAST16_MAX; |
2172 | uif16 = UINT_FAST16_MAX; | |
b329dd10 | 2173 | typedef uint_fast32_t my_uint_fast32_t; |
5289e808 PC |
2174 | my_uint_fast32_t uif32 = UINT_FAST32_MAX; |
2175 | uif32 = UINT_FAST32_MAX; | |
b329dd10 | 2176 | typedef uint_fast64_t my_uint_fast64_t; |
5289e808 PC |
2177 | my_uint_fast64_t uif64 = UINT_FAST64_MAX; |
2178 | uif64 = UINT_FAST64_MAX; | |
b329dd10 | 2179 | typedef uint_least8_t my_uint_least8_t; |
5289e808 PC |
2180 | my_uint_least8_t uil8 = UINT_LEAST8_MAX; |
2181 | uil8 = UINT_LEAST8_MAX; | |
b329dd10 | 2182 | typedef uint_least16_t my_uint_least16_t; |
5289e808 PC |
2183 | my_uint_least16_t uil16 = UINT_LEAST16_MAX; |
2184 | uil16 = UINT_LEAST16_MAX; | |
b329dd10 | 2185 | typedef uint_least32_t my_uint_least32_t; |
5289e808 PC |
2186 | my_uint_least32_t uil32 = UINT_LEAST32_MAX; |
2187 | uil32 = UINT_LEAST32_MAX; | |
b329dd10 | 2188 | typedef uint_least64_t my_uint_least64_t; |
5289e808 PC |
2189 | my_uint_least64_t uil64 = UINT_LEAST64_MAX; |
2190 | uil64 = UINT_LEAST64_MAX; | |
2a1d6346 | 2191 | typedef uintmax_t my_uintmax_t; |
5289e808 PC |
2192 | my_uintmax_t uim = UINTMAX_MAX; |
2193 | uim = UINTMAX_MAX; | |
2a1d6346 | 2194 | typedef uintptr_t my_uintptr_t; |
5289e808 PC |
2195 | my_uintptr_t uip = UINTPTR_MAX; |
2196 | uip = UINTPTR_MAX; | |
0f24e8de PC |
2197 | ],[glibcxx_cv_c99_stdint_tr1=yes], |
2198 | [glibcxx_cv_c99_stdint_tr1=no]) | |
2a1d6346 | 2199 | ]) |
6d26724a | 2200 | if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then |
2a1d6346 | 2201 | AC_DEFINE(_GLIBCXX_USE_C99_STDINT_TR1, 1, |
b329dd10 | 2202 | [Define if C99 types in <stdint.h> should be imported in |
2a1d6346 PC |
2203 | <tr1/cstdint> in namespace std::tr1.]) |
2204 | fi | |
2205 | ||
4f0de5dd | 2206 | # Check for the existence of <math.h> functions. |
9646a322 JW |
2207 | AC_CACHE_CHECK([for ISO C99 support to TR1 in <math.h>], |
2208 | glibcxx_cv_c99_math_tr1, [ | |
4f0de5dd | 2209 | AC_TRY_COMPILE([#include <math.h>], |
b329dd10 BK |
2210 | [typedef double_t my_double_t; |
2211 | typedef float_t my_float_t; | |
2212 | acosh(0.0); | |
2213 | acoshf(0.0f); | |
2214 | acoshl(0.0l); | |
2215 | asinh(0.0); | |
2216 | asinhf(0.0f); | |
2217 | asinhl(0.0l); | |
2218 | atanh(0.0); | |
2219 | atanhf(0.0f); | |
2220 | atanhl(0.0l); | |
2221 | cbrt(0.0); | |
2222 | cbrtf(0.0f); | |
2223 | cbrtl(0.0l); | |
2224 | copysign(0.0, 0.0); | |
2225 | copysignf(0.0f, 0.0f); | |
2226 | copysignl(0.0l, 0.0l); | |
2227 | erf(0.0); | |
2228 | erff(0.0f); | |
2229 | erfl(0.0l); | |
2230 | erfc(0.0); | |
2231 | erfcf(0.0f); | |
2232 | erfcl(0.0l); | |
2233 | exp2(0.0); | |
2234 | exp2f(0.0f); | |
2235 | exp2l(0.0l); | |
2236 | expm1(0.0); | |
2237 | expm1f(0.0f); | |
2238 | expm1l(0.0l); | |
2239 | fdim(0.0, 0.0); | |
2240 | fdimf(0.0f, 0.0f); | |
2241 | fdiml(0.0l, 0.0l); | |
2242 | fma(0.0, 0.0, 0.0); | |
2243 | fmaf(0.0f, 0.0f, 0.0f); | |
2244 | fmal(0.0l, 0.0l, 0.0l); | |
2245 | fmax(0.0, 0.0); | |
2246 | fmaxf(0.0f, 0.0f); | |
2247 | fmaxl(0.0l, 0.0l); | |
2248 | fmin(0.0, 0.0); | |
2249 | fminf(0.0f, 0.0f); | |
2250 | fminl(0.0l, 0.0l); | |
2251 | hypot(0.0, 0.0); | |
2252 | hypotf(0.0f, 0.0f); | |
2253 | hypotl(0.0l, 0.0l); | |
2254 | ilogb(0.0); | |
2255 | ilogbf(0.0f); | |
2256 | ilogbl(0.0l); | |
2257 | lgamma(0.0); | |
2258 | lgammaf(0.0f); | |
2259 | lgammal(0.0l); | |
a7765de8 | 2260 | #ifndef __APPLE__ /* see below */ |
b329dd10 BK |
2261 | llrint(0.0); |
2262 | llrintf(0.0f); | |
2263 | llrintl(0.0l); | |
2264 | llround(0.0); | |
2265 | llroundf(0.0f); | |
2266 | llroundl(0.0l); | |
a7765de8 | 2267 | #endif |
b329dd10 BK |
2268 | log1p(0.0); |
2269 | log1pf(0.0f); | |
2270 | log1pl(0.0l); | |
2271 | log2(0.0); | |
2272 | log2f(0.0f); | |
2273 | log2l(0.0l); | |
2274 | logb(0.0); | |
2275 | logbf(0.0f); | |
2276 | logbl(0.0l); | |
2277 | lrint(0.0); | |
2278 | lrintf(0.0f); | |
2279 | lrintl(0.0l); | |
2280 | lround(0.0); | |
2281 | lroundf(0.0f); | |
2282 | lroundl(0.0l); | |
6190a74e JW |
2283 | nan(""); |
2284 | nanf(""); | |
2285 | nanl(""); | |
b329dd10 BK |
2286 | nearbyint(0.0); |
2287 | nearbyintf(0.0f); | |
2288 | nearbyintl(0.0l); | |
2289 | nextafter(0.0, 0.0); | |
2290 | nextafterf(0.0f, 0.0f); | |
2291 | nextafterl(0.0l, 0.0l); | |
2292 | nexttoward(0.0, 0.0); | |
2293 | nexttowardf(0.0f, 0.0f); | |
2294 | nexttowardl(0.0l, 0.0l); | |
2295 | remainder(0.0, 0.0); | |
2296 | remainderf(0.0f, 0.0f); | |
2297 | remainderl(0.0l, 0.0l); | |
2298 | remquo(0.0, 0.0, 0); | |
2299 | remquof(0.0f, 0.0f, 0); | |
2300 | remquol(0.0l, 0.0l, 0); | |
2301 | rint(0.0); | |
2302 | rintf(0.0f); | |
2303 | rintl(0.0l); | |
2304 | round(0.0); | |
2305 | roundf(0.0f); | |
2306 | roundl(0.0l); | |
2307 | scalbln(0.0, 0l); | |
2308 | scalblnf(0.0f, 0l); | |
2309 | scalblnl(0.0l, 0l); | |
2310 | scalbn(0.0, 0); | |
2311 | scalbnf(0.0f, 0); | |
2312 | scalbnl(0.0l, 0); | |
2313 | tgamma(0.0); | |
2314 | tgammaf(0.0f); | |
2315 | tgammal(0.0l); | |
2316 | trunc(0.0); | |
2317 | truncf(0.0f); | |
2318 | truncl(0.0l); | |
6d26724a | 2319 | ],[glibcxx_cv_c99_math_tr1=yes], [glibcxx_cv_c99_math_tr1=no]) |
4f0de5dd | 2320 | ]) |
6d26724a | 2321 | if test x"$glibcxx_cv_c99_math_tr1" = x"yes"; then |
4f0de5dd | 2322 | AC_DEFINE(_GLIBCXX_USE_C99_MATH_TR1, 1, |
b329dd10 BK |
2323 | [Define if C99 functions or macros in <math.h> should be imported |
2324 | in <tr1/cmath> in namespace std::tr1.]) | |
4f0de5dd PC |
2325 | fi |
2326 | ||
03bf3bc1 | 2327 | # Check for the existence of <inttypes.h> functions (NB: doesn't make |
a834e097 | 2328 | # sense if the glibcxx_cv_c99_stdint_tr1 check fails, per C99, 7.8/1). |
03bf3bc1 | 2329 | ac_c99_inttypes_tr1=no; |
6d26724a | 2330 | if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then |
03bf3bc1 PC |
2331 | AC_MSG_CHECKING([for ISO C99 support to TR1 in <inttypes.h>]) |
2332 | AC_TRY_COMPILE([#include <inttypes.h>], | |
b329dd10 BK |
2333 | [intmax_t i, numer, denom, base; |
2334 | const char* s; | |
2335 | char** endptr; | |
2336 | intmax_t ret = imaxabs(i); | |
2337 | imaxdiv_t dret = imaxdiv(numer, denom); | |
2338 | ret = strtoimax(s, endptr, base); | |
2339 | uintmax_t uret = strtoumax(s, endptr, base); | |
2340 | ],[ac_c99_inttypes_tr1=yes], [ac_c99_inttypes_tr1=no]) | |
9646a322 | 2341 | AC_MSG_RESULT($ac_c99_inttypes_tr1) |
03bf3bc1 | 2342 | fi |
52a64bd3 PC |
2343 | if test x"$ac_c99_inttypes_tr1" = x"yes"; then |
2344 | AC_DEFINE(_GLIBCXX_USE_C99_INTTYPES_TR1, 1, | |
b329dd10 BK |
2345 | [Define if C99 functions in <inttypes.h> should be imported in |
2346 | <tr1/cinttypes> in namespace std::tr1.]) | |
52a64bd3 PC |
2347 | fi |
2348 | ||
bb93f35d | 2349 | # Check for the existence of wchar_t <inttypes.h> functions (NB: doesn't |
a834e097 PC |
2350 | # make sense if the glibcxx_cv_c99_stdint_tr1 check fails, per C99, 7.8/1). |
2351 | ac_c99_inttypes_wchar_t_tr1=no; | |
2352 | if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then | |
2353 | AC_MSG_CHECKING([for wchar_t ISO C99 support to TR1 in <inttypes.h>]) | |
2354 | AC_TRY_COMPILE([#include <inttypes.h>], | |
b329dd10 | 2355 | [intmax_t base; |
a834e097 | 2356 | const wchar_t* s; |
b329dd10 BK |
2357 | wchar_t** endptr; |
2358 | intmax_t ret = wcstoimax(s, endptr, base); | |
2359 | uintmax_t uret = wcstoumax(s, endptr, base); | |
2360 | ],[ac_c99_inttypes_wchar_t_tr1=yes], | |
a834e097 | 2361 | [ac_c99_inttypes_wchar_t_tr1=no]) |
9646a322 | 2362 | AC_MSG_RESULT($ac_c99_inttypes_wchar_t_tr1) |
a834e097 | 2363 | fi |
a834e097 PC |
2364 | if test x"$ac_c99_inttypes_wchar_t_tr1" = x"yes"; then |
2365 | AC_DEFINE(_GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1, 1, | |
b329dd10 | 2366 | [Define if wchar_t C99 functions in <inttypes.h> should be |
a834e097 PC |
2367 | imported in <tr1/cinttypes> in namespace std::tr1.]) |
2368 | fi | |
2369 | ||
b329dd10 | 2370 | # Check for the existence of the <stdbool.h> header. |
1e41a98c PC |
2371 | AC_CHECK_HEADERS(stdbool.h) |
2372 | ||
e0f0ee74 JW |
2373 | # Check for the existence of the <stdalign.h> header. |
2374 | AC_CHECK_HEADERS(stdalign.h) | |
2375 | ||
18f310b7 | 2376 | CXXFLAGS="$ac_save_CXXFLAGS" |
bd2bb1ea PC |
2377 | AC_LANG_RESTORE |
2378 | ]) | |
2379 | ||
20b5f0b3 ESR |
2380 | dnl |
2381 | dnl Check for uchar.h and usability. | |
2382 | dnl | |
2383 | AC_DEFUN([GLIBCXX_CHECK_UCHAR_H], [ | |
2384 | ||
2385 | # Test uchar.h. | |
2386 | AC_CHECK_HEADERS(uchar.h, ac_has_uchar_h=yes, ac_has_uchar_h=no) | |
2387 | ||
2388 | AC_LANG_SAVE | |
2389 | AC_LANG_CPLUSPLUS | |
2390 | ac_save_CXXFLAGS="$CXXFLAGS" | |
2391 | CXXFLAGS="$CXXFLAGS -std=c++11" | |
2392 | ||
2393 | if test x"$ac_has_uchar_h" = x"yes"; then | |
2394 | AC_MSG_CHECKING([for ISO C11 support for <uchar.h>]) | |
2395 | AC_TRY_COMPILE([#include <uchar.h> | |
2396 | #ifdef __STDC_UTF_16__ | |
2397 | long i = __STDC_UTF_16__; | |
2398 | #endif | |
2399 | #ifdef __STDC_UTF_32__ | |
2400 | long j = __STDC_UTF_32__; | |
2401 | #endif | |
2402 | namespace test | |
2403 | { | |
2404 | using ::c16rtomb; | |
2405 | using ::c32rtomb; | |
2406 | using ::mbrtoc16; | |
2407 | using ::mbrtoc32; | |
2408 | } | |
2409 | ], | |
2410 | [], [ac_c11_uchar_cxx11=yes], [ac_c11_uchar_cxx11=no]) | |
9646a322 | 2411 | AC_MSG_RESULT($ac_c11_uchar_cxx11) |
20b5f0b3 ESR |
2412 | else |
2413 | ac_c11_uchar_cxx11=no | |
2414 | fi | |
20b5f0b3 ESR |
2415 | if test x"$ac_c11_uchar_cxx11" = x"yes"; then |
2416 | AC_DEFINE(_GLIBCXX_USE_C11_UCHAR_CXX11, 1, | |
2417 | [Define if C11 functions in <uchar.h> should be imported into | |
2418 | namespace std in <cuchar>.]) | |
2419 | fi | |
2420 | ||
0e4e4b37 TH |
2421 | CXXFLAGS="$CXXFLAGS -fchar8_t" |
2422 | if test x"$ac_has_uchar_h" = x"yes"; then | |
2423 | AC_MSG_CHECKING([for c8rtomb and mbrtoc8 in <uchar.h> with -fchar8_t]) | |
2424 | AC_TRY_COMPILE([#include <uchar.h> | |
2425 | namespace test | |
2426 | { | |
2427 | using ::c8rtomb; | |
2428 | using ::mbrtoc8; | |
2429 | } | |
2430 | ], | |
2431 | [], [ac_uchar_c8rtomb_mbrtoc8_fchar8_t=yes], | |
2432 | [ac_uchar_c8rtomb_mbrtoc8_fchar8_t=no]) | |
7b648e83 | 2433 | AC_MSG_RESULT($ac_uchar_c8rtomb_mbrtoc8_fchar8_t) |
0e4e4b37 TH |
2434 | else |
2435 | ac_uchar_c8rtomb_mbrtoc8_fchar8_t=no | |
2436 | fi | |
0e4e4b37 TH |
2437 | if test x"$ac_uchar_c8rtomb_mbrtoc8_fchar8_t" = x"yes"; then |
2438 | AC_DEFINE(_GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_FCHAR8_T, 1, | |
2439 | [Define if c8rtomb and mbrtoc8 functions in <uchar.h> should be | |
2440 | imported into namespace std in <cuchar> for -fchar8_t.]) | |
2441 | fi | |
2442 | ||
2443 | CXXFLAGS="$CXXFLAGS -std=c++20" | |
2444 | if test x"$ac_has_uchar_h" = x"yes"; then | |
2445 | AC_MSG_CHECKING([for c8rtomb and mbrtoc8 in <uchar.h> with -std=c++20]) | |
2446 | AC_TRY_COMPILE([#include <uchar.h> | |
2447 | namespace test | |
2448 | { | |
2449 | using ::c8rtomb; | |
2450 | using ::mbrtoc8; | |
2451 | } | |
2452 | ], | |
2453 | [], [ac_uchar_c8rtomb_mbrtoc8_cxx20=yes], | |
2454 | [ac_uchar_c8rtomb_mbrtoc8_cxx20=no]) | |
7b648e83 | 2455 | AC_MSG_RESULT($ac_uchar_c8rtomb_mbrtoc8_cxx20) |
0e4e4b37 TH |
2456 | else |
2457 | ac_uchar_c8rtomb_mbrtoc8_cxx20=no | |
2458 | fi | |
0e4e4b37 TH |
2459 | if test x"$ac_uchar_c8rtomb_mbrtoc8_cxx20" = x"yes"; then |
2460 | AC_DEFINE(_GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_CXX20, 1, | |
2461 | [Define if c8rtomb and mbrtoc8 functions in <uchar.h> should be | |
2462 | imported into namespace std in <cuchar> for C++20.]) | |
2463 | fi | |
2464 | ||
20b5f0b3 ESR |
2465 | CXXFLAGS="$ac_save_CXXFLAGS" |
2466 | AC_LANG_RESTORE | |
2467 | ]) | |
2468 | ||
2469 | ||
d8bc9819 | 2470 | dnl |
5ae2c32a JW |
2471 | dnl Check whether "/dev/random" and "/dev/urandom" are available for |
2472 | dnl class std::random_device from C++ 2011 [rand.device], and | |
d8bc9819 PC |
2473 | dnl random_device of "TR1" (Chapter 5.1, "Random number generation"). |
2474 | dnl | |
5ae2c32a | 2475 | AC_DEFUN([GLIBCXX_CHECK_DEV_RANDOM], [ |
d8bc9819 | 2476 | |
9646a322 JW |
2477 | AC_CACHE_CHECK([for "/dev/random" and "/dev/urandom" for std::random_device], |
2478 | glibcxx_cv_dev_random, [ | |
9ce0a22e | 2479 | if test -r /dev/random && test -r /dev/urandom; then |
5ae2c32a JW |
2480 | ## For MSys environment the test above is detected as false-positive |
2481 | ## on mingw-targets. So disable it explicitly for them. | |
cf2f3b1b | 2482 | case ${target_os} in |
5ae2c32a JW |
2483 | *mingw*) glibcxx_cv_dev_random=no ;; |
2484 | *) glibcxx_cv_dev_random=yes ;; | |
cf2f3b1b | 2485 | esac |
9ce0a22e | 2486 | else |
5ae2c32a | 2487 | glibcxx_cv_dev_random=no; |
9ce0a22e | 2488 | fi |
d8bc9819 | 2489 | ]) |
9ce0a22e | 2490 | |
5ae2c32a JW |
2491 | if test x"$glibcxx_cv_dev_random" = x"yes"; then |
2492 | AC_DEFINE(_GLIBCXX_USE_DEV_RANDOM, 1, | |
2493 | [Define if /dev/random and /dev/urandom are available for | |
2494 | std::random_device.]) | |
d8bc9819 | 2495 | AC_DEFINE(_GLIBCXX_USE_RANDOM_TR1, 1, |
b329dd10 | 2496 | [Define if /dev/random and /dev/urandom are available for |
d8bc9819 PC |
2497 | the random_device of TR1 (Chapter 5.1).]) |
2498 | fi | |
2499 | ||
2500 | ]) | |
bd2bb1ea | 2501 | |
1814157e | 2502 | dnl |
ddc9c40d PC |
2503 | dnl Compute the EOF, SEEK_CUR, and SEEK_END integer constants. |
2504 | dnl | |
2505 | AC_DEFUN([GLIBCXX_COMPUTE_STDIO_INTEGER_CONSTANTS], [ | |
2506 | ||
68c2e9e9 | 2507 | if test "$is_hosted" = yes; then |
9b04fa91 | 2508 | AC_CACHE_CHECK([for the value of EOF], glibcxx_cv_stdio_eof, [ |
ddc9c40d | 2509 | AC_COMPUTE_INT([glibcxx_cv_stdio_eof], [[EOF]], |
b329dd10 BK |
2510 | [#include <stdio.h>], |
2511 | [AC_MSG_ERROR([computing EOF failed])]) | |
ddc9c40d | 2512 | ]) |
ddc9c40d | 2513 | AC_DEFINE_UNQUOTED(_GLIBCXX_STDIO_EOF, $glibcxx_cv_stdio_eof, |
b329dd10 | 2514 | [Define to the value of the EOF integer constant.]) |
ddc9c40d | 2515 | |
9b04fa91 | 2516 | AC_CACHE_CHECK([for the value of SEEK_CUR], glibcxx_cv_stdio_seek_cur, [ |
ddc9c40d | 2517 | AC_COMPUTE_INT([glibcxx_cv_stdio_seek_cur], [[SEEK_CUR]], |
b329dd10 BK |
2518 | [#include <stdio.h>], |
2519 | [AC_MSG_ERROR([computing SEEK_CUR failed])]) | |
ddc9c40d | 2520 | ]) |
ddc9c40d | 2521 | AC_DEFINE_UNQUOTED(_GLIBCXX_STDIO_SEEK_CUR, $glibcxx_cv_stdio_seek_cur, |
b329dd10 | 2522 | [Define to the value of the SEEK_CUR integer constant.]) |
ddc9c40d | 2523 | |
9b04fa91 | 2524 | AC_CACHE_CHECK([for the value of SEEK_END], glibcxx_cv_stdio_seek_end, [ |
ddc9c40d | 2525 | AC_COMPUTE_INT([glibcxx_cv_stdio_seek_end], [[SEEK_END]], |
b329dd10 BK |
2526 | [#include <stdio.h>], |
2527 | [AC_MSG_ERROR([computing SEEK_END failed])]) | |
ddc9c40d | 2528 | ]) |
ddc9c40d | 2529 | AC_DEFINE_UNQUOTED(_GLIBCXX_STDIO_SEEK_END, $glibcxx_cv_stdio_seek_end, |
b329dd10 | 2530 | [Define to the value of the SEEK_END integer constant.]) |
68c2e9e9 | 2531 | fi |
1814157e PC |
2532 | ]) |
2533 | ||
1b6ce36f BK |
2534 | dnl |
2535 | dnl Check whether required C++ overloads are present in <stdio.h>. | |
2536 | dnl | |
2537 | AC_DEFUN([GLIBCXX_CHECK_STDIO_PROTO], [ | |
2538 | ||
2539 | AC_LANG_SAVE | |
2540 | AC_LANG_CPLUSPLUS | |
36105dbd JW |
2541 | # Use C++11 because a conforming <stdio.h> won't define gets for C++14, |
2542 | # and we don't need a declaration for C++14 anyway. | |
2543 | ac_save_CXXFLAGS="$CXXFLAGS" | |
2544 | CXXFLAGS="$CXXFLAGS -std=gnu++11" | |
1b6ce36f | 2545 | |
9646a322 | 2546 | AC_CACHE_CHECK([for gets declaration], glibcxx_cv_gets, [ |
1b6ce36f BK |
2547 | AC_COMPILE_IFELSE([AC_LANG_SOURCE( |
2548 | [#include <stdio.h> | |
7607ff49 | 2549 | namespace test |
1b6ce36f BK |
2550 | { |
2551 | using ::gets; | |
2552 | } | |
2553 | ])], | |
2554 | [glibcxx_cv_gets=yes], | |
2555 | [glibcxx_cv_gets=no] | |
2556 | )]) | |
2557 | ||
2558 | if test $glibcxx_cv_gets = yes; then | |
36105dbd | 2559 | AC_DEFINE(HAVE_GETS, 1, [Define if gets is available in <stdio.h> before C++14.]) |
1b6ce36f | 2560 | fi |
1b6ce36f | 2561 | |
36105dbd | 2562 | CXXFLAGS="$ac_save_CXXFLAGS" |
1b6ce36f BK |
2563 | AC_LANG_RESTORE |
2564 | ]) | |
2565 | ||
ef3a7506 | 2566 | dnl |
3115f94f RO |
2567 | dnl Check whether required C++11 overloads for floating point and integral |
2568 | dnl types are present in <math.h>. | |
ef3a7506 RO |
2569 | dnl |
2570 | AC_DEFUN([GLIBCXX_CHECK_MATH11_PROTO], [ | |
2571 | ||
2572 | AC_LANG_SAVE | |
2573 | AC_LANG_CPLUSPLUS | |
2574 | ac_save_CXXFLAGS="$CXXFLAGS" | |
2575 | CXXFLAGS="$CXXFLAGS -std=c++11" | |
2576 | ||
2577 | case "$host" in | |
2578 | *-*-solaris2.*) | |
3115f94f RO |
2579 | # Solaris 12 Build 86, Solaris 11.3 SRU 3.6, and Solaris 10 Patch |
2580 | # 11996[67]-02 introduced the C++11 <math.h> floating point overloads. | |
9646a322 JW |
2581 | AC_CACHE_CHECK([for C++11 <math.h> floating point overloads], |
2582 | glibcxx_cv_math11_fp_overload, [ | |
ef3a7506 RO |
2583 | AC_COMPILE_IFELSE([AC_LANG_SOURCE( |
2584 | [#include <math.h> | |
2585 | #undef isfinite | |
2586 | namespace std { | |
2587 | inline bool isfinite(float __x) | |
2588 | { return __builtin_isfinite(__x); } | |
2589 | } | |
2590 | ])], | |
3115f94f RO |
2591 | [glibcxx_cv_math11_fp_overload=no], |
2592 | [glibcxx_cv_math11_fp_overload=yes] | |
ef3a7506 RO |
2593 | )]) |
2594 | ||
2595 | # autoheader cannot handle indented templates. | |
3115f94f RO |
2596 | AH_VERBATIM([__CORRECT_ISO_CPP11_MATH_H_PROTO_FP], |
2597 | [/* Define if all C++11 floating point overloads are available in <math.h>. */ | |
ef3a7506 | 2598 | #if __cplusplus >= 201103L |
3115f94f | 2599 | #undef __CORRECT_ISO_CPP11_MATH_H_PROTO_FP |
ef3a7506 RO |
2600 | #endif]) |
2601 | ||
3115f94f RO |
2602 | if test $glibcxx_cv_math11_fp_overload = yes; then |
2603 | AC_DEFINE(__CORRECT_ISO_CPP11_MATH_H_PROTO_FP) | |
ef3a7506 | 2604 | fi |
3115f94f RO |
2605 | |
2606 | # Solaris 12 Build 90, Solaris 11.3 SRU 5.6, and Solaris 10 Patch | |
2607 | # 11996[67]-02 introduced the C++11 <math.h> integral type overloads. | |
9646a322 JW |
2608 | AC_CACHE_CHECK([for C++11 <math.h> integral type overloads], |
2609 | glibcxx_cv_math11_int_overload, [ | |
3115f94f RO |
2610 | AC_COMPILE_IFELSE([AC_LANG_SOURCE( |
2611 | [#include <math.h> | |
2612 | namespace std { | |
2613 | template<typename _Tp> | |
2614 | struct __is_integer; | |
2615 | template<> | |
2616 | struct __is_integer<int> | |
2617 | { | |
2618 | enum { __value = 1 }; | |
2619 | }; | |
2620 | } | |
2621 | namespace __gnu_cxx { | |
2622 | template<bool, typename> | |
2623 | struct __enable_if; | |
2624 | template<typename _Tp> | |
2625 | struct __enable_if<true, _Tp> | |
2626 | { typedef _Tp __type; }; | |
2627 | } | |
2628 | namespace std { | |
2629 | template<typename _Tp> | |
2630 | constexpr typename __gnu_cxx::__enable_if | |
2631 | <__is_integer<_Tp>::__value, double>::__type | |
2632 | log2(_Tp __x) | |
2633 | { return __builtin_log2(__x); } | |
2634 | } | |
2635 | int | |
2636 | main (void) | |
2637 | { | |
2638 | int i = 1000; | |
2639 | return std::log2(i); | |
2640 | } | |
2641 | ])], | |
2642 | [glibcxx_cv_math11_int_overload=no], | |
2643 | [glibcxx_cv_math11_int_overload=yes] | |
2644 | )]) | |
2645 | ||
2646 | # autoheader cannot handle indented templates. | |
2647 | AH_VERBATIM([__CORRECT_ISO_CPP11_MATH_H_PROTO_INT], | |
2648 | [/* Define if all C++11 integral type overloads are available in <math.h>. */ | |
2649 | #if __cplusplus >= 201103L | |
2650 | #undef __CORRECT_ISO_CPP11_MATH_H_PROTO_INT | |
2651 | #endif]) | |
2652 | ||
2653 | if test $glibcxx_cv_math11_int_overload = yes; then | |
2654 | AC_DEFINE(__CORRECT_ISO_CPP11_MATH_H_PROTO_INT) | |
2655 | fi | |
ef3a7506 | 2656 | ;; |
cc07da33 | 2657 | *) |
39a1d8c8 JW |
2658 | # If <math.h> defines the obsolete isinf(double) and isnan(double) |
2659 | # functions (instead of or as well as the C99 generic macros) then we | |
2660 | # can't define std::isinf(double) and std::isnan(double) in <cmath> | |
2661 | # and must use the ones from <math.h> instead. | |
9646a322 JW |
2662 | AC_CACHE_CHECK([for obsolete isinf function in <math.h>], |
2663 | glibcxx_cv_obsolete_isinf, [ | |
39a1d8c8 | 2664 | AC_COMPILE_IFELSE([AC_LANG_SOURCE( |
cc07da33 JW |
2665 | [#define _GLIBCXX_INCLUDE_NEXT_C_HEADERS |
2666 | #include <math.h> | |
39a1d8c8 | 2667 | #undef isinf |
39a1d8c8 JW |
2668 | namespace std { |
2669 | using ::isinf; | |
2158532f JW |
2670 | bool isinf(float); |
2671 | bool isinf(long double); | |
69b0daeb JDA |
2672 | } |
2673 | using std::isinf; | |
2674 | bool b = isinf(0.0); | |
2675 | ])], | |
2676 | [glibcxx_cv_obsolete_isinf=yes], | |
2677 | [glibcxx_cv_obsolete_isinf=no] | |
2678 | )]) | |
69b0daeb JDA |
2679 | if test $glibcxx_cv_obsolete_isinf = yes; then |
2680 | AC_DEFINE(HAVE_OBSOLETE_ISINF, 1, | |
2681 | [Define if <math.h> defines obsolete isinf function.]) | |
2682 | fi | |
2683 | ||
9646a322 JW |
2684 | AC_CACHE_CHECK([for obsolete isnan function in <math.h>], |
2685 | glibcxx_cv_obsolete_isnan, [ | |
69b0daeb | 2686 | AC_COMPILE_IFELSE([AC_LANG_SOURCE( |
74106ead GL |
2687 | [#define _GLIBCXX_INCLUDE_NEXT_C_HEADERS |
2688 | #include <math.h> | |
69b0daeb JDA |
2689 | #undef isnan |
2690 | namespace std { | |
39a1d8c8 JW |
2691 | using ::isnan; |
2692 | bool isnan(float); | |
2693 | bool isnan(long double); | |
2694 | } | |
39a1d8c8 | 2695 | using std::isnan; |
69b0daeb | 2696 | bool b = isnan(0.0); |
39a1d8c8 | 2697 | ])], |
69b0daeb JDA |
2698 | [glibcxx_cv_obsolete_isnan=yes], |
2699 | [glibcxx_cv_obsolete_isnan=no] | |
39a1d8c8 | 2700 | )]) |
69b0daeb JDA |
2701 | if test $glibcxx_cv_obsolete_isnan = yes; then |
2702 | AC_DEFINE(HAVE_OBSOLETE_ISNAN, 1, | |
2703 | [Define if <math.h> defines obsolete isnan function.]) | |
39a1d8c8 | 2704 | fi |
39a1d8c8 | 2705 | ;; |
ef3a7506 RO |
2706 | esac |
2707 | ||
2708 | CXXFLAGS="$ac_save_CXXFLAGS" | |
2709 | AC_LANG_RESTORE | |
2710 | ]) | |
2711 | ||
0214010c | 2712 | dnl |
ff66d28f PE |
2713 | dnl Check for what type of C headers to use. |
2714 | dnl | |
2715 | dnl --enable-cheaders= [does stuff]. | |
2716 | dnl --disable-cheaders [does not do anything, really]. | |
2717 | dnl + Usage: GLIBCXX_ENABLE_CHEADERS[(DEFAULT)] | |
55484a0f JW |
2718 | dnl Where DEFAULT is either 'c' or 'c_global' or 'c_std'. |
2719 | dnl | |
2720 | dnl To use the obsolete 'c_std' headers use --enable-cheaders-obsolete as | |
2721 | dnl well as --enable-cheaders=c_std, otherwise configure will fail. | |
ff66d28f | 2722 | dnl |
f214923c | 2723 | AC_DEFUN([GLIBCXX_ENABLE_CHEADERS], [ |
55484a0f JW |
2724 | GLIBCXX_ENABLE(cheaders-obsolete,no,, |
2725 | [allow use of obsolete "C" headers for g++]) | |
b453ace3 | 2726 | GLIBCXX_ENABLE(cheaders,$1,[[[=KIND]]], |
55484a0f | 2727 | [construct "C" headers for g++], [permit c|c_global|c_std]) |
ff66d28f | 2728 | AC_MSG_NOTICE("C" header strategy set to $enable_cheaders) |
55484a0f JW |
2729 | if test $enable_cheaders = c_std ; then |
2730 | AC_MSG_WARN([the --enable-cheaders=c_std configuration is obsolete, c_global should be used instead]) | |
2731 | AC_MSG_WARN([if you are unable to use c_global please report a bug or inform libstdc++@gcc.gnu.org]) | |
2732 | if test $enable_cheaders_obsolete != yes ; then | |
2733 | AC_MSG_ERROR(use --enable-cheaders-obsolete to use c_std "C" headers) | |
2734 | fi | |
2735 | fi | |
ff66d28f PE |
2736 | |
2737 | C_INCLUDE_DIR='${glibcxx_srcdir}/include/'$enable_cheaders | |
2738 | ||
af13a7a6 BK |
2739 | # Allow overrides to configure.host here. |
2740 | if test $enable_cheaders = c_global; then | |
2741 | c_compatibility=yes | |
2742 | fi | |
2743 | ||
ff66d28f | 2744 | AC_SUBST(C_INCLUDE_DIR) |
92eabea2 PE |
2745 | GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C, test $enable_cheaders = c) |
2746 | GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C_STD, test $enable_cheaders = c_std) | |
af13a7a6 | 2747 | GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C_GLOBAL, test $enable_cheaders = c_global) |
92eabea2 | 2748 | GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_COMPATIBILITY, test $c_compatibility = yes) |
ff66d28f PE |
2749 | ]) |
2750 | ||
2751 | ||
0214010c | 2752 | dnl |
ff66d28f PE |
2753 | dnl Check for which locale library to use. The choice is mapped to |
2754 | dnl a subdirectory of config/locale. | |
37bc6ca2 | 2755 | dnl |
ff66d28f | 2756 | dnl Default is generic. |
0214010c | 2757 | dnl |
f214923c | 2758 | AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [ |
b453ace3 | 2759 | GLIBCXX_ENABLE(clocale,auto,[[[=MODEL]]], |
ff66d28f | 2760 | [use MODEL for target locale package], |
aeb4926a | 2761 | [permit generic|gnu|ieee_1003.1-2001|newlib|yes|no|auto]) |
0258dc3a BK |
2762 | |
2763 | # Deal with gettext issues. Default to not using it (=no) until we detect | |
2764 | # support for it later. Let the user turn it off via --e/d, but let that | |
2765 | # default to on for easier handling. | |
2766 | USE_NLS=no | |
2767 | AC_ARG_ENABLE(nls, | |
2768 | AC_HELP_STRING([--enable-nls],[use Native Language Support (default)]), | |
2769 | [], | |
2770 | [enable_nls=yes]) | |
b329dd10 | 2771 | |
aeb4926a | 2772 | # Either a known package, or "auto" |
ff66d28f PE |
2773 | if test $enable_clocale = no || test $enable_clocale = yes; then |
2774 | enable_clocale=auto | |
2775 | fi | |
0214010c BK |
2776 | enable_clocale_flag=$enable_clocale |
2777 | ||
0258dc3a | 2778 | # Probe for locale model to use if none specified. |
ff66d28f PE |
2779 | # Default to "generic". |
2780 | if test $enable_clocale_flag = auto; then | |
7d3998a4 PE |
2781 | case ${target_os} in |
2782 | linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) | |
b329dd10 BK |
2783 | enable_clocale_flag=gnu |
2784 | ;; | |
301d1d00 | 2785 | darwin*) |
b329dd10 | 2786 | enable_clocale_flag=darwin |
f9686024 | 2787 | ;; |
523ca640 CG |
2788 | vxworks*) |
2789 | enable_clocale_flag=vxworks | |
2790 | ;; | |
301d1d00 | 2791 | dragonfly* | freebsd*) |
dbed5a9b JM |
2792 | enable_clocale_flag=dragonfly |
2793 | ;; | |
1f726ff8 MK |
2794 | openbsd*) |
2795 | enable_clocale_flag=newlib | |
2796 | ;; | |
56deb74c | 2797 | *) |
aeb4926a YZ |
2798 | if test x"$with_newlib" = x"yes"; then |
2799 | enable_clocale_flag=newlib | |
2800 | else | |
2801 | enable_clocale_flag=generic | |
2802 | fi | |
b329dd10 | 2803 | ;; |
56deb74c BK |
2804 | esac |
2805 | fi | |
2806 | ||
0258dc3a BK |
2807 | # Sanity check model, and test for special functionality. |
2808 | if test $enable_clocale_flag = gnu; then | |
2809 | AC_EGREP_CPP([_GLIBCXX_ok], [ | |
2810 | #include <features.h> | |
22b36782 | 2811 | #if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined(__UCLIBC__) |
0258dc3a BK |
2812 | _GLIBCXX_ok |
2813 | #endif | |
2814 | ], enable_clocale_flag=gnu, enable_clocale_flag=generic) | |
2815 | ||
0258dc3a | 2816 | # Set it to scream when it hurts. |
b329dd10 | 2817 | ac_save_CFLAGS="$CFLAGS" |
0258dc3a BK |
2818 | CFLAGS="-Wimplicit-function-declaration -Werror" |
2819 | ||
2820 | # Use strxfrm_l if available. | |
2821 | AC_TRY_COMPILE([#define _GNU_SOURCE 1 | |
2822 | #include <string.h> | |
2823 | #include <locale.h>], | |
b329dd10 BK |
2824 | [char s[128]; __locale_t loc; strxfrm_l(s, "C", 5, loc);], |
2825 | AC_DEFINE(HAVE_STRXFRM_L, 1, | |
2826 | [Define if strxfrm_l is available in <string.h>.]),) | |
2827 | ||
0258dc3a BK |
2828 | # Use strerror_l if available. |
2829 | AC_TRY_COMPILE([#define _GNU_SOURCE 1 | |
2830 | #include <string.h> | |
2831 | #include <locale.h>], | |
b329dd10 BK |
2832 | [__locale_t loc; strerror_l(5, loc);], |
2833 | AC_DEFINE(HAVE_STRERROR_L, 1, | |
2834 | [Define if strerror_l is available in <string.h>.]),) | |
0258dc3a BK |
2835 | |
2836 | CFLAGS="$ac_save_CFLAGS" | |
2837 | fi | |
2838 | ||
2839 | # Perhaps use strerror_r if available, and strerror_l isn't. | |
b329dd10 | 2840 | ac_save_CFLAGS="$CFLAGS" |
0258dc3a BK |
2841 | CFLAGS="-Wimplicit-function-declaration -Werror" |
2842 | AC_TRY_COMPILE([#define _GNU_SOURCE 1 | |
2843 | #include <string.h> | |
2844 | #include <locale.h>], | |
b329dd10 BK |
2845 | [char s[128]; strerror_r(5, s, 128);], |
2846 | AC_DEFINE(HAVE_STRERROR_R, 1, | |
2847 | [Define if strerror_r is available in <string.h>.]),) | |
0258dc3a | 2848 | CFLAGS="$ac_save_CFLAGS" |
501e321e | 2849 | |
ff66d28f | 2850 | # Set configure bits for specified locale package |
0258dc3a | 2851 | AC_MSG_CHECKING([for C locale to use]) |
ff66d28f PE |
2852 | case ${enable_clocale_flag} in |
2853 | generic) | |
33590f13 BK |
2854 | AC_MSG_RESULT(generic) |
2855 | ||
1fa4bed7 BK |
2856 | CLOCALE_H=config/locale/generic/c_locale.h |
2857 | CLOCALE_CC=config/locale/generic/c_locale.cc | |
38cca750 | 2858 | CCODECVT_CC=config/locale/generic/codecvt_members.cc |
1fa4bed7 BK |
2859 | CCOLLATE_CC=config/locale/generic/collate_members.cc |
2860 | CCTYPE_CC=config/locale/generic/ctype_members.cc | |
2861 | CMESSAGES_H=config/locale/generic/messages_members.h | |
2862 | CMESSAGES_CC=config/locale/generic/messages_members.cc | |
2863 | CMONEY_CC=config/locale/generic/monetary_members.cc | |
2864 | CNUMERIC_CC=config/locale/generic/numeric_members.cc | |
1c26d8fd | 2865 | CTIME_H=config/locale/generic/time_members.h |
1fa4bed7 | 2866 | CTIME_CC=config/locale/generic/time_members.cc |
89671b70 | 2867 | CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h |
33590f13 | 2868 | ;; |
f9686024 | 2869 | darwin) |
301d1d00 | 2870 | AC_MSG_RESULT(darwin) |
f9686024 GK |
2871 | |
2872 | CLOCALE_H=config/locale/generic/c_locale.h | |
2873 | CLOCALE_CC=config/locale/generic/c_locale.cc | |
f9686024 GK |
2874 | CCODECVT_CC=config/locale/generic/codecvt_members.cc |
2875 | CCOLLATE_CC=config/locale/generic/collate_members.cc | |
2876 | CCTYPE_CC=config/locale/darwin/ctype_members.cc | |
2877 | CMESSAGES_H=config/locale/generic/messages_members.h | |
2878 | CMESSAGES_CC=config/locale/generic/messages_members.cc | |
2879 | CMONEY_CC=config/locale/generic/monetary_members.cc | |
2880 | CNUMERIC_CC=config/locale/generic/numeric_members.cc | |
2881 | CTIME_H=config/locale/generic/time_members.h | |
2882 | CTIME_CC=config/locale/generic/time_members.cc | |
2883 | CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h | |
2884 | ;; | |
523ca640 CG |
2885 | vxworks) |
2886 | AC_MSG_RESULT(vxworks) | |
b329dd10 | 2887 | |
523ca640 CG |
2888 | CLOCALE_H=config/locale/generic/c_locale.h |
2889 | CLOCALE_CC=config/locale/generic/c_locale.cc | |
2890 | CCODECVT_CC=config/locale/generic/codecvt_members.cc | |
2891 | CCOLLATE_CC=config/locale/generic/collate_members.cc | |
2892 | CCTYPE_CC=config/locale/vxworks/ctype_members.cc | |
2893 | CMESSAGES_H=config/locale/generic/messages_members.h | |
2894 | CMESSAGES_CC=config/locale/generic/messages_members.cc | |
2895 | CMONEY_CC=config/locale/generic/monetary_members.cc | |
2896 | CNUMERIC_CC=config/locale/generic/numeric_members.cc | |
2897 | CTIME_H=config/locale/generic/time_members.h | |
2898 | CTIME_CC=config/locale/generic/time_members.cc | |
2899 | CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h | |
2900 | ;; | |
dbed5a9b | 2901 | dragonfly) |
301d1d00 | 2902 | AC_MSG_RESULT(dragonfly or freebsd) |
dbed5a9b | 2903 | |
a98e4e62 | 2904 | CLOCALE_H=config/locale/dragonfly/c_locale.h |
dbed5a9b | 2905 | CLOCALE_CC=config/locale/dragonfly/c_locale.cc |
a98e4e62 JM |
2906 | CCODECVT_CC=config/locale/dragonfly/codecvt_members.cc |
2907 | CCOLLATE_CC=config/locale/dragonfly/collate_members.cc | |
dbed5a9b JM |
2908 | CCTYPE_CC=config/locale/dragonfly/ctype_members.cc |
2909 | CMESSAGES_H=config/locale/generic/messages_members.h | |
2910 | CMESSAGES_CC=config/locale/generic/messages_members.cc | |
a98e4e62 JM |
2911 | CMONEY_CC=config/locale/dragonfly/monetary_members.cc |
2912 | CNUMERIC_CC=config/locale/dragonfly/numeric_members.cc | |
2913 | CTIME_H=config/locale/dragonfly/time_members.h | |
2914 | CTIME_CC=config/locale/dragonfly/time_members.cc | |
dbed5a9b JM |
2915 | CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h |
2916 | ;; | |
2917 | ||
ff66d28f | 2918 | gnu) |
0214010c | 2919 | AC_MSG_RESULT(gnu) |
33590f13 BK |
2920 | |
2921 | # Declare intention to use gettext, and add support for specific | |
2922 | # languages. | |
248a9163 | 2923 | # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT |
33590f13 | 2924 | ALL_LINGUAS="de fr" |
501e321e | 2925 | |
248a9163 | 2926 | # Don't call AM-GNU-GETTEXT here. Instead, assume glibc. |
501e321e BK |
2927 | AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no) |
2928 | if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then | |
b329dd10 | 2929 | USE_NLS=yes |
501e321e | 2930 | fi |
33590f13 BK |
2931 | # Export the build objects. |
2932 | for ling in $ALL_LINGUAS; do \ | |
b329dd10 BK |
2933 | glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \ |
2934 | glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \ | |
33590f13 | 2935 | done |
3d7c150e BK |
2936 | AC_SUBST(glibcxx_MOFILES) |
2937 | AC_SUBST(glibcxx_POFILES) | |
33590f13 | 2938 | |
1fa4bed7 BK |
2939 | CLOCALE_H=config/locale/gnu/c_locale.h |
2940 | CLOCALE_CC=config/locale/gnu/c_locale.cc | |
38cca750 | 2941 | CCODECVT_CC=config/locale/gnu/codecvt_members.cc |
1fa4bed7 BK |
2942 | CCOLLATE_CC=config/locale/gnu/collate_members.cc |
2943 | CCTYPE_CC=config/locale/gnu/ctype_members.cc | |
2944 | CMESSAGES_H=config/locale/gnu/messages_members.h | |
2945 | CMESSAGES_CC=config/locale/gnu/messages_members.cc | |
2946 | CMONEY_CC=config/locale/gnu/monetary_members.cc | |
2947 | CNUMERIC_CC=config/locale/gnu/numeric_members.cc | |
1c26d8fd | 2948 | CTIME_H=config/locale/gnu/time_members.h |
1fa4bed7 | 2949 | CTIME_CC=config/locale/gnu/time_members.cc |
89671b70 | 2950 | CLOCALE_INTERNAL_H=config/locale/gnu/c++locale_internal.h |
0214010c | 2951 | ;; |
ff66d28f | 2952 | ieee_1003.1-2001) |
7f78b6ca | 2953 | AC_MSG_RESULT(IEEE 1003.1) |
33590f13 | 2954 | |
1fa4bed7 BK |
2955 | CLOCALE_H=config/locale/ieee_1003.1-2001/c_locale.h |
2956 | CLOCALE_CC=config/locale/ieee_1003.1-2001/c_locale.cc | |
38cca750 | 2957 | CCODECVT_CC=config/locale/generic/codecvt_members.cc |
1fa4bed7 BK |
2958 | CCOLLATE_CC=config/locale/generic/collate_members.cc |
2959 | CCTYPE_CC=config/locale/generic/ctype_members.cc | |
2960 | CMESSAGES_H=config/locale/ieee_1003.1-2001/messages_members.h | |
2961 | CMESSAGES_CC=config/locale/ieee_1003.1-2001/messages_members.cc | |
2962 | CMONEY_CC=config/locale/generic/monetary_members.cc | |
2963 | CNUMERIC_CC=config/locale/generic/numeric_members.cc | |
1c26d8fd | 2964 | CTIME_H=config/locale/generic/time_members.h |
1fa4bed7 | 2965 | CTIME_CC=config/locale/generic/time_members.cc |
89671b70 | 2966 | CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h |
0214010c | 2967 | ;; |
aeb4926a YZ |
2968 | newlib) |
2969 | AC_MSG_RESULT(newlib) | |
2970 | ||
2971 | CLOCALE_H=config/locale/generic/c_locale.h | |
2972 | CLOCALE_CC=config/locale/generic/c_locale.cc | |
2973 | CCODECVT_CC=config/locale/generic/codecvt_members.cc | |
2974 | CCOLLATE_CC=config/locale/generic/collate_members.cc | |
2975 | CCTYPE_CC=config/locale/newlib/ctype_members.cc | |
2976 | CMESSAGES_H=config/locale/generic/messages_members.h | |
2977 | CMESSAGES_CC=config/locale/generic/messages_members.cc | |
2978 | CMONEY_CC=config/locale/generic/monetary_members.cc | |
2979 | CNUMERIC_CC=config/locale/generic/numeric_members.cc | |
2980 | CTIME_H=config/locale/generic/time_members.h | |
2981 | CTIME_CC=config/locale/generic/time_members.cc | |
2982 | CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h | |
2983 | ;; | |
0214010c BK |
2984 | esac |
2985 | ||
33590f13 BK |
2986 | # This is where the testsuite looks for locale catalogs, using the |
2987 | # -DLOCALEDIR define during testsuite compilation. | |
3d7c150e BK |
2988 | glibcxx_localedir=${glibcxx_builddir}/po/share/locale |
2989 | AC_SUBST(glibcxx_localedir) | |
33590f13 | 2990 | |
7f78b6ca PE |
2991 | # A standalone libintl (e.g., GNU libintl) may be in use. |
2992 | if test $USE_NLS = yes; then | |
c67528fe PE |
2993 | AC_CHECK_HEADERS([libintl.h], [], USE_NLS=no) |
2994 | AC_SEARCH_LIBS(gettext, intl, [], USE_NLS=no) | |
2995 | fi | |
2996 | if test $USE_NLS = yes; then | |
b329dd10 BK |
2997 | AC_DEFINE(_GLIBCXX_USE_NLS, 1, |
2998 | [Define if NLS translations are to be used.]) | |
7f78b6ca PE |
2999 | fi |
3000 | ||
4e10943d | 3001 | AC_SUBST(USE_NLS) |
4a9d5109 | 3002 | AC_SUBST(CLOCALE_H) |
33590f13 | 3003 | AC_SUBST(CMESSAGES_H) |
6aa43d99 BK |
3004 | AC_SUBST(CCODECVT_CC) |
3005 | AC_SUBST(CCOLLATE_CC) | |
3006 | AC_SUBST(CCTYPE_CC) | |
3007 | AC_SUBST(CMESSAGES_CC) | |
3008 | AC_SUBST(CMONEY_CC) | |
3009 | AC_SUBST(CNUMERIC_CC) | |
1c26d8fd | 3010 | AC_SUBST(CTIME_H) |
6aa43d99 BK |
3011 | AC_SUBST(CTIME_CC) |
3012 | AC_SUBST(CLOCALE_CC) | |
3013 | AC_SUBST(CLOCALE_INTERNAL_H) | |
0214010c BK |
3014 | ]) |
3015 | ||
3016 | ||
8b0d6051 BK |
3017 | dnl |
3018 | dnl Check for which std::allocator base class to use. The choice is | |
3019 | dnl mapped from a subdirectory of include/ext. | |
3020 | dnl | |
3021 | dnl Default is new. | |
3022 | dnl | |
3023 | AC_DEFUN([GLIBCXX_ENABLE_ALLOCATOR], [ | |
347669a0 | 3024 | AC_MSG_CHECKING([for std::allocator base class]) |
b453ace3 | 3025 | GLIBCXX_ENABLE(libstdcxx-allocator,auto,[[[=KIND]]], |
8b0d6051 | 3026 | [use KIND for target std::allocator base], |
e2e98f52 | 3027 | [permit new|malloc|yes|no|auto]) |
7d3998a4 | 3028 | |
8b0d6051 BK |
3029 | # If they didn't use this option switch, or if they specified --enable |
3030 | # with no specific model, we'll have to look for one. If they | |
3031 | # specified --disable (???), do likewise. | |
7d3998a4 PE |
3032 | if test $enable_libstdcxx_allocator = no || |
3033 | test $enable_libstdcxx_allocator = yes; | |
3034 | then | |
8b0d6051 BK |
3035 | enable_libstdcxx_allocator=auto |
3036 | fi | |
3037 | ||
780028b6 BK |
3038 | # Either a known package, or "auto". Auto implies the default choice |
3039 | # for a particular platform. | |
8b0d6051 BK |
3040 | enable_libstdcxx_allocator_flag=$enable_libstdcxx_allocator |
3041 | ||
3042 | # Probe for host-specific support if no specific model is specified. | |
3043 | # Default to "new". | |
3044 | if test $enable_libstdcxx_allocator_flag = auto; then | |
3045 | case ${target_os} in | |
780028b6 | 3046 | linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) |
b329dd10 BK |
3047 | enable_libstdcxx_allocator_flag=new |
3048 | ;; | |
8b0d6051 | 3049 | *) |
b329dd10 BK |
3050 | enable_libstdcxx_allocator_flag=new |
3051 | ;; | |
8b0d6051 BK |
3052 | esac |
3053 | fi | |
3054 | AC_MSG_RESULT($enable_libstdcxx_allocator_flag) | |
b329dd10 | 3055 | |
8b0d6051 BK |
3056 | |
3057 | # Set configure bits for specified locale package | |
3058 | case ${enable_libstdcxx_allocator_flag} in | |
8b0d6051 BK |
3059 | malloc) |
3060 | ALLOCATOR_H=config/allocator/malloc_allocator_base.h | |
3061 | ALLOCATOR_NAME=__gnu_cxx::malloc_allocator | |
3062 | ;; | |
8b0d6051 BK |
3063 | new) |
3064 | ALLOCATOR_H=config/allocator/new_allocator_base.h | |
3065 | ALLOCATOR_NAME=__gnu_cxx::new_allocator | |
3066 | ;; | |
3067 | esac | |
3068 | ||
a04d5fc9 TR |
3069 | GLIBCXX_CONDITIONAL(ENABLE_ALLOCATOR_NEW, |
3070 | test $enable_libstdcxx_allocator_flag = new) | |
8b0d6051 BK |
3071 | AC_SUBST(ALLOCATOR_H) |
3072 | AC_SUBST(ALLOCATOR_NAME) | |
3073 | ]) | |
3074 | ||
3075 | ||
b2dad0e3 | 3076 | dnl |
ff66d28f PE |
3077 | dnl Check for whether the Boost-derived checks should be turned on. |
3078 | dnl | |
3079 | dnl --enable-concept-checks turns them on. | |
3080 | dnl --disable-concept-checks leaves them off. | |
3081 | dnl + Usage: GLIBCXX_ENABLE_CONCEPT_CHECKS[(DEFAULT)] | |
3082 | dnl Where DEFAULT is either `yes' or `no'. | |
3083 | dnl | |
f214923c | 3084 | AC_DEFUN([GLIBCXX_ENABLE_CONCEPT_CHECKS], [ |
ff66d28f PE |
3085 | GLIBCXX_ENABLE(concept-checks,$1,,[use Boost-derived template checks]) |
3086 | if test $enable_concept_checks = yes; then | |
4651e622 | 3087 | AC_DEFINE(_GLIBCXX_CONCEPT_CHECKS, 1, |
b329dd10 | 3088 | [Define to use concept checking code from the boost libraries.]) |
ff66d28f PE |
3089 | fi |
3090 | ]) | |
3091 | ||
ed4f96af BK |
3092 | dnl |
3093 | dnl Use extern templates. | |
3094 | dnl | |
3095 | dnl --enable-extern-template defines _GLIBCXX_EXTERN_TEMPLATE to 1 | |
3096 | dnl --disable-extern-template defines _GLIBCXX_EXTERN_TEMPLATE to 0 | |
3097 | ||
3098 | dnl + Usage: GLIBCXX_ENABLE_TEMPLATE[(DEFAULT)] | |
3099 | dnl Where DEFAULT is `yes' or `no'. | |
3100 | dnl | |
3101 | AC_DEFUN([GLIBCXX_ENABLE_EXTERN_TEMPLATE], [ | |
3102 | ||
3103 | GLIBCXX_ENABLE(extern-template,$1,,[enable extern template]) | |
3104 | ||
3105 | AC_MSG_CHECKING([for extern template support]) | |
3106 | AC_MSG_RESULT([$enable_extern_template]) | |
3107 | ||
3108 | GLIBCXX_CONDITIONAL(ENABLE_EXTERN_TEMPLATE, test $enable_extern_template = yes) | |
3109 | ]) | |
3110 | ||
2077db1b CT |
3111 | dnl |
3112 | dnl Use vtable verification. | |
3113 | dnl | |
3114 | dnl --enable-vtable-verify defines _GLIBCXX_VTABLE_VERIFY to 1 | |
3115 | dnl --disable-vtable-verify defines _GLIBCXX_VTABLE_VERIFY to 0 | |
3116 | ||
3117 | dnl + Usage: GLIBCXX_ENABLE_VTABLE_VERIFY[(DEFAULT)] | |
3118 | dnl Where DEFAULT is `yes' or `no'. | |
3119 | dnl | |
3120 | AC_DEFUN([GLIBCXX_ENABLE_VTABLE_VERIFY], [ | |
3121 | ||
3122 | GLIBCXX_ENABLE(vtable-verify,$1,,[enable vtable verify]) | |
3123 | ||
3124 | AC_MSG_CHECKING([for vtable verify support]) | |
3125 | AC_MSG_RESULT([$enable_vtable_verify]) | |
3126 | ||
536616b7 | 3127 | vtv_cygmin=no |
2077db1b | 3128 | if test $enable_vtable_verify = yes; then |
f7f049fa CT |
3129 | case ${target_os} in |
3130 | cygwin*|mingw32*) | |
3131 | VTV_CXXFLAGS="-fvtable-verify=std -Wl,-lvtv,-u_vtable_map_vars_start,-u_vtable_map_vars_end" | |
441fb2cd | 3132 | VTV_CXXLINKFLAGS="-L${toplevel_builddir}/libvtv/.libs -Wl,--rpath -Wl,${toplevel_builddir}/libvtv/.libs" |
536616b7 | 3133 | vtv_cygmin=yes |
f7f049fa | 3134 | ;; |
441fb2cd CT |
3135 | darwin*) |
3136 | VTV_CXXFLAGS="-fvtable-verify=std -Wl,-u,_vtable_map_vars_start -Wl,-u,_vtable_map_vars_end" | |
3137 | VTV_CXXLINKFLAGS="-L${toplevel_builddir}/libvtv/.libs -Wl,-rpath,${toplevel_builddir}/libvtv/.libs" | |
3138 | ;; | |
e5ef217c RO |
3139 | solaris2*) |
3140 | VTV_CXXFLAGS="-fvtable-verify=std -Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end" | |
3141 | VTV_CXXLINKFLAGS="-L${toplevel_builddir}/libvtv/.libs -Wl,-R -Wl,${toplevel_builddir}/libvtv/.libs" | |
3142 | ;; | |
f7f049fa CT |
3143 | *) |
3144 | VTV_CXXFLAGS="-fvtable-verify=std -Wl,-u_vtable_map_vars_start,-u_vtable_map_vars_end" | |
441fb2cd | 3145 | VTV_CXXLINKFLAGS="-L${toplevel_builddir}/libvtv/.libs -Wl,--rpath -Wl,${toplevel_builddir}/libvtv/.libs" |
f7f049fa CT |
3146 | ;; |
3147 | esac | |
2077db1b | 3148 | VTV_PCH_CXXFLAGS="-fvtable-verify=std" |
2077db1b | 3149 | else |
7607ff49 | 3150 | VTV_CXXFLAGS= |
2077db1b | 3151 | VTV_PCH_CXXFLAGS= |
7607ff49 | 3152 | VTV_CXXLINKFLAGS= |
2077db1b CT |
3153 | fi |
3154 | ||
3155 | AC_SUBST(VTV_CXXFLAGS) | |
3156 | AC_SUBST(VTV_PCH_CXXFLAGS) | |
3157 | AC_SUBST(VTV_CXXLINKFLAGS) | |
536616b7 | 3158 | AM_CONDITIONAL(VTV_CYGMIN, test x$vtv_cygmin = xyes) |
2077db1b CT |
3159 | GLIBCXX_CONDITIONAL(ENABLE_VTABLE_VERIFY, test $enable_vtable_verify = yes) |
3160 | ]) | |
3161 | ||
c2ba9709 JS |
3162 | dnl |
3163 | dnl Check for parallel mode pre-requisites, including OpenMP support. | |
3164 | dnl | |
3165 | dnl + Usage: GLIBCXX_ENABLE_PARALLEL | |
3166 | dnl | |
3167 | AC_DEFUN([GLIBCXX_ENABLE_PARALLEL], [ | |
3168 | ||
3169 | enable_parallel=no; | |
6995087d | 3170 | |
0aec205c BK |
3171 | # See if configured libgomp/omp.h exists. (libgomp may be in |
3172 | # noconfigdirs but not explicitly disabled.) | |
aae29963 | 3173 | if echo " ${TARGET_CONFIGDIRS} " | grep " libgomp " > /dev/null 2>&1 ; then |
0aec205c BK |
3174 | enable_parallel=yes; |
3175 | else | |
aae29963 | 3176 | AC_MSG_NOTICE([target-libgomp not built]) |
c2ba9709 JS |
3177 | fi |
3178 | ||
3179 | AC_MSG_CHECKING([for parallel mode support]) | |
3180 | AC_MSG_RESULT([$enable_parallel]) | |
c2ba9709 JS |
3181 | ]) |
3182 | ||
ff66d28f | 3183 | |
b2dad0e3 | 3184 | dnl |
75aee072 | 3185 | dnl Check for which I/O library to use: stdio and POSIX, or pure stdio. |
37bc6ca2 | 3186 | dnl |
75aee072 | 3187 | dnl Default is stdio_posix. |
b2dad0e3 | 3188 | dnl |
f214923c | 3189 | AC_DEFUN([GLIBCXX_ENABLE_CSTDIO], [ |
ff66d28f | 3190 | AC_MSG_CHECKING([for underlying I/O to use]) |
b453ace3 | 3191 | GLIBCXX_ENABLE(cstdio,stdio,[[[=PACKAGE]]], |
75aee072 | 3192 | [use target-specific I/O package], [permit stdio|stdio_posix|stdio_pure]) |
ff66d28f | 3193 | |
75aee072 KP |
3194 | # The only available I/O model is based on stdio, via basic_file_stdio. |
3195 | # The default "stdio" is actually "stdio + POSIX" because it uses fdopen(3) | |
3196 | # to get a file descriptor and then uses read(3) and write(3) with it. | |
3197 | # The "stdio_pure" model doesn't use fdopen and only uses FILE* for I/O. | |
ff66d28f | 3198 | case ${enable_cstdio} in |
75aee072 | 3199 | stdio*) |
33590f13 BK |
3200 | CSTDIO_H=config/io/c_io_stdio.h |
3201 | BASIC_FILE_H=config/io/basic_file_stdio.h | |
3202 | BASIC_FILE_CC=config/io/basic_file_stdio.cc | |
75aee072 KP |
3203 | |
3204 | if test "x$enable_cstdio" = "xstdio_pure" ; then | |
19b8946d | 3205 | AC_MSG_RESULT([stdio (without POSIX read/write)]) |
75aee072 KP |
3206 | AC_DEFINE(_GLIBCXX_USE_STDIO_PURE, 1, |
3207 | [Define to restrict std::__basic_file<> to stdio APIs.]) | |
19b8946d JW |
3208 | else |
3209 | AC_MSG_RESULT([stdio (with POSIX read/write)]) | |
75aee072 | 3210 | fi |
dd75251f | 3211 | ;; |
b2dad0e3 | 3212 | esac |
cc5112c9 | 3213 | |
4a9d5109 SW |
3214 | AC_SUBST(CSTDIO_H) |
3215 | AC_SUBST(BASIC_FILE_H) | |
6aa43d99 | 3216 | AC_SUBST(BASIC_FILE_CC) |
b2dad0e3 BK |
3217 | ]) |
3218 | ||
3219 | ||
9e57d5ca | 3220 | dnl |
ff66d28f | 3221 | dnl Check for "unusual" flags to pass to the compiler while building. |
9e57d5ca | 3222 | dnl |
ff66d28f PE |
3223 | dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing |
3224 | dnl experimental flags such as -fpch, -fIMI, -Dfloat=char, etc. | |
3225 | dnl --disable-cxx-flags passes nothing. | |
3226 | dnl + See http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00131.html | |
3227 | dnl http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00284.html | |
3228 | dnl http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00035.html | |
3229 | dnl + Usage: GLIBCXX_ENABLE_CXX_FLAGS(default flags) | |
3230 | dnl If "default flags" is an empty string, the effect is the same | |
3231 | dnl as --disable or --enable=no. | |
44f0760e | 3232 | dnl |
f214923c | 3233 | AC_DEFUN([GLIBCXX_ENABLE_CXX_FLAGS], [dnl |
ff66d28f PE |
3234 | AC_MSG_CHECKING([for extra compiler flags for building]) |
3235 | GLIBCXX_ENABLE(cxx-flags,$1,[=FLAGS], | |
3236 | [pass compiler FLAGS when building library], | |
3237 | [case "x$enable_cxx_flags" in | |
3238 | xno | x) enable_cxx_flags= ;; | |
3239 | x-*) ;; | |
3240 | *) AC_MSG_ERROR(_g_switch needs compiler flags as arguments) ;; | |
3241 | esac]) | |
3242 | ||
3243 | # Run through flags (either default or command-line) and set anything | |
3244 | # extra (e.g., #defines) that must accompany particular g++ options. | |
3245 | if test -n "$enable_cxx_flags"; then | |
3246 | for f in $enable_cxx_flags; do | |
3247 | case "$f" in | |
b329dd10 BK |
3248 | -fhonor-std) ;; |
3249 | -*) ;; | |
3250 | *) # and we're trying to pass /what/ exactly? | |
3251 | AC_MSG_ERROR([compiler flags start with a -]) ;; | |
ff66d28f PE |
3252 | esac |
3253 | done | |
44f0760e BK |
3254 | fi |
3255 | ||
ff66d28f PE |
3256 | EXTRA_CXX_FLAGS="$enable_cxx_flags" |
3257 | AC_MSG_RESULT($EXTRA_CXX_FLAGS) | |
3258 | AC_SUBST(EXTRA_CXX_FLAGS) | |
9e57d5ca BK |
3259 | ]) |
3260 | ||
ff66d28f | 3261 | |
ff66d28f PE |
3262 | dnl |
3263 | dnl Check to see if debugging libraries are to be built. | |
3264 | dnl | |
3265 | dnl --enable-libstdcxx-debug | |
3266 | dnl builds a separate set of debugging libraries in addition to the | |
3267 | dnl normal (shared, static) libstdc++ binaries. | |
3268 | dnl | |
3269 | dnl --disable-libstdcxx-debug | |
3270 | dnl builds only one (non-debug) version of libstdc++. | |
3271 | dnl | |
3272 | dnl --enable-libstdcxx-debug-flags=FLAGS | |
3273 | dnl iff --enable-debug == yes, then use FLAGS to build the debug library. | |
3274 | dnl | |
3275 | dnl + Usage: GLIBCXX_ENABLE_DEBUG[(DEFAULT)] | |
3276 | dnl Where DEFAULT is either `yes' or `no'. | |
3277 | dnl | |
f214923c | 3278 | AC_DEFUN([GLIBCXX_ENABLE_DEBUG], [ |
ff66d28f | 3279 | AC_MSG_CHECKING([for additional debug build]) |
86f73527 | 3280 | skip_debug_build= |
ff66d28f | 3281 | GLIBCXX_ENABLE(libstdcxx-debug,$1,,[build extra debug library]) |
86f73527 JW |
3282 | if test x$enable_libstdcxx_debug = xyes; then |
3283 | if test -f $toplevel_builddir/../stage_final \ | |
3284 | && test -f $toplevel_builddir/../stage_current; then | |
3285 | stage_final=`cat $toplevel_builddir/../stage_final` | |
3286 | stage_current=`cat $toplevel_builddir/../stage_current` | |
3287 | if test x$stage_current != x$stage_final ; then | |
3288 | skip_debug_build=" (skipped for bootstrap stage $stage_current)" | |
3289 | enable_libstdcxx_debug=no | |
3290 | fi | |
3291 | fi | |
3292 | fi | |
3293 | AC_MSG_RESULT($enable_libstdcxx_debug$skip_debug_build) | |
92eabea2 | 3294 | GLIBCXX_CONDITIONAL(GLIBCXX_BUILD_DEBUG, test $enable_libstdcxx_debug = yes) |
b2dad0e3 BK |
3295 | ]) |
3296 | ||
3297 | ||
52a11cbf | 3298 | dnl |
ff66d28f | 3299 | dnl Check for explicit debug flags. |
52a11cbf | 3300 | dnl |
ff66d28f PE |
3301 | dnl --enable-libstdcxx-debug-flags='-O1' |
3302 | dnl is a general method for passing flags to be used when | |
38cccb0b | 3303 | dnl building debug libraries with --enable-libstdcxx-debug. |
52a11cbf | 3304 | dnl |
ff66d28f PE |
3305 | dnl --disable-libstdcxx-debug-flags does nothing. |
3306 | dnl + Usage: GLIBCXX_ENABLE_DEBUG_FLAGS(default flags) | |
3307 | dnl If "default flags" is an empty string, the effect is the same | |
3308 | dnl as --disable or --enable=no. | |
3309 | dnl | |
f214923c | 3310 | AC_DEFUN([GLIBCXX_ENABLE_DEBUG_FLAGS], [ |
ff66d28f PE |
3311 | GLIBCXX_ENABLE(libstdcxx-debug-flags,[$1],[=FLAGS], |
3312 | [pass compiler FLAGS when building debug library], | |
3313 | [case "x$enable_libstdcxx_debug_flags" in | |
3314 | xno | x) enable_libstdcxx_debug_flags= ;; | |
3315 | x-*) ;; | |
3316 | *) AC_MSG_ERROR(_g_switch needs compiler flags as arguments) ;; | |
3317 | esac]) | |
3318 | ||
3319 | # Option parsed, now set things appropriately | |
3320 | DEBUG_FLAGS="$enable_libstdcxx_debug_flags" | |
3321 | AC_SUBST(DEBUG_FLAGS) | |
3322 | ||
3323 | AC_MSG_NOTICE([Debug build flags set to $DEBUG_FLAGS]) | |
52a11cbf RH |
3324 | ]) |
3325 | ||
3326 | ||
92eabea2 PE |
3327 | dnl |
3328 | dnl Check if the user only wants a freestanding library implementation. | |
3329 | dnl | |
3330 | dnl --disable-hosted-libstdcxx will turn off most of the library build, | |
3331 | dnl installing only the headers required by [17.4.1.3] and the language | |
3332 | dnl support library. More than that will be built (to keep the Makefiles | |
3333 | dnl conveniently clean), but not installed. | |
3334 | dnl | |
6bd2c123 JW |
3335 | dnl Also define --disable-libstdcxx-hosted as an alias for |
3336 | dnl --disable-hosted-libstdcxx but fail if both are given | |
3337 | dnl and their values do not agree. | |
3338 | dnl | |
92eabea2 PE |
3339 | dnl Sets: |
3340 | dnl is_hosted (yes/no) | |
3341 | dnl | |
3660e02f PE |
3342 | dnl Defines: |
3343 | dnl _GLIBCXX_HOSTED (always defined, either to 1 or 0) | |
3344 | dnl | |
f214923c | 3345 | AC_DEFUN([GLIBCXX_ENABLE_HOSTED], [ |
92eabea2 PE |
3346 | AC_ARG_ENABLE([hosted-libstdcxx], |
3347 | AC_HELP_STRING([--disable-hosted-libstdcxx], | |
6bd2c123 JW |
3348 | [only build freestanding C++ runtime support]), |
3349 | [enable_hosted_libstdcxx_was_given=yes], | |
4c24b21a | 3350 | [case "$host" in |
b329dd10 | 3351 | arm*-*-symbianelf*) |
4c24b21a MM |
3352 | enable_hosted_libstdcxx=no |
3353 | ;; | |
b329dd10 | 3354 | *) |
88b34661 AA |
3355 | case "${with_newlib}-${with_headers}" in |
3356 | no-no) enable_hosted_libstdcxx=no ;; | |
3357 | *) enable_hosted_libstdcxx=yes ;; | |
3358 | esac | |
4c24b21a MM |
3359 | ;; |
3360 | esac]) | |
6bd2c123 JW |
3361 | |
3362 | # Because most configure args are --enable-libstdcxx-foo add an alias | |
3363 | # of that form for --enable-hosted-libstdcxx. | |
3364 | AC_ARG_ENABLE([libstdcxx-hosted], | |
3365 | AC_HELP_STRING([--disable-libstdcxx-hosted], | |
3366 | [alias for --disable-hosted-libstdcxx]), | |
3367 | [if test "$enable_hosted_libstdcxx_was_given" = yes; then | |
3368 | if test "$enable_hosted_libstdcxx" != "$enableval"; then | |
3369 | AC_MSG_ERROR([--enable-libstdcxx-hosted=$enableval conflicts with --enable-hosted-libstdcxx=$enable_hosted_libstdcxx]) | |
3370 | fi | |
3371 | else | |
3372 | enable_hosted_libstdcxx=${enableval} | |
3373 | fi | |
3374 | ],) | |
3375 | ||
68c2e9e9 | 3376 | freestanding_flags= |
92eabea2 PE |
3377 | if test "$enable_hosted_libstdcxx" = no; then |
3378 | AC_MSG_NOTICE([Only freestanding libraries will be built]) | |
3379 | is_hosted=no | |
3660e02f | 3380 | hosted_define=0 |
92eabea2 PE |
3381 | enable_abi_check=no |
3382 | enable_libstdcxx_pch=no | |
68c2e9e9 JW |
3383 | if test "x$with_headers" = xno; then |
3384 | freestanding_flags="-ffreestanding" | |
3385 | fi | |
92eabea2 PE |
3386 | else |
3387 | is_hosted=yes | |
f1b51f68 | 3388 | hosted_define=__STDC_HOSTED__ |
92eabea2 PE |
3389 | fi |
3390 | GLIBCXX_CONDITIONAL(GLIBCXX_HOSTED, test $is_hosted = yes) | |
3660e02f PE |
3391 | AC_DEFINE_UNQUOTED(_GLIBCXX_HOSTED, $hosted_define, |
3392 | [Define to 1 if a full hosted library is built, or 0 if freestanding.]) | |
68c2e9e9 JW |
3393 | FREESTANDING_FLAGS="$freestanding_flags" |
3394 | AC_SUBST(FREESTANDING_FLAGS) | |
92eabea2 PE |
3395 | ]) |
3396 | ||
3397 | ||
5a86d36f SH |
3398 | dnl |
3399 | dnl Check if the user wants a non-verbose library implementation. | |
3400 | dnl | |
3401 | dnl --disable-libstdcxx-verbose will turn off descriptive messages to | |
3402 | dnl standard error on termination. | |
3403 | dnl | |
3404 | dnl Defines: | |
3405 | dnl _GLIBCXX_VERBOSE (always defined, either to 1 or 0) | |
3406 | dnl | |
3407 | AC_DEFUN([GLIBCXX_ENABLE_VERBOSE], [ | |
3408 | AC_ARG_ENABLE([libstdcxx-verbose], | |
3409 | AC_HELP_STRING([--disable-libstdcxx-verbose], | |
3410 | [disable termination messages to standard error]),, | |
3411 | [enable_libstdcxx_verbose=yes]) | |
3412 | if test x"$enable_libstdcxx_verbose" = xyes; then | |
3413 | verbose_define=1 | |
3414 | else | |
3415 | AC_MSG_NOTICE([verbose termination messages are disabled]) | |
3416 | verbose_define=0 | |
3417 | fi | |
3418 | AC_DEFINE_UNQUOTED(_GLIBCXX_VERBOSE, $verbose_define, | |
3419 | [Define to 1 if a verbose library is built, or 0 otherwise.]) | |
3420 | ]) | |
3421 | ||
3422 | ||
6c3a9f72 | 3423 | dnl |
347669a0 | 3424 | dnl Check for template specializations for the 'long long' type. |
22248545 PE |
3425 | dnl The result determines only whether 'long long' I/O is enabled; things |
3426 | dnl like numeric_limits<> specializations are always available. | |
6c3a9f72 | 3427 | dnl |
3d7c150e BK |
3428 | dnl --enable-long-long defines _GLIBCXX_USE_LONG_LONG |
3429 | dnl --disable-long-long leaves _GLIBCXX_USE_LONG_LONG undefined | |
3430 | dnl + Usage: GLIBCXX_ENABLE_LONG_LONG[(DEFAULT)] | |
ff66d28f | 3431 | dnl Where DEFAULT is either `yes' or `no'. |
6c3a9f72 | 3432 | dnl |
f214923c | 3433 | AC_DEFUN([GLIBCXX_ENABLE_LONG_LONG], [ |
347669a0 | 3434 | GLIBCXX_ENABLE(long-long,$1,,[enable template specializations for 'long long']) |
ff66d28f | 3435 | if test $enable_long_long = yes; then |
b329dd10 BK |
3436 | AC_DEFINE(_GLIBCXX_USE_LONG_LONG, 1, |
3437 | [Define if code specialized for long long should be used.]) | |
6c3a9f72 | 3438 | fi |
347669a0 BK |
3439 | AC_MSG_CHECKING([for enabled long long specializations]) |
3440 | AC_MSG_RESULT([$enable_long_long]) | |
3441 | ]) | |
3442 | ||
3443 | ||
4cdc8761 BK |
3444 | dnl |
3445 | dnl Check for decimal floating point. | |
3446 | dnl See: | |
3447 | dnl http://gcc.gnu.org/onlinedocs/gcc/Decimal-Float.html#Decimal-Float | |
3448 | dnl | |
3449 | dnl This checks to see if the host supports decimal floating point types. | |
3450 | dnl | |
3451 | dnl Defines: | |
3452 | dnl _GLIBCXX_USE_DECIMAL_FLOAT | |
3453 | dnl | |
3454 | AC_DEFUN([GLIBCXX_ENABLE_DECIMAL_FLOAT], [ | |
3455 | ||
3456 | # Fake what AC_TRY_COMPILE does, without linking as this is | |
3457 | # unnecessary for this test. | |
3458 | ||
3459 | cat > conftest.$ac_ext << EOF | |
3460 | [#]line __oline__ "configure" | |
3461 | int main() | |
3462 | { | |
3463 | _Decimal32 d1; | |
3464 | _Decimal64 d2; | |
3465 | _Decimal128 d3; | |
3466 | return 0; | |
3467 | } | |
3468 | EOF | |
3469 | ||
3470 | AC_MSG_CHECKING([for ISO/IEC TR 24733 ]) | |
3471 | if AC_TRY_EVAL(ac_compile); then | |
3472 | AC_DEFINE(_GLIBCXX_USE_DECIMAL_FLOAT, 1, | |
3473 | [Define if ISO/IEC TR 24733 decimal floating point types are supported on this host.]) | |
3474 | enable_dfp=yes | |
3475 | else | |
3476 | enable_dfp=no | |
3477 | fi | |
3478 | AC_MSG_RESULT($enable_dfp) | |
3479 | rm -f conftest* | |
3480 | ]) | |
3481 | ||
6d585f01 | 3482 | dnl |
ad0a3be4 | 3483 | dnl Check for GNU 128-bit floating point type. |
6d585f01 | 3484 | dnl |
ad0a3be4 | 3485 | dnl Note: also checks that the type isn't a standard types. |
6d585f01 PC |
3486 | dnl |
3487 | dnl Defines: | |
f421e442 | 3488 | dnl ENABLE_FLOAT128 |
6d585f01 | 3489 | dnl |
ad0a3be4 | 3490 | AC_DEFUN([GLIBCXX_ENABLE_FLOAT128], [ |
6d585f01 PC |
3491 | |
3492 | AC_LANG_SAVE | |
3493 | AC_LANG_CPLUSPLUS | |
3494 | ||
3495 | # Fake what AC_TRY_COMPILE does, without linking as this is | |
3496 | # unnecessary for this test. | |
3497 | ||
ad0a3be4 | 3498 | cat > conftest.$ac_ext << EOF |
6d585f01 PC |
3499 | [#]line __oline__ "configure" |
3500 | template<typename T1, typename T2> | |
3501 | struct same | |
3502 | { typedef T2 type; }; | |
3503 | ||
3504 | template<typename T> | |
3505 | struct same<T, T>; | |
3506 | ||
3507 | int main() | |
3508 | { | |
2a5d011c | 3509 | typename same<double, __float128>::type f1; |
6d585f01 PC |
3510 | typename same<long double, __float128>::type f2; |
3511 | } | |
3512 | EOF | |
3513 | ||
3514 | AC_MSG_CHECKING([for __float128]) | |
3515 | if AC_TRY_EVAL(ac_compile); then | |
6d585f01 PC |
3516 | enable_float128=yes |
3517 | else | |
3518 | enable_float128=no | |
3519 | fi | |
3520 | AC_MSG_RESULT($enable_float128) | |
f421e442 | 3521 | GLIBCXX_CONDITIONAL(ENABLE_FLOAT128, test $enable_float128 = yes) |
6d585f01 PC |
3522 | rm -f conftest* |
3523 | ||
3524 | AC_LANG_RESTORE | |
3525 | ]) | |
3526 | ||
347669a0 BK |
3527 | dnl |
3528 | dnl Check for template specializations for the 'wchar_t' type. | |
3529 | dnl | |
3530 | dnl --enable-wchar_t defines _GLIBCXX_USE_WCHAR_T | |
3531 | dnl --disable-wchar_t leaves _GLIBCXX_USE_WCHAR_T undefined | |
3532 | dnl + Usage: GLIBCXX_ENABLE_WCHAR_T[(DEFAULT)] | |
3533 | dnl Where DEFAULT is either `yes' or `no'. | |
3534 | dnl | |
8a9b2875 | 3535 | dnl Necessary support must also be present. |
347669a0 BK |
3536 | dnl |
3537 | AC_DEFUN([GLIBCXX_ENABLE_WCHAR_T], [ | |
3538 | GLIBCXX_ENABLE(wchar_t,$1,,[enable template specializations for 'wchar_t']) | |
8a9b2875 PC |
3539 | |
3540 | # Test wchar.h for mbstate_t, which is needed for char_traits and fpos. | |
3541 | AC_CHECK_HEADERS(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no) | |
3542 | AC_MSG_CHECKING([for mbstate_t]) | |
3543 | AC_TRY_COMPILE([#include <wchar.h>], | |
3544 | [mbstate_t teststate;], | |
3545 | have_mbstate_t=yes, have_mbstate_t=no) | |
3546 | AC_MSG_RESULT($have_mbstate_t) | |
3547 | if test x"$have_mbstate_t" = xyes; then | |
3548 | AC_DEFINE(HAVE_MBSTATE_T,1,[Define if mbstate_t exists in wchar.h.]) | |
3549 | fi | |
3550 | ||
d814595c PC |
3551 | # Test it always, for use in GLIBCXX_ENABLE_C99, together with |
3552 | # ac_has_wchar_h. | |
3553 | AC_CHECK_HEADERS(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no) | |
b329dd10 | 3554 | |
8a9b2875 PC |
3555 | if test x"$enable_wchar_t" = x"yes"; then |
3556 | ||
3557 | AC_LANG_SAVE | |
3558 | AC_LANG_CPLUSPLUS | |
b329dd10 | 3559 | |
8a9b2875 PC |
3560 | if test x"$ac_has_wchar_h" = xyes && |
3561 | test x"$ac_has_wctype_h" = xyes; then | |
3562 | AC_TRY_COMPILE([#include <wchar.h> | |
b329dd10 BK |
3563 | #include <stddef.h> |
3564 | wint_t i; | |
8a9b2875 PC |
3565 | long l = WEOF; |
3566 | long j = WCHAR_MIN; | |
3567 | long k = WCHAR_MAX; | |
b329dd10 BK |
3568 | namespace test |
3569 | { | |
8a9b2875 PC |
3570 | using ::btowc; |
3571 | using ::fgetwc; | |
3572 | using ::fgetws; | |
3573 | using ::fputwc; | |
3574 | using ::fputws; | |
3575 | using ::fwide; | |
b329dd10 | 3576 | using ::fwprintf; |
8a9b2875 PC |
3577 | using ::fwscanf; |
3578 | using ::getwc; | |
3579 | using ::getwchar; | |
b329dd10 BK |
3580 | using ::mbrlen; |
3581 | using ::mbrtowc; | |
3582 | using ::mbsinit; | |
3583 | using ::mbsrtowcs; | |
8a9b2875 PC |
3584 | using ::putwc; |
3585 | using ::putwchar; | |
b329dd10 BK |
3586 | using ::swprintf; |
3587 | using ::swscanf; | |
8a9b2875 | 3588 | using ::ungetwc; |
b329dd10 BK |
3589 | using ::vfwprintf; |
3590 | using ::vswprintf; | |
3591 | using ::vwprintf; | |
3592 | using ::wcrtomb; | |
3593 | using ::wcscat; | |
3594 | using ::wcschr; | |
3595 | using ::wcscmp; | |
3596 | using ::wcscoll; | |
3597 | using ::wcscpy; | |
3598 | using ::wcscspn; | |
3599 | using ::wcsftime; | |
8a9b2875 | 3600 | using ::wcslen; |
b329dd10 BK |
3601 | using ::wcsncat; |
3602 | using ::wcsncmp; | |
3603 | using ::wcsncpy; | |
8a9b2875 | 3604 | using ::wcspbrk; |
b329dd10 BK |
3605 | using ::wcsrchr; |
3606 | using ::wcsrtombs; | |
3607 | using ::wcsspn; | |
8a9b2875 | 3608 | using ::wcsstr; |
b329dd10 BK |
3609 | using ::wcstod; |
3610 | using ::wcstok; | |
8a9b2875 | 3611 | using ::wcstol; |
b329dd10 BK |
3612 | using ::wcstoul; |
3613 | using ::wcsxfrm; | |
3614 | using ::wctob; | |
8a9b2875 PC |
3615 | using ::wmemchr; |
3616 | using ::wmemcmp; | |
3617 | using ::wmemcpy; | |
3618 | using ::wmemmove; | |
3619 | using ::wmemset; | |
b329dd10 BK |
3620 | using ::wprintf; |
3621 | using ::wscanf; | |
8a9b2875 PC |
3622 | } |
3623 | ],[],[], [enable_wchar_t=no]) | |
3624 | else | |
3625 | enable_wchar_t=no | |
3626 | fi | |
3627 | ||
3628 | AC_LANG_RESTORE | |
3629 | fi | |
3630 | ||
3631 | if test x"$enable_wchar_t" = x"yes"; then | |
4651e622 | 3632 | AC_DEFINE(_GLIBCXX_USE_WCHAR_T, 1, |
b329dd10 | 3633 | [Define if code specialized for wchar_t should be used.]) |
347669a0 | 3634 | fi |
8a9b2875 | 3635 | |
347669a0 BK |
3636 | AC_MSG_CHECKING([for enabled wchar_t specializations]) |
3637 | AC_MSG_RESULT([$enable_wchar_t]) | |
6c3a9f72 BK |
3638 | ]) |
3639 | ||
3640 | ||
99246c90 | 3641 | dnl |
ff66d28f | 3642 | dnl Check to see if building and using a C++ precompiled header can be done. |
72ed2836 | 3643 | dnl |
ff66d28f PE |
3644 | dnl --enable-libstdcxx-pch=yes |
3645 | dnl default, this shows intent to use stdc++.h.gch If it looks like it | |
3646 | dnl may work, after some light-hearted attempts to puzzle out compiler | |
3647 | dnl support, flip bits on in include/Makefile.am | |
43ba4a58 | 3648 | dnl |
ff66d28f PE |
3649 | dnl --disable-libstdcxx-pch |
3650 | dnl turns off attempts to use or build stdc++.h.gch. | |
fe413112 | 3651 | dnl |
ff66d28f PE |
3652 | dnl Substs: |
3653 | dnl glibcxx_PCHFLAGS | |
fe413112 | 3654 | dnl |
f214923c | 3655 | AC_DEFUN([GLIBCXX_ENABLE_PCH], [ |
ff66d28f | 3656 | GLIBCXX_ENABLE(libstdcxx-pch,$1,,[build pre-compiled libstdc++ headers]) |
ff66d28f PE |
3657 | if test $enable_libstdcxx_pch = yes; then |
3658 | AC_CACHE_CHECK([for compiler with PCH support], | |
3659 | [glibcxx_cv_prog_CXX_pch], | |
3660 | [ac_save_CXXFLAGS="$CXXFLAGS" | |
3661 | CXXFLAGS="$CXXFLAGS -Werror -Winvalid-pch -Wno-deprecated" | |
3662 | AC_LANG_SAVE | |
3663 | AC_LANG_CPLUSPLUS | |
3664 | echo '#include <math.h>' > conftest.h | |
3665 | if $CXX $CXXFLAGS $CPPFLAGS -x c++-header conftest.h \ | |
b329dd10 BK |
3666 | -o conftest.h.gch 1>&5 2>&1 && |
3667 | echo '#error "pch failed"' > conftest.h && | |
3668 | echo '#include "conftest.h"' > conftest.cc && | |
ff66d28f PE |
3669 | $CXX -c $CXXFLAGS $CPPFLAGS conftest.cc 1>&5 2>&1 ; |
3670 | then | |
b329dd10 | 3671 | glibcxx_cv_prog_CXX_pch=yes |
ff66d28f | 3672 | else |
b329dd10 | 3673 | glibcxx_cv_prog_CXX_pch=no |
ff66d28f PE |
3674 | fi |
3675 | rm -f conftest* | |
3676 | CXXFLAGS=$ac_save_CXXFLAGS | |
3677 | AC_LANG_RESTORE | |
3678 | ]) | |
3679 | enable_libstdcxx_pch=$glibcxx_cv_prog_CXX_pch | |
c4c064e7 | 3680 | fi |
747d0967 | 3681 | |
797308b2 BK |
3682 | AC_MSG_CHECKING([for enabled PCH]) |
3683 | AC_MSG_RESULT([$enable_libstdcxx_pch]) | |
3684 | ||
92eabea2 | 3685 | GLIBCXX_CONDITIONAL(GLIBCXX_BUILD_PCH, test $enable_libstdcxx_pch = yes) |
ff66d28f | 3686 | if test $enable_libstdcxx_pch = yes; then |
c2ba9709 | 3687 | glibcxx_PCHFLAGS="-include bits/stdc++.h" |
c4c064e7 | 3688 | else |
ff66d28f | 3689 | glibcxx_PCHFLAGS="" |
bbacb998 | 3690 | fi |
ff66d28f | 3691 | AC_SUBST(glibcxx_PCHFLAGS) |
bbacb998 PC |
3692 | ]) |
3693 | ||
7cda84dc | 3694 | |
701a3eee BK |
3695 | dnl |
3696 | dnl Check for atomic builtins. | |
3697 | dnl See: | |
75cee7c6 | 3698 | dnl http://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html |
701a3eee BK |
3699 | dnl |
3700 | dnl This checks to see if the host supports the compiler-generated | |
b329dd10 | 3701 | dnl builtins for atomic operations for various integral sizes. Note, this |
35648b45 BK |
3702 | dnl is intended to be an all-or-nothing switch, so all the atomic operations |
3703 | dnl that are used should be checked. | |
701a3eee BK |
3704 | dnl |
3705 | dnl Note: | |
2cd9cdcc | 3706 | dnl libgomp and libgfortran use a link test, see CHECK_SYNC_FETCH_AND_ADD. |
701a3eee | 3707 | dnl |
701a3eee | 3708 | AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [ |
701a3eee BK |
3709 | AC_LANG_SAVE |
3710 | AC_LANG_CPLUSPLUS | |
35648b45 | 3711 | old_CXXFLAGS="$CXXFLAGS" |
2cd9cdcc PC |
3712 | |
3713 | # Do link tests if possible, instead asm tests, limited to some platforms | |
3714 | # see discussion in PR target/40134, PR libstdc++/40133 and the thread | |
3715 | # starting at http://gcc.gnu.org/ml/gcc-patches/2009-07/msg00322.html | |
3716 | atomic_builtins_link_tests=no | |
3717 | if test x$gcc_no_link != xyes; then | |
3718 | # Can do link tests. Limit to some tested platforms | |
3719 | case "$host" in | |
3720 | *-*-linux* | *-*-uclinux* | *-*-kfreebsd*-gnu | *-*-gnu*) | |
3721 | atomic_builtins_link_tests=yes | |
b329dd10 | 3722 | ;; |
2cd9cdcc PC |
3723 | esac |
3724 | fi | |
3725 | ||
3726 | if test x$atomic_builtins_link_tests = xyes; then | |
3727 | ||
3728 | # Do link tests. | |
3729 | ||
3730 | CXXFLAGS="$CXXFLAGS -fno-exceptions" | |
3731 | ||
9646a322 JW |
3732 | AC_CACHE_CHECK([for atomic builtins for bool], |
3733 | glibcxx_cv_atomic_bool, [ | |
2cd9cdcc PC |
3734 | AC_TRY_LINK( |
3735 | [ ], | |
3736 | [typedef bool atomic_type; | |
3737 | atomic_type c1; | |
3738 | atomic_type c2; | |
75cee7c6 | 3739 | atomic_type c3(0); |
d2aee115 | 3740 | // N.B. __atomic_fetch_add is not supported for bool. |
75cee7c6 | 3741 | __atomic_compare_exchange_n(&c1, &c2, c3, true, __ATOMIC_ACQ_REL, |
2a5d011c | 3742 | __ATOMIC_RELAXED); |
75cee7c6 BK |
3743 | __atomic_test_and_set(&c1, __ATOMIC_RELAXED); |
3744 | __atomic_load_n(&c1, __ATOMIC_RELAXED); | |
3745 | ], | |
2cd9cdcc PC |
3746 | [glibcxx_cv_atomic_bool=yes], |
3747 | [glibcxx_cv_atomic_bool=no]) | |
b329dd10 | 3748 | ]) |
2cd9cdcc | 3749 | |
9646a322 JW |
3750 | AC_CACHE_CHECK([for atomic builtins for short], |
3751 | glibcxx_cv_atomic_short, [ | |
2cd9cdcc PC |
3752 | AC_TRY_LINK( |
3753 | [ ], | |
3754 | [typedef short atomic_type; | |
3755 | atomic_type c1; | |
3756 | atomic_type c2; | |
75cee7c6 BK |
3757 | atomic_type c3(0); |
3758 | __atomic_fetch_add(&c1, c2, __ATOMIC_RELAXED); | |
3759 | __atomic_compare_exchange_n(&c1, &c2, c3, true, __ATOMIC_ACQ_REL, | |
2a5d011c | 3760 | __ATOMIC_RELAXED); |
75cee7c6 BK |
3761 | __atomic_test_and_set(&c1, __ATOMIC_RELAXED); |
3762 | __atomic_load_n(&c1, __ATOMIC_RELAXED); | |
3763 | ], | |
2cd9cdcc PC |
3764 | [glibcxx_cv_atomic_short=yes], |
3765 | [glibcxx_cv_atomic_short=no]) | |
b329dd10 | 3766 | ]) |
2cd9cdcc | 3767 | |
9646a322 JW |
3768 | AC_CACHE_CHECK([for atomic builtins for int], |
3769 | glibcxx_cv_atomic_int, [ | |
2cd9cdcc PC |
3770 | AC_TRY_LINK( |
3771 | [ ], | |
3772 | [typedef int atomic_type; | |
3773 | atomic_type c1; | |
3774 | atomic_type c2; | |
75cee7c6 BK |
3775 | atomic_type c3(0); |
3776 | __atomic_fetch_add(&c1, c2, __ATOMIC_RELAXED); | |
3777 | __atomic_compare_exchange_n(&c1, &c2, c3, true, __ATOMIC_ACQ_REL, | |
2a5d011c | 3778 | __ATOMIC_RELAXED); |
75cee7c6 BK |
3779 | __atomic_test_and_set(&c1, __ATOMIC_RELAXED); |
3780 | __atomic_load_n(&c1, __ATOMIC_RELAXED); | |
3781 | ], | |
2cd9cdcc PC |
3782 | [glibcxx_cv_atomic_int=yes], |
3783 | [glibcxx_cv_atomic_int=no]) | |
b329dd10 | 3784 | ]) |
2cd9cdcc | 3785 | |
9646a322 JW |
3786 | AC_CACHE_CHECK([for atomic builtins for long long], |
3787 | glibcxx_cv_atomic_long_long, [ | |
2cd9cdcc PC |
3788 | AC_TRY_LINK( |
3789 | [ ], | |
3790 | [typedef long long atomic_type; | |
3791 | atomic_type c1; | |
3792 | atomic_type c2; | |
75cee7c6 BK |
3793 | atomic_type c3(0); |
3794 | __atomic_fetch_add(&c1, c2, __ATOMIC_RELAXED); | |
3795 | __atomic_compare_exchange_n(&c1, &c2, c3, true, __ATOMIC_ACQ_REL, | |
2a5d011c | 3796 | __ATOMIC_RELAXED); |
75cee7c6 BK |
3797 | __atomic_test_and_set(&c1, __ATOMIC_RELAXED); |
3798 | __atomic_load_n(&c1, __ATOMIC_RELAXED); | |
3799 | ], | |
2cd9cdcc PC |
3800 | [glibcxx_cv_atomic_long_long=yes], |
3801 | [glibcxx_cv_atomic_long_long=no]) | |
b329dd10 | 3802 | ]) |
2cd9cdcc PC |
3803 | |
3804 | else | |
3805 | ||
3806 | # Do asm tests. | |
3807 | ||
35648b45 BK |
3808 | # Compile unoptimized. |
3809 | CXXFLAGS='-O0 -S' | |
3810 | ||
2cd9cdcc | 3811 | # Fake what AC_TRY_COMPILE does. |
701a3eee | 3812 | |
701a3eee BK |
3813 | cat > conftest.$ac_ext << EOF |
3814 | [#]line __oline__ "configure" | |
3815 | int main() | |
50ce8d3d BK |
3816 | { |
3817 | typedef bool atomic_type; | |
3818 | atomic_type c1; | |
3819 | atomic_type c2; | |
75cee7c6 | 3820 | atomic_type c3(0); |
d2aee115 | 3821 | // N.B. __atomic_fetch_add is not supported for bool. |
75cee7c6 | 3822 | __atomic_compare_exchange_n(&c1, &c2, c3, true, __ATOMIC_ACQ_REL, |
2a5d011c | 3823 | __ATOMIC_RELAXED); |
75cee7c6 BK |
3824 | __atomic_test_and_set(&c1, __ATOMIC_RELAXED); |
3825 | __atomic_load_n(&c1, __ATOMIC_RELAXED); | |
2a5d011c | 3826 | |
50ce8d3d BK |
3827 | return 0; |
3828 | } | |
3829 | EOF | |
3830 | ||
3831 | AC_MSG_CHECKING([for atomic builtins for bool]) | |
3832 | if AC_TRY_EVAL(ac_compile); then | |
904bfee8 | 3833 | if grep __atomic_ conftest.s >/dev/null 2>&1 ; then |
b329dd10 | 3834 | glibcxx_cv_atomic_bool=no |
50ce8d3d | 3835 | else |
b329dd10 | 3836 | glibcxx_cv_atomic_bool=yes |
50ce8d3d BK |
3837 | fi |
3838 | fi | |
2cd9cdcc | 3839 | AC_MSG_RESULT($glibcxx_cv_atomic_bool) |
50ce8d3d BK |
3840 | rm -f conftest* |
3841 | ||
3842 | cat > conftest.$ac_ext << EOF | |
3843 | [#]line __oline__ "configure" | |
3844 | int main() | |
3845 | { | |
3846 | typedef short atomic_type; | |
3847 | atomic_type c1; | |
3848 | atomic_type c2; | |
75cee7c6 BK |
3849 | atomic_type c3(0); |
3850 | __atomic_fetch_add(&c1, c2, __ATOMIC_RELAXED); | |
3851 | __atomic_compare_exchange_n(&c1, &c2, c3, true, __ATOMIC_ACQ_REL, | |
2a5d011c | 3852 | __ATOMIC_RELAXED); |
75cee7c6 BK |
3853 | __atomic_test_and_set(&c1, __ATOMIC_RELAXED); |
3854 | __atomic_load_n(&c1, __ATOMIC_RELAXED); | |
3855 | ||
50ce8d3d BK |
3856 | return 0; |
3857 | } | |
3858 | EOF | |
3859 | ||
3860 | AC_MSG_CHECKING([for atomic builtins for short]) | |
3861 | if AC_TRY_EVAL(ac_compile); then | |
904bfee8 | 3862 | if grep __atomic_ conftest.s >/dev/null 2>&1 ; then |
b329dd10 | 3863 | glibcxx_cv_atomic_short=no |
50ce8d3d | 3864 | else |
b329dd10 | 3865 | glibcxx_cv_atomic_short=yes |
50ce8d3d BK |
3866 | fi |
3867 | fi | |
2cd9cdcc | 3868 | AC_MSG_RESULT($glibcxx_cv_atomic_short) |
50ce8d3d BK |
3869 | rm -f conftest* |
3870 | ||
3871 | cat > conftest.$ac_ext << EOF | |
3872 | [#]line __oline__ "configure" | |
3873 | int main() | |
701a3eee | 3874 | { |
b329dd10 | 3875 | // NB: _Atomic_word not necessarily int. |
701a3eee BK |
3876 | typedef int atomic_type; |
3877 | atomic_type c1; | |
3878 | atomic_type c2; | |
75cee7c6 BK |
3879 | atomic_type c3(0); |
3880 | __atomic_fetch_add(&c1, c2, __ATOMIC_RELAXED); | |
3881 | __atomic_compare_exchange_n(&c1, &c2, c3, true, __ATOMIC_ACQ_REL, | |
2a5d011c | 3882 | __ATOMIC_RELAXED); |
75cee7c6 BK |
3883 | __atomic_test_and_set(&c1, __ATOMIC_RELAXED); |
3884 | __atomic_load_n(&c1, __ATOMIC_RELAXED); | |
3885 | ||
35648b45 BK |
3886 | return 0; |
3887 | } | |
3888 | EOF | |
3889 | ||
3890 | AC_MSG_CHECKING([for atomic builtins for int]) | |
3891 | if AC_TRY_EVAL(ac_compile); then | |
904bfee8 | 3892 | if grep __atomic_ conftest.s >/dev/null 2>&1 ; then |
b329dd10 | 3893 | glibcxx_cv_atomic_int=no |
35648b45 | 3894 | else |
b329dd10 | 3895 | glibcxx_cv_atomic_int=yes |
35648b45 BK |
3896 | fi |
3897 | fi | |
2cd9cdcc | 3898 | AC_MSG_RESULT($glibcxx_cv_atomic_int) |
35648b45 BK |
3899 | rm -f conftest* |
3900 | ||
3901 | cat > conftest.$ac_ext << EOF | |
3902 | [#]line __oline__ "configure" | |
3903 | int main() | |
3904 | { | |
50ce8d3d | 3905 | typedef long long atomic_type; |
35648b45 BK |
3906 | atomic_type c1; |
3907 | atomic_type c2; | |
75cee7c6 BK |
3908 | atomic_type c3(0); |
3909 | __atomic_fetch_add(&c1, c2, __ATOMIC_RELAXED); | |
3910 | __atomic_compare_exchange_n(&c1, &c2, c3, true, __ATOMIC_ACQ_REL, | |
2a5d011c | 3911 | __ATOMIC_RELAXED); |
75cee7c6 BK |
3912 | __atomic_test_and_set(&c1, __ATOMIC_RELAXED); |
3913 | __atomic_load_n(&c1, __ATOMIC_RELAXED); | |
3914 | ||
35648b45 | 3915 | return 0; |
701a3eee BK |
3916 | } |
3917 | EOF | |
35648b45 | 3918 | |
50ce8d3d | 3919 | AC_MSG_CHECKING([for atomic builtins for long long]) |
701a3eee | 3920 | if AC_TRY_EVAL(ac_compile); then |
904bfee8 | 3921 | if grep __atomic_ conftest.s >/dev/null 2>&1 ; then |
b329dd10 | 3922 | glibcxx_cv_atomic_long_long=no |
701a3eee | 3923 | else |
b329dd10 | 3924 | glibcxx_cv_atomic_long_long=yes |
701a3eee BK |
3925 | fi |
3926 | fi | |
2cd9cdcc | 3927 | AC_MSG_RESULT($glibcxx_cv_atomic_long_long) |
701a3eee BK |
3928 | rm -f conftest* |
3929 | ||
2cd9cdcc | 3930 | fi |
50ce8d3d | 3931 | |
35648b45 BK |
3932 | CXXFLAGS="$old_CXXFLAGS" |
3933 | AC_LANG_RESTORE | |
3934 | ||
320c7be3 SH |
3935 | # Set atomicity_dir to builtins if all but the long long test above passes, |
3936 | # or if the builtins were already chosen (e.g. by configure.host). | |
3937 | if { test "$glibcxx_cv_atomic_bool" = yes \ | |
3d076231 | 3938 | && test "$glibcxx_cv_atomic_short" = yes \ |
320c7be3 SH |
3939 | && test "$glibcxx_cv_atomic_int" = yes; } \ |
3940 | || test "$atomicity_dir" = "cpu/generic/atomicity_builtins"; then | |
a152e96f BK |
3941 | AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS, 1, |
3942 | [Define if the compiler supports C++11 atomics.]) | |
35648b45 BK |
3943 | atomicity_dir=cpu/generic/atomicity_builtins |
3944 | fi | |
3945 | ||
3946 | # If still generic, set to mutex. | |
701a3eee | 3947 | if test $atomicity_dir = "cpu/generic" ; then |
35648b45 | 3948 | atomicity_dir=cpu/generic/atomicity_mutex |
6995087d | 3949 | AC_MSG_WARN([No native atomic operations are provided for this platform.]) |
dd88bc97 | 3950 | if test "x$target_thread_file" = xsingle; then |
b329dd10 BK |
3951 | AC_MSG_WARN([They cannot be faked when thread support is disabled.]) |
3952 | AC_MSG_WARN([Thread-safety of certain classes is not guaranteed.]) | |
6995087d | 3953 | else |
b329dd10 BK |
3954 | AC_MSG_WARN([They will be faked using a mutex.]) |
3955 | AC_MSG_WARN([Performance of certain classes will degrade as a result.]) | |
6995087d | 3956 | fi |
701a3eee | 3957 | fi |
35648b45 | 3958 | |
701a3eee BK |
3959 | ]) |
3960 | ||
da29d2a3 JW |
3961 | dnl |
3962 | dnl Set default lock policy for synchronizing shared_ptr reference counting. | |
3963 | dnl | |
3964 | dnl --with-libstdcxx-lock-policy=auto | |
3965 | dnl Use atomic operations for shared_ptr reference counting only if | |
3966 | dnl the default target supports atomic compare-and-swap. | |
3967 | dnl --with-libstdcxx-lock-policy=atomic | |
3968 | dnl Use atomic operations for shared_ptr reference counting. | |
3969 | dnl --with-libstdcxx-lock-policy=mutex | |
3970 | dnl Use a mutex to synchronize shared_ptr reference counting. | |
3971 | dnl | |
3972 | dnl This controls the value of __gnu_cxx::__default_lock_policy, which | |
3973 | dnl determines how shared_ptr reference counts are synchronized. | |
3974 | dnl The option "atomic" means that atomic operations should be used, | |
3975 | dnl "mutex" means that a mutex will be used. The default option, "auto", | |
3976 | dnl will check if the target supports the compiler-generated builtins | |
3977 | dnl for atomic compare-and-swap operations for 2-byte and 4-byte integers, | |
3978 | dnl and will use "atomic" if supported, "mutex" otherwise. | |
3979 | dnl This option is ignored if the thread model used by GCC is "single", | |
3980 | dnl as no synchronization is used at all in that case. | |
3981 | dnl This option affects the library ABI (except in the "single" thread model). | |
3982 | dnl | |
3983 | dnl Defines _GLIBCXX_HAVE_ATOMIC_LOCK_POLICY to 1 if atomics should be used. | |
3984 | dnl | |
3985 | AC_DEFUN([GLIBCXX_ENABLE_LOCK_POLICY], [ | |
3986 | ||
3987 | AC_ARG_WITH([libstdcxx-lock-policy], | |
3988 | AC_HELP_STRING([--with-libstdcxx-lock-policy={atomic,mutex,auto}], | |
3989 | [synchronization policy for shared_ptr reference counting [default=auto]]), | |
3990 | [libstdcxx_atomic_lock_policy=$withval], | |
3991 | [libstdcxx_atomic_lock_policy=auto]) | |
3992 | ||
3993 | case "$libstdcxx_atomic_lock_policy" in | |
3994 | atomic|mutex|auto) ;; | |
3995 | *) AC_MSG_ERROR([Invalid argument for --with-libstdcxx-lock-policy]) ;; | |
3996 | esac | |
3997 | AC_MSG_CHECKING([for lock policy for shared_ptr reference counts]) | |
3998 | ||
3999 | if test x"$libstdcxx_atomic_lock_policy" = x"auto"; then | |
4000 | AC_LANG_SAVE | |
4001 | AC_LANG_CPLUSPLUS | |
4002 | ac_save_CXXFLAGS="$CXXFLAGS" | |
4003 | ||
4004 | dnl Why do we care about 2-byte CAS on targets with 4-byte _Atomic_word?! | |
8dbb60b8 JW |
4005 | dnl Why don't we check 8-byte CAS for sparc64, where _Atomic_word is long?! |
4006 | dnl New targets should only check for CAS for the _Atomic_word type. | |
da29d2a3 | 4007 | AC_TRY_COMPILE([ |
3fc22eed PD |
4008 | #if defined __riscv |
4009 | # error "Defaulting to mutex-based locks for ABI compatibility" | |
4010 | #endif | |
da29d2a3 JW |
4011 | #if ! defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 |
4012 | # error "No 2-byte compare-and-swap" | |
4013 | #elif ! defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 | |
4014 | # error "No 4-byte compare-and-swap" | |
4015 | #endif | |
4016 | ],, | |
4017 | [libstdcxx_atomic_lock_policy=atomic], | |
4018 | [libstdcxx_atomic_lock_policy=mutex]) | |
4019 | AC_LANG_RESTORE | |
4020 | CXXFLAGS="$ac_save_CXXFLAGS" | |
4021 | fi | |
4022 | ||
4023 | if test x"$libstdcxx_atomic_lock_policy" = x"atomic"; then | |
4024 | AC_MSG_RESULT(atomic) | |
4025 | AC_DEFINE(HAVE_ATOMIC_LOCK_POLICY,1, | |
4026 | [Defined if shared_ptr reference counting should use atomic operations.]) | |
4027 | else | |
4028 | AC_MSG_RESULT(mutex) | |
4029 | fi | |
4030 | ||
4031 | ]) | |
701a3eee | 4032 | |
98e615b4 BK |
4033 | dnl |
4034 | dnl Allow visibility attributes to be used on namespaces, objects, etc. | |
4035 | dnl | |
dbe17524 PC |
4036 | dnl --enable-libstdcxx-visibility enables attempt to use visibility attributes. |
4037 | dnl --disable-libstdcxx-visibility turns off all use of visibility attributes. | |
4038 | dnl + Usage: GLIBCXX_ENABLE_LIBSTDCXX_VISIBILITY[(DEFAULT)] | |
98e615b4 BK |
4039 | dnl Where DEFAULT is 'yes'. |
4040 | dnl | |
dbe17524 PC |
4041 | AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_VISIBILITY], [ |
4042 | GLIBCXX_ENABLE(libstdcxx-visibility,$1,,[enables visibility safe usage]) | |
98e615b4 | 4043 | |
dbe17524 | 4044 | if test x$enable_libstdcxx_visibility = xyes ; then |
98e615b4 BK |
4045 | dnl all hail libgfortran |
4046 | dnl Check whether the target supports hidden visibility. | |
4047 | AC_CACHE_CHECK([whether the target supports hidden visibility], | |
6d26724a | 4048 | glibcxx_cv_have_attribute_visibility, [ |
98e615b4 BK |
4049 | save_CFLAGS="$CFLAGS" |
4050 | CFLAGS="$CFLAGS -Werror" | |
4051 | AC_TRY_COMPILE([void __attribute__((visibility("hidden"))) foo(void) { }], | |
6d26724a RW |
4052 | [], glibcxx_cv_have_attribute_visibility=yes, |
4053 | glibcxx_cv_have_attribute_visibility=no) | |
98e615b4 | 4054 | CFLAGS="$save_CFLAGS"]) |
6d26724a | 4055 | if test $glibcxx_cv_have_attribute_visibility = no; then |
dbe17524 | 4056 | enable_libstdcxx_visibility=no |
98e615b4 BK |
4057 | fi |
4058 | fi | |
4059 | ||
dbe17524 PC |
4060 | GLIBCXX_CONDITIONAL(ENABLE_VISIBILITY, test $enable_libstdcxx_visibility = yes) |
4061 | AC_MSG_NOTICE([visibility supported: $enable_libstdcxx_visibility]) | |
98e615b4 BK |
4062 | ]) |
4063 | ||
4064 | ||
530539d9 PE |
4065 | dnl |
4066 | dnl Add version tags to symbols in shared library (or not), additionally | |
4067 | dnl marking other symbols as private/local (or not). | |
4068 | dnl | |
2799d972 BK |
4069 | dnl Sets libtool_VERSION, and determines shared library SONAME. |
4070 | dnl | |
4071 | dnl This depends on GLIBCXX CHECK_LINKER_FEATURES, but without it assumes no. | |
4072 | dnl | |
c98b201b PE |
4073 | dnl --enable-symvers=style adds a version script to the linker call when |
4074 | dnl creating the shared library. The choice of version script is | |
4075 | dnl controlled by 'style'. | |
530539d9 | 4076 | dnl --disable-symvers does not. |
2799d972 | 4077 | dnl |
3d7c150e | 4078 | dnl + Usage: GLIBCXX_ENABLE_SYMVERS[(DEFAULT)] |
ff66d28f PE |
4079 | dnl Where DEFAULT is either 'yes' or 'no'. Passing `yes' tries to |
4080 | dnl choose a default style based on linker characteristics. Passing | |
4081 | dnl 'no' disables versioning. | |
4082 | dnl | |
f214923c | 4083 | AC_DEFUN([GLIBCXX_ENABLE_SYMVERS], [ |
ff66d28f | 4084 | |
b453ace3 | 4085 | GLIBCXX_ENABLE(symvers,$1,[[[=STYLE]]], |
ff66d28f | 4086 | [enables symbol versioning of the shared library], |
c18dc5cc | 4087 | [permit yes|no|gnu|gnu-versioned-namespace|darwin|darwin-export|sun]) |
c98b201b | 4088 | |
3d7c150e | 4089 | # If we never went through the GLIBCXX_CHECK_LINKER_FEATURES macro, then we |
37bc6ca2 | 4090 | # don't know enough about $LD to do tricks... |
ff66d28f | 4091 | AC_REQUIRE([GLIBCXX_CHECK_LINKER_FEATURES]) |
c18dc5cc RO |
4092 | # Sun style symbol versions needs GNU c++filt for make_sunver.pl to work |
4093 | # with extern "C++" in version scripts. | |
4094 | AC_REQUIRE([GCC_PROG_GNU_CXXFILT]) | |
a9fdd472 GK |
4095 | |
4096 | # Turn a 'yes' into a suitable default. | |
4097 | if test x$enable_symvers = xyes ; then | |
4bd726d0 | 4098 | if test $enable_shared = no || test "x$LD" = x || test x$gcc_no_link = xyes; then |
a9fdd472 | 4099 | enable_symvers=no |
a9fdd472 | 4100 | else |
fb5c309d | 4101 | if test $with_gnu_ld = yes ; then |
d89f0ad6 | 4102 | case ${target_os} in |
b329dd10 BK |
4103 | hpux*) |
4104 | enable_symvers=no ;; | |
4105 | *) | |
4106 | enable_symvers=gnu ;; | |
d89f0ad6 | 4107 | esac |
fb5c309d BK |
4108 | else |
4109 | case ${target_os} in | |
b329dd10 | 4110 | darwin*) |
fb5c309d | 4111 | enable_symvers=darwin ;; |
c18dc5cc RO |
4112 | # Sun symbol versioning exists since Solaris 2.5. |
4113 | solaris2.[[5-9]]* | solaris2.1[[0-9]]*) | |
4114 | # make_sunver.pl needs GNU c++filt to support extern "C++" in | |
4115 | # version scripts, so disable symbol versioning if none can be | |
4116 | # found. | |
4117 | if test -z "$ac_cv_path_CXXFILT"; then | |
4118 | AC_MSG_WARN([=== You have requested Sun symbol versioning, but]) | |
4119 | AC_MSG_WARN([=== no GNU c++filt could be found.]) | |
4120 | AC_MSG_WARN([=== Symbol versioning will be disabled.]) | |
4121 | enable_symvers=no | |
4122 | else | |
4123 | enable_symvers=sun | |
4124 | fi | |
4125 | ;; | |
b329dd10 BK |
4126 | *) |
4127 | enable_symvers=no ;; | |
fb5c309d BK |
4128 | esac |
4129 | fi | |
a9fdd472 | 4130 | fi |
530539d9 | 4131 | fi |
c98b201b | 4132 | |
fb5c309d BK |
4133 | # Check to see if 'darwin' or 'darwin-export' can win. |
4134 | if test x$enable_symvers = xdarwin-export ; then | |
4135 | enable_symvers=darwin | |
4136 | fi | |
4137 | ||
c18dc5cc RO |
4138 | # Check if 'sun' was requested on non-Solaris 2 platforms. |
4139 | if test x$enable_symvers = xsun ; then | |
4140 | case ${target_os} in | |
4141 | solaris2*) | |
4142 | # All fine. | |
4143 | ;; | |
4144 | *) | |
4145 | # Unlikely to work. | |
4146 | AC_MSG_WARN([=== You have requested Sun symbol versioning, but]) | |
4147 | AC_MSG_WARN([=== you are not targetting Solaris 2.]) | |
4148 | AC_MSG_WARN([=== Symbol versioning will be disabled.]) | |
4149 | enable_symvers=no | |
4150 | ;; | |
4151 | esac | |
4152 | fi | |
4153 | ||
f47bddec | 4154 | # Check to see if 'gnu' can win. |
b329dd10 BK |
4155 | if test $enable_symvers = gnu || |
4156 | test $enable_symvers = gnu-versioned-namespace || | |
c18dc5cc | 4157 | test $enable_symvers = sun; then |
f47bddec | 4158 | # Check to see if libgcc_s exists, indicating that shared libgcc is possible. |
2c839a4e PE |
4159 | AC_MSG_CHECKING([for shared libgcc]) |
4160 | ac_save_CFLAGS="$CFLAGS" | |
4161 | CFLAGS=' -lgcc_s' | |
ff66d28f | 4162 | AC_TRY_LINK(, [return 0;], glibcxx_shared_libgcc=yes, glibcxx_shared_libgcc=no) |
2c839a4e | 4163 | CFLAGS="$ac_save_CFLAGS" |
d5325238 JJ |
4164 | if test $glibcxx_shared_libgcc = no; then |
4165 | cat > conftest.c <<EOF | |
4166 | int main (void) { return 0; } | |
4167 | EOF | |
4168 | changequote(,)dnl | |
4169 | glibcxx_libgcc_s_suffix=`${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \ | |
4170 | -shared -shared-libgcc -o conftest.so \ | |
4171 | conftest.c -v 2>&1 >/dev/null \ | |
4172 | | sed -n 's/^.* -lgcc_s\([^ ]*\) .*$/\1/p'` | |
4173 | changequote([,])dnl | |
4174 | rm -f conftest.c conftest.so | |
4175 | if test x${glibcxx_libgcc_s_suffix+set} = xset; then | |
4176 | CFLAGS=" -lgcc_s$glibcxx_libgcc_s_suffix" | |
4177 | AC_TRY_LINK(, [return 0;], glibcxx_shared_libgcc=yes) | |
4178 | CFLAGS="$ac_save_CFLAGS" | |
4179 | fi | |
4180 | fi | |
3d7c150e | 4181 | AC_MSG_RESULT($glibcxx_shared_libgcc) |
a9fdd472 | 4182 | |
a9fdd472 GK |
4183 | # For GNU ld, we need at least this version. The format is described in |
4184 | # GLIBCXX_CHECK_LINKER_FEATURES above. | |
4185 | glibcxx_min_gnu_ld_version=21400 | |
c98b201b | 4186 | |
f47bddec GK |
4187 | # If no shared libgcc, can't win. |
4188 | if test $glibcxx_shared_libgcc != yes; then | |
4189 | AC_MSG_WARN([=== You have requested GNU symbol versioning, but]) | |
4190 | AC_MSG_WARN([=== you are not building a shared libgcc_s.]) | |
4191 | AC_MSG_WARN([=== Symbol versioning will be disabled.]) | |
4192 | enable_symvers=no | |
c18dc5cc RO |
4193 | elif test $with_gnu_ld != yes && test $enable_symvers = sun; then |
4194 | : All interesting versions of Sun ld support sun style symbol versioning. | |
f47bddec | 4195 | elif test $with_gnu_ld != yes ; then |
ab3bc736 | 4196 | # just fail for now |
a9fdd472 GK |
4197 | AC_MSG_WARN([=== You have requested GNU symbol versioning, but]) |
4198 | AC_MSG_WARN([=== you are not using the GNU linker.]) | |
4199 | AC_MSG_WARN([=== Symbol versioning will be disabled.]) | |
4200 | enable_symvers=no | |
d60a2d4d ILT |
4201 | elif test $glibcxx_ld_is_gold = yes ; then |
4202 | : All versions of gold support symbol versioning. | |
c99a6eb0 ML |
4203 | elif test $glibcxx_ld_is_mold = yes ; then |
4204 | : All versions of mold support symbol versioning. | |
a9fdd472 GK |
4205 | elif test $glibcxx_gnu_ld_version -lt $glibcxx_min_gnu_ld_version ; then |
4206 | # The right tools, the right setup, but too old. Fallbacks? | |
4207 | AC_MSG_WARN(=== Linker version $glibcxx_gnu_ld_version is too old for) | |
4208 | AC_MSG_WARN(=== full symbol versioning support in this release of GCC.) | |
4209 | AC_MSG_WARN(=== You would need to upgrade your binutils to version) | |
4210 | AC_MSG_WARN(=== $glibcxx_min_gnu_ld_version or later and rebuild GCC.) | |
58579a27 | 4211 | AC_MSG_WARN([=== Symbol versioning will be disabled.]) |
ab3bc736 BK |
4212 | enable_symvers=no |
4213 | fi | |
4214 | fi | |
4215 | ||
2799d972 | 4216 | # For libtool versioning info, format is CURRENT:REVISION:AGE |
9a3558cf | 4217 | libtool_VERSION=6:33:0 |
2799d972 BK |
4218 | |
4219 | # Everything parsed; figure out what files and settings to use. | |
c98b201b | 4220 | case $enable_symvers in |
ab3bc736 | 4221 | no) |
fb5c309d | 4222 | SYMVER_FILE=config/abi/pre/none.ver |
ff66d28f | 4223 | ;; |
c98b201b | 4224 | gnu) |
fb5c309d | 4225 | SYMVER_FILE=config/abi/pre/gnu.ver |
b329dd10 BK |
4226 | AC_DEFINE(_GLIBCXX_SYMVER_GNU, 1, |
4227 | [Define to use GNU versioning in the shared library.]) | |
a9fdd472 | 4228 | ;; |
3cbc7af0 | 4229 | gnu-versioned-namespace) |
87c7063d | 4230 | libtool_VERSION=8:0:0 |
3cbc7af0 | 4231 | SYMVER_FILE=config/abi/pre/gnu-versioned-namespace.ver |
b329dd10 BK |
4232 | AC_DEFINE(_GLIBCXX_SYMVER_GNU_NAMESPACE, 1, |
4233 | [Define to use GNU namespace versioning in the shared library.]) | |
3cbc7af0 | 4234 | ;; |
fb5c309d BK |
4235 | darwin) |
4236 | SYMVER_FILE=config/abi/pre/gnu.ver | |
b329dd10 BK |
4237 | AC_DEFINE(_GLIBCXX_SYMVER_DARWIN, 1, |
4238 | [Define to use darwin versioning in the shared library.]) | |
ff66d28f | 4239 | ;; |
c18dc5cc RO |
4240 | sun) |
4241 | SYMVER_FILE=config/abi/pre/gnu.ver | |
b329dd10 BK |
4242 | AC_DEFINE(_GLIBCXX_SYMVER_SUN, 1, |
4243 | [Define to use Sun versioning in the shared library.]) | |
c18dc5cc | 4244 | ;; |
c98b201b PE |
4245 | esac |
4246 | ||
fb5c309d BK |
4247 | if test x$enable_symvers != xno ; then |
4248 | AC_DEFINE(_GLIBCXX_SYMVER, 1, | |
4249 | [Define to use symbol versioning in the shared library.]) | |
4250 | fi | |
4251 | ||
1f93f687 JJ |
4252 | AC_CACHE_CHECK([whether the target supports .symver directive], |
4253 | glibcxx_cv_have_as_symver_directive, [ | |
4254 | AC_TRY_COMPILE([void foo (void); __asm (".symver foo, bar@SYMVER");], | |
4255 | [], glibcxx_cv_have_as_symver_directive=yes, | |
4256 | glibcxx_cv_have_as_symver_directive=no)]) | |
4257 | if test $glibcxx_cv_have_as_symver_directive = yes; then | |
4258 | AC_DEFINE(HAVE_AS_SYMVER_DIRECTIVE, 1, | |
4259 | [Define to 1 if the target assembler supports .symver directive.]) | |
4260 | fi | |
4261 | ||
fb5c309d BK |
4262 | AC_SUBST(SYMVER_FILE) |
4263 | AC_SUBST(port_specific_symbol_files) | |
4264 | GLIBCXX_CONDITIONAL(ENABLE_SYMVERS, test $enable_symvers != no) | |
4265 | GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_GNU, test $enable_symvers = gnu) | |
3cbc7af0 | 4266 | GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_GNU_NAMESPACE, test $enable_symvers = gnu-versioned-namespace) |
fb5c309d | 4267 | GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_DARWIN, test $enable_symvers = darwin) |
c18dc5cc | 4268 | GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_SUN, test $enable_symvers = sun) |
fb5c309d BK |
4269 | AC_MSG_NOTICE(versioning on shared library symbols is $enable_symvers) |
4270 | ||
c18dc5cc RO |
4271 | if test $enable_symvers != no ; then |
4272 | case ${target_os} in | |
4273 | # The Solaris 2 runtime linker doesn't support the GNU extension of | |
4274 | # binding the same symbol to different versions | |
4275 | solaris2*) | |
cc2de92d | 4276 | ;; |
c18dc5cc RO |
4277 | # Other platforms with GNU symbol versioning (GNU/Linux, more?) do. |
4278 | *) | |
8198d541 | 4279 | AC_DEFINE(HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT, 1, |
b329dd10 | 4280 | [Define to 1 if the target runtime linker supports binding the same symbol to different versions.]) |
cc2de92d | 4281 | ;; |
c18dc5cc RO |
4282 | esac |
4283 | fi | |
c18dc5cc | 4284 | |
fb5c309d | 4285 | # Now, set up compatibility support, if any. |
bb2b2a24 BK |
4286 | # In addition, need this to deal with std::size_t mangling in |
4287 | # src/compatibility.cc. In a perfect world, could use | |
4288 | # typeid(std::size_t).name()[0] to do direct substitution. | |
4289 | AC_MSG_CHECKING([for size_t as unsigned int]) | |
4290 | ac_save_CFLAGS="$CFLAGS" | |
4291 | CFLAGS="-Werror" | |
b329dd10 BK |
4292 | AC_TRY_COMPILE(, [__SIZE_TYPE__* stp; unsigned int* uip; stp = uip;], |
4293 | [glibcxx_size_t_is_i=yes], [glibcxx_size_t_is_i=no]) | |
bb2b2a24 BK |
4294 | CFLAGS=$ac_save_CFLAGS |
4295 | if test "$glibcxx_size_t_is_i" = yes; then | |
4296 | AC_DEFINE(_GLIBCXX_SIZE_T_IS_UINT, 1, [Define if size_t is unsigned int.]) | |
4297 | fi | |
4298 | AC_MSG_RESULT([$glibcxx_size_t_is_i]) | |
4299 | ||
4300 | AC_MSG_CHECKING([for ptrdiff_t as int]) | |
4301 | ac_save_CFLAGS="$CFLAGS" | |
4302 | CFLAGS="-Werror" | |
b329dd10 BK |
4303 | AC_TRY_COMPILE(, [__PTRDIFF_TYPE__* ptp; int* ip; ptp = ip;], |
4304 | [glibcxx_ptrdiff_t_is_i=yes], [glibcxx_ptrdiff_t_is_i=no]) | |
bb2b2a24 BK |
4305 | CFLAGS=$ac_save_CFLAGS |
4306 | if test "$glibcxx_ptrdiff_t_is_i" = yes; then | |
4307 | AC_DEFINE(_GLIBCXX_PTRDIFF_T_IS_INT, 1, [Define if ptrdiff_t is int.]) | |
4308 | fi | |
4309 | AC_MSG_RESULT([$glibcxx_ptrdiff_t_is_i]) | |
ff66d28f PE |
4310 | ]) |
4311 | ||
4312 | ||
4313 | dnl | |
4314 | dnl Setup to use the gcc gthr.h thread-specific memory and mutex model. | |
4315 | dnl We must stage the required headers so that they will be installed | |
4316 | dnl with the library (unlike libgcc, the STL implementation is provided | |
4317 | dnl solely within headers). Since we must not inject random user-space | |
4318 | dnl macro names into user-provided C++ code, we first stage into <file>-in | |
4319 | dnl and process to <file> with an output command. The reason for a two- | |
4320 | dnl stage process here is to correctly handle $srcdir!=$objdir without | |
4321 | dnl having to write complex code (the sed commands to clean the macro | |
4322 | dnl namespace are complex and fragile enough as it is). We must also | |
4323 | dnl add a relative path so that -I- is supported properly. | |
4324 | dnl | |
1183dc2c PC |
4325 | dnl Substs: |
4326 | dnl thread_header | |
4327 | dnl | |
f214923c | 4328 | AC_DEFUN([GLIBCXX_ENABLE_THREADS], [ |
ff66d28f | 4329 | AC_MSG_CHECKING([for thread model used by GCC]) |
fbe057bb | 4330 | target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'` |
ff66d28f | 4331 | AC_MSG_RESULT([$target_thread_file]) |
1183dc2c | 4332 | GCC_AC_THREAD_HEADER([$target_thread_file]) |
ff66d28f PE |
4333 | ]) |
4334 | ||
4335 | ||
b8c41c8e CF |
4336 | dnl |
4337 | dnl Check if gthread implementation defines the types and functions | |
4338 | dnl required by the c++0x thread library. Conforming gthread | |
4339 | dnl implementations can define __GTHREADS_CXX0X to enable use with c++0x. | |
4340 | dnl | |
bae868fb RO |
4341 | dnl GLIBCXX_ENABLE_SYMVERS must be done before this. |
4342 | dnl | |
b8c41c8e | 4343 | AC_DEFUN([GLIBCXX_CHECK_GTHREADS], [ |
bae868fb RO |
4344 | GLIBCXX_ENABLE(libstdcxx-threads,auto,,[enable C++11 threads support]) |
4345 | ||
7607ff49 | 4346 | if test x$enable_libstdcxx_threads = xauto || |
bae868fb RO |
4347 | test x$enable_libstdcxx_threads = xyes; then |
4348 | ||
b8c41c8e CF |
4349 | AC_LANG_SAVE |
4350 | AC_LANG_CPLUSPLUS | |
4351 | ||
4352 | ac_save_CXXFLAGS="$CXXFLAGS" | |
5d1c8e77 RO |
4353 | CXXFLAGS="$CXXFLAGS -fno-exceptions \ |
4354 | -I${toplevel_srcdir}/libgcc -I${toplevel_builddir}/libgcc" | |
b8c41c8e | 4355 | |
3b2eeb43 JW |
4356 | target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'` |
4357 | case $target_thread_file in | |
4358 | posix) | |
4359 | CXXFLAGS="$CXXFLAGS -DSUPPORTS_WEAK -DGTHREAD_USE_WEAK -D_PTHREADS" | |
9149a5b7 EB |
4360 | ;; |
4361 | win32) | |
4362 | CXXFLAGS="$CXXFLAGS -D_WIN32_THREADS" | |
4363 | # The support of condition variables is disabled by default in | |
4364 | # the Win32 gthreads library, so enable it on explicit request. | |
4365 | if test x$enable_libstdcxx_threads = xyes; then | |
4366 | CXXFLAGS="$CXXFLAGS -D_WIN32_WINNT=0x0600" | |
4367 | fi | |
4368 | ;; | |
3b2eeb43 JW |
4369 | esac |
4370 | ||
4371 | AC_MSG_CHECKING([whether it can be safely assumed that mutex_timedlock is available]) | |
6545e33e PC |
4372 | |
4373 | AC_TRY_COMPILE([#include <unistd.h>], | |
4374 | [ | |
3b2eeb43 JW |
4375 | // In case of POSIX threads check _POSIX_TIMEOUTS. |
4376 | #if (defined(_PTHREADS) \ | |
2a5d011c | 4377 | && (!defined(_POSIX_TIMEOUTS) || _POSIX_TIMEOUTS <= 0)) |
6545e33e | 4378 | #error |
9149a5b7 EB |
4379 | // In case of Win32 threads there is no support. |
4380 | #elif defined(_WIN32_THREADS) | |
4381 | #error | |
6545e33e PC |
4382 | #endif |
4383 | ], [ac_gthread_use_mutex_timedlock=1], [ac_gthread_use_mutex_timedlock=0]) | |
4384 | ||
4385 | AC_DEFINE_UNQUOTED(_GTHREAD_USE_MUTEX_TIMEDLOCK, $ac_gthread_use_mutex_timedlock, | |
2a5d011c | 4386 | [Define to 1 if mutex_timedlock is available.]) |
6545e33e PC |
4387 | |
4388 | if test $ac_gthread_use_mutex_timedlock = 1 ; then res_mutex_timedlock=yes ; | |
4389 | else res_mutex_timedlock=no ; fi | |
4390 | AC_MSG_RESULT([$res_mutex_timedlock]) | |
4391 | ||
b8c41c8e CF |
4392 | AC_MSG_CHECKING([for gthreads library]) |
4393 | ||
3b2eeb43 | 4394 | AC_TRY_COMPILE([#include "gthr.h"], |
b8c41c8e | 4395 | [ |
a1c5742d PC |
4396 | #ifndef __GTHREADS_CXX0X |
4397 | #error | |
4398 | #endif | |
d9f069ab | 4399 | ], [ac_has_gthreads=yes], [ac_has_gthreads=no]) |
bae868fb RO |
4400 | else |
4401 | ac_has_gthreads=no | |
4402 | fi | |
b8c41c8e CF |
4403 | |
4404 | AC_MSG_RESULT([$ac_has_gthreads]) | |
4405 | ||
4406 | if test x"$ac_has_gthreads" = x"yes"; then | |
4407 | AC_DEFINE(_GLIBCXX_HAS_GTHREADS, 1, | |
b329dd10 | 4408 | [Define if gthreads library is available.]) |
5e0216f1 JW |
4409 | |
4410 | # Also check for pthread_rwlock_t for std::shared_timed_mutex in C++14 | |
7607ff49 JL |
4411 | # but only do so if we're using pthread in the gthread library. |
4412 | # On VxWorks for example, pthread_rwlock_t is defined in sys/types.h | |
4413 | # but the pthread library is not there by default and the gthread library | |
4414 | # does not use it. | |
4415 | AC_TRY_COMPILE([#include "gthr.h"], | |
4416 | [ | |
4417 | #if (!defined(_PTHREADS)) | |
4418 | #error | |
4419 | #endif | |
4420 | ], [ac_gthread_use_pthreads=yes], [ac_gthread_use_pthreads=no]) | |
4421 | if test x"$ac_gthread_use_pthreads" = x"yes"; then | |
4422 | AC_CHECK_TYPE([pthread_rwlock_t], | |
4423 | [AC_DEFINE([_GLIBCXX_USE_PTHREAD_RWLOCK_T], 1, | |
4424 | [Define if POSIX read/write locks are available in <gthr.h>.])], | |
4425 | [], | |
4426 | [#include "gthr.h"]) | |
4427 | fi | |
9149a5b7 EB |
4428 | |
4429 | # See above for the rationale. | |
4430 | if test $target_thread_file = win32; then | |
4431 | CPPFLAGS="$CPPFLAGS -D_WIN32_WINNT=0x0600" | |
4432 | fi | |
b8c41c8e CF |
4433 | fi |
4434 | ||
92b47a32 JW |
4435 | AC_CHECK_HEADER(semaphore.h, [ |
4436 | AC_MSG_CHECKING([for POSIX Semaphores and sem_timedwait]) | |
4437 | AC_TRY_COMPILE([ | |
4438 | #include <unistd.h> | |
4439 | #include <semaphore.h> | |
4440 | #include <limits.h> | |
4441 | ], | |
4442 | [ | |
4443 | #if !defined _POSIX_TIMEOUTS || _POSIX_TIMEOUTS <= 0 | |
4444 | # error "POSIX Timeouts option not supported" | |
4445 | #elif !defined _POSIX_SEMAPHORES || _POSIX_SEMAPHORES <= 0 | |
4446 | # error "POSIX Semaphores option not supported" | |
4447 | #else | |
4448 | #if defined SEM_VALUE_MAX | |
4449 | constexpr int sem_value_max = SEM_VALUE_MAX; | |
4450 | #elif defined _POSIX_SEM_VALUE_MAX | |
4451 | constexpr int sem_value_max = _POSIX_SEM_VALUE_MAX; | |
4452 | #else | |
4453 | # error "SEM_VALUE_MAX not available" | |
4454 | #endif | |
4455 | sem_t sem; | |
4456 | sem_init(&sem, 0, sem_value_max); | |
4457 | struct timespec ts = { 0 }; | |
4458 | sem_timedwait(&sem, &ts); | |
4459 | #endif | |
4460 | ], | |
4461 | [ac_have_posix_semaphore=yes], | |
4462 | [ac_have_posix_semaphore=no])], | |
4463 | [ac_have_posix_semaphore=no]) | |
4464 | ||
4465 | if test $ac_have_posix_semaphore = yes ; then | |
2d4c3af9 | 4466 | AC_DEFINE(HAVE_POSIX_SEMAPHORE, |
92b47a32 JW |
4467 | 1, |
4468 | [Define to 1 if POSIX Semaphores with sem_timedwait are available in <semaphore.h>.]) | |
4469 | fi | |
4470 | AC_MSG_RESULT([$ac_have_posix_semaphore]) | |
4471 | ||
b8c41c8e CF |
4472 | CXXFLAGS="$ac_save_CXXFLAGS" |
4473 | AC_LANG_RESTORE | |
4474 | ]) | |
4475 | ||
4476 | ||
ff66d28f PE |
4477 | # Check whether LC_MESSAGES is available in <locale.h>. |
4478 | # Ulrich Drepper <drepper@cygnus.com>, 1995. | |
4479 | # | |
4480 | # This file file be copied and used freely without restrictions. It can | |
4481 | # be used in projects which are not available under the GNU Public License | |
4482 | # but which still want to provide support for the GNU gettext functionality. | |
4483 | # Please note that the actual code is *not* freely available. | |
f214923c | 4484 | AC_DEFUN([AC_LC_MESSAGES], [ |
ff66d28f PE |
4485 | AC_CHECK_HEADER(locale.h, [ |
4486 | AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES, | |
99bf8d16 | 4487 | [AC_TRY_COMPILE([#include <locale.h>], [return LC_MESSAGES], |
ff66d28f PE |
4488 | ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)]) |
4489 | if test $ac_cv_val_LC_MESSAGES = yes; then | |
b329dd10 BK |
4490 | AC_DEFINE(HAVE_LC_MESSAGES, 1, |
4491 | [Define if LC_MESSAGES is available in <locale.h>.]) | |
ff66d28f PE |
4492 | fi |
4493 | ]) | |
4494 | ]) | |
4495 | ||
3ca6351d UD |
4496 | dnl |
4497 | dnl Check whether rdrand is supported in the assembler. | |
4498 | AC_DEFUN([GLIBCXX_CHECK_X86_RDRAND], [ | |
9646a322 JW |
4499 | AC_CACHE_CHECK([for rdrand support in assembler], |
4500 | ac_cv_x86_rdrand, [ | |
3ca6351d UD |
4501 | ac_cv_x86_rdrand=no |
4502 | case "$target" in | |
4503 | i?86-*-* | \ | |
4504 | x86_64-*-*) | |
4505 | AC_TRY_COMPILE(, [asm("rdrand %eax");], | |
4506 | [ac_cv_x86_rdrand=yes], [ac_cv_x86_rdrand=no]) | |
4507 | esac | |
4508 | ]) | |
4509 | if test $ac_cv_x86_rdrand = yes; then | |
4510 | AC_DEFINE(_GLIBCXX_X86_RDRAND, 1, | |
4511 | [ Defined if as can handle rdrand. ]) | |
4512 | fi | |
3ca6351d UD |
4513 | ]) |
4514 | ||
b0c0d878 JW |
4515 | dnl |
4516 | dnl Check whether rdseed is supported in the assembler. | |
4517 | AC_DEFUN([GLIBCXX_CHECK_X86_RDSEED], [ | |
9646a322 JW |
4518 | AC_CACHE_CHECK([for rdseed support in assembler], |
4519 | ac_cv_x86_rdseed, [ | |
b0c0d878 JW |
4520 | ac_cv_x86_rdseed=no |
4521 | case "$target" in | |
4522 | i?86-*-* | \ | |
4523 | x86_64-*-*) | |
4524 | AC_TRY_COMPILE(, [asm("rdseed %eax");], | |
4525 | [ac_cv_x86_rdseed=yes], [ac_cv_x86_rdseed=no]) | |
4526 | esac | |
4527 | ]) | |
4528 | if test $ac_cv_x86_rdseed = yes; then | |
4529 | AC_DEFINE(_GLIBCXX_X86_RDSEED, 1, | |
4530 | [ Defined if as can handle rdseed. ]) | |
4531 | fi | |
b0c0d878 JW |
4532 | ]) |
4533 | ||
43653c33 JW |
4534 | dnl |
4535 | dnl Check whether get_nprocs is available in <sys/sysinfo.h>, and define _GLIBCXX_USE_GET_NPROCS. | |
4536 | dnl | |
4537 | AC_DEFUN([GLIBCXX_CHECK_GET_NPROCS], [ | |
4538 | ||
4539 | AC_LANG_SAVE | |
4540 | AC_LANG_CPLUSPLUS | |
4541 | ac_save_CXXFLAGS="$CXXFLAGS" | |
4542 | CXXFLAGS="$CXXFLAGS -fno-exceptions" | |
4543 | ||
9646a322 JW |
4544 | AC_CACHE_CHECK([for get_nprocs], |
4545 | glibcxx_cv_GET_NPROCS, [ | |
43653c33 JW |
4546 | GCC_TRY_COMPILE_OR_LINK( |
4547 | [#include <sys/sysinfo.h>], | |
4548 | [int n = get_nprocs();], | |
4549 | [glibcxx_cv_GET_NPROCS=yes], | |
4550 | [glibcxx_cv_GET_NPROCS=no]) | |
4551 | ]) | |
4552 | if test $glibcxx_cv_GET_NPROCS = yes; then | |
4553 | AC_DEFINE(_GLIBCXX_USE_GET_NPROCS, 1, [Define if get_nprocs is available in <sys/sysinfo.h>.]) | |
4554 | fi | |
43653c33 JW |
4555 | |
4556 | CXXFLAGS="$ac_save_CXXFLAGS" | |
4557 | AC_LANG_RESTORE | |
4558 | ]) | |
4559 | ||
4560 | dnl | |
4561 | dnl Check whether sysconf(_SC_NPROCESSORS_ONLN) is available in <unistd.h>, and define _GLIBCXX_USE_SC_NPROCESSORS_ONLN. | |
4562 | dnl | |
4563 | AC_DEFUN([GLIBCXX_CHECK_SC_NPROCESSORS_ONLN], [ | |
4564 | ||
4565 | AC_LANG_SAVE | |
4566 | AC_LANG_CPLUSPLUS | |
4567 | ac_save_CXXFLAGS="$CXXFLAGS" | |
4568 | CXXFLAGS="$CXXFLAGS -fno-exceptions" | |
4569 | ||
9646a322 JW |
4570 | AC_CACHE_CHECK([for _SC_NPROCESSORS_ONLN], |
4571 | glibcxx_cv_SC_NPROCESSORS_ONLN, [ | |
43653c33 JW |
4572 | GCC_TRY_COMPILE_OR_LINK( |
4573 | [#include <unistd.h>], | |
4574 | [int n = sysconf(_SC_NPROCESSORS_ONLN);], | |
4575 | [glibcxx_cv_SC_NPROCESSORS_ONLN=yes], | |
4576 | [glibcxx_cv_SC_NPROCESSORS_ONLN=no]) | |
4577 | ]) | |
4578 | if test $glibcxx_cv_SC_NPROCESSORS_ONLN = yes; then | |
4579 | AC_DEFINE(_GLIBCXX_USE_SC_NPROCESSORS_ONLN, 1, [Define if _SC_NPROCESSORS_ONLN is available in <unistd.h>.]) | |
4580 | fi | |
43653c33 JW |
4581 | |
4582 | CXXFLAGS="$ac_save_CXXFLAGS" | |
4583 | AC_LANG_RESTORE | |
4584 | ]) | |
4585 | ||
5ee360d0 JW |
4586 | dnl |
4587 | dnl Check whether sysconf(_SC_NPROC_ONLN) is available in <unistd.h>, and define _GLIBCXX_USE_SC_NPROC_ONLN. | |
4588 | dnl | |
4589 | AC_DEFUN([GLIBCXX_CHECK_SC_NPROC_ONLN], [ | |
4590 | ||
4591 | AC_LANG_SAVE | |
4592 | AC_LANG_CPLUSPLUS | |
4593 | ac_save_CXXFLAGS="$CXXFLAGS" | |
4594 | CXXFLAGS="$CXXFLAGS -fno-exceptions" | |
4595 | ||
9646a322 JW |
4596 | AC_CACHE_CHECK([for _SC_NPROC_ONLN], |
4597 | glibcxx_cv_SC_NPROC_ONLN, [ | |
5ee360d0 JW |
4598 | GCC_TRY_COMPILE_OR_LINK( |
4599 | [#include <unistd.h>], | |
4600 | [int n = sysconf(_SC_NPROC_ONLN);], | |
4601 | [glibcxx_cv_SC_NPROC_ONLN=yes], | |
4602 | [glibcxx_cv_SC_NPROC_ONLN=no]) | |
4603 | ]) | |
4604 | if test $glibcxx_cv_SC_NPROC_ONLN = yes; then | |
4605 | AC_DEFINE(_GLIBCXX_USE_SC_NPROC_ONLN, 1, [Define if _SC_NPROC_ONLN is available in <unistd.h>.]) | |
4606 | fi | |
5ee360d0 JW |
4607 | |
4608 | CXXFLAGS="$ac_save_CXXFLAGS" | |
4609 | AC_LANG_RESTORE | |
4610 | ]) | |
4611 | ||
4612 | dnl | |
4613 | dnl Check whether pthread_num_processors_np is available in <pthread.h>, and define _GLIBCXX_USE_PTHREADS_NUM_PROCESSORS_NP. | |
4614 | dnl | |
4615 | AC_DEFUN([GLIBCXX_CHECK_PTHREADS_NUM_PROCESSORS_NP], [ | |
4616 | ||
4617 | AC_LANG_SAVE | |
4618 | AC_LANG_CPLUSPLUS | |
4619 | ac_save_CXXFLAGS="$CXXFLAGS" | |
4620 | CXXFLAGS="$CXXFLAGS -fno-exceptions" | |
4621 | ||
9646a322 JW |
4622 | AC_CACHE_CHECK([for pthreads_num_processors_np], |
4623 | glibcxx_cv_PTHREADS_NUM_PROCESSORS_NP, [ | |
5ee360d0 JW |
4624 | GCC_TRY_COMPILE_OR_LINK( |
4625 | [#include <pthread.h>], | |
4626 | [int n = pthread_num_processors_np();], | |
4627 | [glibcxx_cv_PTHREADS_NUM_PROCESSORS_NP=yes], | |
4628 | [glibcxx_cv_PTHREADS_NUM_PROCESSORS_NP=no]) | |
4629 | ]) | |
4630 | if test $glibcxx_cv_PTHREADS_NUM_PROCESSORS_NP = yes; then | |
4631 | AC_DEFINE(_GLIBCXX_USE_PTHREADS_NUM_PROCESSORS_NP, 1, [Define if pthreads_num_processors_np is available in <pthread.h>.]) | |
4632 | fi | |
5ee360d0 JW |
4633 | |
4634 | CXXFLAGS="$ac_save_CXXFLAGS" | |
4635 | AC_LANG_RESTORE | |
4636 | ]) | |
4637 | ||
ad4d1d21 MC |
4638 | dnl |
4639 | dnl Check whether pthread_cond_clockwait is available in <pthread.h> for std::condition_variable to use, | |
4640 | dnl and define _GLIBCXX_USE_PTHREAD_COND_CLOCKWAIT. | |
4641 | dnl | |
4642 | AC_DEFUN([GLIBCXX_CHECK_PTHREAD_COND_CLOCKWAIT], [ | |
4643 | ||
4644 | AC_LANG_SAVE | |
4645 | AC_LANG_CPLUSPLUS | |
4646 | ac_save_CXXFLAGS="$CXXFLAGS" | |
4647 | CXXFLAGS="$CXXFLAGS -fno-exceptions" | |
4648 | ac_save_LIBS="$LIBS" | |
4649 | LIBS="$LIBS -lpthread" | |
4650 | ||
9646a322 JW |
4651 | AC_CACHE_CHECK([for pthread_cond_clockwait], |
4652 | glibcxx_cv_PTHREAD_COND_CLOCKWAIT, [ | |
ad4d1d21 MC |
4653 | GCC_TRY_COMPILE_OR_LINK( |
4654 | [#include <pthread.h>], | |
4655 | [pthread_mutex_t mutex; pthread_cond_t cond; struct timespec ts; int n = pthread_cond_clockwait(&cond, &mutex, 0, &ts);], | |
4656 | [glibcxx_cv_PTHREAD_COND_CLOCKWAIT=yes], | |
4657 | [glibcxx_cv_PTHREAD_COND_CLOCKWAIT=no]) | |
4658 | ]) | |
4659 | if test $glibcxx_cv_PTHREAD_COND_CLOCKWAIT = yes; then | |
4660 | AC_DEFINE(_GLIBCXX_USE_PTHREAD_COND_CLOCKWAIT, 1, [Define if pthread_cond_clockwait is available in <pthread.h>.]) | |
4661 | fi | |
ad4d1d21 MC |
4662 | |
4663 | CXXFLAGS="$ac_save_CXXFLAGS" | |
4664 | LIBS="$ac_save_LIBS" | |
4665 | AC_LANG_RESTORE | |
4666 | ]) | |
4667 | ||
3b2fb543 MC |
4668 | dnl |
4669 | dnl Check whether pthread_mutex_clocklock is available in <pthread.h> for std::timed_mutex to use, | |
4670 | dnl and define _GLIBCXX_USE_PTHREAD_MUTEX_CLOCKLOCK. | |
4671 | dnl | |
4672 | AC_DEFUN([GLIBCXX_CHECK_PTHREAD_MUTEX_CLOCKLOCK], [ | |
4673 | ||
4674 | AC_LANG_SAVE | |
4675 | AC_LANG_CPLUSPLUS | |
4676 | ac_save_CXXFLAGS="$CXXFLAGS" | |
4677 | CXXFLAGS="$CXXFLAGS -fno-exceptions" | |
4678 | ac_save_LIBS="$LIBS" | |
4679 | LIBS="$LIBS -lpthread" | |
4680 | ||
9646a322 JW |
4681 | AC_CACHE_CHECK([for pthread_mutex_clocklock], |
4682 | glibcxx_cv_PTHREAD_MUTEX_CLOCKLOCK, [ | |
3b2fb543 MC |
4683 | GCC_TRY_COMPILE_OR_LINK( |
4684 | [#include <pthread.h>], | |
4685 | [pthread_mutex_t mutex; struct timespec ts; int n = pthread_mutex_clocklock(&mutex, CLOCK_REALTIME, &ts);], | |
4686 | [glibcxx_cv_PTHREAD_MUTEX_CLOCKLOCK=yes], | |
4687 | [glibcxx_cv_PTHREAD_MUTEX_CLOCKLOCK=no]) | |
4688 | ]) | |
4689 | if test $glibcxx_cv_PTHREAD_MUTEX_CLOCKLOCK = yes; then | |
3b7cb330 | 4690 | AC_DEFINE(_GLIBCXX_USE_PTHREAD_MUTEX_CLOCKLOCK, (_GLIBCXX_TSAN==0), [Define if pthread_mutex_clocklock is available in <pthread.h>.]) |
3b2fb543 | 4691 | fi |
3b2fb543 MC |
4692 | |
4693 | CXXFLAGS="$ac_save_CXXFLAGS" | |
4694 | LIBS="$ac_save_LIBS" | |
4695 | AC_LANG_RESTORE | |
4696 | ]) | |
4697 | ||
ab40695a MC |
4698 | dnl |
4699 | dnl Check whether pthread_mutex_clocklock is available in <pthread.h> for std::timed_mutex to use, | |
4700 | dnl and define _GLIBCXX_USE_PTHREAD_MUTEX_CLOCKLOCK. | |
4701 | dnl | |
4702 | AC_DEFUN([GLIBCXX_CHECK_PTHREAD_RWLOCK_CLOCKLOCK], [ | |
4703 | ||
4704 | AC_LANG_SAVE | |
4705 | AC_LANG_CPLUSPLUS | |
4706 | ac_save_CXXFLAGS="$CXXFLAGS" | |
4707 | CXXFLAGS="$CXXFLAGS -fno-exceptions" | |
4708 | ac_save_LIBS="$LIBS" | |
4709 | LIBS="$LIBS -lpthread" | |
4710 | ||
9646a322 JW |
4711 | AC_CACHE_CHECK([for pthread_rwlock_clockrdlock, pthread_wlock_clockwrlock], |
4712 | glibcxx_cv_PTHREAD_RWLOCK_CLOCKLOCK, [ | |
ab40695a MC |
4713 | GCC_TRY_COMPILE_OR_LINK( |
4714 | [#include <pthread.h>], | |
4715 | [pthread_rwlock_t rwl; struct timespec ts;] | |
4716 | [int n = pthread_rwlock_clockrdlock(&rwl, CLOCK_REALTIME, &ts);] | |
4717 | [int m = pthread_rwlock_clockwrlock(&rwl, CLOCK_REALTIME, &ts);], | |
4718 | [glibcxx_cv_PTHREAD_RWLOCK_CLOCKLOCK=yes], | |
4719 | [glibcxx_cv_PTHREAD_RWLOCK_CLOCKLOCK=no]) | |
4720 | ]) | |
4721 | if test $glibcxx_cv_PTHREAD_RWLOCK_CLOCKLOCK = yes; then | |
4722 | AC_DEFINE(_GLIBCXX_USE_PTHREAD_RWLOCK_CLOCKLOCK, 1, [Define if pthread_rwlock_clockrdlock and pthread_rwlock_clockwrlock are available in <pthread.h>.]) | |
4723 | fi | |
ab40695a MC |
4724 | |
4725 | CXXFLAGS="$ac_save_CXXFLAGS" | |
4726 | LIBS="$ac_save_LIBS" | |
4727 | AC_LANG_RESTORE | |
4728 | ]) | |
4729 | ||
5ee360d0 JW |
4730 | dnl |
4731 | dnl Check whether sysctl is available in <pthread.h>, and define _GLIBCXX_USE_SYSCTL_HW_NCPU. | |
4732 | dnl | |
4733 | AC_DEFUN([GLIBCXX_CHECK_SYSCTL_HW_NCPU], [ | |
4734 | ||
4735 | AC_LANG_SAVE | |
4736 | AC_LANG_CPLUSPLUS | |
4737 | ac_save_CXXFLAGS="$CXXFLAGS" | |
4738 | CXXFLAGS="$CXXFLAGS -fno-exceptions" | |
4739 | ||
9646a322 JW |
4740 | AC_CACHE_CHECK([for hw.ncpu sysctl], |
4741 | glibcxx_cv_SYSCTL_HW_NCPU, [ | |
5ee360d0 JW |
4742 | GCC_TRY_COMPILE_OR_LINK( |
4743 | [ | |
4744 | #include <stddef.h> | |
4745 | #include <sys/sysctl.h> | |
4746 | ], | |
4747 | [ | |
4748 | int count; | |
4749 | size_t size = sizeof(count); | |
4750 | int mib[] = { CTL_HW, HW_NCPU }; | |
4751 | sysctl(mib, 2, &count, &size, NULL, 0); | |
4752 | ], | |
4753 | [glibcxx_cv_SYSCTL_HW_NCPU=yes], | |
4754 | [glibcxx_cv_SYSCTL_HW_NCPU=no]) | |
4755 | ]) | |
4756 | if test $glibcxx_cv_SYSCTL_HW_NCPU = yes; then | |
4757 | AC_DEFINE(_GLIBCXX_USE_SYSCTL_HW_NCPU, 1, [Define if sysctl(), CTL_HW and HW_NCPU are available in <sys/sysctl.h>.]) | |
4758 | fi | |
5ee360d0 JW |
4759 | |
4760 | CXXFLAGS="$ac_save_CXXFLAGS" | |
4761 | AC_LANG_RESTORE | |
4762 | ]) | |
43653c33 | 4763 | |
2a5d011c BK |
4764 | dnl |
4765 | dnl Check to see if python pretty printing can be activated. | |
4766 | dnl | |
4767 | dnl --with-python-dir=dir | |
4768 | dnl installs directory into $prefix/dir | |
4769 | AC_DEFUN([GLIBCXX_ENABLE_PYTHON], [ | |
4770 | ||
4771 | AC_MSG_CHECKING([for custom python install directory]) | |
4772 | AC_ARG_WITH([python-dir], | |
4773 | AS_HELP_STRING([--with-python-dir], | |
4774 | [the location to install Python modules. This path is relative starting from the prefix.]), | |
4775 | [with_python_dir=$withval], [with_python_dir="no"]) | |
4776 | AC_MSG_RESULT(${with_python_dir}) | |
4777 | ||
4778 | # Needed for installing Python modules during make install. | |
4779 | python_mod_dir="${with_python_dir}" | |
4780 | AC_SUBST(python_mod_dir) | |
4781 | GLIBCXX_CONDITIONAL(ENABLE_PYTHONDIR, test $python_mod_dir != no) | |
4782 | ]) | |
4783 | ||
b124c5c4 BK |
4784 | dnl |
4785 | dnl Check to see if -Werror is disabled. | |
4786 | dnl | |
4787 | dnl --enable-werror/--disable-werror | |
4788 | AC_DEFUN([GLIBCXX_ENABLE_WERROR], [ | |
4789 | AC_MSG_CHECKING([for -Werror]) | |
4790 | GLIBCXX_ENABLE(werror,$1,,[turns on -Werror]) | |
4791 | AC_MSG_RESULT($enable_werror) | |
4792 | GLIBCXX_CONDITIONAL(ENABLE_WERROR, test $enable_werror = yes) | |
4793 | ]) | |
4794 | ||
7370b9df BRF |
4795 | dnl |
4796 | dnl Check whether obsolescent tmpnam is available in <stdio.h>, | |
4797 | dnl and define _GLIBCXX_USE_TMPNAM. | |
4798 | dnl | |
4799 | AC_DEFUN([GLIBCXX_CHECK_TMPNAM], [dnl | |
4800 | dnl | |
4801 | AC_LANG_SAVE | |
4802 | AC_LANG_CPLUSPLUS | |
4803 | ac_save_CXXFLAGS="$CXXFLAGS" | |
4804 | CXXFLAGS="$CXXFLAGS -fno-exceptions" | |
4805 | dnl | |
9646a322 | 4806 | AC_CACHE_CHECK([for tmpnam], glibcxx_cv_TMPNAM, [dnl |
7370b9df BRF |
4807 | GCC_TRY_COMPILE_OR_LINK( |
4808 | [#include <stdio.h>], | |
4809 | [char *tmp = tmpnam(NULL);], | |
4810 | [glibcxx_cv_TMPNAM=yes], | |
4811 | [glibcxx_cv_TMPNAM=no]) | |
4812 | ]) | |
4813 | if test $glibcxx_cv_TMPNAM = yes; then | |
4814 | AC_DEFINE(_GLIBCXX_USE_TMPNAM, 1, [Define if obsolescent tmpnam is available in <stdio.h>.]) | |
4815 | fi | |
7370b9df BRF |
4816 | dnl |
4817 | CXXFLAGS="$ac_save_CXXFLAGS" | |
4818 | AC_LANG_RESTORE | |
4819 | ]) | |
2a5d011c | 4820 | |
d74e340d TT |
4821 | dnl |
4822 | dnl Check to see if sys/sdt.h exists and that it is suitable for use. | |
4823 | dnl Some versions of sdt.h were not compatible with C++11. | |
4824 | dnl | |
4825 | AC_DEFUN([GLIBCXX_CHECK_SDT_H], [ | |
d74e340d TT |
4826 | # Note that this test has to be run with the C language. |
4827 | # Otherwise, sdt.h will try to include some headers from | |
4828 | # libstdc++ itself. | |
4829 | AC_LANG_SAVE | |
4830 | AC_LANG_C | |
9646a322 JW |
4831 | AC_CACHE_CHECK([for suitable sys/sdt.h], |
4832 | glibcxx_cv_sys_sdt_h, [ | |
d74e340d TT |
4833 | # Because we have to run the test in C, we use grep rather |
4834 | # than the compiler to check for the bug. The bug is that | |
4835 | # were strings without trailing whitespace, causing g++ | |
4836 | # to look for operator"". The pattern searches for the fixed | |
4837 | # output. | |
4838 | AC_EGREP_CPP([ \",\" ], [ | |
4839 | #include <sys/sdt.h> | |
4840 | int f() { STAP_PROBE(hi, bob); } | |
4841 | ], [glibcxx_cv_sys_sdt_h=yes], [glibcxx_cv_sys_sdt_h=no]) | |
4842 | ]) | |
4843 | AC_LANG_RESTORE | |
4844 | if test $glibcxx_cv_sys_sdt_h = yes; then | |
4845 | AC_DEFINE(HAVE_SYS_SDT_H, 1, | |
4846 | [Define to 1 if you have a suitable <sys/sdt.h> header file]) | |
4847 | fi | |
d74e340d TT |
4848 | ]) |
4849 | ||
375f837b | 4850 | dnl |
34a2b755 JW |
4851 | dnl Control whether the library should define symbols for old and new ABIs. |
4852 | dnl This affects definitions of strings, stringstreams and locale facets. | |
375f837b | 4853 | dnl |
34a2b755 | 4854 | dnl --disable-libstdcxx-dual-abi will use old ABI for all types. |
375f837b JW |
4855 | dnl |
4856 | dnl Defines: | |
34a2b755 | 4857 | dnl _GLIBCXX_USE_DUAL_ABI (always defined, either to 1 or 0) |
375f837b | 4858 | dnl |
34a2b755 JW |
4859 | AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_DUAL_ABI], [ |
4860 | GLIBCXX_ENABLE(libstdcxx-dual-abi,$1,,[support two versions of std::string]) | |
8dcf3d3c JW |
4861 | if test x$enable_symvers = xgnu-versioned-namespace; then |
4862 | # gnu-versioned-namespace is incompatible with the dual ABI. | |
4863 | enable_libstdcxx_dual_abi="no" | |
4864 | fi | |
34a2b755 JW |
4865 | if test x"$enable_libstdcxx_dual_abi" != xyes; then |
4866 | AC_MSG_NOTICE([dual ABI is disabled]) | |
10d712eb | 4867 | default_libstdcxx_abi="gcc4-compatible" |
375f837b | 4868 | fi |
34a2b755 | 4869 | GLIBCXX_CONDITIONAL(ENABLE_DUAL_ABI, test $enable_libstdcxx_dual_abi = yes) |
375f837b JW |
4870 | ]) |
4871 | ||
34a2b755 JW |
4872 | dnl |
4873 | dnl Check to see which ABI should be enabled by default. | |
4874 | dnl | |
10d712eb | 4875 | dnl --with-default-libstdcxx-abi={gcc4-compatible,new} |
34a2b755 JW |
4876 | dnl |
4877 | dnl Defines: | |
4878 | dnl _GLIBCXX_USE_CXX11_ABI (always defined, either to 1 or 0) | |
4879 | dnl | |
4880 | AC_DEFUN([GLIBCXX_DEFAULT_ABI], [ | |
4881 | if test x$enable_libstdcxx_dual_abi = xyes; then | |
4882 | AC_MSG_CHECKING([for default std::string ABI to use]) | |
4883 | AC_ARG_WITH([default-libstdcxx-abi], | |
4884 | AS_HELP_STRING([--with-default-libstdcxx-abi], | |
4885 | [set the std::string ABI to use by default]), | |
4886 | [case "$withval" in | |
10d712eb JW |
4887 | gcc4-compatible) default_libstdcxx_abi="gcc4-compatible" ;; |
4888 | new|cxx11) default_libstdcxx_abi="new" ;; | |
4889 | c++*|gnu++*) AC_MSG_ERROR([Supported arguments for --with-default-libstdcxx-abi have changed, use "new" or "gcc4-compatible"]) ;; | |
4890 | *) AC_MSG_ERROR([Invalid argument for --with-default-libstdcxx-abi]) ;; | |
4891 | esac | |
4892 | ], | |
4893 | [default_libstdcxx_abi="new"]) | |
34a2b755 JW |
4894 | AC_MSG_RESULT(${default_libstdcxx_abi}) |
4895 | fi | |
10d712eb | 4896 | if test $default_libstdcxx_abi = "new"; then |
34a2b755 JW |
4897 | glibcxx_cxx11_abi=1 |
4898 | glibcxx_cxx98_abi=0 | |
4899 | else | |
4900 | glibcxx_cxx11_abi=0 | |
4901 | glibcxx_cxx98_abi=1 | |
4902 | fi | |
4903 | AC_SUBST(glibcxx_cxx98_abi) | |
4904 | GLIBCXX_CONDITIONAL(ENABLE_CXX11_ABI, test $glibcxx_cxx11_abi = 1) | |
4905 | ]) | |
4906 | ||
0ca7ba9a JW |
4907 | dnl |
4908 | dnl Check to see whether to build libstdc++fs.a | |
4909 | dnl | |
4910 | dnl --enable-libstdcxx-filesystem-ts | |
4911 | dnl | |
4912 | AC_DEFUN([GLIBCXX_ENABLE_FILESYSTEM_TS], [ | |
4913 | GLIBCXX_ENABLE(libstdcxx-filesystem-ts,auto,, | |
4914 | [turns on ISO/IEC TS 18822 support], | |
4915 | [permit yes|no|auto]) | |
4916 | ||
4917 | AC_MSG_CHECKING([whether to build Filesystem TS support]) | |
bf53e6a9 JW |
4918 | if test x"$ac_cv_header_dirent_h" != x"yes"; then |
4919 | enable_libstdcxx_filesystem_ts=no | |
4920 | fi | |
0ca7ba9a JW |
4921 | if test x"$enable_libstdcxx_filesystem_ts" = x"auto"; then |
4922 | case "${target_os}" in | |
4923 | freebsd*|netbsd*|openbsd*|dragonfly*|darwin*) | |
4924 | enable_libstdcxx_filesystem_ts=yes | |
4925 | ;; | |
6508fa9c | 4926 | gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu | uclinux*) |
0ca7ba9a JW |
4927 | enable_libstdcxx_filesystem_ts=yes |
4928 | ;; | |
b76602dc SH |
4929 | rtems*) |
4930 | enable_libstdcxx_filesystem_ts=yes | |
4931 | ;; | |
0ca7ba9a | 4932 | solaris*) |
32ff3768 | 4933 | enable_libstdcxx_filesystem_ts=yes |
0ca7ba9a | 4934 | ;; |
f0cfae9f JW |
4935 | mingw*) |
4936 | enable_libstdcxx_filesystem_ts=yes | |
4937 | ;; | |
0ca7ba9a JW |
4938 | *) |
4939 | enable_libstdcxx_filesystem_ts=no | |
4940 | ;; | |
4941 | esac | |
4942 | fi | |
4943 | AC_MSG_RESULT($enable_libstdcxx_filesystem_ts) | |
4944 | GLIBCXX_CONDITIONAL(ENABLE_FILESYSTEM_TS, test $enable_libstdcxx_filesystem_ts = yes) | |
4945 | ]) | |
4946 | ||
4947 | dnl | |
90f7636b JW |
4948 | dnl Check whether the library calls required by the C++17 Filesystem library |
4949 | dnl and the Filesystem TS are present. | |
7314856c JW |
4950 | dnl Defines: |
4951 | dnl HAVE_STRUCT_DIRENT_D_TYPE | |
4952 | dnl _GLIBCXX_USE_REALPATH | |
4953 | dnl _GLIBCXX_USE_UTIMENSAT | |
4954 | dnl _GLIBCXX_USE_ST_MTIM | |
4955 | dnl _GLIBCXX_USE_FCHMOD | |
4956 | dnl _GLIBCXX_USE_FCHMODAT | |
d87caacf | 4957 | dnl _GLIBCXX_USE_COPY_FILE_RANGE |
7314856c JW |
4958 | dnl _GLIBCXX_USE_SENDFILE |
4959 | dnl HAVE_LINK | |
f80a8b42 | 4960 | dnl HAVE_LSEEK |
7314856c JW |
4961 | dnl HAVE_READLINK |
4962 | dnl HAVE_SYMLINK | |
0ca7ba9a JW |
4963 | dnl |
4964 | AC_DEFUN([GLIBCXX_CHECK_FILESYSTEM_DEPS], [dnl | |
4965 | dnl | |
90f7636b JW |
4966 | AC_LANG_SAVE |
4967 | AC_LANG_CPLUSPLUS | |
4968 | ac_save_CXXFLAGS="$CXXFLAGS" | |
4969 | CXXFLAGS="$CXXFLAGS -fno-exceptions" | |
0b9fc9fe | 4970 | dnl |
9646a322 | 4971 | AC_CACHE_CHECK([for struct dirent.d_type], glibcxx_cv_dirent_d_type, [dnl |
90f7636b JW |
4972 | GCC_TRY_COMPILE_OR_LINK( |
4973 | [#include <dirent.h>], | |
4974 | [ | |
4975 | struct dirent d; | |
4976 | if (sizeof d.d_type) return 0; | |
4977 | ], | |
4978 | [glibcxx_cv_dirent_d_type=yes], | |
4979 | [glibcxx_cv_dirent_d_type=no]) | |
4980 | ]) | |
4981 | if test $glibcxx_cv_dirent_d_type = yes; then | |
4982 | AC_DEFINE(HAVE_STRUCT_DIRENT_D_TYPE, 1, [Define to 1 if `d_type' is a member of `struct dirent'.]) | |
4983 | fi | |
0ca7ba9a | 4984 | dnl |
9646a322 | 4985 | AC_CACHE_CHECK([for realpath], glibcxx_cv_realpath, [dnl |
90f7636b JW |
4986 | GCC_TRY_COMPILE_OR_LINK( |
4987 | [ | |
4988 | #include <limits.h> | |
4989 | #include <stdlib.h> | |
4990 | #include <unistd.h> | |
4991 | ], | |
4992 | [ | |
4993 | #if _XOPEN_VERSION < 500 | |
4994 | #error | |
4995 | #elif _XOPEN_VERSION >= 700 || defined(PATH_MAX) | |
4996 | char *tmp = realpath((const char*)NULL, (char*)NULL); | |
4997 | #else | |
4998 | #error | |
4999 | #endif | |
5000 | ], | |
5001 | [glibcxx_cv_realpath=yes], | |
5002 | [glibcxx_cv_realpath=no]) | |
5003 | ]) | |
5004 | if test $glibcxx_cv_realpath = yes; then | |
5005 | AC_DEFINE(_GLIBCXX_USE_REALPATH, 1, [Define if usable realpath is available in <stdlib.h>.]) | |
5006 | fi | |
0ca7ba9a | 5007 | dnl |
9646a322 | 5008 | AC_CACHE_CHECK([for utimensat], glibcxx_cv_utimensat, [dnl |
90f7636b JW |
5009 | GCC_TRY_COMPILE_OR_LINK( |
5010 | [ | |
5011 | #include <fcntl.h> | |
5012 | #include <sys/stat.h> | |
5013 | ], | |
5014 | [ | |
5015 | struct timespec ts[2] = { { 0, UTIME_OMIT }, { 1, 1 } }; | |
5016 | int i = utimensat(AT_FDCWD, "path", ts, 0); | |
5017 | ], | |
5018 | [glibcxx_cv_utimensat=yes], | |
5019 | [glibcxx_cv_utimensat=no]) | |
5020 | ]) | |
5021 | if test $glibcxx_cv_utimensat = yes; then | |
5022 | AC_DEFINE(_GLIBCXX_USE_UTIMENSAT, 1, [Define if utimensat and UTIME_OMIT are available in <sys/stat.h> and AT_FDCWD in <fcntl.h>.]) | |
5023 | fi | |
de4db54f | 5024 | dnl |
9646a322 | 5025 | AC_CACHE_CHECK([for utime], glibcxx_cv_utime, [dnl |
90f7636b JW |
5026 | GCC_TRY_COMPILE_OR_LINK( |
5027 | [ | |
5028 | #include <utime.h> | |
5029 | ], | |
5030 | [ | |
5031 | struct utimbuf t = { 1, 1 }; | |
5032 | int i = utime("path", &t); | |
5033 | ], | |
5034 | [glibcxx_cv_utime=yes], | |
5035 | [glibcxx_cv_utime=no]) | |
5036 | ]) | |
5037 | if test $glibcxx_cv_utime = yes; then | |
5038 | AC_DEFINE(_GLIBCXX_USE_UTIME, 1, [Define if utime is available in <utime.h>.]) | |
5039 | fi | |
de4db54f | 5040 | dnl |
9646a322 | 5041 | AC_CACHE_CHECK([for lstat], glibcxx_cv_lstat, [dnl |
90f7636b JW |
5042 | GCC_TRY_COMPILE_OR_LINK( |
5043 | [ #include <sys/stat.h> ], | |
5044 | [ | |
5045 | struct stat st; | |
5046 | int i = lstat("path", &st); | |
5047 | ], | |
5048 | [glibcxx_cv_lstat=yes], | |
5049 | [glibcxx_cv_lstat=no]) | |
5050 | ]) | |
5051 | if test $glibcxx_cv_lstat = yes; then | |
5052 | AC_DEFINE(_GLIBCXX_USE_LSTAT, 1, [Define if lstat is available in <sys/stat.h>.]) | |
5053 | fi | |
0ca7ba9a | 5054 | dnl |
9646a322 JW |
5055 | AC_CACHE_CHECK([for struct stat.st_mtim.tv_nsec], |
5056 | glibcxx_cv_st_mtim, [dnl | |
90f7636b JW |
5057 | GCC_TRY_COMPILE_OR_LINK( |
5058 | [ #include <sys/stat.h> ], | |
5059 | [ | |
5060 | struct stat st; | |
5061 | return st.st_mtim.tv_nsec; | |
5062 | ], | |
5063 | [glibcxx_cv_st_mtim=yes], | |
5064 | [glibcxx_cv_st_mtim=no]) | |
5065 | ]) | |
5066 | if test $glibcxx_cv_st_mtim = yes; then | |
5067 | AC_DEFINE(_GLIBCXX_USE_ST_MTIM, 1, [Define if struct stat has timespec members.]) | |
5068 | fi | |
a0c4531c | 5069 | dnl |
9646a322 JW |
5070 | AC_CACHE_CHECK([for fchmod], |
5071 | glibcxx_cv_fchmod, [dnl | |
90f7636b JW |
5072 | GCC_TRY_COMPILE_OR_LINK( |
5073 | [#include <sys/stat.h>], | |
5074 | [fchmod(1, S_IWUSR);], | |
5075 | [glibcxx_cv_fchmod=yes], | |
5076 | [glibcxx_cv_fchmod=no]) | |
5077 | ]) | |
5078 | if test $glibcxx_cv_fchmod = yes; then | |
5079 | AC_DEFINE(_GLIBCXX_USE_FCHMOD, 1, [Define if fchmod is available in <sys/stat.h>.]) | |
5080 | fi | |
bf53e6a9 | 5081 | dnl |
9646a322 JW |
5082 | AC_CACHE_CHECK([for fchmodat], |
5083 | glibcxx_cv_fchmodat, [dnl | |
90f7636b JW |
5084 | GCC_TRY_COMPILE_OR_LINK( |
5085 | [ | |
5086 | #include <fcntl.h> | |
5087 | #include <sys/stat.h> | |
5088 | ], | |
5089 | [fchmodat(AT_FDCWD, "", 0, AT_SYMLINK_NOFOLLOW);], | |
5090 | [glibcxx_cv_fchmodat=yes], | |
5091 | [glibcxx_cv_fchmodat=no]) | |
5092 | ]) | |
5093 | if test $glibcxx_cv_fchmodat = yes; then | |
5094 | AC_DEFINE(_GLIBCXX_USE_FCHMODAT, 1, [Define if fchmodat is available in <sys/stat.h>.]) | |
5095 | fi | |
0ca7ba9a | 5096 | dnl |
9646a322 JW |
5097 | AC_CACHE_CHECK([for link], |
5098 | glibcxx_cv_link, [dnl | |
90f7636b JW |
5099 | GCC_TRY_COMPILE_OR_LINK( |
5100 | [#include <unistd.h>], | |
5101 | [link("", "");], | |
5102 | [glibcxx_cv_link=yes], | |
5103 | [glibcxx_cv_link=no]) | |
5104 | ]) | |
5105 | if test $glibcxx_cv_link = yes; then | |
5106 | AC_DEFINE(HAVE_LINK, 1, [Define if link is available in <unistd.h>.]) | |
5107 | fi | |
f80a8b42 JG |
5108 | dnl |
5109 | AC_CACHE_CHECK([for lseek], | |
5110 | glibcxx_cv_lseek, [dnl | |
5111 | GCC_TRY_COMPILE_OR_LINK( | |
5112 | [#include <unistd.h>], | |
5113 | [lseek(1, 0, SEEK_SET);], | |
5114 | [glibcxx_cv_lseek=yes], | |
5115 | [glibcxx_cv_lseek=no]) | |
5116 | ]) | |
5117 | if test $glibcxx_cv_lseek = yes; then | |
5118 | AC_DEFINE(HAVE_LSEEK, 1, [Define if lseek is available in <unistd.h>.]) | |
5119 | fi | |
7314856c | 5120 | dnl |
9646a322 JW |
5121 | AC_CACHE_CHECK([for readlink], |
5122 | glibcxx_cv_readlink, [dnl | |
90f7636b JW |
5123 | GCC_TRY_COMPILE_OR_LINK( |
5124 | [#include <unistd.h>], | |
5125 | [char buf[32]; readlink("", buf, sizeof(buf));], | |
5126 | [glibcxx_cv_readlink=yes], | |
5127 | [glibcxx_cv_readlink=no]) | |
5128 | ]) | |
5129 | if test $glibcxx_cv_readlink = yes; then | |
5130 | AC_DEFINE(HAVE_READLINK, 1, [Define if readlink is available in <unistd.h>.]) | |
5131 | fi | |
cf4b581f | 5132 | dnl |
9646a322 JW |
5133 | AC_CACHE_CHECK([for symlink], |
5134 | glibcxx_cv_symlink, [dnl | |
90f7636b JW |
5135 | GCC_TRY_COMPILE_OR_LINK( |
5136 | [#include <unistd.h>], | |
5137 | [symlink("", "");], | |
5138 | [glibcxx_cv_symlink=yes], | |
5139 | [glibcxx_cv_symlink=no]) | |
5140 | ]) | |
5141 | if test $glibcxx_cv_symlink = yes; then | |
5142 | AC_DEFINE(HAVE_SYMLINK, 1, [Define if symlink is available in <unistd.h>.]) | |
5143 | fi | |
7314856c | 5144 | dnl |
9646a322 JW |
5145 | AC_CACHE_CHECK([for truncate], |
5146 | glibcxx_cv_truncate, [dnl | |
90f7636b JW |
5147 | GCC_TRY_COMPILE_OR_LINK( |
5148 | [#include <unistd.h>], | |
5149 | [truncate("", 99);], | |
5150 | [glibcxx_cv_truncate=yes], | |
5151 | [glibcxx_cv_truncate=no]) | |
5152 | ]) | |
5153 | if test $glibcxx_cv_truncate = yes; then | |
5154 | AC_DEFINE(HAVE_TRUNCATE, 1, [Define if truncate is available in <unistd.h>.]) | |
7314856c | 5155 | fi |
d87caacf JG |
5156 | dnl |
5157 | AC_CACHE_CHECK([for copy_file_range that can copy files], | |
5158 | glibcxx_cv_copy_file_range, [dnl | |
5159 | case "${target_os}" in | |
5160 | linux*) | |
5161 | GCC_TRY_COMPILE_OR_LINK( | |
5162 | [#include <unistd.h>], | |
ff29ee6a | 5163 | [copy_file_range(1, (loff_t*)nullptr, 2, (loff_t*)nullptr, 1, 0);], |
d87caacf JG |
5164 | [glibcxx_cv_copy_file_range=yes], |
5165 | [glibcxx_cv_copy_file_range=no]) | |
5166 | ;; | |
5167 | *) | |
5168 | glibcxx_cv_copy_file_range=no | |
5169 | ;; | |
5170 | esac | |
5171 | ]) | |
5172 | if test $glibcxx_cv_copy_file_range = yes; then | |
5173 | AC_DEFINE(_GLIBCXX_USE_COPY_FILE_RANGE, 1, [Define if copy_file_range is available in <unistd.h>.]) | |
5174 | fi | |
f80a8b42 JG |
5175 | dnl |
5176 | AC_CACHE_CHECK([for sendfile that can copy files], | |
5177 | glibcxx_cv_sendfile, [dnl | |
5178 | case "${target_os}" in | |
5179 | gnu* | linux* | solaris* | uclinux*) | |
5180 | GCC_TRY_COMPILE_OR_LINK( | |
5181 | [#include <sys/sendfile.h>], | |
5182 | [sendfile(1, 2, (off_t*)0, sizeof 1);], | |
5183 | [glibcxx_cv_sendfile=yes], | |
5184 | [glibcxx_cv_sendfile=no]) | |
5185 | ;; | |
5186 | *) | |
5187 | glibcxx_cv_sendfile=no | |
5188 | ;; | |
5189 | esac | |
5190 | ]) | |
5191 | if test $glibcxx_cv_sendfile = yes && test $glibcxx_cv_lseek = yes; then | |
5192 | AC_DEFINE(_GLIBCXX_USE_SENDFILE, 1, [Define if sendfile is available in <sys/sendfile.h>.]) | |
5193 | fi | |
c8bd4dc8 JW |
5194 | dnl |
5195 | AC_CACHE_CHECK([for fdopendir], | |
5196 | glibcxx_cv_fdopendir, [dnl | |
5197 | GCC_TRY_COMPILE_OR_LINK( | |
5198 | [#include <dirent.h>], | |
ebf61754 | 5199 | [::DIR* dir = ::fdopendir(1);], |
c8bd4dc8 JW |
5200 | [glibcxx_cv_fdopendir=yes], |
5201 | [glibcxx_cv_fdopendir=no]) | |
5202 | ]) | |
14f33989 | 5203 | if test $glibcxx_cv_fdopendir = yes; then |
c8bd4dc8 JW |
5204 | AC_DEFINE(HAVE_FDOPENDIR, 1, [Define if fdopendir is available in <dirent.h>.]) |
5205 | fi | |
ebf61754 JW |
5206 | dnl |
5207 | AC_CACHE_CHECK([for dirfd], | |
5208 | glibcxx_cv_dirfd, [dnl | |
5209 | GCC_TRY_COMPILE_OR_LINK( | |
5210 | [#include <dirent.h>], | |
5211 | [int fd = ::dirfd((::DIR*)0);], | |
5212 | [glibcxx_cv_dirfd=yes], | |
5213 | [glibcxx_cv_dirfd=no]) | |
5214 | ]) | |
5215 | if test $glibcxx_cv_dirfd = yes; then | |
5216 | AC_DEFINE(HAVE_DIRFD, 1, [Define if dirfd is available in <dirent.h>.]) | |
5217 | fi | |
93070671 AO |
5218 | dnl |
5219 | AC_CACHE_CHECK([for openat], | |
5220 | glibcxx_cv_openat, [dnl | |
5221 | GCC_TRY_COMPILE_OR_LINK( | |
5222 | [#include <fcntl.h>], | |
5223 | [int fd = ::openat(AT_FDCWD, "", 0);], | |
5224 | [glibcxx_cv_openat=yes], | |
5225 | [glibcxx_cv_openat=no]) | |
5226 | ]) | |
5227 | if test $glibcxx_cv_openat = yes; then | |
5228 | AC_DEFINE(HAVE_OPENAT, 1, [Define if openat is available in <fcntl.h>.]) | |
5229 | fi | |
ebf61754 JW |
5230 | dnl |
5231 | AC_CACHE_CHECK([for unlinkat], | |
5232 | glibcxx_cv_unlinkat, [dnl | |
5233 | GCC_TRY_COMPILE_OR_LINK( | |
5234 | [#include <fcntl.h> | |
5235 | #include <unistd.h>], | |
5236 | [::unlinkat(AT_FDCWD, "", AT_REMOVEDIR);], | |
5237 | [glibcxx_cv_unlinkat=yes], | |
5238 | [glibcxx_cv_unlinkat=no]) | |
5239 | ]) | |
5240 | if test $glibcxx_cv_unlinkat = yes; then | |
5241 | AC_DEFINE(HAVE_UNLINKAT, 1, [Define if unlinkat is available in <fcntl.h>.]) | |
5242 | fi | |
90f7636b JW |
5243 | dnl |
5244 | CXXFLAGS="$ac_save_CXXFLAGS" | |
5245 | AC_LANG_RESTORE | |
0ca7ba9a | 5246 | ]) |
34a2b755 | 5247 | |
a04d5fc9 TR |
5248 | dnl |
5249 | dnl Check how size_t is mangled. Copied from libitm. | |
5250 | dnl | |
5251 | AC_DEFUN([GLIBCXX_CHECK_SIZE_T_MANGLING], [ | |
5252 | AC_CACHE_CHECK([how size_t is mangled], | |
5253 | glibcxx_cv_size_t_mangling, [ | |
5254 | AC_TRY_COMPILE([], [extern __SIZE_TYPE__ x; extern unsigned long x;], | |
5255 | [glibcxx_cv_size_t_mangling=m], [ | |
5256 | AC_TRY_COMPILE([], [extern __SIZE_TYPE__ x; extern unsigned int x;], | |
5257 | [glibcxx_cv_size_t_mangling=j], [ | |
5258 | AC_TRY_COMPILE([], | |
5259 | [extern __SIZE_TYPE__ x; extern unsigned long long x;], | |
5260 | [glibcxx_cv_size_t_mangling=y], [ | |
5261 | AC_TRY_COMPILE([], | |
5262 | [extern __SIZE_TYPE__ x; extern unsigned short x;], | |
f14d2c52 JS |
5263 | [glibcxx_cv_size_t_mangling=t], [ |
5264 | AC_TRY_COMPILE([], | |
5265 | [extern __SIZE_TYPE__ x; extern __int20 unsigned x;], | |
5266 | [glibcxx_cv_size_t_mangling=u6uint20], | |
5267 | [glibcxx_cv_size_t_mangling=x]) | |
5268 | ]) | |
a04d5fc9 TR |
5269 | ]) |
5270 | ]) | |
5271 | ]) | |
5272 | ]) | |
5273 | if test $glibcxx_cv_size_t_mangling = x; then | |
5274 | AC_MSG_ERROR([Unknown underlying type for size_t]) | |
5275 | fi | |
5276 | AC_DEFINE_UNQUOTED(_GLIBCXX_MANGLE_SIZE_T, [$glibcxx_cv_size_t_mangling], | |
5277 | [Define to the letter to which size_t is mangled.]) | |
5278 | ]) | |
5279 | ||
ed3cb497 PN |
5280 | dnl |
5281 | dnl Determine whether std::exception_ptr symbols should be exported with | |
5282 | dnl the symbol versions from GCC 4.6.0 or GCC 7.1.0, depending on which | |
5283 | dnl release first added support for std::exception_ptr. Originally it was | |
5284 | dnl only supported for targets with always-lock-free atomics for int, but | |
5285 | dnl since GCC 7.1 it is supported for all targets. | |
5286 | dnl | |
5287 | AC_DEFUN([GLIBCXX_CHECK_EXCEPTION_PTR_SYMVER], [ | |
5288 | if test $enable_symvers != no; then | |
5289 | AC_MSG_CHECKING([for first version to support std::exception_ptr]) | |
5290 | case ${target} in | |
5291 | aarch64-*-* | alpha-*-* | hppa*-*-* | i?86-*-* | x86_64-*-* | \ | |
5292 | m68k-*-* | powerpc*-*-* | s390*-*-* | *-*-solaris* ) | |
5293 | ac_exception_ptr_since_gcc46=yes | |
5294 | ;; | |
5295 | *) | |
5296 | # If the value of this macro changes then we will need to hardcode | |
5297 | # yes/no here for additional targets based on the original value. | |
5298 | AC_TRY_COMPILE([], [ | |
5299 | #if __GCC_ATOMIC_INT_LOCK_FREE <= 1 | |
5300 | # error atomic int not always lock free | |
5301 | #endif | |
5302 | ], | |
5303 | [ac_exception_ptr_since_gcc46=yes], | |
5304 | [ac_exception_ptr_since_gcc46=no]) | |
5305 | ;; | |
5306 | esac | |
5307 | if test x"$ac_exception_ptr_since_gcc46" = x"yes" ; then | |
5308 | AC_DEFINE(HAVE_EXCEPTION_PTR_SINCE_GCC46, 1, | |
5309 | [Define to 1 if GCC 4.6 supported std::exception_ptr for the target]) | |
5310 | AC_MSG_RESULT([4.6.0]) | |
5311 | else | |
5312 | AC_MSG_RESULT([7.1.0]) | |
5313 | fi | |
5314 | fi | |
5315 | ]) | |
5316 | ||
3439657b JW |
5317 | dnl |
5318 | dnl Check whether getentropy is present in <unistd.h>. | |
5319 | dnl | |
5320 | AC_DEFUN([GLIBCXX_CHECK_GETENTROPY], [ | |
5321 | ||
5322 | AC_LANG_SAVE | |
5323 | AC_LANG_CPLUSPLUS | |
9646a322 | 5324 | AC_CACHE_CHECK([for getentropy], glibcxx_cv_getentropy, [ |
60f761c7 | 5325 | GCC_TRY_COMPILE_OR_LINK( |
3439657b JW |
5326 | [#include <unistd.h>], |
5327 | [unsigned i; | |
5328 | ::getentropy(&i, sizeof(i));], | |
5329 | [glibcxx_cv_getentropy=yes], [glibcxx_cv_getentropy=no]) | |
5330 | ]) | |
5331 | ||
5332 | if test $glibcxx_cv_getentropy = yes; then | |
5333 | AC_DEFINE(HAVE_GETENTROPY, 1, [Define if getentropy is available in <unistd.h>.]) | |
5334 | fi | |
3439657b JW |
5335 | AC_LANG_RESTORE |
5336 | ]) | |
5337 | ||
5338 | dnl | |
5339 | dnl Check whether arc4random is present in <stdlib.h>. | |
5340 | dnl | |
5341 | AC_DEFUN([GLIBCXX_CHECK_ARC4RANDOM], [ | |
5342 | ||
5343 | AC_LANG_SAVE | |
5344 | AC_LANG_CPLUSPLUS | |
9646a322 | 5345 | AC_CACHE_CHECK([for arc4random], glibcxx_cv_arc4random, [ |
60f761c7 | 5346 | GCC_TRY_COMPILE_OR_LINK( |
3439657b JW |
5347 | [#include <stdlib.h>], |
5348 | [unsigned i = ::arc4random();], | |
5349 | [glibcxx_cv_arc4random=yes], [glibcxx_cv_arc4random=no]) | |
5350 | ]) | |
5351 | ||
5352 | if test $glibcxx_cv_arc4random = yes; then | |
5353 | AC_DEFINE(HAVE_ARC4RANDOM, 1, [Define if arc4random is available in <stdlib.h>.]) | |
5354 | fi | |
3439657b JW |
5355 | AC_LANG_RESTORE |
5356 | ]) | |
5357 | ||
3acb929c JW |
5358 | dnl |
5359 | dnl Check to see whether to build libstdc++_libbacktrace.a | |
5360 | dnl | |
5361 | dnl --enable-libstdcxx-backtrace | |
5362 | dnl | |
5363 | AC_DEFUN([GLIBCXX_ENABLE_BACKTRACE], [ | |
5364 | GLIBCXX_ENABLE(libstdcxx-backtrace,auto,, | |
5365 | [turns on libbacktrace support], | |
5366 | [permit yes|no|auto]) | |
5367 | ||
5368 | # Most of this is adapted from libsanitizer/configure.ac | |
5369 | ||
5370 | BACKTRACE_CPPFLAGS= | |
5371 | ||
5372 | # libbacktrace only needs atomics for int, which we've already tested | |
5373 | if test "$glibcxx_cv_atomic_int" = "yes"; then | |
5374 | BACKTRACE_CPPFLAGS="$BACKTRACE_CPPFLAGS -DHAVE_ATOMIC_FUNCTIONS=1" | |
5375 | fi | |
5376 | ||
5377 | # Test for __sync support. | |
5378 | AC_CACHE_CHECK([__sync extensions], | |
5379 | [glibcxx_cv_sys_sync], | |
5380 | [GCC_TRY_COMPILE_OR_LINK( | |
5381 | [int i;], | |
5382 | [__sync_bool_compare_and_swap (&i, i, i); | |
5383 | __sync_lock_test_and_set (&i, 1); | |
5384 | __sync_lock_release (&i);], | |
5385 | [glibcxx_cv_sys_sync=yes], | |
5386 | [glibcxx_cv_sys_sync=no]) | |
5387 | ]) | |
5388 | if test "$glibcxx_cv_sys_sync" = "yes"; then | |
5389 | BACKTRACE_CPPFLAGS="$BACKTRACE_CPPFLAGS -DHAVE_SYNC_FUNCTIONS=1" | |
5390 | fi | |
5391 | ||
5392 | # Check for dl_iterate_phdr. | |
5393 | AC_CHECK_HEADERS(link.h) | |
5394 | if test "$ac_cv_header_link_h" = "no"; then | |
5395 | have_dl_iterate_phdr=no | |
5396 | else | |
5397 | # When built as a GCC target library, we can't do a link test. | |
5398 | AC_EGREP_HEADER([dl_iterate_phdr], [link.h], [have_dl_iterate_phdr=yes], | |
5399 | [have_dl_iterate_phdr=no]) | |
5400 | fi | |
5401 | if test "$have_dl_iterate_phdr" = "yes"; then | |
5402 | BACKTRACE_CPPFLAGS="$BACKTRACE_CPPFLAGS -DHAVE_DL_ITERATE_PHDR=1" | |
5403 | fi | |
523e8716 | 5404 | AC_CHECK_HEADERS(windows.h) |
3acb929c JW |
5405 | |
5406 | # Check for the fcntl function. | |
5407 | if test -n "${with_target_subdir}"; then | |
5408 | case "${host}" in | |
5409 | *-*-mingw*) have_fcntl=no ;; | |
5410 | *) have_fcntl=yes ;; | |
5411 | esac | |
5412 | else | |
5413 | AC_CHECK_FUNC(fcntl, [have_fcntl=yes], [have_fcntl=no]) | |
5414 | fi | |
5415 | if test "$have_fcntl" = "yes"; then | |
5416 | BACKTRACE_CPPFLAGS="$BACKTRACE_CPPFLAGS -DHAVE_FCNTL=1" | |
5417 | fi | |
5418 | ||
5419 | AC_CHECK_DECLS(strnlen) | |
5420 | ||
5421 | # Check for getexecname function. | |
5422 | if test -n "${with_target_subdir}"; then | |
5423 | case "${host}" in | |
5424 | *-*-solaris2*) have_getexecname=yes ;; | |
5425 | *) have_getexecname=no ;; | |
5426 | esac | |
5427 | else | |
5428 | AC_CHECK_FUNC(getexecname, [have_getexecname=yes], [have_getexecname=no]) | |
5429 | fi | |
5430 | if test "$have_getexecname" = "yes"; then | |
5431 | BACKTRACE_CPPFLAGS="$BACKTRACE_CPPFLAGS -DHAVE_GETEXECNAME=1" | |
5432 | fi | |
5433 | ||
5434 | # The library needs to be able to read the executable itself. Compile | |
5435 | # a file to determine the executable format. The awk script | |
5436 | # filetype.awk prints out the file type. | |
5437 | AC_CACHE_CHECK([output filetype], | |
5438 | [glibcxx_cv_sys_filetype], | |
5439 | [filetype= | |
5440 | AC_COMPILE_IFELSE( | |
5441 | [AC_LANG_PROGRAM([int i;], [int j;])], | |
5442 | [filetype=`${AWK} -f $srcdir/../libbacktrace/filetype.awk conftest.$ac_objext`], | |
5443 | [AC_MSG_FAILURE([compiler failed])]) | |
5444 | glibcxx_cv_sys_filetype=$filetype]) | |
5445 | ||
5446 | # Match the file type to decide what files to compile. | |
5447 | FORMAT_FILE= | |
5448 | case "$glibcxx_cv_sys_filetype" in | |
5449 | elf*) FORMAT_FILE="elf.lo" ;; | |
523e8716 | 5450 | pecoff*) FORMAT_FILE="pecoff.lo" ;; |
3acb929c JW |
5451 | *) AC_MSG_WARN([could not determine output file type]) |
5452 | FORMAT_FILE="unknown.lo" | |
5453 | enable_libstdcxx_backtrace=no | |
5454 | ;; | |
5455 | esac | |
5456 | AC_SUBST(FORMAT_FILE) | |
5457 | ||
5458 | # ELF defines. | |
5459 | elfsize= | |
5460 | case "$glibcxx_cv_sys_filetype" in | |
5461 | elf32) elfsize=32 ;; | |
5462 | elf64) elfsize=64 ;; | |
5463 | esac | |
5464 | BACKTRACE_CPPFLAGS="$BACKTRACE_CPPFLAGS -DBACKTRACE_ELF_SIZE=$elfsize" | |
5465 | ||
3acb929c | 5466 | AC_MSG_CHECKING([whether to build libbacktrace support]) |
a2a7da1a | 5467 | if test "$enable_libstdcxx_backtrace" = "auto"; then |
3acb929c JW |
5468 | enable_libstdcxx_backtrace=no |
5469 | fi | |
7b648e83 | 5470 | AC_MSG_RESULT($enable_libstdcxx_backtrace) |
a2a7da1a | 5471 | if test "$enable_libstdcxx_backtrace" = "yes"; then |
3acb929c | 5472 | BACKTRACE_SUPPORTED=1 |
3c742621 JW |
5473 | |
5474 | AC_CHECK_HEADERS(sys/mman.h) | |
5475 | case "${host}" in | |
5476 | *-*-msdosdjgpp) # DJGPP has sys/man.h, but no mmap | |
5477 | have_mmap=no ;; | |
5478 | *-*-*) | |
5479 | have_mmap="$ac_cv_header_sys_mman_h" ;; | |
5480 | esac | |
5481 | ||
5482 | if test "$have_mmap" = "no"; then | |
5483 | VIEW_FILE=read.lo | |
5484 | ALLOC_FILE=alloc.lo | |
5485 | else | |
5486 | VIEW_FILE=mmapio.lo | |
5487 | AC_PREPROC_IFELSE([AC_LANG_SOURCE([ | |
5488 | #include <sys/mman.h> | |
5489 | #if !defined(MAP_ANONYMOUS) && !defined(MAP_ANON) | |
5490 | #error no MAP_ANONYMOUS | |
5491 | #endif | |
5492 | ])], [ALLOC_FILE=mmap.lo], [ALLOC_FILE=alloc.lo]) | |
5493 | fi | |
5494 | AC_SUBST(VIEW_FILE) | |
5495 | AC_SUBST(ALLOC_FILE) | |
5496 | ||
5497 | BACKTRACE_USES_MALLOC=0 | |
5498 | if test "$ALLOC_FILE" = "alloc.lo"; then | |
5499 | BACKTRACE_USES_MALLOC=1 | |
5500 | fi | |
5501 | ||
3acb929c JW |
5502 | if test "$ac_has_gthreads" = "yes"; then |
5503 | BACKTRACE_SUPPORTS_THREADS=1 | |
5504 | else | |
5505 | BACKTRACE_SUPPORTS_THREADS=0 | |
5506 | fi | |
5507 | AC_SUBST(BACKTRACE_CPPFLAGS) | |
5508 | AC_SUBST(BACKTRACE_SUPPORTED) | |
5509 | AC_SUBST(BACKTRACE_USES_MALLOC) | |
5510 | AC_SUBST(BACKTRACE_SUPPORTS_THREADS) | |
5511 | AC_DEFINE(HAVE_STACKTRACE, 1, [Define if the <stacktrace> header is supported.]) | |
5512 | else | |
5513 | BACKTRACE_SUPPORTED=0 | |
5514 | BACKTRACE_USES_MALLOC=0 | |
5515 | BACKTRACE_SUPPORTS_THREADS=0 | |
5516 | fi | |
a2a7da1a | 5517 | GLIBCXX_CONDITIONAL(ENABLE_BACKTRACE, [test "$enable_libstdcxx_backtrace" = yes]) |
3acb929c | 5518 | ]) |
3439657b | 5519 | |
637e3668 JW |
5520 | dnl |
5521 | dnl Allow the emergency EH pool to be configured. | |
5522 | dnl | |
5523 | dnl --enable-libstdcxx-static-eh-pool will cause a fixed-size static buffer | |
5524 | dnl to be used for allocating exceptions after malloc fails. The default is | |
5525 | dnl to allocate a buffer using malloc | |
5526 | dnl | |
5527 | dnl --with-libstdcxx-eh-pool-obj-count=N will set the default size for the | |
5528 | dnl buffer. For a static buffer that size is fixed permanently. For a dynamic | |
5529 | dnl buffer it's the default, but it can be overridden from the environment. | |
5530 | dnl | |
5531 | dnl To set the default to approximately the same values as GCC 12, | |
5532 | dnl use --with-libstdcxx-eh-pool-obj-count=94 for 32-bit targets, | |
5533 | dnl and --with-libstdcxx-eh-pool-obj-count=252 for 64-bit targets. | |
5534 | dnl | |
5535 | dnl Defines: | |
5536 | dnl _GLIBCXX_EH_POOL_STATIC if a fixed-size static buffer should be used | |
5537 | dnl instead of allocating a buffer on startup. | |
5538 | dnl _GLIBCXX_EH_POOL_NOBJS to override the default EMERGENCY_OBJ_COUNT value. | |
5539 | dnl | |
5540 | AC_DEFUN([GLIBCXX_EMERGENCY_EH_ALLOC], [ | |
5541 | eh_pool_static= | |
5542 | eh_pool_nobjs= | |
5543 | AC_ARG_ENABLE([libstdcxx-static-eh-pool], | |
5544 | AC_HELP_STRING([--enable-libstdcxx-static-eh-pool], | |
5545 | [use a fixed-size static buffer for allocating exceptions if malloc fails]), | |
5546 | [if test "${enableval}" = yes; then | |
5547 | eh_pool_static="-D_GLIBCXX_EH_POOL_STATIC" | |
5548 | AC_MSG_NOTICE([EH pool using static buffer]) | |
5549 | fi],) | |
5550 | ||
5551 | AC_ARG_WITH([libstdcxx-eh-pool-obj-count], | |
5552 | AC_HELP_STRING([--with-libstdcxx-eh-pool-obj-count], | |
5553 | [the number of exceptions that can be allocated from the pool if malloc fails]), | |
5554 | [if test "${withval}" -ge 0 2>/dev/null; then | |
5555 | eh_pool_obj_count="-D_GLIBCXX_EH_POOL_NOBJS=${withval}" | |
5556 | AC_MSG_NOTICE([EH pool object count: ${withval}]) | |
5557 | else | |
5558 | AC_MSG_ERROR([EH pool obj count must be a non-negative integer: $withval]) | |
5559 | fi],) | |
5560 | ||
5561 | EH_POOL_FLAGS="$eh_pool_static $eh_pool_obj_count" | |
5562 | AC_SUBST(EH_POOL_FLAGS) | |
5563 | ]) | |
5564 | ||
9fc61d45 JW |
5565 | dnl |
5566 | dnl Allow the location of tzdata files to be configured. | |
5567 | dnl | |
559993b8 JW |
5568 | dnl --with-libstdcxx-zoneinfo=ARG where ARG can be: |
5569 | dnl DIR - use DIR/tzdata.zi and DIR/leapseconds files. | |
5570 | dnl static - use static copy of tzdata.zi embedded in the library. | |
5571 | dnl DIR,static - use DIR, but use embedded static copy as fallback. | |
5572 | dnl yes - equivalent to DIR,static with a system-specific value for DIR. | |
5573 | dnl no - disable most tzdb functionality. | |
9fc61d45 JW |
5574 | dnl |
5575 | dnl Defines: | |
559993b8 | 5576 | dnl _GLIBCXX_ZONEINFO_DIR if std::chrono::tzdb should use the specified |
9fc61d45 | 5577 | dnl directory for the tzdata.zi and leapseconds files. |
559993b8 JW |
5578 | dnl _GLIBCXX_STATIC_TZDATA if std::chrono::tzdb should use an embedded |
5579 | dnl static copy of the tzdata.zi file. | |
9fc61d45 JW |
5580 | dnl |
5581 | AC_DEFUN([GLIBCXX_ZONEINFO_DIR], [ | |
559993b8 JW |
5582 | AC_ARG_WITH([libstdcxx-zoneinfo], |
5583 | AC_HELP_STRING([--with-libstdcxx-zoneinfo], | |
5584 | [the location to use for tzdata]), | |
5585 | [],[with_libstdcxx_zoneinfo=yes]) | |
5586 | ||
5587 | if test "x${with_libstdcxx_zoneinfo}" = xyes; then | |
5588 | # Pick a default when no specific path is set. | |
d74d84c6 | 5589 | case "$target_os" in |
559993b8 JW |
5590 | gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu) |
5591 | # Not all distros ship tzdata.zi in this dir. | |
5592 | zoneinfo_dir="/usr/share/zoneinfo" | |
5593 | ;; | |
d74d84c6 | 5594 | aix*) |
559993b8 JW |
5595 | # Binary tzfile files are in /usr/share/lib/zoneinfo |
5596 | # but tzdata.zi is not present there. | |
5597 | zoneinfo_dir=none | |
5598 | ;; | |
d74d84c6 | 5599 | darwin2*) |
559993b8 JW |
5600 | # Binary tzfile files are in /usr/share/lib/zoneinfo.default |
5601 | # but tzdata.zi is not present there. | |
5602 | zoneinfo_dir=none | |
5603 | ;; | |
5604 | *) | |
5605 | # Binary tzfile files are commonly found in /usr/share/zoneinfo | |
5606 | # but tzdata.zi is not present there. | |
5607 | zoneinfo_dir=none | |
5608 | ;; | |
9fc61d45 | 5609 | esac |
51cf0b39 | 5610 | |
2a919c08 | 5611 | AC_COMPUTE_INT(glibcxx_cv_at_least_32bit, [__INTPTR_WIDTH__ >= 32]) |
51cf0b39 JW |
5612 | if test "$glibcxx_cv_at_least_32bit" -ne 0; then |
5613 | # Also embed a copy of the tzdata.zi file as a static string. | |
5614 | embed_zoneinfo=yes | |
5615 | else | |
5616 | # The embedded data is too large for 16-bit targets. | |
5617 | embed_zoneinfo=no | |
5618 | fi | |
559993b8 JW |
5619 | elif test "x${with_libstdcxx_zoneinfo}" = xno; then |
5620 | # Disable tzdb support completely. | |
5621 | zoneinfo_dir=none | |
5622 | embed_zoneinfo=no | |
5623 | else | |
5624 | case "${with_libstdcxx_zoneinfo}" in | |
5625 | static) | |
5626 | # Do not attempt to read from disk, always use embedded data. | |
5627 | zoneinfo_dir=none | |
5628 | embed_zoneinfo=yes | |
5629 | ;; | |
5630 | static,* | *,static) | |
5631 | # Try to read from disk, use embedded data as fallback. | |
5632 | zoneinfo_dir="${with_libstdcxx_zoneinfo#static,}" | |
5633 | zoneinfo_dir="${with_libstdcxx_zoneinfo%,static}" | |
5634 | embed_zoneinfo=yes | |
5635 | ;; | |
5636 | *) | |
5637 | zoneinfo_dir="${with_libstdcxx_zoneinfo}" | |
5638 | embed_zoneinfo=no | |
5639 | ;; | |
5640 | esac | |
5641 | fi | |
9fc61d45 | 5642 | AC_MSG_NOTICE([zoneinfo data directory: ${zoneinfo_dir}]) |
559993b8 JW |
5643 | if test "x${zoneinfo_dir}" != xnone; then |
5644 | AC_DEFINE_UNQUOTED(_GLIBCXX_ZONEINFO_DIR, "${zoneinfo_dir}", | |
5645 | [Define if a directory should be searched for tzdata files.]) | |
d74d84c6 | 5646 | if $GLIBCXX_IS_NATIVE && ! test -f "$zoneinfo_dir/tzdata.zi"; then |
559993b8 JW |
5647 | AC_MSG_WARN("$zoneinfo_dir does not contain tzdata.zi file") |
5648 | fi | |
5649 | fi | |
5650 | GLIBCXX_CONDITIONAL(USE_STATIC_TZDATA, test "${embed_zoneinfo}" = yes) | |
5651 | if test "x${embed_zoneinfo}" = xyes; then | |
5652 | AC_MSG_NOTICE([static tzdata.zi file will be compiled into the library]) | |
5653 | AC_DEFINE_UNQUOTED(_GLIBCXX_STATIC_TZDATA, 1, | |
5654 | [Define if static tzdata should be compiled into the library.]) | |
5655 | fi | |
9fc61d45 JW |
5656 | ]) |
5657 | ||
94a311ab JW |
5658 | dnl |
5659 | dnl Check whether lock tables can be aligned to avoid false sharing. | |
5660 | dnl | |
5661 | dnl Defines: | |
5662 | dnl _GLIBCXX_CAN_ALIGNAS_DESTRUCTIVE_SIZE if objects with static storage | |
5663 | dnl duration can be aligned to std::hardware_destructive_interference_size. | |
5664 | dnl | |
5665 | AC_DEFUN([GLIBCXX_CHECK_ALIGNAS_CACHELINE], [ | |
5666 | AC_LANG_SAVE | |
5667 | AC_LANG_CPLUSPLUS | |
5668 | ||
5669 | AC_MSG_CHECKING([whether static objects can be aligned to the cacheline size]) | |
5670 | AC_TRY_COMPILE(, [struct alignas(__GCC_DESTRUCTIVE_SIZE) Aligned { }; | |
5671 | alignas(Aligned) static char buf[sizeof(Aligned) * 16]; | |
5672 | ], [ac_alignas_cacheline=yes], [ac_alignas_cacheline=no]) | |
5673 | if test "$ac_alignas_cacheline" = yes; then | |
5674 | AC_DEFINE_UNQUOTED(_GLIBCXX_CAN_ALIGNAS_DESTRUCTIVE_SIZE, 1, | |
5675 | [Define if global objects can be aligned to | |
5676 | std::hardware_destructive_interference_size.]) | |
5677 | fi | |
5678 | AC_MSG_RESULT($ac_alignas_cacheline) | |
5679 | ||
5680 | AC_LANG_RESTORE | |
5681 | ]) | |
5682 | ||
fe2651af JW |
5683 | dnl |
5684 | dnl Check whether iostream initialization should be done in the library, | |
5685 | dnl using the init_priority attribute. | |
5686 | dnl | |
5687 | dnl Defines: | |
5688 | dnl _GLIBCXX_USE_INIT_PRIORITY_ATTRIBUTE if GCC supports the init_priority | |
5689 | dnl attribute for the target. | |
5690 | dnl | |
5691 | AC_DEFUN([GLIBCXX_CHECK_INIT_PRIORITY], [ | |
5692 | AC_LANG_SAVE | |
5693 | AC_LANG_CPLUSPLUS | |
5694 | ||
5695 | AC_MSG_CHECKING([whether init_priority attribute is supported]) | |
5696 | AC_TRY_COMPILE(, [ | |
5697 | #if ! __has_attribute(init_priority) | |
5698 | #error init_priority not supported | |
5699 | #endif | |
5700 | ], [ac_init_priority=yes], [ac_init_priority=no]) | |
5701 | if test "$ac_init_priority" = yes; then | |
5702 | AC_DEFINE_UNQUOTED(_GLIBCXX_USE_INIT_PRIORITY_ATTRIBUTE, 1, | |
5703 | [Define if init_priority should be used for iostream initialization.]) | |
5704 | fi | |
5705 | AC_MSG_RESULT($ac_init_priority) | |
5706 | ||
5707 | AC_LANG_RESTORE | |
5708 | ]) | |
5709 | ||
cddfb1c7 | 5710 | # Macros from the top-level gcc directory. |
c18dc5cc | 5711 | m4_include([../config/gc++filt.m4]) |
cddfb1c7 | 5712 | m4_include([../config/tls.m4]) |
1183dc2c | 5713 | m4_include([../config/gthr.m4]) |
36101de9 | 5714 | m4_include([../config/cet.m4]) |