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