]>
Commit | Line | Data |
---|---|---|
68224f8d | 1 | |
11764568 | 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 | |
2ad02b6c | 11 | AC_DEFUN([GLIBCXX_CONDITIONAL], [dnl |
11764568 | 12 | m4_divert_text([glibcxx_diversion],dnl |
13 | AM_CONDITIONAL([$1],[$2]) | |
14 | )dnl | |
15 | ])dnl | |
2ad02b6c | 16 | AC_DEFUN([GLIBCXX_EVALUATE_CONDITIONALS], [m4_undivert([glibcxx_diversion])])dnl |
11764568 | 17 | |
18 | ||
68224f8d | 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 | |
2ad02b6c | 24 | AC_DEFUN([GLIBCXX_CHECK_HOST], [ |
68224f8d | 25 | . $glibcxx_srcdir/configure.host |
2ad02b6c | 26 | AC_MSG_NOTICE([CPU config directory is $cpu_include_dir]) |
27 | AC_MSG_NOTICE([OS config directory is $os_include_dir]) | |
68224f8d | 28 | ]) |
29 | ||
68224f8d | 30 | dnl |
31 | dnl Initialize the rest of the library configury. At this point we have | |
32 | dnl variables like $host. | |
8400ab1c | 33 | dnl |
68224f8d | 34 | dnl Sets: |
4591e20f | 35 | dnl SUBDIRS |
68224f8d | 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 | |
8400ab1c | 47 | dnl |
2ad02b6c | 48 | AC_DEFUN([GLIBCXX_CONFIGURE], [ |
4591e20f | 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 | ||
acf7a6bc | 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. | |
5a64d8cf | 58 | glibcxx_builddir=`${PWDCMD-pwd}` |
acf7a6bc | 59 | case $srcdir in |
68224f8d | 60 | [\\/$]* | ?:[\\/]*) glibcxx_srcdir=${srcdir} ;; |
61 | *) glibcxx_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;; | |
acf7a6bc | 62 | esac |
68224f8d | 63 | toplevel_srcdir=${glibcxx_srcdir}/.. |
5a64d8cf | 64 | AC_SUBST(glibcxx_builddir) |
65 | AC_SUBST(glibcxx_srcdir) | |
68224f8d | 66 | AC_SUBST(toplevel_srcdir) |
acf7a6bc | 67 | |
68224f8d | 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 | ||
68224f8d | 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 | |
b1e05b1a | 94 | # that ourselves. Un-preciousing AC_PROG_CC also affects CC and CFLAGS. |
68224f8d | 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. | |
f4a06a64 | 98 | |
68224f8d | 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" | |
b1e05b1a | 104 | AC_PROG_CC |
68224f8d | 105 | AC_PROG_CXX |
106 | CXXFLAGS="$save_CXXFLAGS" | |
107 | m4_rename([glibcxx_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) | |
b1e05b1a | 108 | AC_SUBST(CFLAGS) |
68224f8d | 109 | AC_SUBST(CXXFLAGS) |
b9e8095b | 110 | |
68224f8d | 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 | ||
f1f1b9ae | 116 | AC_CHECK_TOOL(AS, as) |
117 | AC_CHECK_TOOL(AR, ar) | |
c45e0e39 | 118 | AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error) |
b9e8095b | 119 | |
f1f1b9ae | 120 | AM_MAINTAINER_MODE |
b9e8095b | 121 | |
11764568 | 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 | |
d1fde434 | 126 | need_libmath=no |
d1fde434 | 127 | |
68224f8d | 128 | # Find platform-specific directories containing configuration info. |
129 | # Also possibly modify flags used elsewhere, as needed by the platform. | |
5a64d8cf | 130 | GLIBCXX_CHECK_HOST |
b9e8095b | 131 | ]) |
132 | ||
133 | ||
c21bc234 | 134 | dnl |
457683de | 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. | |
b9e8095b | 138 | dnl |
68224f8d | 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. | |
b9386e63 | 145 | dnl |
2ad02b6c | 146 | AC_DEFUN([GLIBCXX_CHECK_COMPILER_FEATURES], [ |
c51c23c3 | 147 | # All these tests are for C++; save the language and the compiler flags. |
457683de | 148 | # The CXXFLAGS thing is suspicious, but based on similar bits previously |
5a64d8cf | 149 | # found in GLIBCXX_CONFIGURE. |
c51c23c3 | 150 | AC_LANG_SAVE |
151 | AC_LANG_CPLUSPLUS | |
152 | ac_test_CXXFLAGS="${CXXFLAGS+set}" | |
153 | ac_save_CXXFLAGS="$CXXFLAGS" | |
c51c23c3 | 154 | |
211ecbdf | 155 | # Check for maintainer-mode bits. |
156 | if test x"$USE_MAINTAINER_MODE" = xno; then | |
157 | WERROR='' | |
9c6a106c | 158 | else |
211ecbdf | 159 | WERROR='-Werror' |
9c6a106c | 160 | fi |
161 | ||
c21bc234 | 162 | # Check for -ffunction-sections -fdata-sections |
163 | AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections]) | |
8e34227a | 164 | CXXFLAGS='-Werror -ffunction-sections -fdata-sections' |
68224f8d | 165 | AC_TRY_COMPILE(, [int foo;], [ac_fdsections=yes], [ac_fdsections=no]) |
c21bc234 | 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 | |
7f713ccf | 172 | if test x"$ac_fdsections" = x"yes"; then |
c21bc234 | 173 | SECTION_FLAGS='-ffunction-sections -fdata-sections' |
174 | fi | |
175 | AC_MSG_RESULT($ac_fdsections) | |
176 | ||
c51c23c3 | 177 | AC_LANG_RESTORE |
9c6a106c | 178 | AC_SUBST(WERROR) |
c21bc234 | 179 | AC_SUBST(SECTION_FLAGS) |
b9e8095b | 180 | ]) |
181 | ||
c21bc234 | 182 | |
183 | dnl | |
06f58ac6 | 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 | |
68224f8d | 188 | dnl Defines: |
189 | dnl SECTION_LDFLAGS='-Wl,--gc-sections' if possible | |
bc12299b | 190 | dnl OPT_LDFLAGS='-Wl,-O1' and '-z,relro' if possible |
68224f8d | 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. | |
c21bc234 | 198 | dnl |
2ad02b6c | 199 | AC_DEFUN([GLIBCXX_CHECK_LINKER_FEATURES], [ |
06f58ac6 | 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... | |
13bad5d9 | 203 | test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS='' |
204 | test -z "$OPT_LDFLAGS" && OPT_LDFLAGS='' | |
06f58ac6 | 205 | AC_REQUIRE([AC_PROG_LD]) |
68224f8d | 206 | AC_REQUIRE([AC_PROG_AWK]) |
445cdc9a | 207 | |
00c7100f | 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([,]) | |
5a64d8cf | 229 | glibcxx_gnu_ld_version=`echo $ldver | \ |
00c7100f | 230 | $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'` |
231 | ||
445cdc9a | 232 | # Set --gc-sections. |
fd9a63cd | 233 | if test x"$with_gnu_ld" = x"yes"; then |
985550e9 | 234 | # GNU ld it is! Joy and bunny rabbits! |
06f58ac6 | 235 | |
e3acaece | 236 | # All these tests are for C++, but run with the "C" compiler driver. |
237 | # Need to do this so that g++ won't try to link in libstdc++/libsupc++. | |
06f58ac6 | 238 | ac_test_CFLAGS="${CFLAGS+set}" |
239 | ac_save_CFLAGS="$CFLAGS" | |
e3acaece | 240 | CFLAGS='-x c++ -Werror -Wl,--gc-sections' |
06f58ac6 | 241 | |
242 | # Check for -Wl,--gc-sections | |
243 | AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections]) | |
e3acaece | 244 | AC_TRY_LINK([ int one(void) { return 1; } |
245 | int two(void) { return 2; } | |
246 | ], [ two(); ] , [ac_gcsections=yes], [ac_gcsections=no]) | |
247 | if test "$ac_gcsections" = "yes"; then | |
248 | SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS" | |
249 | fi | |
250 | AC_MSG_RESULT($ac_gcsections) | |
251 | ||
06f58ac6 | 252 | if test "$ac_test_CFLAGS" = set; then |
253 | CFLAGS="$ac_save_CFLAGS" | |
254 | else | |
255 | # this is the suspicious part | |
256 | CFLAGS='' | |
257 | fi | |
445cdc9a | 258 | fi |
985550e9 | 259 | |
bc12299b | 260 | # Set -z,relro. |
fd9a63cd | 261 | # Note this is only for shared objects. |
bc12299b | 262 | ac_ld_relro=no |
263 | if test x"$with_gnu_ld" = x"yes"; then | |
264 | AC_MSG_CHECKING([for ld that supports -Wl,-z,relro]) | |
265 | cxx_z_relo=`$LD -v --help 2>/dev/null | grep "z relro"` | |
266 | if test -n "$cxx_z_relo"; then | |
267 | OPT_LDFLAGS="-Wl,-z,relro" | |
268 | ac_ld_relro=yes | |
269 | fi | |
270 | AC_MSG_RESULT($ac_ld_relro) | |
271 | fi | |
272 | ||
445cdc9a | 273 | # Set linker optimization flags. |
7f713ccf | 274 | if test x"$with_gnu_ld" = x"yes"; then |
13bad5d9 | 275 | OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS" |
06f58ac6 | 276 | fi |
445cdc9a | 277 | |
c21bc234 | 278 | AC_SUBST(SECTION_LDFLAGS) |
06f58ac6 | 279 | AC_SUBST(OPT_LDFLAGS) |
c21bc234 | 280 | ]) |
281 | ||
282 | ||
b9e8095b | 283 | dnl |
c586733c | 284 | dnl Check to see if this target can enable the iconv specializations. |
285 | dnl If --disable-c-mbchar was given, no wchar_t specialization is enabled. | |
286 | dnl (This must have been previously checked, along with the rest of C99 | |
287 | dnl support.) By default, iconv support is disabled. | |
b9e8095b | 288 | dnl |
68224f8d | 289 | dnl Defines: |
c586733c | 290 | dnl _GLIBCXX_USE_ICONV if all the bits are found. |
622700c3 | 291 | dnl Substs: |
292 | dnl LIBICONV to a -l string containing the iconv library, if needed. | |
b9e8095b | 293 | dnl |
c586733c | 294 | AC_DEFUN([GLIBCXX_CHECK_ICONV_SUPPORT], [ |
77cbec55 | 295 | |
c586733c | 296 | enable_iconv=no |
68224f8d | 297 | # Only continue checking if the ISO C99 headers exist and support is on. |
c586733c | 298 | if test x"$enable_wchar_t" = xyes; then |
77cbec55 | 299 | |
68224f8d | 300 | # Use iconv for wchar_t to char conversions. As such, check for |
301 | # X/Open Portability Guide, version 2 features (XPG2). | |
3d1a09b9 | 302 | AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no) |
303 | AC_CHECK_HEADER(langinfo.h, ac_has_langinfo_h=yes, ac_has_langinfo_h=no) | |
304 | ||
68224f8d | 305 | # Check for existence of libiconv.a providing XPG2 wchar_t support. |
622700c3 | 306 | AC_CHECK_LIB(iconv, iconv, LIBICONV="-liconv") |
3d1a09b9 | 307 | ac_save_LIBS="$LIBS" |
622700c3 | 308 | LIBS="$LIBS $LIBICONV" |
309 | AC_SUBST(LIBICONV) | |
3d1a09b9 | 310 | |
68224f8d | 311 | AC_CHECK_FUNCS([iconv_open iconv_close iconv nl_langinfo], |
312 | [ac_XPG2funcs=yes], [ac_XPG2funcs=no]) | |
77cbec55 | 313 | |
3d1a09b9 | 314 | LIBS="$ac_save_LIBS" |
2407da46 | 315 | |
2475beac | 316 | if test x"$ac_has_iconv_h" = xyes && |
317 | test x"$ac_has_langinfo_h" = xyes && | |
68224f8d | 318 | test x"$ac_XPG2funcs" = xyes; |
319 | then | |
c586733c | 320 | AC_DEFINE([_GLIBCXX_USE_ICONV],1, |
321 | [Define if iconv and related functions exist and are usable.]) | |
322 | enable_iconv=yes | |
0a40c6ad | 323 | fi |
b9e8095b | 324 | fi |
c586733c | 325 | AC_MSG_CHECKING([for enabled iconv specializations]) |
326 | AC_MSG_RESULT($enable_iconv) | |
b9e8095b | 327 | ]) |
328 | ||
329 | ||
b9e8095b | 330 | dnl |
68224f8d | 331 | dnl Check for headers for, and arguments to, the setrlimit() function. |
332 | dnl Used only in testsuite_hooks.h. Called from GLIBCXX_CONFIGURE_TESTSUITE. | |
7f713ccf | 333 | dnl |
68224f8d | 334 | dnl Defines: |
ac7a2146 | 335 | dnl _GLIBCXX_RES_LIMITS if we can set artificial resource limits |
336 | dnl various HAVE_LIMIT_* for individual limit names | |
7f713ccf | 337 | dnl |
2ad02b6c | 338 | AC_DEFUN([GLIBCXX_CHECK_SETRLIMIT_ancilliary], [ |
bd30e718 | 339 | AC_MSG_CHECKING([for RLIMIT_$1]) |
68224f8d | 340 | AC_TRY_COMPILE( |
341 | [#include <unistd.h> | |
342 | #include <sys/time.h> | |
343 | #include <sys/resource.h> | |
344 | ], | |
345 | [ int f = RLIMIT_$1 ; ], | |
346 | [glibcxx_mresult=1], [glibcxx_mresult=0]) | |
ac7a2146 | 347 | AC_DEFINE_UNQUOTED(HAVE_LIMIT_$1, $glibcxx_mresult, |
68224f8d | 348 | [Only used in build directory testsuite_hooks.h.]) |
bd30e718 | 349 | if test $glibcxx_mresult = 1 ; then res=yes ; else res=no ; fi |
350 | AC_MSG_RESULT($res) | |
68224f8d | 351 | ]) |
352 | ||
2ad02b6c | 353 | AC_DEFUN([GLIBCXX_CHECK_SETRLIMIT], [ |
68224f8d | 354 | setrlimit_have_headers=yes |
355 | AC_CHECK_HEADERS(unistd.h sys/time.h sys/resource.h, | |
356 | [], | |
357 | [setrlimit_have_headers=no]) | |
358 | # If don't have the headers, then we can't run the tests now, and we | |
359 | # won't be seeing any of these during testsuite compilation. | |
360 | if test $setrlimit_have_headers = yes; then | |
361 | # Can't do these in a loop, else the resulting syntax is wrong. | |
362 | GLIBCXX_CHECK_SETRLIMIT_ancilliary(DATA) | |
363 | GLIBCXX_CHECK_SETRLIMIT_ancilliary(RSS) | |
364 | GLIBCXX_CHECK_SETRLIMIT_ancilliary(VMEM) | |
365 | GLIBCXX_CHECK_SETRLIMIT_ancilliary(AS) | |
ac7a2146 | 366 | GLIBCXX_CHECK_SETRLIMIT_ancilliary(FSIZE) |
68224f8d | 367 | |
368 | # Check for rlimit, setrlimit. | |
369 | AC_CACHE_VAL(ac_setrlimit, [ | |
370 | AC_TRY_COMPILE( | |
371 | [#include <unistd.h> | |
372 | #include <sys/time.h> | |
373 | #include <sys/resource.h> | |
374 | ], | |
375 | [struct rlimit r; | |
376 | setrlimit(0, &r);], | |
377 | [ac_setrlimit=yes], [ac_setrlimit=no]) | |
378 | ]) | |
379 | fi | |
380 | ||
ac7a2146 | 381 | AC_MSG_CHECKING([for testsuite resource limits support]) |
68224f8d | 382 | if test $setrlimit_have_headers = yes && test $ac_setrlimit = yes; then |
ac7a2146 | 383 | ac_res_limits=yes |
d64903a9 | 384 | AC_DEFINE(_GLIBCXX_RES_LIMITS, 1, |
385 | [Define if using setrlimit to set resource limits during | |
386 | "make check"]) | |
68224f8d | 387 | else |
ac7a2146 | 388 | ac_res_limits=no |
68224f8d | 389 | fi |
ac7a2146 | 390 | AC_MSG_RESULT($ac_res_limits) |
7f713ccf | 391 | ]) |
392 | ||
393 | ||
7f713ccf | 394 | dnl |
68224f8d | 395 | dnl Check whether S_ISREG (Posix) or S_IFREG is available in <sys/stat.h>. |
396 | dnl Define HAVE_S_ISREG / HAVE_S_IFREG appropriately. | |
7f713ccf | 397 | dnl |
2ad02b6c | 398 | AC_DEFUN([GLIBCXX_CHECK_S_ISREG_OR_S_IFREG], [ |
bd30e718 | 399 | AC_MSG_CHECKING([for S_ISREG or S_IFREG]) |
68224f8d | 400 | AC_CACHE_VAL(glibcxx_cv_S_ISREG, [ |
401 | AC_TRY_LINK( | |
402 | [#include <sys/stat.h>], | |
403 | [struct stat buffer; | |
404 | fstat(0, &buffer); | |
405 | S_ISREG(buffer.st_mode);], | |
406 | [glibcxx_cv_S_ISREG=yes], | |
407 | [glibcxx_cv_S_ISREG=no]) | |
408 | ]) | |
409 | AC_CACHE_VAL(glibcxx_cv_S_IFREG, [ | |
410 | AC_TRY_LINK( | |
411 | [#include <sys/stat.h>], | |
412 | [struct stat buffer; | |
413 | fstat(0, &buffer); | |
414 | S_IFREG & buffer.st_mode;], | |
415 | [glibcxx_cv_S_IFREG=yes], | |
416 | [glibcxx_cv_S_IFREG=no]) | |
417 | ]) | |
bd30e718 | 418 | res=no |
68224f8d | 419 | if test $glibcxx_cv_S_ISREG = yes; then |
d64903a9 | 420 | AC_DEFINE(HAVE_S_ISREG, 1, |
421 | [Define if S_IFREG is available in <sys/stat.h>.]) | |
bd30e718 | 422 | res=S_ISREG |
68224f8d | 423 | elif test $glibcxx_cv_S_IFREG = yes; then |
d64903a9 | 424 | AC_DEFINE(HAVE_S_IFREG, 1, |
425 | [Define if S_IFREG is available in <sys/stat.h>.]) | |
bd30e718 | 426 | res=S_IFREG |
68224f8d | 427 | fi |
bd30e718 | 428 | AC_MSG_RESULT($res) |
b9e8095b | 429 | ]) |
430 | ||
431 | ||
401f263f | 432 | dnl |
68224f8d | 433 | dnl Check whether poll is available in <poll.h>, and define HAVE_POLL. |
401f263f | 434 | dnl |
2ad02b6c | 435 | AC_DEFUN([GLIBCXX_CHECK_POLL], [ |
bd30e718 | 436 | AC_MSG_CHECKING([for poll]) |
68224f8d | 437 | AC_CACHE_VAL(glibcxx_cv_POLL, [ |
440c107f | 438 | AC_TRY_LINK( |
68224f8d | 439 | [#include <poll.h>], |
440 | [struct pollfd pfd[1]; | |
441 | pfd[0].events = POLLIN; | |
442 | poll(pfd, 1, 0);], | |
443 | [glibcxx_cv_POLL=yes], | |
444 | [glibcxx_cv_POLL=no]) | |
445 | ]) | |
446 | if test $glibcxx_cv_POLL = yes; then | |
d64903a9 | 447 | AC_DEFINE(HAVE_POLL, 1, [Define if poll is available in <poll.h>.]) |
68224f8d | 448 | fi |
bd30e718 | 449 | AC_MSG_RESULT($glibcxx_cv_POLL) |
68224f8d | 450 | ]) |
451 | ||
452 | ||
453 | dnl | |
454 | dnl Check whether writev is available in <sys/uio.h>, and define HAVE_WRITEV. | |
455 | dnl | |
2ad02b6c | 456 | AC_DEFUN([GLIBCXX_CHECK_WRITEV], [ |
bd30e718 | 457 | AC_MSG_CHECKING([for writev]) |
68224f8d | 458 | AC_CACHE_VAL(glibcxx_cv_WRITEV, [ |
440c107f | 459 | AC_TRY_LINK( |
68224f8d | 460 | [#include <sys/uio.h>], |
461 | [struct iovec iov[2]; | |
462 | writev(0, iov, 0);], | |
463 | [glibcxx_cv_WRITEV=yes], | |
464 | [glibcxx_cv_WRITEV=no]) | |
465 | ]) | |
466 | if test $glibcxx_cv_WRITEV = yes; then | |
d64903a9 | 467 | AC_DEFINE(HAVE_WRITEV, 1, [Define if writev is available in <sys/uio.h>.]) |
68224f8d | 468 | fi |
bd30e718 | 469 | AC_MSG_RESULT($glibcxx_cv_WRITEV) |
68224f8d | 470 | ]) |
471 | ||
472 | ||
440c107f | 473 | dnl |
474 | dnl Check whether int64_t is available in <stdint.h>, and define HAVE_INT64_T. | |
475 | dnl | |
2ad02b6c | 476 | AC_DEFUN([GLIBCXX_CHECK_INT64_T], [ |
bd30e718 | 477 | AC_MSG_CHECKING([for int64_t]) |
440c107f | 478 | AC_CACHE_VAL(glibcxx_cv_INT64_T, [ |
479 | AC_TRY_COMPILE( | |
480 | [#include <stdint.h>], | |
481 | [int64_t var;], | |
482 | [glibcxx_cv_INT64_T=yes], | |
483 | [glibcxx_cv_INT64_T=no]) | |
484 | ]) | |
485 | if test $glibcxx_cv_INT64_T = yes; then | |
d64903a9 | 486 | AC_DEFINE(HAVE_INT64_T, 1, [Define if int64_t is available in <stdint.h>.]) |
440c107f | 487 | fi |
bd30e718 | 488 | AC_MSG_RESULT($glibcxx_cv_INT64_T) |
440c107f | 489 | ]) |
490 | ||
491 | ||
492 | dnl | |
493 | dnl Check whether LFS support is available. | |
494 | dnl | |
2ad02b6c | 495 | AC_DEFUN([GLIBCXX_CHECK_LFS], [ |
14636c22 | 496 | AC_LANG_SAVE |
f6c9c179 | 497 | AC_LANG_CPLUSPLUS |
498 | ac_save_CXXFLAGS="$CXXFLAGS" | |
499 | CXXFLAGS="$CXXFLAGS -fno-exceptions" | |
bd30e718 | 500 | AC_MSG_CHECKING([for LFS support]) |
440c107f | 501 | AC_CACHE_VAL(glibcxx_cv_LFS, [ |
502 | AC_TRY_LINK( | |
14636c22 | 503 | [#include <unistd.h> |
504 | #include <stdio.h> | |
b1e0564a | 505 | #include <sys/stat.h> |
14636c22 | 506 | ], |
c92ce3f5 | 507 | [FILE* fp; |
508 | fopen64("t", "w"); | |
509 | fseeko64(fp, 0, SEEK_CUR); | |
510 | ftello64(fp); | |
b1e0564a | 511 | lseek64(1, 0, SEEK_CUR); |
512 | struct stat64 buf; | |
513 | fstat64(1, &buf);], | |
440c107f | 514 | [glibcxx_cv_LFS=yes], |
515 | [glibcxx_cv_LFS=no]) | |
516 | ]) | |
517 | if test $glibcxx_cv_LFS = yes; then | |
d64903a9 | 518 | AC_DEFINE(_GLIBCXX_USE_LFS, 1, [Define if LFS support is available.]) |
440c107f | 519 | fi |
bd30e718 | 520 | AC_MSG_RESULT($glibcxx_cv_LFS) |
f6c9c179 | 521 | CXXFLAGS="$ac_save_CXXFLAGS" |
522 | AC_LANG_RESTORE | |
440c107f | 523 | ]) |
524 | ||
525 | ||
06450f58 | 526 | dnl |
527 | dnl Check for whether a fully dynamic basic_string implementation should | |
528 | dnl be turned on, that does not put empty objects in per-process static | |
529 | dnl memory (mostly useful together with shared memory allocators, see PR | |
530 | dnl libstdc++/16612 for details). | |
531 | dnl | |
532 | dnl --enable-fully-dynamic-string defines _GLIBCXX_FULLY_DYNAMIC_STRING | |
533 | dnl --disable-fully-dynamic-string leaves _GLIBCXX_FULLY_DYNAMIC_STRING undefined | |
534 | dnl + Usage: GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING[(DEFAULT)] | |
535 | dnl Where DEFAULT is either `yes' or `no'. | |
536 | dnl | |
537 | AC_DEFUN([GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING], [ | |
538 | GLIBCXX_ENABLE(fully-dynamic-string,$1,,[do not put empty strings in per-process static memory]) | |
539 | if test $enable_fully_dynamic_string = yes; then | |
d64903a9 | 540 | AC_DEFINE(_GLIBCXX_FULLY_DYNAMIC_STRING, 1, |
541 | [Define if a fully dynamic basic_string is wanted.]) | |
06450f58 | 542 | fi |
543 | ]) | |
544 | ||
545 | ||
68224f8d | 546 | dnl |
547 | dnl Does any necessary configuration of the testsuite directory. Generates | |
548 | dnl the testsuite_hooks.h header. | |
549 | dnl | |
550 | dnl GLIBCXX_ENABLE_SYMVERS and GLIBCXX_IS_NATIVE must be done before this. | |
551 | dnl | |
552 | dnl Sets: | |
099c5a78 | 553 | dnl enable_abi_check |
c37e7a9d | 554 | dnl GLIBCXX_TEST_WCHAR_T |
555 | dnl GLIBCXX_TEST_THREAD | |
68224f8d | 556 | dnl Substs: |
557 | dnl baseline_dir | |
558 | dnl | |
2ad02b6c | 559 | AC_DEFUN([GLIBCXX_CONFIGURE_TESTSUITE], [ |
10f7a2cb | 560 | if $GLIBCXX_IS_NATIVE ; then |
ac7a2146 | 561 | # Do checks for resource limit functions. |
68224f8d | 562 | GLIBCXX_CHECK_SETRLIMIT |
563 | ||
564 | # Look for setenv, so that extended locale tests can be performed. | |
565 | GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_3(setenv) | |
10f7a2cb | 566 | fi |
3795d5fd | 567 | |
10f7a2cb | 568 | if $GLIBCXX_IS_NATIVE && test $is_hosted = yes && |
569 | test $enable_symvers != no; then | |
570 | case "$host" in | |
571 | *-*-cygwin*) | |
572 | enable_abi_check=no ;; | |
573 | *) | |
574 | enable_abi_check=yes ;; | |
575 | esac | |
3795d5fd | 576 | else |
577 | # Only build this as native, since automake does not understand | |
578 | # CXX_FOR_BUILD. | |
579 | enable_abi_check=no | |
68224f8d | 580 | fi |
099c5a78 | 581 | |
68224f8d | 582 | # Export file names for ABI checking. |
871b22db | 583 | baseline_dir="$glibcxx_srcdir/config/abi/post/${abi_baseline_pair}\$(MULTISUBDIR)" |
68224f8d | 584 | AC_SUBST(baseline_dir) |
68224f8d | 585 | ]) |
586 | ||
587 | ||
588 | dnl | |
589 | dnl Set up *_INCLUDES variables for all sundry Makefile.am's. | |
590 | dnl | |
591 | dnl Substs: | |
592 | dnl GLIBCXX_INCLUDES | |
593 | dnl TOPLEVEL_INCLUDES | |
68224f8d | 594 | dnl |
2ad02b6c | 595 | AC_DEFUN([GLIBCXX_EXPORT_INCLUDES], [ |
2eb169cd | 596 | # Used for every C++ compile we perform. |
597 | GLIBCXX_INCLUDES="\ | |
598 | -I$glibcxx_builddir/include/$host_alias \ | |
599 | -I$glibcxx_builddir/include \ | |
600 | -I$glibcxx_srcdir/libsupc++" | |
68224f8d | 601 | |
2eb169cd | 602 | # For Canadian crosses, pick this up too. |
68224f8d | 603 | if test $CANADIAN = yes; then |
c0d1c48c | 604 | GLIBCXX_INCLUDES="$GLIBCXX_INCLUDES -I\${includedir}" |
68224f8d | 605 | fi |
606 | ||
2eb169cd | 607 | # Stuff in the actual top level. Currently only used by libsupc++ to |
608 | # get unwind* headers from the gcc dir. | |
609 | #TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc -I$(toplevel_srcdir)/include' | |
610 | TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc' | |
68224f8d | 611 | |
612 | # Now, export this to all the little Makefiles.... | |
613 | AC_SUBST(GLIBCXX_INCLUDES) | |
614 | AC_SUBST(TOPLEVEL_INCLUDES) | |
68224f8d | 615 | ]) |
616 | ||
617 | ||
618 | dnl | |
619 | dnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's. | |
620 | dnl (SECTION_FLAGS is done under CHECK_COMPILER_FEATURES.) | |
621 | dnl | |
622 | dnl Substs: | |
623 | dnl OPTIMIZE_CXXFLAGS | |
624 | dnl WARN_FLAGS | |
625 | dnl | |
2ad02b6c | 626 | AC_DEFUN([GLIBCXX_EXPORT_FLAGS], [ |
68224f8d | 627 | # Optimization flags that are probably a good idea for thrill-seekers. Just |
628 | # uncomment the lines below and make, everything else is ready to go... | |
629 | # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc | |
630 | OPTIMIZE_CXXFLAGS= | |
631 | AC_SUBST(OPTIMIZE_CXXFLAGS) | |
632 | ||
c8559392 | 633 | WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual' |
68224f8d | 634 | AC_SUBST(WARN_FLAGS) |
635 | ]) | |
636 | ||
637 | ||
638 | dnl | |
639 | dnl All installation directory information is determined here. | |
640 | dnl | |
641 | dnl Substs: | |
642 | dnl gxx_install_dir | |
643 | dnl glibcxx_prefixdir | |
644 | dnl glibcxx_toolexecdir | |
645 | dnl glibcxx_toolexeclibdir | |
646 | dnl | |
647 | dnl Assumes cross_compiling bits already done, and with_cross_host in | |
648 | dnl particular. | |
649 | dnl | |
2ad02b6c | 650 | AC_DEFUN([GLIBCXX_EXPORT_INSTALL_INFO], [ |
68224f8d | 651 | glibcxx_toolexecdir=no |
652 | glibcxx_toolexeclibdir=no | |
653 | glibcxx_prefixdir=$prefix | |
654 | ||
655 | AC_MSG_CHECKING([for gxx-include-dir]) | |
656 | AC_ARG_WITH([gxx-include-dir], | |
657 | AC_HELP_STRING([--with-gxx-include-dir=DIR], | |
658 | [installation directory for include files]), | |
659 | [case "$withval" in | |
660 | yes) AC_MSG_ERROR([Missing directory for --with-gxx-include-dir]) ;; | |
661 | no) gxx_include_dir=no ;; | |
662 | *) gxx_include_dir=$withval ;; | |
663 | esac], | |
664 | [gxx_include_dir=no]) | |
665 | AC_MSG_RESULT($gxx_include_dir) | |
666 | ||
667 | AC_MSG_CHECKING([for --enable-version-specific-runtime-libs]) | |
668 | AC_ARG_ENABLE([version-specific-runtime-libs], | |
669 | AC_HELP_STRING([--enable-version-specific-runtime-libs], | |
670 | [Specify that runtime libraries should be installed in a compiler-specific directory]), | |
671 | [case "$enableval" in | |
672 | yes) version_specific_libs=yes ;; | |
673 | no) version_specific_libs=no ;; | |
674 | *) AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);; | |
675 | esac], | |
676 | [version_specific_libs=no]) | |
677 | AC_MSG_RESULT($version_specific_libs) | |
678 | ||
679 | # Default case for install directory for include files. | |
680 | if test $version_specific_libs = no && test $gxx_include_dir = no; then | |
b6ca54bb | 681 | gxx_include_dir='${prefix}/include/c++/${gcc_version}' |
68224f8d | 682 | fi |
683 | ||
684 | # Version-specific runtime libs processing. | |
685 | if test $version_specific_libs = yes; then | |
686 | # Need the gcc compiler version to know where to install libraries | |
687 | # and header files if --enable-version-specific-runtime-libs option | |
949aa2c6 | 688 | # is selected. FIXME: these variables are misnamed, there are |
689 | # no executables installed in _toolexecdir or _toolexeclibdir. | |
68224f8d | 690 | if test x"$gxx_include_dir" = x"no"; then |
b6ca54bb | 691 | gxx_include_dir='${libdir}/gcc/${host_alias}/${gcc_version}/include/c++' |
68224f8d | 692 | fi |
949aa2c6 | 693 | glibcxx_toolexecdir='${libdir}/gcc/${host_alias}' |
b6ca54bb | 694 | glibcxx_toolexeclibdir='${toolexecdir}/${gcc_version}$(MULTISUBDIR)' |
68224f8d | 695 | fi |
696 | ||
697 | # Calculate glibcxx_toolexecdir, glibcxx_toolexeclibdir | |
698 | # Install a library built with a cross compiler in tooldir, not libdir. | |
699 | if test x"$glibcxx_toolexecdir" = x"no"; then | |
700 | if test -n "$with_cross_host" && | |
701 | test x"$with_cross_host" != x"no"; then | |
f4a06a64 | 702 | glibcxx_toolexecdir='${exec_prefix}/${host_alias}' |
703 | glibcxx_toolexeclibdir='${toolexecdir}/lib' | |
68224f8d | 704 | else |
949aa2c6 | 705 | glibcxx_toolexecdir='${libdir}/gcc/${host_alias}' |
f4a06a64 | 706 | glibcxx_toolexeclibdir='${libdir}' |
68224f8d | 707 | fi |
f4a06a64 | 708 | multi_os_directory=`$CXX -print-multi-os-directory` |
68224f8d | 709 | case $multi_os_directory in |
710 | .) ;; # Avoid trailing /. | |
711 | *) glibcxx_toolexeclibdir=$glibcxx_toolexeclibdir/$multi_os_directory ;; | |
712 | esac | |
713 | fi | |
714 | ||
715 | AC_MSG_CHECKING([for install location]) | |
716 | AC_MSG_RESULT($gxx_include_dir) | |
717 | ||
718 | AC_SUBST(glibcxx_prefixdir) | |
719 | AC_SUBST(gxx_include_dir) | |
720 | AC_SUBST(glibcxx_toolexecdir) | |
721 | AC_SUBST(glibcxx_toolexeclibdir) | |
722 | ]) | |
723 | ||
724 | ||
725 | dnl | |
726 | dnl GLIBCXX_ENABLE | |
727 | dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING) | |
728 | dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, permit a|b|c) | |
729 | dnl (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, SHELL-CODE-HANDLER) | |
730 | dnl | |
731 | dnl See docs/html/17_intro/configury.html#enable for documentation. | |
732 | dnl | |
733 | m4_define([GLIBCXX_ENABLE],[dnl | |
734 | m4_define([_g_switch],[--enable-$1])dnl | |
735 | m4_define([_g_help],[AC_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl | |
736 | AC_ARG_ENABLE($1,_g_help, | |
737 | m4_bmatch([$5], | |
738 | [^permit ], | |
739 | [[ | |
740 | case "$enableval" in | |
741 | m4_bpatsubst([$5],[permit ])) ;; | |
742 | *) AC_MSG_ERROR(Unknown argument to enable/disable $1) ;; | |
743 | dnl Idea for future: generate a URL pointing to | |
744 | dnl "onlinedocs/configopts.html#whatever" | |
745 | esac | |
746 | ]], | |
747 | [^$], | |
748 | [[ | |
749 | case "$enableval" in | |
750 | yes|no) ;; | |
751 | *) AC_MSG_ERROR(Argument to enable/disable $1 must be yes or no) ;; | |
752 | esac | |
753 | ]], | |
754 | [[$5]]), | |
755 | [enable_]m4_bpatsubst([$1],-,_)[=][$2]) | |
756 | m4_undefine([_g_switch])dnl | |
757 | m4_undefine([_g_help])dnl | |
758 | ]) | |
759 | ||
760 | ||
761 | dnl | |
762 | dnl Check for ISO/IEC 9899:1999 "C99" support. | |
763 | dnl | |
764 | dnl --enable-c99 defines _GLIBCXX_USE_C99 | |
765 | dnl --disable-c99 leaves _GLIBCXX_USE_C99 undefined | |
766 | dnl + Usage: GLIBCXX_ENABLE_C99[(DEFAULT)] | |
767 | dnl Where DEFAULT is either `yes' or `no'. | |
768 | dnl + If 'C99' stuff is not available, ignores DEFAULT and sets `no'. | |
769 | dnl | |
2ad02b6c | 770 | AC_DEFUN([GLIBCXX_ENABLE_C99], [ |
68224f8d | 771 | GLIBCXX_ENABLE(c99,$1,,[turns on ISO/IEC 9899:1999 support]) |
772 | ||
c586733c | 773 | # Test wchar.h for mbstate_t, which is needed for char_traits and fpos |
774 | # even if C99 support is turned off. | |
775 | AC_CHECK_HEADERS(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no) | |
776 | AC_MSG_CHECKING([for mbstate_t]) | |
777 | AC_TRY_COMPILE([#include <wchar.h>], | |
778 | [mbstate_t teststate;], | |
779 | have_mbstate_t=yes, have_mbstate_t=no) | |
780 | AC_MSG_RESULT($have_mbstate_t) | |
781 | if test x"$have_mbstate_t" = xyes; then | |
d64903a9 | 782 | AC_DEFINE(HAVE_MBSTATE_T,1,[Define if mbstate_t exists in wchar.h.]) |
c586733c | 783 | fi |
784 | ||
785 | if test x"$enable_c99" = x"yes"; then | |
786 | ||
68224f8d | 787 | AC_LANG_SAVE |
788 | AC_LANG_CPLUSPLUS | |
789 | ||
790 | # Check for the existence of <math.h> functions used if C99 is enabled. | |
68224f8d | 791 | AC_MSG_CHECKING([for ISO C99 support in <math.h>]) |
c586733c | 792 | AC_CACHE_VAL(ac_c99_math, [ |
68224f8d | 793 | AC_TRY_COMPILE([#include <math.h>], |
c586733c | 794 | [fpclassify(0.0); |
795 | isfinite(0.0); | |
796 | isinf(0.0); | |
797 | isnan(0.0); | |
798 | isnormal(0.0); | |
799 | signbit(0.0); | |
800 | isgreater(0.0,0.0); | |
801 | isgreaterequal(0.0,0.0); | |
802 | isless(0.0,0.0); | |
803 | islessequal(0.0,0.0); | |
804 | islessgreater(0.0,0.0); | |
805 | islessgreater(0.0,0.0); | |
806 | isunordered(0.0,0.0); | |
807 | ],[ac_c99_math=yes], [ac_c99_math=no]) | |
808 | ]) | |
68224f8d | 809 | AC_MSG_RESULT($ac_c99_math) |
90d5bb42 | 810 | if test x"$ac_c99_math" = x"yes"; then |
d64903a9 | 811 | AC_DEFINE(_GLIBCXX_USE_C99_MATH, 1, |
812 | [Define if C99 functions or macros in <math.h> should be imported | |
813 | in <cmath> in namespace std.]) | |
90d5bb42 | 814 | fi |
815 | ||
7b989971 | 816 | # Check for the existence of <complex.h> complex math functions. |
9253fc43 | 817 | # This is necessary even though libstdc++ uses the builtin versions |
818 | # of these functions, because if the builtin cannot be used, a reference | |
819 | # to the library function is emitted. | |
820 | AC_CHECK_HEADERS(complex.h, ac_has_complex_h=yes, ac_has_complex_h=no) | |
821 | ac_c99_complex=no; | |
822 | if test x"$ac_has_complex_h" = x"yes"; then | |
9253fc43 | 823 | AC_MSG_CHECKING([for ISO C99 support in <complex.h>]) |
824 | AC_TRY_COMPILE([#include <complex.h>], | |
c586733c | 825 | [typedef __complex__ float float_type; float_type tmpf; |
826 | cabsf(tmpf); | |
827 | cargf(tmpf); | |
828 | ccosf(tmpf); | |
829 | ccoshf(tmpf); | |
830 | cexpf(tmpf); | |
88d7b4c4 | 831 | clogf(tmpf); |
c586733c | 832 | csinf(tmpf); |
833 | csinhf(tmpf); | |
834 | csqrtf(tmpf); | |
835 | ctanf(tmpf); | |
836 | ctanhf(tmpf); | |
837 | cpowf(tmpf, tmpf); | |
838 | typedef __complex__ double double_type; double_type tmpd; | |
839 | cabs(tmpd); | |
840 | carg(tmpd); | |
841 | ccos(tmpd); | |
842 | ccosh(tmpd); | |
843 | cexp(tmpd); | |
88d7b4c4 | 844 | clog(tmpd); |
c586733c | 845 | csin(tmpd); |
846 | csinh(tmpd); | |
847 | csqrt(tmpd); | |
848 | ctan(tmpd); | |
849 | ctanh(tmpd); | |
850 | cpow(tmpd, tmpd); | |
851 | typedef __complex__ long double ld_type; ld_type tmpld; | |
852 | cabsl(tmpld); | |
853 | cargl(tmpld); | |
854 | ccosl(tmpld); | |
855 | ccoshl(tmpld); | |
856 | cexpl(tmpld); | |
88d7b4c4 | 857 | clogl(tmpld); |
c586733c | 858 | csinl(tmpld); |
859 | csinhl(tmpld); | |
860 | csqrtl(tmpld); | |
861 | ctanl(tmpld); | |
862 | ctanhl(tmpld); | |
863 | cpowl(tmpld, tmpld); | |
864 | ],[ac_c99_complex=yes], [ac_c99_complex=no]) | |
9253fc43 | 865 | fi |
866 | AC_MSG_RESULT($ac_c99_complex) | |
9253fc43 | 867 | if test x"$ac_c99_complex" = x"yes"; then |
d64903a9 | 868 | AC_DEFINE(_GLIBCXX_USE_C99_COMPLEX, 1, |
869 | [Define if C99 functions in <complex.h> should be used in | |
870 | <complex>. Using compiler builtins for these functions requires | |
871 | corresponding C99 library functions to be present.]) | |
9253fc43 | 872 | fi |
873 | ||
68224f8d | 874 | # Check for the existence in <stdio.h> of vscanf, et. al. |
68224f8d | 875 | AC_MSG_CHECKING([for ISO C99 support in <stdio.h>]) |
c586733c | 876 | AC_CACHE_VAL(ac_c99_stdio, [ |
68224f8d | 877 | AC_TRY_COMPILE([#include <stdio.h> |
c586733c | 878 | #include <stdarg.h> |
68224f8d | 879 | void foo(char* fmt, ...) |
c586733c | 880 | { |
881 | va_list args; va_start(args, fmt); | |
882 | vfscanf(stderr, "%i", args); | |
883 | vscanf("%i", args); | |
884 | vsnprintf(fmt, 0, "%i", args); | |
885 | vsscanf(fmt, "%i", args); | |
886 | }], | |
887 | [snprintf("12", 0, "%i");], | |
888 | [ac_c99_stdio=yes], [ac_c99_stdio=no]) | |
889 | ]) | |
68224f8d | 890 | AC_MSG_RESULT($ac_c99_stdio) |
891 | ||
892 | # Check for the existence in <stdlib.h> of lldiv_t, et. al. | |
68224f8d | 893 | AC_MSG_CHECKING([for ISO C99 support in <stdlib.h>]) |
c586733c | 894 | AC_CACHE_VAL(ac_c99_stdlib, [ |
68224f8d | 895 | AC_TRY_COMPILE([#include <stdlib.h>], |
4520d221 | 896 | [char* tmp; |
897 | strtof("gnu", &tmp); | |
c586733c | 898 | strtold("gnu", &tmp); |
4520d221 | 899 | strtoll("gnu", &tmp, 10); |
900 | strtoull("gnu", &tmp, 10); | |
901 | llabs(10); | |
902 | lldiv(10,1); | |
903 | atoll("10"); | |
c586733c | 904 | _Exit(0); |
905 | lldiv_t mydivt;],[ac_c99_stdlib=yes], [ac_c99_stdlib=no]) | |
906 | ]) | |
68224f8d | 907 | AC_MSG_RESULT($ac_c99_stdlib) |
908 | ||
c586733c | 909 | # Check for the existence in <wchar.h> of wcstoull, WEOF, etc. |
910 | AC_CHECK_HEADERS(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no) | |
911 | ac_c99_wchar=no; | |
912 | if test x"$ac_has_wchar_h" = xyes && | |
913 | test x"$ac_has_wctype_h" = xyes; then | |
914 | AC_TRY_COMPILE([#include <wchar.h> | |
915 | #include <stddef.h> | |
916 | wint_t i; | |
917 | long l = WEOF; | |
918 | long j = WCHAR_MIN; | |
919 | long k = WCHAR_MAX; | |
920 | namespace test | |
921 | { | |
922 | using ::btowc; | |
923 | using ::fgetwc; | |
924 | using ::fgetws; | |
925 | using ::fputwc; | |
926 | using ::fputws; | |
927 | using ::fwide; | |
928 | using ::fwprintf; | |
929 | using ::fwscanf; | |
930 | using ::getwc; | |
931 | using ::getwchar; | |
932 | using ::mbrlen; | |
933 | using ::mbrtowc; | |
934 | using ::mbsinit; | |
935 | using ::mbsrtowcs; | |
936 | using ::putwc; | |
937 | using ::putwchar; | |
938 | using ::swprintf; | |
939 | using ::swscanf; | |
940 | using ::ungetwc; | |
941 | using ::vfwprintf; | |
942 | using ::vswprintf; | |
943 | using ::vwprintf; | |
944 | using ::wcrtomb; | |
945 | using ::wcscat; | |
946 | using ::wcschr; | |
947 | using ::wcscmp; | |
948 | using ::wcscoll; | |
949 | using ::wcscpy; | |
950 | using ::wcscspn; | |
951 | using ::wcsftime; | |
952 | using ::wcslen; | |
953 | using ::wcsncat; | |
954 | using ::wcsncmp; | |
955 | using ::wcsncpy; | |
956 | using ::wcspbrk; | |
957 | using ::wcsrchr; | |
958 | using ::wcsrtombs; | |
959 | using ::wcsspn; | |
960 | using ::wcsstr; | |
961 | using ::wcstod; | |
962 | using ::wcstok; | |
963 | using ::wcstol; | |
964 | using ::wcstold; | |
965 | using ::wcstoll; | |
966 | using ::wcstoul; | |
967 | using ::wcstoull; | |
968 | using ::wcsxfrm; | |
969 | using ::wctob; | |
970 | using ::wmemchr; | |
971 | using ::wmemcmp; | |
972 | using ::wmemcpy; | |
973 | using ::wmemmove; | |
974 | using ::wmemset; | |
975 | using ::wprintf; | |
976 | using ::wscanf; | |
977 | } | |
978 | ],[],[ac_c99_wchar=yes], [ac_c99_wchar=no]) | |
979 | ||
980 | # Checks for wide character functions that may not be present. | |
981 | # Injection of these is wrapped with guard macros. | |
982 | # NB: only put functions here, instead of immediately above, if | |
983 | # absolutely necessary. | |
984 | AC_TRY_COMPILE([#include <wchar.h> | |
985 | namespace test { using ::vfwscanf; } ], [], | |
986 | [AC_DEFINE(HAVE_VFWSCANF,1, | |
987 | [Defined if vfwscanf exists.])],[]) | |
988 | ||
989 | AC_TRY_COMPILE([#include <wchar.h> | |
990 | namespace test { using ::vswscanf; } ], [], | |
991 | [AC_DEFINE(HAVE_VSWSCANF,1, | |
992 | [Defined if vswscanf exists.])],[]) | |
993 | ||
994 | AC_TRY_COMPILE([#include <wchar.h> | |
995 | namespace test { using ::vwscanf; } ], [], | |
996 | [AC_DEFINE(HAVE_VWSCANF,1,[Defined if vwscanf exists.])],[]) | |
997 | ||
998 | AC_TRY_COMPILE([#include <wchar.h> | |
999 | namespace test { using ::wcstof; } ], [], | |
1000 | [AC_DEFINE(HAVE_WCSTOF,1,[Defined if wcstof exists.])],[]) | |
1001 | ||
1002 | AC_TRY_COMPILE([#include <wctype.h>], | |
1003 | [ wint_t t; int i = iswblank(t);], | |
1004 | [AC_DEFINE(HAVE_ISWBLANK,1, | |
1005 | [Defined if iswblank exists.])],[]) | |
1006 | ||
1007 | AC_MSG_CHECKING([for ISO C99 support in <wchar.h>]) | |
1008 | AC_MSG_RESULT($ac_c99_wchar) | |
1009 | fi | |
68224f8d | 1010 | |
c586733c | 1011 | # Option parsed, now set things appropriately. |
68224f8d | 1012 | if test x"$ac_c99_math" = x"no" || |
356ae535 | 1013 | test x"$ac_c99_complex" = x"no" || |
68224f8d | 1014 | test x"$ac_c99_stdio" = x"no" || |
1015 | test x"$ac_c99_stdlib" = x"no" || | |
1016 | test x"$ac_c99_wchar" = x"no"; then | |
1017 | enable_c99=no; | |
c586733c | 1018 | else |
d64903a9 | 1019 | AC_DEFINE(_GLIBCXX_USE_C99, 1, |
1020 | [Define if C99 functions or macros from <wchar.h>, <math.h>, | |
1021 | <complex.h>, <stdio.h>, and <stdlib.h> can be used or exposed.]) | |
68224f8d | 1022 | fi |
1023 | ||
1024 | AC_LANG_RESTORE | |
c586733c | 1025 | fi |
1026 | ||
1027 | AC_MSG_CHECKING([for fully enabled ISO C99 support]) | |
1028 | AC_MSG_RESULT($enable_c99) | |
401f263f | 1029 | ]) |
1030 | ||
1031 | ||
20752884 | 1032 | dnl |
68224f8d | 1033 | dnl Check for what type of C headers to use. |
1034 | dnl | |
1035 | dnl --enable-cheaders= [does stuff]. | |
1036 | dnl --disable-cheaders [does not do anything, really]. | |
1037 | dnl + Usage: GLIBCXX_ENABLE_CHEADERS[(DEFAULT)] | |
1038 | dnl Where DEFAULT is either `c' or `c_std'. | |
1039 | dnl | |
2ad02b6c | 1040 | AC_DEFUN([GLIBCXX_ENABLE_CHEADERS], [ |
68224f8d | 1041 | GLIBCXX_ENABLE(cheaders,$1,[=KIND], |
1042 | [construct "C" headers for g++], [permit c|c_std]) | |
1043 | AC_MSG_NOTICE("C" header strategy set to $enable_cheaders) | |
1044 | ||
1045 | C_INCLUDE_DIR='${glibcxx_srcdir}/include/'$enable_cheaders | |
1046 | ||
1047 | AC_SUBST(C_INCLUDE_DIR) | |
11764568 | 1048 | GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C, test $enable_cheaders = c) |
1049 | GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C_STD, test $enable_cheaders = c_std) | |
1050 | GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_COMPATIBILITY, test $c_compatibility = yes) | |
68224f8d | 1051 | ]) |
1052 | ||
1053 | ||
20752884 | 1054 | dnl |
68224f8d | 1055 | dnl Check for which locale library to use. The choice is mapped to |
1056 | dnl a subdirectory of config/locale. | |
77cbec55 | 1057 | dnl |
68224f8d | 1058 | dnl Default is generic. |
20752884 | 1059 | dnl |
2ad02b6c | 1060 | AC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [ |
68224f8d | 1061 | AC_MSG_CHECKING([for C locale to use]) |
1062 | GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@], | |
1063 | [use MODEL for target locale package], | |
1064 | [permit generic|gnu|ieee_1003.1-2001|yes|no|auto]) | |
1065 | ||
1066 | # If they didn't use this option switch, or if they specified --enable | |
1067 | # with no specific model, we'll have to look for one. If they | |
1068 | # specified --disable (???), do likewise. | |
1069 | if test $enable_clocale = no || test $enable_clocale = yes; then | |
1070 | enable_clocale=auto | |
1071 | fi | |
20752884 | 1072 | |
68224f8d | 1073 | # Either a known package, or "auto" |
20752884 | 1074 | enable_clocale_flag=$enable_clocale |
1075 | ||
68224f8d | 1076 | # Probe for locale support if no specific model is specified. |
1077 | # Default to "generic". | |
1078 | if test $enable_clocale_flag = auto; then | |
1abe8d9c | 1079 | case ${target_os} in |
1080 | linux* | gnu* | kfreebsd*-gnu | knetbsd*-gnu) | |
68224f8d | 1081 | AC_EGREP_CPP([_GLIBCXX_ok], [ |
01702872 | 1082 | #include <features.h> |
77cbec55 | 1083 | #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) |
5a64d8cf | 1084 | _GLIBCXX_ok |
01702872 | 1085 | #endif |
1086 | ], enable_clocale_flag=gnu, enable_clocale_flag=generic) | |
0d289e52 | 1087 | |
68224f8d | 1088 | # Test for bugs early in glibc-2.2.x series |
1abe8d9c | 1089 | if test $enable_clocale_flag = gnu; then |
68224f8d | 1090 | AC_TRY_RUN([ |
1091 | #define _GNU_SOURCE 1 | |
1092 | #include <locale.h> | |
1093 | #include <string.h> | |
1094 | #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) | |
1095 | extern __typeof(newlocale) __newlocale; | |
1096 | extern __typeof(duplocale) __duplocale; | |
1097 | extern __typeof(strcoll_l) __strcoll_l; | |
1098 | #endif | |
1099 | int main() | |
1100 | { | |
1101 |