OSDN Git Service

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