OSDN Git Service

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