]> git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/acinclude.m4
acinclude.m4 (GLIBCPP_ENABLE_THREADS): Obtain target_thread_file with `gcc -v'.
[thirdparty/gcc.git] / libstdc++-v3 / acinclude.m4
1 dnl
2 dnl Initialize configure bits.
3 dnl
4 dnl Define OPTLEVEL='-O2' if new inlining code present.
5 dnl
6 dnl GLIBCPP_CONFIGURE
7 AC_DEFUN(GLIBCPP_CONFIGURE, [
8 dnl Default to --enable-multilib
9 AC_ARG_ENABLE(multilib,
10 [ --enable-multilib build hella library versions (default)],
11 [case "${enableval}" in
12 yes) multilib=yes ;;
13 no) multilib=no ;;
14 *) AC_MSG_ERROR(bad value ${enableval} for multilib option) ;;
15 esac], [multilib=yes])dnl
16
17 glibcpp_basedir=$auxdir/$1/libstdc++-v3
18 AC_SUBST(glibcpp_basedir)
19
20 AM_INIT_AUTOMAKE(libstdc++, 2.91)
21
22 # Never versions of autoconf add an underscore to these functions.
23 # Prevent future problems ...
24 ifdef([AC_PROG_CC_G],[],[define([AC_PROG_CC_G],defn([_AC_PROG_CC_G]))])
25 ifdef([AC_PROG_CC_GNU],[],[define([AC_PROG_CC_GNU],defn([_AC_PROG_CC_GNU]))])
26 ifdef([AC_PROG_CXX_G],[],[define([AC_PROG_CXX_G],defn([_AC_PROG_CXX_G]))])
27 ifdef([AC_PROG_CXX_GNU],[],[define([AC_PROG_CXX_GNU],defn([_AC_PROG_CXX_GNU]))])
28
29 # AC_PROG_CC
30
31 # FIXME: We temporarily define our own version of AC_PROG_CC. This is
32 # copied from autoconf 2.12, but does not call AC_PROG_CC_WORKS. We
33 # are probably using a cross compiler, which will not be able to fully
34 # link an executable. This should really be fixed in autoconf
35 # itself.
36
37 AC_DEFUN(LIB_AC_PROG_CC,
38 [AC_BEFORE([$0], [AC_PROG_CPP])dnl
39 dnl Fool anybody using AC_PROG_CC.
40 AC_PROVIDE([AC_PROG_CC])
41 AC_CHECK_PROG(CC, gcc, gcc)
42 if test -z "$CC"; then
43 AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc)
44 test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH])
45 fi
46
47 AC_PROG_CC_GNU
48
49 if test $ac_cv_prog_gcc = yes; then
50 GCC=yes
51 dnl Check whether -g works, even if CFLAGS is set, in case the package
52 dnl plays around with CFLAGS (such as to build both debugging and
53 dnl normal versions of a library), tasteless as that idea is.
54 ac_test_CFLAGS="${CFLAGS+set}"
55 ac_save_CFLAGS="$CFLAGS"
56 CFLAGS=
57 AC_PROG_CC_G
58 if test "$ac_test_CFLAGS" = set; then
59 CFLAGS="$ac_save_CFLAGS"
60 elif test $ac_cv_prog_cc_g = yes; then
61 CFLAGS="-g -O2"
62 else
63 CFLAGS="-O2"
64 fi
65 else
66 GCC=
67 test "${CFLAGS+set}" = set || CFLAGS="-g"
68 fi
69 ])
70
71 LIB_AC_PROG_CC
72
73 # Can't just call these here as g++ requires libstc++ to be built....
74 # AC_PROG_CXX
75
76 # Likewise for AC_PROG_CXX.
77 AC_DEFUN(LIB_AC_PROG_CXX,
78 [AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl
79 dnl Fool anybody using AC_PROG_CXX.
80 AC_PROVIDE([AC_PROG_CXX])
81 # Use glibcpp_CXX so that we do not cause CXX to be cached with the
82 # flags that come in CXX while configuring libstdc++. They're different
83 # from those used for all other target libraries. If CXX is set in
84 # the environment, respect that here.
85 glibcpp_CXX=$CXX
86 AC_CHECK_PROGS(glibcpp_CXX, $CCC c++ g++ gcc CC cxx cc++, gcc)
87 AC_SUBST(glibcpp_CXX)
88 CXX=$glibcpp_CXX
89 test -z "$glibcpp_CXX" && AC_MSG_ERROR([no acceptable c++ found in \$PATH])
90
91 AC_PROG_CXX_GNU
92
93 if test $ac_cv_prog_gxx = yes; then
94 GXX=yes
95 dnl Check whether -g works, even if CXXFLAGS is set, in case the package
96 dnl plays around with CXXFLAGS (such as to build both debugging and
97 dnl normal versions of a library), tasteless as that idea is.
98 ac_test_CXXFLAGS="${CXXFLAGS+set}"
99 ac_save_CXXFLAGS="$CXXFLAGS"
100 CXXFLAGS=
101 AC_PROG_CXX_G
102 if test "$ac_test_CXXFLAGS" = set; then
103 CXXFLAGS="$ac_save_CXXFLAGS"
104 elif test $ac_cv_prog_cxx_g = yes; then
105 CXXFLAGS="-g -O2"
106 else
107 CXXFLAGS="-O2"
108 fi
109 else
110 GXX=
111 test "${CXXFLAGS+set}" = set || CXXFLAGS="-g"
112 fi
113 ])
114
115 LIB_AC_PROG_CXX
116
117 AC_CHECK_TOOL(AS, as)
118 AC_CHECK_TOOL(AR, ar)
119 AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
120 AC_CHECK_TOOL(glibcpp_expect, expect, expect-not-found-in-path-error)
121 AC_CHECK_TOOL(glibcpp_runtest, runtest, runtest-not-found-in-path-error)
122 AC_SUBST(glibcpp_expect)
123 AC_SUBST(glibcpp_runtest)
124 AC_PROG_INSTALL
125
126 AM_MAINTAINER_MODE
127
128 # We need AC_EXEEXT to keep automake happy in cygnus mode. However,
129 # at least currently, we never actually build a program, so we never
130 # need to use $(EXEEXT). Moreover, the test for EXEEXT normally
131 # fails, because we are probably configuring with a cross compiler
132 # which cant create executables. So we include AC_EXEEXT to keep
133 # automake happy, but we dont execute it, since we dont care about
134 # the result.
135 if false; then
136 AC_EXEEXT
137 fi
138
139 . [$]{glibcpp_basedir}/configure.host
140
141 case [$]{glibcpp_basedir} in
142 /* | [A-Za-z]:[\\/]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;;
143 *) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;;
144 esac
145
146 # This does for the target what configure.host does for the host. In
147 # addition to possibly modifying the same flags, it also sets up symlinks.
148 GLIBCPP_CHECK_TARGET
149 ])
150
151
152 dnl
153 dnl Check to see if g++ can compile this library, and if so, if any version-
154 dnl specific precautions need to be taken.
155 dnl
156 dnl GLIBCPP_CHECK_COMPILER_VERSION
157 AC_DEFUN(GLIBCPP_CHECK_COMPILER_VERSION, [
158 if test ! -f stamp-sanity-compiler; then
159 AC_MSG_CHECKING([for g++ that will successfully compile libstdc++-v3])
160 AC_LANG_SAVE
161 AC_LANG_CPLUSPLUS
162 AC_EGREP_CPP(ok, [
163 #if __GNUC__ >= 3
164 ok
165 #endif
166 ], gpp_satisfactory=yes, AC_MSG_ERROR([please upgrade to GCC 3.0 or above]))
167 AC_LANG_RESTORE
168 AC_MSG_RESULT($gpp_satisfactory)
169 touch stamp-sanity-compiler
170 fi
171 ])
172
173
174 dnl
175 dnl Test for newer compiler features, or features that are present in newer
176 dnl compiler version but not older compiler versions should be placed
177 dnl here.
178 dnl
179 dnl Define WERROR='-Werror' if requested and possible; g++'s that lack the
180 dnl new inlining code or the new system_header pragma will die on -Werror.
181 dnl Leave it out by default and use maint-mode to use it.
182 dnl
183 dnl Define SECTION_FLAGS='-ffunction-sections -fdata-sections' if
184 dnl compiler supports it and the user has not requested debug mode.
185 dnl
186 dnl GLIBCPP_CHECK_COMPILER_FEATURES
187 AC_DEFUN(GLIBCPP_CHECK_COMPILER_FEATURES, [
188 # All these tests are for C++; save the language and the compiler flags.
189 # The CXXFLAGS thing is suspicious, but based on similar bits
190 # found in GLIBCPP_CONFIGURE.
191 AC_LANG_SAVE
192 AC_LANG_CPLUSPLUS
193 ac_test_CXXFLAGS="${CXXFLAGS+set}"
194 ac_save_CXXFLAGS="$CXXFLAGS"
195
196 # Check for maintainer-mode bits.
197 if test x"$USE_MAINTAINER_MODE" = xno; then
198 WERROR=''
199 else
200 WERROR='-Werror'
201 fi
202
203 # Check for -ffunction-sections -fdata-sections
204 AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections])
205 CXXFLAGS='-Werror -ffunction-sections -fdata-sections'
206 AC_TRY_COMPILE(, [int foo;
207 ], [ac_fdsections=yes], [ac_fdsections=no])
208 if test "$ac_test_CXXFLAGS" = set; then
209 CXXFLAGS="$ac_save_CXXFLAGS"
210 else
211 # this is the suspicious part
212 CXXFLAGS=''
213 fi
214 if test x"$ac_fdsections" = x"yes" && test x"$enable_debug" = x"no"; then
215 SECTION_FLAGS='-ffunction-sections -fdata-sections'
216 fi
217 AC_MSG_RESULT($ac_fdsections)
218
219 AC_LANG_RESTORE
220 AC_SUBST(WERROR)
221 AC_SUBST(SECTION_FLAGS)
222 ])
223
224
225 dnl
226 dnl If GNU ld is in use, check to see if tricky linker opts can be used. If
227 dnl the native linker is in use, all variables will be defined to something
228 dnl safe (like an empty string).
229 dnl
230 dnl Define SECTION_LDFLAGS='-Wl,--gc-sections' if possible.
231 dnl Define OPT_LDFLAGS='-Wl,-O1' if possible.
232 dnl
233 dnl GLIBCPP_CHECK_LINKER_FEATURES
234 AC_DEFUN(GLIBCPP_CHECK_LINKER_FEATURES, [
235 # If we're not using GNU ld, then there's no point in even trying these
236 # tests. Check for that first. We should have already tested for gld
237 # by now (in libtool), but require it now just to be safe...
238 SECTION_LDFLAGS=''
239 OPT_LDFLAGS=''
240 AC_REQUIRE([AC_PROG_LD])
241
242 # Set --gc-sections.
243 if test "$ac_cv_prog_gnu_ld" = "notbroken"; then
244 # GNU ld it is! Joy and bunny rabbits!
245
246 # All these tests are for C++; save the language and the compiler flags.
247 # Need to do this so that g++ won't try to link in libstdc++
248 ac_test_CFLAGS="${CFLAGS+set}"
249 ac_save_CFLAGS="$CFLAGS"
250 CFLAGS='-x c++ -Wl,--gc-sections'
251
252 # Check for -Wl,--gc-sections
253 # XXX This test is broken at the moment, as symbols required for
254 # linking are now in libsupc++ (not built yet.....). In addition,
255 # this test has cored on solaris in the past. In addition,
256 # --gc-sections doesn't really work at the moment (keeps on discarding
257 # used sections, first .eh_frame and now some of the glibc sections for
258 # iconv). Bzzzzt. Thanks for playing, maybe next time.
259 AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
260 AC_TRY_RUN([
261 int main(void)
262 {
263 try { throw 1; }
264 catch (...) { };
265 return 0;
266 }
267 ], [ac_sectionLDflags=yes],[ac_sectionLFflags=no], [ac_sectionLDflags=yes])
268 if test "$ac_test_CFLAGS" = set; then
269 CFLAGS="$ac_save_CFLAGS"
270 else
271 # this is the suspicious part
272 CFLAGS=''
273 fi
274 if test "$ac_sectionLDflags" = "yes"; then
275 SECTION_LDFLAGS='-Wl,--gc-sections'
276 fi
277 AC_MSG_RESULT($ac_sectionLDflags)
278 fi
279
280 # Set linker optimization flags.
281 if test x"$ac_cv_prog_gnu_ld" = x"yes" && test x"$enable_debug" = x"no"; then
282 OPT_LDFLAGS='-Wl,-O1'
283 fi
284
285 AC_SUBST(SECTION_LDFLAGS)
286 AC_SUBST(OPT_LDFLAGS)
287 ])
288
289
290 dnl
291 dnl Check to see if the (math function) argument passed is
292 dnl declared when using the c++ compiler
293 dnl ASSUMES argument is a math function with ONE parameter
294 dnl
295 dnl GLIBCPP_CHECK_MATH_DECL_1
296 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_1, [
297 AC_MSG_CHECKING([for $1 declaration])
298 if test x${glibcpp_cv_func_$1_use+set} != xset; then
299 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
300 AC_LANG_SAVE
301 AC_LANG_CPLUSPLUS
302 AC_TRY_COMPILE([#include <math.h>
303 #ifdef HAVE_IEEEFP_H
304 #include <ieeefp.h>
305 #endif
306 ],
307 [ $1(0);],
308 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
309 AC_LANG_RESTORE
310 ])
311 fi
312 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
313 ])
314
315 dnl
316 dnl Check to see if the (math function) argument passed is
317 dnl 1) declared when using the c++ compiler
318 dnl 2) has "C" linkage
319 dnl 3) if not, see if 1) and 2) for argument prepended with '_'
320 dnl
321 dnl Define HAVE_CARGF etc if "cargf" is declared and links
322 dnl
323 dnl argument 1 is name of function to check
324 dnl
325 dnl ASSUMES argument is a math function with ONE parameter
326 dnl
327 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1
328 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, [
329 GLIBCPP_CHECK_MATH_DECL_1($1)
330 if test x$glibcpp_cv_func_$1_use = x"yes"; then
331 AC_CHECK_FUNCS($1)
332 else
333 GLIBCPP_CHECK_MATH_DECL_1(_$1)
334 if test x$glibcpp_cv_func__$1_use = x"yes"; then
335 AC_CHECK_FUNCS(_$1)
336 fi
337 fi
338 ])
339
340
341 dnl
342 dnl Like GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1, but does a bunch of
343 dnl of functions at once. It's an all-or-nothing check -- either
344 dnl HAVE_XYZ is defined for each of the functions, or for none of them.
345 dnl Doing it this way saves significant configure time.
346 AC_DEFUN(GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1, [
347 AC_MSG_CHECKING([for $1 functions])
348 AC_CACHE_VAL(glibcpp_cv_func_$2_use, [
349 AC_LANG_SAVE
350 AC_LANG_CPLUSPLUS
351 AC_TRY_COMPILE([#include <math.h>],
352 [ `for x in $3; do echo "$x (0);"; done` ],
353 [glibcpp_cv_func_$2_use=yes],
354 [glibcpp_cv_func_$2_use=no])
355 AC_LANG_RESTORE])
356 AC_MSG_RESULT($glibcpp_cv_func_$2_use)
357 if test x$glibcpp_cv_func_$2_use = x"yes"; then
358 AC_CHECK_FUNCS($3)
359 fi
360 ])
361
362 dnl
363 dnl Check to see if the (math function) argument passed is
364 dnl declared when using the c++ compiler
365 dnl ASSUMES argument is a math function with ONE parameter
366 dnl
367 dnl GLIBCPP_CHECK_MATH_DECL_2
368 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_2, [
369 AC_MSG_CHECKING([for $1 declaration])
370 if test x${glibcpp_cv_func_$1_use+set} != xset; then
371 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
372 AC_LANG_SAVE
373 AC_LANG_CPLUSPLUS
374 AC_TRY_COMPILE([#include <math.h>],
375 [ $1(0, 0);],
376 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
377 AC_LANG_RESTORE
378 ])
379 fi
380 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
381 ])
382
383 dnl
384 dnl Check to see if the (math function) argument passed is
385 dnl 1) declared when using the c++ compiler
386 dnl 2) has "C" linkage
387 dnl
388 dnl Define HAVE_CARGF etc if "cargf" is declared and links
389 dnl
390 dnl argument 1 is name of function to check
391 dnl
392 dnl ASSUMES argument is a math function with TWO parameters
393 dnl
394 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2
395 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2, [
396 GLIBCPP_CHECK_MATH_DECL_2($1)
397 if test x$glibcpp_cv_func_$1_use = x"yes"; then
398 AC_CHECK_FUNCS($1)
399 else
400 GLIBCPP_CHECK_MATH_DECL_2(_$1)
401 if test x$glibcpp_cv_func__$1_use = x"yes"; then
402 AC_CHECK_FUNCS(_$1)
403 fi
404 fi
405 ])
406
407
408 dnl
409 dnl Check to see if the (math function) argument passed is
410 dnl declared when using the c++ compiler
411 dnl ASSUMES argument is a math function with ONE parameter
412 dnl
413 dnl GLIBCPP_CHECK_MATH_DECL_3
414 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_3, [
415 AC_MSG_CHECKING([for $1 declaration])
416 if test x${glibcpp_cv_func_$1_use+set} != xset; then
417 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
418 AC_LANG_SAVE
419 AC_LANG_CPLUSPLUS
420 AC_TRY_COMPILE([#include <math.h>],
421 [ $1(0, 0, 0);],
422 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
423 AC_LANG_RESTORE
424 ])
425 fi
426 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
427 ])
428
429 dnl
430 dnl Check to see if the (math function) argument passed is
431 dnl 1) declared when using the c++ compiler
432 dnl 2) has "C" linkage
433 dnl
434 dnl Define HAVE_CARGF etc if "cargf" is declared and links
435 dnl
436 dnl argument 1 is name of function to check
437 dnl
438 dnl ASSUMES argument is a math function with THREE parameters
439 dnl
440 dnl GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3
441 AC_DEFUN(GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3, [
442 GLIBCPP_CHECK_MATH_DECL_3($1)
443 if test x$glibcpp_cv_func_$1_use = x"yes"; then
444 AC_CHECK_FUNCS($1)
445 else
446 GLIBCPP_CHECK_MATH_DECL_3(_$1)
447 if test x$glibcpp_cv_func__$1_use = x"yes"; then
448 AC_CHECK_FUNCS(_$1)
449 fi
450 fi
451 ])
452
453
454 dnl
455 dnl Check to see if the (stdlib function) argument passed is
456 dnl 1) declared when using the c++ compiler
457 dnl 2) has "C" linkage
458 dnl
459 dnl argument 1 is name of function to check
460 dnl
461 dnl ASSUMES argument is a math function with TWO parameters
462 dnl
463 dnl GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2
464 AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2, [
465 AC_MSG_CHECKING([for $1 declaration])
466 if test x${glibcpp_cv_func_$1_use+set} != xset; then
467 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
468 AC_LANG_SAVE
469 AC_LANG_CPLUSPLUS
470 AC_TRY_COMPILE([#include <stdlib.h>],
471 [ $1(0, 0);],
472 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
473 AC_LANG_RESTORE
474 ])
475 fi
476 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
477 if test x$glibcpp_cv_func_$1_use = x"yes"; then
478 AC_CHECK_FUNCS($1)
479 fi
480 ])
481
482
483 dnl
484 dnl Because the builtins are picky picky picky about the arguments they take,
485 dnl do an explict linkage tests here.
486 dnl Check to see if the (math function) argument passed is
487 dnl 1) declared when using the c++ compiler
488 dnl 2) has "C" linkage
489 dnl
490 dnl Define HAVE_CARGF etc if "cargf" is declared and links
491 dnl
492 dnl argument 1 is name of function to check
493 dnl
494 dnl ASSUMES argument is a math function with ONE parameter
495 dnl
496 dnl GLIBCPP_CHECK_BUILTIN_MATH_DECL_LINKAGE_1
497 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1, [
498 AC_MSG_CHECKING([for $1 declaration])
499 if test x${glibcpp_cv_func_$1_use+set} != xset; then
500 AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
501 AC_LANG_SAVE
502 AC_LANG_CPLUSPLUS
503 AC_TRY_COMPILE([#include <math.h>],
504 [ $1(0);],
505 [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
506 AC_LANG_RESTORE
507 ])
508 fi
509 AC_MSG_RESULT($glibcpp_cv_func_$1_use)
510 if test x$glibcpp_cv_func_$1_use = x"yes"; then
511 AC_MSG_CHECKING([for $1 linkage])
512 if test x${glibcpp_cv_func_$1_link+set} != xset; then
513 AC_CACHE_VAL(glibcpp_cv_func_$1_link, [
514 AC_TRY_LINK([#include <math.h>],
515 [ $1(0);],
516 [glibcpp_cv_func_$1_link=yes], [glibcpp_cv_func_$1_link=no])
517 ])
518 fi
519 AC_MSG_RESULT($glibcpp_cv_func_$1_link)
520 if test x$glibcpp_cv_func_$1_link = x"yes"; then
521 ac_tr_func=HAVE_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
522 AC_DEFINE_UNQUOTED(${ac_tr_func})
523 fi
524 fi
525 ])
526
527
528 dnl
529 dnl Check to see what builtin math functions are supported
530 dnl
531 dnl check for __builtin_abs
532 dnl check for __builtin_fabsf
533 dnl check for __builtin_fabs
534 dnl check for __builtin_fabl
535 dnl check for __builtin_labs
536 dnl check for __builtin_sqrtf
537 dnl check for __builtin_sqrtl
538 dnl check for __builtin_fsqrt
539 dnl check for __builtin_sinf
540 dnl check for __builtin_sin
541 dnl check for __builtin_sinl
542 dnl check for __builtin_cosf
543 dnl check for __builtin_cos
544 dnl check for __builtin_cosl
545 dnl
546 dnl GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
547 AC_DEFUN(GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT, [
548 dnl Test for builtin math functions.
549 dnl These are made in gcc/c-common.c
550 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_abs)
551 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsf)
552 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabs)
553 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fabsl)
554 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_labs)
555
556 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtf)
557 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_fsqrt)
558 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sqrtl)
559
560 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinf)
561 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sin)
562 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_sinl)
563
564 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosf)
565 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cos)
566 GLIBCPP_CHECK_BUILTIN_MATH_DECL_AND_LINKAGE_1(__builtin_cosl)
567
568 dnl There is, without a doubt, a more elegant way to have these
569 dnl names exported so that they won't be stripped out of acconfig.h by
570 dnl autoheader. I leave this as an exercise to somebody less frustrated
571 dnl than I.... please email the libstdc++ list if you can figure out a
572 dnl more elegant approach (see autoconf/acgen.m4 and specifically
573 dnl AC_CHECK_FUNC for things to steal.)
574 dummyvar=no
575 if test x$dummyvar = x"yes"; then
576 AC_DEFINE(HAVE___BUILTIN_ABS)
577 AC_DEFINE(HAVE___BUILTIN_LABS)
578 AC_DEFINE(HAVE___BUILTIN_COS)
579 AC_DEFINE(HAVE___BUILTIN_COSF)
580 AC_DEFINE(HAVE___BUILTIN_COSL)
581 AC_DEFINE(HAVE___BUILTIN_FABS)
582 AC_DEFINE(HAVE___BUILTIN_FABSF)
583 AC_DEFINE(HAVE___BUILTIN_FABSL)
584 AC_DEFINE(HAVE___BUILTIN_SIN)
585 AC_DEFINE(HAVE___BUILTIN_SINF)
586 AC_DEFINE(HAVE___BUILTIN_SINL)
587 AC_DEFINE(HAVE___BUILTIN_FSQRT)
588 AC_DEFINE(HAVE___BUILTIN_SQRTF)
589 AC_DEFINE(HAVE___BUILTIN_SQRTL)
590 fi
591 ])
592
593
594 dnl
595 dnl Check to see what the underlying c library
596 dnl These checks need to do two things:
597 dnl 1) make sure the name is declared when using the c++ compiler
598 dnl 2) make sure the name has "C" linkage
599 dnl This might seem like overkill but experience has shown that it's not...
600 dnl
601 dnl Define HAVE_STRTOLD if "strtold" is declared and links
602 dnl Define HAVE_STRTOF if "strtof" is declared and links
603 dnl Define HAVE_DRAND48 if "drand48" is declared and links
604 dnl
605 dnl GLIBCPP_CHECK_STDLIB_SUPPORT
606 AC_DEFUN(GLIBCPP_CHECK_STDLIB_SUPPORT, [
607 ac_test_CXXFLAGS="${CXXFLAGS+set}"
608 ac_save_CXXFLAGS="$CXXFLAGS"
609 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
610
611 AC_CHECK_FUNCS(strtof)
612 GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtold)
613 AC_CHECK_FUNCS(drand48)
614
615 CXXFLAGS="$ac_save_CXXFLAGS"
616 ])
617
618
619 dnl
620 dnl Check to see what the underlying c library or math library is like.
621 dnl These checks need to do two things:
622 dnl 1) make sure the name is declared when using the c++ compiler
623 dnl 2) make sure the name has "C" linkage
624 dnl This might seem like overkill but experience has shown that it's not...
625 dnl
626 dnl Define HAVE_CARGF etc if "cargf" is found.
627 dnl
628 dnl GLIBCPP_CHECK_MATH_SUPPORT
629 AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
630 ac_test_CXXFLAGS="${CXXFLAGS+set}"
631 ac_save_CXXFLAGS="$CXXFLAGS"
632 CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
633
634 dnl Check libm
635 AC_CHECK_LIB(m, sin, libm="-lm")
636 ac_save_LIBS="$LIBS"
637 LIBS="$LIBS $libm"
638
639 dnl Check to see if certain C math functions exist.
640 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinf)
641 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnan)
642 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finite)
643 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysign)
644 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincos)
645 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fpclass)
646 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(qfpclass)
647
648 dnl Check to see if basic C math functions have float versions.
649 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float trig,
650 float_trig,
651 acosf asinf atanf \
652 cosf sinf tanf \
653 coshf sinhf tanhf)
654 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float round,
655 float_round,
656 ceilf floorf)
657 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanf)
658 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinff)
659 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsf)
660 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodf)
661 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpf)
662 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpf)
663 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logf)
664 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10f)
665 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modff)
666 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powf)
667 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtf)
668 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosf)
669 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitef)
670
671 dnl Check to see if basic C math functions have long double versions.
672 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double trig,
673 long_double_trig,
674 acosl asinl atanl \
675 cosl sinl tanl \
676 coshl sinhl tanhl)
677 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(long double round,
678 long_double_round,
679 ceill floorl)
680 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanl)
681 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinfl)
682 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(copysignl)
683 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2l)
684 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expl)
685 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(fabsl)
686 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(fmodl)
687 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(frexpl)
688 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(ldexpl)
689 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(logl)
690 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(log10l)
691 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(modfl)
692 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(powl)
693 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(sqrtl)
694 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_3(sincosl)
695 GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(finitel)
696
697 dnl Some runtimes have these functions with a preceding underscore. Please
698 dnl keep this sync'd with the one above. And if you add any new symbol,
699 dnl please add the corresponding block in the @BOTTOM@ section of acconfig.h.
700 dnl Check to see if certain C math functions exist.
701
702 dnl Check to see if basic C math functions have float versions.
703 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float trig,
704 _float_trig,
705 _acosf _asinf _atanf \
706 _cosf _sinf _tanf \
707 _coshf _sinhf _tanhf)
708 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_float round,
709 _float_round,
710 _ceilf _floorf)
711
712 dnl Check to see if basic C math functions have long double versions.
713 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double trig,
714 _long_double_trig,
715 _acosl _asinl _atanl \
716 _cosl _sinl _tanl \
717 _coshl _sinhl _tanhl)
718 GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(_long double round,
719 _long_double_round,
720 _ceill _floorl)
721
722 LIBS="$ac_save_LIBS"
723 CXXFLAGS="$ac_save_CXXFLAGS"
724 ])
725
726
727 dnl
728 dnl Check to see if there is native support for complex
729 dnl
730 dnl Don't compile bits in math/* if native support exits.
731 dnl
732 dnl Define USE_COMPLEX_LONG_DOUBLE etc if "atan2l/copysignl" is found.
733 dnl
734 dnl GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT
735 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [
736 dnl Check for complex versions of math functions of platform.
737 AC_CHECK_LIB(m, main)
738 AC_REPLACE_MATHFUNCS(nan hypot hypotf atan2f expf copysignf)
739
740 dnl Compile the long double complex functions only if the function
741 dnl provides the non-complex long double functions that are needed.
742 dnl Currently this includes copysignl and atan2l, which should be
743 dnl cached from the GLIBCPP_CHECK_MATH_SUPPORT macro, above.
744 USE_COMPLEX_LONG_DOUBLE=no
745 if test x$ac_cv_func_atan2l = x"yes" \
746 && test x$ac_cv_func_copysignl = x"yes"; then
747 USE_COMPLEX_LONG_DOUBLE=yes
748 AC_REPLACE_MATHFUNCS(hypotl signbitl)
749 fi
750
751 AC_SUBST(USE_COMPLEX_LONG_DOUBLE)
752 ])
753
754
755 dnl Check to see what architecture and operating system we are compiling
756 dnl for. Also, if architecture- or OS-specific flags are required for
757 dnl compilation, pick them up here.
758 dnl
759 dnl GLIBCPP_CHECK_TARGET
760 AC_DEFUN(GLIBCPP_CHECK_TARGET, [
761 . [$]{glibcpp_basedir}/configure.target
762 AC_MSG_RESULT(CPU config directory is $cpu_include_dir)
763 AC_MSG_RESULT(OS config directory is $os_include_dir)
764 AC_LINK_FILES($os_include_dir/bits/os_defines.h, include/bits/os_defines.h)
765 ])
766
767
768 dnl
769 dnl Check to see if this target can enable the wchar_t parts of libstdc++.
770 dnl If --disable-c-mbchar was given, no wchar_t stuff is enabled. (This
771 dnl must have been previously checked.)
772 dnl
773 dnl Define _GLIBCPP_USE_WCHAR_T if all the bits are found
774 dnl Define HAVE_MBSTATE_T if mbstate_t is not in wchar.h
775 dnl
776 dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT
777 AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
778
779 dnl Test wchar.h for mbstate_t, which is needed for char_traits and
780 dnl others even if wchar_t support is not on.
781 AC_MSG_CHECKING([for mbstate_t])
782 AC_TRY_COMPILE([#include <wchar.h>],
783 [mbstate_t teststate;],
784 have_mbstate_t=yes, have_mbstate_t=no)
785 AC_MSG_RESULT($have_mbstate_t)
786 if test x"$have_mbstate_t" = xyes; then
787 AC_DEFINE(HAVE_MBSTATE_T)
788 fi
789
790 dnl Sanity check for existence of ISO C99 headers for extended encoding.
791 AC_CHECK_HEADERS(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no)
792 AC_CHECK_HEADER(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no)
793
794 dnl Only continue checking if the ISO C99 headers exist and support is on.
795 if test x"$ac_has_wchar_h" = xyes && test x"$ac_has_wctype_h" = xyes \
796 && test x"$enable_c_mbchar" != xno; then
797
798 dnl Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
799 dnl numeric_limits can instantiate type_traits<wchar_t>
800 AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
801 AC_TRY_COMPILE([#include <wchar.h>],
802 [int i = WCHAR_MIN; int j = WCHAR_MAX;],
803 has_wchar_minmax=yes, has_wchar_minmax=no)
804 AC_MSG_RESULT($has_wchar_minmax)
805
806 dnl Test wchar.h for WEOF, which is what we use to determine whether
807 dnl to specialize for char_traits<wchar_t> or not.
808 AC_MSG_CHECKING([for WEOF])
809 AC_TRY_COMPILE([
810 #include <wchar.h>
811 #include <stddef.h>],
812 [wint_t i = WEOF;],
813 has_weof=yes, has_weof=no)
814 AC_MSG_RESULT($has_weof)
815
816 dnl Tests for wide character functions used in char_traits<wchar_t>.
817 AC_CHECK_FUNCS(wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset \
818 wcsrtombs mbsrtowcs, ac_wfuncs=yes, ac_wfuncs=no)
819
820 AC_MSG_CHECKING([for ISO C99 wchar_t support])
821 if test x"$has_weof" = xyes && test x"$has_wchar_minmax" = xyes \
822 && test x"$ac_wfuncs" = xyes; then
823 ac_isoC99_wchar_t=yes
824 else
825 ac_isoC99_wchar_t=no
826 fi
827 AC_MSG_RESULT($ac_isoC99_wchar_t)
828
829 dnl Use iconv for wchar_t to char conversions. As such, check for
830 dnl X/Open Portability Guide, version 2 features (XPG2).
831 AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no)
832 AC_CHECK_HEADER(langinfo.h, ac_has_langinfo_h=yes, ac_has_langinfo_h=no)
833
834 dnl Check for existence of libiconv.a providing XPG2 wchar_t support.
835 AC_CHECK_LIB(iconv, iconv, libiconv="-liconv")
836 ac_save_LIBS="$LIBS"
837 LIBS="$LIBS $libiconv"
838
839 AC_CHECK_FUNCS(iconv_open iconv_close iconv nl_langinfo, \
840 ac_XPG2funcs=yes, ac_XPG2funcs=no)
841
842 LIBS="$ac_save_LIBS"
843
844 AC_MSG_CHECKING([for XPG2 wchar_t support])
845 if test x"$ac_has_iconv_h" = xyes && test x"$ac_has_langinfo_h" = xyes \
846 && test x"$ac_XPG2funcs" = xyes; then
847 ac_XPG2_wchar_t=yes
848 else
849 ac_XPG2_wchar_t=no
850 fi
851 AC_MSG_RESULT($ac_XPG2_wchar_t)
852
853 dnl At the moment, only enable wchar_t specializations if all the
854 dnl above support is present.
855 AC_MSG_CHECKING([for enabled wchar_t specializations])
856 if test x"$ac_isoC99_wchar_t" = xyes \
857 && test x"$ac_XPG2_wchar_t" = xyes; then
858 AC_DEFINE(_GLIBCPP_USE_WCHAR_T)
859 AC_MSG_RESULT("yes")
860 else
861 AC_MSG_RESULT("no")
862 fi
863 else
864 dnl Wide characters disabled by the user.
865 AC_MSG_WARN([wchar_t support disabled.])
866 fi
867 ])
868
869
870 dnl
871 dnl Check to see if this version of GNU C++ is afflicted by bugs in
872 dnl __complex__ float support.
873 dnl
874 dnl Define _GLIBCPP_BUGGY_FLOAT_COMPLEX if buggy.
875 dnl
876 dnl Check to see if this version of GNU C++ is afflicted by bugs in
877 dnl __complex__ support.Check for buggy __complex__ that will cause ICE in
878 dnl gcc-2.95.x when using the library, unless we define the default copy
879 dnl ctor in the specializations of complex<>.
880 dnl
881 dnl Define _GLIBCPP_BUGGY_COMPLEX if buggy.
882 dnl GLIBCPP_CHECK_COMPLEX_MATH_COMPILER_SUPPORT
883 AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_COMPILER_SUPPORT, [
884 AC_REQUIRE([AC_PROG_CXX])
885
886 AC_MSG_CHECKING([for GNU C++ __complex__ support])
887 AC_CACHE_VAL(glibcpp_cv_complex, [
888 AC_LANG_SAVE
889 AC_LANG_CPLUSPLUS
890 AC_TRY_COMPILE([struct dcomplex { __complex__ double x; }; \
891 dcomplex f(const dcomplex& x) { return dcomplex(x); }], \
892 [ dcomplex x; f(x); ],
893 glibcpp_cv_complex=ok,
894 glibcpp_cv_complex=buggy
895 )
896 AC_LANG_RESTORE
897 ])
898 AC_MSG_RESULT($glibcpp_cv_complex)
899 if test $glibcpp_cv_complex = buggy; then
900 AC_DEFINE(_GLIBCPP_BUGGY_COMPLEX)
901 fi
902
903 AC_MSG_CHECKING([for GNU C++ __complex__ float support])
904 AC_CACHE_VAL(glibcpp_cv_float_complex, [
905 AC_LANG_SAVE
906 AC_LANG_CPLUSPLUS
907 rm -f conftest.h
908 cat > conftest.h <<EOB
909 //
910 // Check for buggy __complex__ that causes ICE in most versions of egcs
911 // and gcc-2.95.x on certain platforms (eg., x86-win32).
912 //
913 // See http://gcc.gnu.org/ml/gcc-bugs/1999-07n/msg00845.html for
914 // more info on the bug itself.
915 //
916 struct
917 float_complex
918 {
919 __complex__ float m_value;
920 float_complex (float = 0.0f, float = 0.0f);
921 float_complex (__complex__ float val) : m_value (val) {}
922 float_complex foo (const float_complex &val)
923 { return float_complex (~val.m_value); }
924 };
925 EOB
926 AC_TRY_COMPILE([#include "conftest.h"], ,
927 glibcpp_cv_float_complex=ok,
928 glibcpp_cv_float_complex=buggy
929 )
930 AC_LANG_RESTORE
931 ])
932 AC_MSG_RESULT($glibcpp_cv_float_complex)
933 if test $glibcpp_cv_float_complex = buggy; then
934 AC_DEFINE(_GLIBCPP_BUGGY_FLOAT_COMPLEX)
935 fi
936 ])
937
938
939 dnl
940 dnl Check for special debugging mode; not for production use.
941 dnl
942 dnl GLIBCPP_ENABLE_DEBUG
943 dnl --enable-debug sets '-ggdb3 -O0'.
944 dnl --disable-debug sets '-g' and whatever optimization options the
945 dnl compiler can handle.
946 dnl + --enable-maintainer-mode automatically defaults this to on.
947 dnl + Perhaps -D/-U of NDEBUG, DEBUG, DEBUG_ASSERT, ...?
948 dnl + Usage: GLIBCPP_ENABLE_DEBUG[(DEFAULT)]
949 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
950 dnl defaults to `no'.
951 AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl
952 define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl
953 AC_ARG_ENABLE(debug,
954 changequote(<<, >>)dnl
955 << --enable-debug extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT],
956 changequote([, ])dnl
957 [case "${enableval}" in
958 yes) enable_debug=yes ;;
959 no) enable_debug=no ;;
960 *) AC_MSG_ERROR([Unknown argument to enable/disable extra debugging]) ;;
961 esac],
962 enable_debug=GLIBCPP_ENABLE_DEBUG_DEFAULT)dnl
963
964 dnl Option parsed, now set things appropriately
965 case "${enable_debug}" in
966 yes)
967 DEBUG_FLAGS='-O0 -ggdb3'
968 ;;
969 no)
970 DEBUG_FLAGS='-g'
971 ;;
972 esac
973 AC_SUBST(DEBUG_FLAGS)
974 ])
975
976
977 dnl
978 dnl Check for "unusual" flags to pass to the compiler while building.
979 dnl
980 dnl GLIBCPP_ENABLE_CXX_FLAGS
981 dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing
982 dnl experimental flags such as -fhonor-std, -fsquangle, -Dfloat=char, etc.
983 dnl Somehow this same set of flags must be passed when [re]building
984 dnl libgcc.
985 dnl --disable-cxx-flags passes nothing.
986 dnl + See http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00131.html
987 dnl http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00284.html
988 dnl http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00035.html
989 dnl + Usage: GLIBCPP_ENABLE_CXX_FLAGS(default flags)
990 dnl If "default flags" is an empty string (or "none"), the effect is
991 dnl the same as --disable or --enable=no.
992 AC_DEFUN(GLIBCPP_ENABLE_CXX_FLAGS, [dnl
993 define([GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT], ifelse($1,,, $1))dnl
994 AC_ARG_ENABLE(cxx-flags,
995 changequote(<<, >>)dnl
996 << --enable-cxx-flags=FLAGS pass compiler FLAGS when building library;
997 [default=>>GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT],
998 changequote([, ])dnl
999 [case "x$enableval" in
1000 xyes)
1001 AC_MSG_ERROR([--enable-cxx-flags needs compiler flags as arguments]) ;;
1002 xno|x)
1003 enable_cxx_flags='' ;;
1004 *)
1005 enable_cxx_flags="$enableval" ;;
1006 esac],
1007 enable_cxx_flags='GLIBCPP_ENABLE_CXX_FLAGS_DEFAULT')
1008
1009 dnl Thinko on my part during design. This kludge is the workaround.
1010 if test "$enable_cxx_flags" = "none"; then
1011 enable_cxx_flags='';
1012 fi
1013
1014 dnl Run through flags (either default or command-line) and set anything
1015 dnl extra (e.g., #defines) that must accompany particular g++ options.
1016 if test -n "$enable_cxx_flags"; then
1017 for f in $enable_cxx_flags; do
1018 case "$f" in
1019 -fhonor-std) ;;
1020 -*) ;;
1021 *) # and we're trying to pass /what/ exactly?
1022 AC_MSG_ERROR([compiler flags start with a -]) ;;
1023 esac
1024 done
1025 fi
1026 EXTRA_CXX_FLAGS="$enable_cxx_flags"
1027 AC_SUBST(EXTRA_CXX_FLAGS)
1028 ])
1029
1030
1031 dnl
1032 dnl Check for which locale library to use: gnu or generic.
1033 dnl
1034 dnl GLIBCPP_ENABLE_CLOCALE
1035 dnl --enable-clocale=gnu sets config/c_locale_gnu.cc and friends
1036 dnl --enable-clocale=generic sets config/c_locale_generic.cc and friends
1037 dnl
1038 dnl default is generic
1039 dnl
1040 AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
1041 AC_MSG_CHECKING([for clocale to use])
1042 AC_ARG_ENABLE(clocale,
1043 [ --enable-clocale enable model for target locale package.
1044 --enable-clocale=MODEL use MODEL target-speific locale package. [default=generic]
1045 ],
1046 if test x$enable_clocale = xno; then
1047 enable_clocale=generic
1048 fi,
1049 enable_clocale=generic)
1050
1051 enable_clocale_flag=$enable_clocale
1052
1053 dnl Check if a valid locale package
1054 case x${enable_clocale_flag} in
1055 xgnu)
1056 CLOCALE_H=config/c_locale_gnu.h
1057 CLOCALE_CC=config/c_locale_gnu.cc
1058 AC_MSG_RESULT(gnu)
1059 ;;
1060 xgeneric)
1061 CLOCALE_H=config/c_locale_generic.h
1062 CLOCALE_CC=config/c_locale_generic.cc
1063 AC_MSG_RESULT(generic)
1064 ;;
1065 *)
1066 echo "$enable_clocale is an unknown locale package" 1>&2
1067 exit 1
1068 ;;
1069 esac
1070
1071 AC_LINK_FILES($CLOCALE_H, include/bits/c++locale.h)
1072 AC_LINK_FILES($CLOCALE_CC, src/c++locale.cc)
1073 ])
1074
1075
1076 dnl
1077 dnl Check for which I/O library to use: libio, or something specific.
1078 dnl
1079 dnl GLIBCPP_ENABLE_CSTDIO
1080 dnl --enable-cstdio=libio sets config/c_io_libio.h and friends
1081 dnl
1082 dnl default is stdio
1083 dnl
1084 AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
1085 AC_MSG_CHECKING([for cstdio to use])
1086 AC_ARG_ENABLE(cstdio,
1087 [ --enable-cstdio enable stdio for target io package.
1088 --enable-cstdio=LIB use LIB target-speific io package. [default=stdio]
1089 ],
1090 if test x$enable_cstdio = xno; then
1091 enable_cstdio=stdio
1092 fi,
1093 enable_cstdio=stdio)
1094
1095 enable_cstdio_flag=$enable_cstdio
1096
1097 dnl Check if a valid I/O package
1098 case x${enable_cstdio_flag} in
1099 xlibio)
1100 CSTDIO_H=config/c_io_libio.h
1101 BASIC_FILE_H=config/basic_file_libio.h
1102 BASIC_FILE_CC=config/basic_file_libio.cc
1103 AC_MSG_RESULT(libio)
1104
1105 # see if we are on a system with libio native (ie, linux)
1106 AC_CHECK_HEADER(libio.h, has_libio=yes, has_libio=no)
1107
1108 # Need to check and see what version of glibc is being used. If
1109 # it's not glibc-2.2 or higher, then we'll need to go ahead and
1110 # compile most of libio for linux systems.
1111 if test x$has_libio = x"yes"; then
1112 case "$target" in
1113 *-*-linux*)
1114 AC_MSG_CHECKING([for glibc version >= 2.2])
1115 AC_EGREP_CPP([ok], [
1116 #include <features.h>
1117 #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
1118 ok
1119 #endif
1120 ], glibc_satisfactory=yes, glibc_satisfactory=no)
1121 AC_MSG_RESULT($glibc_satisfactory)
1122 ;;
1123 esac
1124
1125 # XXX at the moment, admit defeat and force the recompilation
1126 # XXX of glibc even on glibc-2.2 systems, because libio is not synched.
1127 glibc_satisfactory=no
1128
1129 if test x$glibc_satisfactory = x"yes"; then
1130 need_libio=no
1131 need_wlibio=no
1132 else
1133 need_libio=yes
1134 # bkoz XXX need to add checks to enable this
1135 # pme XXX here's a first pass at such a check
1136 if test x$enable_c_mbchar != xno; then
1137 need_wlibio=yes
1138 else
1139 need_wlibio=no
1140 fi
1141 fi
1142
1143 else
1144 # Using libio, but <libio.h> doesn't exist on the target system. . .
1145 need_libio=yes
1146 # bkoz XXX need to add checks to enable this
1147 # pme XXX here's a first pass at such a check
1148 if test x$enable_c_mbchar != xno; then
1149 need_wlibio=yes
1150 else
1151 need_wlibio=no
1152 fi
1153 fi
1154 ;;
1155 xstdio | x | xno | xnone | xyes)
1156 # default
1157 CSTDIO_H=config/c_io_stdio.h
1158 BASIC_FILE_H=config/basic_file_stdio.h
1159 BASIC_FILE_CC=config/basic_file_stdio.cc
1160 AC_MSG_RESULT(stdio)
1161
1162 # We're not using stdio.
1163 need_libio=no
1164 need_wlibio=no
1165 ;;
1166 *)
1167 echo "$enable_cstdio is an unknown io package" 1>&2
1168 exit 1
1169 ;;
1170 esac
1171 AC_LINK_FILES($CSTDIO_H, include/bits/c++io.h)
1172 AC_LINK_FILES($BASIC_FILE_H, include/bits/basic_file_model.h)
1173 AC_LINK_FILES($BASIC_FILE_CC, src/basic_file.cc)
1174
1175 # 2000-08-04 bkoz hack
1176 CCODECVT_C=config/c_io_libio_codecvt.c
1177 AC_LINK_FILES($CCODECVT_C, libio/c_codecvt.c)
1178 # 2000-08-04 bkoz hack
1179
1180 AM_CONDITIONAL(GLIBCPP_BUILD_LIBIO,
1181 test "$need_libio" = yes || test "$need_wlibio" = yes)
1182 AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
1183 AM_CONDITIONAL(GLIBCPP_NEED_WLIBIO, test "$need_wlibio" = yes)
1184 if test "$need_libio" = yes || test "$need_wlibio" = yes; then
1185 libio_la=../libio/libio.la
1186 else
1187 libio_la=
1188 fi
1189 AC_SUBST(libio_la)
1190 ])
1191
1192
1193 dnl
1194 dnl Check for which threading library to use.
1195 dnl
1196 dnl GLIBCPP_ENABLE_THREADS
1197 dnl --enable-threads=posix sets config/threads-posix.h et. al.
1198 dnl
1199 dnl Default is no threads, which also disables _IO_MTSAFE_IO in
1200 dnl libio. Any actual thread package will enable it.
1201 dnl
1202 AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
1203 AC_MSG_CHECKING([for thread model used by GCC])
1204 target_thread_file=`$CC -v 2>&1 | sed -n 's/^Thread model: //p'`
1205 AC_MSG_RESULT([$target_thread_file])
1206
1207 dnl Check for thread package actually supported in libstdc++
1208 THREADH=
1209 case "$target_thread_file" in
1210 no | none | single)
1211 THREADH=threads-no.h
1212 ;;
1213 posix | pthreads)
1214 THREADH=threads-posix.h
1215 ;;
1216 decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks)
1217 AC_MSG_WARN(disabling unsupported thread package $target_thread_file)
1218 THREADH=threads-no.h
1219 ;;
1220 *)
1221 AC_MSG_ERROR($target_thread_file: unsupported/unknown thread package)
1222 ;;
1223 esac
1224
1225 AC_LINK_FILES(config/$THREADH, include/bits/c++threads.h)
1226 if test $THREADH != threads-no.h; then
1227 AC_DEFINE(_GLIBCPP_USE_THREADS)
1228 fi
1229 ])
1230
1231
1232 dnl
1233 dnl Check for exception handling support. If an explicit enable/disable
1234 dnl sjlj exceptions is given, we don't have to detect. Otherwise the
1235 dnl target may or may not support call frame exceptions.
1236 dnl
1237 dnl GLIBCPP_ENABLE_SJLJ_EXCEPTIONS
1238 dnl --enable-sjlj-exceptions forces the use of builtin setjmp.
1239 dnl --disable-sjlj-exceptions forces the use of call frame unwinding.
1240 dnl
1241 dnl Define _GLIBCPP_SJLJ_EXCEPTIONS if the compiler is configured for it.
1242 dnl
1243 AC_DEFUN(GLIBCPP_ENABLE_SJLJ_EXCEPTIONS, [
1244 AC_MSG_CHECKING([for exception model to use])
1245 AC_LANG_SAVE
1246 AC_LANG_CPLUSPLUS
1247 AC_ARG_ENABLE(sjlj-exceptions,
1248 [ --enable-sjlj-exceptions force use of builtin_setjmp for exceptions],
1249 [:],
1250 [dnl Botheration. Now we've got to detect the exception model.
1251 dnl Link tests against libgcc.a are problematic since -- at least
1252 dnl as of this writing -- we've not been given proper -L bits for
1253 dnl single-tree newlib and libgloss.
1254 dnl
1255 dnl This is what AC_TRY_COMPILE would do if it didn't delete the
1256 dnl conftest files before we got a change to grep them first.
1257 cat > conftest.$ac_ext << EOF
1258 [#]line __oline__ "configure"
1259 struct S { ~S(); };
1260 void bar();
1261 void foo()
1262 {
1263 S s;
1264 bar();
1265 }
1266 EOF
1267 old_CXXFLAGS="$CXXFLAGS"
1268 CXXFLAGS=-S
1269 if AC_TRY_EVAL(ac_compile); then
1270 if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
1271 enable_sjlj_exceptions=yes
1272 elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
1273 enable_sjlj_exceptions=no
1274 fi
1275 fi
1276 CXXFLAGS="$old_CXXFLAGS"
1277 rm -f conftest*])
1278 if test x$enable_sjlj_exceptions = xyes; then
1279 AC_DEFINE(_GLIBCPP_SJLJ_EXCEPTIONS, 1,
1280 [Define if the compiler is configured for setjmp/longjmp exceptions.])
1281 ac_exception_model_name=sjlj
1282 elif test x$enable_sjlj_exceptions = xno; then
1283 ac_exception_model_name="call frame"
1284 else
1285 AC_MSG_ERROR([unable to detect exception model])
1286 fi
1287 AC_LANG_RESTORE
1288 AC_MSG_RESULT($ac_exception_model_name)
1289 ])
1290
1291
1292 dnl
1293 dnl Check for ISO/IEC 9899:1999 "C99" support.
1294 dnl
1295 dnl GLIBCPP_ENABLE_C99
1296 dnl --enable-c99 defines _GLIBCPP_USE_C99
1297 dnl --disable-c99 leaves _GLIBCPP_USE_C99 undefined
1298 dnl + Usage: GLIBCPP_ENABLE_C99[(DEFAULT)]
1299 dnl Where DEFAULT is either `yes' or `no'. If omitted, it
1300 dnl defaults to `no'.
1301 dnl + If 'C99' stuff is not available, ignores DEFAULT and sets `no'.
1302 dnl
1303 dnl GLIBCPP_ENABLE_C99
1304 AC_DEFUN(GLIBCPP_ENABLE_C99, [dnl
1305 define([GLIBCPP_ENABLE_C99_DEFAULT], ifelse($1, yes, yes, no))dnl
1306
1307 AC_ARG_ENABLE(c99,
1308 changequote(<<, >>)dnl
1309 <<--enable-c99 turns on 'ISO/IEC 9899:1999 support' [default=>>GLIBCPP_ENABLE_C99_DEFAULT],
1310 changequote([, ])dnl
1311 [case "$enableval" in
1312 yes) enable_c99=yes ;;
1313 no) enable_c99=no ;;
1314 *) AC_MSG_ERROR([Unknown argument to enable/disable C99]) ;;
1315 esac],
1316 enable_c99=GLIBCPP_ENABLE_C99_DEFAULT)dnl
1317
1318 AC_LANG_SAVE
1319 AC_LANG_CPLUSPLUS
1320
1321 # Check for the existence of <math.h> functions used if C99 is enabled.
1322 AC_TRY_COMPILE([#include <math.h>],[fpclassify(0.0);],, [ac_c99_math=no])
1323 AC_TRY_COMPILE([#include <math.h>],[isfinite(0.0);],, [ac_c99_math=no])
1324 AC_TRY_COMPILE([#include <math.h>],[isinf(0.0);],, [ac_c99_math=no])
1325 AC_TRY_COMPILE([#include <math.h>],[isnan(0.0);],, [ac_c99_math=no])
1326 AC_TRY_COMPILE([#include <math.h>],[isnormal(0.0);],, [ac_c99_math=no])
1327 AC_TRY_COMPILE([#include <math.h>],[signbit(0.0);],, [ac_c99_math=no])
1328 AC_TRY_COMPILE([#include <math.h>],[isgreater(0.0,0.0);],, [ac_c99_math=no])
1329 AC_TRY_COMPILE([#include <math.h>],
1330 [isgreaterequal(0.0,0.0);], , [ac_c99_math=no])
1331 AC_TRY_COMPILE([#include <math.h>],[isless(0.0,0.0);],, [ac_c99_math=no])
1332 AC_TRY_COMPILE([#include <math.h>],[islessequal(0.0,0.0);],,[ac_c99_math=no])
1333 AC_TRY_COMPILE([#include <math.h>],
1334 [islessgreater(0.0,0.0);], , [ac_c99_math=no])
1335 AC_TRY_COMPILE([#include <math.h>],
1336 [isunordered(0.0,0.0);], , [ac_c99_math=no])
1337
1338 # Check for the existence in <stdlib.h> of lldiv_t, et. al.
1339 AC_CHECK_FUNC(strtoll,,ac_c99_stdlib=no)
1340 AC_CHECK_FUNC(strtoull,,ac_c99_stdlib=no)
1341 AC_CHECK_FUNC(llabs,,ac_c99_stdlib=no)
1342 AC_CHECK_FUNC(lldiv,,ac_c99_stdlib=no)
1343 AC_CHECK_FUNC(atoll,,ac_c99_stdlib=no)
1344
1345 AC_MSG_CHECKING([for lldiv_t declaration])
1346 AC_CACHE_VAL(ac_c99_lldiv_t, [
1347 AC_TRY_COMPILE([#include <stdlib.h>],
1348 [ lldiv_t mydivt;],
1349 [ac_c99_lldiv_t=yes], [ac_c99_lldiv_t=no])
1350 ])
1351 AC_MSG_RESULT($ac_c99_lldiv_t)
1352 if test x"$ac_c99_lldiv_t" = x"no"; then
1353 ac_c99_stdlib=no;
1354 fi;
1355
1356 # Check for the existence of <wchar.h> functions used if C99 is enabled.
1357 AC_CHECK_FUNC(wcstold,,ac_c99_wchar=no)
1358 AC_CHECK_FUNC(wcstoll,,ac_c99_wchar=no)
1359 AC_CHECK_FUNC(wcstoull,,ac_c99_wchar=no)
1360
1361 AC_MSG_CHECKING([for enabled ISO C99 support])
1362 if test x"$ac_c99_math" = x"no" || test x"$ac_c99_wchar" = x"no" \
1363 || test x"$ac_c99_stdlib" = x"no"; then
1364 enable_c99=no;
1365 fi;
1366 AC_MSG_RESULT($enable_c99)
1367
1368 # Option parsed, now set things appropriately
1369 if test x"$enable_c99" = x"yes"; then
1370 AC_DEFINE(_GLIBCPP_USE_C99)
1371 fi
1372
1373 AC_LANG_RESTORE
1374 ])
1375
1376
1377 dnl
1378 dnl Check for template specializations for the 'long long' type extension.
1379 dnl NB: Must check for C99 support before calling _GLIBCPP_ENABLE_LONG_LONG
1380 dnl
1381 dnl GLIBCPP_ENABLE_LONG_LONG
1382 dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG
1383 dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined
1384 dnl + Usage: GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)]
1385 dnl Where DEFAULT is either `yes' or `no'. If omitted, it
1386 dnl defaults to `no'.
1387 dnl + If 'long long' stuff is not available, ignores DEFAULT and sets `no'.
1388 dnl
1389 dnl GLIBCPP_ENABLE_LONG_LONG
1390 AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
1391 define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl
1392
1393 AC_ARG_ENABLE(long-long,
1394 changequote(<<, >>)dnl
1395 <<--enable-long-long turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT],
1396 changequote([, ])dnl
1397 [case "$enableval" in
1398 yes) enable_long_long=yes ;;
1399 no) enable_long_long=no ;;
1400 *) AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;;
1401 esac],
1402 enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl
1403
1404 # iostreams require strtoll, strtoull to compile. If the
1405 # GLIBCPP_ENABLE_C99 tests found these, and if C99 support is enabled,
1406 # go ahead and allow long long to be used.
1407 if test x"$enable_c99" = x"no"; then
1408 enable_long_long=no;
1409 fi
1410
1411 # Option parsed, now set things appropriately
1412 AC_MSG_CHECKING([for enabled long long support])
1413 if test x"$enable_long_long" = xyes; then
1414 AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
1415 fi
1416 AC_MSG_RESULT($enable_long_long)
1417 ])
1418
1419
1420 dnl
1421 dnl Check for what kind of C headers to use.
1422 dnl
1423 dnl GLIBCPP_ENABLE_CHEADERS
1424 dnl --enable-cheaders= [does stuff].
1425 dnl --disable-cheaders [does not do anything, really].
1426 dnl + This will eventually need to be 'c_shadow' by default.
1427 dnl + Usage: GLIBCPP_ENABLE_CHEADERS[(DEFAULT)]
1428 dnl Where DEFAULT is either `c' or `c_std' or 'c_shadow'.
1429 dnl If ommitted, it defaults to `c_std'.
1430 AC_DEFUN(GLIBCPP_ENABLE_CHEADERS, [dnl
1431 define([GLIBCPP_ENABLE_CHEADERS_DEFAULT], ifelse($1, c_std, c_std, c_std))dnl
1432 AC_MSG_CHECKING([for c header strategy to use])
1433 AC_ARG_ENABLE(cheaders,
1434 changequote(<<, >>)dnl
1435 << --enable-cheaders construct "C" header files for
1436 g++ [default=>>GLIBCPP_ENABLE_CHEADERS_DEFAULT],
1437 changequote([, ])
1438 [case "$enableval" in
1439 c)
1440 enable_cheaders=c
1441 ;;
1442 c_std)
1443 enable_cheaders=c_std
1444 ;;
1445 c_shadow)
1446 enable_cheaders=c_shadow
1447 ;;
1448 *) AC_MSG_ERROR([Unknown argument to enable/disable "C" headers])
1449 ;;
1450 esac],
1451 enable_cheaders=GLIBCPP_ENABLE_CHEADERS_DEFAULT)
1452 AC_MSG_RESULT($enable_cheaders)
1453
1454 dnl Option parsed, now set things appropriately
1455 case "$enable_cheaders" in
1456 c_shadow)
1457 CSHADOW_FLAGS="-fno-builtin"
1458 C_INCLUDE_DIR='${top_srcdir}/include/c_shadow'
1459 AC_DEFINE(_GLIBCPP_USE_SHADOW_HEADERS)
1460 ;;
1461 c_std)
1462 CSHADOW_FLAGS=""
1463 C_INCLUDE_DIR='${top_srcdir}/include/c_std'
1464 ;;
1465 c)
1466 CSHADOW_FLAGS=""
1467 C_INCLUDE_DIR='${top_srcdir}/include/c'
1468 ;;
1469 esac
1470
1471 AC_SUBST(CSHADOW_FLAGS)
1472 AC_SUBST(C_INCLUDE_DIR)
1473 AM_CONDITIONAL(GLIBCPP_USE_CSHADOW, test "$enable_cheaders" = c_shadow)
1474 ])
1475
1476
1477 dnl
1478 dnl Check for wide character support. Has the same effect as the option
1479 dnl in gcc's configure, but in a form that autoconf can mess with.
1480 dnl
1481 dnl GLIBCPP_ENABLE_C_MBCHAR
1482 dnl --enable-c-mbchar requests all the wchar_t stuff.
1483 dnl --disable-c-mbchar doesn't.
1484 dnl + Usage: GLIBCPP_ENABLE_C_MBCHAR[(DEFAULT)]
1485 dnl Where DEFAULT is either `yes' or `no'. If ommitted, it
1486 dnl defaults to `no'.
1487 AC_DEFUN(GLIBCPP_ENABLE_C_MBCHAR, [dnl
1488 define([GLIBCPP_ENABLE_C_MBCHAR_DEFAULT], ifelse($1, yes, yes, no))dnl
1489 AC_ARG_ENABLE(c-mbchar,
1490 changequote(<<, >>)dnl
1491 << --enable-c-mbchar enable multibyte (wide) characters [default=>>GLIBCPP_ENABLE_C_MBCHAR_DEFAULT],
1492 changequote([, ])dnl
1493 [case "$enableval" in
1494 yes) enable_c_mbchar=yes ;;
1495 no) enable_c_mbchar=no ;;
1496 *) AC_MSG_ERROR([Unknown argument to enable/disable c-mbchar]) ;;
1497 esac],
1498 enable_c_mbchar=GLIBCPP_ENABLE_C_MBCHAR_DEFAULT)dnl
1499 dnl Option parsed, now other scripts can test enable_c_mbchar for yes/no.
1500 ])
1501
1502
1503 dnl
1504 dnl Set up *_INCLUDES and *_INCLUDE_DIR variables for all sundry Makefile.am's.
1505 dnl
1506 dnl GLIBCPP_INCLUDE_DIR
1507 dnl C_INCLUDE_DIR
1508 dnl TOPLEVEL_INCLUDES
1509 dnl LIBMATH_INCLUDES
1510 dnl LIBSUPCXX_INCLUDES
1511 dnl LIBIO_INCLUDES
1512 dnl CSHADOW_INCLUDES
1513 dnl
1514 dnl GLIBCPP_EXPORT_INCLUDE
1515 AC_DEFUN(GLIBCPP_EXPORT_INCLUDES, [
1516 # Root level of the include sources.
1517 GLIBCPP_INCLUDE_DIR='$(top_srcdir)/include'
1518
1519 # Can either use include/c or include/c_std to grab "C" headers. This
1520 # variable is set to the include directory currently in use.
1521 # set with C_INCLUDE_DIR in GLIBCPP_ENABLE_CHEADERS
1522
1523 # Passed down for canadian crosses.
1524 if test x"$CANADIAN" = xyes; then
1525 TOPLEVEL_INCLUDES='-I$(includedir)'
1526 fi
1527
1528 LIBMATH_INCLUDES='-I$(top_srcdir)/libmath'
1529
1530 LIBSUPCXX_INCLUDES='-I$(top_srcdir)/libsupc++'
1531
1532 #if GLIBCPP_NEED_LIBIO
1533 LIBIO_INCLUDES='-I$(top_builddir)/libio -I$(top_srcdir)/libio'
1534 #else
1535 #LIBIO_INCLUDES='-I$(top_srcdir)/libio'
1536 #endif
1537
1538 #if GLIBCPP_USE_CSHADOW
1539 # CSHADOW_INCLUDES='-I$(GLIBCPP_INCLUDE_DIR)/std -I$(C_INCLUDE_DIR) \
1540 # -I$(top_blddir)/cshadow'
1541 #else
1542 CSTD_INCLUDES='-I$(GLIBCPP_INCLUDE_DIR)/std -I$(C_INCLUDE_DIR)'
1543 #endif
1544
1545 # Now, export this to all the little Makefiles....
1546 AC_SUBST(GLIBCPP_INCLUDE_DIR)
1547 AC_SUBST(TOPLEVEL_INCLUDES)
1548 AC_SUBST(LIBMATH_INCLUDES)
1549 AC_SUBST(LIBSUPCXX_INCLUDES)
1550 AC_SUBST(LIBIO_INCLUDES)
1551 AC_SUBST(CSTD_INCLUDES)
1552 ])
1553
1554
1555 dnl
1556 dnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's.
1557 dnl
1558 AC_DEFUN(GLIBCPP_EXPORT_FLAGS, [
1559 # Optimization flags that are probably a good idea for thrill-seekers. Just
1560 # uncomment the lines below and make, everything else is ready to go...
1561 # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
1562 OPTIMIZE_CXXFLAGS=
1563 AC_SUBST(OPTIMIZE_CXXFLAGS)
1564
1565 WARN_FLAGS='-Wall -Wno-format -W -Wwrite-strings -Winline'
1566 AC_SUBST(WARN_FLAGS)
1567 ])
1568
1569 dnl
1570 dnl GLIBCPP_EXPORT_INSTALL_INFO
1571 dnl calculates gxx_install_dir
1572 dnl exports glibcpp_toolexecdir
1573 dnl exports glibcpp_toolexeclibdir
1574 dnl
1575 dnl Assumes cross_compiling bits already done, and with_cross_host in
1576 dnl particular
1577 dnl
1578 dnl GLIBCPP_EXPORT_INSTALL_INFO
1579 AC_DEFUN(GLIBCPP_EXPORT_INSTALL_INFO, [
1580
1581 glibcpp_toolexecdir=no
1582 glibcpp_toolexeclibdir=no
1583
1584 AC_MSG_CHECKING([for interface version number])
1585 libstdcxx_interface=$INTERFACE
1586 AC_MSG_RESULT($libstdcxx_interface)
1587
1588 # Process the option --with-gxx-include-dir=<path to include-files directory>
1589 AC_MSG_CHECKING([for --with-gxx-include-dir])
1590 AC_ARG_WITH(gxx-include-dir,
1591 [ --with-gxx-include-dir the installation directory for include files],
1592 [case "${withval}" in
1593 yes)
1594 AC_MSG_ERROR(Missing directory for --with-gxx-include-dir)
1595 gxx_include_dir=no
1596 ;;
1597 no)
1598 gxx_include_dir=no
1599 ;;
1600 *)
1601 gxx_include_dir=${withval}
1602 ;;
1603 esac], [gxx_include_dir=no])
1604 AC_MSG_RESULT($gxx_include_dir)
1605
1606 # Process the option "--enable-version-specific-runtime-libs"
1607 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
1608 AC_ARG_ENABLE(version-specific-runtime-libs,
1609 [ --enable-version-specific-runtime-libs Specify that runtime libraries should be installed in a compiler-specific directory ],
1610 [ version_specific_libs=yes
1611 # Need the gcc compiler version to know where to install libraries
1612 # and header files if --enable-version-specific-runtime-libs option
1613 # is selected.
1614 changequote(,)dnl
1615 gcc_version_trigger=${srcdir}/../gcc/version.c
1616 gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([^\"]*\)\".*/\1/'`
1617 gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
1618 gxx_include_dir='$(libdir)/gcc-lib/$(target_alias)/'${gcc_version}/include/g++
1619 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
1620 glibcpp_toolexeclibdir='$(toolexecdir)/'${gcc_version}
1621 changequote([,])dnl
1622 ],version_specific_libs=no)
1623 AC_MSG_RESULT($version_specific_libs)
1624
1625 # Default case for install directory for include files.
1626 if test x"$version_specific_libs" = x"no" \
1627 && test x"$gxx_include_dir" = x"no"; then
1628 gxx_include_dir='$(prefix)'/include/g++-${libstdcxx_interface}
1629 fi
1630
1631 # Calculate glibcpp_toolexecdir, glibcpp_toolexeclibdir
1632 # Install a library built with a cross compiler in tooldir, not libdir.
1633 if test x"$glibcpp_toolexecdir" = x"no"; then
1634 if test -n "$with_cross_host" && test x"$with_cross_host" != x"no"; then
1635 glibcpp_toolexecdir='$(exec_prefix)/$(target_alias)'
1636 glibcpp_toolexeclibdir='$(toolexecdir)/lib$(MULTISUBDIR)'
1637 else
1638 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
1639 glibcpp_toolexeclibdir='$(libdir)$(MULTISUBDIR)'
1640 fi
1641 fi
1642
1643 AC_MSG_CHECKING([for install location])
1644 AC_MSG_RESULT($gxx_include_dir)
1645
1646 AC_SUBST(gxx_include_dir)
1647 AC_SUBST(glibcpp_toolexecdir)
1648 AC_SUBST(glibcpp_toolexeclibdir)
1649 ])
1650
1651
1652 # Check whether LC_MESSAGES is available in <locale.h>.
1653 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1654 #
1655 # This file file be copied and used freely without restrictions. It can
1656 # be used in projects which are not available under the GNU Public License
1657 # but which still want to provide support for the GNU gettext functionality.
1658 # Please note that the actual code is *not* freely available.
1659
1660 # serial 1
1661
1662 AC_DEFUN(AC_LC_MESSAGES, [
1663 AC_CHECK_HEADER(locale.h, [
1664 AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
1665 [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1666 ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
1667 if test $ac_cv_val_LC_MESSAGES = yes; then
1668 AC_DEFINE(HAVE_LC_MESSAGES)
1669 fi
1670 ])
1671 ])
1672
1673
1674 # Check for functions in math library.
1675 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1676 #
1677 # This file can be copied and used freely without restrictions. It can
1678 # be used in projects which are not available under the GNU Public License
1679 # but which still want to provide support for the GNU gettext functionality.
1680 # Please note that the actual code is *not* freely available.
1681
1682 # serial 1
1683
1684 dnl AC_REPLACE_MATHFUNCS(FUNCTION...)
1685 AC_DEFUN(AC_REPLACE_MATHFUNCS,
1686 [AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])
1687 AC_SUBST(LIBMATHOBJS)dnl
1688 ])
1689
1690
1691 # Check for string functions.
1692 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1693 #
1694 # This file can be copied and used freely without restrictions. It can
1695 # be used in projects which are not available under the GNU Public License
1696 # but which still want to provide support for the GNU gettext functionality.
1697 # Please note that the actual code is *not* freely available.
1698
1699 # serial 1
1700
1701 dnl AC_REPLACE_STRINGFUNCS(FUNCTION...)
1702 AC_DEFUN(AC_REPLACE_STRINGFUNCS,
1703 [AC_CHECK_FUNCS([$1], , [LIBSTRINGOBJS="$LIBSTRINGOBJS ${ac_func}.lo"])
1704 AC_SUBST(LIBSTRINGOBJS)dnl
1705 ])
1706
1707
1708 dnl This macro searches for a GNU version of make. If a match is found, the
1709 dnl makefile variable `ifGNUmake' is set to the empty string, otherwise it is
1710 dnl set to "#". This is useful for including a special features in a Makefile,
1711 dnl which cannot be handled by other versions of make. The variable
1712 dnl _cv_gnu_make_command is set to the command to invoke GNU make if it exists,
1713 dnl the empty string otherwise.
1714 dnl
1715 dnl Here is an example of its use:
1716 dnl
1717 dnl Makefile.in might contain:
1718 dnl
1719 dnl # A failsafe way of putting a dependency rule into a makefile
1720 dnl $(DEPEND):
1721 dnl $(CC) -MM $(srcdir)/*.c > $(DEPEND)
1722 dnl
1723 dnl @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
1724 dnl @ifGNUmake@ include $(DEPEND)
1725 dnl @ifGNUmake@ endif
1726 dnl
1727 dnl Then configure.in would normally contain:
1728 dnl
1729 dnl CHECK_GNU_MAKE()
1730 dnl AC_OUTPUT(Makefile)
1731 dnl
1732 dnl Then perhaps to cause gnu make to override any other make, we could do
1733 dnl something like this (note that GNU make always looks for GNUmakefile first):
1734 dnl
1735 dnl if ! test x$_cv_gnu_make_command = x ; then
1736 dnl mv Makefile GNUmakefile
1737 dnl echo .DEFAULT: > Makefile ;
1738 dnl echo \ $_cv_gnu_make_command \$@ >> Makefile;
1739 dnl fi
1740 dnl
1741 dnl Then, if any (well almost any) other make is called, and GNU make also
1742 dnl exists, then the other make wraps the GNU make.
1743 dnl
1744 dnl @author John Darrington <j.darrington@elvis.murdoch.edu.au>
1745 dnl @version 1.1 #### replaced Id string now that Id is for lib-v3; pme
1746 dnl
1747 dnl #### Changes for libstdc++-v3: reformatting and linewrapping; prepending
1748 dnl #### GLIBCPP_ to the macro name; adding the :-make fallback in the
1749 dnl #### conditional's subshell (" --version" is not a command), using a
1750 dnl #### different option to grep(1).
1751 dnl #### -pme
1752 dnl #### Fixed Bourne shell portability bug (use ${MAKE-make}, not
1753 dnl #### ${MAKE:-make}).
1754 dnl #### -msokolov
1755 AC_DEFUN(
1756 GLIBCPP_CHECK_GNU_MAKE, [AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
1757 _cv_gnu_make_command='' ;
1758 dnl Search all the common names for GNU make
1759 for a in "${MAKE-make}" make gmake gnumake ; do
1760 if ( $a --version 2> /dev/null | grep -c GNU > /dev/null )
1761 then
1762 _cv_gnu_make_command=$a ;
1763 break;
1764 fi
1765 done ;
1766 ) ;
1767 dnl If there was a GNU version, then set @ifGNUmake@ to the empty
1768 dnl string, '#' otherwise
1769 if test "x$_cv_gnu_make_command" != "x" ; then
1770 ifGNUmake='' ;
1771 else
1772 ifGNUmake='#' ;
1773 fi
1774 AC_SUBST(ifGNUmake)
1775 ])
1776
1777 sinclude(../libtool.m4)
1778 dnl The lines below arrange for aclocal not to bring an installed
1779 dnl libtool.m4 into aclocal.m4, while still arranging for automake to
1780 dnl add a definition of LIBTOOL to Makefile.in.
1781 ifelse(,,,[AC_SUBST(LIBTOOL)
1782 AC_DEFUN([AM_PROG_LIBTOOL])
1783 AC_DEFUN([AC_LIBTOOL_DLOPEN])
1784 AC_DEFUN([AC_PROG_LD])
1785 ])
1786
1787