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