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