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