]> git.ipfire.org Git - thirdparty/gcc.git/blame - libstdc++-v3/acinclude.m4
2011-07-15 Paolo Carlini <paolo.carlini@oracle.com>
[thirdparty/gcc.git] / libstdc++-v3 / acinclude.m4
CommitLineData
92eabea2
PE
1dnl
2dnl GLIBCXX_CONDITIONAL (NAME, SHELL-TEST)
3dnl
4dnl Exactly like AM_CONDITIONAL, but delays evaluation of the test until the
5dnl end of configure. This lets tested variables be reassigned, and the
6dnl conditional will depend on the final state of the variable. For a simple
7dnl example of why this is needed, see GLIBCXX_ENABLE_HOSTED.
8dnl
9m4_define([_m4_divert(glibcxx_diversion)], 8000)dnl
f214923c 10AC_DEFUN([GLIBCXX_CONDITIONAL], [dnl
92eabea2
PE
11 m4_divert_text([glibcxx_diversion],dnl
12 AM_CONDITIONAL([$1],[$2])
13 )dnl
14])dnl
f214923c 15AC_DEFUN([GLIBCXX_EVALUATE_CONDITIONALS], [m4_undivert([glibcxx_diversion])])dnl
92eabea2
PE
16
17
ff66d28f
PE
18dnl
19dnl Check to see what architecture and operating system we are compiling
20dnl for. Also, if architecture- or OS-specific flags are required for
21dnl compilation, pick them up here.
22dnl
f214923c 23AC_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
29dnl
30dnl Initialize the rest of the library configury. At this point we have
31dnl variables like $host.
aebb8c22 32dnl
ff66d28f 33dnl Sets:
82ba99d5 34dnl SUBDIRS
ff66d28f
PE
35dnl Substs:
36dnl glibcxx_builddir (absolute path)
37dnl glibcxx_srcdir (absolute path)
38dnl toplevel_srcdir (absolute path)
39dnl with_cross_host
40dnl with_newlib
41dnl with_target_subdir
42dnl plus
43dnl - the variables in GLIBCXX_CHECK_HOST / configure.host
44dnl - default settings for all AM_CONFITIONAL test variables
45dnl - lots of tools, like CC and CXX
aebb8c22 46dnl
f214923c 47AC_DEFUN([GLIBCXX_CONFIGURE], [
82ba99d5
PE
48 # Keep these sync'd with the list in Makefile.am. The first provides an
49 # expandable list at autoconf time; the second provides an expandable list
50 # (i.e., shell variable) at configure time.
41850419 51 m4_define([glibcxx_SUBDIRS],[include libsupc++ python src doc po testsuite])
82ba99d5
PE
52 SUBDIRS='glibcxx_SUBDIRS'
53
d2caef2e
PE
54 # These need to be absolute paths, yet at the same time need to
55 # canonicalize only relative paths, because then amd will not unmount
56 # drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
3d7c150e 57 glibcxx_builddir=`${PWDCMD-pwd}`
d2caef2e 58 case $srcdir in
ff66d28f
PE
59 [\\/$]* | ?:[\\/]*) glibcxx_srcdir=${srcdir} ;;
60 *) glibcxx_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
d2caef2e 61 esac
ff66d28f 62 toplevel_srcdir=${glibcxx_srcdir}/..
3d7c150e
BK
63 AC_SUBST(glibcxx_builddir)
64 AC_SUBST(glibcxx_srcdir)
ff66d28f 65 AC_SUBST(toplevel_srcdir)
d2caef2e 66
ff66d28f
PE
67 # We use these options to decide which functions to include. They are
68 # set from the top level.
69 AC_ARG_WITH([target-subdir],
70 AC_HELP_STRING([--with-target-subdir=SUBDIR],
b329dd10 71 [configuring in a subdirectory]))
ff66d28f
PE
72
73 AC_ARG_WITH([cross-host],
74 AC_HELP_STRING([--with-cross-host=HOST],
b329dd10 75 [configuring with a cross compiler]))
ff66d28f
PE
76
77 AC_ARG_WITH([newlib],
78 AC_HELP_STRING([--with-newlib],
b329dd10 79 [assume newlib as a system C library]))
ff66d28f 80
ff66d28f
PE
81 # Will set LN_S to either 'ln -s', 'ln', or 'cp -p' (if linking isn't
82 # available). Uncomment the next line to force a particular method.
83 AC_PROG_LN_S
84 #LN_S='cp -p'
85
5780a46b
BK
86 AC_CHECK_TOOL(AS, as)
87 AC_CHECK_TOOL(AR, ar)
46840bcd 88 AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
b2dad0e3 89
5780a46b 90 AM_MAINTAINER_MODE
b2dad0e3 91
92eabea2
PE
92 # Set up safe default values for all subsequent AM_CONDITIONAL tests
93 # which are themselves conditionally expanded.
94 ## (Right now, this only matters for enable_wchar_t, but nothing prevents
95 ## other macros from doing the same. This should be automated.) -pme
16da539b 96
aa6a73b9 97 # Check for C library flavor since Linux platforms use different configuration
464aea98
JM
98 # directories depending on the C library in use.
99 AC_EGREP_CPP([_using_uclibc], [
100 #include <stdio.h>
101 #if __UCLIBC__
102 _using_uclibc
103 #endif
104 ], uclibc=yes, uclibc=no)
105
aa6a73b9
MK
106 AC_EGREP_CPP([_using_bionic], [
107 #include <stdio.h>
108 #if __BIONIC__
109 _using_bionic
110 #endif
111 ], bionic=yes, bionic=no)
112
ff66d28f
PE
113 # Find platform-specific directories containing configuration info.
114 # Also possibly modify flags used elsewhere, as needed by the platform.
3d7c150e 115 GLIBCXX_CHECK_HOST
b2dad0e3
BK
116])
117
118
c470c17d 119dnl
52b55e7d
PE
120dnl Tests for newer compiler features, or features that are present in newer
121dnl compiler versions but not older compiler versions still in use, should
122dnl be placed here.
b2dad0e3 123dnl
ff66d28f
PE
124dnl Defines:
125dnl WERROR='-Werror' if requested and possible; g++'s that lack the
126dnl new inlining code or the new system_header pragma will die on -Werror.
127dnl Leave it out by default and use maint-mode to use it.
128dnl SECTION_FLAGS='-ffunction-sections -fdata-sections' if
129dnl compiler supports it and the user has not requested debug mode.
c21b6f87 130dnl
f214923c 131AC_DEFUN([GLIBCXX_CHECK_COMPILER_FEATURES], [
a4e99046 132 # All these tests are for C++; save the language and the compiler flags.
52b55e7d 133 # The CXXFLAGS thing is suspicious, but based on similar bits previously
3d7c150e 134 # found in GLIBCXX_CONFIGURE.
a4e99046
PE
135 AC_LANG_SAVE
136 AC_LANG_CPLUSPLUS
137 ac_test_CXXFLAGS="${CXXFLAGS+set}"
138 ac_save_CXXFLAGS="$CXXFLAGS"
a4e99046 139
7f586614
BK
140 # Check for maintainer-mode bits.
141 if test x"$USE_MAINTAINER_MODE" = xno; then
142 WERROR=''
8bd636c5 143 else
7f586614 144 WERROR='-Werror'
8bd636c5
PE
145 fi
146
c470c17d
BK
147 # Check for -ffunction-sections -fdata-sections
148 AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections])
85ee35ca
BK
149 CXXFLAGS='-g -Werror -ffunction-sections -fdata-sections'
150 AC_TRY_COMPILE([int foo; void bar() { };],, [ac_fdsections=yes], [ac_fdsections=no])
c470c17d
BK
151 if test "$ac_test_CXXFLAGS" = set; then
152 CXXFLAGS="$ac_save_CXXFLAGS"
153 else
154 # this is the suspicious part
155 CXXFLAGS=''
156 fi
6aa43d99 157 if test x"$ac_fdsections" = x"yes"; then
c470c17d
BK
158 SECTION_FLAGS='-ffunction-sections -fdata-sections'
159 fi
160 AC_MSG_RESULT($ac_fdsections)
161
a4e99046 162 AC_LANG_RESTORE
8bd636c5 163 AC_SUBST(WERROR)
c470c17d 164 AC_SUBST(SECTION_FLAGS)
b2dad0e3
BK
165])
166
c470c17d
BK
167
168dnl
421173e6
PE
169dnl If GNU ld is in use, check to see if tricky linker opts can be used. If
170dnl the native linker is in use, all variables will be defined to something
171dnl safe (like an empty string).
172dnl
ff66d28f
PE
173dnl Defines:
174dnl SECTION_LDFLAGS='-Wl,--gc-sections' if possible
a429affe 175dnl OPT_LDFLAGS='-Wl,-O1' and '-z,relro' if possible
ff66d28f
PE
176dnl LD (as a side effect of testing)
177dnl Sets:
178dnl with_gnu_ld
d60a2d4d 179dnl glibcxx_ld_is_gold (set to "no" or "yes")
ff66d28f
PE
180dnl glibcxx_gnu_ld_version (possibly)
181dnl
182dnl The last will be a single integer, e.g., version 1.23.45.0.67.89 will
183dnl set glibcxx_gnu_ld_version to 12345. Zeros cause problems.
c470c17d 184dnl
f214923c 185AC_DEFUN([GLIBCXX_CHECK_LINKER_FEATURES], [
421173e6
PE
186 # If we're not using GNU ld, then there's no point in even trying these
187 # tests. Check for that first. We should have already tested for gld
188 # by now (in libtool), but require it now just to be safe...
654421eb
DE
189 test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
190 test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
421173e6 191 AC_REQUIRE([AC_PROG_LD])
ff66d28f 192 AC_REQUIRE([AC_PROG_AWK])
5bd17d39 193
c98b201b
PE
194 # The name set by libtool depends on the version of libtool. Shame on us
195 # for depending on an impl detail, but c'est la vie. Older versions used
196 # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on
197 # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually
198 # makes sense). We'll test with_gnu_ld everywhere else, so if that isn't
199 # set (hence we're using an older libtool), then set it.
200 if test x${with_gnu_ld+set} != xset; then
201 if test x${ac_cv_prog_gnu_ld+set} != xset; then
202 # We got through "ac_require(ac_prog_ld)" and still not set? Huh?
203 with_gnu_ld=no
204 else
205 with_gnu_ld=$ac_cv_prog_gnu_ld
206 fi
207 fi
208
209 # Start by getting the version number. I think the libtool test already
210 # does some of this, but throws away the result.
d60a2d4d 211 glibcxx_ld_is_gold=no
e2c104d8
BK
212 if test x"$with_gnu_ld" = x"yes"; then
213 AC_MSG_CHECKING([for ld version])
214 changequote(,)
d60a2d4d
ILT
215 if $LD --version 2>/dev/null | grep 'GNU gold' >/dev/null 2>&1; then
216 glibcxx_ld_is_gold=yes
217 fi
c82852f7 218 ldver=`$LD --version 2>/dev/null |
89c74f4a 219 sed -e 's/GNU gold /GNU ld /;s/GNU ld version /GNU ld /;s/GNU ld ([^)]*) /GNU ld /;s/GNU ld \([0-9.][0-9.]*\).*/\1/; q'`
e2c104d8
BK
220 changequote([,])
221 glibcxx_gnu_ld_version=`echo $ldver | \
b329dd10 222 $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
e2c104d8
BK
223 AC_MSG_RESULT($glibcxx_gnu_ld_version)
224 fi
c98b201b 225
5bd17d39 226 # Set --gc-sections.
d60a2d4d
ILT
227 glibcxx_have_gc_sections=no
228 if test "$glibcxx_ld_is_gold" = "yes"; then
229 if $LD --help 2>/dev/null | grep gc-sections >/dev/null 2>&1; then
230 glibcxx_have_gc_sections=yes
231 fi
232 else
233 glibcxx_gcsections_min_ld=21602
b329dd10 234 if test x"$with_gnu_ld" = x"yes" &&
ac2b2479 235 test $glibcxx_gnu_ld_version -gt $glibcxx_gcsections_min_ld ; then
d60a2d4d
ILT
236 glibcxx_have_gc_sections=yes
237 fi
238 fi
239 if test "$glibcxx_have_gc_sections" = "yes"; then
ac2b2479
BK
240 # Sufficiently young GNU ld it is! Joy and bunny rabbits!
241 # NB: This flag only works reliably after 2.16.1. Configure tests
242 # for this are difficult, so hard wire a value that should work.
421173e6 243
421173e6
PE
244 ac_test_CFLAGS="${CFLAGS+set}"
245 ac_save_CFLAGS="$CFLAGS"
2a0ab51c 246 CFLAGS='-Wl,--gc-sections'
421173e6
PE
247
248 # Check for -Wl,--gc-sections
249 AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
acb6e9be
BK
250 AC_TRY_LINK([ int one(void) { return 1; }
251 int two(void) { return 2; }
252 ], [ two(); ] , [ac_gcsections=yes], [ac_gcsections=no])
360e8759
L
253 if test "$ac_gcsections" = "yes"; then
254 rm -f conftest.c
255 touch conftest.c
256 if $CC -c conftest.c; then
257 if $LD --gc-sections -o conftest conftest.o 2>&1 | \
258 grep "Warning: gc-sections option ignored" > /dev/null; then
259 ac_gcsections=no
260 fi
261 fi
262 rm -f conftest.c conftest.o conftest
263 fi
acb6e9be
BK
264 if test "$ac_gcsections" = "yes"; then
265 SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
266 fi
267 AC_MSG_RESULT($ac_gcsections)
268
421173e6
PE
269 if test "$ac_test_CFLAGS" = set; then
270 CFLAGS="$ac_save_CFLAGS"
271 else
272 # this is the suspicious part
273 CFLAGS=''
274 fi
5bd17d39 275 fi
a9117427 276
a429affe 277 # Set -z,relro.
952c7b74 278 # Note this is only for shared objects.
a429affe
BK
279 ac_ld_relro=no
280 if test x"$with_gnu_ld" = x"yes"; then
281 AC_MSG_CHECKING([for ld that supports -Wl,-z,relro])
282 cxx_z_relo=`$LD -v --help 2>/dev/null | grep "z relro"`
283 if test -n "$cxx_z_relo"; then
284 OPT_LDFLAGS="-Wl,-z,relro"
285 ac_ld_relro=yes
286 fi
287 AC_MSG_RESULT($ac_ld_relro)
288 fi
289
5bd17d39 290 # Set linker optimization flags.
6aa43d99 291 if test x"$with_gnu_ld" = x"yes"; then
654421eb 292 OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
421173e6 293 fi
5bd17d39 294
c470c17d 295 AC_SUBST(SECTION_LDFLAGS)
421173e6 296 AC_SUBST(OPT_LDFLAGS)
c470c17d
BK
297])
298
299
b2dad0e3 300dnl
ff66d28f
PE
301dnl Check for headers for, and arguments to, the setrlimit() function.
302dnl Used only in testsuite_hooks.h. Called from GLIBCXX_CONFIGURE_TESTSUITE.
6aa43d99 303dnl
ff66d28f 304dnl Defines:
b329dd10 305dnl _GLIBCXX_RES_LIMITS if we can set artificial resource limits
2ae6e982 306dnl various HAVE_LIMIT_* for individual limit names
6aa43d99 307dnl
f214923c 308AC_DEFUN([GLIBCXX_CHECK_SETRLIMIT_ancilliary], [
e0103440 309 AC_MSG_CHECKING([for RLIMIT_$1])
ff66d28f
PE
310 AC_TRY_COMPILE(
311 [#include <unistd.h>
312 #include <sys/time.h>
313 #include <sys/resource.h>
314 ],
315 [ int f = RLIMIT_$1 ; ],
316 [glibcxx_mresult=1], [glibcxx_mresult=0])
2ae6e982 317 AC_DEFINE_UNQUOTED(HAVE_LIMIT_$1, $glibcxx_mresult,
b329dd10 318 [Only used in build directory testsuite_hooks.h.])
e0103440
GK
319 if test $glibcxx_mresult = 1 ; then res=yes ; else res=no ; fi
320 AC_MSG_RESULT($res)
ff66d28f
PE
321])
322
f214923c 323AC_DEFUN([GLIBCXX_CHECK_SETRLIMIT], [
ff66d28f
PE
324 setrlimit_have_headers=yes
325 AC_CHECK_HEADERS(unistd.h sys/time.h sys/resource.h,
b329dd10
BK
326 [],
327 [setrlimit_have_headers=no])
ff66d28f
PE
328 # If don't have the headers, then we can't run the tests now, and we
329 # won't be seeing any of these during testsuite compilation.
330 if test $setrlimit_have_headers = yes; then
331 # Can't do these in a loop, else the resulting syntax is wrong.
332 GLIBCXX_CHECK_SETRLIMIT_ancilliary(DATA)
333 GLIBCXX_CHECK_SETRLIMIT_ancilliary(RSS)
334 GLIBCXX_CHECK_SETRLIMIT_ancilliary(VMEM)
335 GLIBCXX_CHECK_SETRLIMIT_ancilliary(AS)
2ae6e982 336 GLIBCXX_CHECK_SETRLIMIT_ancilliary(FSIZE)
ff66d28f
PE
337
338 # Check for rlimit, setrlimit.
6d26724a 339 AC_CACHE_VAL(glibcxx_cv_setrlimit, [
ff66d28f 340 AC_TRY_COMPILE(
b329dd10
BK
341 [#include <unistd.h>
342 #include <sys/time.h>
343 #include <sys/resource.h>
344 ],
345 [struct rlimit r;
346 setrlimit(0, &r);],
347 [glibcxx_cv_setrlimit=yes], [glibcxx_cv_setrlimit=no])
ff66d28f
PE
348 ])
349 fi
350
2ae6e982 351 AC_MSG_CHECKING([for testsuite resource limits support])
6d26724a 352 if test $setrlimit_have_headers = yes && test $glibcxx_cv_setrlimit = yes; then
2ae6e982 353 ac_res_limits=yes
4651e622 354 AC_DEFINE(_GLIBCXX_RES_LIMITS, 1,
b329dd10
BK
355 [Define if using setrlimit to set resource limits during
356 "make check"])
ff66d28f 357 else
2ae6e982 358 ac_res_limits=no
ff66d28f 359 fi
2ae6e982 360 AC_MSG_RESULT($ac_res_limits)
6aa43d99
BK
361])
362
363
6aa43d99 364dnl
ff66d28f
PE
365dnl Check whether S_ISREG (Posix) or S_IFREG is available in <sys/stat.h>.
366dnl Define HAVE_S_ISREG / HAVE_S_IFREG appropriately.
6aa43d99 367dnl
f214923c 368AC_DEFUN([GLIBCXX_CHECK_S_ISREG_OR_S_IFREG], [
74745ec5
PC
369
370 AC_LANG_SAVE
371 AC_LANG_CPLUSPLUS
372 ac_save_CXXFLAGS="$CXXFLAGS"
373 CXXFLAGS="$CXXFLAGS -fno-exceptions"
374
e0103440 375 AC_MSG_CHECKING([for S_ISREG or S_IFREG])
ff66d28f 376 AC_CACHE_VAL(glibcxx_cv_S_ISREG, [
74745ec5 377 GCC_TRY_COMPILE_OR_LINK(
ff66d28f
PE
378 [#include <sys/stat.h>],
379 [struct stat buffer;
380 fstat(0, &buffer);
381 S_ISREG(buffer.st_mode);],
382 [glibcxx_cv_S_ISREG=yes],
383 [glibcxx_cv_S_ISREG=no])
384 ])
385 AC_CACHE_VAL(glibcxx_cv_S_IFREG, [
74745ec5 386 GCC_TRY_COMPILE_OR_LINK(
ff66d28f
PE
387 [#include <sys/stat.h>],
388 [struct stat buffer;
389 fstat(0, &buffer);
390 S_IFREG & buffer.st_mode;],
391 [glibcxx_cv_S_IFREG=yes],
392 [glibcxx_cv_S_IFREG=no])
393 ])
e0103440 394 res=no
ff66d28f 395 if test $glibcxx_cv_S_ISREG = yes; then
b329dd10
BK
396 AC_DEFINE(HAVE_S_ISREG, 1,
397 [Define if S_IFREG is available in <sys/stat.h>.])
e0103440 398 res=S_ISREG
ff66d28f 399 elif test $glibcxx_cv_S_IFREG = yes; then
4651e622 400 AC_DEFINE(HAVE_S_IFREG, 1,
b329dd10 401 [Define if S_IFREG is available in <sys/stat.h>.])
e0103440 402 res=S_IFREG
ff66d28f 403 fi
e0103440 404 AC_MSG_RESULT($res)
74745ec5
PC
405
406 CXXFLAGS="$ac_save_CXXFLAGS"
407 AC_LANG_RESTORE
b2dad0e3
BK
408])
409
410
dcfa0bc8 411dnl
ff66d28f 412dnl Check whether poll is available in <poll.h>, and define HAVE_POLL.
dcfa0bc8 413dnl
f214923c 414AC_DEFUN([GLIBCXX_CHECK_POLL], [
74745ec5
PC
415
416 AC_LANG_SAVE
417 AC_LANG_CPLUSPLUS
418 ac_save_CXXFLAGS="$CXXFLAGS"
419 CXXFLAGS="$CXXFLAGS -fno-exceptions"
420
e0103440 421 AC_MSG_CHECKING([for poll])
ff66d28f 422 AC_CACHE_VAL(glibcxx_cv_POLL, [
74745ec5 423 GCC_TRY_COMPILE_OR_LINK(
ff66d28f
PE
424 [#include <poll.h>],
425 [struct pollfd pfd[1];
426 pfd[0].events = POLLIN;
427 poll(pfd, 1, 0);],
428 [glibcxx_cv_POLL=yes],
429 [glibcxx_cv_POLL=no])
430 ])
431 if test $glibcxx_cv_POLL = yes; then
4651e622 432 AC_DEFINE(HAVE_POLL, 1, [Define if poll is available in <poll.h>.])
ff66d28f 433 fi
e0103440 434 AC_MSG_RESULT($glibcxx_cv_POLL)
74745ec5
PC
435
436 CXXFLAGS="$ac_save_CXXFLAGS"
437 AC_LANG_RESTORE
ff66d28f
PE
438])
439
440
441dnl
442dnl Check whether writev is available in <sys/uio.h>, and define HAVE_WRITEV.
443dnl
f214923c 444AC_DEFUN([GLIBCXX_CHECK_WRITEV], [
74745ec5
PC
445
446 AC_LANG_SAVE
447 AC_LANG_CPLUSPLUS
448 ac_save_CXXFLAGS="$CXXFLAGS"
449 CXXFLAGS="$CXXFLAGS -fno-exceptions"
450
e0103440 451 AC_MSG_CHECKING([for writev])
ff66d28f 452 AC_CACHE_VAL(glibcxx_cv_WRITEV, [
74745ec5 453 GCC_TRY_COMPILE_OR_LINK(
ff66d28f
PE
454 [#include <sys/uio.h>],
455 [struct iovec iov[2];
456 writev(0, iov, 0);],
457 [glibcxx_cv_WRITEV=yes],
458 [glibcxx_cv_WRITEV=no])
459 ])
460 if test $glibcxx_cv_WRITEV = yes; then
4651e622 461 AC_DEFINE(HAVE_WRITEV, 1, [Define if writev is available in <sys/uio.h>.])
ff66d28f 462 fi
e0103440 463 AC_MSG_RESULT($glibcxx_cv_WRITEV)
74745ec5
PC
464
465 CXXFLAGS="$ac_save_CXXFLAGS"
466 AC_LANG_RESTORE
ff66d28f
PE
467])
468
469
3d05b345
PC
470dnl
471dnl Check whether int64_t is available in <stdint.h>, and define HAVE_INT64_T.
fc9ab7b4 472dnl Also check whether int64_t is actually a typedef to long or long long.
3d05b345 473dnl
f214923c 474AC_DEFUN([GLIBCXX_CHECK_INT64_T], [
fc9ab7b4
PC
475
476 AC_LANG_SAVE
477 AC_LANG_CPLUSPLUS
478
e0103440 479 AC_MSG_CHECKING([for int64_t])
3d05b345
PC
480 AC_CACHE_VAL(glibcxx_cv_INT64_T, [
481 AC_TRY_COMPILE(
482 [#include <stdint.h>],
483 [int64_t var;],
484 [glibcxx_cv_INT64_T=yes],
485 [glibcxx_cv_INT64_T=no])
486 ])
fc9ab7b4 487
3d05b345 488 if test $glibcxx_cv_INT64_T = yes; then
4651e622 489 AC_DEFINE(HAVE_INT64_T, 1, [Define if int64_t is available in <stdint.h>.])
fc9ab7b4
PC
490 AC_MSG_RESULT($glibcxx_cv_INT64_T)
491
492 AC_MSG_CHECKING([for int64_t as long])
493 AC_CACHE_VAL(glibcxx_cv_int64_t_long, [
494 AC_TRY_COMPILE(
b329dd10
BK
495 [#include <stdint.h>
496 template<typename, typename> struct same { enum { value = -1 }; };
497 template<typename Tp> struct same<Tp, Tp> { enum { value = 1 }; };
498 int array[same<int64_t, long>::value];], [],
fc9ab7b4
PC
499 [glibcxx_cv_int64_t_long=yes], [glibcxx_cv_int64_t_long=no])
500 ])
501
502 if test $glibcxx_cv_int64_t_long = yes; then
503 AC_DEFINE(HAVE_INT64_T_LONG, 1, [Define if int64_t is a long.])
504 AC_MSG_RESULT($glibcxx_cv_int64_t_long)
505 fi
506
507 AC_MSG_CHECKING([for int64_t as long long])
508 AC_CACHE_VAL(glibcxx_cv_int64_t_long_long, [
509 AC_TRY_COMPILE(
b329dd10
BK
510 [#include <stdint.h>
511 template<typename, typename> struct same { enum { value = -1 }; };
512 template<typename Tp> struct same<Tp, Tp> { enum { value = 1 }; };
513 int array[same<int64_t, long long>::value];], [],
fc9ab7b4
PC
514 [glibcxx_cv_int64_t_long_long=yes], [glibcxx_cv_int64_t_long_long=no])
515 ])
516
517 if test $glibcxx_cv_int64_t_long_long = yes; then
518 AC_DEFINE(HAVE_INT64_T_LONG_LONG, 1, [Define if int64_t is a long long.])
519 AC_MSG_RESULT($glibcxx_cv_int64_t_long_long)
520 fi
3d05b345 521 fi
fc9ab7b4
PC
522
523 AC_LANG_RESTORE
3d05b345
PC
524])
525
526
527dnl
528dnl Check whether LFS support is available.
529dnl
f214923c 530AC_DEFUN([GLIBCXX_CHECK_LFS], [
0c6b814a 531 AC_LANG_SAVE
9d47bc51
PC
532 AC_LANG_CPLUSPLUS
533 ac_save_CXXFLAGS="$CXXFLAGS"
b329dd10 534 CXXFLAGS="$CXXFLAGS -fno-exceptions"
e0103440 535 AC_MSG_CHECKING([for LFS support])
3d05b345 536 AC_CACHE_VAL(glibcxx_cv_LFS, [
74745ec5 537 GCC_TRY_COMPILE_OR_LINK(
0c6b814a
PC
538 [#include <unistd.h>
539 #include <stdio.h>
dd5d134b 540 #include <sys/stat.h>
0c6b814a 541 ],
5c89246d
PC
542 [FILE* fp;
543 fopen64("t", "w");
544 fseeko64(fp, 0, SEEK_CUR);
545 ftello64(fp);
dd5d134b
PC
546 lseek64(1, 0, SEEK_CUR);
547 struct stat64 buf;
548 fstat64(1, &buf);],
3d05b345
PC
549 [glibcxx_cv_LFS=yes],
550 [glibcxx_cv_LFS=no])
551 ])
552 if test $glibcxx_cv_LFS = yes; then
4651e622 553 AC_DEFINE(_GLIBCXX_USE_LFS, 1, [Define if LFS support is available.])
3d05b345 554 fi
e0103440 555 AC_MSG_RESULT($glibcxx_cv_LFS)
9d47bc51
PC
556 CXXFLAGS="$ac_save_CXXFLAGS"
557 AC_LANG_RESTORE
3d05b345
PC
558])
559
560
1165dc50
PC
561dnl
562dnl Check for whether a fully dynamic basic_string implementation should
563dnl be turned on, that does not put empty objects in per-process static
564dnl memory (mostly useful together with shared memory allocators, see PR
565dnl libstdc++/16612 for details).
566dnl
567dnl --enable-fully-dynamic-string defines _GLIBCXX_FULLY_DYNAMIC_STRING
568dnl --disable-fully-dynamic-string leaves _GLIBCXX_FULLY_DYNAMIC_STRING undefined
569dnl + Usage: GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING[(DEFAULT)]
570dnl Where DEFAULT is either `yes' or `no'.
571dnl
572AC_DEFUN([GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING], [
573 GLIBCXX_ENABLE(fully-dynamic-string,$1,,[do not put empty strings in per-process static memory])
574 if test $enable_fully_dynamic_string = yes; then
4651e622 575 AC_DEFINE(_GLIBCXX_FULLY_DYNAMIC_STRING, 1,
b329dd10 576 [Define if a fully dynamic basic_string is wanted.])
1165dc50
PC
577 fi
578])
579
580
ff66d28f
PE
581dnl
582dnl Does any necessary configuration of the testsuite directory. Generates
583dnl the testsuite_hooks.h header.
584dnl
585dnl GLIBCXX_ENABLE_SYMVERS and GLIBCXX_IS_NATIVE must be done before this.
586dnl
587dnl Sets:
b329dd10 588dnl enable_abi_check
e3f78d9b
BK
589dnl GLIBCXX_TEST_WCHAR_T
590dnl GLIBCXX_TEST_THREAD
ff66d28f
PE
591dnl Substs:
592dnl baseline_dir
00fc1bf6 593dnl baseline_subdir_switch
ff66d28f 594dnl
f214923c 595AC_DEFUN([GLIBCXX_CONFIGURE_TESTSUITE], [
0646b059 596 if $GLIBCXX_IS_NATIVE ; then
2ae6e982 597 # Do checks for resource limit functions.
ff66d28f
PE
598 GLIBCXX_CHECK_SETRLIMIT
599
600 # Look for setenv, so that extended locale tests can be performed.
601 GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_3(setenv)
0646b059 602 fi
dbc66058 603
0646b059
GK
604 if $GLIBCXX_IS_NATIVE && test $is_hosted = yes &&
605 test $enable_symvers != no; then
606 case "$host" in
607 *-*-cygwin*)
b329dd10 608 enable_abi_check=no ;;
0646b059 609 *)
b329dd10 610 enable_abi_check=yes ;;
0646b059 611 esac
dbc66058
DJ
612 else
613 # Only build this as native, since automake does not understand
614 # CXX_FOR_BUILD.
615 enable_abi_check=no
ff66d28f 616 fi
b329dd10 617
ff66d28f 618 # Export file names for ABI checking.
68c512f6 619 baseline_dir="$glibcxx_srcdir/config/abi/post/${abi_baseline_pair}"
ff66d28f 620 AC_SUBST(baseline_dir)
00fc1bf6
RO
621 baseline_subdir_switch="$abi_baseline_subdir_switch"
622 AC_SUBST(baseline_subdir_switch)
ff66d28f
PE
623])
624
625
b329dd10
BK
626dnl
627dnl Does any necessary configuration of the documentation directory.
628dnl
629dnl XSLTPROC must be set before this
630dnl
631dnl Sets:
632dnl glibcxx_stylesheets
633dnl Substs:
634dnl XSL_STYLE_DIR
635dnl
636AC_DEFUN([GLIBCXX_CONFIGURE_DOCBOOK], [
637
638AC_MSG_CHECKING([for stylesheets used in generation of documentation])
639glibcxx_stylesheets=no
640if test x${XSLTPROC} = xyes && echo '<title/>' | xsltproc --noout --nonet --xinclude http://docbook.sourceforge.net/release/xsl-ns/current/xhtml-1_1/docbook.xsl - 2>/dev/null; then
641 glibcxx_stylesheets=yes
642fi
643AC_MSG_RESULT($glibcxx_stylesheets)
644
645AC_MSG_CHECKING([for local stylesheet directory])
646glibcxx_local_stylesheets=no
647if test x"$glibcxx_stylesheets" = x"yes"; then
648 if test -d /usr/share/sgml/docbook/xsl-ns-stylesheets; then
649 glibcxx_local_stylesheets=yes
650 XSL_STYLE_DIR=/usr/share/sgml/docbook/xsl-ns-stylesheets
651 fi
652 if test -d /usr/share/xml/docbook/stylesheet/docbook-xsl-ns; then
653 glibcxx_local_stylesheets=yes
654 XSL_STYLE_DIR=/usr/share/xml/docbook/stylesheet/docbook-xsl-ns
655 fi
656fi
657AC_MSG_RESULT($glibcxx_local_stylesheets)
658
659if test x"$glibcxx_local_stylesheets" = x"yes"; then
660 AC_SUBST(XSL_STYLE_DIR)
661 AC_MSG_NOTICE($XSL_STYLE_DIR)
662else
663 glibcxx_stylesheets=no
664fi
665])
666
667
ff66d28f
PE
668dnl
669dnl Set up *_INCLUDES variables for all sundry Makefile.am's.
670dnl
671dnl Substs:
672dnl GLIBCXX_INCLUDES
673dnl TOPLEVEL_INCLUDES
ff66d28f 674dnl
f214923c 675AC_DEFUN([GLIBCXX_EXPORT_INCLUDES], [
0df3f383
PE
676 # Used for every C++ compile we perform.
677 GLIBCXX_INCLUDES="\
678-I$glibcxx_builddir/include/$host_alias \
679-I$glibcxx_builddir/include \
680-I$glibcxx_srcdir/libsupc++"
ff66d28f 681
0df3f383 682 # For Canadian crosses, pick this up too.
ff66d28f 683 if test $CANADIAN = yes; then
37e0ff11 684 GLIBCXX_INCLUDES="$GLIBCXX_INCLUDES -I\${includedir}"
ff66d28f
PE
685 fi
686
0df3f383
PE
687 # Stuff in the actual top level. Currently only used by libsupc++ to
688 # get unwind* headers from the gcc dir.
689 #TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc -I$(toplevel_srcdir)/include'
690 TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc'
ff66d28f
PE
691
692 # Now, export this to all the little Makefiles....
693 AC_SUBST(GLIBCXX_INCLUDES)
694 AC_SUBST(TOPLEVEL_INCLUDES)
ff66d28f
PE
695])
696
697
698dnl
699dnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's.
700dnl (SECTION_FLAGS is done under CHECK_COMPILER_FEATURES.)
701dnl
702dnl Substs:
703dnl OPTIMIZE_CXXFLAGS
704dnl WARN_FLAGS
705dnl
f214923c 706AC_DEFUN([GLIBCXX_EXPORT_FLAGS], [
ff66d28f
PE
707 # Optimization flags that are probably a good idea for thrill-seekers. Just
708 # uncomment the lines below and make, everything else is ready to go...
62801a96 709 # Alternatively OPTIMIZE_CXXFLAGS can be set in configure.host.
ff66d28f 710 # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
ff66d28f
PE
711 AC_SUBST(OPTIMIZE_CXXFLAGS)
712
dc7c62ae 713 WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual'
ff66d28f
PE
714 AC_SUBST(WARN_FLAGS)
715])
716
717
718dnl
719dnl All installation directory information is determined here.
720dnl
721dnl Substs:
722dnl gxx_install_dir
723dnl glibcxx_prefixdir
724dnl glibcxx_toolexecdir
725dnl glibcxx_toolexeclibdir
726dnl
727dnl Assumes cross_compiling bits already done, and with_cross_host in
728dnl particular.
729dnl
0f57bf40 730dnl This logic must match gcc/configure.ac's setting of gcc_gxx_include_dir.
505692b0 731dnl config/gxx-include-dir.m4 must be kept consistant with this as well.
f214923c 732AC_DEFUN([GLIBCXX_EXPORT_INSTALL_INFO], [
ff66d28f
PE
733 glibcxx_toolexecdir=no
734 glibcxx_toolexeclibdir=no
735 glibcxx_prefixdir=$prefix
736
737 AC_MSG_CHECKING([for gxx-include-dir])
738 AC_ARG_WITH([gxx-include-dir],
739 AC_HELP_STRING([--with-gxx-include-dir=DIR],
b329dd10 740 [installation directory for include files]),
ff66d28f
PE
741 [case "$withval" in
742 yes) AC_MSG_ERROR([Missing directory for --with-gxx-include-dir]) ;;
743 no) gxx_include_dir=no ;;
744 *) gxx_include_dir=$withval ;;
745 esac],
746 [gxx_include_dir=no])
747 AC_MSG_RESULT($gxx_include_dir)
748
749 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
750 AC_ARG_ENABLE([version-specific-runtime-libs],
751 AC_HELP_STRING([--enable-version-specific-runtime-libs],
b329dd10 752 [Specify that runtime libraries should be installed in a compiler-specific directory]),
ff66d28f
PE
753 [case "$enableval" in
754 yes) version_specific_libs=yes ;;
755 no) version_specific_libs=no ;;
756 *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
757 esac],
758 [version_specific_libs=no])
759 AC_MSG_RESULT($version_specific_libs)
760
761 # Default case for install directory for include files.
762 if test $version_specific_libs = no && test $gxx_include_dir = no; then
0f57bf40 763 gxx_include_dir='include/c++/${gcc_version}'
b329dd10
BK
764 if test -n "$with_cross_host" &&
765 test x"$with_cross_host" != x"no"; then
0f57bf40
MM
766 gxx_include_dir='${prefix}/${target_alias}/'"$gxx_include_dir"
767 else
768 gxx_include_dir='${prefix}/'"$gxx_include_dir"
769 fi
ff66d28f
PE
770 fi
771
772 # Version-specific runtime libs processing.
773 if test $version_specific_libs = yes; then
774 # Need the gcc compiler version to know where to install libraries
775 # and header files if --enable-version-specific-runtime-libs option
0314451d
GK
776 # is selected. FIXME: these variables are misnamed, there are
777 # no executables installed in _toolexecdir or _toolexeclibdir.
ff66d28f 778 if test x"$gxx_include_dir" = x"no"; then
47194af4 779 gxx_include_dir='${libdir}/gcc/${host_alias}/${gcc_version}/include/c++'
ff66d28f 780 fi
0314451d 781 glibcxx_toolexecdir='${libdir}/gcc/${host_alias}'
47194af4 782 glibcxx_toolexeclibdir='${toolexecdir}/${gcc_version}$(MULTISUBDIR)'
ff66d28f
PE
783 fi
784
785 # Calculate glibcxx_toolexecdir, glibcxx_toolexeclibdir
786 # Install a library built with a cross compiler in tooldir, not libdir.
787 if test x"$glibcxx_toolexecdir" = x"no"; then
788 if test -n "$with_cross_host" &&
789 test x"$with_cross_host" != x"no"; then
fbe057bb
PE
790 glibcxx_toolexecdir='${exec_prefix}/${host_alias}'
791 glibcxx_toolexeclibdir='${toolexecdir}/lib'
ff66d28f 792 else
0314451d 793 glibcxx_toolexecdir='${libdir}/gcc/${host_alias}'
fbe057bb 794 glibcxx_toolexeclibdir='${libdir}'
ff66d28f 795 fi
fbe057bb 796 multi_os_directory=`$CXX -print-multi-os-directory`
ff66d28f
PE
797 case $multi_os_directory in
798 .) ;; # Avoid trailing /.
799 *) glibcxx_toolexeclibdir=$glibcxx_toolexeclibdir/$multi_os_directory ;;
800 esac
801 fi
802
803 AC_MSG_CHECKING([for install location])
804 AC_MSG_RESULT($gxx_include_dir)
805
806 AC_SUBST(glibcxx_prefixdir)
807 AC_SUBST(gxx_include_dir)
808 AC_SUBST(glibcxx_toolexecdir)
809 AC_SUBST(glibcxx_toolexeclibdir)
810])
811
812
813dnl
814dnl GLIBCXX_ENABLE
815dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING)
816dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, permit a|b|c)
817dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, SHELL-CODE-HANDLER)
818dnl
819dnl See docs/html/17_intro/configury.html#enable for documentation.
820dnl
821m4_define([GLIBCXX_ENABLE],[dnl
822m4_define([_g_switch],[--enable-$1])dnl
b453ace3
AS
823m4_define([_g_help],[AC_HELP_STRING([_g_switch$3],[$4 @<:@default=$2@:>@])])dnl
824 AC_ARG_ENABLE([$1],m4_dquote(_g_help),
ff66d28f
PE
825 m4_bmatch([$5],
826 [^permit ],
827 [[
828 case "$enableval" in
829 m4_bpatsubst([$5],[permit ])) ;;
830 *) AC_MSG_ERROR(Unknown argument to enable/disable $1) ;;
b329dd10
BK
831 dnl Idea for future: generate a URL pointing to
832 dnl "onlinedocs/configopts.html#whatever"
ff66d28f
PE
833 esac
834 ]],
835 [^$],
836 [[
837 case "$enableval" in
838 yes|no) ;;
839 *) AC_MSG_ERROR(Argument to enable/disable $1 must be yes or no) ;;
840 esac
841 ]],
842 [[$5]]),
843 [enable_]m4_bpatsubst([$1],-,_)[=][$2])
844m4_undefine([_g_switch])dnl
845m4_undefine([_g_help])dnl
846])
847
848
849dnl
850dnl Check for ISO/IEC 9899:1999 "C99" support.
851dnl
852dnl --enable-c99 defines _GLIBCXX_USE_C99
853dnl --disable-c99 leaves _GLIBCXX_USE_C99 undefined
854dnl + Usage: GLIBCXX_ENABLE_C99[(DEFAULT)]
855dnl Where DEFAULT is either `yes' or `no'.
856dnl + If 'C99' stuff is not available, ignores DEFAULT and sets `no'.
857dnl
f214923c 858AC_DEFUN([GLIBCXX_ENABLE_C99], [
ff66d28f
PE
859 GLIBCXX_ENABLE(c99,$1,,[turns on ISO/IEC 9899:1999 support])
860
347669a0
BK
861 if test x"$enable_c99" = x"yes"; then
862
ff66d28f
PE
863 AC_LANG_SAVE
864 AC_LANG_CPLUSPLUS
865
18f310b7
PC
866 # Use -std=c++98 because the default (-std=gnu++98) leaves __STRICT_ANSI__
867 # undefined and fake C99 facilities - like pre-standard snprintf - may be
868 # spuriously enabled.
869 # Long term, -std=c++0x could be even better, could manage to explicitely
870 # request C99 facilities to the underlying C headers.
b6f914f6 871 ac_save_CXXFLAGS="$CXXFLAGS"
18f310b7 872 CXXFLAGS="$CXXFLAGS -std=c++98"
b6f914f6
RS
873 ac_save_LIBS="$LIBS"
874 ac_save_gcc_no_link="$gcc_no_link"
875
876 if test x$gcc_no_link != xyes; then
877 # Use -fno-exceptions to that the C driver can link these tests without
878 # hitting undefined references to personality routines.
879 CXXFLAGS="$CXXFLAGS -fno-exceptions"
880 AC_CHECK_LIB(m, sin, [
881 LIBS="$LIBS -lm"
882 ], [
883 # Use the default compile-only tests in GCC_TRY_COMPILE_OR_LINK
884 gcc_no_link=yes
885 ])
886 fi
887
ff66d28f 888 # Check for the existence of <math.h> functions used if C99 is enabled.
ff66d28f 889 AC_MSG_CHECKING([for ISO C99 support in <math.h>])
6d26724a 890 AC_CACHE_VAL(glibcxx_cv_c99_math, [
b6f914f6
RS
891 GCC_TRY_COMPILE_OR_LINK(
892 [#include <math.h>
893 volatile double d1, d2;
894 volatile int i;],
895 [i = fpclassify(d1);
896 i = isfinite(d1);
897 i = isinf(d1);
898 i = isnan(d1);
899 i = isnormal(d1);
900 i = signbit(d1);
901 i = isgreater(d1, d2);
902 i = isgreaterequal(d1, d2);
903 i = isless(d1, d2);
904 i = islessequal(d1, d2);
905 i = islessgreater(d1, d2);
906 i = islessgreater(d1, d2);
907 i = isunordered(d1, d2);
6d26724a 908 ],[glibcxx_cv_c99_math=yes], [glibcxx_cv_c99_math=no])
347669a0 909 ])
6d26724a
RW
910 AC_MSG_RESULT($glibcxx_cv_c99_math)
911 if test x"$glibcxx_cv_c99_math" = x"yes"; then
4651e622 912 AC_DEFINE(_GLIBCXX_USE_C99_MATH, 1,
b329dd10
BK
913 [Define if C99 functions or macros in <math.h> should be imported
914 in <cmath> in namespace std.])
517da0ce
MM
915 fi
916
225962a0 917 # Check for the existence of <complex.h> complex math functions.
52e6723c
BK
918 # This is necessary even though libstdc++ uses the builtin versions
919 # of these functions, because if the builtin cannot be used, a reference
920 # to the library function is emitted.
5ad2f32d 921 AC_CHECK_HEADERS(tgmath.h, ac_has_tgmath_h=yes, ac_has_tgmath_h=no)
52e6723c 922 AC_CHECK_HEADERS(complex.h, ac_has_complex_h=yes, ac_has_complex_h=no)
6d26724a 923 glibcxx_cv_c99_complex=no;
52e6723c 924 if test x"$ac_has_complex_h" = x"yes"; then
52e6723c 925 AC_MSG_CHECKING([for ISO C99 support in <complex.h>])
b6f914f6
RS
926 GCC_TRY_COMPILE_OR_LINK(
927 [#include <complex.h>
928 typedef __complex__ float float_type;
929 typedef __complex__ double double_type;
930 typedef __complex__ long double ld_type;
931 volatile float_type tmpf;
932 volatile double_type tmpd;
933 volatile ld_type tmpld;
934 volatile float f;
935 volatile double d;
936 volatile long double ld;],
937 [f = cabsf(tmpf);
938 f = cargf(tmpf);
939 tmpf = ccosf(tmpf);
940 tmpf = ccoshf(tmpf);
941 tmpf = cexpf(tmpf);
942 tmpf = clogf(tmpf);
943 tmpf = csinf(tmpf);
944 tmpf = csinhf(tmpf);
945 tmpf = csqrtf(tmpf);
946 tmpf = ctanf(tmpf);
947 tmpf = ctanhf(tmpf);
948 tmpf = cpowf(tmpf, tmpf);
3cd54fc9 949 tmpf = cprojf(tmpf);
b6f914f6
RS
950 d = cabs(tmpd);
951 d = carg(tmpd);
952 tmpd = ccos(tmpd);
953 tmpd = ccosh(tmpd);
954 tmpd = cexp(tmpd);
955 tmpd = clog(tmpd);
956 tmpd = csin(tmpd);
957 tmpd = csinh(tmpd);
958 tmpd = csqrt(tmpd);
959 tmpd = ctan(tmpd);
960 tmpd = ctanh(tmpd);
961 tmpd = cpow(tmpd, tmpd);
3cd54fc9 962 tmpd = cproj(tmpd);
b6f914f6
RS
963 ld = cabsl(tmpld);
964 ld = cargl(tmpld);
965 tmpld = ccosl(tmpld);
966 tmpld = ccoshl(tmpld);
967 tmpld = cexpl(tmpld);
968 tmpld = clogl(tmpld);
969 tmpld = csinl(tmpld);
970 tmpld = csinhl(tmpld);
971 tmpld = csqrtl(tmpld);
972 tmpld = ctanl(tmpld);
973 tmpld = ctanhl(tmpld);
974 tmpld = cpowl(tmpld, tmpld);
3cd54fc9 975 tmpld = cprojl(tmpld);
6d26724a 976 ],[glibcxx_cv_c99_complex=yes], [glibcxx_cv_c99_complex=no])
52e6723c 977 fi
6d26724a
RW
978 AC_MSG_RESULT($glibcxx_cv_c99_complex)
979 if test x"$glibcxx_cv_c99_complex" = x"yes"; then
4651e622 980 AC_DEFINE(_GLIBCXX_USE_C99_COMPLEX, 1,
b329dd10
BK
981 [Define if C99 functions in <complex.h> should be used in
982 <complex>. Using compiler builtins for these functions requires
983 corresponding C99 library functions to be present.])
52e6723c
BK
984 fi
985
ff66d28f 986 # Check for the existence in <stdio.h> of vscanf, et. al.
ff66d28f 987 AC_MSG_CHECKING([for ISO C99 support in <stdio.h>])
6d26724a 988 AC_CACHE_VAL(glibcxx_cv_c99_stdio, [
b6f914f6
RS
989 GCC_TRY_COMPILE_OR_LINK(
990 [#include <stdio.h>
991 #include <stdarg.h>
992 void foo(char* fmt, ...)
993 {
994 va_list args; va_start(args, fmt);
b329dd10 995 vfscanf(stderr, "%i", args);
b6f914f6
RS
996 vscanf("%i", args);
997 vsnprintf(fmt, 0, "%i", args);
998 vsscanf(fmt, "%i", args);
999 }],
1000 [snprintf("12", 0, "%i");],
6d26724a 1001 [glibcxx_cv_c99_stdio=yes], [glibcxx_cv_c99_stdio=no])
347669a0 1002 ])
6d26724a 1003 AC_MSG_RESULT($glibcxx_cv_c99_stdio)
ff66d28f
PE
1004
1005 # Check for the existence in <stdlib.h> of lldiv_t, et. al.
ff66d28f 1006 AC_MSG_CHECKING([for ISO C99 support in <stdlib.h>])
6d26724a 1007 AC_CACHE_VAL(glibcxx_cv_c99_stdlib, [
b6f914f6
RS
1008 GCC_TRY_COMPILE_OR_LINK(
1009 [#include <stdlib.h>
1010 volatile float f;
1011 volatile long double ld;
1012 volatile unsigned long long ll;
1013 lldiv_t mydivt;],
1014 [char* tmp;
1015 f = strtof("gnu", &tmp);
1016 ld = strtold("gnu", &tmp);
1017 ll = strtoll("gnu", &tmp, 10);
1018 ll = strtoull("gnu", &tmp, 10);
1019 ll = llabs(10);
1020 mydivt = lldiv(10,1);
1021 ll = mydivt.quot;
1022 ll = mydivt.rem;
1023 ll = atoll("10");
1024 _Exit(0);
6d26724a 1025 ],[glibcxx_cv_c99_stdlib=yes], [glibcxx_cv_c99_stdlib=no])
347669a0 1026 ])
6d26724a 1027 AC_MSG_RESULT($glibcxx_cv_c99_stdlib)
ff66d28f 1028
8a9b2875 1029 # Check for the existence in <wchar.h> of wcstold, etc.
6d26724a 1030 glibcxx_cv_c99_wchar=no;
347669a0
BK
1031 if test x"$ac_has_wchar_h" = xyes &&
1032 test x"$ac_has_wctype_h" = xyes; then
b329dd10 1033 AC_MSG_CHECKING([for ISO C99 support in <wchar.h>])
347669a0 1034 AC_TRY_COMPILE([#include <wchar.h>
b329dd10
BK
1035 namespace test
1036 {
347669a0
BK
1037 using ::wcstold;
1038 using ::wcstoll;
347669a0 1039 using ::wcstoull;
347669a0 1040 }
6d26724a 1041 ],[],[glibcxx_cv_c99_wchar=yes], [glibcxx_cv_c99_wchar=no])
347669a0
BK
1042
1043 # Checks for wide character functions that may not be present.
1044 # Injection of these is wrapped with guard macros.
1045 # NB: only put functions here, instead of immediately above, if
1046 # absolutely necessary.
1047 AC_TRY_COMPILE([#include <wchar.h>
b329dd10 1048 namespace test { using ::vfwscanf; } ], [],
347669a0
BK
1049 [AC_DEFINE(HAVE_VFWSCANF,1,
1050 [Defined if vfwscanf exists.])],[])
1051
1052 AC_TRY_COMPILE([#include <wchar.h>
b329dd10 1053 namespace test { using ::vswscanf; } ], [],
347669a0
BK
1054 [AC_DEFINE(HAVE_VSWSCANF,1,
1055 [Defined if vswscanf exists.])],[])
1056
1057 AC_TRY_COMPILE([#include <wchar.h>
b329dd10 1058 namespace test { using ::vwscanf; } ], [],
347669a0
BK
1059 [AC_DEFINE(HAVE_VWSCANF,1,[Defined if vwscanf exists.])],[])
1060
1061 AC_TRY_COMPILE([#include <wchar.h>
b329dd10 1062 namespace test { using ::wcstof; } ], [],
347669a0
BK
1063 [AC_DEFINE(HAVE_WCSTOF,1,[Defined if wcstof exists.])],[])
1064
1065 AC_TRY_COMPILE([#include <wctype.h>],
b329dd10 1066 [ wint_t t; int i = iswblank(t);],
347669a0
BK
1067 [AC_DEFINE(HAVE_ISWBLANK,1,
1068 [Defined if iswblank exists.])],[])
1069
6d26724a 1070 AC_MSG_RESULT($glibcxx_cv_c99_wchar)
347669a0 1071 fi
ff66d28f 1072
347669a0 1073 # Option parsed, now set things appropriately.
6d26724a
RW
1074 if test x"$glibcxx_cv_c99_math" = x"no" ||
1075 test x"$glibcxx_cv_c99_complex" = x"no" ||
1076 test x"$glibcxx_cv_c99_stdio" = x"no" ||
1077 test x"$glibcxx_cv_c99_stdlib" = x"no" ||
1078 test x"$glibcxx_cv_c99_wchar" = x"no"; then
ff66d28f 1079 enable_c99=no;
347669a0 1080 else
4651e622
KC
1081 AC_DEFINE(_GLIBCXX_USE_C99, 1,
1082 [Define if C99 functions or macros from <wchar.h>, <math.h>,
1083 <complex.h>, <stdio.h>, and <stdlib.h> can be used or exposed.])
ff66d28f
PE
1084 fi
1085
b6f914f6
RS
1086 gcc_no_link="$ac_save_gcc_no_link"
1087 LIBS="$ac_save_LIBS"
1088 CXXFLAGS="$ac_save_CXXFLAGS"
ff66d28f 1089 AC_LANG_RESTORE
b329dd10 1090 fi
347669a0
BK
1091
1092 AC_MSG_CHECKING([for fully enabled ISO C99 support])
1093 AC_MSG_RESULT($enable_c99)
dcfa0bc8
PE
1094])
1095
1096
15e38d0d 1097dnl
959d14e1
CF
1098dnl Check for clock_gettime, nanosleep and sched_yield, used in the
1099dnl implementation of 20.8.5 [time.clock], and 30.2.2 [thread.thread.this]
1100dnl in the current C++0x working draft.
15e38d0d 1101dnl
959d14e1
CF
1102dnl --enable-libstdcxx-time
1103dnl --enable-libstdcxx-time=yes
1104dnl checks for the availability of monotonic and realtime clocks,
1105dnl nanosleep and sched_yield in libc and libposix4 and, in case, links
1106dnl the latter
1107dnl --enable-libstdcxx-time=rt
6c3385c1 1108dnl also searches (and, in case, links) librt. Note that this is
610870b2 1109dnl not always desirable because, in glibc, for example, in turn it
6c3385c1
PC
1110dnl triggers the linking of libpthread too, which activates locking,
1111dnl a large overhead for single-thread programs.
959d14e1
CF
1112dnl --enable-libstdcxx-time=no
1113dnl --disable-libstdcxx-time
610870b2
PC
1114dnl disables the checks completely
1115dnl
959d14e1 1116AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [
610870b2 1117
959d14e1 1118 AC_MSG_CHECKING([for clock_gettime, nanosleep and sched_yield])
b453ace3 1119 GLIBCXX_ENABLE(libstdcxx-time,$1,[[[=KIND]]],
610870b2
PC
1120 [use KIND for check type],
1121 [permit yes|no|rt])
15e38d0d
CF
1122
1123 AC_LANG_SAVE
1124 AC_LANG_CPLUSPLUS
1125 ac_save_CXXFLAGS="$CXXFLAGS"
1126 CXXFLAGS="$CXXFLAGS -fno-exceptions"
ec6fa56a
PB
1127 ac_save_LIBS="$LIBS"
1128
1ac5e52c
MK
1129 ac_has_clock_monotonic=no
1130 ac_has_clock_realtime=no
1131 AC_MSG_RESULT($enable_libstdcxx_time)
ec6fa56a 1132
959d14e1 1133 if test x"$enable_libstdcxx_time" != x"no"; then
ec6fa56a 1134
959d14e1 1135 if test x"$enable_libstdcxx_time" = x"rt"; then
610870b2 1136 AC_SEARCH_LIBS(clock_gettime, [rt posix4])
959d14e1 1137 AC_SEARCH_LIBS(nanosleep, [rt posix4])
610870b2
PC
1138 else
1139 AC_SEARCH_LIBS(clock_gettime, [posix4])
959d14e1 1140 AC_SEARCH_LIBS(nanosleep, [posix4])
610870b2
PC
1141 fi
1142
1143 case "$ac_cv_search_clock_gettime" in
1144 -l*) GLIBCXX_LIBS=$ac_cv_search_clock_gettime
959d14e1
CF
1145 ;;
1146 esac
1147 case "$ac_cv_search_nanosleep" in
1148 -l*) GLIBCXX_LIBS="$GLIBCXX_LIBS $ac_cv_search_nanosleep"
1149 ;;
1150 esac
1151
1152 AC_SEARCH_LIBS(sched_yield, [rt posix4])
1153
1154 case "$ac_cv_search_sched_yield" in
1155 -lposix4*)
1156 GLIBCXX_LIBS="$GLIBCXX_LIBS $ac_cv_search_sched_yield"
1157 AC_DEFINE(_GLIBCXX_USE_SCHED_YIELD, 1,
b329dd10 1158 [ Defined if sched_yield is available. ])
959d14e1
CF
1159 ;;
1160 -lrt*)
1161 if test x"$enable_libstdcxx_time" = x"rt"; then
b329dd10
BK
1162 GLIBCXX_LIBS="$GLIBCXX_LIBS $ac_cv_search_sched_yield"
1163 AC_DEFINE(_GLIBCXX_USE_SCHED_YIELD, 1,
1164 [ Defined if sched_yield is available. ])
959d14e1
CF
1165 fi
1166 ;;
1167 *)
1168 AC_DEFINE(_GLIBCXX_USE_SCHED_YIELD, 1,
b329dd10 1169 [ Defined if sched_yield is available. ])
959d14e1 1170 ;;
610870b2
PC
1171 esac
1172
1173 AC_CHECK_HEADERS(unistd.h, ac_has_unistd_h=yes, ac_has_unistd_h=no)
1174
1175 if test x"$ac_has_unistd_h" = x"yes"; then
1176 AC_MSG_CHECKING([for monotonic clock])
1177 AC_TRY_LINK(
b329dd10
BK
1178 [#include <unistd.h>
1179 #include <time.h>
1180 ],
1181 [#if _POSIX_TIMERS > 0 && defined(_POSIX_MONOTONIC_CLOCK)
1182 timespec tp;
1183 #endif
1184 clock_gettime(CLOCK_MONOTONIC, &tp);
1185 ], [ac_has_clock_monotonic=yes], [ac_has_clock_monotonic=no])
1186
1187 AC_MSG_RESULT($ac_has_clock_monotonic)
1188
610870b2
PC
1189 AC_MSG_CHECKING([for realtime clock])
1190 AC_TRY_LINK(
b329dd10
BK
1191 [#include <unistd.h>
1192 #include <time.h>
1193 ],
1194 [#if _POSIX_TIMERS > 0
1195 timespec tp;
1196 #endif
1197 clock_gettime(CLOCK_REALTIME, &tp);
1198 ], [ac_has_clock_realtime=yes], [ac_has_clock_realtime=no])
610870b2
PC
1199
1200 AC_MSG_RESULT($ac_has_clock_realtime)
610870b2 1201
959d14e1
CF
1202 AC_MSG_CHECKING([for nanosleep])
1203 AC_TRY_LINK(
b329dd10
BK
1204 [#include <unistd.h>
1205 #include <time.h>
1206 ],
1207 [#if _POSIX_TIMERS > 0
1208 timespec tp;
1209 #endif
1210 nanosleep(&tp, 0);
1211 ], [ac_has_nanosleep=yes], [ac_has_nanosleep=no])
959d14e1
CF
1212
1213 AC_MSG_RESULT($ac_has_nanosleep)
1214 fi
610870b2
PC
1215 fi
1216
15e38d0d
CF
1217 if test x"$ac_has_clock_monotonic" = x"yes"; then
1218 AC_DEFINE(_GLIBCXX_USE_CLOCK_MONOTONIC, 1,
1219 [ Defined if clock_gettime has monotonic clock support. ])
1220 fi
ec6fa56a 1221
15e38d0d
CF
1222 if test x"$ac_has_clock_realtime" = x"yes"; then
1223 AC_DEFINE(_GLIBCXX_USE_CLOCK_REALTIME, 1,
1224 [ Defined if clock_gettime has realtime clock support. ])
1225 fi
ec6fa56a 1226
959d14e1
CF
1227 if test x"$ac_has_nanosleep" = x"yes"; then
1228 AC_DEFINE(_GLIBCXX_USE_NANOSLEEP, 1,
1229 [ Defined if nanosleep is available. ])
1230 fi
1231
ec6fa56a
PB
1232 AC_SUBST(GLIBCXX_LIBS)
1233
15e38d0d 1234 CXXFLAGS="$ac_save_CXXFLAGS"
ec6fa56a 1235 LIBS="$ac_save_LIBS"
15e38d0d
CF
1236 AC_LANG_RESTORE
1237])
1238
1239dnl
610870b2
PC
1240dnl Check for gettimeofday, used in the implementation of 20.8.5
1241dnl [time.clock] in the current C++0x working draft.
15e38d0d
CF
1242dnl
1243AC_DEFUN([GLIBCXX_CHECK_GETTIMEOFDAY], [
b329dd10 1244
610870b2
PC
1245 AC_MSG_CHECKING([for gettimeofday])
1246
15e38d0d
CF
1247 AC_LANG_SAVE
1248 AC_LANG_CPLUSPLUS
1249 ac_save_CXXFLAGS="$CXXFLAGS"
1250 CXXFLAGS="$CXXFLAGS -fno-exceptions"
b329dd10 1251
15e38d0d
CF
1252 ac_has_gettimeofday=no;
1253 AC_CHECK_HEADERS(sys/time.h, ac_has_sys_time_h=yes, ac_has_sys_time_h=no)
1254 if test x"$ac_has_sys_time_h" = x"yes"; then
1255 AC_MSG_CHECKING([for gettimeofday])
610870b2 1256 GCC_TRY_COMPILE_OR_LINK([#include <sys/time.h>],
15e38d0d
CF
1257 [timeval tv; gettimeofday(&tv, 0);],
1258 [ac_has_gettimeofday=yes], [ac_has_gettimeofday=no])
b329dd10 1259
15e38d0d
CF
1260 AC_MSG_RESULT($ac_has_gettimeofday)
1261 fi
b329dd10 1262
15e38d0d
CF
1263 if test x"$ac_has_gettimeofday" = x"yes"; then
1264 AC_DEFINE(_GLIBCXX_USE_GETTIMEOFDAY, 1,
1265 [ Defined if gettimeofday is available. ])
1266 fi
b329dd10 1267
15e38d0d
CF
1268 CXXFLAGS="$ac_save_CXXFLAGS"
1269 AC_LANG_RESTORE
1270])
1271
bd2bb1ea
PC
1272dnl
1273dnl Check for ISO/IEC 9899:1999 "C99" support to ISO/IEC DTR 19768 "TR1"
1274dnl facilities in Chapter 8, "C compatibility".
1275dnl
1276AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [
1277
1278 AC_LANG_SAVE
1279 AC_LANG_CPLUSPLUS
1280
18f310b7
PC
1281 # Use -std=c++98 because the default (-std=gnu++98) leaves __STRICT_ANSI__
1282 # undefined and fake C99 facilities may be spuriously enabled.
1283 ac_save_CXXFLAGS="$CXXFLAGS"
1284 CXXFLAGS="$CXXFLAGS -std=c++98"
1285
bd2bb1ea
PC
1286 # Check for the existence of <complex.h> complex math functions used
1287 # by tr1/complex.
1288 AC_CHECK_HEADERS(complex.h, ac_has_complex_h=yes, ac_has_complex_h=no)
1289 ac_c99_complex_tr1=no;
1290 if test x"$ac_has_complex_h" = x"yes"; then
1291 AC_MSG_CHECKING([for ISO C99 support to TR1 in <complex.h>])
1292 AC_TRY_COMPILE([#include <complex.h>],
b329dd10
BK
1293 [typedef __complex__ float float_type; float_type tmpf;
1294 cacosf(tmpf);
1295 casinf(tmpf);
1296 catanf(tmpf);
1297 cacoshf(tmpf);
1298 casinhf(tmpf);
1299 catanhf(tmpf);
bd2bb1ea 1300 typedef __complex__ double double_type; double_type tmpd;
b329dd10
BK
1301 cacos(tmpd);
1302 casin(tmpd);
1303 catan(tmpd);
1304 cacosh(tmpd);
1305 casinh(tmpd);
1306 catanh(tmpd);
bd2bb1ea 1307 typedef __complex__ long double ld_type; ld_type tmpld;
b329dd10
BK
1308 cacosl(tmpld);
1309 casinl(tmpld);
1310 catanl(tmpld);
1311 cacoshl(tmpld);
1312 casinhl(tmpld);
1313 catanhl(tmpld);
bd2bb1ea
PC
1314 ],[ac_c99_complex_tr1=yes], [ac_c99_complex_tr1=no])
1315 fi
1316 AC_MSG_RESULT($ac_c99_complex_tr1)
1317 if test x"$ac_c99_complex_tr1" = x"yes"; then
1318 AC_DEFINE(_GLIBCXX_USE_C99_COMPLEX_TR1, 1,
b329dd10
BK
1319 [Define if C99 functions in <complex.h> should be used in
1320 <tr1/complex>. Using compiler builtins for these functions
bd2bb1ea
PC
1321 requires corresponding C99 library functions to be present.])
1322 fi
1323
1324 # Check for the existence of <ctype.h> functions.
1325 AC_MSG_CHECKING([for ISO C99 support to TR1 in <ctype.h>])
6d26724a 1326 AC_CACHE_VAL(glibcxx_cv_c99_ctype_tr1, [
bd2bb1ea 1327 AC_TRY_COMPILE([#include <ctype.h>],
b329dd10
BK
1328 [int ch;
1329 int ret;
1330 ret = isblank(ch);
0f24e8de
PC
1331 ],[glibcxx_cv_c99_ctype_tr1=yes],
1332 [glibcxx_cv_c99_ctype_tr1=no])
bd2bb1ea 1333 ])
6d26724a
RW
1334 AC_MSG_RESULT($glibcxx_cv_c99_ctype_tr1)
1335 if test x"$glibcxx_cv_c99_ctype_tr1" = x"yes"; then
bd2bb1ea 1336 AC_DEFINE(_GLIBCXX_USE_C99_CTYPE_TR1, 1,
b329dd10 1337 [Define if C99 functions in <ctype.h> should be imported in
bd2bb1ea
PC
1338 <tr1/cctype> in namespace std::tr1.])
1339 fi
1340
20921e53
PC
1341 # Check for the existence of <fenv.h> functions.
1342 AC_CHECK_HEADERS(fenv.h, ac_has_fenv_h=yes, ac_has_fenv_h=no)
1343 ac_c99_fenv_tr1=no;
1344 if test x"$ac_has_fenv_h" = x"yes"; then
1345 AC_MSG_CHECKING([for ISO C99 support to TR1 in <fenv.h>])
1346 AC_TRY_COMPILE([#include <fenv.h>],
b329dd10
BK
1347 [int except, mode;
1348 fexcept_t* pflag;
1349 fenv_t* penv;
1350 int ret;
1351 ret = feclearexcept(except);
1352 ret = fegetexceptflag(pflag, except);
1353 ret = feraiseexcept(except);
1354 ret = fesetexceptflag(pflag, except);
1355 ret = fetestexcept(except);
1356 ret = fegetround();
1357 ret = fesetround(mode);
1358 ret = fegetenv(penv);
1359 ret = feholdexcept(penv);
1360 ret = fesetenv(penv);
1361 ret = feupdateenv(penv);
20921e53
PC
1362 ],[ac_c99_fenv_tr1=yes], [ac_c99_fenv_tr1=no])
1363 fi
1364 AC_MSG_RESULT($ac_c99_fenv_tr1)
1365 if test x"$ac_c99_fenv_tr1" = x"yes"; then
1366 AC_DEFINE(_GLIBCXX_USE_C99_FENV_TR1, 1,
b329dd10 1367 [Define if C99 functions in <fenv.h> should be imported in
20921e53
PC
1368 <tr1/cfenv> in namespace std::tr1.])
1369 fi
1370
2a1d6346
PC
1371 # Check for the existence of <stdint.h> types.
1372 AC_MSG_CHECKING([for ISO C99 support to TR1 in <stdint.h>])
6d26724a 1373 AC_CACHE_VAL(glibcxx_cv_c99_stdint_tr1, [
5289e808 1374 AC_TRY_COMPILE([#define __STDC_LIMIT_MACROS
b329dd10
BK
1375 #define __STDC_CONSTANT_MACROS
1376 #include <stdint.h>],
1377 [typedef int8_t my_int8_t;
5289e808
PC
1378 my_int8_t i8 = INT8_MIN;
1379 i8 = INT8_MAX;
b329dd10 1380 typedef int16_t my_int16_t;
5289e808
PC
1381 my_int16_t i16 = INT16_MIN;
1382 i16 = INT16_MAX;
b329dd10 1383 typedef int32_t my_int32_t;
5289e808
PC
1384 my_int32_t i32 = INT32_MIN;
1385 i32 = INT32_MAX;
b329dd10 1386 typedef int64_t my_int64_t;
5289e808
PC
1387 my_int64_t i64 = INT64_MIN;
1388 i64 = INT64_MAX;
b329dd10 1389 typedef int_fast8_t my_int_fast8_t;
5289e808
PC
1390 my_int_fast8_t if8 = INT_FAST8_MIN;
1391 if8 = INT_FAST8_MAX;
b329dd10 1392 typedef int_fast16_t my_int_fast16_t;
5289e808
PC
1393 my_int_fast16_t if16 = INT_FAST16_MIN;
1394 if16 = INT_FAST16_MAX;
b329dd10 1395 typedef int_fast32_t my_int_fast32_t;
5289e808
PC
1396 my_int_fast32_t if32 = INT_FAST32_MIN;
1397 if32 = INT_FAST32_MAX;
b329dd10 1398 typedef int_fast64_t my_int_fast64_t;
5289e808
PC
1399 my_int_fast64_t if64 = INT_FAST64_MIN;
1400 if64 = INT_FAST64_MAX;
b329dd10 1401 typedef int_least8_t my_int_least8_t;
5289e808
PC
1402 my_int_least8_t il8 = INT_LEAST8_MIN;
1403 il8 = INT_LEAST8_MAX;
b329dd10 1404 typedef int_least16_t my_int_least16_t;
5289e808
PC
1405 my_int_least16_t il16 = INT_LEAST16_MIN;
1406 il16 = INT_LEAST16_MAX;
b329dd10 1407 typedef int_least32_t my_int_least32_t;
5289e808
PC
1408 my_int_least32_t il32 = INT_LEAST32_MIN;
1409 il32 = INT_LEAST32_MAX;
b329dd10 1410 typedef int_least64_t my_int_least64_t;
5289e808
PC
1411 my_int_least64_t il64 = INT_LEAST64_MIN;
1412 il64 = INT_LEAST64_MAX;
2a1d6346 1413 typedef intmax_t my_intmax_t;
5289e808
PC
1414 my_intmax_t im = INTMAX_MAX;
1415 im = INTMAX_MIN;
2a1d6346 1416 typedef intptr_t my_intptr_t;
5289e808
PC
1417 my_intptr_t ip = INTPTR_MAX;
1418 ip = INTPTR_MIN;
b329dd10 1419 typedef uint8_t my_uint8_t;
5289e808
PC
1420 my_uint8_t ui8 = UINT8_MAX;
1421 ui8 = UINT8_MAX;
b329dd10 1422 typedef uint16_t my_uint16_t;
5289e808
PC
1423 my_uint16_t ui16 = UINT16_MAX;
1424 ui16 = UINT16_MAX;
b329dd10 1425 typedef uint32_t my_uint32_t;
5289e808
PC
1426 my_uint32_t ui32 = UINT32_MAX;
1427 ui32 = UINT32_MAX;
b329dd10 1428 typedef uint64_t my_uint64_t;
5289e808
PC
1429 my_uint64_t ui64 = UINT64_MAX;
1430 ui64 = UINT64_MAX;
b329dd10 1431 typedef uint_fast8_t my_uint_fast8_t;
5289e808
PC
1432 my_uint_fast8_t uif8 = UINT_FAST8_MAX;
1433 uif8 = UINT_FAST8_MAX;
b329dd10 1434 typedef uint_fast16_t my_uint_fast16_t;
5289e808
PC
1435 my_uint_fast16_t uif16 = UINT_FAST16_MAX;
1436 uif16 = UINT_FAST16_MAX;
b329dd10 1437 typedef uint_fast32_t my_uint_fast32_t;
5289e808
PC
1438 my_uint_fast32_t uif32 = UINT_FAST32_MAX;
1439 uif32 = UINT_FAST32_MAX;
b329dd10 1440 typedef uint_fast64_t my_uint_fast64_t;
5289e808
PC
1441 my_uint_fast64_t uif64 = UINT_FAST64_MAX;
1442 uif64 = UINT_FAST64_MAX;
b329dd10 1443 typedef uint_least8_t my_uint_least8_t;
5289e808
PC
1444 my_uint_least8_t uil8 = UINT_LEAST8_MAX;
1445 uil8 = UINT_LEAST8_MAX;
b329dd10 1446 typedef uint_least16_t my_uint_least16_t;
5289e808
PC
1447 my_uint_least16_t uil16 = UINT_LEAST16_MAX;
1448 uil16 = UINT_LEAST16_MAX;
b329dd10 1449 typedef uint_least32_t my_uint_least32_t;
5289e808
PC
1450 my_uint_least32_t uil32 = UINT_LEAST32_MAX;
1451 uil32 = UINT_LEAST32_MAX;
b329dd10 1452 typedef uint_least64_t my_uint_least64_t;
5289e808
PC
1453 my_uint_least64_t uil64 = UINT_LEAST64_MAX;
1454 uil64 = UINT_LEAST64_MAX;
2a1d6346 1455 typedef uintmax_t my_uintmax_t;
5289e808
PC
1456 my_uintmax_t uim = UINTMAX_MAX;
1457 uim = UINTMAX_MAX;
2a1d6346 1458 typedef uintptr_t my_uintptr_t;
5289e808
PC
1459 my_uintptr_t uip = UINTPTR_MAX;
1460 uip = UINTPTR_MAX;
0f24e8de
PC
1461 ],[glibcxx_cv_c99_stdint_tr1=yes],
1462 [glibcxx_cv_c99_stdint_tr1=no])
2a1d6346 1463 ])
6d26724a
RW
1464 AC_MSG_RESULT($glibcxx_cv_c99_stdint_tr1)
1465 if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then
2a1d6346 1466 AC_DEFINE(_GLIBCXX_USE_C99_STDINT_TR1, 1,
b329dd10 1467 [Define if C99 types in <stdint.h> should be imported in
2a1d6346
PC
1468 <tr1/cstdint> in namespace std::tr1.])
1469 fi
1470
4f0de5dd
PC
1471 # Check for the existence of <math.h> functions.
1472 AC_MSG_CHECKING([for ISO C99 support to TR1 in <math.h>])
6d26724a 1473 AC_CACHE_VAL(glibcxx_cv_c99_math_tr1, [
4f0de5dd 1474 AC_TRY_COMPILE([#include <math.h>],
b329dd10
BK
1475 [typedef double_t my_double_t;
1476 typedef float_t my_float_t;
1477 acosh(0.0);
1478 acoshf(0.0f);
1479 acoshl(0.0l);
1480 asinh(0.0);
1481 asinhf(0.0f);
1482 asinhl(0.0l);
1483 atanh(0.0);
1484 atanhf(0.0f);
1485 atanhl(0.0l);
1486 cbrt(0.0);
1487 cbrtf(0.0f);
1488 cbrtl(0.0l);
1489 copysign(0.0, 0.0);
1490 copysignf(0.0f, 0.0f);
1491 copysignl(0.0l, 0.0l);
1492 erf(0.0);
1493 erff(0.0f);
1494 erfl(0.0l);
1495 erfc(0.0);
1496 erfcf(0.0f);
1497 erfcl(0.0l);
1498 exp2(0.0);
1499 exp2f(0.0f);
1500 exp2l(0.0l);
1501 expm1(0.0);
1502 expm1f(0.0f);
1503 expm1l(0.0l);
1504 fdim(0.0, 0.0);
1505 fdimf(0.0f, 0.0f);
1506 fdiml(0.0l, 0.0l);
1507 fma(0.0, 0.0, 0.0);
1508 fmaf(0.0f, 0.0f, 0.0f);
1509 fmal(0.0l, 0.0l, 0.0l);
1510 fmax(0.0, 0.0);
1511 fmaxf(0.0f, 0.0f);
1512 fmaxl(0.0l, 0.0l);
1513 fmin(0.0, 0.0);
1514 fminf(0.0f, 0.0f);
1515 fminl(0.0l, 0.0l);
1516 hypot(0.0, 0.0);
1517 hypotf(0.0f, 0.0f);
1518 hypotl(0.0l, 0.0l);
1519 ilogb(0.0);
1520 ilogbf(0.0f);
1521 ilogbl(0.0l);
1522 lgamma(0.0);
1523 lgammaf(0.0f);
1524 lgammal(0.0l);
1525 llrint(0.0);
1526 llrintf(0.0f);
1527 llrintl(0.0l);
1528 llround(0.0);
1529 llroundf(0.0f);
1530 llroundl(0.0l);
1531 log1p(0.0);
1532 log1pf(0.0f);
1533 log1pl(0.0l);
1534 log2(0.0);
1535 log2f(0.0f);
1536 log2l(0.0l);
1537 logb(0.0);
1538 logbf(0.0f);
1539 logbl(0.0l);
1540 lrint(0.0);
1541 lrintf(0.0f);
1542 lrintl(0.0l);
1543 lround(0.0);
1544 lroundf(0.0f);
1545 lroundl(0.0l);
1546 nan(0);
1547 nanf(0);
1548 nanl(0);
1549 nearbyint(0.0);
1550 nearbyintf(0.0f);
1551 nearbyintl(0.0l);
1552 nextafter(0.0, 0.0);
1553 nextafterf(0.0f, 0.0f);
1554 nextafterl(0.0l, 0.0l);
1555 nexttoward(0.0, 0.0);
1556 nexttowardf(0.0f, 0.0f);
1557 nexttowardl(0.0l, 0.0l);
1558 remainder(0.0, 0.0);
1559 remainderf(0.0f, 0.0f);
1560 remainderl(0.0l, 0.0l);
1561 remquo(0.0, 0.0, 0);
1562 remquof(0.0f, 0.0f, 0);
1563 remquol(0.0l, 0.0l, 0);
1564 rint(0.0);
1565 rintf(0.0f);
1566 rintl(0.0l);
1567 round(0.0);
1568 roundf(0.0f);
1569 roundl(0.0l);
1570 scalbln(0.0, 0l);
1571 scalblnf(0.0f, 0l);
1572 scalblnl(0.0l, 0l);
1573 scalbn(0.0, 0);
1574 scalbnf(0.0f, 0);
1575 scalbnl(0.0l, 0);
1576 tgamma(0.0);
1577 tgammaf(0.0f);
1578 tgammal(0.0l);
1579 trunc(0.0);
1580 truncf(0.0f);
1581 truncl(0.0l);
6d26724a 1582 ],[glibcxx_cv_c99_math_tr1=yes], [glibcxx_cv_c99_math_tr1=no])
4f0de5dd 1583 ])
6d26724a
RW
1584 AC_MSG_RESULT($glibcxx_cv_c99_math_tr1)
1585 if test x"$glibcxx_cv_c99_math_tr1" = x"yes"; then
4f0de5dd 1586 AC_DEFINE(_GLIBCXX_USE_C99_MATH_TR1, 1,
b329dd10
BK
1587 [Define if C99 functions or macros in <math.h> should be imported
1588 in <tr1/cmath> in namespace std::tr1.])
4f0de5dd
PC
1589 fi
1590
03bf3bc1 1591 # Check for the existence of <inttypes.h> functions (NB: doesn't make
a834e097 1592 # sense if the glibcxx_cv_c99_stdint_tr1 check fails, per C99, 7.8/1).
03bf3bc1 1593 ac_c99_inttypes_tr1=no;
6d26724a 1594 if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then
03bf3bc1
PC
1595 AC_MSG_CHECKING([for ISO C99 support to TR1 in <inttypes.h>])
1596 AC_TRY_COMPILE([#include <inttypes.h>],
b329dd10
BK
1597 [intmax_t i, numer, denom, base;
1598 const char* s;
1599 char** endptr;
1600 intmax_t ret = imaxabs(i);
1601 imaxdiv_t dret = imaxdiv(numer, denom);
1602 ret = strtoimax(s, endptr, base);
1603 uintmax_t uret = strtoumax(s, endptr, base);
1604 ],[ac_c99_inttypes_tr1=yes], [ac_c99_inttypes_tr1=no])
03bf3bc1 1605 fi
52a64bd3
PC
1606 AC_MSG_RESULT($ac_c99_inttypes_tr1)
1607 if test x"$ac_c99_inttypes_tr1" = x"yes"; then
1608 AC_DEFINE(_GLIBCXX_USE_C99_INTTYPES_TR1, 1,
b329dd10
BK
1609 [Define if C99 functions in <inttypes.h> should be imported in
1610 <tr1/cinttypes> in namespace std::tr1.])
52a64bd3
PC
1611 fi
1612
a834e097
PC
1613 # Check for the existence of whcar_t <inttypes.h> functions (NB: doesn't
1614 # make sense if the glibcxx_cv_c99_stdint_tr1 check fails, per C99, 7.8/1).
1615 ac_c99_inttypes_wchar_t_tr1=no;
1616 if test x"$glibcxx_cv_c99_stdint_tr1" = x"yes"; then
1617 AC_MSG_CHECKING([for wchar_t ISO C99 support to TR1 in <inttypes.h>])
1618 AC_TRY_COMPILE([#include <inttypes.h>],
b329dd10 1619 [intmax_t base;
a834e097 1620 const wchar_t* s;
b329dd10
BK
1621 wchar_t** endptr;
1622 intmax_t ret = wcstoimax(s, endptr, base);
1623 uintmax_t uret = wcstoumax(s, endptr, base);
1624 ],[ac_c99_inttypes_wchar_t_tr1=yes],
a834e097
PC
1625 [ac_c99_inttypes_wchar_t_tr1=no])
1626 fi
1627 AC_MSG_RESULT($ac_c99_inttypes_wchar_t_tr1)
1628 if test x"$ac_c99_inttypes_wchar_t_tr1" = x"yes"; then
1629 AC_DEFINE(_GLIBCXX_USE_C99_INTTYPES_WCHAR_T_TR1, 1,
b329dd10 1630 [Define if wchar_t C99 functions in <inttypes.h> should be
a834e097
PC
1631 imported in <tr1/cinttypes> in namespace std::tr1.])
1632 fi
1633
b329dd10 1634 # Check for the existence of the <stdbool.h> header.
1e41a98c
PC
1635 AC_CHECK_HEADERS(stdbool.h)
1636
18f310b7 1637 CXXFLAGS="$ac_save_CXXFLAGS"
bd2bb1ea
PC
1638 AC_LANG_RESTORE
1639])
1640
d8bc9819 1641dnl
9ce0a22e 1642dnl Check whether "/dev/random" and "/dev/urandom" are available for the
d8bc9819
PC
1643dnl random_device of "TR1" (Chapter 5.1, "Random number generation").
1644dnl
1645AC_DEFUN([GLIBCXX_CHECK_RANDOM_TR1], [
1646
9ce0a22e 1647 AC_MSG_CHECKING([for "/dev/random" and "/dev/urandom" for TR1 random_device])
6d26724a 1648 AC_CACHE_VAL(glibcxx_cv_random_tr1, [
9ce0a22e
PC
1649 if test -r /dev/random && test -r /dev/urandom; then
1650 glibcxx_cv_random_tr1=yes;
1651 else
1652 glibcxx_cv_random_tr1=no;
1653 fi
d8bc9819 1654 ])
6d26724a 1655 AC_MSG_RESULT($glibcxx_cv_random_tr1)
9ce0a22e 1656
6d26724a 1657 if test x"$glibcxx_cv_random_tr1" = x"yes"; then
d8bc9819 1658 AC_DEFINE(_GLIBCXX_USE_RANDOM_TR1, 1,
b329dd10 1659 [Define if /dev/random and /dev/urandom are available for
d8bc9819
PC
1660 the random_device of TR1 (Chapter 5.1).])
1661 fi
1662
1663])
bd2bb1ea 1664
1814157e 1665dnl
ddc9c40d
PC
1666dnl Compute the EOF, SEEK_CUR, and SEEK_END integer constants.
1667dnl
1668AC_DEFUN([GLIBCXX_COMPUTE_STDIO_INTEGER_CONSTANTS], [
1669
9b04fa91 1670 AC_CACHE_CHECK([for the value of EOF], glibcxx_cv_stdio_eof, [
ddc9c40d 1671 AC_COMPUTE_INT([glibcxx_cv_stdio_eof], [[EOF]],
b329dd10
BK
1672 [#include <stdio.h>],
1673 [AC_MSG_ERROR([computing EOF failed])])
ddc9c40d 1674 ])
ddc9c40d 1675 AC_DEFINE_UNQUOTED(_GLIBCXX_STDIO_EOF, $glibcxx_cv_stdio_eof,
b329dd10 1676 [Define to the value of the EOF integer constant.])
ddc9c40d 1677
9b04fa91 1678 AC_CACHE_CHECK([for the value of SEEK_CUR], glibcxx_cv_stdio_seek_cur, [
ddc9c40d 1679 AC_COMPUTE_INT([glibcxx_cv_stdio_seek_cur], [[SEEK_CUR]],
b329dd10
BK
1680 [#include <stdio.h>],
1681 [AC_MSG_ERROR([computing SEEK_CUR failed])])
ddc9c40d 1682 ])
ddc9c40d 1683 AC_DEFINE_UNQUOTED(_GLIBCXX_STDIO_SEEK_CUR, $glibcxx_cv_stdio_seek_cur,
b329dd10 1684 [Define to the value of the SEEK_CUR integer constant.])
ddc9c40d 1685
9b04fa91 1686 AC_CACHE_CHECK([for the value of SEEK_END], glibcxx_cv_stdio_seek_end, [
ddc9c40d 1687 AC_COMPUTE_INT([glibcxx_cv_stdio_seek_end], [[SEEK_END]],
b329dd10
BK
1688 [#include <stdio.h>],
1689 [AC_MSG_ERROR([computing SEEK_END failed])])
ddc9c40d 1690 ])
ddc9c40d 1691 AC_DEFINE_UNQUOTED(_GLIBCXX_STDIO_SEEK_END, $glibcxx_cv_stdio_seek_end,
b329dd10 1692 [Define to the value of the SEEK_END integer constant.])
1814157e
PC
1693])
1694
0646d8a3
BK
1695dnl
1696dnl Check whether macros, etc are present for <system_error>
1697dnl
1698AC_DEFUN([GLIBCXX_CHECK_SYSTEM_ERROR], [
1699
6d26724a
RW
1700m4_pushdef([n_syserr], [1])dnl
1701m4_foreach([syserr], [EOWNERDEAD, ENOTRECOVERABLE, ENOLINK, EPROTO, ENODATA,
70593ad2 1702 ENOSR, ENOSTR, ETIME, EBADMSG, ECANCELED,
6d26724a
RW
1703 EOVERFLOW, ENOTSUP, EIDRM, ETXTBSY],
1704[m4_pushdef([SYSERR], m4_toupper(syserr))dnl
1705AC_MSG_CHECKING([for syserr])
1706AC_CACHE_VAL([glibcxx_cv_system_error[]n_syserr], [
1707AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <errno.h>]],
1708 [int i = syserr;])],
1709 [glibcxx_cv_system_error[]n_syserr=yes],
1710 [glibcxx_cv_system_error[]n_syserr=no])
1711])
1712AC_MSG_RESULT([$glibcxx_cv_system_error[]n_syserr])
1713if test x"$glibcxx_cv_system_error[]n_syserr" = x"yes"; then
1714 AC_DEFINE([HAVE_]SYSERR, 1, [Define if ]syserr[ exists.])
1715fi
1716m4_define([n_syserr], m4_incr(n_syserr))dnl
1717m4_popdef([SYSERR])dnl
1718])
1719m4_popdef([n_syserr])dnl
0646d8a3
BK
1720])
1721
0214010c 1722dnl
ff66d28f
PE
1723dnl Check for what type of C headers to use.
1724dnl
1725dnl --enable-cheaders= [does stuff].
1726dnl --disable-cheaders [does not do anything, really].
1727dnl + Usage: GLIBCXX_ENABLE_CHEADERS[(DEFAULT)]
af13a7a6 1728dnl Where DEFAULT is either 'c' or 'c_std' or 'c_global'.
ff66d28f 1729dnl
f214923c 1730AC_DEFUN([GLIBCXX_ENABLE_CHEADERS], [
b453ace3 1731 GLIBCXX_ENABLE(cheaders,$1,[[[=KIND]]],
af13a7a6 1732 [construct "C" headers for g++], [permit c|c_std|c_global])
ff66d28f
PE
1733 AC_MSG_NOTICE("C" header strategy set to $enable_cheaders)
1734
1735 C_INCLUDE_DIR='${glibcxx_srcdir}/include/'$enable_cheaders
1736
af13a7a6
BK
1737 # Allow overrides to configure.host here.
1738 if test $enable_cheaders = c_global; then
1739 c_compatibility=yes
1740 fi
1741
ff66d28f 1742 AC_SUBST(C_INCLUDE_DIR)
92eabea2
PE
1743 GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C, test $enable_cheaders = c)
1744 GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C_STD, test $enable_cheaders = c_std)
af13a7a6 1745 GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C_GLOBAL, test $enable_cheaders = c_global)
92eabea2 1746 GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_COMPATIBILITY, test $c_compatibility = yes)
ff66d28f
PE
1747])
1748
1749
0214010c 1750dnl
ff66d28f
PE
1751dnl Check for which locale library to use. The choice is mapped to
1752dnl a subdirectory of config/locale.
37bc6ca2 1753dnl
ff66d28f 1754dnl Default is generic.
0214010c 1755dnl
f214923c 1756AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
b453ace3 1757 GLIBCXX_ENABLE(clocale,auto,[[[=MODEL]]],
ff66d28f
PE
1758 [use MODEL for target locale package],
1759 [permit generic|gnu|ieee_1003.1-2001|yes|no|auto])
0258dc3a
BK
1760
1761 # Deal with gettext issues. Default to not using it (=no) until we detect
1762 # support for it later. Let the user turn it off via --e/d, but let that
1763 # default to on for easier handling.
1764 USE_NLS=no
1765 AC_ARG_ENABLE(nls,
1766 AC_HELP_STRING([--enable-nls],[use Native Language Support (default)]),
1767 [],
1768 [enable_nls=yes])
b329dd10 1769
0258dc3a 1770 # Either a known packaage, or "auto"
ff66d28f
PE
1771 if test $enable_clocale = no || test $enable_clocale = yes; then
1772 enable_clocale=auto
1773 fi
0214010c
BK
1774 enable_clocale_flag=$enable_clocale
1775
0258dc3a 1776 # Probe for locale model to use if none specified.
ff66d28f
PE
1777 # Default to "generic".
1778 if test $enable_clocale_flag = auto; then
7d3998a4
PE
1779 case ${target_os} in
1780 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
b329dd10
BK
1781 enable_clocale_flag=gnu
1782 ;;
a7f7b334 1783 darwin* | freebsd*)
b329dd10 1784 enable_clocale_flag=darwin
f9686024 1785 ;;
56deb74c 1786 *)
b329dd10
BK
1787 enable_clocale_flag=generic
1788 ;;
56deb74c
BK
1789 esac
1790 fi
1791
0258dc3a
BK
1792 # Sanity check model, and test for special functionality.
1793 if test $enable_clocale_flag = gnu; then
1794 AC_EGREP_CPP([_GLIBCXX_ok], [
1795 #include <features.h>
22b36782 1796 #if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined(__UCLIBC__)
0258dc3a
BK
1797 _GLIBCXX_ok
1798 #endif
1799 ], enable_clocale_flag=gnu, enable_clocale_flag=generic)
1800
0258dc3a 1801 # Set it to scream when it hurts.
b329dd10 1802 ac_save_CFLAGS="$CFLAGS"
0258dc3a
BK
1803 CFLAGS="-Wimplicit-function-declaration -Werror"
1804
1805 # Use strxfrm_l if available.
1806 AC_TRY_COMPILE([#define _GNU_SOURCE 1
1807 #include <string.h>
1808 #include <locale.h>],
b329dd10
BK
1809 [char s[128]; __locale_t loc; strxfrm_l(s, "C", 5, loc);],
1810 AC_DEFINE(HAVE_STRXFRM_L, 1,
1811 [Define if strxfrm_l is available in <string.h>.]),)
1812
0258dc3a
BK
1813 # Use strerror_l if available.
1814 AC_TRY_COMPILE([#define _GNU_SOURCE 1
1815 #include <string.h>
1816 #include <locale.h>],
b329dd10
BK
1817 [__locale_t loc; strerror_l(5, loc);],
1818 AC_DEFINE(HAVE_STRERROR_L, 1,
1819 [Define if strerror_l is available in <string.h>.]),)
0258dc3a
BK
1820
1821 CFLAGS="$ac_save_CFLAGS"
1822 fi
1823
1824 # Perhaps use strerror_r if available, and strerror_l isn't.
b329dd10 1825 ac_save_CFLAGS="$CFLAGS"
0258dc3a
BK
1826 CFLAGS="-Wimplicit-function-declaration -Werror"
1827 AC_TRY_COMPILE([#define _GNU_SOURCE 1
1828 #include <string.h>
1829 #include <locale.h>],
b329dd10
BK
1830 [char s[128]; strerror_r(5, s, 128);],
1831 AC_DEFINE(HAVE_STRERROR_R, 1,
1832 [Define if strerror_r is available in <string.h>.]),)
0258dc3a 1833 CFLAGS="$ac_save_CFLAGS"
501e321e 1834
ff66d28f 1835 # Set configure bits for specified locale package
0258dc3a 1836 AC_MSG_CHECKING([for C locale to use])
ff66d28f
PE
1837 case ${enable_clocale_flag} in
1838 generic)
33590f13
BK
1839 AC_MSG_RESULT(generic)
1840
1fa4bed7
BK
1841 CLOCALE_H=config/locale/generic/c_locale.h
1842 CLOCALE_CC=config/locale/generic/c_locale.cc
38cca750 1843 CCODECVT_CC=config/locale/generic/codecvt_members.cc
1fa4bed7
BK
1844 CCOLLATE_CC=config/locale/generic/collate_members.cc
1845 CCTYPE_CC=config/locale/generic/ctype_members.cc
1846 CMESSAGES_H=config/locale/generic/messages_members.h
1847 CMESSAGES_CC=config/locale/generic/messages_members.cc
1848 CMONEY_CC=config/locale/generic/monetary_members.cc
1849 CNUMERIC_CC=config/locale/generic/numeric_members.cc
1c26d8fd 1850 CTIME_H=config/locale/generic/time_members.h
1fa4bed7 1851 CTIME_CC=config/locale/generic/time_members.cc
89671b70 1852 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
33590f13 1853 ;;
f9686024 1854 darwin)
a7f7b334 1855 AC_MSG_RESULT(darwin or freebsd)
f9686024
GK
1856
1857 CLOCALE_H=config/locale/generic/c_locale.h
1858 CLOCALE_CC=config/locale/generic/c_locale.cc
f9686024
GK
1859 CCODECVT_CC=config/locale/generic/codecvt_members.cc
1860 CCOLLATE_CC=config/locale/generic/collate_members.cc
1861 CCTYPE_CC=config/locale/darwin/ctype_members.cc
1862 CMESSAGES_H=config/locale/generic/messages_members.h
1863 CMESSAGES_CC=config/locale/generic/messages_members.cc
1864 CMONEY_CC=config/locale/generic/monetary_members.cc
1865 CNUMERIC_CC=config/locale/generic/numeric_members.cc
1866 CTIME_H=config/locale/generic/time_members.h
1867 CTIME_CC=config/locale/generic/time_members.cc
1868 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
1869 ;;
b329dd10 1870
ff66d28f 1871 gnu)
0214010c 1872 AC_MSG_RESULT(gnu)
33590f13
BK
1873
1874 # Declare intention to use gettext, and add support for specific
1875 # languages.
248a9163 1876 # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
33590f13 1877 ALL_LINGUAS="de fr"
501e321e 1878
248a9163 1879 # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
501e321e
BK
1880 AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
1881 if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
b329dd10 1882 USE_NLS=yes
501e321e 1883 fi
33590f13
BK
1884 # Export the build objects.
1885 for ling in $ALL_LINGUAS; do \
b329dd10
BK
1886 glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
1887 glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
33590f13 1888 done
3d7c150e
BK
1889 AC_SUBST(glibcxx_MOFILES)
1890 AC_SUBST(glibcxx_POFILES)
33590f13 1891
1fa4bed7
BK
1892 CLOCALE_H=config/locale/gnu/c_locale.h
1893 CLOCALE_CC=config/locale/gnu/c_locale.cc
38cca750 1894 CCODECVT_CC=config/locale/gnu/codecvt_members.cc
1fa4bed7
BK
1895 CCOLLATE_CC=config/locale/gnu/collate_members.cc
1896 CCTYPE_CC=config/locale/gnu/ctype_members.cc
1897 CMESSAGES_H=config/locale/gnu/messages_members.h
1898 CMESSAGES_CC=config/locale/gnu/messages_members.cc
1899 CMONEY_CC=config/locale/gnu/monetary_members.cc
1900 CNUMERIC_CC=config/locale/gnu/numeric_members.cc
1c26d8fd 1901 CTIME_H=config/locale/gnu/time_members.h
1fa4bed7 1902 CTIME_CC=config/locale/gnu/time_members.cc
89671b70 1903 CLOCALE_INTERNAL_H=config/locale/gnu/c++locale_internal.h
0214010c 1904 ;;
ff66d28f 1905 ieee_1003.1-2001)
7f78b6ca 1906 AC_MSG_RESULT(IEEE 1003.1)
33590f13 1907
1fa4bed7
BK
1908 CLOCALE_H=config/locale/ieee_1003.1-2001/c_locale.h
1909 CLOCALE_CC=config/locale/ieee_1003.1-2001/c_locale.cc
38cca750 1910 CCODECVT_CC=config/locale/generic/codecvt_members.cc
1fa4bed7
BK
1911 CCOLLATE_CC=config/locale/generic/collate_members.cc
1912 CCTYPE_CC=config/locale/generic/ctype_members.cc
1913 CMESSAGES_H=config/locale/ieee_1003.1-2001/messages_members.h
1914 CMESSAGES_CC=config/locale/ieee_1003.1-2001/messages_members.cc
1915 CMONEY_CC=config/locale/generic/monetary_members.cc
1916 CNUMERIC_CC=config/locale/generic/numeric_members.cc
1c26d8fd 1917 CTIME_H=config/locale/generic/time_members.h
1fa4bed7 1918 CTIME_CC=config/locale/generic/time_members.cc
89671b70 1919 CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
0214010c 1920 ;;
0214010c
BK
1921 esac
1922
33590f13
BK
1923 # This is where the testsuite looks for locale catalogs, using the
1924 # -DLOCALEDIR define during testsuite compilation.
3d7c150e
BK
1925 glibcxx_localedir=${glibcxx_builddir}/po/share/locale
1926 AC_SUBST(glibcxx_localedir)
33590f13 1927
7f78b6ca
PE
1928 # A standalone libintl (e.g., GNU libintl) may be in use.
1929 if test $USE_NLS = yes; then
c67528fe
PE
1930 AC_CHECK_HEADERS([libintl.h], [], USE_NLS=no)
1931 AC_SEARCH_LIBS(gettext, intl, [], USE_NLS=no)
1932 fi
1933 if test $USE_NLS = yes; then
b329dd10
BK
1934 AC_DEFINE(_GLIBCXX_USE_NLS, 1,
1935 [Define if NLS translations are to be used.])
7f78b6ca
PE
1936 fi
1937
4e10943d 1938 AC_SUBST(USE_NLS)
4a9d5109 1939 AC_SUBST(CLOCALE_H)
33590f13 1940 AC_SUBST(CMESSAGES_H)
6aa43d99
BK
1941 AC_SUBST(CCODECVT_CC)
1942 AC_SUBST(CCOLLATE_CC)
1943 AC_SUBST(CCTYPE_CC)
1944 AC_SUBST(CMESSAGES_CC)
1945 AC_SUBST(CMONEY_CC)
1946 AC_SUBST(CNUMERIC_CC)
1c26d8fd 1947 AC_SUBST(CTIME_H)
6aa43d99
BK
1948 AC_SUBST(CTIME_CC)
1949 AC_SUBST(CLOCALE_CC)
1950 AC_SUBST(CLOCALE_INTERNAL_H)
0214010c
BK
1951])
1952
1953
8b0d6051
BK
1954dnl
1955dnl Check for which std::allocator base class to use. The choice is
1956dnl mapped from a subdirectory of include/ext.
1957dnl
1958dnl Default is new.
1959dnl
1960AC_DEFUN([GLIBCXX_ENABLE_ALLOCATOR], [
347669a0 1961 AC_MSG_CHECKING([for std::allocator base class])
b453ace3 1962 GLIBCXX_ENABLE(libstdcxx-allocator,auto,[[[=KIND]]],
8b0d6051 1963 [use KIND for target std::allocator base],
29d4adf4 1964 [permit new|malloc|mt|bitmap|pool|yes|no|auto])
7d3998a4 1965
8b0d6051
BK
1966 # If they didn't use this option switch, or if they specified --enable
1967 # with no specific model, we'll have to look for one. If they
1968 # specified --disable (???), do likewise.
7d3998a4
PE
1969 if test $enable_libstdcxx_allocator = no ||
1970 test $enable_libstdcxx_allocator = yes;
1971 then
8b0d6051
BK
1972 enable_libstdcxx_allocator=auto
1973 fi
1974
780028b6
BK
1975 # Either a known package, or "auto". Auto implies the default choice
1976 # for a particular platform.
8b0d6051
BK
1977 enable_libstdcxx_allocator_flag=$enable_libstdcxx_allocator
1978
1979 # Probe for host-specific support if no specific model is specified.
1980 # Default to "new".
1981 if test $enable_libstdcxx_allocator_flag = auto; then
1982 case ${target_os} in
780028b6 1983 linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu)
b329dd10
BK
1984 enable_libstdcxx_allocator_flag=new
1985 ;;
8b0d6051 1986 *)
b329dd10
BK
1987 enable_libstdcxx_allocator_flag=new
1988 ;;
8b0d6051
BK
1989 esac
1990 fi
1991 AC_MSG_RESULT($enable_libstdcxx_allocator_flag)
b329dd10 1992
8b0d6051
BK
1993
1994 # Set configure bits for specified locale package
1995 case ${enable_libstdcxx_allocator_flag} in
1996 bitmap)
1997 ALLOCATOR_H=config/allocator/bitmap_allocator_base.h
1998 ALLOCATOR_NAME=__gnu_cxx::bitmap_allocator
1999 ;;
2000 malloc)
2001 ALLOCATOR_H=config/allocator/malloc_allocator_base.h
2002 ALLOCATOR_NAME=__gnu_cxx::malloc_allocator
2003 ;;
2004 mt)
2005 ALLOCATOR_H=config/allocator/mt_allocator_base.h
2006 ALLOCATOR_NAME=__gnu_cxx::__mt_alloc
2007 ;;
2008 new)
2009 ALLOCATOR_H=config/allocator/new_allocator_base.h
2010 ALLOCATOR_NAME=__gnu_cxx::new_allocator
2011 ;;
29d4adf4
PC
2012 pool)
2013 ALLOCATOR_H=config/allocator/pool_allocator_base.h
2014 ALLOCATOR_NAME=__gnu_cxx::__pool_alloc
b329dd10 2015 ;;
8b0d6051
BK
2016 esac
2017
2018 AC_SUBST(ALLOCATOR_H)
2019 AC_SUBST(ALLOCATOR_NAME)
2020])
2021
2022
b2dad0e3 2023dnl
ff66d28f
PE
2024dnl Check for whether the Boost-derived checks should be turned on.
2025dnl
2026dnl --enable-concept-checks turns them on.
2027dnl --disable-concept-checks leaves them off.
2028dnl + Usage: GLIBCXX_ENABLE_CONCEPT_CHECKS[(DEFAULT)]
2029dnl Where DEFAULT is either `yes' or `no'.
2030dnl
f214923c 2031AC_DEFUN([GLIBCXX_ENABLE_CONCEPT_CHECKS], [
ff66d28f
PE
2032 GLIBCXX_ENABLE(concept-checks,$1,,[use Boost-derived template checks])
2033 if test $enable_concept_checks = yes; then
4651e622 2034 AC_DEFINE(_GLIBCXX_CONCEPT_CHECKS, 1,
b329dd10 2035 [Define to use concept checking code from the boost libraries.])
ff66d28f
PE
2036 fi
2037])
2038
ed4f96af
BK
2039dnl
2040dnl Use extern templates.
2041dnl
2042dnl --enable-extern-template defines _GLIBCXX_EXTERN_TEMPLATE to 1
2043dnl --disable-extern-template defines _GLIBCXX_EXTERN_TEMPLATE to 0
2044
2045dnl + Usage: GLIBCXX_ENABLE_TEMPLATE[(DEFAULT)]
2046dnl Where DEFAULT is `yes' or `no'.
2047dnl
2048AC_DEFUN([GLIBCXX_ENABLE_EXTERN_TEMPLATE], [
2049
2050 GLIBCXX_ENABLE(extern-template,$1,,[enable extern template])
2051
2052 AC_MSG_CHECKING([for extern template support])
2053 AC_MSG_RESULT([$enable_extern_template])
2054
2055 GLIBCXX_CONDITIONAL(ENABLE_EXTERN_TEMPLATE, test $enable_extern_template = yes)
2056])
2057
c2ba9709
JS
2058dnl
2059dnl Check for parallel mode pre-requisites, including OpenMP support.
2060dnl
2061dnl + Usage: GLIBCXX_ENABLE_PARALLEL
2062dnl
2063AC_DEFUN([GLIBCXX_ENABLE_PARALLEL], [
2064
2065 enable_parallel=no;
6995087d 2066
0aec205c
BK
2067 # See if configured libgomp/omp.h exists. (libgomp may be in
2068 # noconfigdirs but not explicitly disabled.)
aae29963 2069 if echo " ${TARGET_CONFIGDIRS} " | grep " libgomp " > /dev/null 2>&1 ; then
0aec205c
BK
2070 enable_parallel=yes;
2071 else
aae29963 2072 AC_MSG_NOTICE([target-libgomp not built])
c2ba9709
JS
2073 fi
2074
2075 AC_MSG_CHECKING([for parallel mode support])
2076 AC_MSG_RESULT([$enable_parallel])
2077 GLIBCXX_CONDITIONAL(ENABLE_PARALLEL, test $enable_parallel = yes)
2078])
2079
ff66d28f 2080
b2dad0e3 2081dnl
ff66d28f 2082dnl Check for which I/O library to use: stdio, or something specific.
37bc6ca2 2083dnl
ff66d28f 2084dnl Default is stdio.
b2dad0e3 2085dnl
f214923c 2086AC_DEFUN([GLIBCXX_ENABLE_CSTDIO], [
ff66d28f 2087 AC_MSG_CHECKING([for underlying I/O to use])
b453ace3 2088 GLIBCXX_ENABLE(cstdio,stdio,[[[=PACKAGE]]],
ff66d28f
PE
2089 [use target-specific I/O package], [permit stdio])
2090
2091 # Now that libio has been removed, you can have any color you want as long
2092 # as it's black. This is one big no-op until other packages are added, but
2093 # showing the framework never hurts.
2094 case ${enable_cstdio} in
2095 stdio)
33590f13
BK
2096 CSTDIO_H=config/io/c_io_stdio.h
2097 BASIC_FILE_H=config/io/basic_file_stdio.h
2098 BASIC_FILE_CC=config/io/basic_file_stdio.cc
9717c75c 2099 AC_MSG_RESULT(stdio)
dd75251f 2100 ;;
b2dad0e3 2101 esac
cc5112c9 2102
4a9d5109
SW
2103 AC_SUBST(CSTDIO_H)
2104 AC_SUBST(BASIC_FILE_H)
6aa43d99 2105 AC_SUBST(BASIC_FILE_CC)
b2dad0e3
BK
2106])
2107
2108
9e57d5ca 2109dnl
ff66d28f 2110dnl Check for "unusual" flags to pass to the compiler while building.
9e57d5ca 2111dnl
ff66d28f
PE
2112dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing
2113dnl experimental flags such as -fpch, -fIMI, -Dfloat=char, etc.
2114dnl --disable-cxx-flags passes nothing.
2115dnl + See http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00131.html
2116dnl http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00284.html
2117dnl http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00035.html
2118dnl + Usage: GLIBCXX_ENABLE_CXX_FLAGS(default flags)
2119dnl If "default flags" is an empty string, the effect is the same
2120dnl as --disable or --enable=no.
44f0760e 2121dnl
f214923c 2122AC_DEFUN([GLIBCXX_ENABLE_CXX_FLAGS], [dnl
ff66d28f
PE
2123 AC_MSG_CHECKING([for extra compiler flags for building])
2124 GLIBCXX_ENABLE(cxx-flags,$1,[=FLAGS],
2125 [pass compiler FLAGS when building library],
2126 [case "x$enable_cxx_flags" in
2127 xno | x) enable_cxx_flags= ;;
2128 x-*) ;;
2129 *) AC_MSG_ERROR(_g_switch needs compiler flags as arguments) ;;
2130 esac])
2131
2132 # Run through flags (either default or command-line) and set anything
2133 # extra (e.g., #defines) that must accompany particular g++ options.
2134 if test -n "$enable_cxx_flags"; then
2135 for f in $enable_cxx_flags; do
2136 case "$f" in
b329dd10
BK
2137 -fhonor-std) ;;
2138 -*) ;;
2139 *) # and we're trying to pass /what/ exactly?
2140 AC_MSG_ERROR([compiler flags start with a -]) ;;
ff66d28f
PE
2141 esac
2142 done
44f0760e
BK
2143 fi
2144
ff66d28f
PE
2145 EXTRA_CXX_FLAGS="$enable_cxx_flags"
2146 AC_MSG_RESULT($EXTRA_CXX_FLAGS)
2147 AC_SUBST(EXTRA_CXX_FLAGS)
9e57d5ca
BK
2148])
2149
ff66d28f 2150
ff66d28f
PE
2151dnl
2152dnl Check to see if debugging libraries are to be built.
2153dnl
2154dnl --enable-libstdcxx-debug
2155dnl builds a separate set of debugging libraries in addition to the
2156dnl normal (shared, static) libstdc++ binaries.
2157dnl
2158dnl --disable-libstdcxx-debug
2159dnl builds only one (non-debug) version of libstdc++.
2160dnl
2161dnl --enable-libstdcxx-debug-flags=FLAGS
2162dnl iff --enable-debug == yes, then use FLAGS to build the debug library.
2163dnl
2164dnl + Usage: GLIBCXX_ENABLE_DEBUG[(DEFAULT)]
2165dnl Where DEFAULT is either `yes' or `no'.
2166dnl
f214923c 2167AC_DEFUN([GLIBCXX_ENABLE_DEBUG], [
ff66d28f
PE
2168 AC_MSG_CHECKING([for additional debug build])
2169 GLIBCXX_ENABLE(libstdcxx-debug,$1,,[build extra debug library])
2170 AC_MSG_RESULT($enable_libstdcxx_debug)
92eabea2 2171 GLIBCXX_CONDITIONAL(GLIBCXX_BUILD_DEBUG, test $enable_libstdcxx_debug = yes)
b2dad0e3
BK
2172])
2173
2174
52a11cbf 2175dnl
ff66d28f 2176dnl Check for explicit debug flags.
52a11cbf 2177dnl
ff66d28f
PE
2178dnl --enable-libstdcxx-debug-flags='-O1'
2179dnl is a general method for passing flags to be used when
2180dnl building debug libraries with --enable-debug.
52a11cbf 2181dnl
ff66d28f
PE
2182dnl --disable-libstdcxx-debug-flags does nothing.
2183dnl + Usage: GLIBCXX_ENABLE_DEBUG_FLAGS(default flags)
2184dnl If "default flags" is an empty string, the effect is the same
2185dnl as --disable or --enable=no.
2186dnl
f214923c 2187AC_DEFUN([GLIBCXX_ENABLE_DEBUG_FLAGS], [
ff66d28f
PE
2188 GLIBCXX_ENABLE(libstdcxx-debug-flags,[$1],[=FLAGS],
2189 [pass compiler FLAGS when building debug library],
2190 [case "x$enable_libstdcxx_debug_flags" in
2191 xno | x) enable_libstdcxx_debug_flags= ;;
2192 x-*) ;;
2193 *) AC_MSG_ERROR(_g_switch needs compiler flags as arguments) ;;
2194 esac])
2195
2196 # Option parsed, now set things appropriately
2197 DEBUG_FLAGS="$enable_libstdcxx_debug_flags"
2198 AC_SUBST(DEBUG_FLAGS)
2199
2200 AC_MSG_NOTICE([Debug build flags set to $DEBUG_FLAGS])
52a11cbf
RH
2201])
2202
2203
92eabea2
PE
2204dnl
2205dnl Check if the user only wants a freestanding library implementation.
2206dnl
2207dnl --disable-hosted-libstdcxx will turn off most of the library build,
2208dnl installing only the headers required by [17.4.1.3] and the language
2209dnl support library. More than that will be built (to keep the Makefiles
2210dnl conveniently clean), but not installed.
2211dnl
2212dnl Sets:
2213dnl is_hosted (yes/no)
2214dnl
3660e02f
PE
2215dnl Defines:
2216dnl _GLIBCXX_HOSTED (always defined, either to 1 or 0)
2217dnl
f214923c 2218AC_DEFUN([GLIBCXX_ENABLE_HOSTED], [
92eabea2
PE
2219 AC_ARG_ENABLE([hosted-libstdcxx],
2220 AC_HELP_STRING([--disable-hosted-libstdcxx],
b329dd10 2221 [only build freestanding C++ runtime support]),,
4c24b21a 2222 [case "$host" in
b329dd10 2223 arm*-*-symbianelf*)
4c24b21a
MM
2224 enable_hosted_libstdcxx=no
2225 ;;
b329dd10 2226 *)
4c24b21a
MM
2227 enable_hosted_libstdcxx=yes
2228 ;;
2229 esac])
92eabea2
PE
2230 if test "$enable_hosted_libstdcxx" = no; then
2231 AC_MSG_NOTICE([Only freestanding libraries will be built])
2232 is_hosted=no
3660e02f 2233 hosted_define=0
92eabea2
PE
2234 enable_abi_check=no
2235 enable_libstdcxx_pch=no
2236 else
2237 is_hosted=yes
3660e02f 2238 hosted_define=1
92eabea2
PE
2239 fi
2240 GLIBCXX_CONDITIONAL(GLIBCXX_HOSTED, test $is_hosted = yes)
3660e02f
PE
2241 AC_DEFINE_UNQUOTED(_GLIBCXX_HOSTED, $hosted_define,
2242 [Define to 1 if a full hosted library is built, or 0 if freestanding.])
92eabea2
PE
2243])
2244
2245
6c3a9f72 2246dnl
347669a0 2247dnl Check for template specializations for the 'long long' type.
22248545
PE
2248dnl The result determines only whether 'long long' I/O is enabled; things
2249dnl like numeric_limits<> specializations are always available.
6c3a9f72 2250dnl
3d7c150e
BK
2251dnl --enable-long-long defines _GLIBCXX_USE_LONG_LONG
2252dnl --disable-long-long leaves _GLIBCXX_USE_LONG_LONG undefined
2253dnl + Usage: GLIBCXX_ENABLE_LONG_LONG[(DEFAULT)]
ff66d28f 2254dnl Where DEFAULT is either `yes' or `no'.
6c3a9f72 2255dnl
f214923c 2256AC_DEFUN([GLIBCXX_ENABLE_LONG_LONG], [
347669a0 2257 GLIBCXX_ENABLE(long-long,$1,,[enable template specializations for 'long long'])
ff66d28f 2258 if test $enable_long_long = yes; then
b329dd10
BK
2259 AC_DEFINE(_GLIBCXX_USE_LONG_LONG, 1,
2260 [Define if code specialized for long long should be used.])
6c3a9f72 2261 fi
347669a0
BK
2262 AC_MSG_CHECKING([for enabled long long specializations])
2263 AC_MSG_RESULT([$enable_long_long])
2264])
2265
2266
4cdc8761
BK
2267dnl
2268dnl Check for decimal floating point.
2269dnl See:
2270dnl http://gcc.gnu.org/onlinedocs/gcc/Decimal-Float.html#Decimal-Float
2271dnl
2272dnl This checks to see if the host supports decimal floating point types.
2273dnl
2274dnl Defines:
2275dnl _GLIBCXX_USE_DECIMAL_FLOAT
2276dnl
2277AC_DEFUN([GLIBCXX_ENABLE_DECIMAL_FLOAT], [
2278
2279 # Fake what AC_TRY_COMPILE does, without linking as this is
2280 # unnecessary for this test.
2281
2282 cat > conftest.$ac_ext << EOF
2283[#]line __oline__ "configure"
2284int main()
2285{
2286 _Decimal32 d1;
2287 _Decimal64 d2;
2288 _Decimal128 d3;
2289 return 0;
2290}
2291EOF
2292
2293 AC_MSG_CHECKING([for ISO/IEC TR 24733 ])
2294 if AC_TRY_EVAL(ac_compile); then
2295 AC_DEFINE(_GLIBCXX_USE_DECIMAL_FLOAT, 1,
2296 [Define if ISO/IEC TR 24733 decimal floating point types are supported on this host.])
2297 enable_dfp=yes
2298 else
2299 enable_dfp=no
2300 fi
2301 AC_MSG_RESULT($enable_dfp)
2302 rm -f conftest*
2303])
2304
347669a0
BK
2305dnl
2306dnl Check for template specializations for the 'wchar_t' type.
2307dnl
2308dnl --enable-wchar_t defines _GLIBCXX_USE_WCHAR_T
2309dnl --disable-wchar_t leaves _GLIBCXX_USE_WCHAR_T undefined
2310dnl + Usage: GLIBCXX_ENABLE_WCHAR_T[(DEFAULT)]
2311dnl Where DEFAULT is either `yes' or `no'.
2312dnl
8a9b2875 2313dnl Necessary support must also be present.
347669a0
BK
2314dnl
2315AC_DEFUN([GLIBCXX_ENABLE_WCHAR_T], [
2316 GLIBCXX_ENABLE(wchar_t,$1,,[enable template specializations for 'wchar_t'])
8a9b2875
PC
2317
2318 # Test wchar.h for mbstate_t, which is needed for char_traits and fpos.
2319 AC_CHECK_HEADERS(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no)
2320 AC_MSG_CHECKING([for mbstate_t])
2321 AC_TRY_COMPILE([#include <wchar.h>],
2322 [mbstate_t teststate;],
2323 have_mbstate_t=yes, have_mbstate_t=no)
2324 AC_MSG_RESULT($have_mbstate_t)
2325 if test x"$have_mbstate_t" = xyes; then
2326 AC_DEFINE(HAVE_MBSTATE_T,1,[Define if mbstate_t exists in wchar.h.])
2327 fi
2328
d814595c
PC
2329 # Test it always, for use in GLIBCXX_ENABLE_C99, together with
2330 # ac_has_wchar_h.
2331 AC_CHECK_HEADERS(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no)
b329dd10 2332
8a9b2875
PC
2333 if test x"$enable_wchar_t" = x"yes"; then
2334
2335 AC_LANG_SAVE
2336 AC_LANG_CPLUSPLUS
b329dd10 2337
8a9b2875
PC
2338 if test x"$ac_has_wchar_h" = xyes &&
2339 test x"$ac_has_wctype_h" = xyes; then
2340 AC_TRY_COMPILE([#include <wchar.h>
b329dd10
BK
2341 #include <stddef.h>
2342 wint_t i;
8a9b2875
PC
2343 long l = WEOF;
2344 long j = WCHAR_MIN;
2345 long k = WCHAR_MAX;
b329dd10
BK
2346 namespace test
2347 {
8a9b2875
PC
2348 using ::btowc;
2349 using ::fgetwc;
2350 using ::fgetws;
2351 using ::fputwc;
2352 using ::fputws;
2353 using ::fwide;
b329dd10 2354 using ::fwprintf;
8a9b2875
PC
2355 using ::fwscanf;
2356 using ::getwc;
2357 using ::getwchar;
b329dd10
BK
2358 using ::mbrlen;
2359 using ::mbrtowc;
2360 using ::mbsinit;
2361 using ::mbsrtowcs;
8a9b2875
PC
2362 using ::putwc;
2363 using ::putwchar;
b329dd10
BK
2364 using ::swprintf;
2365 using ::swscanf;
8a9b2875 2366 using ::ungetwc;
b329dd10
BK
2367 using ::vfwprintf;
2368 using ::vswprintf;
2369 using ::vwprintf;
2370 using ::wcrtomb;
2371 using ::wcscat;
2372 using ::wcschr;
2373 using ::wcscmp;
2374 using ::wcscoll;
2375 using ::wcscpy;
2376 using ::wcscspn;
2377 using ::wcsftime;
8a9b2875 2378 using ::wcslen;
b329dd10
BK
2379 using ::wcsncat;
2380 using ::wcsncmp;
2381 using ::wcsncpy;
8a9b2875 2382 using ::wcspbrk;
b329dd10
BK
2383 using ::wcsrchr;
2384 using ::wcsrtombs;
2385 using ::wcsspn;
8a9b2875 2386 using ::wcsstr;
b329dd10
BK
2387 using ::wcstod;
2388 using ::wcstok;
8a9b2875 2389 using ::wcstol;
b329dd10
BK
2390 using ::wcstoul;
2391 using ::wcsxfrm;
2392 using ::wctob;
8a9b2875
PC
2393 using ::wmemchr;
2394 using ::wmemcmp;
2395 using ::wmemcpy;
2396 using ::wmemmove;
2397 using ::wmemset;
b329dd10
BK
2398 using ::wprintf;
2399 using ::wscanf;
8a9b2875
PC
2400 }
2401 ],[],[], [enable_wchar_t=no])
2402 else
2403 enable_wchar_t=no
2404 fi
2405
2406 AC_LANG_RESTORE
2407 fi
2408
2409 if test x"$enable_wchar_t" = x"yes"; then
4651e622 2410 AC_DEFINE(_GLIBCXX_USE_WCHAR_T, 1,
b329dd10 2411 [Define if code specialized for wchar_t should be used.])
347669a0 2412 fi
8a9b2875 2413
347669a0
BK
2414 AC_MSG_CHECKING([for enabled wchar_t specializations])
2415 AC_MSG_RESULT([$enable_wchar_t])
6c3a9f72
BK
2416])
2417
2418
99246c90 2419dnl
ff66d28f 2420dnl Check to see if building and using a C++ precompiled header can be done.
72ed2836 2421dnl
ff66d28f
PE
2422dnl --enable-libstdcxx-pch=yes
2423dnl default, this shows intent to use stdc++.h.gch If it looks like it
2424dnl may work, after some light-hearted attempts to puzzle out compiler
2425dnl support, flip bits on in include/Makefile.am
43ba4a58 2426dnl
ff66d28f
PE
2427dnl --disable-libstdcxx-pch
2428dnl turns off attempts to use or build stdc++.h.gch.
fe413112 2429dnl
ff66d28f
PE
2430dnl Substs:
2431dnl glibcxx_PCHFLAGS
fe413112 2432dnl
f214923c 2433AC_DEFUN([GLIBCXX_ENABLE_PCH], [
ff66d28f 2434 GLIBCXX_ENABLE(libstdcxx-pch,$1,,[build pre-compiled libstdc++ headers])
ff66d28f
PE
2435 if test $enable_libstdcxx_pch = yes; then
2436 AC_CACHE_CHECK([for compiler with PCH support],
2437 [glibcxx_cv_prog_CXX_pch],
2438 [ac_save_CXXFLAGS="$CXXFLAGS"
2439 CXXFLAGS="$CXXFLAGS -Werror -Winvalid-pch -Wno-deprecated"
2440 AC_LANG_SAVE
2441 AC_LANG_CPLUSPLUS
2442 echo '#include <math.h>' > conftest.h
2443 if $CXX $CXXFLAGS $CPPFLAGS -x c++-header conftest.h \
b329dd10
BK
2444 -o conftest.h.gch 1>&5 2>&1 &&
2445 echo '#error "pch failed"' > conftest.h &&
2446 echo '#include "conftest.h"' > conftest.cc &&
ff66d28f
PE
2447 $CXX -c $CXXFLAGS $CPPFLAGS conftest.cc 1>&5 2>&1 ;
2448 then
b329dd10 2449 glibcxx_cv_prog_CXX_pch=yes
ff66d28f 2450 else
b329dd10 2451 glibcxx_cv_prog_CXX_pch=no
ff66d28f
PE
2452 fi
2453 rm -f conftest*
2454 CXXFLAGS=$ac_save_CXXFLAGS
2455 AC_LANG_RESTORE
2456 ])
2457 enable_libstdcxx_pch=$glibcxx_cv_prog_CXX_pch
c4c064e7 2458 fi
747d0967 2459
797308b2
BK
2460 AC_MSG_CHECKING([for enabled PCH])
2461 AC_MSG_RESULT([$enable_libstdcxx_pch])
2462
92eabea2 2463 GLIBCXX_CONDITIONAL(GLIBCXX_BUILD_PCH, test $enable_libstdcxx_pch = yes)
ff66d28f 2464 if test $enable_libstdcxx_pch = yes; then
c2ba9709 2465 glibcxx_PCHFLAGS="-include bits/stdc++.h"
c4c064e7 2466 else
ff66d28f 2467 glibcxx_PCHFLAGS=""
bbacb998 2468 fi
ff66d28f 2469 AC_SUBST(glibcxx_PCHFLAGS)
bbacb998
PC
2470])
2471
7cda84dc 2472
701a3eee
BK
2473dnl
2474dnl Check for atomic builtins.
2475dnl See:
2476dnl http://gcc.gnu.org/onlinedocs/gcc/Atomic-Builtins.html#Atomic-Builtins
2477dnl
2478dnl This checks to see if the host supports the compiler-generated
b329dd10 2479dnl builtins for atomic operations for various integral sizes. Note, this
35648b45
BK
2480dnl is intended to be an all-or-nothing switch, so all the atomic operations
2481dnl that are used should be checked.
701a3eee
BK
2482dnl
2483dnl Note:
2cd9cdcc 2484dnl libgomp and libgfortran use a link test, see CHECK_SYNC_FETCH_AND_ADD.
701a3eee
BK
2485dnl
2486dnl Defines:
b329dd10 2487dnl _GLIBCXX_ATOMIC_BUILTINS_1
50ce8d3d 2488dnl _GLIBCXX_ATOMIC_BUILTINS_2
35648b45 2489dnl _GLIBCXX_ATOMIC_BUILTINS_4
50ce8d3d 2490dnl _GLIBCXX_ATOMIC_BUILTINS_8
701a3eee
BK
2491dnl
2492AC_DEFUN([GLIBCXX_ENABLE_ATOMIC_BUILTINS], [
701a3eee
BK
2493 AC_LANG_SAVE
2494 AC_LANG_CPLUSPLUS
35648b45 2495 old_CXXFLAGS="$CXXFLAGS"
2cd9cdcc
PC
2496
2497 # Do link tests if possible, instead asm tests, limited to some platforms
2498 # see discussion in PR target/40134, PR libstdc++/40133 and the thread
2499 # starting at http://gcc.gnu.org/ml/gcc-patches/2009-07/msg00322.html
2500 atomic_builtins_link_tests=no
2501 if test x$gcc_no_link != xyes; then
2502 # Can do link tests. Limit to some tested platforms
2503 case "$host" in
2504 *-*-linux* | *-*-uclinux* | *-*-kfreebsd*-gnu | *-*-gnu*)
2505 atomic_builtins_link_tests=yes
b329dd10 2506 ;;
2cd9cdcc
PC
2507 esac
2508 fi
2509
2510 if test x$atomic_builtins_link_tests = xyes; then
2511
2512 # Do link tests.
2513
2514 CXXFLAGS="$CXXFLAGS -fno-exceptions"
2515
2516 AC_MSG_CHECKING([for atomic builtins for bool])
2517 AC_CACHE_VAL(glibcxx_cv_atomic_bool, [
2518 AC_TRY_LINK(
2519 [ ],
2520 [typedef bool atomic_type;
2521 atomic_type c1;
2522 atomic_type c2;
2523 const atomic_type c3(0);
2524 __sync_fetch_and_add(&c1, c2);
2525 __sync_val_compare_and_swap(&c1, c3, c2);
2526 __sync_lock_test_and_set(&c1, c3);
2527 __sync_lock_release(&c1);
2528 __sync_synchronize();],
2529 [glibcxx_cv_atomic_bool=yes],
2530 [glibcxx_cv_atomic_bool=no])
b329dd10 2531 ])
2cd9cdcc
PC
2532 if test $glibcxx_cv_atomic_bool = yes; then
2533 AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_1, 1,
2534 [Define if builtin atomic operations for bool are supported on this host.])
2535 fi
2536 AC_MSG_RESULT($glibcxx_cv_atomic_bool)
2537
2538 AC_MSG_CHECKING([for atomic builtins for short])
2539 AC_CACHE_VAL(glibcxx_cv_atomic_short, [
2540 AC_TRY_LINK(
2541 [ ],
2542 [typedef short atomic_type;
2543 atomic_type c1;
2544 atomic_type c2;
2545 const atomic_type c3(0);
2546 __sync_fetch_and_add(&c1, c2);
2547 __sync_val_compare_and_swap(&c1, c3, c2);
2548 __sync_lock_test_and_set(&c1, c3);
2549 __sync_lock_release(&c1);
2550 __sync_synchronize();],
2551 [glibcxx_cv_atomic_short=yes],
2552 [glibcxx_cv_atomic_short=no])
b329dd10 2553 ])
2cd9cdcc
PC
2554 if test $glibcxx_cv_atomic_short = yes; then
2555 AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_2, 1,
2556 [Define if builtin atomic operations for short are supported on this host.])
2557 fi
2558 AC_MSG_RESULT($glibcxx_cv_atomic_short)
2559
2560 AC_MSG_CHECKING([for atomic builtins for int])
2561 AC_CACHE_VAL(glibcxx_cv_atomic_int, [
2562 AC_TRY_LINK(
2563 [ ],
2564 [typedef int atomic_type;
2565 atomic_type c1;
2566 atomic_type c2;
2567 const atomic_type c3(0);
2568 __sync_fetch_and_add(&c1, c2);
2569 __sync_val_compare_and_swap(&c1, c3, c2);
2570 __sync_lock_test_and_set(&c1, c3);
2571 __sync_lock_release(&c1);
2572 __sync_synchronize();],
2573 [glibcxx_cv_atomic_int=yes],
2574 [glibcxx_cv_atomic_int=no])
b329dd10 2575 ])
2cd9cdcc
PC
2576 if test $glibcxx_cv_atomic_int = yes; then
2577 AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_4, 1,
2578 [Define if builtin atomic operations for int are supported on this host.])
2579 fi
2580 AC_MSG_RESULT($glibcxx_cv_atomic_int)
2581
2582 AC_MSG_CHECKING([for atomic builtins for long long])
2583 AC_CACHE_VAL(glibcxx_cv_atomic_long_long, [
2584 AC_TRY_LINK(
2585 [ ],
2586 [typedef long long atomic_type;
2587 atomic_type c1;
2588 atomic_type c2;
2589 const atomic_type c3(0);
2590 __sync_fetch_and_add(&c1, c2);
2591 __sync_val_compare_and_swap(&c1, c3, c2);
2592 __sync_lock_test_and_set(&c1, c3);
2593 __sync_lock_release(&c1);
2594 __sync_synchronize();],
2595 [glibcxx_cv_atomic_long_long=yes],
2596 [glibcxx_cv_atomic_long_long=no])
b329dd10 2597 ])
2cd9cdcc
PC
2598 if test $glibcxx_cv_atomic_long_long = yes; then
2599 AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_8, 1,
2600 [Define if builtin atomic operations for long long are supported on this host.])
2601 fi
2602 AC_MSG_RESULT($glibcxx_cv_atomic_long_long)
2603
2604 else
2605
2606 # Do asm tests.
2607
35648b45
BK
2608 # Compile unoptimized.
2609 CXXFLAGS='-O0 -S'
2610
2cd9cdcc 2611 # Fake what AC_TRY_COMPILE does.
701a3eee 2612
701a3eee
BK
2613 cat > conftest.$ac_ext << EOF
2614[#]line __oline__ "configure"
2615int main()
50ce8d3d
BK
2616{
2617 typedef bool atomic_type;
2618 atomic_type c1;
2619 atomic_type c2;
2620 const atomic_type c3(0);
2621 __sync_fetch_and_add(&c1, c2);
2622 __sync_val_compare_and_swap(&c1, c3, c2);
2623 __sync_lock_test_and_set(&c1, c3);
2624 __sync_lock_release(&c1);
2625 __sync_synchronize();
2626 return 0;
2627}
2628EOF
2629
2630 AC_MSG_CHECKING([for atomic builtins for bool])
2631 if AC_TRY_EVAL(ac_compile); then
2632 if grep __sync_ conftest.s >/dev/null 2>&1 ; then
b329dd10 2633 glibcxx_cv_atomic_bool=no
50ce8d3d
BK
2634 else
2635 AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_1, 1,
2636 [Define if builtin atomic operations for bool are supported on this host.])
b329dd10 2637 glibcxx_cv_atomic_bool=yes
50ce8d3d
BK
2638 fi
2639 fi
2cd9cdcc 2640 AC_MSG_RESULT($glibcxx_cv_atomic_bool)
50ce8d3d
BK
2641 rm -f conftest*
2642
2643 cat > conftest.$ac_ext << EOF
2644[#]line __oline__ "configure"
2645int main()
2646{
2647 typedef short atomic_type;
2648 atomic_type c1;
2649 atomic_type c2;
2650 const atomic_type c3(0);
2651 __sync_fetch_and_add(&c1, c2);
2652 __sync_val_compare_and_swap(&c1, c3, c2);
2653 __sync_lock_test_and_set(&c1, c3);
2654 __sync_lock_release(&c1);
2655 __sync_synchronize();
2656 return 0;
2657}
2658EOF
2659
2660 AC_MSG_CHECKING([for atomic builtins for short])
2661 if AC_TRY_EVAL(ac_compile); then
2662 if grep __sync_ conftest.s >/dev/null 2>&1 ; then
b329dd10 2663 glibcxx_cv_atomic_short=no
50ce8d3d
BK
2664 else
2665 AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_2, 1,
2666 [Define if builtin atomic operations for short are supported on this host.])
b329dd10 2667 glibcxx_cv_atomic_short=yes
50ce8d3d
BK
2668 fi
2669 fi
2cd9cdcc 2670 AC_MSG_RESULT($glibcxx_cv_atomic_short)
50ce8d3d
BK
2671 rm -f conftest*
2672
2673 cat > conftest.$ac_ext << EOF
2674[#]line __oline__ "configure"
2675int main()
701a3eee 2676{
b329dd10 2677 // NB: _Atomic_word not necessarily int.
701a3eee
BK
2678 typedef int atomic_type;
2679 atomic_type c1;
2680 atomic_type c2;
2681 const atomic_type c3(0);
35648b45
BK
2682 __sync_fetch_and_add(&c1, c2);
2683 __sync_val_compare_and_swap(&c1, c3, c2);
2684 __sync_lock_test_and_set(&c1, c3);
2685 __sync_lock_release(&c1);
2686 __sync_synchronize();
2687 return 0;
2688}
2689EOF
2690
2691 AC_MSG_CHECKING([for atomic builtins for int])
2692 if AC_TRY_EVAL(ac_compile); then
2693 if grep __sync_ conftest.s >/dev/null 2>&1 ; then
b329dd10 2694 glibcxx_cv_atomic_int=no
35648b45
BK
2695 else
2696 AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_4, 1,
b329dd10
BK
2697 [Define if builtin atomic operations for int are supported on this host.])
2698 glibcxx_cv_atomic_int=yes
35648b45
BK
2699 fi
2700 fi
2cd9cdcc 2701 AC_MSG_RESULT($glibcxx_cv_atomic_int)
35648b45
BK
2702 rm -f conftest*
2703
2704 cat > conftest.$ac_ext << EOF
2705[#]line __oline__ "configure"
2706int main()
2707{
50ce8d3d 2708 typedef long long atomic_type;
35648b45
BK
2709 atomic_type c1;
2710 atomic_type c2;
2711 const atomic_type c3(0);
2712 __sync_fetch_and_add(&c1, c2);
2713 __sync_val_compare_and_swap(&c1, c3, c2);
2714 __sync_lock_test_and_set(&c1, c3);
2715 __sync_lock_release(&c1);
2716 __sync_synchronize();
2717 return 0;
701a3eee
BK
2718}
2719EOF
35648b45 2720
50ce8d3d 2721 AC_MSG_CHECKING([for atomic builtins for long long])
701a3eee 2722 if AC_TRY_EVAL(ac_compile); then
35648b45 2723 if grep __sync_ conftest.s >/dev/null 2>&1 ; then
b329dd10 2724 glibcxx_cv_atomic_long_long=no
701a3eee 2725 else
50ce8d3d
BK
2726 AC_DEFINE(_GLIBCXX_ATOMIC_BUILTINS_8, 1,
2727 [Define if builtin atomic operations for long long are supported on this host.])
b329dd10 2728 glibcxx_cv_atomic_long_long=yes
701a3eee
BK
2729 fi
2730 fi
2cd9cdcc 2731 AC_MSG_RESULT($glibcxx_cv_atomic_long_long)
701a3eee
BK
2732 rm -f conftest*
2733
2cd9cdcc 2734 fi
50ce8d3d 2735
35648b45
BK
2736 CXXFLAGS="$old_CXXFLAGS"
2737 AC_LANG_RESTORE
2738
2739 # Set atomicity_dir to builtins if either of above tests pass.
2cd9cdcc 2740 if test $glibcxx_cv_atomic_int = yes || test $glibcxx_cv_atomic_bool = yes ; then
35648b45
BK
2741 atomicity_dir=cpu/generic/atomicity_builtins
2742 fi
2743
2744 # If still generic, set to mutex.
701a3eee 2745 if test $atomicity_dir = "cpu/generic" ; then
35648b45 2746 atomicity_dir=cpu/generic/atomicity_mutex
6995087d 2747 AC_MSG_WARN([No native atomic operations are provided for this platform.])
dd88bc97 2748 if test "x$target_thread_file" = xsingle; then
b329dd10
BK
2749 AC_MSG_WARN([They cannot be faked when thread support is disabled.])
2750 AC_MSG_WARN([Thread-safety of certain classes is not guaranteed.])
6995087d 2751 else
b329dd10
BK
2752 AC_MSG_WARN([They will be faked using a mutex.])
2753 AC_MSG_WARN([Performance of certain classes will degrade as a result.])
6995087d 2754 fi
701a3eee 2755 fi
35648b45 2756
701a3eee
BK
2757])
2758
2759
bda243ec 2760dnl
ff66d28f
PE
2761dnl Check for exception handling support. If an explicit enable/disable
2762dnl sjlj exceptions is given, we don't have to detect. Otherwise the
2763dnl target may or may not support call frame exceptions.
bda243ec 2764dnl
ff66d28f
PE
2765dnl --enable-sjlj-exceptions forces the use of builtin setjmp.
2766dnl --disable-sjlj-exceptions forces the use of call frame unwinding.
1260d70f 2767dnl Neither one forces an attempt at detection.
4d16bdbb 2768dnl
ff66d28f
PE
2769dnl Defines:
2770dnl _GLIBCXX_SJLJ_EXCEPTIONS if the compiler is configured for it
4d16bdbb 2771dnl
f214923c 2772AC_DEFUN([GLIBCXX_ENABLE_SJLJ_EXCEPTIONS], [
ff66d28f
PE
2773 AC_MSG_CHECKING([for exception model to use])
2774 AC_LANG_SAVE
2775 AC_LANG_CPLUSPLUS
1260d70f 2776 GLIBCXX_ENABLE(sjlj-exceptions,auto,,
ff66d28f 2777 [force use of builtin_setjmp for exceptions],
1260d70f
PE
2778 [permit yes|no|auto])
2779
2780 if test $enable_sjlj_exceptions = auto; then
2781 # Botheration. Now we've got to detect the exception model. Link tests
2782 # against libgcc.a are problematic since we've not been given proper -L
2783 # bits for single-tree newlib and libgloss.
2784 #
2785 # Fake what AC_TRY_COMPILE does. XXX Look at redoing this new-style.
2786 cat > conftest.$ac_ext << EOF
ff66d28f
PE
2787[#]line __oline__ "configure"
2788struct S { ~S(); };
2789void bar();
2790void foo()
2791{
2792 S s;
2793 bar();
2794}
2795EOF
1260d70f
PE
2796 old_CXXFLAGS="$CXXFLAGS"
2797 CXXFLAGS=-S
2798 if AC_TRY_EVAL(ac_compile); then
2799 if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
b329dd10 2800 enable_sjlj_exceptions=yes
1260d70f 2801 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
b329dd10 2802 enable_sjlj_exceptions=no
617a1b71 2803 elif grep __cxa_end_cleanup conftest.s >/dev/null 2>&1 ; then
b329dd10 2804 enable_sjlj_exceptions=no
1260d70f
PE
2805 fi
2806 fi
2807 CXXFLAGS="$old_CXXFLAGS"
2808 rm -f conftest*
2809 fi
2810
cddfb1c7
BK
2811 # This is a tad weird, for hysterical raisins. We have to map
2812 # enable/disable to two different models.
1260d70f
PE
2813 case $enable_sjlj_exceptions in
2814 yes)
2815 AC_DEFINE(_GLIBCXX_SJLJ_EXCEPTIONS, 1,
b329dd10 2816 [Define if the compiler is configured for setjmp/longjmp exceptions.])
1260d70f
PE
2817 ac_exception_model_name=sjlj
2818 ;;
2819 no)
2820 ac_exception_model_name="call frame"
2821 ;;
2822 *)
2823 AC_MSG_ERROR([unable to detect exception model])
2824 ;;
2825 esac
ff66d28f
PE
2826 AC_LANG_RESTORE
2827 AC_MSG_RESULT($ac_exception_model_name)
4d16bdbb
PE
2828])
2829
2830
98e615b4
BK
2831dnl
2832dnl Allow visibility attributes to be used on namespaces, objects, etc.
2833dnl
2834dnl --enable-visibility enables attempt to use visibility attributes.
2835dnl --disable-visibility turns off all use of visibility attributes.
2836dnl + Usage: GLIBCXX_ENABLE_VISIBILITY[(DEFAULT)]
2837dnl Where DEFAULT is 'yes'.
2838dnl
2839AC_DEFUN([GLIBCXX_ENABLE_VISIBILITY], [
2840GLIBCXX_ENABLE(visibility,$1,,[enables visibility safe usage])
2841
2842if test x$enable_visibility = xyes ; then
2843 dnl all hail libgfortran
2844 dnl Check whether the target supports hidden visibility.
2845 AC_CACHE_CHECK([whether the target supports hidden visibility],
6d26724a 2846 glibcxx_cv_have_attribute_visibility, [
98e615b4
BK
2847 save_CFLAGS="$CFLAGS"
2848 CFLAGS="$CFLAGS -Werror"
2849 AC_TRY_COMPILE([void __attribute__((visibility("hidden"))) foo(void) { }],
6d26724a
RW
2850 [], glibcxx_cv_have_attribute_visibility=yes,
2851 glibcxx_cv_have_attribute_visibility=no)
98e615b4 2852 CFLAGS="$save_CFLAGS"])
6d26724a 2853 if test $glibcxx_cv_have_attribute_visibility = no; then
98e615b4
BK
2854 enable_visibility=no
2855 fi
2856fi
2857
2858GLIBCXX_CONDITIONAL(ENABLE_VISIBILITY, test $enable_visibility = yes)
2859AC_MSG_NOTICE([visibility supported: $enable_visibility])
2860])
2861
2862
530539d9
PE
2863dnl
2864dnl Add version tags to symbols in shared library (or not), additionally
2865dnl marking other symbols as private/local (or not).
2866dnl
c98b201b
PE
2867dnl --enable-symvers=style adds a version script to the linker call when
2868dnl creating the shared library. The choice of version script is
2869dnl controlled by 'style'.
530539d9 2870dnl --disable-symvers does not.
3d7c150e 2871dnl + Usage: GLIBCXX_ENABLE_SYMVERS[(DEFAULT)]
ff66d28f
PE
2872dnl Where DEFAULT is either 'yes' or 'no'. Passing `yes' tries to
2873dnl choose a default style based on linker characteristics. Passing
2874dnl 'no' disables versioning.
2875dnl
f214923c 2876AC_DEFUN([GLIBCXX_ENABLE_SYMVERS], [
ff66d28f 2877
b453ace3 2878GLIBCXX_ENABLE(symvers,$1,[[[=STYLE]]],
ff66d28f 2879 [enables symbol versioning of the shared library],
c18dc5cc 2880 [permit yes|no|gnu|gnu-versioned-namespace|darwin|darwin-export|sun])
c98b201b 2881
3d7c150e 2882# If we never went through the GLIBCXX_CHECK_LINKER_FEATURES macro, then we
37bc6ca2 2883# don't know enough about $LD to do tricks...
ff66d28f 2884AC_REQUIRE([GLIBCXX_CHECK_LINKER_FEATURES])
c18dc5cc
RO
2885# Sun style symbol versions needs GNU c++filt for make_sunver.pl to work
2886# with extern "C++" in version scripts.
2887AC_REQUIRE([GCC_PROG_GNU_CXXFILT])
a9fdd472
GK
2888
2889# Turn a 'yes' into a suitable default.
2890if test x$enable_symvers = xyes ; then
4bd726d0 2891 if test $enable_shared = no || test "x$LD" = x || test x$gcc_no_link = xyes; then
a9fdd472 2892 enable_symvers=no
a9fdd472 2893 else
fb5c309d 2894 if test $with_gnu_ld = yes ; then
d89f0ad6 2895 case ${target_os} in
b329dd10
BK
2896 hpux*)
2897 enable_symvers=no ;;
2898 *)
2899 enable_symvers=gnu ;;
d89f0ad6 2900 esac
fb5c309d
BK
2901 else
2902 case ${target_os} in
b329dd10 2903 darwin*)
fb5c309d 2904 enable_symvers=darwin ;;
c18dc5cc
RO
2905 # Sun symbol versioning exists since Solaris 2.5.
2906 solaris2.[[5-9]]* | solaris2.1[[0-9]]*)
2907 # make_sunver.pl needs GNU c++filt to support extern "C++" in
2908 # version scripts, so disable symbol versioning if none can be
2909 # found.
2910 if test -z "$ac_cv_path_CXXFILT"; then
2911 AC_MSG_WARN([=== You have requested Sun symbol versioning, but])
2912 AC_MSG_WARN([=== no GNU c++filt could be found.])
2913 AC_MSG_WARN([=== Symbol versioning will be disabled.])
2914 enable_symvers=no
2915 else
2916 enable_symvers=sun
2917 fi
2918 ;;
b329dd10
BK
2919 *)
2920 enable_symvers=no ;;
fb5c309d
BK
2921 esac
2922 fi
a9fdd472 2923 fi
530539d9 2924fi
c98b201b 2925
fb5c309d
BK
2926# Check to see if 'darwin' or 'darwin-export' can win.
2927if test x$enable_symvers = xdarwin-export ; then
2928 enable_symvers=darwin
2929fi
2930
c18dc5cc
RO
2931# Check if 'sun' was requested on non-Solaris 2 platforms.
2932if test x$enable_symvers = xsun ; then
2933 case ${target_os} in
2934 solaris2*)
2935 # All fine.
2936 ;;
2937 *)
2938 # Unlikely to work.
2939 AC_MSG_WARN([=== You have requested Sun symbol versioning, but])
2940 AC_MSG_WARN([=== you are not targetting Solaris 2.])
2941 AC_MSG_WARN([=== Symbol versioning will be disabled.])
2942 enable_symvers=no
2943 ;;
2944 esac
2945fi
2946
f47bddec 2947# Check to see if 'gnu' can win.
b329dd10
BK
2948if test $enable_symvers = gnu ||
2949 test $enable_symvers = gnu-versioned-namespace ||
c18dc5cc 2950 test $enable_symvers = sun; then
f47bddec 2951 # Check to see if libgcc_s exists, indicating that shared libgcc is possible.
2c839a4e
PE
2952 AC_MSG_CHECKING([for shared libgcc])
2953 ac_save_CFLAGS="$CFLAGS"
2954 CFLAGS=' -lgcc_s'
ff66d28f 2955 AC_TRY_LINK(, [return 0;], glibcxx_shared_libgcc=yes, glibcxx_shared_libgcc=no)
2c839a4e 2956 CFLAGS="$ac_save_CFLAGS"
d5325238
JJ
2957 if test $glibcxx_shared_libgcc = no; then
2958 cat > conftest.c <<EOF
2959int main (void) { return 0; }
2960EOF
2961changequote(,)dnl
2962 glibcxx_libgcc_s_suffix=`${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
2963 -shared -shared-libgcc -o conftest.so \
2964 conftest.c -v 2>&1 >/dev/null \
2965 | sed -n 's/^.* -lgcc_s\([^ ]*\) .*$/\1/p'`
2966changequote([,])dnl
2967 rm -f conftest.c conftest.so
2968 if test x${glibcxx_libgcc_s_suffix+set} = xset; then
2969 CFLAGS=" -lgcc_s$glibcxx_libgcc_s_suffix"
2970 AC_TRY_LINK(, [return 0;], glibcxx_shared_libgcc=yes)
2971 CFLAGS="$ac_save_CFLAGS"
2972 fi
2973 fi
3d7c150e 2974 AC_MSG_RESULT($glibcxx_shared_libgcc)
a9fdd472 2975
a9fdd472
GK
2976 # For GNU ld, we need at least this version. The format is described in
2977 # GLIBCXX_CHECK_LINKER_FEATURES above.
2978 glibcxx_min_gnu_ld_version=21400
c98b201b 2979
f47bddec
GK
2980 # If no shared libgcc, can't win.
2981 if test $glibcxx_shared_libgcc != yes; then
2982 AC_MSG_WARN([=== You have requested GNU symbol versioning, but])
2983 AC_MSG_WARN([=== you are not building a shared libgcc_s.])
2984 AC_MSG_WARN([=== Symbol versioning will be disabled.])
2985 enable_symvers=no
c18dc5cc
RO
2986 elif test $with_gnu_ld != yes && test $enable_symvers = sun; then
2987 : All interesting versions of Sun ld support sun style symbol versioning.
f47bddec 2988 elif test $with_gnu_ld != yes ; then
ab3bc736 2989 # just fail for now
a9fdd472
GK
2990 AC_MSG_WARN([=== You have requested GNU symbol versioning, but])
2991 AC_MSG_WARN([=== you are not using the GNU linker.])
2992 AC_MSG_WARN([=== Symbol versioning will be disabled.])
2993 enable_symvers=no
d60a2d4d
ILT
2994 elif test $glibcxx_ld_is_gold = yes ; then
2995 : All versions of gold support symbol versioning.
a9fdd472
GK
2996 elif test $glibcxx_gnu_ld_version -lt $glibcxx_min_gnu_ld_version ; then
2997 # The right tools, the right setup, but too old. Fallbacks?
2998 AC_MSG_WARN(=== Linker version $glibcxx_gnu_ld_version is too old for)
2999 AC_MSG_WARN(=== full symbol versioning support in this release of GCC.)
3000 AC_MSG_WARN(=== You would need to upgrade your binutils to version)
3001 AC_MSG_WARN(=== $glibcxx_min_gnu_ld_version or later and rebuild GCC.)
58579a27 3002 AC_MSG_WARN([=== Symbol versioning will be disabled.])
ab3bc736
BK
3003 enable_symvers=no
3004 fi
3005fi
3006
ff66d28f 3007# Everything parsed; figure out what file to use.
c98b201b 3008case $enable_symvers in
ab3bc736 3009 no)
fb5c309d 3010 SYMVER_FILE=config/abi/pre/none.ver
ff66d28f 3011 ;;
c98b201b 3012 gnu)
fb5c309d 3013 SYMVER_FILE=config/abi/pre/gnu.ver
b329dd10
BK
3014 AC_DEFINE(_GLIBCXX_SYMVER_GNU, 1,
3015 [Define to use GNU versioning in the shared library.])
a9fdd472 3016 ;;
3cbc7af0
BK
3017 gnu-versioned-namespace)
3018 SYMVER_FILE=config/abi/pre/gnu-versioned-namespace.ver
b329dd10
BK
3019 AC_DEFINE(_GLIBCXX_SYMVER_GNU_NAMESPACE, 1,
3020 [Define to use GNU namespace versioning in the shared library.])
3cbc7af0 3021 ;;
fb5c309d
BK
3022 darwin)
3023 SYMVER_FILE=config/abi/pre/gnu.ver
b329dd10
BK
3024 AC_DEFINE(_GLIBCXX_SYMVER_DARWIN, 1,
3025 [Define to use darwin versioning in the shared library.])
ff66d28f 3026 ;;
c18dc5cc
RO
3027 sun)
3028 SYMVER_FILE=config/abi/pre/gnu.ver
b329dd10
BK
3029 AC_DEFINE(_GLIBCXX_SYMVER_SUN, 1,
3030 [Define to use Sun versioning in the shared library.])
c18dc5cc 3031 ;;
c98b201b
PE
3032esac
3033
fb5c309d
BK
3034if test x$enable_symvers != xno ; then
3035 AC_DEFINE(_GLIBCXX_SYMVER, 1,
3036 [Define to use symbol versioning in the shared library.])
3037fi
3038
1f93f687
JJ
3039AC_CACHE_CHECK([whether the target supports .symver directive],
3040 glibcxx_cv_have_as_symver_directive, [
3041 AC_TRY_COMPILE([void foo (void); __asm (".symver foo, bar@SYMVER");],
3042 [], glibcxx_cv_have_as_symver_directive=yes,
3043 glibcxx_cv_have_as_symver_directive=no)])
3044if test $glibcxx_cv_have_as_symver_directive = yes; then
3045 AC_DEFINE(HAVE_AS_SYMVER_DIRECTIVE, 1,
3046 [Define to 1 if the target assembler supports .symver directive.])
3047fi
3048
fb5c309d
BK
3049AC_SUBST(SYMVER_FILE)
3050AC_SUBST(port_specific_symbol_files)
3051GLIBCXX_CONDITIONAL(ENABLE_SYMVERS, test $enable_symvers != no)
3052GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_GNU, test $enable_symvers = gnu)
3cbc7af0 3053GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_GNU_NAMESPACE, test $enable_symvers = gnu-versioned-namespace)
fb5c309d 3054GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_DARWIN, test $enable_symvers = darwin)
c18dc5cc 3055GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_SUN, test $enable_symvers = sun)
fb5c309d
BK
3056AC_MSG_NOTICE(versioning on shared library symbols is $enable_symvers)
3057
c18dc5cc
RO
3058if test $enable_symvers != no ; then
3059 case ${target_os} in
3060 # The Solaris 2 runtime linker doesn't support the GNU extension of
3061 # binding the same symbol to different versions
3062 solaris2*)
3063 symvers_renaming=no ;;
3064 # Other platforms with GNU symbol versioning (GNU/Linux, more?) do.
3065 *)
8198d541 3066 AC_DEFINE(HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT, 1,
b329dd10 3067 [Define to 1 if the target runtime linker supports binding the same symbol to different versions.])
8198d541 3068 symvers_renaming=yes ;;
c18dc5cc 3069 esac
c0f9d583
RO
3070else
3071 symvers_renaming=no
c18dc5cc
RO
3072fi
3073GLIBCXX_CONDITIONAL(ENABLE_SYMVERS_SOL2, test $symvers_renaming = no)
3074
fb5c309d 3075# Now, set up compatibility support, if any.
bb2b2a24
BK
3076# In addition, need this to deal with std::size_t mangling in
3077# src/compatibility.cc. In a perfect world, could use
3078# typeid(std::size_t).name()[0] to do direct substitution.
3079AC_MSG_CHECKING([for size_t as unsigned int])
3080ac_save_CFLAGS="$CFLAGS"
3081CFLAGS="-Werror"
b329dd10
BK
3082AC_TRY_COMPILE(, [__SIZE_TYPE__* stp; unsigned int* uip; stp = uip;],
3083 [glibcxx_size_t_is_i=yes], [glibcxx_size_t_is_i=no])
bb2b2a24
BK
3084CFLAGS=$ac_save_CFLAGS
3085if test "$glibcxx_size_t_is_i" = yes; then
3086 AC_DEFINE(_GLIBCXX_SIZE_T_IS_UINT, 1, [Define if size_t is unsigned int.])
3087fi
3088AC_MSG_RESULT([$glibcxx_size_t_is_i])
3089
3090AC_MSG_CHECKING([for ptrdiff_t as int])
3091ac_save_CFLAGS="$CFLAGS"
3092CFLAGS="-Werror"
b329dd10
BK
3093AC_TRY_COMPILE(, [__PTRDIFF_TYPE__* ptp; int* ip; ptp = ip;],
3094 [glibcxx_ptrdiff_t_is_i=yes], [glibcxx_ptrdiff_t_is_i=no])
bb2b2a24
BK
3095CFLAGS=$ac_save_CFLAGS
3096if test "$glibcxx_ptrdiff_t_is_i" = yes; then
3097 AC_DEFINE(_GLIBCXX_PTRDIFF_T_IS_INT, 1, [Define if ptrdiff_t is int.])
3098fi
3099AC_MSG_RESULT([$glibcxx_ptrdiff_t_is_i])
ff66d28f
PE
3100])
3101
3102
3103dnl
3104dnl Setup to use the gcc gthr.h thread-specific memory and mutex model.
3105dnl We must stage the required headers so that they will be installed
3106dnl with the library (unlike libgcc, the STL implementation is provided
3107dnl solely within headers). Since we must not inject random user-space
3108dnl macro names into user-provided C++ code, we first stage into <file>-in
3109dnl and process to <file> with an output command. The reason for a two-
3110dnl stage process here is to correctly handle $srcdir!=$objdir without
3111dnl having to write complex code (the sed commands to clean the macro
3112dnl namespace are complex and fragile enough as it is). We must also
3113dnl add a relative path so that -I- is supported properly.
3114dnl
3115dnl Substs:
3116dnl glibcxx_thread_h
3117dnl
3118dnl Defines:
3119dnl HAVE_GTHR_DEFAULT
ff66d28f 3120dnl
f214923c 3121AC_DEFUN([GLIBCXX_ENABLE_THREADS], [
ff66d28f 3122 AC_MSG_CHECKING([for thread model used by GCC])
fbe057bb 3123 target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'`
ff66d28f
PE
3124 AC_MSG_RESULT([$target_thread_file])
3125
3126 if test $target_thread_file != single; then
4651e622 3127 AC_DEFINE(HAVE_GTHR_DEFAULT, 1,
b329dd10
BK
3128 [Define if gthr-default.h exists
3129 (meaning that threading support is enabled).])
ff66d28f
PE
3130 fi
3131
3132 glibcxx_thread_h=gthr-$target_thread_file.h
382c6e2d
BK
3133
3134 dnl Check for __GTHREADS define.
3135 gthread_file=${toplevel_srcdir}/gcc/${glibcxx_thread_h}
3136 if grep __GTHREADS $gthread_file >/dev/null 2>&1 ; then
3137 enable_thread=yes
3138 else
3139 enable_thread=no
3140 fi
3141
ff66d28f
PE
3142 AC_SUBST(glibcxx_thread_h)
3143])
3144
3145
b8c41c8e
CF
3146dnl
3147dnl Check if gthread implementation defines the types and functions
3148dnl required by the c++0x thread library. Conforming gthread
3149dnl implementations can define __GTHREADS_CXX0X to enable use with c++0x.
3150dnl
3151AC_DEFUN([GLIBCXX_CHECK_GTHREADS], [
3152 AC_LANG_SAVE
3153 AC_LANG_CPLUSPLUS
3154
3155 ac_save_CXXFLAGS="$CXXFLAGS"
3156 CXXFLAGS="$CXXFLAGS -fno-exceptions -I${toplevel_srcdir}/gcc"
3157
6545e33e
PC
3158 AC_MSG_CHECKING([check whether it can be safely assumed that mutex_timedlock is available])
3159
3160 AC_TRY_COMPILE([#include <unistd.h>],
3161 [
3162 #if !defined(_POSIX_TIMEOUTS) || _POSIX_TIMEOUTS < 0
3163 #error
3164 #endif
3165 ], [ac_gthread_use_mutex_timedlock=1], [ac_gthread_use_mutex_timedlock=0])
3166
3167 AC_DEFINE_UNQUOTED(_GTHREAD_USE_MUTEX_TIMEDLOCK, $ac_gthread_use_mutex_timedlock,
3168 [Define to 1 if mutex_timedlock is available.])
3169
3170 if test $ac_gthread_use_mutex_timedlock = 1 ; then res_mutex_timedlock=yes ;
3171 else res_mutex_timedlock=no ; fi
3172 AC_MSG_RESULT([$res_mutex_timedlock])
3173
b8c41c8e
CF
3174 target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'`
3175 case $target_thread_file in
3176 posix)
3177 CXXFLAGS="$CXXFLAGS -DSUPPORTS_WEAK -DGTHREAD_USE_WEAK -D_PTHREADS"
3178 esac
3179
3180 AC_MSG_CHECKING([for gthreads library])
3181
6545e33e
PC
3182 AC_TRY_COMPILE([
3183 #include "gthr.h"
3184 #include <unistd.h>
3185 ],
b8c41c8e 3186 [
a1c5742d
PC
3187 #ifndef __GTHREADS_CXX0X
3188 #error
3189 #endif
3190
3191 // In case of POSIX threads check _POSIX_TIMEOUTS too.
3192 #if (defined(_PTHREADS) \
b329dd10 3193 && (!defined(_POSIX_TIMEOUTS) || _POSIX_TIMEOUTS <= 0))
a1c5742d
PC
3194 #error
3195 #endif
b8c41c8e
CF
3196 ], [ac_has_gthreads=yes], [ac_has_gthreads=no])
3197
3198 AC_MSG_RESULT([$ac_has_gthreads])
3199
3200 if test x"$ac_has_gthreads" = x"yes"; then
3201 AC_DEFINE(_GLIBCXX_HAS_GTHREADS, 1,
b329dd10 3202 [Define if gthreads library is available.])
b8c41c8e
CF
3203 fi
3204
3205 CXXFLAGS="$ac_save_CXXFLAGS"
3206 AC_LANG_RESTORE
3207])
3208
3209
ff66d28f
PE
3210# Check whether LC_MESSAGES is available in <locale.h>.
3211# Ulrich Drepper <drepper@cygnus.com>, 1995.
3212#
3213# This file file be copied and used freely without restrictions. It can
3214# be used in projects which are not available under the GNU Public License
3215# but which still want to provide support for the GNU gettext functionality.
3216# Please note that the actual code is *not* freely available.
f214923c 3217AC_DEFUN([AC_LC_MESSAGES], [
ff66d28f
PE
3218 AC_CHECK_HEADER(locale.h, [
3219 AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
99bf8d16 3220 [AC_TRY_COMPILE([#include <locale.h>], [return LC_MESSAGES],
ff66d28f
PE
3221 ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
3222 if test $ac_cv_val_LC_MESSAGES = yes; then
b329dd10
BK
3223 AC_DEFINE(HAVE_LC_MESSAGES, 1,
3224 [Define if LC_MESSAGES is available in <locale.h>.])
ff66d28f
PE
3225 fi
3226 ])
3227])
3228
43653c33
JW
3229dnl
3230dnl Check whether get_nprocs is available in <sys/sysinfo.h>, and define _GLIBCXX_USE_GET_NPROCS.
3231dnl
3232AC_DEFUN([GLIBCXX_CHECK_GET_NPROCS], [
3233
3234 AC_LANG_SAVE
3235 AC_LANG_CPLUSPLUS
3236 ac_save_CXXFLAGS="$CXXFLAGS"
3237 CXXFLAGS="$CXXFLAGS -fno-exceptions"
3238
3239 AC_MSG_CHECKING([for get_nprocs])
3240 AC_CACHE_VAL(glibcxx_cv_GET_NPROCS, [
3241 GCC_TRY_COMPILE_OR_LINK(
3242 [#include <sys/sysinfo.h>],
3243 [int n = get_nprocs();],
3244 [glibcxx_cv_GET_NPROCS=yes],
3245 [glibcxx_cv_GET_NPROCS=no])
3246 ])
3247 if test $glibcxx_cv_GET_NPROCS = yes; then
3248 AC_DEFINE(_GLIBCXX_USE_GET_NPROCS, 1, [Define if get_nprocs is available in <sys/sysinfo.h>.])
3249 fi
3250 AC_MSG_RESULT($glibcxx_cv_GET_NPROCS)
3251
3252 CXXFLAGS="$ac_save_CXXFLAGS"
3253 AC_LANG_RESTORE
3254])
3255
3256dnl
3257dnl Check whether sysconf(_SC_NPROCESSORS_ONLN) is available in <unistd.h>, and define _GLIBCXX_USE_SC_NPROCESSORS_ONLN.
3258dnl
3259AC_DEFUN([GLIBCXX_CHECK_SC_NPROCESSORS_ONLN], [
3260
3261 AC_LANG_SAVE
3262 AC_LANG_CPLUSPLUS
3263 ac_save_CXXFLAGS="$CXXFLAGS"
3264 CXXFLAGS="$CXXFLAGS -fno-exceptions"
3265
3266 AC_MSG_CHECKING([for _SC_NPROCESSORS_ONLN])
3267 AC_CACHE_VAL(glibcxx_cv_SC_NPROCESSORS_ONLN, [
3268 GCC_TRY_COMPILE_OR_LINK(
3269 [#include <unistd.h>],
3270 [int n = sysconf(_SC_NPROCESSORS_ONLN);],
3271 [glibcxx_cv_SC_NPROCESSORS_ONLN=yes],
3272 [glibcxx_cv_SC_NPROCESSORS_ONLN=no])
3273 ])
3274 if test $glibcxx_cv_SC_NPROCESSORS_ONLN = yes; then
3275 AC_DEFINE(_GLIBCXX_USE_SC_NPROCESSORS_ONLN, 1, [Define if _SC_NPROCESSORS_ONLN is available in <unistd.h>.])
3276 fi
3277 AC_MSG_RESULT($glibcxx_cv_SC_NPROCESSORS_ONLN)
3278
3279 CXXFLAGS="$ac_save_CXXFLAGS"
3280 AC_LANG_RESTORE
3281])
3282
3283
cddfb1c7 3284# Macros from the top-level gcc directory.
c18dc5cc 3285m4_include([../config/gc++filt.m4])
cddfb1c7 3286m4_include([../config/tls.m4])