]>
Commit | Line | Data |
---|---|---|
b9e8095b | 1 | dnl |
8f0dfb87 | 2 | dnl Initialize basic configure bits, set toplevel_srcdir for Makefiles. |
b9e8095b | 3 | dnl |
8400ab1c | 4 | dnl GLIBCPP_TOPREL_CONFIGURE |
5 | AC_DEFUN(GLIBCPP_TOPREL_CONFIGURE, [ | |
43390bfe | 6 | dnl Default to --enable-multilib (this is also passed by default |
7 | dnl from the ubercommon-top-level configure) | |
b9e8095b | 8 | AC_ARG_ENABLE(multilib, |
9 | [ --enable-multilib build hella library versions (default)], | |
10 | [case "${enableval}" in | |
11 | yes) multilib=yes ;; | |
12 | no) multilib=no ;; | |
13 | *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;; | |
14 | esac], [multilib=yes])dnl | |
15 | ||
acf7a6bc | 16 | # When building with srcdir == objdir, links to the source files will |
17 | # be created in directories within the target_subdir. We have to | |
18 | # adjust toplevel_srcdir accordingly, so that configure finds | |
19 | # install-sh and other auxiliary files that live in the top-level | |
20 | # source directory. | |
21 | if test "${srcdir}" = "."; then | |
22 | if test -z "${with_target_subdir}"; then | |
23 | toprel=".." | |
c099f5df | 24 | else |
acf7a6bc | 25 | if test "${with_target_subdir}" != "."; then |
26 | toprel="${with_multisrctop}../.." | |
27 | else | |
28 | toprel="${with_multisrctop}.." | |
29 | fi | |
c099f5df | 30 | fi |
acf7a6bc | 31 | else |
32 | toprel=".." | |
c099f5df | 33 | fi |
acf7a6bc | 34 | AC_CONFIG_AUX_DIR(${srcdir}/$toprel) |
35 | toplevel_srcdir=\${top_srcdir}/$toprel | |
36 | AC_SUBST(toplevel_srcdir) | |
8400ab1c | 37 | ]) |
38 | ||
39 | dnl | |
8f0dfb87 | 40 | dnl Initialize the rest of the library configury. |
8400ab1c | 41 | dnl |
42 | dnl GLIBCPP_CONFIGURE | |
43 | AC_DEFUN(GLIBCPP_CONFIGURE, [ | |
acf7a6bc | 44 | # Export build and source directories. |
45 | # These need to be absolute paths, yet at the same time need to | |
46 | # canonicalize only relative paths, because then amd will not unmount | |
47 | # drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd. | |
3354d061 | 48 | glibcpp_builddir=`${PWDCMD-pwd}` |
acf7a6bc | 49 | case $srcdir in |
50 | [\\/$]* | ?:[\\/]*) glibcpp_srcdir=${srcdir} ;; | |
51 | *) glibcpp_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;; | |
52 | esac | |
53 | AC_SUBST(glibcpp_builddir) | |
54 | AC_SUBST(glibcpp_srcdir) | |
55 | ||
56 | dnl This is here just to satisfy automake. | |
57 | ifelse(not,equal,[AC_CONFIG_AUX_DIR(..)]) | |
58 | ||
59 | AC_PROG_AWK | |
60 | # Will set LN_S to either 'ln -s' or 'ln'. With autoconf 2.5x, can also | |
43390bfe | 61 | # be 'cp -p' if linking isn't available. Uncomment the next line to |
62 | # force a particular method. | |
acf7a6bc | 63 | #ac_cv_prog_LN_S='cp -p' |
64 | AC_PROG_LN_S | |
65 | ||
66 | # We use these options to decide which functions to include. | |
67 | AC_ARG_WITH(target-subdir, | |
68 | [ --with-target-subdir=SUBDIR | |
69 | configuring in a subdirectory]) | |
70 | AC_ARG_WITH(cross-host, | |
71 | [ --with-cross-host=HOST configuring with a cross compiler]) | |
c099f5df | 72 | |
c3f3e891 | 73 | glibcpp_basedir=$srcdir/$toprel/$1/libstdc++-v3 |
b9e8095b | 74 | AC_SUBST(glibcpp_basedir) |
75 | ||
f04d76b5 | 76 | # Never versions of autoconf add an underscore to these functions. |
77 | # Prevent future problems ... | |
78 | ifdef([AC_PROG_CC_G],[],[define([AC_PROG_CC_G],defn([_AC_PROG_CC_G]))]) | |
79 | ifdef([AC_PROG_CC_GNU],[],[define([AC_PROG_CC_GNU],defn([_AC_PROG_CC_GNU]))]) | |
80 | ifdef([AC_PROG_CXX_G],[],[define([AC_PROG_CXX_G],defn([_AC_PROG_CXX_G]))]) | |
81 | ifdef([AC_PROG_CXX_GNU],[],[define([AC_PROG_CXX_GNU],defn([_AC_PROG_CXX_GNU]))]) | |
f1f1b9ae | 82 | |
acf7a6bc | 83 | # AC_PROG_CC |
84 | # FIXME: We temporarily define our own version of AC_PROG_CC. This is | |
85 | # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We | |
86 | # are probably using a cross compiler, which will not be able to fully | |
87 | # link an executable. This is addressed in later versions of autoconf. | |
88 | ||
89 | AC_DEFUN(LIB_AC_PROG_CC, | |
90 | [AC_BEFORE([$0], [AC_PROG_CPP])dnl | |
91 | dnl Fool anybody using AC_PROG_CC. | |
92 | AC_PROVIDE([AC_PROG_CC]) | |
93 | AC_CHECK_PROG(CC, gcc, gcc) | |
94 | if test -z "$CC"; then | |
95 | AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) | |
96 | test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) | |
b9e8095b | 97 | fi |
b9e8095b | 98 | |
acf7a6bc | 99 | AC_PROG_CC_GNU |
100 | ||
101 | if test $ac_cv_prog_gcc = yes; then | |
102 | GCC=yes | |
103 | dnl Check whether -g works, even if CFLAGS is set, in case the package | |
104 | dnl plays around with CFLAGS (such as to build both debugging and | |
105 | dnl normal versions of a library), tasteless as that idea is. | |
106 | ac_test_CFLAGS="${CFLAGS+set}" | |
107 | ac_save_CFLAGS="$CFLAGS" | |
108 | CFLAGS= | |
109 | AC_PROG_CC_G | |
110 | if test "$ac_test_CFLAGS" = set; then | |
111 | CFLAGS="$ac_save_CFLAGS" | |
112 | elif test $ac_cv_prog_cc_g = yes; then | |
113 | CFLAGS="-g -O2" | |
114 | else | |
115 | CFLAGS="-O2" | |
116 | fi | |
b9e8095b | 117 | else |
acf7a6bc | 118 | GCC= |
119 | test "${CFLAGS+set}" = set || CFLAGS="-g" | |
b9e8095b | 120 | fi |
acf7a6bc | 121 | ]) |
122 | ||
123 | LIB_AC_PROG_CC | |
124 | ||
125 | # Likewise for AC_PROG_CXX. We can't just call it directly because g++ | |
126 | # will try to link in libstdc++. | |
127 | AC_DEFUN(LIB_AC_PROG_CXX, | |
128 | [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl | |
129 | dnl Fool anybody using AC_PROG_CXX. | |
130 | AC_PROVIDE([AC_PROG_CXX]) | |
131 | # Use glibcpp_CXX so that we do not cause CXX to be cached with the | |
132 | # flags that come in CXX while configuring libstdc++. They're different | |
133 | # from those used for all other target libraries. If CXX is set in | |
134 | # the environment, respect that here. | |
135 | glibcpp_CXX=$CXX | |
136 | AC_CHECK_PROGS(glibcpp_CXX, $CCC c++ g++ gcc CC cxx cc++, gcc) | |
137 | AC_SUBST(glibcpp_CXX) | |
138 | CXX=$glibcpp_CXX | |
139 | test -z "$glibcpp_CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH]) | |
140 | ||
141 | AC_PROG_CXX_GNU | |
142 | ||
143 | if test $ac_cv_prog_gxx = yes; then | |
144 | GXX=yes | |
145 | dnl Check whether -g works, even if CXXFLAGS is set, in case the package | |
146 | dnl plays around with CXXFLAGS (such as to build both debugging and | |
147 | dnl normal versions of a library), tasteless as that idea is. | |
148 | ac_test_CXXFLAGS="${CXXFLAGS+set}" | |
149 | ac_save_CXXFLAGS="$CXXFLAGS" | |
150 | CXXFLAGS= | |
151 | AC_PROG_CXX_G | |
152 | if test "$ac_test_CXXFLAGS" = set; then | |
153 | CXXFLAGS="$ac_save_CXXFLAGS" | |
154 | elif test $ac_cv_prog_cxx_g = yes; then | |
155 | CXXFLAGS="-g -O2" | |
156 | else | |
157 | CXXFLAGS="-O2" | |
158 | fi | |
159 | else | |
160 | GXX= | |
161 | test "${CXXFLAGS+set}" = set || CXXFLAGS="-g" | |
162 | fi | |
163 | ]) | |
b9e8095b | 164 | |
acf7a6bc | 165 | LIB_AC_PROG_CXX |
b9e8095b | 166 | |
501dc171 | 167 | # For directory versioning (e.g., headers) and other variables. |
168 | AC_MSG_CHECKING([for GCC version number]) | |
169 | gcc_version=`$glibcpp_CXX -dumpversion` | |
170 | AC_MSG_RESULT($gcc_version) | |
171 | ||
acf7a6bc | 172 | # For some reason, gettext needs this. |
173 | AC_ISC_POSIX | |
c099f5df | 174 | |
f1f1b9ae | 175 | AC_CHECK_TOOL(AS, as) |
176 | AC_CHECK_TOOL(AR, ar) | |
c45e0e39 | 177 | AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error) |
f1f1b9ae | 178 | AC_PROG_INSTALL |
b9e8095b | 179 | |
f1f1b9ae | 180 | AM_MAINTAINER_MODE |
b9e8095b | 181 | |
f1f1b9ae | 182 | # We need AC_EXEEXT to keep automake happy in cygnus mode. However, |
183 | # at least currently, we never actually build a program, so we never | |
184 | # need to use $(EXEEXT). Moreover, the test for EXEEXT normally | |
185 | # fails, because we are probably configuring with a cross compiler | |
8aa131b0 | 186 | # which can't create executables. So we include AC_EXEEXT to keep |
187 | # automake happy, but we don't execute it, since we don't care about | |
0a40c6ad | 188 | # the result. |
f1f1b9ae | 189 | if false; then |
cc4069a9 | 190 | # autoconf 2.50 runs AC_EXEEXT by default, and the macro expands |
191 | # to nothing, so nothing would remain between `then' and `fi' if it | |
192 | # were not for the `:' below. | |
193 | : | |
f1f1b9ae | 194 | AC_EXEEXT |
195 | fi | |
b9e8095b | 196 | |
f1f1b9ae | 197 | case [$]{glibcpp_basedir} in |
557a32f1 | 198 | /* | [A-Za-z]:[\\/]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;; |
f1f1b9ae | 199 | *) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;; |
200 | esac | |
b9e8095b | 201 | |
43390bfe | 202 | # Find platform-specific directories containing configuration info. In |
5886ba5e | 203 | # addition to possibly modifying the same flags, it also sets up symlinks. |
1d71fbac | 204 | GLIBCPP_CHECK_TARGET |
b9e8095b | 205 | ]) |
206 | ||
207 | ||
208 | dnl | |
9c6a106c | 209 | dnl Check to see if g++ can compile this library, and if so, if any version- |
77cbec55 | 210 | dnl specific precautions need to be taken. |
211 | dnl | |
c21bc234 | 212 | dnl GLIBCPP_CHECK_COMPILER_VERSION |
213 | AC_DEFUN(GLIBCPP_CHECK_COMPILER_VERSION, [ | |
95925f2c | 214 | if test ! -f stamp-sanity-compiler; then |
215 | AC_MSG_CHECKING([for g++ that will successfully compile libstdc++-v3]) | |
216 | AC_LANG_SAVE | |
217 | AC_LANG_CPLUSPLUS | |
c2f3d0d8 | 218 | AC_TRY_COMPILE(, [ |
219 | #if __GNUC__ < 3 | |
220 | not_ok | |
c21bc234 | 221 | #endif |
90d10a87 | 222 | ], gpp_satisfactory=yes, AC_MSG_ERROR([please upgrade to GCC 3.0 or above])) |
95925f2c | 223 | AC_LANG_RESTORE |
c21bc234 | 224 | AC_MSG_RESULT($gpp_satisfactory) |
95925f2c | 225 | touch stamp-sanity-compiler |
226 | fi | |
c21bc234 | 227 | ]) |
228 | ||
229 | ||
230 | dnl | |
457683de | 231 | dnl Tests for newer compiler features, or features that are present in newer |
232 | dnl compiler versions but not older compiler versions still in use, should | |
233 | dnl be placed here. | |
b9e8095b | 234 | dnl |
211ecbdf | 235 | dnl Define WERROR='-Werror' if requested and possible; g++'s that lack the |
236 | dnl new inlining code or the new system_header pragma will die on -Werror. | |
237 | dnl Leave it out by default and use maint-mode to use it. | |
b9e8095b | 238 | dnl |
c21bc234 | 239 | dnl Define SECTION_FLAGS='-ffunction-sections -fdata-sections' if |
b9386e63 | 240 | dnl compiler supports it and the user has not requested debug mode. |
241 | dnl | |
c21bc234 | 242 | dnl GLIBCPP_CHECK_COMPILER_FEATURES |
243 | AC_DEFUN(GLIBCPP_CHECK_COMPILER_FEATURES, [ | |
c51c23c3 | 244 | # All these tests are for C++; save the language and the compiler flags. |
457683de | 245 | # The CXXFLAGS thing is suspicious, but based on similar bits previously |
c51c23c3 | 246 | # found in GLIBCPP_CONFIGURE. |
247 | AC_LANG_SAVE | |
248 | AC_LANG_CPLUSPLUS | |
249 | ac_test_CXXFLAGS="${CXXFLAGS+set}" | |
250 | ac_save_CXXFLAGS="$CXXFLAGS" | |
c51c23c3 | 251 | |
211ecbdf | 252 | # Check for maintainer-mode bits. |
253 | if test x"$USE_MAINTAINER_MODE" = xno; then | |
254 | WERROR='' | |
9c6a106c | 255 | else |
211ecbdf | 256 | WERROR='-Werror' |
9c6a106c | 257 | fi |
258 | ||
c21bc234 | 259 | # Check for -ffunction-sections -fdata-sections |
260 | AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections]) | |
8e34227a | 261 | CXXFLAGS='-Werror -ffunction-sections -fdata-sections' |
c21bc234 | 262 | AC_TRY_COMPILE(, [int foo; |
263 | ], [ac_fdsections=yes], [ac_fdsections=no]) | |
264 | if test "$ac_test_CXXFLAGS" = set; then | |
265 | CXXFLAGS="$ac_save_CXXFLAGS" | |
266 | else | |
267 | # this is the suspicious part | |
268 | CXXFLAGS='' | |
269 | fi | |
7f713ccf | 270 | if test x"$ac_fdsections" = x"yes"; then |
c21bc234 | 271 | SECTION_FLAGS='-ffunction-sections -fdata-sections' |
272 | fi | |
273 | AC_MSG_RESULT($ac_fdsections) | |
274 | ||
c51c23c3 | 275 | AC_LANG_RESTORE |
9c6a106c | 276 | AC_SUBST(WERROR) |
c21bc234 | 277 | AC_SUBST(SECTION_FLAGS) |
b9e8095b | 278 | ]) |
279 | ||
c21bc234 | 280 | |
281 | dnl | |
06f58ac6 | 282 | dnl If GNU ld is in use, check to see if tricky linker opts can be used. If |
283 | dnl the native linker is in use, all variables will be defined to something | |
284 | dnl safe (like an empty string). | |
285 | dnl | |
286 | dnl Define SECTION_LDFLAGS='-Wl,--gc-sections' if possible. | |
287 | dnl Define OPT_LDFLAGS='-Wl,-O1' if possible. | |
00c7100f | 288 | dnl Define LD, with_gnu_ld, and (possibly) glibcpp_gnu_ld_version as |
289 | dnl side-effects of testing. | |
c21bc234 | 290 | dnl |
c21bc234 | 291 | dnl GLIBCPP_CHECK_LINKER_FEATURES |
292 | AC_DEFUN(GLIBCPP_CHECK_LINKER_FEATURES, [ | |
06f58ac6 | 293 | # If we're not using GNU ld, then there's no point in even trying these |
294 | # tests. Check for that first. We should have already tested for gld | |
295 | # by now (in libtool), but require it now just to be safe... | |
13bad5d9 | 296 | test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS='' |
297 | test -z "$OPT_LDFLAGS" && OPT_LDFLAGS='' | |
06f58ac6 | 298 | AC_REQUIRE([AC_PROG_LD]) |
445cdc9a | 299 | |
00c7100f | 300 | # The name set by libtool depends on the version of libtool. Shame on us |
301 | # for depending on an impl detail, but c'est la vie. Older versions used | |
302 | # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on | |
303 | # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually | |
304 | # makes sense). We'll test with_gnu_ld everywhere else, so if that isn't | |
305 | # set (hence we're using an older libtool), then set it. | |
306 | if test x${with_gnu_ld+set} != xset; then | |
307 | if test x${ac_cv_prog_gnu_ld+set} != xset; then | |
308 | # We got through "ac_require(ac_prog_ld)" and still not set? Huh? | |
309 | with_gnu_ld=no | |
310 | else | |
311 | with_gnu_ld=$ac_cv_prog_gnu_ld | |
312 | fi | |
313 | fi | |
314 | ||
315 | # Start by getting the version number. I think the libtool test already | |
316 | # does some of this, but throws away the result. | |
317 | changequote(,) | |
318 | ldver=`$LD --version 2>/dev/null | head -1 | \ | |
319 | sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'` | |
320 | changequote([,]) | |
321 | glibcpp_gnu_ld_version=`echo $ldver | \ | |
322 | $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'` | |
323 | ||
445cdc9a | 324 | # Set --gc-sections. |
00c7100f | 325 | if test "$with_gnu_ld" = "notbroken"; then |
985550e9 | 326 | # GNU ld it is! Joy and bunny rabbits! |
06f58ac6 | 327 | |
328 | # All these tests are for C++; save the language and the compiler flags. | |
329 | # Need to do this so that g++ won't try to link in libstdc++ | |
330 | ac_test_CFLAGS="${CFLAGS+set}" | |
331 | ac_save_CFLAGS="$CFLAGS" | |
445cdc9a | 332 | CFLAGS='-x c++ -Wl,--gc-sections' |
06f58ac6 | 333 | |
334 | # Check for -Wl,--gc-sections | |
71dbcf67 | 335 | # XXX This test is broken at the moment, as symbols required for |
77cbec55 | 336 | # linking are now in libsupc++ (not built yet.....). In addition, |
985550e9 | 337 | # this test has cored on solaris in the past. In addition, |
338 | # --gc-sections doesn't really work at the moment (keeps on discarding | |
339 | # used sections, first .eh_frame and now some of the glibc sections for | |
340 | # iconv). Bzzzzt. Thanks for playing, maybe next time. | |
06f58ac6 | 341 | AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections]) |
342 | AC_TRY_RUN([ | |
77cbec55 | 343 | int main(void) |
06f58ac6 | 344 | { |
985550e9 | 345 | try { throw 1; } |
346 | catch (...) { }; | |
06f58ac6 | 347 | return 0; |
348 | } | |
4bc1d851 | 349 | ], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], [ac_sectionLDflags=yes]) |
06f58ac6 | 350 | if test "$ac_test_CFLAGS" = set; then |
351 | CFLAGS="$ac_save_CFLAGS" | |
352 | else | |
353 | # this is the suspicious part | |
354 | CFLAGS='' | |
355 | fi | |
356 | if test "$ac_sectionLDflags" = "yes"; then | |
13bad5d9 | 357 | SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS" |
06f58ac6 | 358 | fi |
359 | AC_MSG_RESULT($ac_sectionLDflags) | |
445cdc9a | 360 | fi |
985550e9 | 361 | |
445cdc9a | 362 | # Set linker optimization flags. |
7f713ccf | 363 | if test x"$with_gnu_ld" = x"yes"; then |
13bad5d9 | 364 | OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS" |
06f58ac6 | 365 | fi |
445cdc9a | 366 | |
c21bc234 | 367 | AC_SUBST(SECTION_LDFLAGS) |
06f58ac6 | 368 | AC_SUBST(OPT_LDFLAGS) |
c21bc234 | 369 | ]) |
370 | ||
371 | ||
b9e8095b | 372 | dnl |
04081d71 | 373 | dnl Check to see if the (math function) argument passed is |
a54b7bcc | 374 | dnl declared when using the c++ compiler |
7fdffd07 | 375 | dnl ASSUMES argument is a math function with ONE parameter |
376 | dnl | |
a54b7bcc | 377 | dnl GLIBCPP_CHECK_MATH_DECL_1 |
378 | AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_1, [ | |
7fdffd07 | 379 | AC_MSG_CHECKING([for $1 declaration]) |
41127527 | 380 | if test x${glibcpp_cv_func_$1_use+set} != xset; then |
381 | AC_CACHE_VAL(glibcpp_cv_func_$1_use, [ | |
382 | AC_LANG_SAVE | |
383 | AC_LANG_CPLUSPLUS | |
d6f87729 | 384 | AC_TRY_COMPILE([#include <math.h> |
385 | #ifdef HAVE_IEEEFP_H | |
386 | #include <ieeefp.h> | |
387 | #endif | |
77cbec55 | 388 | ], |
389 | [ $1(0);], | |
41127527 | 390 | [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no]) |
391 | AC_LANG_RESTORE | |
392 | ]) | |
393 | fi | |
06f58ac6 | 394 | AC_MSG_RESULT($glibcpp_cv_func_$1_use) |
a54b7bcc | 395 | ]) |
396 | ||
397 | dnl | |
398 | dnl Check to see if the (math function) argument passed is | |
399 | dnl 1) declared when using the c++ compiler | |
400 | dnl 2) has "C" linkage | |
401 | dnl 3) if not, see if 1) and 2) for argument prepended with '_' | |
402 | dnl | |
403 | dnl Define HAVE_CARGF etc if "cargf" is declared and links | |
404 | dnl | |
405 | dnl argument 1 is name of function to check | |
406 | dnl | |
407 | dnl ASSUMES argument is a math function with ONE parameter | |
408 | dnl | |
409 | dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1 | |
410 | AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, [ | |
411 | GLIBCPP_CHECK_MATH_DECL_1($1) | |
06f58ac6 | 412 | if test x$glibcpp_cv_func_$1_use = x"yes"; then |
77cbec55 | 413 | AC_CHECK_FUNCS($1) |
a54b7bcc | 414 | else |
415 | GLIBCPP_CHECK_MATH_DECL_1(_$1) | |
416 | if test x$glibcpp_cv_func__$1_use = x"yes"; then | |
77cbec55 | 417 | AC_CHECK_FUNCS(_$1) |
2475beac | 418 | fi |
7fdffd07 | 419 | fi |
420 | ]) | |
421 | ||
a54b7bcc | 422 | |
af3ed51d | 423 | dnl |
424 | dnl Like GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, but does a bunch of | |
77cbec55 | 425 | dnl of functions at once. It's an all-or-nothing check -- either |
93a3ddb7 | 426 | dnl HAVE_XYZ is defined for each of the functions, or for none of them. |
af3ed51d | 427 | dnl Doing it this way saves significant configure time. |
428 | AC_DEFUN(GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1, [ | |
429 | AC_MSG_CHECKING([for $1 functions]) | |
430 | AC_CACHE_VAL(glibcpp_cv_func_$2_use, [ | |
431 | AC_LANG_SAVE | |
432 | AC_LANG_CPLUSPLUS | |
433 | AC_TRY_COMPILE([#include <math.h>], | |
434 | [ `for x in $3; do echo "$x (0);"; done` ], | |
93a3ddb7 | 435 | [glibcpp_cv_func_$2_use=yes], |
436 | [glibcpp_cv_func_$2_use=no]) | |
af3ed51d | 437 | AC_LANG_RESTORE]) |
438 | AC_MSG_RESULT($glibcpp_cv_func_$2_use) | |
439 | if test x$glibcpp_cv_func_$2_use = x"yes"; then | |
440 | AC_CHECK_FUNCS($3) | |
441 | fi | |
442 | ]) | |
7fdffd07 | 443 | |
444 | dnl | |
04081d71 | 445 | dnl Check to see if the (math function) argument passed is |
a54b7bcc | 446 | dnl declared when using the c++ compiler |
457683de | 447 | dnl ASSUMES argument is a math function with TWO parameters |
7fdffd07 | 448 | dnl |
a54b7bcc | 449 | dnl GLIBCPP_CHECK_MATH_DECL_2 |
450 | AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_2, [ | |
7fdffd07 | 451 | AC_MSG_CHECKING([for $1 declaration]) |
41127527 | 452 | if test x${glibcpp_cv_func_$1_use+set} != xset; then |
453 | AC_CACHE_VAL(glibcpp_cv_func_$1_use, [ | |
454 | AC_LANG_SAVE | |
455 | AC_LANG_CPLUSPLUS | |
77cbec55 | 456 | AC_TRY_COMPILE([#include <math.h>], |
457 | [ $1(0, 0);], | |
41127527 | 458 | [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no]) |
459 | AC_LANG_RESTORE | |
460 | ]) | |
461 | fi | |
06f58ac6 | 462 | AC_MSG_RESULT($glibcpp_cv_func_$1_use) |
7fdffd07 | 463 | ]) |
464 | ||
7fdffd07 | 465 | dnl |
04081d71 | 466 | dnl Check to see if the (math function) argument passed is |
7fdffd07 | 467 | dnl 1) declared when using the c++ compiler |
468 | dnl 2) has "C" linkage | |
469 | dnl | |
470 | dnl Define HAVE_CARGF etc if "cargf" is declared and links | |
471 | dnl | |
472 | dnl argument 1 is name of function to check | |
473 | dnl | |
a54b7bcc | 474 | dnl ASSUMES argument is a math function with TWO parameters |
7fdffd07 | 475 | dnl |
a54b7bcc | 476 | dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2 |
477 | AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2, [ | |
478 | GLIBCPP_CHECK_MATH_DECL_2($1) | |
479 | if test x$glibcpp_cv_func_$1_use = x"yes"; then | |
77cbec55 | 480 | AC_CHECK_FUNCS($1) |
a54b7bcc | 481 | else |
482 | GLIBCPP_CHECK_MATH_DECL_2(_$1) | |
483 | if test x$glibcpp_cv_func__$1_use = x"yes"; then | |
77cbec55 | 484 | AC_CHECK_FUNCS(_$1) |
2475beac | 485 | fi |
a54b7bcc | 486 | fi |
487 | ]) | |
488 | ||
489 | ||
490 | dnl | |
491 | dnl Check to see if the (math function) argument passed is | |
492 | dnl declared when using the c++ compiler | |
457683de | 493 | dnl ASSUMES argument is a math function with THREE parameters |
a54b7bcc | 494 | dnl |
495 | dnl GLIBCPP_CHECK_MATH_DECL_3 | |
496 | AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_3, [ | |
7fdffd07 | 497 | AC_MSG_CHECKING([for $1 declaration]) |
41127527 | 498 | if test x${glibcpp_cv_func_$1_use+set} != xset; then |
499 | AC_CACHE_VAL(glibcpp_cv_func_$1_use, [ | |
500 | AC_LANG_SAVE | |
501 | AC_LANG_CPLUSPLUS | |
77cbec55 | 502 | AC_TRY_COMPILE([#include <math.h>], |
503 | [ $1(0, 0, 0);], | |
41127527 | 504 | [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no]) |
505 | AC_LANG_RESTORE | |
506 | ]) | |
507 | fi | |
06f58ac6 | 508 | AC_MSG_RESULT($glibcpp_cv_func_$1_use) |
a54b7bcc | 509 | ]) |
510 | ||
511 | dnl | |
512 | dnl Check to see if the (math function) argument passed is | |
513 | dnl 1) declared when using the c++ compiler | |
514 | dnl 2) has "C" linkage | |
515 | dnl | |
516 | dnl Define HAVE_CARGF etc if "cargf" is declared and links | |
517 | dnl | |
518 | dnl argument 1 is name of function to check | |
519 | dnl | |
520 | dnl ASSUMES argument is a math function with THREE parameters | |
521 | dnl | |
522 | dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3 | |
523 | AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3, [ | |
524 | GLIBCPP_CHECK_MATH_DECL_3($1) | |
06f58ac6 | 525 | if test x$glibcpp_cv_func_$1_use = x"yes"; then |
77cbec55 | 526 | AC_CHECK_FUNCS($1) |
a54b7bcc | 527 | else |
528 | GLIBCPP_CHECK_MATH_DECL_3(_$1) | |
529 | if test x$glibcpp_cv_func__$1_use = x"yes"; then | |
77cbec55 | 530 | AC_CHECK_FUNCS(_$1) |
2475beac | 531 | fi |
7fdffd07 | 532 | fi |
533 | ]) | |
534 | ||
535 | ||
445cdc9a | 536 | dnl |
537 | dnl Check to see if the (stdlib function) argument passed is | |
538 | dnl 1) declared when using the c++ compiler | |
539 | dnl 2) has "C" linkage | |
540 | dnl | |
445cdc9a | 541 | dnl argument 1 is name of function to check |
542 | dnl | |
543 | dnl ASSUMES argument is a math function with TWO parameters | |
544 | dnl | |
545 | dnl GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2 | |
546 | AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2, [ | |
547 | AC_MSG_CHECKING([for $1 declaration]) | |
41127527 | 548 | if test x${glibcpp_cv_func_$1_use+set} != xset; then |
549 | AC_CACHE_VAL(glibcpp_cv_func_$1_use, [ | |
550 | AC_LANG_SAVE | |
551 | AC_LANG_CPLUSPLUS | |
77cbec55 | 552 | AC_TRY_COMPILE([#include <stdlib.h>], |
553 | [ $1(0, 0);], | |
41127527 | 554 | [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no]) |
555 | AC_LANG_RESTORE | |
556 | ]) | |
557 | fi | |
445cdc9a | 558 | AC_MSG_RESULT($glibcpp_cv_func_$1_use) |
559 | if test x$glibcpp_cv_func_$1_use = x"yes"; then | |
77cbec55 | 560 | AC_CHECK_FUNCS($1) |
445cdc9a | 561 | fi |
562 | ]) | |
563 | ||
564 | ||
2c1e3fae | 565 | dnl |
566 | dnl Check to see if the (stdlib function) argument passed is | |
567 | dnl 1) declared when using the c++ compiler | |
568 | dnl 2) has "C" linkage | |
569 | dnl | |
570 | dnl argument 1 is name of function to check | |
571 | dnl | |
572 | dnl ASSUMES argument is a function with THREE parameters | |
573 | dnl | |
574 | dnl GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_3 | |
575 | AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_3, [ | |
576 | AC_MSG_CHECKING([for $1 declaration]) | |
577 | if test x${glibcpp_cv_func_$1_use+set} != xset; then | |
578 | AC_CACHE_VAL(glibcpp_cv_func_$1_use, [ | |
579 | AC_LANG_SAVE | |
580 | AC_LANG_CPLUSPLUS | |
77cbec55 | 581 | AC_TRY_COMPILE([#include <stdlib.h>], |
582 | [ $1(0, 0, 0);], | |
2c1e3fae | 583 | [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no]) |
584 | AC_LANG_RESTORE | |
585 | ]) | |
586 | fi | |
587 | AC_MSG_RESULT($glibcpp_cv_func_$1_use) | |
588 | if test x$glibcpp_cv_func_$1_use = x"yes"; then | |
77cbec55 | 589 | AC_CHECK_FUNCS($1) |
2c1e3fae | 590 | fi |
591 | ]) | |
592 | ||
04081d71 | 593 | dnl |
77cbec55 | 594 | dnl Because the builtins are picky picky picky about the arguments they take, |
04081d71 | 595 | dnl do an explict linkage tests here. |
596 | dnl Check to see if the (math function) argument passed is | |
597 | dnl 1) declared when using the c++ compiler | |
598 | dnl 2) has "C" linkage | |
599 | dnl | |
600 | dnl Define HAVE_CARGF etc if "cargf" is declared and links | |
601 | dnl | |
602 | dnl argument 1 is name of function to check | |
603 | dnl | |
604 | dnl ASSUMES argument is a math function with ONE parameter | |
605 | dnl | |
606 | dnl GLIBCPP_CHECK_BUILTIN_MATH_DECL_LINKAGE_1 | |
607 | AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1, [ | |
04081d71 | 608 | AC_MSG_CHECKING([for $1 declaration]) |
41127527 | 609 | if test x${glibcpp_cv_func_$1_use+set} != xset; then |
610 | AC_CACHE_VAL(glibcpp_cv_func_$1_use, [ | |
611 | AC_LANG_SAVE | |
612 | AC_LANG_CPLUSPLUS | |
77cbec55 | 613 | AC_TRY_COMPILE([#include <math.h>], |
614 | [ $1(0);], | |
41127527 | 615 | [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no]) |
616 | AC_LANG_RESTORE | |
617 | ]) | |
618 | fi | |
06f58ac6 | 619 | AC_MSG_RESULT($glibcpp_cv_func_$1_use) |
620 | if test x$glibcpp_cv_func_$1_use = x"yes"; then | |
04081d71 | 621 | AC_MSG_CHECKING([for $1 linkage]) |
41127527 | 622 | if test x${glibcpp_cv_func_$1_link+set} != xset; then |
623 | AC_CACHE_VAL(glibcpp_cv_func_$1_link, [ | |
77cbec55 | 624 | AC_TRY_LINK([#include <math.h>], |
625 | [ $1(0);], | |
41127527 | 626 | [glibcpp_cv_func_$1_link=yes], [glibcpp_cv_func_$1_link=no]) |
627 | ]) | |
628 | fi | |
06f58ac6 | 629 | AC_MSG_RESULT($glibcpp_cv_func_$1_link) |
630 | if test x$glibcpp_cv_func_$1_link = x"yes"; then | |
04081d71 | 631 | ac_tr_func=HAVE_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` |
632 | AC_DEFINE_UNQUOTED(${ac_tr_func}) | |
633 | fi | |
634 | fi | |
635 | ]) | |
636 | ||
637 | ||
638 | dnl | |
639 | dnl Check to see what builtin math functions are supported | |
640 | dnl | |
641 | dnl check for __builtin_abs | |
642 | dnl check for __builtin_fabsf | |
643 | dnl check for __builtin_fabs | |
644 | dnl check for __builtin_fabl | |
645 | dnl check for __builtin_labs | |
646 | dnl check for __builtin_sqrtf | |
647 | dnl check for __builtin_sqrtl | |
75357f66 | 648 | dnl check for __builtin_sqrt |
04081d71 | 649 | dnl check for __builtin_sinf |
650 | dnl check for __builtin_sin | |
651 | dnl check for __builtin_sinl | |
652 | dnl check for __builtin_cosf | |
653 | dnl check for __builtin_cos | |
654 | dnl check for __builtin_cosl | |
655 | dnl | |
656 | dnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT | |
657 | AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [ | |
658 | dnl Test for builtin math functions. | |
77cbec55 | 659 | dnl These are made in gcc/c-common.c |
04081d71 | 660 | GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_abs) |
661 | GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsf) | |
662 | GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabs) | |
663 | GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsl) | |
664 | GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_labs) | |
665 | ||
666 | GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtf) | |
75357f66 | 667 | GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrt) |
04081d71 | 668 | GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtl) |
669 | ||
670 | GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinf) | |
671 | GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sin) | |
672 | GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinl) | |
673 | ||
674 | GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosf) | |
675 | GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cos) | |
676 | GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosl) | |
677 | ||
678 | dnl There is, without a doubt, a more elegant way to have these | |
679 | dnl names exported so that they won't be stripped out of acconfig.h by | |
680 | dnl autoheader. I leave this as an exercise to somebody less frustrated | |
681 | dnl than I.... please email the libstdc++ list if you can figure out a | |
682 | dnl more elegant approach (see autoconf/acgen.m4 and specifically | |
683 | dnl AC_CHECK_FUNC for things to steal.) | |
684 | dummyvar=no | |
685 | if test x$dummyvar = x"yes"; then | |
686 | AC_DEFINE(HAVE___BUILTIN_ABS) | |
687 | AC_DEFINE(HAVE___BUILTIN_LABS) | |
688 | AC_DEFINE(HAVE___BUILTIN_COS) | |
689 | AC_DEFINE(HAVE___BUILTIN_COSF) | |
690 | AC_DEFINE(HAVE___BUILTIN_COSL) | |
691 | AC_DEFINE(HAVE___BUILTIN_FABS) | |
692 | AC_DEFINE(HAVE___BUILTIN_FABSF) | |
693 | AC_DEFINE(HAVE___BUILTIN_FABSL) | |
694 | AC_DEFINE(HAVE___BUILTIN_SIN) | |
695 | AC_DEFINE(HAVE___BUILTIN_SINF) | |
696 | AC_DEFINE(HAVE___BUILTIN_SINL) | |
75357f66 | 697 | AC_DEFINE(HAVE___BUILTIN_SQRT) |
04081d71 | 698 | AC_DEFINE(HAVE___BUILTIN_SQRTF) |
699 | AC_DEFINE(HAVE___BUILTIN_SQRTL) | |
700 | fi | |
701 | ]) | |
702 | ||
445cdc9a | 703 | dnl |
9b15111c | 704 | dnl Check to see what the underlying c library is like |
77cbec55 | 705 | dnl These checks need to do two things: |
445cdc9a | 706 | dnl 1) make sure the name is declared when using the c++ compiler |
707 | dnl 2) make sure the name has "C" linkage | |
708 | dnl This might seem like overkill but experience has shown that it's not... | |
709 | dnl | |
08078d47 | 710 | dnl Define HAVE_STRTOLD if "strtold" is declared and links |
711 | dnl Define HAVE_STRTOF if "strtof" is declared and links | |
712 | dnl Define HAVE_DRAND48 if "drand48" is declared and links | |
445cdc9a | 713 | dnl |
714 | dnl GLIBCPP_CHECK_STDLIB_SUPPORT | |
715 | AC_DEFUN(GLIBCPP_CHECK_STDLIB_SUPPORT, [ | |
716 | ac_test_CXXFLAGS="${CXXFLAGS+set}" | |
717 | ac_save_CXXFLAGS="$CXXFLAGS" | |
718 | CXXFLAGS='-fno-builtins -D_GNU_SOURCE' | |
719 | ||
445cdc9a | 720 | GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtold) |
a36f8f2b | 721 | GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtof) |
08078d47 | 722 | AC_CHECK_FUNCS(drand48) |
445cdc9a | 723 | |
724 | CXXFLAGS="$ac_save_CXXFLAGS" | |
725 | ]) | |
726 | ||
b170b427 | 727 | dnl |
728 | dnl Check to see what the underlying c library or math library is like. | |
77cbec55 | 729 | dnl These checks need to do two things: |
7fdffd07 | 730 | dnl 1) make sure the name is declared when using the c++ compiler |
731 | dnl 2) make sure the name has "C" linkage | |
732 | dnl This might seem like overkill but experience has shown that it's not... | |
b170b427 | 733 | dnl |
734 | dnl Define HAVE_CARGF etc if "cargf" is found. | |
735 | dnl | |
736 | dnl GLIBCPP_CHECK_MATH_SUPPORT | |
737 | AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [ | |
7fdffd07 | 738 | ac_test_CXXFLAGS="${CXXFLAGS+set}" |
739 | ac_save_CXXFLAGS="$CXXFLAGS" | |
76e6433d | 740 | CXXFLAGS='-fno-builtins -D_GNU_SOURCE' |
ef4c833e | 741 | |
742 | dnl Check libm | |
b170b427 | 743 | AC_CHECK_LIB(m, sin, libm="-lm") |
7fdffd07 | 744 | ac_save_LIBS="$LIBS" |
b170b427 | 745 | LIBS="$LIBS $libm" |
746 | ||
7fdffd07 | 747 | dnl Check to see if certain C math functions exist. |
748 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinf) | |
749 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnan) | |
750 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finite) | |
751 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysign) | |
752 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincos) | |
753 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fpclass) | |
754 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(qfpclass) | |
1e59e631 | 755 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypot) |
7fdffd07 | 756 | |
757 | dnl Check to see if basic C math functions have float versions. | |
af3ed51d | 758 | GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float trig, |
93a3ddb7 | 759 | float_trig, |
760 | acosf asinf atanf \ | |
af3ed51d | 761 | cosf sinf tanf \ |
93a3ddb7 | 762 | coshf sinhf tanhf) |
af3ed51d | 763 | GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float round, |
93a3ddb7 | 764 | float_round, |
af3ed51d | 765 | ceilf floorf) |
d50d98ed | 766 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expf) |
7fdffd07 | 767 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanf) |
768 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinff) | |
1e59e631 | 769 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2f) |
7fdffd07 | 770 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsf) |
7fdffd07 | 771 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodf) |
772 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpf) | |
1e59e631 | 773 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypotf) |
7fdffd07 | 774 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpf) |
775 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logf) | |
776 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10f) | |
777 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modff) | |
778 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powf) | |
7fdffd07 | 779 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtf) |
7fdffd07 | 780 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosf) |
781 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitef) | |
782 | ||
783 | dnl Check to see if basic C math functions have long double versions. | |
af3ed51d | 784 | GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double trig, |
93a3ddb7 | 785 | long_double_trig, |
786 | acosl asinl atanl \ | |
af3ed51d | 787 | cosl sinl tanl \ |
93a3ddb7 | 788 | coshl sinhl tanhl) |
af3ed51d | 789 | GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double round, |
93a3ddb7 | 790 | long_double_round, |
af3ed51d | 791 | ceill floorl) |
7fdffd07 | 792 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanl) |
793 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinfl) | |
04081d71 | 794 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysignl) |
7fdffd07 | 795 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2l) |
7fdffd07 | 796 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expl) |
797 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsl) | |
7fdffd07 | 798 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodl) |
799 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpl) | |
1e59e631 | 800 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(hypotl) |
7fdffd07 | 801 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpl) |
802 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logl) | |
803 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10l) | |
804 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modfl) | |
805 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powl) | |
7fdffd07 | 806 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtl) |
7fdffd07 | 807 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosl) |
808 | GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitel) | |
809 | ||
810 | dnl Some runtimes have these functions with a preceding underscore. Please | |
811 | dnl keep this sync'd with the one above. And if you add any new symbol, | |
812 | dnl please add the corresponding block in the @BOTTOM@ section of acconfig.h. | |
813 | dnl Check to see if certain C math functions exist. | |
7fdffd07 | 814 | |
815 | dnl Check to see if basic C math functions have float versions. | |
af3ed51d | 816 | GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float trig, |
93a3ddb7 | 817 | _float_trig, |
818 | _acosf _asinf _atanf \ | |
af3ed51d | 819 | _cosf _sinf _tanf \ |
93a3ddb7 | 820 | _coshf _sinhf _tanhf) |
af3ed51d | 821 | GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float round, |
93a3ddb7 | 822 | _float_round, |
af3ed51d | 823 | _ceilf _floorf) |
7fdffd07 | 824 | |
825 | dnl Check to see if basic C math functions have long double versions. | |
af3ed51d | 826 | GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double trig, |
93a3ddb7 | 827 | _long_double_trig, |
828 | _acosl _asinl _atanl \ | |
af3ed51d | 829 | _cosl _sinl _tanl \ |
93a3ddb7 | 830 | _coshl _sinhl _tanhl) |
af3ed51d | 831 | GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double round, |
93a3ddb7 | 832 | _long_double_round, |
af3ed51d | 833 | _ceill _floorl) |
7fdffd07 | 834 | |
835 | LIBS="$ac_save_LIBS" | |
836 | CXXFLAGS="$ac_save_CXXFLAGS" | |
b170b427 | 837 | ]) |
838 | ||
839 | ||
840 | dnl | |
77cbec55 | 841 | dnl Check to see if there is native support for complex |
b170b427 | 842 | dnl |
843 | dnl Don't compile bits in math/* if native support exits. | |
844 | dnl | |
1e59e631 | 845 | dnl Define USE_COMPLEX_LONG_DOUBLE etc if "copysignl" is found. |
b170b427 | 846 | dnl |
847 | dnl GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT | |
848 | AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [ | |
849 | dnl Check for complex versions of math functions of platform. | |
5922e5b5 | 850 | AC_CHECK_LIB(m, main) |
1e59e631 | 851 | AC_REPLACE_MATHFUNCS(nan copysignf) |
04081d71 | 852 | |
d50d98ed | 853 | dnl For __signbit to signbit conversions. |
854 | AC_CHECK_FUNCS([__signbit], , [LIBMATHOBJS="$LIBMATHOBJS signbit.lo"]) | |
855 | AC_CHECK_FUNCS([__signbitf], , [LIBMATHOBJS="$LIBMATHOBJS signbitf.lo"]) | |
856 | ||
77cbec55 | 857 | dnl Compile the long double complex functions only if the function |
04081d71 | 858 | dnl provides the non-complex long double functions that are needed. |
1e59e631 | 859 | dnl Currently this includes copysignl, which should be |
04081d71 | 860 | dnl cached from the GLIBCPP_CHECK_MATH_SUPPORT macro, above. |
1e59e631 | 861 | if test x$ac_cv_func_copysignl = x"yes"; then |
d50d98ed | 862 | AC_CHECK_FUNCS([__signbitl], , [LIBMATHOBJS="$LIBMATHOBJS signbitl.lo"]) |
04081d71 | 863 | fi |
864 | ||
7f713ccf | 865 | if test -n "$LIBMATHOBJS"; then |
866 | need_libmath=yes | |
867 | fi | |
d50d98ed | 868 | AC_SUBST(LIBMATHOBJS) |
7f713ccf | 869 | AM_CONDITIONAL(GLIBCPP_BUILD_LIBMATH, test "$need_libmath" = yes) |
b170b427 | 870 | ]) |
871 | ||
67271580 | 872 | |
1d71fbac | 873 | dnl Check to see what architecture and operating system we are compiling |
874 | dnl for. Also, if architecture- or OS-specific flags are required for | |
875 | dnl compilation, pick them up here. | |
77cbec55 | 876 | dnl |
1d71fbac | 877 | dnl GLIBCPP_CHECK_TARGET |
878 | AC_DEFUN(GLIBCPP_CHECK_TARGET, [ | |
ec3959da | 879 | . [$]{glibcpp_basedir}/configure.target |
880 | AC_MSG_RESULT(CPU config directory is $cpu_include_dir) | |
881 | AC_MSG_RESULT(OS config directory is $os_include_dir) | |
d481da82 | 882 | ]) |
883 | ||
884 | ||
b9e8095b | 885 | dnl |
886 | dnl Check to see if this target can enable the wchar_t parts of libstdc++. | |
1580b14b | 887 | dnl If --disable-c-mbchar was given, no wchar_t stuff is enabled. (This |
888 | dnl must have been previously checked.) | |
b9e8095b | 889 | dnl |
77cbec55 | 890 | dnl Define _GLIBCPP_USE_WCHAR_T if all the bits are found |
3d1a09b9 | 891 | dnl Define HAVE_MBSTATE_T if mbstate_t is not in wchar.h |
b9e8095b | 892 | dnl |
893 | dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT | |
894 | AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [ | |
d9044b86 | 895 | dnl Wide characters disabled by default. |
896 | enable_wchar_t=no | |
3d1a09b9 | 897 | |
898 | dnl Test wchar.h for mbstate_t, which is needed for char_traits and | |
899 | dnl others even if wchar_t support is not on. | |
900 | AC_MSG_CHECKING([for mbstate_t]) | |
901 | AC_TRY_COMPILE([#include <wchar.h>], | |
77cbec55 | 902 | [mbstate_t teststate;], |
3d1a09b9 | 903 | have_mbstate_t=yes, have_mbstate_t=no) |
904 | AC_MSG_RESULT($have_mbstate_t) | |
905 | if test x"$have_mbstate_t" = xyes; then | |
906 | AC_DEFINE(HAVE_MBSTATE_T) | |
907 | fi | |
908 | ||
909 | dnl Sanity check for existence of ISO C99 headers for extended encoding. | |
910 | AC_CHECK_HEADERS(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no) | |
396629a5 | 911 | AC_CHECK_HEADERS(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no) |
77cbec55 | 912 | |
3d1a09b9 | 913 | dnl Only continue checking if the ISO C99 headers exist and support is on. |
2475beac | 914 | if test x"$ac_has_wchar_h" = xyes && |
915 | test x"$ac_has_wctype_h" = xyes && | |
916 | test x"$enable_c_mbchar" != xno; then | |
77cbec55 | 917 | |
3d1a09b9 | 918 | dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before |
919 | dnl numeric_limits can instantiate type_traits<wchar_t> | |
920 | AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX]) | |
921 | AC_TRY_COMPILE([#include <wchar.h>], | |
77cbec55 | 922 | [int i = WCHAR_MIN; int j = WCHAR_MAX;], |
3d1a09b9 | 923 | has_wchar_minmax=yes, has_wchar_minmax=no) |
924 | AC_MSG_RESULT($has_wchar_minmax) | |
77cbec55 | 925 | |
3d1a09b9 | 926 | dnl Test wchar.h for WEOF, which is what we use to determine whether |
927 | dnl to specialize for char_traits<wchar_t> or not. | |
928 | AC_MSG_CHECKING([for WEOF]) | |
929 | AC_TRY_COMPILE([ | |
930 | #include <wchar.h> | |
931 | #include <stddef.h>], | |
932 | [wint_t i = WEOF;], | |
933 | has_weof=yes, has_weof=no) | |
934 | AC_MSG_RESULT($has_weof) | |
77cbec55 | 935 | |
3d1a09b9 | 936 | dnl Tests for wide character functions used in char_traits<wchar_t>. |
710560e9 | 937 | ac_wfuncs=yes |
938 | AC_CHECK_FUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset,, \ | |
939 | ac_wfuncs=no) | |
77cbec55 | 940 | |
710560e9 | 941 | dnl Checks for names injected into std:: by the c_std headers. |
d9044b86 | 942 | AC_CHECK_FUNCS(btowc wctob fgetwc fgetws fputwc fputws fwide \ |
710560e9 | 943 | fwprintf fwscanf swprintf swscanf vfwprintf vfwscanf vswprintf vswscanf \ |
944 | vwprintf vwscanf wprintf wscanf getwc getwchar mbsinit mbrlen mbrtowc \ | |
945 | mbsrtowcs wcsrtombs putwc putwchar ungetwc wcrtomb wcstod wcstof wcstol \ | |
946 | wcstoul wcscpy wcsncpy wcscat wcsncat wcscmp wcscoll wcsncmp wcsxfrm \ | |
947 | wcscspn wcsspn wcstok wcsftime wcschr wcspbrk wcsrchr wcsstr,, \ | |
948 | ac_wfuncs=no) | |
6bb18279 | 949 | |
3d1a09b9 | 950 | AC_MSG_CHECKING([for ISO C99 wchar_t support]) |
2475beac | 951 | if test x"$has_weof" = xyes && |
952 | test x"$has_wchar_minmax" = xyes && | |
953 | test x"$ac_wfuncs" = xyes; then | |
3d1a09b9 | 954 | ac_isoC99_wchar_t=yes |
955 | else | |
956 | ac_isoC99_wchar_t=no | |
957 | fi | |
958 | AC_MSG_RESULT($ac_isoC99_wchar_t) | |
77cbec55 | 959 | |
960 | dnl Use iconv for wchar_t to char conversions. As such, check for | |
3d1a09b9 | 961 | dnl X/Open Portability Guide, version 2 features (XPG2). |
962 | AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no) | |
963 | AC_CHECK_HEADER(langinfo.h, ac_has_langinfo_h=yes, ac_has_langinfo_h=no) | |
964 | ||
965 | dnl Check for existence of libiconv.a providing XPG2 wchar_t support. | |
966 | AC_CHECK_LIB(iconv, iconv, libiconv="-liconv") | |
967 | ac_save_LIBS="$LIBS" | |
968 | LIBS="$LIBS $libiconv" | |
969 | ||
970 | AC_CHECK_FUNCS(iconv_open iconv_close iconv nl_langinfo, \ | |
971 | ac_XPG2funcs=yes, ac_XPG2funcs=no) | |
77cbec55 | 972 | |
3d1a09b9 | 973 | LIBS="$ac_save_LIBS" |
2407da46 | 974 | |
3d1a09b9 | 975 | AC_MSG_CHECKING([for XPG2 wchar_t support]) |
2475beac | 976 | if test x"$ac_has_iconv_h" = xyes && |
977 | test x"$ac_has_langinfo_h" = xyes && | |
978 | test x"$ac_XPG2funcs" = xyes; then | |
3d1a09b9 | 979 | ac_XPG2_wchar_t=yes |
980 | else | |
981 | ac_XPG2_wchar_t=no | |
982 | fi | |
983 | AC_MSG_RESULT($ac_XPG2_wchar_t) | |
77cbec55 | 984 | |
3d1a09b9 | 985 | dnl At the moment, only enable wchar_t specializations if all the |
986 | dnl above support is present. | |
d9044b86 | 987 | if test x"$ac_isoC99_wchar_t" = xyes && |
988 | test x"$ac_XPG2_wchar_t" = xyes; then | |
3d1a09b9 | 989 | AC_DEFINE(_GLIBCPP_USE_WCHAR_T) |
d9044b86 | 990 | enable_wchar_t=yes |
0a40c6ad | 991 | fi |
b9e8095b | 992 | fi |
d9044b86 | 993 | AC_MSG_CHECKING([for enabled wchar_t specializations]) |
994 | AC_MSG_RESULT($enable_wchar_t) | |
995 | AM_CONDITIONAL(GLIBCPP_TEST_WCHAR_T, test "$enable_wchar_t" = yes) | |
b9e8095b | 996 | ]) |
997 | ||
998 | ||
b9e8095b | 999 | dnl |
7f713ccf | 1000 | dnl Check to see if debugging libraries are to be built. |
b9e8095b | 1001 | dnl |
1002 | dnl GLIBCPP_ENABLE_DEBUG | |
7f713ccf | 1003 | dnl |
77cbec55 | 1004 | dnl --enable-debug |
7f713ccf | 1005 | dnl builds a separate set of debugging libraries in addition to the |
1006 | dnl normal (shared, static) libstdc++ binaries. | |
1007 | dnl | |
77cbec55 | 1008 | dnl --disable-debug |
7f713ccf | 1009 | dnl builds only one (non-debug) version of libstdc++. |
1010 | dnl | |
1011 | dnl --enable-debug-flags=FLAGS | |
1012 | dnl iff --enable-debug == yes, then use FLAGS to build the debug library. | |
1013 | dnl | |
b9e8095b | 1014 | dnl + Usage: GLIBCPP_ENABLE_DEBUG[(DEFAULT)] |
1015 | dnl Where DEFAULT is either `yes' or `no'. If ommitted, it | |
1016 | dnl defaults to `no'. | |
1017 | AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl | |
1018 | define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl | |
1019 | AC_ARG_ENABLE(debug, | |
1020 | changequote(<<, >>)dnl | |
0b49d004 | 1021 | << --enable-debug build extra debug library [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT], |
b9e8095b | 1022 | changequote([, ])dnl |
f1f1b9ae | 1023 | [case "${enableval}" in |
b9e8095b | 1024 | yes) enable_debug=yes ;; |
1025 | no) enable_debug=no ;; | |
1026 | *) AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;; | |
1027 | esac], | |
1028 | enable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl | |
7f713ccf | 1029 | AC_MSG_CHECKING([for additional debug build]) |
1030 | AC_MSG_RESULT($enable_debug) | |
77cbec55 | 1031 | AM_CONDITIONAL(GLIBCPP_BUILD_DEBUG, test "$enable_debug" = yes) |
7f713ccf | 1032 | ]) |
1033 | ||
1034 | ||
1035 | dnl Check for explicit debug flags. | |
1036 | dnl | |
1037 | dnl GLIBCPP_ENABLE_DEBUG_FLAGS | |
1038 | dnl | |
77cbec55 | 1039 | dnl --enable-debug-flags='-O1' |
1040 | dnl is a general method for passing flags to be used when | |
7f713ccf | 1041 | dnl building debug libraries with --enable-debug. |
1042 | dnl | |
1043 | dnl --disable-debug-flags does nothing. | |
1044 | dnl + Usage: GLIBCPP_ENABLE_DEBUG_FLAGS(default flags) | |
1045 | dnl If "default flags" is an empty string (or "none"), the effect is | |
1046 | dnl the same as --disable or --enable=no. | |
1047 | AC_DEFUN(GLIBCPP_ENABLE_DEBUG_FLAGS, [dnl | |
1048 | define([GLIBCPP_ENABLE_DEBUG_FLAGS_DEFAULT], ifelse($1,,, $1))dnl | |
1049 | AC_ARG_ENABLE(debug_flags, | |
1050 | changequote(<<, >>)dnl | |
77cbec55 | 1051 | << --enable-debug-flags=FLAGS pass compiler FLAGS when building debug |
7f713ccf | 1052 | library;[default=>>GLIBCPP_ENABLE_DEBUG_FLAGS_DEFAULT], |
1053 | changequote([, ])dnl | |
1054 | [case "${enableval}" in | |
1055 | none) ;; | |
1056 | -*) enable_debug_flags="${enableval}" ;; | |
1057 | *) AC_MSG_ERROR([Unknown argument to extra debugging flags]) ;; | |
1058 | esac], | |
1059 | enable_debug_flags=GLIBCPP_ENABLE_DEBUG_FLAGS_DEFAULT)dnl | |
f1f1b9ae | 1060 | |
b9e8095b | 1061 | dnl Option parsed, now set things appropriately |
7f713ccf | 1062 | case x"$enable_debug" in |
77cbec55 | 1063 | xyes) |
7f713ccf | 1064 | case "$enable_debug_flags" in |
77cbec55 | 1065 | none) |
7f713ccf | 1066 | DEBUG_FLAGS="-g3 -O0";; |
1067 | -*) #valid input | |
1068 | DEBUG_FLAGS="${enableval}" | |
1069 | esac | |
77cbec55 | 1070 | ;; |
1071 | xno) | |
7f713ccf | 1072 | DEBUG_FLAGS="" |
82a73681 | 1073 | ;; |
b9e8095b | 1074 | esac |
c21bc234 | 1075 | AC_SUBST(DEBUG_FLAGS) |
7f713ccf | 1076 | |
1077 | AC_MSG_CHECKING([for debug build flags]) | |
1078 | AC_MSG_RESULT($DEBUG_FLAGS) | |
b9e8095b | 1079 | ]) |
1080 | ||
1081 | ||
401f263f | 1082 | dnl |
1083 | dnl Check for "unusual" flags to pass to the compiler while building. | |
1084 | dnl | |
1085 | dnl GLIBCPP_ENABLE_CXX_FLAGS | |
1086 | dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing | |
1087 | dnl experimental flags such as -fhonor-std, -fsquangle, -Dfloat=char, etc. | |
1088 | dnl Somehow this same set of flags must be passed when [re]building | |
1089 | dnl libgcc. | |
1090 | dnl --disable-cxx-flags passes nothing. | |
7524d23a | 1091 | dnl + See http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00131.html |
1092 | dnl http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00284.html | |
1093 | dnl http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00035.html | |
401f263f | 1094 | dnl + Usage: GLIBCPP_ENABLE_CXX_FLAGS(default flags) |
acad6b7e | 1095 | dnl If "default flags" is an empty string (or "none"), the effect is |
1096 | dnl the same as --disable or --enable=no. | |
401f263f | 1097 | AC_DEFUN(GLIBCPP_ENABLE_CXX_FLAGS, [dnl |
1098 | define([GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT], ifelse($1,,, $1))dnl | |
77cbec55 | 1099 | AC_MSG_CHECKING([for extra compiler flags for building]) |
7f713ccf | 1100 | AC_ARG_ENABLE(cxx_flags, |
401f263f | 1101 | changequote(<<, >>)dnl |
1102 | << --enable-cxx-flags=FLAGS pass compiler FLAGS when building library; | |
77cbec55 | 1103 | [default=>>GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT], |
401f263f | 1104 | changequote([, ])dnl |
77cbec55 | 1105 | [case "x$enable_cxx_flags" in |
1106 | xyes) | |
1107 | AC_MSG_ERROR([--enable-cxx-flags needs compiler flags as arguments]) ;; | |
1108 | xno | xnone | x) | |
1109 | enable_cxx_flags='' ;; | |
1110 | *) | |
1111 | enable_cxx_flags="$enableval" ;; | |
1112 | esac], | |
1113 | enable_cxx_flags=GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT) | |
f1f1b9ae | 1114 | |
acad6b7e | 1115 | dnl Run through flags (either default or command-line) and set anything |
1116 | dnl extra (e.g., #defines) that must accompany particular g++ options. | |
401f263f | 1117 | if test -n "$enable_cxx_flags"; then |
ec3959da | 1118 | for f in $enable_cxx_flags; do |
1119 | case "$f" in | |
1120 | -fhonor-std) ;; | |
1121 | -*) ;; | |
1122 | *) # and we're trying to pass /what/ exactly? | |
1123 | AC_MSG_ERROR([compiler flags start with a -]) ;; | |
1124 | esac | |
1125 | done | |
401f263f | 1126 | fi |
1127 | EXTRA_CXX_FLAGS="$enable_cxx_flags" | |
77cbec55 | 1128 | AC_MSG_RESULT($EXTRA_CXX_FLAGS) |
401f263f | 1129 | AC_SUBST(EXTRA_CXX_FLAGS) |
1130 | ]) | |
1131 | ||
1132 | ||
20752884 | 1133 | dnl |
1134 | dnl Check for which locale library to use: gnu or generic. | |
1135 | dnl | |
1136 | dnl GLIBCPP_ENABLE_CLOCALE | |
c099f5df | 1137 | dnl --enable-clocale=gnu sets config/locale/c_locale_gnu.cc and friends |
1138 | dnl --enable-clocale=generic sets config/locale/c_locale_generic.cc and friends | |
77cbec55 | 1139 | dnl |
20752884 | 1140 | dnl default is generic |
1141 | dnl | |
1142 | AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [ | |
1143 | AC_MSG_CHECKING([for clocale to use]) | |
1144 | AC_ARG_ENABLE(clocale, | |
77cbec55 | 1145 | [ --enable-clocale enable model for target locale package. |
780eeb66 | 1146 | --enable-clocale=MODEL use MODEL target-speific locale package. [default=generic] |
77cbec55 | 1147 | ], |
20752884 | 1148 | if test x$enable_clocale = xno; then |
01702872 | 1149 | enable_clocale=no |
20752884 | 1150 | fi, |
01702872 | 1151 | enable_clocale=no) |
20752884 | 1152 | |
1153 | enable_clocale_flag=$enable_clocale | |
1154 | ||
01702872 | 1155 | dnl Probe for locale support if no specific model is specified. |
1156 | dnl Default to "generic" | |
1157 | if test x$enable_clocale_flag = xno; then | |
1158 | case x${target_os} in | |
1159 | xlinux* | xgnu*) | |
0d289e52 | 1160 | AC_EGREP_CPP([_GLIBCPP_ok], [ |
01702872 | 1161 | #include <features.h> |
77cbec55 | 1162 | #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) |
0d289e52 | 1163 | _GLIBCPP_ok |
01702872 | 1164 | #endif |
1165 | ], enable_clocale_flag=gnu, enable_clocale_flag=generic) | |
0d289e52 | 1166 | |
1167 | # Test for bugs early in glibc-2.2.x series | |
1168 | if test x$enable_clocale_flag = xgnu; then | |
1169 | AC_TRY_RUN([ | |
1170 | #define _GNU_SOURCE 1 | |
1171 | #include <locale.h> | |
8404b390 | 1172 | #include <string.h> |
1173 | #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) | |
1174 | extern __typeof(newlocale) __newlocale; | |
1175 | extern __typeof(duplocale) __duplocale; | |
1176 | extern __typeof(strcoll_l) __strcoll_l; | |
1177 | #endif | |
0d289e52 | 1178 | int main() |
1179 | { | |
1180 |