* lib/old-dejagnu.exp: Don't delete output of executable.
[official-gcc.git] / libstdc++-v3 / aclocal.m4
blob117a0dc34172a398f9a151b8c7e0c4cb7d661eac
1 dnl aclocal.m4 generated automatically by aclocal 1.4
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.
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.
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
29   glibcpp_basedir=$auxdir/$1/libstdc++-v3
30   AC_SUBST(glibcpp_basedir)
32   AM_INIT_AUTOMAKE(libstdc++, 2.90.8)
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]))])
41 #  AC_PROG_CC
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.
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])
59 AC_PROG_CC_GNU
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"
83 LIB_AC_PROG_CC
85 # Can't just call these here as g++ requires libstc++ to be built....
86 #  AC_PROG_CXX
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])
103 AC_PROG_CXX_GNU
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"
127 LIB_AC_PROG_CXX
129   AC_CHECK_TOOL(AS, as)
130   AC_CHECK_TOOL(AR, ar)
131   AC_CHECK_TOOL(RANLIB, ranlib, :)
133   AC_PROG_INSTALL
135   AM_MAINTAINER_MODE
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
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=
154   . [$]{glibcpp_basedir}/configure.host
156   case [$]{glibcpp_basedir} in
157     /* | [A-Za-z]:[\\/]*) libgcj_flagbasedir=[$]{glibcpp_basedir} ;;
158     *) glibcpp_flagbasedir='[$](top_builddir)/'[$]{glibcpp_basedir} ;;
159   esac
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
165   GLIBCPP_CFLAGS="[$]{glibcpp_cflags}"
166   GLIBCPP_CXXFLAGS="[$]{glibcpp_cxxflags}"
167   AC_SUBST(GLIBCPP_CFLAGS)
168   AC_SUBST(GLIBCPP_CXXFLAGS)
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
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.
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.
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"
217   # Check for maintainer-mode bits.
218   if test x"$USE_MAINTAINER_MODE" = xno; then
219     WERROR=''
220   else
221     WERROR='-Werror'
222   fi
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)
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)
256   AC_LANG_RESTORE
257   AC_SUBST(WERROR)
258   AC_SUBST(WFMT_FLAGS)
259   AC_SUBST(SECTION_FLAGS)
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).
268 dnl Define SECTION_LDFLAGS='-Wl,--gc-sections' if possible.
269 dnl Define OPT_LDFLAGS='-Wl,-O1' if possible.
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])
280   # Set --gc-sections.
281   if test "$ac_cv_prog_gnu_ld" = "notbroken"; then
282     # GNU ld it is!  Joy and bunny rabbits!
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'
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
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
323   AC_SUBST(SECTION_LDFLAGS)
324   AC_SUBST(OPT_LDFLAGS)
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
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)
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 '_'
359 dnl Define HAVE_CARGF etc if "cargf" is declared and links
361 dnl argument 1 is name of function to check
363 dnl ASSUMES argument is a math function with ONE parameter
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
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
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
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)
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
426 dnl Define HAVE_CARGF etc if "cargf" is declared and links
428 dnl argument 1 is name of function to check
430 dnl ASSUMES argument is a math function with TWO parameters
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
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
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)
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
472 dnl Define HAVE_CARGF etc if "cargf" is declared and links
474 dnl argument 1 is name of function to check
476 dnl ASSUMES argument is a math function with THREE parameters
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
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
497 dnl Define HAVE_STRTOLD if "strtold" is declared and links
498 dnl Define HAVE_STRTOF if "strtof" is declared and links
500 dnl argument 1 is name of function to check
502 dnl ASSUMES argument is a math function with TWO parameters
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
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
531 dnl Define HAVE_CARGF etc if "cargf" is declared and links
533 dnl argument 1 is name of function to check
535 dnl ASSUMES argument is a math function with ONE parameter
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
570 dnl Check to see what builtin math functions are supported
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
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)
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)
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)
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)
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
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...
642 dnl Define HAVE_STRTOF etc if "strtof" is found.
643 dnl Define HAVE_STRTOLD etc if "strtold" is found.
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'
651   AC_CHECK_FUNCS(strtof)
652   GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtold)
654   CXXFLAGS="$ac_save_CXXFLAGS"
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...
665 dnl Define HAVE_CARGF etc if "cargf" is found.
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'
673   dnl Check libm
674   AC_CHECK_LIB(m, sin, libm="-lm")
675   ac_save_LIBS="$LIBS"
676   LIBS="$LIBS $libm"
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)
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)
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)
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.
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)
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)
761   LIBS="$ac_save_LIBS"
762   CXXFLAGS="$ac_save_CXXFLAGS"
767 dnl Check to see if there is native support for complex 
769 dnl Don't compile bits in math/* if native support exits.
771 dnl Define USE_COMPLEX_LONG_DOUBLE etc if "atan2l/copysignl" is found.
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)
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
790   AC_SUBST(USE_COMPLEX_LONG_DOUBLE)
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)
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.)
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
815 dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT
816 AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
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
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)
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"
878     AC_CHECK_FUNCS(iconv_open iconv_close iconv nl_langinfo, \
879     ac_XPG2funcs=yes, ac_XPG2funcs=no)
880   
881     LIBS="$ac_save_LIBS"
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
914 dnl Check to see if this version of GNU C++ is afflicted by bugs in
915 dnl __complex__ float support.
917 dnl Define _GLIBCPP_BUGGY_FLOAT_COMPLEX if buggy.
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])
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
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       };
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
983 dnl Check for special debugging mode; not for production use.
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
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)
1021 dnl Check for "unusual" flags to pass to the compiler while building.
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')
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=''; 
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
1069 EXTRA_CXX_FLAGS="$enable_cxx_flags"
1070 AC_SUBST(EXTRA_CXX_FLAGS)
1075 dnl Check for which locale library to use:  gnu or generic.
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
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)
1094   enable_clocale_flag=$enable_clocale
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
1114   AC_LINK_FILES($CLOCALE_H, include/bits/c++locale.h)
1115   AC_LINK_FILES($CLOCALE_CC, src/c++locale.cc)
1120 dnl Check for which I/O library to use:  libio, or something specific.
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
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)
1138   enable_cstdio_flag=$enable_cstdio
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       BASIC_FILE_H=config/basic_file_libio.h
1145       BASIC_FILE_CC=config/basic_file_libio.cc
1146       AC_MSG_RESULT(libio)
1148       # see if we are on a system with libio native (ie, linux)
1149       AC_CHECK_HEADER(libio.h,  has_libio=yes, has_libio=no)
1151       # Need to check and see what version of glibc is being used. If
1152       # it's not glibc-2.2 or higher, then we'll need to go ahead and 
1153       # compile most of libio for linux systems.
1154       if test x$has_libio = x"yes"; then
1155         case "$target" in
1156           *-*-linux*)
1157               AC_MSG_CHECKING([for glibc version >= 2.2])
1158               AC_EGREP_CPP([ok], [
1159             #include <features.h>
1160               #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) 
1161                     ok
1162               #endif
1163               ], glibc_satisfactory=yes, glibc_satisfactory=no)
1164               AC_MSG_RESULT($glibc_satisfactory)
1165             ;;
1166         esac
1168         # XXX at the moment, admit defeat and force the recompilation
1169         # XXX of glibc even on glibc-2.2 systems, because libio is not synched.
1170         glibc_satisfactory=no        
1172         if test x$glibc_satisfactory = x"yes"; then
1173            need_libio=no
1174            need_wlibio=no        
1175         else
1176            need_libio=yes
1177            # bkoz XXX need to add checks to enable this
1178            # pme XXX here's a first pass at such a check
1179            if test x$enable_c_mbchar != xno; then
1180               need_wlibio=yes
1181            else
1182               need_wlibio=no
1183            fi
1184         fi
1186       else
1187          # Using libio, but <libio.h> doesn't exist on the target system. . .
1188          need_libio=yes
1189          # bkoz XXX need to add checks to enable this
1190          # pme XXX here's a first pass at such a check
1191          if test x$enable_c_mbchar != xno; then
1192              need_wlibio=yes
1193          else
1194              need_wlibio=no
1195          fi
1196       fi
1197       ;;
1198     xstdio | x | xno | xnone | xyes)
1199       # default
1200       CSTDIO_H=config/c_io_stdio.h
1201       BASIC_FILE_H=config/basic_file_stdio.h
1202       BASIC_FILE_CC=config/basic_file_stdio.cc
1203       AC_MSG_RESULT(stdio)
1205       # We're not using stdio.
1206       need_libio=no
1207       need_wlibio=no
1208       # Wide characters are not supported with this package.
1209       enable_c_mbchar=no
1210       ;;
1211     *)
1212       echo "$enable_cstdio is an unknown io package" 1>&2
1213       exit 1
1214       ;;
1215   esac
1216   AC_LINK_FILES($CSTDIO_H, include/bits/c++io.h)
1217   AC_LINK_FILES($BASIC_FILE_H, include/bits/basic_file_model.h)
1218   AC_LINK_FILES($BASIC_FILE_CC, src/basic_file.cc)
1220   # 2000-08-04 bkoz hack
1221   CCODECVT_C=config/c_io_libio_codecvt.c
1222   AC_LINK_FILES($CCODECVT_C, libio/c_codecvt.c)
1223   # 2000-08-04 bkoz hack
1225   AM_CONDITIONAL(GLIBCPP_BUILD_LIBIO,
1226                  test "$need_libio" = yes || test "$need_wlibio" = yes)
1227   AM_CONDITIONAL(GLIBCPP_NEED_LIBIO, test "$need_libio" = yes)
1228   AM_CONDITIONAL(GLIBCPP_NEED_WLIBIO, test "$need_wlibio" = yes)
1229   if test "$need_libio" = yes || test "$need_wlibio" = yes; then
1230     libio_la=../libio/libio.la
1231   else
1232     libio_la=
1233   fi
1234   AC_SUBST(libio_la)
1239 dnl Check for which threading library to use.
1241 dnl GLIBCPP_ENABLE_THREADS
1242 dnl --enable-threads=posix sets config/threads-posix.h et. al.
1243 dnl 
1244 dnl Default is no threads, which also disables _IO_MTSAFE_IO in
1245 dnl libio.  Any actual thread package will enable it.
1247 AC_DEFUN(GLIBCPP_ENABLE_THREADS, [
1248   dnl Note this comes from the gcc/config.in and libjava/config.in
1249   dnl Efforts should be made to keep this in sync.
1250   AC_MSG_CHECKING([for threads package to use])
1251   AC_ARG_ENABLE(threads,
1252   [  --enable-threads       enable thread usage for target GCC.
1253      --enable-threads=LIB   use LIB thread package for target GCC. [default=no]
1254   ],
1255   if test x$enable_threads = xno; then
1256     enable_threads=''
1257   fi,
1258     enable_threads='')
1260   enable_threads_flag=$enable_threads
1262   dnl Check if a valid thread package
1263   case x${enable_threads_flag} in
1264         x | xno | xnone)
1265                 # No threads
1266                 target_thread_file='single'
1267                 ;;
1268         xyes)
1269                 # default
1270                 target_thread_file='posix'
1271                 ;;
1272         xdecosf1 | xirix | xmach | xos2 | xposix | xpthreads | xsingle | \
1273         xsolaris | xwin32 | xdce | xvxworks)
1274                 target_thread_file=$enable_threads_flag
1275                 ;;
1276         *)
1277                 echo "$enable_threads is an unknown thread package" 1>&2
1278                 exit 1
1279                 ;;
1280   esac
1282   dnl Check for thread package actually supported in libstdc++ 
1283   THREADH=
1284   case "$target_thread_file" in
1285     no | none | single)
1286       THREADH=threads-no.h
1287       ;;
1288     posix | pthreads)
1289       THREADH=threads-posix.h
1290       ;;
1291     decosf1 | irix | mach | os2 | solaris | win32 | dce | vxworks)
1292       AC_MSG_ERROR(thread package $THREADS not yet supported)
1293       ;;
1294     *)
1295       AC_MSG_ERROR($THREADS is an unsupported/unknown thread package)
1296       ;;
1297   esac
1298   AC_MSG_RESULT($THREADH)
1300   AC_LINK_FILES(config/$THREADH, include/bits/c++threads.h)
1301   if test $THREADH != threads-no.h; then
1302     AC_DEFINE(_GLIBCPP_USE_THREADS)
1303   fi
1308 dnl Check for template specializations for the 'long long' type extension.
1310 dnl GLIBCPP_ENABLE_LONG_LONG
1311 dnl --enable-long-long defines _GLIBCPP_USE_LONG_LONG
1312 dnl --disable-long-long leaves _GLIBCPP_USE_LONG_LONG undefined
1313 dnl  +  Usage:  GLIBCPP_ENABLE_LONG_LONG[(DEFAULT)]
1314 dnl       Where DEFAULT is either `yes' or `no'.  If ommitted, it
1315 dnl       defaults to `no'.
1316 dnl  +  If 'long long' stuff is not available, ignores DEFAULT and sets `no'.
1318 dnl GLIBCPP_ENABLE_LONG_LONG
1319 AC_DEFUN(GLIBCPP_ENABLE_LONG_LONG, [dnl
1320   define([GLIBCPP_ENABLE_LONG_LONG_DEFAULT], ifelse($1, yes, yes, no))dnl
1322   AC_ARG_ENABLE(long-long,
1323   changequote(<<, >>)dnl
1324   <<--enable-long-long      turns on 'long long' [default=>>GLIBCPP_ENABLE_LONG_LONG_DEFAULT],
1325   changequote([, ])dnl
1326   [case "$enableval" in
1327    yes) enable_long_long=yes ;;
1328    no)  enable_long_long=no ;;
1329    *)   AC_MSG_ERROR([Unknown argument to enable/disable long long]) ;;
1330    esac],
1331   enable_long_long=GLIBCPP_ENABLE_LONG_LONG_DEFAULT)dnl
1333   # Allow use of os-dependent settings, so that macros that turn on
1334   # C99 capabilities can be defined and used in a consistent way.
1335   OS_INC_PATH=${srcdir}/$os_include_dir
1336   ac_test_CFLAGS="${CFLAGS+set}"
1337   ac_save_CFLAGS="$CFLAGS"
1338   CFLAGS="-I$OS_INC_PATH"
1340   # Check for the existence of functions used if long long is enabled.
1341   AC_CHECK_FUNC(strtoll,,ac_strtoll=no)
1342   AC_CHECK_FUNC(strtoull,,ac_strtoull=no)
1344   # Check for lldiv_t, et. al.
1345   AC_MSG_CHECKING([for lldiv_t declaration])
1346   AC_CACHE_VAL(glibcpp_lldiv_t_use, [
1347   AC_TRY_COMPILE([#include <bits/os_defines.h>
1348                   #include <stdlib.h>], 
1349                    [ lldiv_t mydivt;], 
1350                    [glibcpp_lldiv_t_use=yes], [glibcpp_lldiv_t_use=no])
1351   ])
1352   AC_MSG_RESULT($glibcpp_lldiv_t_use)
1353   if test x$glibcpp_lldiv_t_use = x"yes"; then
1354     AC_DEFINE(HAVE_LLDIV_T)
1355   fi
1357   AC_MSG_CHECKING([for enabled long long])
1358   if test x"$ac_strtoll" = xno || test x"$ac_strtoull" = xno; then 
1359     enable_long_long=no; 
1360   fi; 
1361   AC_MSG_RESULT($enable_long_long)
1363   # Option parsed, now set things appropriately
1364   if test x"$enable_long_long" = xyes; then
1365     AC_DEFINE(_GLIBCPP_USE_LONG_LONG)
1366   fi
1368   # Reset CFLAGS
1369   CFLAGS="$ac_save_CFLAGS"
1374 dnl Check for what kind of C headers to use.
1376 dnl GLIBCPP_ENABLE_CHEADERS
1377 dnl --enable-cheaders= [does stuff].
1378 dnl --disable-cheaders [does not do anything, really].
1379 dnl  +  This will eventually need to be 'c_shadow' by default.
1380 dnl  +  Usage:  GLIBCPP_ENABLE_CHEADERS[(DEFAULT)]
1381 dnl       Where DEFAULT is either `c' or `c_std' or 'c_shadow'.  
1382 dnl       If ommitted, it defaults to `c_std'.
1383 AC_DEFUN(GLIBCPP_ENABLE_CHEADERS, [dnl
1384 define([GLIBCPP_ENABLE_CHEADERS_DEFAULT], ifelse($1, c_std, c_std, c_std))dnl
1385 AC_MSG_CHECKING([for c header strategy to use])
1386 AC_ARG_ENABLE(cheaders,
1387 changequote(<<, >>)dnl
1388 <<  --enable-cheaders construct "C" header files for
1389                            g++ [default=>>GLIBCPP_ENABLE_CHEADERS_DEFAULT],
1390 changequote([, ])
1391   [case "$enableval" in
1392    c) 
1393         enable_cheaders=c 
1394         ;;
1395    c_std)  
1396         enable_cheaders=c_std 
1397         ;;
1398    c_shadow)  
1399         enable_cheaders=c_shadow 
1400         ;;
1401    *)   AC_MSG_ERROR([Unknown argument to enable/disable "C" headers]) 
1402         ;;
1403   esac],
1404   enable_cheaders=GLIBCPP_ENABLE_CHEADERS_DEFAULT)
1405   AC_MSG_RESULT($enable_cheaders)
1407   dnl Option parsed, now set things appropriately
1408   case "$enable_cheaders" in
1409     c_shadow) 
1410         CSHADOW_FLAGS="-fno-builtin"
1411         C_INCLUDE_DIR='${top_srcdir}/include/c_shadow'
1412         AC_DEFINE(_GLIBCPP_USE_SHADOW_HEADERS)
1413         ;;
1414     c_std)   
1415         CSHADOW_FLAGS=""
1416         C_INCLUDE_DIR='${top_srcdir}/include/c_std'
1417         ;;
1418     c)   
1419         CSHADOW_FLAGS=""
1420         C_INCLUDE_DIR='${top_srcdir}/include/c'
1421         ;;
1422   esac
1424   AC_SUBST(CSHADOW_FLAGS)
1425   AC_SUBST(C_INCLUDE_DIR)
1426   AM_CONDITIONAL(GLIBCPP_USE_CSHADOW, test "$enable_cheaders" = c_shadow)
1431 dnl Check for wide character support.  Has the same effect as the option
1432 dnl in gcc's configure, but in a form that autoconf can mess with.
1434 dnl GLIBCPP_ENABLE_C_MBCHAR
1435 dnl --enable-c-mbchar requests all the wchar_t stuff.
1436 dnl --disable-c-mbchar doesn't.
1437 dnl  +  Usage:  GLIBCPP_ENABLE_C_MBCHAR[(DEFAULT)]
1438 dnl       Where DEFAULT is either `yes' or `no'.  If ommitted, it
1439 dnl       defaults to `no'.
1440 AC_DEFUN(GLIBCPP_ENABLE_C_MBCHAR, [dnl
1441 define([GLIBCPP_ENABLE_C_MBCHAR_DEFAULT], ifelse($1, yes, yes, no))dnl
1442 AC_ARG_ENABLE(c-mbchar,
1443 changequote(<<, >>)dnl
1444 <<  --enable-c-mbchar       enable multibyte (wide) characters [default=>>GLIBCPP_ENABLE_C_MBCHAR_DEFAULT],
1445 changequote([, ])dnl
1446 [case "$enableval" in
1447  yes) enable_c_mbchar=yes ;;
1448  no)  enable_c_mbchar=no ;;
1449  *)   AC_MSG_ERROR([Unknown argument to enable/disable c-mbchar]) ;;
1450  esac],
1451 enable_c_mbchar=GLIBCPP_ENABLE_C_MBCHAR_DEFAULT)dnl
1452 dnl Option parsed, now other scripts can test enable_c_mbchar for yes/no.
1457 dnl Set up *_INCLUDES and *_INCLUDE_DIR variables for all sundry Makefile.am's.
1459 dnl GLIBCPP_INCLUDE_DIR
1460 dnl C_INCLUDE_DIR
1461 dnl TOPLEVEL_INCLUDES
1462 dnl LIBMATH_INCLUDES
1463 dnl LIBSUPCXX_INCLUDES
1464 dnl LIBIO_INCLUDES
1465 dnl CSHADOW_INCLUDES
1467 dnl GLIBCPP_EXPORT_INCLUDE
1468 AC_DEFUN(GLIBCPP_EXPORT_INCLUDES, [
1469   # Root level of the include sources.
1470   GLIBCPP_INCLUDE_DIR='$(top_srcdir)/include'
1472   # Can either use include/c or include/c_std to grab "C" headers. This
1473   # variable is set to the include directory currently in use.
1474   # set with C_INCLUDE_DIR in GLIBCPP_ENABLE_CHEADERS
1475    
1476   # Passed down for canadian crosses.
1477   if  test x"$CANADIAN" = xyes; then
1478     TOPLEVEL_INCLUDES='-I$(includedir)'
1479   fi
1481   LIBMATH_INCLUDES='-I$(top_srcdir)/libmath'
1483   LIBSUPCXX_INCLUDES='-I$(top_srcdir)/libsupc++'
1485   #if GLIBCPP_NEED_LIBIO
1486   LIBIO_INCLUDES='-I$(top_builddir)/libio -I$(top_srcdir)/libio'
1487   #else
1488   #LIBIO_INCLUDES='-I$(top_srcdir)/libio'
1489   #endif
1491   #if GLIBCPP_USE_CSHADOW
1492   #  CSHADOW_INCLUDES='-I$(GLIBCPP_INCLUDE_DIR)/std -I$(C_INCLUDE_DIR) \
1493   #                   -I$(top_blddir)/cshadow'
1494   #else
1495   CSTD_INCLUDES='-I$(GLIBCPP_INCLUDE_DIR)/std -I$(C_INCLUDE_DIR)'
1496   #endif
1498   # Now, export this to all the little Makefiles....
1499   AC_SUBST(GLIBCPP_INCLUDE_DIR)
1500   AC_SUBST(TOPLEVEL_INCLUDES)
1501   AC_SUBST(LIBMATH_INCLUDES)
1502   AC_SUBST(LIBSUPCXX_INCLUDES)
1503   AC_SUBST(LIBIO_INCLUDES)
1504   AC_SUBST(CSTD_INCLUDES)
1509 dnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's.
1511 AC_DEFUN(GLIBCPP_EXPORT_FLAGS, [
1512   # Optimization flags that are probably a good idea for thrill-seekers. Just
1513   # uncomment the lines below and make, everything else is ready to go... 
1514   # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc 
1515   OPTIMIZE_CXXFLAGS=
1516   AC_SUBST(OPTIMIZE_CXXFLAGS)
1518   WARN_FLAGS='-Wall -Wno-format -W -Wwrite-strings -Winline'
1519   AC_SUBST(WARN_FLAGS)
1523 dnl  GLIBCPP_EXPORT_INSTALL_INFO
1524 dnl  calculates gxx_install_dir
1525 dnl  exports glibcpp_toolexecdir
1526 dnl  exports glibcpp_toolexeclibdir
1528 dnl Assumes cross_compiling bits already done, and with_cross_host in
1529 dnl particular
1531 dnl GLIBCPP_EXPORT_INSTALL_INFO
1532 AC_DEFUN(GLIBCPP_EXPORT_INSTALL_INFO, [
1534 glibcpp_toolexecdir=no
1535 glibcpp_toolexeclibdir=no
1537 AC_MSG_CHECKING([for interface version number])
1538 libstdcxx_interface=$INTERFACE
1539 AC_MSG_RESULT($libstdcxx_interface)
1541 # Process the option --with-gxx-include-dir=<path to include-files directory>
1542 AC_MSG_CHECKING([for --with-gxx-include-dir])
1543 AC_ARG_WITH(gxx-include-dir,
1544 [ --with-gxx-include-dir  the installation directory for include files],
1545 [case "${withval}" in
1546   yes)
1547     AC_MSG_ERROR(Missing directory for --with-gxx-include-dir)
1548     gxx_include_dir=no
1549     ;;
1550   no)
1551     gxx_include_dir=no
1552     ;;
1553   *)
1554     gxx_include_dir=${withval}
1555     ;;
1556 esac], [gxx_include_dir=no])
1557 AC_MSG_RESULT($gxx_include_dir)
1559 # Process the option "--enable-version-specific-runtime-libs"
1560 AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
1561 AC_ARG_ENABLE(version-specific-runtime-libs,
1562 [  --enable-version-specific-runtime-libs    Specify that runtime libraries should be installed in a compiler-specific directory ],
1563 [  version_specific_libs=yes
1564 # Need the gcc compiler version to know where to install libraries
1565 # and header files if --enable-version-specific-runtime-libs option
1566 # is selected.
1567 changequote(,)dnl
1568 gcc_version_trigger=${srcdir}/../gcc/version.c
1569 gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([^\"]*\)\".*/\1/'`
1570 gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
1571 gxx_include_dir='$(libdir)/gcc-lib/$(target_alias)/'${gcc_version}/include/g++
1572 glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
1573 glibcpp_toolexeclibdir='$(toolexecdir)/'${gcc_version}
1574 changequote([,])dnl
1575 ],version_specific_libs=no)
1576 AC_MSG_RESULT($version_specific_libs)
1578 # Default case for install directory for include files.
1579 if test x"$version_specific_libs" = x"no" \
1580    && test x"$gxx_include_dir" = x"no"; then
1581   gxx_include_dir='$(prefix)'/include/g++-${libstdcxx_interface}
1584 # Calculate glibcpp_toolexecdir, glibcpp_toolexeclibdir
1585 # Install a library built with a cross compiler in tooldir, not libdir.
1586 if test x"$glibcpp_toolexecdir" = x"no"; then 
1587   if test -n "$with_cross_host" && test x"$with_cross_host" != x"no"; then
1588     glibcpp_toolexecdir='$(exec_prefix)/$(target_alias)'
1589     glibcpp_toolexeclibdir='$(toolexecdir)/lib$(MULTISUBDIR)'
1590   else
1591     glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
1592     glibcpp_toolexeclibdir='$(libdir)$(MULTISUBDIR)'
1593   fi
1596 AC_MSG_CHECKING([for install location])
1597 AC_MSG_RESULT($gxx_include_dir)
1599 AC_SUBST(gxx_include_dir)
1600 AC_SUBST(glibcpp_toolexecdir)
1601 AC_SUBST(glibcpp_toolexeclibdir)
1605 # Check whether LC_MESSAGES is available in <locale.h>.
1606 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1608 # This file file be copied and used freely without restrictions.  It can
1609 # be used in projects which are not available under the GNU Public License
1610 # but which still want to provide support for the GNU gettext functionality.
1611 # Please note that the actual code is *not* freely available.
1613 # serial 1
1615 AC_DEFUN(AC_LC_MESSAGES, [
1616   AC_CHECK_HEADER(locale.h, [
1617     AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
1618       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1619        ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
1620     if test $ac_cv_val_LC_MESSAGES = yes; then
1621       AC_DEFINE(HAVE_LC_MESSAGES)
1622     fi
1623   ])
1627 # Check for functions in math library.
1628 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1630 # This file can be copied and used freely without restrictions.  It can
1631 # be used in projects which are not available under the GNU Public License
1632 # but which still want to provide support for the GNU gettext functionality.
1633 # Please note that the actual code is *not* freely available.
1635 # serial 1
1637 dnl AC_REPLACE_MATHFUNCS(FUNCTION...)
1638 AC_DEFUN(AC_REPLACE_MATHFUNCS,
1639 [AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])
1640 AC_SUBST(LIBMATHOBJS)dnl
1644 # Check for string functions.
1645 # Ulrich Drepper <drepper@cygnus.com>, 1998.
1647 # This file can be copied and used freely without restrictions.  It can
1648 # be used in projects which are not available under the GNU Public License
1649 # but which still want to provide support for the GNU gettext functionality.
1650 # Please note that the actual code is *not* freely available.
1652 # serial 1
1654 dnl AC_REPLACE_STRINGFUNCS(FUNCTION...)
1655 AC_DEFUN(AC_REPLACE_STRINGFUNCS,
1656 [AC_CHECK_FUNCS([$1], , [LIBSTRINGOBJS="$LIBSTRINGOBJS ${ac_func}.lo"])
1657 AC_SUBST(LIBSTRINGOBJS)dnl
1661 dnl This macro searches for a GNU version of make.  If a match is found, the
1662 dnl makefile variable `ifGNUmake' is set to the empty string, otherwise it is
1663 dnl set to "#". This is useful for  including a special features in a Makefile,
1664 dnl which cannot be handled by other versions of make.  The variable
1665 dnl _cv_gnu_make_command is set to the command to invoke GNU make if it exists,
1666 dnl the empty string otherwise.
1668 dnl Here is an example of its use:
1670 dnl Makefile.in might contain:
1672 dnl     # A failsafe way of putting a dependency rule into a makefile
1673 dnl     $(DEPEND):
1674 dnl             $(CC) -MM $(srcdir)/*.c > $(DEPEND)
1676 dnl     @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
1677 dnl     @ifGNUmake@ include $(DEPEND)
1678 dnl     @ifGNUmake@ endif
1680 dnl Then configure.in would normally contain:
1682 dnl     CHECK_GNU_MAKE()
1683 dnl     AC_OUTPUT(Makefile)
1685 dnl Then perhaps to cause gnu make to override any other make, we could do
1686 dnl something like this (note that GNU make always looks for GNUmakefile first):
1688 dnl     if  ! test x$_cv_gnu_make_command = x ; then
1689 dnl             mv Makefile GNUmakefile
1690 dnl             echo .DEFAULT: > Makefile ;
1691 dnl             echo \  $_cv_gnu_make_command \$@ >> Makefile;
1692 dnl     fi
1694 dnl Then, if any (well almost any) other make is called, and GNU make also
1695 dnl exists, then the other make wraps the GNU make.
1697 dnl @author John Darrington <j.darrington@elvis.murdoch.edu.au>
1698 dnl @version 1.1 #### replaced Id string now that Id is for lib-v3; pme
1700 dnl #### Changes for libstdc++-v3:  reformatting and linewrapping; prepending
1701 dnl #### GLIBCPP_ to the macro name; adding the :-make fallback in the
1702 dnl #### conditional's subshell (" --version" is not a command), using a
1703 dnl #### different option to grep(1).
1704 dnl #### -pme
1705 dnl #### Fixed Bourne shell portability bug (use ${MAKE-make}, not
1706 dnl #### ${MAKE:-make}).
1707 dnl #### -msokolov
1708 AC_DEFUN(
1709   GLIBCPP_CHECK_GNU_MAKE, [AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
1710           _cv_gnu_make_command='' ;
1711 dnl Search all the common names for GNU make
1712           for a in "${MAKE-make}" make gmake gnumake ; do
1713                   if ( $a --version 2> /dev/null | grep -c GNU > /dev/null )
1714                   then
1715                           _cv_gnu_make_command=$a ;
1716                           break;
1717                   fi
1718           done ;
1719   ) ;
1720 dnl If there was a GNU version, then set @ifGNUmake@ to the empty
1721 dnl string, '#' otherwise
1722   if test  "x$_cv_gnu_make_command" != "x"  ; then
1723           ifGNUmake='' ;
1724   else
1725           ifGNUmake='#' ;
1726   fi
1727   AC_SUBST(ifGNUmake)
1730 sinclude(../libtool.m4)
1731 dnl The lines below arrange for aclocal not to bring an installed
1732 dnl libtool.m4 into aclocal.m4, while still arranging for automake to
1733 dnl add a definition of LIBTOOL to Makefile.in.
1734 ifelse(,,,[AC_SUBST(LIBTOOL)
1735 AC_DEFUN([AM_PROG_LIBTOOL])
1736 AC_DEFUN([AC_LIBTOOL_DLOPEN])
1737 AC_DEFUN([AC_PROG_LD])
1741 # Do all the work for Automake.  This macro actually does too much --
1742 # some checks are only needed if your package does certain things.
1743 # But this isn't really a big deal.
1745 # serial 1
1747 dnl Usage:
1748 dnl AM_INIT_AUTOMAKE(package,version, [no-define])
1750 AC_DEFUN(AM_INIT_AUTOMAKE,
1751 [AC_REQUIRE([AC_PROG_INSTALL])
1752 PACKAGE=[$1]
1753 AC_SUBST(PACKAGE)
1754 VERSION=[$2]
1755 AC_SUBST(VERSION)
1756 dnl test to see if srcdir already configured
1757 if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
1758   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
1760 ifelse([$3],,
1761 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
1762 AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
1763 AC_REQUIRE([AM_SANITY_CHECK])
1764 AC_REQUIRE([AC_ARG_PROGRAM])
1765 dnl FIXME This is truly gross.
1766 missing_dir=`cd $ac_aux_dir && pwd`
1767 AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir)
1768 AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir)
1769 AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir)
1770 AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
1771 AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
1772 AC_REQUIRE([AC_PROG_MAKE_SET])])
1775 # Check to make sure that the build environment is sane.
1778 AC_DEFUN(AM_SANITY_CHECK,
1779 [AC_MSG_CHECKING([whether build environment is sane])
1780 # Just in case
1781 sleep 1
1782 echo timestamp > conftestfile
1783 # Do `set' in a subshell so we don't clobber the current shell's
1784 # arguments.  Must try -L first in case configure is actually a
1785 # symlink; some systems play weird games with the mod time of symlinks
1786 # (eg FreeBSD returns the mod time of the symlink's containing
1787 # directory).
1788 if (
1789    set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null`
1790    if test "[$]*" = "X"; then
1791       # -L didn't work.
1792       set X `ls -t $srcdir/configure conftestfile`
1793    fi
1794    if test "[$]*" != "X $srcdir/configure conftestfile" \
1795       && test "[$]*" != "X conftestfile $srcdir/configure"; then
1797       # If neither matched, then we have a broken ls.  This can happen
1798       # if, for instance, CONFIG_SHELL is bash and it inherits a
1799       # broken ls alias from the environment.  This has actually
1800       # happened.  Such a system could not be considered "sane".
1801       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
1802 alias in your environment])
1803    fi
1805    test "[$]2" = conftestfile
1806    )
1807 then
1808    # Ok.
1809    :
1810 else
1811    AC_MSG_ERROR([newly created file is older than distributed files!
1812 Check your system clock])
1814 rm -f conftest*
1815 AC_MSG_RESULT(yes)])
1817 dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY)
1818 dnl The program must properly implement --version.
1819 AC_DEFUN(AM_MISSING_PROG,
1820 [AC_MSG_CHECKING(for working $2)
1821 # Run test in a subshell; some versions of sh will print an error if
1822 # an executable is not found, even if stderr is redirected.
1823 # Redirect stdin to placate older versions of autoconf.  Sigh.
1824 if ($2 --version) < /dev/null > /dev/null 2>&1; then
1825    $1=$2
1826    AC_MSG_RESULT(found)
1827 else
1828    $1="$3/missing $2"
1829    AC_MSG_RESULT(missing)
1831 AC_SUBST($1)])
1833 # Add --enable-maintainer-mode option to configure.
1834 # From Jim Meyering
1836 # serial 1
1838 AC_DEFUN(AM_MAINTAINER_MODE,
1839 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
1840   dnl maintainer-mode is disabled by default
1841   AC_ARG_ENABLE(maintainer-mode,
1842 [  --enable-maintainer-mode enable make rules and dependencies not useful
1843                           (and sometimes confusing) to the casual installer],
1844       USE_MAINTAINER_MODE=$enableval,
1845       USE_MAINTAINER_MODE=no)
1846   AC_MSG_RESULT($USE_MAINTAINER_MODE)
1847   AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
1848   MAINT=$MAINTAINER_MODE_TRUE
1849   AC_SUBST(MAINT)dnl
1853 # Define a conditional.
1855 AC_DEFUN(AM_CONDITIONAL,
1856 [AC_SUBST($1_TRUE)
1857 AC_SUBST($1_FALSE)
1858 if $2; then
1859   $1_TRUE=
1860   $1_FALSE='#'
1861 else
1862   $1_TRUE='#'
1863   $1_FALSE=
1864 fi])
1866 # Like AC_CONFIG_HEADER, but automatically create stamp file.
1868 AC_DEFUN(AM_CONFIG_HEADER,
1869 [AC_PREREQ([2.12])
1870 AC_CONFIG_HEADER([$1])
1871 dnl When config.status generates a header, we must update the stamp-h file.
1872 dnl This file resides in the same directory as the config header
1873 dnl that is generated.  We must strip everything past the first ":",
1874 dnl and everything past the last "/".
1875 AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl
1876 ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>,
1877 <<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>,
1878 <<am_indx=1
1879 for am_file in <<$1>>; do
1880   case " <<$>>CONFIG_HEADERS " in
1881   *" <<$>>am_file "*<<)>>
1882     echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx
1883     ;;
1884   esac
1885   am_indx=`expr "<<$>>am_indx" + 1`
1886 done<<>>dnl>>)
1887 changequote([,]))])