OSDN Git Service

2003-08-27 Phil Edwards <pme@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / aclocal.m4
1 # generated automatically by aclocal 1.7.6 -*- Autoconf -*-
2
3 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
4 # Free Software Foundation, Inc.
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
8
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY, to the extent permitted by law; without
11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12 # PARTICULAR PURPOSE.
13
14
15 dnl
16 dnl GLIBCXX_CONDITIONAL (NAME, SHELL-TEST)
17 dnl
18 dnl Exactly like AM_CONDITIONAL, but delays evaluation of the test until the
19 dnl end of configure.  This lets tested variables be reassigned, and the
20 dnl conditional will depend on the final state of the variable.  For a simple
21 dnl example of why this is needed, see GLIBCXX_ENABLE_HOSTED.
22 dnl
23 m4_define([_m4_divert(glibcxx_diversion)], 8000)dnl
24 AC_DEFUN(GLIBCXX_CONDITIONAL, [dnl
25   m4_divert_text([glibcxx_diversion],dnl
26    AM_CONDITIONAL([$1],[$2])
27   )dnl
28 ])dnl
29 AC_DEFUN(GLIBCXX_EVALUATE_CONDITIONALS, [m4_undivert([glibcxx_diversion])])dnl
30
31
32 dnl
33 dnl Check to see what architecture and operating system we are compiling
34 dnl for.  Also, if architecture- or OS-specific flags are required for
35 dnl compilation, pick them up here.
36 dnl
37 AC_DEFUN(GLIBCXX_CHECK_HOST, [
38   . $glibcxx_srcdir/configure.host
39   AC_MSG_NOTICE(CPU config directory is $cpu_include_dir)
40   AC_MSG_NOTICE(OS config directory is $os_include_dir)
41 ])
42
43
44 dnl
45 dnl Initialize basic configure bits.
46 dnl
47 dnl Substs:
48 dnl  multi_basedir
49 dnl
50 AC_DEFUN(GLIBCXX_TOPREL_CONFIGURE, [
51   # Sets up multi_basedir, which is srcdir/.. plus the usual
52   # "multi_source_toprel_bottom_adjust" lunacy as needed.
53   AM_ENABLE_MULTILIB(, ..)
54
55   # The generated code is exactly the same, except that automake's looks in
56   # ".. $srcdir/.." and autoconf's looks in multi_basedir.  Apparently other
57   # things are triggered on the presence of the two ...AUX_DIR[S], but I don't
58   # know what they are or what the other differences might be (and they keep
59   # changing anyhow).
60   #
61   # Looking in multi_basedir seems smarter, so actually execute that branch.
62   if false; then
63     # this is for automake
64     AC_CONFIG_AUX_DIR(..)
65   else
66     # this is for autoconf
67     AC_CONFIG_AUX_DIRS(${multi_basedir})
68   fi
69
70   dnl XXX Turn this on.
71   dnl AC_LANG_CPLUSPLUS
72 ])
73
74
75 dnl
76 dnl Initialize the rest of the library configury.  At this point we have
77 dnl variables like $host.
78 dnl
79 dnl Sets:
80 dnl  gcc_version          (x.y.z format)
81 dnl  SUBDIRS
82 dnl Substs:
83 dnl  glibcxx_builddir     (absolute path)
84 dnl  glibcxx_srcdir       (absolute path)
85 dnl  toplevel_srcdir      (absolute path)
86 dnl  with_cross_host
87 dnl  with_newlib
88 dnl  with_target_subdir
89 dnl plus
90 dnl  - the variables in GLIBCXX_CHECK_HOST / configure.host
91 dnl  - default settings for all AM_CONFITIONAL test variables
92 dnl  - lots of tools, like CC and CXX
93 dnl
94 AC_DEFUN(GLIBCXX_CONFIGURE, [
95   # Keep these sync'd with the list in Makefile.am.  The first provides an
96   # expandable list at autoconf time; the second provides an expandable list
97   # (i.e., shell variable) at configure time.
98   m4_define([glibcxx_SUBDIRS],[include libmath libsupc++ src po testsuite])
99   SUBDIRS='glibcxx_SUBDIRS'
100
101   # These need to be absolute paths, yet at the same time need to
102   # canonicalize only relative paths, because then amd will not unmount
103   # drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
104   glibcxx_builddir=`${PWDCMD-pwd}`
105   case $srcdir in
106     [\\/$]* | ?:[\\/]*) glibcxx_srcdir=${srcdir} ;;
107     *) glibcxx_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
108   esac
109   toplevel_srcdir=${glibcxx_srcdir}/..
110   AC_SUBST(glibcxx_builddir)
111   AC_SUBST(glibcxx_srcdir)
112   AC_SUBST(toplevel_srcdir)
113
114   # We use these options to decide which functions to include.  They are
115   # set from the top level.
116   AC_ARG_WITH([target-subdir],
117     AC_HELP_STRING([--with-target-subdir=SUBDIR],
118                    [configuring in a subdirectory]))
119
120   AC_ARG_WITH([cross-host],
121     AC_HELP_STRING([--with-cross-host=HOST],
122                    [configuring with a cross compiler]))
123
124   AC_ARG_WITH([newlib],
125     AC_HELP_STRING([--with-newlib],
126                    [assume newlib as a system C library]))
127
128   # We're almost certainly being configured before anything else which uses
129   # C++, so all of our AC_PROG_* discoveries will be cached.  It's vital that
130   # we not cache the value of CXX that we "discover" here, because it's set
131   # to something unique for us and libjava.  Other target libraries need to
132   # find CXX for themselves.  We yank the rug out from under the normal AC_*
133   # process by sneakily renaming the cache variable.  This also lets us debug
134   # the value of "our" CXX in postmortems.
135   #
136   # We must also force CXX to /not/ be a precious variable, otherwise the
137   # wrong (non-multilib-adjusted) value will be used in multilibs.  This
138   # little trick also affects CPPFLAGS, CXXFLAGS, and LDFLAGS.  And as a side
139   # effect, CXXFLAGS is no longer automagically subst'd, so we have to do
140   # that ourselves.  Un-preciousing AC_PROG_CC also affects CC and CFLAGS.
141   #
142   # -fno-builtin must be present here so that a non-conflicting form of
143   # std::exit can be guessed by AC_PROG_CXX, and used in later tests.
144
145   m4_define([ac_cv_prog_CXX],[glibcxx_cv_prog_CXX])
146   m4_rename([_AC_ARG_VAR_PRECIOUS],[glibcxx_PRECIOUS])
147   m4_define([_AC_ARG_VAR_PRECIOUS],[])
148   save_CXXFLAGS="$CXXFLAGS"
149   CXXFLAGS="$CXXFLAGS -fno-builtin"
150   AC_PROG_CC
151   AC_PROG_CXX
152   CXXFLAGS="$save_CXXFLAGS"
153   m4_rename([glibcxx_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
154   AC_SUBST(CFLAGS)
155   AC_SUBST(CXXFLAGS)
156
157   # For directory versioning (e.g., headers) and other variables.
158   AC_MSG_CHECKING([for GCC version number])
159   gcc_version=`$CXX -dumpversion`
160   AC_MSG_RESULT($gcc_version)
161
162   # Will set LN_S to either 'ln -s', 'ln', or 'cp -p' (if linking isn't
163   # available).  Uncomment the next line to force a particular method.
164   AC_PROG_LN_S
165   #LN_S='cp -p'
166
167   AC_CHECK_TOOL(AS, as)
168   AC_CHECK_TOOL(AR, ar)
169   AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
170
171   AM_MAINTAINER_MODE
172
173   # Set up safe default values for all subsequent AM_CONDITIONAL tests
174   # which are themselves conditionally expanded.
175   ## (Right now, this only matters for enable_wchar_t, but nothing prevents
176   ## other macros from doing the same.  This should be automated.)  -pme
177   need_libmath=no
178   enable_wchar_t=no
179   #enable_libstdcxx_debug=no
180   #enable_libstdcxx_pch=no
181   #enable_cheaders=c
182   #c_compatibility=no
183   #enable_abi_check=no
184   #enable_symvers=no
185   #enable_hosted_libstdcxx=yes
186
187   # Find platform-specific directories containing configuration info.
188   # Also possibly modify flags used elsewhere, as needed by the platform.
189   GLIBCXX_CHECK_HOST
190 ])
191
192
193 m4_include([linkage.m4])
194 m4_include([../config/no-executables.m4])
195
196
197 dnl
198 dnl Tests for newer compiler features, or features that are present in newer
199 dnl compiler versions but not older compiler versions still in use, should
200 dnl be placed here.
201 dnl
202 dnl Defines:
203 dnl  WERROR='-Werror' if requested and possible; g++'s that lack the
204 dnl   new inlining code or the new system_header pragma will die on -Werror.
205 dnl   Leave it out by default and use maint-mode to use it.
206 dnl  SECTION_FLAGS='-ffunction-sections -fdata-sections' if
207 dnl   compiler supports it and the user has not requested debug mode.
208 dnl
209 AC_DEFUN(GLIBCXX_CHECK_COMPILER_FEATURES, [
210   # All these tests are for C++; save the language and the compiler flags.
211   # The CXXFLAGS thing is suspicious, but based on similar bits previously
212   # found in GLIBCXX_CONFIGURE.
213   AC_LANG_SAVE
214   AC_LANG_CPLUSPLUS
215   ac_test_CXXFLAGS="${CXXFLAGS+set}"
216   ac_save_CXXFLAGS="$CXXFLAGS"
217
218   # Check for maintainer-mode bits.
219   if test x"$USE_MAINTAINER_MODE" = xno; then
220     WERROR=''
221   else
222     WERROR='-Werror'
223   fi
224
225   # Check for -ffunction-sections -fdata-sections
226   AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections])
227   CXXFLAGS='-Werror -ffunction-sections -fdata-sections'
228   AC_TRY_COMPILE(, [int foo;], [ac_fdsections=yes], [ac_fdsections=no])
229   if test "$ac_test_CXXFLAGS" = set; then
230     CXXFLAGS="$ac_save_CXXFLAGS"
231   else
232     # this is the suspicious part
233     CXXFLAGS=''
234   fi
235   if test x"$ac_fdsections" = x"yes"; then
236     SECTION_FLAGS='-ffunction-sections -fdata-sections'
237   fi
238   AC_MSG_RESULT($ac_fdsections)
239
240   AC_LANG_RESTORE
241   AC_SUBST(WERROR)
242   AC_SUBST(SECTION_FLAGS)
243 ])
244
245
246 dnl
247 dnl If GNU ld is in use, check to see if tricky linker opts can be used.  If
248 dnl the native linker is in use, all variables will be defined to something
249 dnl safe (like an empty string).
250 dnl
251 dnl Defines:
252 dnl  SECTION_LDFLAGS='-Wl,--gc-sections' if possible
253 dnl  OPT_LDFLAGS='-Wl,-O1' if possible
254 dnl  LD (as a side effect of testing)
255 dnl Sets:
256 dnl  with_gnu_ld
257 dnl  glibcxx_gnu_ld_version (possibly)
258 dnl
259 dnl The last will be a single integer, e.g., version 1.23.45.0.67.89 will
260 dnl set glibcxx_gnu_ld_version to 12345.  Zeros cause problems.
261 dnl
262 AC_DEFUN(GLIBCXX_CHECK_LINKER_FEATURES, [
263   # If we're not using GNU ld, then there's no point in even trying these
264   # tests.  Check for that first.  We should have already tested for gld
265   # by now (in libtool), but require it now just to be safe...
266   test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
267   test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
268   AC_REQUIRE([AC_PROG_LD])
269   AC_REQUIRE([AC_PROG_AWK])
270
271   # The name set by libtool depends on the version of libtool.  Shame on us
272   # for depending on an impl detail, but c'est la vie.  Older versions used
273   # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on
274   # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually
275   # makes sense).  We'll test with_gnu_ld everywhere else, so if that isn't
276   # set (hence we're using an older libtool), then set it.
277   if test x${with_gnu_ld+set} != xset; then
278     if test x${ac_cv_prog_gnu_ld+set} != xset; then
279       # We got through "ac_require(ac_prog_ld)" and still not set?  Huh?
280       with_gnu_ld=no
281     else
282       with_gnu_ld=$ac_cv_prog_gnu_ld
283     fi
284   fi
285
286   # Start by getting the version number.  I think the libtool test already
287   # does some of this, but throws away the result.
288   changequote(,)
289   ldver=`$LD --version 2>/dev/null | head -1 | \
290          sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
291   changequote([,])
292   glibcxx_gnu_ld_version=`echo $ldver | \
293          $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
294
295   # Set --gc-sections.
296   if test "$with_gnu_ld" = "notbroken"; then
297     # GNU ld it is!  Joy and bunny rabbits!
298
299     # All these tests are for C++; save the language and the compiler flags.
300     # Need to do this so that g++ won't try to link in libstdc++
301     ac_test_CFLAGS="${CFLAGS+set}"
302     ac_save_CFLAGS="$CFLAGS"
303     CFLAGS='-x c++  -Wl,--gc-sections'
304
305     # Check for -Wl,--gc-sections
306     # XXX This test is broken at the moment, as symbols required for linking
307     # are now in libsupc++ (not built yet).  In addition, this test has
308     # cored on solaris in the past.  In addition, --gc-sections doesn't
309     # really work at the moment (keeps on discarding used sections, first
310     # .eh_frame and now some of the glibc sections for iconv).
311     # Bzzzzt.  Thanks for playing, maybe next time.
312     AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
313     AC_TRY_RUN([
314      int main(void)
315      {
316        try { throw 1; }
317        catch (...) { };
318        return 0;
319      }
320     ], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], [ac_sectionLDflags=yes])
321     if test "$ac_test_CFLAGS" = set; then
322       CFLAGS="$ac_save_CFLAGS"
323     else
324       # this is the suspicious part
325       CFLAGS=''
326     fi
327     if test "$ac_sectionLDflags" = "yes"; then
328       SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
329     fi
330     AC_MSG_RESULT($ac_sectionLDflags)
331   fi
332
333   # Set linker optimization flags.
334   if test x"$with_gnu_ld" = x"yes"; then
335     OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
336   fi
337
338   AC_SUBST(SECTION_LDFLAGS)
339   AC_SUBST(OPT_LDFLAGS)
340 ])
341
342
343 dnl
344 dnl Check to see if this target can enable the wchar_t parts.
345 dnl If --disable-c-mbchar was given, no wchar_t stuff is enabled.  (This
346 dnl must have been previously checked.)  By default, wide characters are
347 dnl disabled.
348 dnl
349 dnl Defines:
350 dnl  HAVE_MBSTATE_T if mbstate_t is not in wchar.h
351 dnl  _GLIBCXX_USE_WCHAR_T if all the bits are found.
352 dnl
353 AC_DEFUN(GLIBCXX_CHECK_WCHAR_T_SUPPORT, [
354   # Test wchar.h for mbstate_t, which is needed for char_traits and
355   # others even if wchar_t support is not on.
356   AC_MSG_CHECKING([for mbstate_t])
357   AC_TRY_COMPILE([#include <wchar.h>],
358   [mbstate_t teststate;],
359   have_mbstate_t=yes, have_mbstate_t=no)
360   AC_MSG_RESULT($have_mbstate_t)
361   if test x"$have_mbstate_t" = xyes; then
362     AC_DEFINE(HAVE_MBSTATE_T)
363   fi
364
365   # Sanity check for existence of ISO C99 headers for extended encoding.
366   AC_CHECK_HEADERS(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no)
367   AC_CHECK_HEADERS(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no)
368
369   # Only continue checking if the ISO C99 headers exist and support is on.
370   if test x"$ac_has_wchar_h" = xyes &&
371      test x"$ac_has_wctype_h" = xyes &&
372      test x"$enable_c_mbchar" != xno; then
373
374     # Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
375     # numeric_limits can instantiate type_traits<wchar_t>
376     AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
377     AC_TRY_COMPILE([#include <wchar.h>],
378     [int i = WCHAR_MIN; int j = WCHAR_MAX;],
379     has_wchar_minmax=yes, has_wchar_minmax=no)
380     AC_MSG_RESULT($has_wchar_minmax)
381
382     # Test wchar.h for WEOF, which is what we use to determine whether
383     # to specialize for char_traits<wchar_t> or not.
384     AC_MSG_CHECKING([for WEOF])
385     AC_TRY_COMPILE([
386       #include <wchar.h>
387       #include <stddef.h>],
388     [wint_t i = WEOF;],
389     has_weof=yes, has_weof=no)
390     AC_MSG_RESULT($has_weof)
391
392     # Tests for wide character functions used in char_traits<wchar_t>.
393     ac_wfuncs=yes
394     AC_CHECK_FUNCS([wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset],
395     [],[ac_wfuncs=no])
396
397     # Checks for names injected into std:: by the c_std headers.
398     AC_CHECK_FUNCS([btowc wctob fgetwc fgetws fputwc fputws fwide \
399     fwprintf fwscanf swprintf swscanf vfwprintf vfwscanf vswprintf vswscanf \
400     vwprintf vwscanf wprintf wscanf getwc getwchar mbsinit mbrlen mbrtowc \
401     mbsrtowcs wcsrtombs putwc putwchar ungetwc wcrtomb wcstod wcstof wcstol \
402     wcstoul wcscpy wcsncpy wcscat wcsncat wcscmp wcscoll wcsncmp wcsxfrm \
403     wcscspn wcsspn wcstok wcsftime wcschr wcspbrk wcsrchr wcsstr],
404     [],[ac_wfuncs=no])
405
406     AC_MSG_CHECKING([for ISO C99 wchar_t support])
407     if test x"$has_weof" = xyes &&
408        test x"$has_wchar_minmax" = xyes &&
409        test x"$ac_wfuncs" = xyes;
410     then
411       ac_isoC99_wchar_t=yes
412     else
413       ac_isoC99_wchar_t=no
414     fi
415     AC_MSG_RESULT($ac_isoC99_wchar_t)
416
417     # Use iconv for wchar_t to char conversions. As such, check for
418     # X/Open Portability Guide, version 2 features (XPG2).
419     AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no)
420     AC_CHECK_HEADER(langinfo.h, ac_has_langinfo_h=yes, ac_has_langinfo_h=no)
421
422     # Check for existence of libiconv.a providing XPG2 wchar_t support.
423     AC_CHECK_LIB(iconv, iconv, libiconv="-liconv")
424     ac_save_LIBS="$LIBS"
425     LIBS="$LIBS $libiconv"
426
427     AC_CHECK_FUNCS([iconv_open iconv_close iconv nl_langinfo],
428     [ac_XPG2funcs=yes], [ac_XPG2funcs=no])
429
430     LIBS="$ac_save_LIBS"
431
432     AC_MSG_CHECKING([for XPG2 wchar_t support])
433     if test x"$ac_has_iconv_h" = xyes &&
434        test x"$ac_has_langinfo_h" = xyes &&
435        test x"$ac_XPG2funcs" = xyes;
436     then
437       ac_XPG2_wchar_t=yes
438     else
439       ac_XPG2_wchar_t=no
440     fi
441     AC_MSG_RESULT($ac_XPG2_wchar_t)
442
443     # At the moment, only enable wchar_t specializations if all the
444     # above support is present.
445     if test x"$ac_isoC99_wchar_t" = xyes &&
446        test x"$ac_XPG2_wchar_t" = xyes;
447     then
448       AC_DEFINE(_GLIBCXX_USE_WCHAR_T)
449       enable_wchar_t=yes
450     fi
451   fi
452   AC_MSG_CHECKING([for enabled wchar_t specializations])
453   AC_MSG_RESULT($enable_wchar_t)
454 ])
455
456
457 dnl
458 dnl Check for headers for, and arguments to, the setrlimit() function.
459 dnl Used only in testsuite_hooks.h.  Called from GLIBCXX_CONFIGURE_TESTSUITE.
460 dnl
461 dnl Defines:
462 dnl  _GLIBCXX_MEM_LIMITS if we can set artificial limits on memory
463 dnl  various HAVE_MEMLIMIT_* for individual limit names
464 dnl
465 AC_DEFUN(GLIBCXX_CHECK_SETRLIMIT_ancilliary, [
466   AC_TRY_COMPILE(
467     [#include <unistd.h>
468      #include <sys/time.h>
469      #include <sys/resource.h>
470     ],
471     [ int f = RLIMIT_$1 ; ],
472     [glibcxx_mresult=1], [glibcxx_mresult=0])
473   AC_DEFINE_UNQUOTED(HAVE_MEMLIMIT_$1, $glibcxx_mresult,
474                      [Only used in build directory testsuite_hooks.h.])
475 ])
476
477 AC_DEFUN(GLIBCXX_CHECK_SETRLIMIT, [
478   setrlimit_have_headers=yes
479   AC_CHECK_HEADERS(unistd.h sys/time.h sys/resource.h,
480                    [],
481                    [setrlimit_have_headers=no])
482   # If don't have the headers, then we can't run the tests now, and we
483   # won't be seeing any of these during testsuite compilation.
484   if test $setrlimit_have_headers = yes; then
485     # Can't do these in a loop, else the resulting syntax is wrong.
486     GLIBCXX_CHECK_SETRLIMIT_ancilliary(DATA)
487     GLIBCXX_CHECK_SETRLIMIT_ancilliary(RSS)
488     GLIBCXX_CHECK_SETRLIMIT_ancilliary(VMEM)
489     GLIBCXX_CHECK_SETRLIMIT_ancilliary(AS)
490
491     # Check for rlimit, setrlimit.
492     AC_CACHE_VAL(ac_setrlimit, [
493       AC_TRY_COMPILE(
494         [#include <unistd.h>
495          #include <sys/time.h>
496          #include <sys/resource.h>
497         ],
498         [struct rlimit r;
499          setrlimit(0, &r);],
500         [ac_setrlimit=yes], [ac_setrlimit=no])
501     ])
502   fi
503
504   AC_MSG_CHECKING([for testsuite memory limit support])
505   if test $setrlimit_have_headers = yes && test $ac_setrlimit = yes; then
506     ac_mem_limits=yes
507     AC_DEFINE(_GLIBCXX_MEM_LIMITS)
508   else
509     ac_mem_limits=no
510   fi
511   AC_MSG_RESULT($ac_mem_limits)
512 ])
513
514
515 dnl
516 dnl Check whether S_ISREG (Posix) or S_IFREG is available in <sys/stat.h>.
517 dnl Define HAVE_S_ISREG / HAVE_S_IFREG appropriately.
518 dnl
519 AC_DEFUN(GLIBCXX_CHECK_S_ISREG_OR_S_IFREG, [
520   AC_CACHE_VAL(glibcxx_cv_S_ISREG, [
521     AC_TRY_LINK(
522       [#include <sys/stat.h>],
523       [struct stat buffer;
524        fstat(0, &buffer);
525        S_ISREG(buffer.st_mode);],
526       [glibcxx_cv_S_ISREG=yes],
527       [glibcxx_cv_S_ISREG=no])
528   ])
529   AC_CACHE_VAL(glibcxx_cv_S_IFREG, [
530     AC_TRY_LINK(
531       [#include <sys/stat.h>],
532       [struct stat buffer;
533        fstat(0, &buffer);
534        S_IFREG & buffer.st_mode;],
535       [glibcxx_cv_S_IFREG=yes],
536       [glibcxx_cv_S_IFREG=no])
537   ])
538   if test $glibcxx_cv_S_ISREG = yes; then
539     AC_DEFINE(HAVE_S_ISREG)
540   elif test $glibcxx_cv_S_IFREG = yes; then
541     AC_DEFINE(HAVE_S_IFREG)
542   fi
543 ])
544
545
546 dnl
547 dnl Check whether poll is available in <poll.h>, and define HAVE_POLL.
548 dnl
549 AC_DEFUN(GLIBCXX_CHECK_POLL, [
550   AC_CACHE_VAL(glibcxx_cv_POLL, [
551     AC_TRY_COMPILE(
552       [#include <poll.h>],
553       [struct pollfd pfd[1];
554        pfd[0].events = POLLIN;
555        poll(pfd, 1, 0);],
556       [glibcxx_cv_POLL=yes],
557       [glibcxx_cv_POLL=no])
558   ])
559   if test $glibcxx_cv_POLL = yes; then
560     AC_DEFINE(HAVE_POLL)
561   fi
562 ])
563
564
565 dnl
566 dnl Check whether writev is available in <sys/uio.h>, and define HAVE_WRITEV.
567 dnl
568 AC_DEFUN(GLIBCXX_CHECK_WRITEV, [
569   AC_CACHE_VAL(glibcxx_cv_WRITEV, [
570     AC_TRY_COMPILE(
571       [#include <sys/uio.h>],
572       [struct iovec iov[2];
573        writev(0, iov, 0);],
574       [glibcxx_cv_WRITEV=yes],
575       [glibcxx_cv_WRITEV=no])
576   ])
577   if test $glibcxx_cv_WRITEV = yes; then
578     AC_DEFINE(HAVE_WRITEV)
579   fi
580 ])
581
582
583 dnl
584 dnl Does any necessary configuration of the testsuite directory.  Generates
585 dnl the testsuite_hooks.h header.
586 dnl
587 dnl GLIBCXX_ENABLE_SYMVERS and GLIBCXX_IS_NATIVE must be done before this.
588 dnl
589 dnl Sets:
590 dnl  enable_abi_check / GLIBCXX_TEST_ABI
591 dnl Substs:
592 dnl  baseline_dir
593 dnl
594 AC_DEFUN(GLIBCXX_CONFIGURE_TESTSUITE, [
595   if $GLIBCXX_IS_NATIVE && test $is_hosted = yes; then
596     # Do checks for memory limit functions.
597     GLIBCXX_CHECK_SETRLIMIT
598
599     # Look for setenv, so that extended locale tests can be performed.
600     GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_3(setenv)
601   fi
602
603   # Export file names for ABI checking.
604   baseline_dir="$glibcxx_srcdir/config/abi/${abi_baseline_pair}\$(MULTISUBDIR)"
605   AC_SUBST(baseline_dir)
606
607   # Determine if checking the ABI is desirable.
608   if test $enable_symvers = no || test $is_hosted = no; then
609     enable_abi_check=no
610   else
611     case "$host" in
612       *-*-cygwin*)
613         enable_abi_check=no ;;
614       *)
615         enable_abi_check=yes ;;
616     esac
617   fi
618
619   GLIBCXX_CONDITIONAL(GLIBCXX_TEST_WCHAR_T, test $enable_wchar_t = yes)
620   GLIBCXX_CONDITIONAL(GLIBCXX_TEST_ABI, test $enable_abi_check = yes)
621 ])
622
623
624 dnl
625 dnl Set up *_INCLUDES variables for all sundry Makefile.am's.
626 dnl
627 dnl Substs:
628 dnl  GLIBCXX_INCLUDES
629 dnl  TOPLEVEL_INCLUDES
630 dnl
631 AC_DEFUN(GLIBCXX_EXPORT_INCLUDES, [
632   # Used for every C++ compile we perform.
633   GLIBCXX_INCLUDES="\
634 -I$glibcxx_builddir/include/$host_alias \
635 -I$glibcxx_builddir/include \
636 -I$glibcxx_srcdir/libsupc++"
637
638   # For Canadian crosses, pick this up too.
639   if test $CANADIAN = yes; then
640     GLIBCXX_INCLUDES="$GLIBCXX_INCLUDES -I\${includedir}"
641   fi
642
643   # Stuff in the actual top level.  Currently only used by libsupc++ to
644   # get unwind* headers from the gcc dir.
645   #TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc -I$(toplevel_srcdir)/include'
646   TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc'
647
648   # Now, export this to all the little Makefiles....
649   AC_SUBST(GLIBCXX_INCLUDES)
650   AC_SUBST(TOPLEVEL_INCLUDES)
651 ])
652
653
654 dnl
655 dnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's.
656 dnl (SECTION_FLAGS is done under CHECK_COMPILER_FEATURES.)
657 dnl
658 dnl Substs:
659 dnl  OPTIMIZE_CXXFLAGS
660 dnl  WARN_FLAGS
661 dnl
662 AC_DEFUN(GLIBCXX_EXPORT_FLAGS, [
663   # Optimization flags that are probably a good idea for thrill-seekers. Just
664   # uncomment the lines below and make, everything else is ready to go...
665   # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
666   OPTIMIZE_CXXFLAGS=
667   AC_SUBST(OPTIMIZE_CXXFLAGS)
668
669   WARN_FLAGS='-Wall -Wno-format -W -Wwrite-strings'
670   AC_SUBST(WARN_FLAGS)
671 ])
672
673
674 dnl
675 dnl All installation directory information is determined here.
676 dnl
677 dnl Substs:
678 dnl  gxx_install_dir
679 dnl  glibcxx_prefixdir
680 dnl  glibcxx_toolexecdir
681 dnl  glibcxx_toolexeclibdir
682 dnl
683 dnl Assumes cross_compiling bits already done, and with_cross_host in
684 dnl particular.
685 dnl
686 AC_DEFUN(GLIBCXX_EXPORT_INSTALL_INFO, [
687   glibcxx_toolexecdir=no
688   glibcxx_toolexeclibdir=no
689   glibcxx_prefixdir=$prefix
690
691   AC_MSG_CHECKING([for gxx-include-dir])
692   AC_ARG_WITH([gxx-include-dir],
693     AC_HELP_STRING([--with-gxx-include-dir=DIR],
694                    [installation directory for include files]),
695     [case "$withval" in
696       yes) AC_MSG_ERROR([Missing directory for --with-gxx-include-dir]) ;;
697       no)  gxx_include_dir=no ;;
698       *)   gxx_include_dir=$withval ;;
699      esac],
700     [gxx_include_dir=no])
701   AC_MSG_RESULT($gxx_include_dir)
702
703   AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
704   AC_ARG_ENABLE([version-specific-runtime-libs],
705     AC_HELP_STRING([--enable-version-specific-runtime-libs],
706                    [Specify that runtime libraries should be installed in a compiler-specific directory]),
707     [case "$enableval" in
708       yes) version_specific_libs=yes ;;
709       no)  version_specific_libs=no ;;
710       *)   AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
711      esac],
712     [version_specific_libs=no])
713   AC_MSG_RESULT($version_specific_libs)
714
715   # Default case for install directory for include files.
716   if test $version_specific_libs = no && test $gxx_include_dir = no; then
717     gxx_include_dir='${prefix}'/include/c++/${gcc_version}
718   fi
719
720   # Version-specific runtime libs processing.
721   if test $version_specific_libs = yes; then
722     # Need the gcc compiler version to know where to install libraries
723     # and header files if --enable-version-specific-runtime-libs option
724     # is selected.
725     if test x"$gxx_include_dir" = x"no"; then
726       gxx_include_dir='${libdir}/gcc-lib/${host_alias}/'$gcc_version/include/c++
727     fi
728     glibcxx_toolexecdir='${libdir}/gcc-lib/${host_alias}'
729     glibcxx_toolexeclibdir='${toolexecdir}/'$gcc_version'$(MULTISUBDIR)'
730   fi
731
732   # Calculate glibcxx_toolexecdir, glibcxx_toolexeclibdir
733   # Install a library built with a cross compiler in tooldir, not libdir.
734   if test x"$glibcxx_toolexecdir" = x"no"; then
735     if test -n "$with_cross_host" &&
736        test x"$with_cross_host" != x"no"; then
737       glibcxx_toolexecdir='${exec_prefix}/${host_alias}'
738       glibcxx_toolexeclibdir='${toolexecdir}/lib'
739     else
740       glibcxx_toolexecdir='${libdir}/gcc-lib/${host_alias}'
741       glibcxx_toolexeclibdir='${libdir}'
742     fi
743     multi_os_directory=`$CXX -print-multi-os-directory`
744     case $multi_os_directory in
745       .) ;; # Avoid trailing /.
746       *) glibcxx_toolexeclibdir=$glibcxx_toolexeclibdir/$multi_os_directory ;;
747     esac
748   fi
749
750   AC_MSG_CHECKING([for install location])
751   AC_MSG_RESULT($gxx_include_dir)
752
753   AC_SUBST(glibcxx_prefixdir)
754   AC_SUBST(gxx_include_dir)
755   AC_SUBST(glibcxx_toolexecdir)
756   AC_SUBST(glibcxx_toolexeclibdir)
757 ])
758
759
760 dnl
761 dnl GLIBCXX_ENABLE
762 dnl    (FEATURE, DEFAULT, HELP-ARG, HELP-STRING)
763 dnl    (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, permit a|b|c)
764 dnl    (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, SHELL-CODE-HANDLER)
765 dnl
766 dnl See docs/html/17_intro/configury.html#enable for documentation.
767 dnl
768 m4_define([GLIBCXX_ENABLE],[dnl
769 m4_define([_g_switch],[--enable-$1])dnl
770 m4_define([_g_help],[AC_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl
771  AC_ARG_ENABLE($1,_g_help,
772   m4_bmatch([$5],
773    [^permit ],
774      [[
775       case "$enableval" in
776        m4_bpatsubst([$5],[permit ])) ;;
777        *) AC_MSG_ERROR(Unknown argument to enable/disable $1) ;;
778           dnl Idea for future:  generate a URL pointing to
779           dnl "onlinedocs/configopts.html#whatever"
780       esac
781      ]],
782    [^$],
783      [[
784       case "$enableval" in
785        yes|no) ;;
786        *) AC_MSG_ERROR(Argument to enable/disable $1 must be yes or no) ;;
787       esac
788      ]],
789    [[$5]]),
790   [enable_]m4_bpatsubst([$1],-,_)[=][$2])
791 m4_undefine([_g_switch])dnl
792 m4_undefine([_g_help])dnl
793 ])
794
795
796 dnl
797 dnl Check for ISO/IEC 9899:1999 "C99" support.
798 dnl
799 dnl --enable-c99 defines _GLIBCXX_USE_C99
800 dnl --disable-c99 leaves _GLIBCXX_USE_C99 undefined
801 dnl  +  Usage:  GLIBCXX_ENABLE_C99[(DEFAULT)]
802 dnl       Where DEFAULT is either `yes' or `no'.
803 dnl  +  If 'C99' stuff is not available, ignores DEFAULT and sets `no'.
804 dnl
805 AC_DEFUN(GLIBCXX_ENABLE_C99, [
806   GLIBCXX_ENABLE(c99,$1,,[turns on ISO/IEC 9899:1999 support])
807
808   AC_LANG_SAVE
809   AC_LANG_CPLUSPLUS
810
811   # Check for the existence of <math.h> functions used if C99 is enabled.
812   ac_c99_math=yes;
813   AC_MSG_CHECKING([for ISO C99 support in <math.h>])
814   AC_TRY_COMPILE([#include <math.h>],[fpclassify(0.0);],, [ac_c99_math=no])
815   AC_TRY_COMPILE([#include <math.h>],[isfinite(0.0);],, [ac_c99_math=no])
816   AC_TRY_COMPILE([#include <math.h>],[isinf(0.0);],, [ac_c99_math=no])
817   AC_TRY_COMPILE([#include <math.h>],[isnan(0.0);],, [ac_c99_math=no])
818   AC_TRY_COMPILE([#include <math.h>],[isnormal(0.0);],, [ac_c99_math=no])
819   AC_TRY_COMPILE([#include <math.h>],[signbit(0.0);],, [ac_c99_math=no])
820   AC_TRY_COMPILE([#include <math.h>],[isgreater(0.0,0.0);],, [ac_c99_math=no])
821   AC_TRY_COMPILE([#include <math.h>],
822                  [isgreaterequal(0.0,0.0);],, [ac_c99_math=no])
823   AC_TRY_COMPILE([#include <math.h>],[isless(0.0,0.0);],, [ac_c99_math=no])
824   AC_TRY_COMPILE([#include <math.h>],[islessequal(0.0,0.0);],,[ac_c99_math=no])
825   AC_TRY_COMPILE([#include <math.h>],
826                  [islessgreater(0.0,0.0);],, [ac_c99_math=no])
827   AC_TRY_COMPILE([#include <math.h>],
828                  [isunordered(0.0,0.0);],, [ac_c99_math=no])
829   AC_MSG_RESULT($ac_c99_math)
830
831   # Check for the existence in <stdio.h> of vscanf, et. al.
832   ac_c99_stdio=yes;
833   AC_MSG_CHECKING([for ISO C99 support in <stdio.h>])
834   AC_TRY_COMPILE([#include <stdio.h>],
835                  [snprintf("12", 0, "%i");],, [ac_c99_stdio=no])
836   AC_TRY_COMPILE([#include <stdio.h>
837                   #include <stdarg.h>
838                   void foo(char* fmt, ...)
839                   {va_list args; va_start(args, fmt);
840                   vfscanf(stderr, "%i", args);}],
841                   [],, [ac_c99_stdio=no])
842   AC_TRY_COMPILE([#include <stdio.h>
843                   #include <stdarg.h>
844                   void foo(char* fmt, ...)
845                   {va_list args; va_start(args, fmt);
846                   vscanf("%i", args);}],
847                   [],, [ac_c99_stdio=no])
848   AC_TRY_COMPILE([#include <stdio.h>
849                   #include <stdarg.h>
850                   void foo(char* fmt, ...)
851                   {va_list args; va_start(args, fmt);
852                   vsnprintf(fmt, 0, "%i", args);}],
853                   [],, [ac_c99_stdio=no])
854   AC_TRY_COMPILE([#include <stdio.h>
855                   #include <stdarg.h>
856                   void foo(char* fmt, ...)
857                   {va_list args; va_start(args, fmt);
858                   vsscanf(fmt, "%i", args);}],
859                   [],, [ac_c99_stdio=no])
860   AC_MSG_RESULT($ac_c99_stdio)
861
862   # Check for the existence in <stdlib.h> of lldiv_t, et. al.
863   ac_c99_stdlib=yes;
864   AC_MSG_CHECKING([for lldiv_t declaration])
865   AC_CACHE_VAL(ac_c99_lldiv_t, [
866   AC_TRY_COMPILE([#include <stdlib.h>],
867                    [ lldiv_t mydivt;],
868                    [ac_c99_lldiv_t=yes], [ac_c99_lldiv_t=no])
869   ])
870   AC_MSG_RESULT($ac_c99_lldiv_t)
871
872   AC_MSG_CHECKING([for ISO C99 support in <stdlib.h>])
873   AC_TRY_COMPILE([#include <stdlib.h>],
874                  [char* tmp; strtof("gnu", &tmp);],, [ac_c99_stdlib=no])
875   AC_TRY_COMPILE([#include <stdlib.h>],
876                  [char* tmp; strtold("gnu", &tmp);],, [ac_c99_stdlib=no])
877   AC_TRY_COMPILE([#include <stdlib.h>], [llabs(10);],, [ac_c99_stdlib=no])
878   AC_TRY_COMPILE([#include <stdlib.h>], [lldiv(10,1);],, [ac_c99_stdlib=no])
879   AC_TRY_COMPILE([#include <stdlib.h>], [atoll("10");],, [ac_c99_stdlib=no])
880   AC_TRY_COMPILE([#include <stdlib.h>], [_Exit(0);],, [ac_c99_stdlib=no])
881   if test x"$ac_c99_lldiv_t" = x"no"; then
882     ac_c99_stdlib=no;
883   fi;
884   AC_MSG_RESULT($ac_c99_stdlib)
885
886   # Check for the existence of <wchar.h> functions used if C99 is enabled.
887   # XXX the wchar.h checks should be rolled into the general C99 bits.
888   ac_c99_wchar=yes;
889   AC_MSG_CHECKING([for additional ISO C99 support in <wchar.h>])
890   AC_TRY_COMPILE([#include <wchar.h>],
891                  [wcstold(L"10.0", NULL);],, [ac_c99_wchar=no])
892   AC_TRY_COMPILE([#include <wchar.h>],
893                  [wcstoll(L"10", NULL, 10);],, [ac_c99_wchar=no])
894   AC_TRY_COMPILE([#include <wchar.h>],
895                  [wcstoull(L"10", NULL, 10);],, [ac_c99_wchar=no])
896   AC_MSG_RESULT($ac_c99_wchar)
897
898   AC_MSG_CHECKING([for enabled ISO C99 support])
899   if test x"$ac_c99_math" = x"no" ||
900      test x"$ac_c99_stdio" = x"no" ||
901      test x"$ac_c99_stdlib" = x"no" ||
902      test x"$ac_c99_wchar" = x"no"; then
903     enable_c99=no;
904   fi;
905   AC_MSG_RESULT($enable_c99)
906
907   # Option parsed, now set things appropriately
908   if test x"$enable_c99" = x"yes"; then
909     AC_DEFINE(_GLIBCXX_USE_C99)
910   fi
911
912   AC_LANG_RESTORE
913 ])
914
915
916 dnl
917 dnl Check for what type of C headers to use.
918 dnl
919 dnl --enable-cheaders= [does stuff].
920 dnl --disable-cheaders [does not do anything, really].
921 dnl  +  Usage:  GLIBCXX_ENABLE_CHEADERS[(DEFAULT)]
922 dnl       Where DEFAULT is either `c' or `c_std'.
923 dnl
924 AC_DEFUN(GLIBCXX_ENABLE_CHEADERS, [
925   GLIBCXX_ENABLE(cheaders,$1,[=KIND],
926     [construct "C" headers for g++], [permit c|c_std])
927   AC_MSG_NOTICE("C" header strategy set to $enable_cheaders)
928
929   C_INCLUDE_DIR='${glibcxx_srcdir}/include/'$enable_cheaders
930
931   AC_SUBST(C_INCLUDE_DIR)
932   GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C, test $enable_cheaders = c)
933   GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C_STD, test $enable_cheaders = c_std)
934   GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_COMPATIBILITY, test $c_compatibility = yes)
935 ])
936
937
938 dnl
939 dnl Check for which locale library to use.  The choice is mapped to
940 dnl a subdirectory of config/locale.
941 dnl
942 dnl Default is generic.
943 dnl
944 AC_DEFUN(GLIBCXX_ENABLE_CLOCALE, [
945   AC_MSG_CHECKING([for C locale to use])
946   GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@],
947     [use MODEL for target locale package],
948     [permit generic|gnu|ieee_1003.1-2001|yes|no|auto])
949   
950   # If they didn't use this option switch, or if they specified --enable
951   # with no specific model, we'll have to look for one.  If they
952   # specified --disable (???), do likewise.
953   if test $enable_clocale = no || test $enable_clocale = yes; then
954      enable_clocale=auto
955   fi
956
957   # Either a known package, or "auto"
958   enable_clocale_flag=$enable_clocale
959
960   # Probe for locale support if no specific model is specified.
961   # Default to "generic".
962   if test $enable_clocale_flag = auto; then
963     case x${target_os} in
964       xlinux* | xgnu*)
965         AC_EGREP_CPP([_GLIBCXX_ok], [
966         #include <features.h>
967         #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
968           _GLIBCXX_ok
969         #endif
970         ], enable_clocale_flag=gnu, enable_clocale_flag=generic)
971
972         # Test for bugs early in glibc-2.2.x series
973           if test x$enable_clocale_flag = xgnu; then
974           AC_TRY_RUN([
975           #define _GNU_SOURCE 1
976           #include <locale.h>
977           #include <string.h>
978           #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
979           extern __typeof(newlocale) __newlocale;
980           extern __typeof(duplocale) __duplocale;
981           extern __typeof(strcoll_l) __strcoll_l;
982           #endif
983           int main()
984           {
985               const char __one[] = "Äuglein Augmen";
986               const char __two[] = "Äuglein";
987               int i;
988               int j;
989               __locale_t        loc;
990                __locale_t        loc_dup;
991               loc = __newlocale(1 << LC_ALL, "de_DE", 0);
992               loc_dup = __duplocale(loc);
993               i = __strcoll_l(__one, __two, loc);
994               j = __strcoll_l(__one, __two, loc_dup);
995               return 0;
996           }
997           ],
998           [enable_clocale_flag=gnu],[enable_clocale_flag=generic],
999           [enable_clocale_flag=generic])
1000           fi
1001
1002         # ... at some point put __strxfrm_l tests in as well.
1003         ;;
1004       *)
1005         enable_clocale_flag=generic
1006         ;;
1007     esac
1008   fi
1009
1010   # Deal with gettext issues.  Default to not using it (=no) until we detect
1011   # support for it later.  Let the user turn it off via --e/d, but let that
1012   # default to on for easier handling.
1013   USE_NLS=no
1014   AC_ARG_ENABLE(nls,
1015     AC_HELP_STRING([--enable-nls],[use Native Language Support (default)]),
1016     [],
1017     [enable_nls=yes])
1018
1019   # Set configure bits for specified locale package
1020   case ${enable_clocale_flag} in
1021     generic)
1022       AC_MSG_RESULT(generic)
1023
1024       CLOCALE_H=config/locale/generic/c_locale.h
1025       CLOCALE_CC=config/locale/generic/c_locale.cc
1026       CCODECVT_H=config/locale/generic/codecvt_specializations.h
1027       CCODECVT_CC=config/locale/generic/codecvt_members.cc
1028       CCOLLATE_CC=config/locale/generic/collate_members.cc
1029       CCTYPE_CC=config/locale/generic/ctype_members.cc
1030       CMESSAGES_H=config/locale/generic/messages_members.h
1031       CMESSAGES_CC=config/locale/generic/messages_members.cc
1032       CMONEY_CC=config/locale/generic/monetary_members.cc
1033       CNUMERIC_CC=config/locale/generic/numeric_members.cc
1034       CTIME_H=config/locale/generic/time_members.h
1035       CTIME_CC=config/locale/generic/time_members.cc
1036       CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
1037       ;;
1038     gnu)
1039       AC_MSG_RESULT(gnu)
1040
1041       # Declare intention to use gettext, and add support for specific
1042       # languages.
1043       # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
1044       ALL_LINGUAS="de fr"
1045
1046       # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
1047       AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
1048       if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
1049         USE_NLS=yes
1050       fi
1051       # Export the build objects.
1052       for ling in $ALL_LINGUAS; do \
1053         glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
1054         glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
1055       done
1056       AC_SUBST(glibcxx_MOFILES)
1057       AC_SUBST(glibcxx_POFILES)
1058
1059       CLOCALE_H=config/locale/gnu/c_locale.h
1060       CLOCALE_CC=config/locale/gnu/c_locale.cc
1061       CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h
1062       CCODECVT_CC=config/locale/gnu/codecvt_members.cc
1063       CCOLLATE_CC=config/locale/gnu/collate_members.cc
1064       CCTYPE_CC=config/locale/gnu/ctype_members.cc
1065       CMESSAGES_H=config/locale/gnu/messages_members.h
1066       CMESSAGES_CC=config/locale/gnu/messages_members.cc
1067       CMONEY_CC=config/locale/gnu/monetary_members.cc
1068       CNUMERIC_CC=config/locale/gnu/numeric_members.cc
1069       CTIME_H=config/locale/gnu/time_members.h
1070       CTIME_CC=config/locale/gnu/time_members.cc
1071       CLOCALE_INTERNAL_H=config/locale/gnu/c++locale_internal.h
1072       ;;
1073     ieee_1003.1-2001)
1074       AC_MSG_RESULT(IEEE 1003.1)
1075
1076       CLOCALE_H=config/locale/ieee_1003.1-2001/c_locale.h
1077       CLOCALE_CC=config/locale/ieee_1003.1-2001/c_locale.cc
1078       CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h
1079       CCODECVT_CC=config/locale/generic/codecvt_members.cc
1080       CCOLLATE_CC=config/locale/generic/collate_members.cc
1081       CCTYPE_CC=config/locale/generic/ctype_members.cc
1082       CMESSAGES_H=config/locale/ieee_1003.1-2001/messages_members.h
1083       CMESSAGES_CC=config/locale/ieee_1003.1-2001/messages_members.cc
1084       CMONEY_CC=config/locale/generic/monetary_members.cc
1085       CNUMERIC_CC=config/locale/generic/numeric_members.cc
1086       CTIME_H=config/locale/generic/time_members.h
1087       CTIME_CC=config/locale/generic/time_members.cc
1088       CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
1089       ;;
1090   esac
1091
1092   # This is where the testsuite looks for locale catalogs, using the
1093   # -DLOCALEDIR define during testsuite compilation.
1094   glibcxx_localedir=${glibcxx_builddir}/po/share/locale
1095   AC_SUBST(glibcxx_localedir)
1096
1097   # A standalone libintl (e.g., GNU libintl) may be in use.
1098   if test $USE_NLS = yes; then
1099     AC_CHECK_HEADERS([libintl.h], [], USE_NLS=no)
1100     AC_SEARCH_LIBS(gettext, intl, [], USE_NLS=no)
1101   fi
1102   if test $USE_NLS = yes; then
1103     AC_DEFINE(_GLIBCXX_USE_NLS)
1104   fi
1105
1106   AC_SUBST(USE_NLS)
1107   AC_SUBST(CLOCALE_H)
1108   AC_SUBST(CCODECVT_H)
1109   AC_SUBST(CMESSAGES_H)
1110   AC_SUBST(CCODECVT_CC)
1111   AC_SUBST(CCOLLATE_CC)
1112   AC_SUBST(CCTYPE_CC)
1113   AC_SUBST(CMESSAGES_CC)
1114   AC_SUBST(CMONEY_CC)
1115   AC_SUBST(CNUMERIC_CC)
1116   AC_SUBST(CTIME_H)
1117   AC_SUBST(CTIME_CC)
1118   AC_SUBST(CLOCALE_CC)
1119   AC_SUBST(CLOCALE_INTERNAL_H)
1120 ])
1121
1122
1123 dnl
1124 dnl Check for whether the Boost-derived checks should be turned on.
1125 dnl
1126 dnl --enable-concept-checks turns them on.
1127 dnl --disable-concept-checks leaves them off.
1128 dnl  +  Usage:  GLIBCXX_ENABLE_CONCEPT_CHECKS[(DEFAULT)]
1129 dnl       Where DEFAULT is either `yes' or `no'.
1130 dnl
1131 AC_DEFUN(GLIBCXX_ENABLE_CONCEPT_CHECKS, [
1132   GLIBCXX_ENABLE(concept-checks,$1,,[use Boost-derived template checks])
1133   if test $enable_concept_checks = yes; then
1134     AC_DEFINE(_GLIBCXX_CONCEPT_CHECKS)
1135   fi
1136 ])
1137
1138
1139 dnl
1140 dnl Check for which I/O library to use:  stdio, or something specific.
1141 dnl
1142 dnl Default is stdio.
1143 dnl
1144 AC_DEFUN(GLIBCXX_ENABLE_CSTDIO, [
1145   AC_MSG_CHECKING([for underlying I/O to use])
1146   GLIBCXX_ENABLE(cstdio,stdio,[=PACKAGE],
1147     [use target-specific I/O package], [permit stdio])
1148
1149   # Now that libio has been removed, you can have any color you want as long
1150   # as it's black.  This is one big no-op until other packages are added, but
1151   # showing the framework never hurts.
1152   case ${enable_cstdio} in
1153     stdio)
1154       CSTDIO_H=config/io/c_io_stdio.h
1155       BASIC_FILE_H=config/io/basic_file_stdio.h
1156       BASIC_FILE_CC=config/io/basic_file_stdio.cc
1157       AC_MSG_RESULT(stdio)
1158       ;;
1159   esac
1160
1161   dnl Set directory for fpos.h
1162   FPOS_H=$fpos_include_dir
1163
1164   AC_SUBST(CSTDIO_H)
1165   AC_SUBST(FPOS_H)
1166   AC_SUBST(BASIC_FILE_H)
1167   AC_SUBST(BASIC_FILE_CC)
1168 ])
1169
1170
1171 dnl
1172 dnl Check for "unusual" flags to pass to the compiler while building.
1173 dnl
1174 dnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing
1175 dnl     experimental flags such as -fpch, -fIMI, -Dfloat=char, etc.
1176 dnl --disable-cxx-flags passes nothing.
1177 dnl  +  See http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00131.html
1178 dnl         http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00284.html
1179 dnl         http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00035.html
1180 dnl  +  Usage:  GLIBCXX_ENABLE_CXX_FLAGS(default flags)
1181 dnl       If "default flags" is an empty string, the effect is the same
1182 dnl       as --disable or --enable=no.
1183 dnl
1184 AC_DEFUN(GLIBCXX_ENABLE_CXX_FLAGS, [dnl
1185   AC_MSG_CHECKING([for extra compiler flags for building])
1186   GLIBCXX_ENABLE(cxx-flags,$1,[=FLAGS],
1187     [pass compiler FLAGS when building library],
1188     [case "x$enable_cxx_flags" in
1189       xno | x)   enable_cxx_flags= ;;
1190       x-*)       ;;
1191       *)         AC_MSG_ERROR(_g_switch needs compiler flags as arguments) ;;
1192      esac])
1193
1194   # Run through flags (either default or command-line) and set anything
1195   # extra (e.g., #defines) that must accompany particular g++ options.
1196   if test -n "$enable_cxx_flags"; then
1197     for f in $enable_cxx_flags; do
1198       case "$f" in
1199         -fhonor-std)  ;;
1200         -*)  ;;
1201         *)   # and we're trying to pass /what/ exactly?
1202              AC_MSG_ERROR([compiler flags start with a -]) ;;
1203       esac
1204     done
1205   fi
1206
1207   EXTRA_CXX_FLAGS="$enable_cxx_flags"
1208   AC_MSG_RESULT($EXTRA_CXX_FLAGS)
1209   AC_SUBST(EXTRA_CXX_FLAGS)
1210 ])
1211
1212
1213 dnl
1214 dnl Check for wide character support.  Has the same effect as the option
1215 dnl in gcc's configure, but in a form that autoconf can mess with.
1216 dnl
1217 dnl --enable-c-mbchar requests all the wchar_t stuff.
1218 dnl --disable-c-mbchar doesn't.
1219 dnl  +  Usage:  GLIBCXX_ENABLE_C_MBCHAR[(DEFAULT)]
1220 dnl       Where DEFAULT is either `yes' or `no'.
1221 dnl
1222 AC_DEFUN(GLIBCXX_ENABLE_C_MBCHAR, [
1223   GLIBCXX_ENABLE(c-mbchar,$1,,[enable multibyte (wide) characters])
1224   # Option parsed, now other scripts can test enable_c_mbchar for yes/no.
1225 ])
1226
1227
1228 dnl
1229 dnl Check to see if debugging libraries are to be built.
1230 dnl
1231 dnl --enable-libstdcxx-debug
1232 dnl builds a separate set of debugging libraries in addition to the
1233 dnl normal (shared, static) libstdc++ binaries.
1234 dnl
1235 dnl --disable-libstdcxx-debug
1236 dnl builds only one (non-debug) version of libstdc++.
1237 dnl
1238 dnl --enable-libstdcxx-debug-flags=FLAGS
1239 dnl iff --enable-debug == yes, then use FLAGS to build the debug library.
1240 dnl
1241 dnl  +  Usage:  GLIBCXX_ENABLE_DEBUG[(DEFAULT)]
1242 dnl       Where DEFAULT is either `yes' or `no'.
1243 dnl
1244 AC_DEFUN(GLIBCXX_ENABLE_DEBUG, [
1245   AC_MSG_CHECKING([for additional debug build])
1246   GLIBCXX_ENABLE(libstdcxx-debug,$1,,[build extra debug library])
1247   AC_MSG_RESULT($enable_libstdcxx_debug)
1248   GLIBCXX_CONDITIONAL(GLIBCXX_BUILD_DEBUG, test $enable_libstdcxx_debug = yes)
1249 ])
1250
1251
1252 dnl
1253 dnl Check for explicit debug flags.
1254 dnl
1255 dnl --enable-libstdcxx-debug-flags='-O1'
1256 dnl is a general method for passing flags to be used when
1257 dnl building debug libraries with --enable-debug.
1258 dnl
1259 dnl --disable-libstdcxx-debug-flags does nothing.
1260 dnl  +  Usage:  GLIBCXX_ENABLE_DEBUG_FLAGS(default flags)
1261 dnl       If "default flags" is an empty string, the effect is the same
1262 dnl       as --disable or --enable=no.
1263 dnl
1264 AC_DEFUN(GLIBCXX_ENABLE_DEBUG_FLAGS, [
1265   GLIBCXX_ENABLE(libstdcxx-debug-flags,[$1],[=FLAGS],
1266     [pass compiler FLAGS when building debug library],
1267     [case "x$enable_libstdcxx_debug_flags" in
1268       xno | x)    enable_libstdcxx_debug_flags= ;;
1269       x-*)        ;;
1270       *)          AC_MSG_ERROR(_g_switch needs compiler flags as arguments) ;;
1271      esac])
1272
1273   # Option parsed, now set things appropriately
1274   DEBUG_FLAGS="$enable_libstdcxx_debug_flags"
1275   AC_SUBST(DEBUG_FLAGS)
1276
1277   AC_MSG_NOTICE([Debug build flags set to $DEBUG_FLAGS])
1278 ])
1279
1280
1281 dnl
1282 dnl Check if the user only wants a freestanding library implementation.
1283 dnl
1284 dnl --disable-hosted-libstdcxx will turn off most of the library build,
1285 dnl installing only the headers required by [17.4.1.3] and the language
1286 dnl support library.  More than that will be built (to keep the Makefiles
1287 dnl conveniently clean), but not installed.
1288 dnl
1289 dnl Sets:
1290 dnl  is_hosted  (yes/no)
1291 dnl
1292 AC_DEFUN(GLIBCXX_ENABLE_HOSTED, [
1293   AC_ARG_ENABLE([hosted-libstdcxx],
1294     AC_HELP_STRING([--disable-hosted-libstdcxx],
1295                    [only build freestanding C++ runtime support]),,
1296     [enable_hosted_libstdcxx=yes])
1297   if test "$enable_hosted_libstdcxx" = no; then
1298     AC_MSG_NOTICE([Only freestanding libraries will be built])
1299     is_hosted=no
1300     enable_abi_check=no
1301     enable_libstdcxx_pch=no
1302   else
1303     is_hosted=yes
1304   fi
1305   GLIBCXX_CONDITIONAL(GLIBCXX_HOSTED, test $is_hosted = yes)
1306 ])
1307
1308
1309 dnl
1310 dnl Check for libunwind exception handling support.  If enabled, then
1311 dnl we assume that the _Unwind_* functions that make up the Unwind ABI
1312 dnl (_Unwind_RaiseException, _Unwind_Resume, etc.) are defined by
1313 dnl libunwind instead of libgcc, and that libstdc++ has a dependency
1314 dnl on libunwind as well as libgcc.
1315 dnl
1316 dnl --enable-libunwind-exceptions forces the use of libunwind.
1317 dnl --disable-libunwind-exceptions assumes there is no libunwind.
1318 dnl
1319 dnl Substs:
1320 dnl  LIBUNWIND_FLAG
1321 dnl
1322 AC_DEFUN(GLIBCXX_ENABLE_LIBUNWIND_EXCEPTIONS, [
1323   AC_MSG_CHECKING([for use of libunwind])
1324   GLIBCXX_ENABLE(libunwind-exceptions,no,,
1325     [force use of libunwind for exceptions])
1326   AC_MSG_RESULT($use_libunwind_exceptions)
1327   if test $enable_libunwind_exceptions = yes; then
1328     LIBUNWIND_FLAG="-lunwind"
1329   else
1330     LIBUNWIND_FLAG=""
1331   fi
1332   AC_SUBST(LIBUNWIND_FLAG)
1333 ])
1334
1335
1336 dnl
1337 dnl Check for template specializations for the 'long long' type extension.
1338 dnl The result determines only whether 'long long' I/O is enabled; things
1339 dnl like numeric_limits<> specializations are always available.
1340 dnl
1341 dnl --enable-long-long defines _GLIBCXX_USE_LONG_LONG
1342 dnl --disable-long-long leaves _GLIBCXX_USE_LONG_LONG undefined
1343 dnl  +  Usage:  GLIBCXX_ENABLE_LONG_LONG[(DEFAULT)]
1344 dnl       Where DEFAULT is either `yes' or `no'.
1345 dnl  +  If 'long long' stuff is not available, ignores DEFAULT and sets `no'.
1346 dnl
1347 AC_DEFUN(GLIBCXX_ENABLE_LONG_LONG, [
1348   GLIBCXX_ENABLE(long-long,$1,,[enables I/O support for 'long long'])
1349
1350   AC_LANG_SAVE
1351   AC_LANG_CPLUSPLUS
1352
1353   AC_MSG_CHECKING([for enabled long long I/O support])
1354   # iostreams require strtoll, strtoull to compile
1355   AC_TRY_COMPILE([#include <stdlib.h>],
1356                  [char* tmp; strtoll("gnu", &tmp, 10);],,[enable_long_long=no])
1357   AC_TRY_COMPILE([#include <stdlib.h>],
1358                  [char* tmp; strtoull("gnu", &tmp, 10);],,[enable_long_long=no])
1359
1360   # Option parsed, now set things appropriately
1361   if test $enable_long_long = yes; then
1362     AC_DEFINE(_GLIBCXX_USE_LONG_LONG)
1363   fi
1364   AC_MSG_RESULT($enable_long_long)
1365
1366   AC_LANG_RESTORE
1367 ])
1368
1369
1370 dnl
1371 dnl Check to see if building and using a C++ precompiled header can be done.
1372 dnl
1373 dnl --enable-libstdcxx-pch=yes
1374 dnl default, this shows intent to use stdc++.h.gch If it looks like it
1375 dnl may work, after some light-hearted attempts to puzzle out compiler
1376 dnl support, flip bits on in include/Makefile.am
1377 dnl
1378 dnl --disable-libstdcxx-pch
1379 dnl turns off attempts to use or build stdc++.h.gch.
1380 dnl
1381 dnl Substs:
1382 dnl  glibcxx_PCHFLAGS
1383 dnl
1384 AC_DEFUN(GLIBCXX_ENABLE_PCH, [
1385   AC_MSG_CHECKING([for enabled PCH])
1386   GLIBCXX_ENABLE(libstdcxx-pch,$1,,[build pre-compiled libstdc++ headers])
1387   AC_MSG_RESULT([$enable_libstdcxx_pch])
1388
1389   if test $enable_libstdcxx_pch = yes; then
1390     AC_CACHE_CHECK([for compiler with PCH support],
1391       [glibcxx_cv_prog_CXX_pch],
1392       [ac_save_CXXFLAGS="$CXXFLAGS"
1393        CXXFLAGS="$CXXFLAGS -Werror -Winvalid-pch -Wno-deprecated"
1394        AC_LANG_SAVE
1395        AC_LANG_CPLUSPLUS
1396        echo '#include <math.h>' > conftest.h
1397        if $CXX $CXXFLAGS $CPPFLAGS -x c++-header conftest.h \
1398                           -o conftest.h.gch 1>&5 2>&1 &&
1399                 echo '#error "pch failed"' > conftest.h &&
1400           echo '#include "conftest.h"' > conftest.cc &&
1401                $CXX -c $CXXFLAGS $CPPFLAGS conftest.cc 1>&5 2>&1 ;
1402        then
1403          glibcxx_cv_prog_CXX_pch=yes
1404        else
1405          glibcxx_cv_prog_CXX_pch=no
1406        fi
1407        rm -f conftest*
1408        CXXFLAGS=$ac_save_CXXFLAGS
1409        AC_LANG_RESTORE
1410       ])
1411     enable_libstdcxx_pch=$glibcxx_cv_prog_CXX_pch
1412   fi
1413
1414   GLIBCXX_CONDITIONAL(GLIBCXX_BUILD_PCH, test $enable_libstdcxx_pch = yes)
1415   if test $enable_libstdcxx_pch = yes; then
1416     glibcxx_PCHFLAGS="-include bits/stdc++.h"
1417   else
1418     glibcxx_PCHFLAGS=""
1419   fi
1420   AC_SUBST(glibcxx_PCHFLAGS)
1421 ])
1422
1423
1424 dnl
1425 dnl Check for exception handling support.  If an explicit enable/disable
1426 dnl sjlj exceptions is given, we don't have to detect.  Otherwise the
1427 dnl target may or may not support call frame exceptions.
1428 dnl
1429 dnl --enable-sjlj-exceptions forces the use of builtin setjmp.
1430 dnl --disable-sjlj-exceptions forces the use of call frame unwinding.
1431 dnl Neither one forces an attempt at detection.
1432 dnl
1433 dnl Defines:
1434 dnl  _GLIBCXX_SJLJ_EXCEPTIONS if the compiler is configured for it
1435 dnl
1436 AC_DEFUN(GLIBCXX_ENABLE_SJLJ_EXCEPTIONS, [
1437   AC_MSG_CHECKING([for exception model to use])
1438   AC_LANG_SAVE
1439   AC_LANG_CPLUSPLUS
1440   GLIBCXX_ENABLE(sjlj-exceptions,auto,,
1441     [force use of builtin_setjmp for exceptions],
1442     [permit yes|no|auto])
1443
1444   if test $enable_sjlj_exceptions = auto; then
1445     # Botheration.  Now we've got to detect the exception model.  Link tests
1446     # against libgcc.a are problematic since we've not been given proper -L
1447     # bits for single-tree newlib and libgloss.
1448     #
1449     # Fake what AC_TRY_COMPILE does.  XXX Look at redoing this new-style.
1450     cat > conftest.$ac_ext << EOF
1451 [#]line __oline__ "configure"
1452 struct S { ~S(); };
1453 void bar();
1454 void foo()
1455 {
1456   S s;
1457   bar();
1458 }
1459 EOF
1460     old_CXXFLAGS="$CXXFLAGS"
1461     CXXFLAGS=-S
1462     if AC_TRY_EVAL(ac_compile); then
1463       if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
1464         enable_sjlj_exceptions=yes
1465       elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
1466         enable_sjlj_exceptions=no
1467       fi
1468     fi
1469     CXXFLAGS="$old_CXXFLAGS"
1470     rm -f conftest*
1471   fi
1472
1473   # This is a tad weird, for hysterical raisins.  We have to map enable/disable 
1474   # to two different models.
1475   case $enable_sjlj_exceptions in
1476     yes)
1477       AC_DEFINE(_GLIBCXX_SJLJ_EXCEPTIONS, 1,
1478         [Define if the compiler is configured for setjmp/longjmp exceptions.])
1479       ac_exception_model_name=sjlj
1480       ;;
1481     no)
1482       ac_exception_model_name="call frame"
1483       ;;
1484     *)
1485       AC_MSG_ERROR([unable to detect exception model])
1486       ;;
1487   esac
1488  AC_LANG_RESTORE
1489  AC_MSG_RESULT($ac_exception_model_name)
1490 ])
1491
1492
1493 dnl
1494 dnl Add version tags to symbols in shared library (or not), additionally
1495 dnl marking other symbols as private/local (or not).
1496 dnl
1497 dnl --enable-symvers=style adds a version script to the linker call when
1498 dnl       creating the shared library.  The choice of version script is
1499 dnl       controlled by 'style'.
1500 dnl --disable-symvers does not.
1501 dnl  +  Usage:  GLIBCXX_ENABLE_SYMVERS[(DEFAULT)]
1502 dnl       Where DEFAULT is either 'yes' or 'no'.  Passing `yes' tries to
1503 dnl       choose a default style based on linker characteristics.  Passing
1504 dnl       'no' disables versioning.
1505 dnl
1506 AC_DEFUN(GLIBCXX_ENABLE_SYMVERS, [
1507
1508 GLIBCXX_ENABLE(symvers,$1,[=STYLE],
1509   [enables symbol versioning of the shared library],
1510   [permit yes|no|gnu])
1511
1512 # If we never went through the GLIBCXX_CHECK_LINKER_FEATURES macro, then we
1513 # don't know enough about $LD to do tricks...
1514 AC_REQUIRE([GLIBCXX_CHECK_LINKER_FEATURES])
1515 # FIXME  The following test is too strict, in theory.
1516 if test $enable_shared = no ||
1517         test "x$LD" = x ||
1518         test x$glibcxx_gnu_ld_version = x; then
1519   enable_symvers=no
1520 fi
1521
1522 # Check to see if libgcc_s exists, indicating that shared libgcc is possible.
1523 if test $enable_symvers != no; then
1524   AC_MSG_CHECKING([for shared libgcc])
1525   ac_save_CFLAGS="$CFLAGS"
1526   CFLAGS=' -lgcc_s'
1527   AC_TRY_LINK(, [return 0;], glibcxx_shared_libgcc=yes, glibcxx_shared_libgcc=no)
1528   CFLAGS="$ac_save_CFLAGS"
1529   AC_MSG_RESULT($glibcxx_shared_libgcc)
1530 fi
1531
1532 # For GNU ld, we need at least this version.  The format is described in
1533 # GLIBCXX_CHECK_LINKER_FEATURES above.
1534 glibcxx_min_gnu_ld_version=21400
1535 # XXXXXXXXXXX glibcxx_gnu_ld_version=21390
1536
1537 # Check to see if unspecified "yes" value can win, given results above.
1538 # Change "yes" into either "no" or a style name.
1539 if test $enable_symvers = yes; then
1540   if test $with_gnu_ld = yes &&
1541      test $glibcxx_shared_libgcc = yes;
1542   then
1543     if test $glibcxx_gnu_ld_version -ge $glibcxx_min_gnu_ld_version ; then
1544       enable_symvers=gnu
1545     else
1546       # The right tools, the right setup, but too old.  Fallbacks?
1547       AC_MSG_WARN(=== Linker version $glibcxx_gnu_ld_version is too old for)
1548       AC_MSG_WARN(=== full symbol versioning support in this release of GCC.)
1549       AC_MSG_WARN(=== You would need to upgrade your binutils to version)
1550       AC_MSG_WARN(=== $glibcxx_min_gnu_ld_version or later and rebuild GCC.)
1551       if test $glibcxx_gnu_ld_version -ge 21200 ; then
1552         # Globbing fix is present, proper block support is not.
1553         dnl AC_MSG_WARN([=== Dude, you are soooo close.  Maybe we can fake it.])
1554         dnl enable_symvers=???
1555         AC_MSG_WARN([=== Symbol versioning will be disabled.])
1556         enable_symvers=no
1557       else
1558         # 2.11 or older.
1559         AC_MSG_WARN([=== Symbol versioning will be disabled.])
1560         enable_symvers=no
1561       fi
1562     fi
1563   else
1564     # just fail for now
1565     AC_MSG_WARN([=== You have requested some kind of symbol versioning, but])
1566     AC_MSG_WARN([=== either you are not using a supported linker, or you are])
1567     AC_MSG_WARN([=== not building a shared libgcc_s (which is required).])
1568     AC_MSG_WARN([=== Symbol versioning will be disabled.])
1569     enable_symvers=no
1570   fi
1571 fi
1572
1573 # Everything parsed; figure out what file to use.
1574 case $enable_symvers in
1575   no)
1576     SYMVER_MAP=config/linker-map.dummy
1577     ;;
1578   gnu)
1579     SYMVER_MAP=config/linker-map.gnu
1580     AC_DEFINE(_GLIBCXX_SYMVER)
1581     ;;
1582 esac
1583
1584 AC_SUBST(SYMVER_MAP)
1585 AC_SUBST(port_specific_symbol_files)
1586 GLIBCXX_CONDITIONAL(GLIBCXX_BUILD_VERSIONED_SHLIB, test $enable_symvers != no)
1587 AC_MSG_NOTICE(versioning on shared library symbols is $enable_symvers)
1588 ])
1589
1590
1591 dnl
1592 dnl Setup to use the gcc gthr.h thread-specific memory and mutex model.
1593 dnl We must stage the required headers so that they will be installed
1594 dnl with the library (unlike libgcc, the STL implementation is provided
1595 dnl solely within headers).  Since we must not inject random user-space
1596 dnl macro names into user-provided C++ code, we first stage into <file>-in
1597 dnl and process to <file> with an output command.  The reason for a two-
1598 dnl stage process here is to correctly handle $srcdir!=$objdir without
1599 dnl having to write complex code (the sed commands to clean the macro
1600 dnl namespace are complex and fragile enough as it is).  We must also
1601 dnl add a relative path so that -I- is supported properly.
1602 dnl
1603 dnl Substs:
1604 dnl  glibcxx_thread_h
1605 dnl
1606 dnl Defines:
1607 dnl  HAVE_GTHR_DEFAULT
1608 dnl  _GLIBCXX_SUPPORTS_WEAK
1609 dnl
1610 AC_DEFUN(GLIBCXX_ENABLE_THREADS, [
1611   AC_MSG_CHECKING([for thread model used by GCC])
1612   target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'`
1613   AC_MSG_RESULT([$target_thread_file])
1614
1615   if test $target_thread_file != single; then
1616     AC_DEFINE(HAVE_GTHR_DEFAULT)
1617     AC_DEFINE(_GLIBCXX_SUPPORTS_WEAK, __GXX_WEAK__)
1618   fi
1619
1620   glibcxx_thread_h=gthr-$target_thread_file.h
1621   AC_SUBST(glibcxx_thread_h)
1622 ])
1623
1624
1625 # Check whether LC_MESSAGES is available in <locale.h>.
1626 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1627 #
1628 # This file file be copied and used freely without restrictions.  It can
1629 # be used in projects which are not available under the GNU Public License
1630 # but which still want to provide support for the GNU gettext functionality.
1631 # Please note that the actual code is *not* freely available.
1632
1633 # serial 1
1634 AC_DEFUN(AC_LC_MESSAGES, [
1635   AC_CHECK_HEADER(locale.h, [
1636     AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
1637       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1638        ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
1639     if test $ac_cv_val_LC_MESSAGES = yes; then
1640       AC_DEFINE(HAVE_LC_MESSAGES)
1641     fi
1642   ])
1643 ])
1644
1645
1646 sinclude([../libtool.m4])
1647 dnl The lines below arrange for aclocal not to bring an installed
1648 dnl libtool.m4 into aclocal.m4, while still arranging for automake to
1649 dnl add a definition of LIBTOOL to Makefile.in.
1650 ifelse(,,,[AC_SUBST(LIBTOOL)
1651 AC_DEFUN([AM_PROG_LIBTOOL])
1652 AC_DEFUN([AC_LIBTOOL_DLOPEN])
1653 AC_DEFUN([AC_PROG_LD])
1654 ])
1655
1656 dnl vim:et:ts=2:sw=2
1657
1658 # AM_CONDITIONAL                                              -*- Autoconf -*-
1659
1660 # Copyright 1997, 2000, 2001 Free Software Foundation, Inc.
1661
1662 # This program is free software; you can redistribute it and/or modify
1663 # it under the terms of the GNU General Public License as published by
1664 # the Free Software Foundation; either version 2, or (at your option)
1665 # any later version.
1666
1667 # This program is distributed in the hope that it will be useful,
1668 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1669 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1670 # GNU General Public License for more details.
1671
1672 # You should have received a copy of the GNU General Public License
1673 # along with this program; if not, write to the Free Software
1674 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1675 # 02111-1307, USA.
1676
1677 # serial 5
1678
1679 AC_PREREQ(2.52)
1680
1681 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
1682 # -------------------------------------
1683 # Define a conditional.
1684 AC_DEFUN([AM_CONDITIONAL],
1685 [ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1686         [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1687 AC_SUBST([$1_TRUE])
1688 AC_SUBST([$1_FALSE])
1689 if $2; then
1690   $1_TRUE=
1691   $1_FALSE='#'
1692 else
1693   $1_TRUE='#'
1694   $1_FALSE=
1695 fi
1696 AC_CONFIG_COMMANDS_PRE(
1697 [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1698   AC_MSG_ERROR([conditional "$1" was never defined.
1699 Usually this means the macro was only invoked conditionally.])
1700 fi])])
1701
1702 # Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
1703
1704 # This program is free software; you can redistribute it and/or modify
1705 # it under the terms of the GNU General Public License as published by
1706 # the Free Software Foundation; either version 2, or (at your option)
1707 # any later version.
1708
1709 # This program is distributed in the hope that it will be useful,
1710 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1711 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1712 # GNU General Public License for more details.
1713
1714 # You should have received a copy of the GNU General Public License
1715 # along with this program; if not, write to the Free Software
1716 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1717 # 02111-1307, USA.
1718
1719 # serial 3
1720
1721 # AM_ENABLE_MULTILIB([MAKEFILE], [REL-TO-TOP-SRCDIR])
1722 # ---------------------------------------------------
1723 # Add --enable-multilib to configure.
1724 AC_DEFUN([AM_ENABLE_MULTILIB],
1725 [# Default to --enable-multilib
1726 AC_ARG_ENABLE(multilib,
1727 [  --enable-multilib         build many library versions (default)],
1728 [case "$enableval" in
1729   yes) multilib=yes ;;
1730   no)  multilib=no ;;
1731   *)   AC_MSG_ERROR([bad value $enableval for multilib option]) ;;
1732  esac],
1733               [multilib=yes])
1734
1735 # We may get other options which we leave undocumented:
1736 # --with-target-subdir, --with-multisrctop, --with-multisubdir
1737 # See config-ml.in if you want the gory details.
1738
1739 if test "$srcdir" = "."; then
1740   if test "$with_target_subdir" != "."; then
1741     multi_basedir="$srcdir/$with_multisrctop../$2"
1742   else
1743     multi_basedir="$srcdir/$with_multisrctop$2"
1744   fi
1745 else
1746   multi_basedir="$srcdir/$2"
1747 fi
1748 AC_SUBST(multi_basedir)
1749
1750 AC_OUTPUT_COMMANDS([
1751 # Only add multilib support code if we just rebuilt the top-level
1752 # Makefile.
1753 case " $CONFIG_FILES " in
1754  *" ]m4_default([$1],Makefile)[ "*)
1755    ac_file=]m4_default([$1],Makefile)[ . ${multi_basedir}/config-ml.in
1756    ;;
1757 esac],
1758                    [
1759 srcdir="$srcdir"
1760 host="$host"
1761 target="$target"
1762 with_multisubdir="$with_multisubdir"
1763 with_multisrctop="$with_multisrctop"
1764 with_target_subdir="$with_target_subdir"
1765 ac_configure_args="${multilib_arg} ${ac_configure_args}"
1766 multi_basedir="$multi_basedir"
1767 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
1768 CC="$CC"])])dnl
1769
1770 # Add --enable-maintainer-mode option to configure.
1771 # From Jim Meyering
1772
1773 # Copyright 1996, 1998, 2000, 2001, 2002  Free Software Foundation, Inc.
1774
1775 # This program is free software; you can redistribute it and/or modify
1776 # it under the terms of the GNU General Public License as published by
1777 # the Free Software Foundation; either version 2, or (at your option)
1778 # any later version.
1779
1780 # This program is distributed in the hope that it will be useful,
1781 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1782 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1783 # GNU General Public License for more details.
1784
1785 # You should have received a copy of the GNU General Public License
1786 # along with this program; if not, write to the Free Software
1787 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1788 # 02111-1307, USA.
1789
1790 # serial 2
1791
1792 AC_DEFUN([AM_MAINTAINER_MODE],
1793 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
1794   dnl maintainer-mode is disabled by default
1795   AC_ARG_ENABLE(maintainer-mode,
1796 [  --enable-maintainer-mode enable make rules and dependencies not useful
1797                           (and sometimes confusing) to the casual installer],
1798       USE_MAINTAINER_MODE=$enableval,
1799       USE_MAINTAINER_MODE=no)
1800   AC_MSG_RESULT([$USE_MAINTAINER_MODE])
1801   AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
1802   MAINT=$MAINTAINER_MODE_TRUE
1803   AC_SUBST(MAINT)dnl
1804 ]
1805 )
1806
1807 AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
1808
1809 # Do all the work for Automake.                            -*- Autoconf -*-
1810
1811 # This macro actually does too much some checks are only needed if
1812 # your package does certain things.  But this isn't really a big deal.
1813
1814 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
1815 # Free Software Foundation, Inc.
1816
1817 # This program is free software; you can redistribute it and/or modify
1818 # it under the terms of the GNU General Public License as published by
1819 # the Free Software Foundation; either version 2, or (at your option)
1820 # any later version.
1821
1822 # This program is distributed in the hope that it will be useful,
1823 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1824 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1825 # GNU General Public License for more details.
1826
1827 # You should have received a copy of the GNU General Public License
1828 # along with this program; if not, write to the Free Software
1829 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1830 # 02111-1307, USA.
1831
1832 # serial 10
1833
1834 AC_PREREQ([2.54])
1835
1836 # Autoconf 2.50 wants to disallow AM_ names.  We explicitly allow
1837 # the ones we care about.
1838 m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
1839
1840 # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
1841 # AM_INIT_AUTOMAKE([OPTIONS])
1842 # -----------------------------------------------
1843 # The call with PACKAGE and VERSION arguments is the old style
1844 # call (pre autoconf-2.50), which is being phased out.  PACKAGE
1845 # and VERSION should now be passed to AC_INIT and removed from
1846 # the call to AM_INIT_AUTOMAKE.
1847 # We support both call styles for the transition.  After
1848 # the next Automake release, Autoconf can make the AC_INIT
1849 # arguments mandatory, and then we can depend on a new Autoconf
1850 # release and drop the old call support.
1851 AC_DEFUN([AM_INIT_AUTOMAKE],
1852 [AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
1853  AC_REQUIRE([AC_PROG_INSTALL])dnl
1854 # test to see if srcdir already configured
1855 if test "`cd $srcdir && pwd`" != "`pwd`" &&
1856    test -f $srcdir/config.status; then
1857   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
1858 fi
1859
1860 # test whether we have cygpath
1861 if test -z "$CYGPATH_W"; then
1862   if (cygpath --version) >/dev/null 2>/dev/null; then
1863     CYGPATH_W='cygpath -w'
1864   else
1865     CYGPATH_W=echo
1866   fi
1867 fi
1868 AC_SUBST([CYGPATH_W])
1869
1870 # Define the identity of the package.
1871 dnl Distinguish between old-style and new-style calls.
1872 m4_ifval([$2],
1873 [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
1874  AC_SUBST([PACKAGE], [$1])dnl
1875  AC_SUBST([VERSION], [$2])],
1876 [_AM_SET_OPTIONS([$1])dnl
1877  AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
1878  AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
1879
1880 _AM_IF_OPTION([no-define],,
1881 [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
1882  AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
1883
1884 # Some tools Automake needs.
1885 AC_REQUIRE([AM_SANITY_CHECK])dnl
1886 AC_REQUIRE([AC_ARG_PROGRAM])dnl
1887 AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
1888 AM_MISSING_PROG(AUTOCONF, autoconf)
1889 AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
1890 AM_MISSING_PROG(AUTOHEADER, autoheader)
1891 AM_MISSING_PROG(MAKEINFO, makeinfo)
1892 AM_MISSING_PROG(AMTAR, tar)
1893 AM_PROG_INSTALL_SH
1894 AM_PROG_INSTALL_STRIP
1895 # We need awk for the "check" target.  The system "awk" is bad on
1896 # some platforms.
1897 AC_REQUIRE([AC_PROG_AWK])dnl
1898 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
1899 AC_REQUIRE([AM_SET_LEADING_DOT])dnl
1900
1901 _AM_IF_OPTION([no-dependencies],,
1902 [AC_PROVIDE_IFELSE([AC_PROG_CC],
1903                   [_AM_DEPENDENCIES(CC)],
1904                   [define([AC_PROG_CC],
1905                           defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
1906 AC_PROVIDE_IFELSE([AC_PROG_CXX],
1907                   [_AM_DEPENDENCIES(CXX)],
1908                   [define([AC_PROG_CXX],
1909                           defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
1910 ])
1911 ])
1912
1913
1914 # When config.status generates a header, we must update the stamp-h file.
1915 # This file resides in the same directory as the config header
1916 # that is generated.  The stamp files are numbered to have different names.
1917
1918 # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
1919 # loop where config.status creates the headers, so we can generate
1920 # our stamp files there.
1921 AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
1922 [# Compute $1's index in $config_headers.
1923 _am_stamp_count=1
1924 for _am_header in $config_headers :; do
1925   case $_am_header in
1926     $1 | $1:* )
1927       break ;;
1928     * )
1929       _am_stamp_count=`expr $_am_stamp_count + 1` ;;
1930   esac
1931 done
1932 echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
1933
1934 # Copyright 2002  Free Software Foundation, Inc.
1935
1936 # This program is free software; you can redistribute it and/or modify
1937 # it under the terms of the GNU General Public License as published by
1938 # the Free Software Foundation; either version 2, or (at your option)
1939 # any later version.
1940
1941 # This program is distributed in the hope that it will be useful,
1942 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1943 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1944 # GNU General Public License for more details.
1945
1946 # You should have received a copy of the GNU General Public License
1947 # along with this program; if not, write to the Free Software
1948 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1949
1950 # AM_AUTOMAKE_VERSION(VERSION)
1951 # ----------------------------
1952 # Automake X.Y traces this macro to ensure aclocal.m4 has been
1953 # generated from the m4 files accompanying Automake X.Y.
1954 AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.7"])
1955
1956 # AM_SET_CURRENT_AUTOMAKE_VERSION
1957 # -------------------------------
1958 # Call AM_AUTOMAKE_VERSION so it can be traced.
1959 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
1960 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
1961          [AM_AUTOMAKE_VERSION([1.7.6])])
1962
1963 # Helper functions for option handling.                    -*- Autoconf -*-
1964
1965 # Copyright 2001, 2002  Free Software Foundation, Inc.
1966
1967 # This program is free software; you can redistribute it and/or modify
1968 # it under the terms of the GNU General Public License as published by
1969 # the Free Software Foundation; either version 2, or (at your option)
1970 # any later version.
1971
1972 # This program is distributed in the hope that it will be useful,
1973 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1974 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1975 # GNU General Public License for more details.
1976
1977 # You should have received a copy of the GNU General Public License
1978 # along with this program; if not, write to the Free Software
1979 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1980 # 02111-1307, USA.
1981
1982 # serial 2
1983
1984 # _AM_MANGLE_OPTION(NAME)
1985 # -----------------------
1986 AC_DEFUN([_AM_MANGLE_OPTION],
1987 [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
1988
1989 # _AM_SET_OPTION(NAME)
1990 # ------------------------------
1991 # Set option NAME.  Presently that only means defining a flag for this option.
1992 AC_DEFUN([_AM_SET_OPTION],
1993 [m4_define(_AM_MANGLE_OPTION([$1]), 1)])
1994
1995 # _AM_SET_OPTIONS(OPTIONS)
1996 # ----------------------------------
1997 # OPTIONS is a space-separated list of Automake options.
1998 AC_DEFUN([_AM_SET_OPTIONS],
1999 [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
2000
2001 # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
2002 # -------------------------------------------
2003 # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
2004 AC_DEFUN([_AM_IF_OPTION],
2005 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
2006
2007 #
2008 # Check to make sure that the build environment is sane.
2009 #
2010
2011 # Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
2012
2013 # This program is free software; you can redistribute it and/or modify
2014 # it under the terms of the GNU General Public License as published by
2015 # the Free Software Foundation; either version 2, or (at your option)
2016 # any later version.
2017
2018 # This program is distributed in the hope that it will be useful,
2019 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2020 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2021 # GNU General Public License for more details.
2022
2023 # You should have received a copy of the GNU General Public License
2024 # along with this program; if not, write to the Free Software
2025 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
2026 # 02111-1307, USA.
2027
2028 # serial 3
2029
2030 # AM_SANITY_CHECK
2031 # ---------------
2032 AC_DEFUN([AM_SANITY_CHECK],
2033 [AC_MSG_CHECKING([whether build environment is sane])
2034 # Just in case
2035 sleep 1
2036 echo timestamp > conftest.file
2037 # Do `set' in a subshell so we don't clobber the current shell's
2038 # arguments.  Must try -L first in case configure is actually a
2039 # symlink; some systems play weird games with the mod time of symlinks
2040 # (eg FreeBSD returns the mod time of the symlink's containing
2041 # directory).
2042 if (
2043    set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
2044    if test "$[*]" = "X"; then
2045       # -L didn't work.
2046       set X `ls -t $srcdir/configure conftest.file`
2047    fi
2048    rm -f conftest.file
2049    if test "$[*]" != "X $srcdir/configure conftest.file" \
2050       && test "$[*]" != "X conftest.file $srcdir/configure"; then
2051
2052       # If neither matched, then we have a broken ls.  This can happen
2053       # if, for instance, CONFIG_SHELL is bash and it inherits a
2054       # broken ls alias from the environment.  This has actually
2055       # happened.  Such a system could not be considered "sane".
2056       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
2057 alias in your environment])
2058    fi
2059
2060    test "$[2]" = conftest.file
2061    )
2062 then
2063    # Ok.
2064    :
2065 else
2066    AC_MSG_ERROR([newly created file is older than distributed files!
2067 Check your system clock])
2068 fi
2069 AC_MSG_RESULT(yes)])
2070
2071 #  -*- Autoconf -*-
2072
2073
2074 # Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
2075
2076 # This program is free software; you can redistribute it and/or modify
2077 # it under the terms of the GNU General Public License as published by
2078 # the Free Software Foundation; either version 2, or (at your option)
2079 # any later version.
2080
2081 # This program is distributed in the hope that it will be useful,
2082 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2083 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2084 # GNU General Public License for more details.
2085
2086 # You should have received a copy of the GNU General Public License
2087 # along with this program; if not, write to the Free Software
2088 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
2089 # 02111-1307, USA.
2090
2091 # serial 3
2092
2093 # AM_MISSING_PROG(NAME, PROGRAM)
2094 # ------------------------------
2095 AC_DEFUN([AM_MISSING_PROG],
2096 [AC_REQUIRE([AM_MISSING_HAS_RUN])
2097 $1=${$1-"${am_missing_run}$2"}
2098 AC_SUBST($1)])
2099
2100
2101 # AM_MISSING_HAS_RUN
2102 # ------------------
2103 # Define MISSING if not defined so far and test if it supports --run.
2104 # If it does, set am_missing_run to use it, otherwise, to nothing.
2105 AC_DEFUN([AM_MISSING_HAS_RUN],
2106 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2107 test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
2108 # Use eval to expand $SHELL
2109 if eval "$MISSING --run true"; then
2110   am_missing_run="$MISSING --run "
2111 else
2112   am_missing_run=
2113   AC_MSG_WARN([`missing' script is too old or missing])
2114 fi
2115 ])
2116
2117 # AM_AUX_DIR_EXPAND
2118
2119 # Copyright 2001 Free Software Foundation, Inc.
2120
2121 # This program is free software; you can redistribute it and/or modify
2122 # it under the terms of the GNU General Public License as published by
2123 # the Free Software Foundation; either version 2, or (at your option)
2124 # any later version.
2125
2126 # This program is distributed in the hope that it will be useful,
2127 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2128 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2129 # GNU General Public License for more details.
2130
2131 # You should have received a copy of the GNU General Public License
2132 # along with this program; if not, write to the Free Software
2133 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
2134 # 02111-1307, USA.
2135
2136 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
2137 # $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
2138 # `$srcdir', `$srcdir/..', or `$srcdir/../..'.
2139 #
2140 # Of course, Automake must honor this variable whenever it calls a
2141 # tool from the auxiliary directory.  The problem is that $srcdir (and
2142 # therefore $ac_aux_dir as well) can be either absolute or relative,
2143 # depending on how configure is run.  This is pretty annoying, since
2144 # it makes $ac_aux_dir quite unusable in subdirectories: in the top
2145 # source directory, any form will work fine, but in subdirectories a
2146 # relative path needs to be adjusted first.
2147 #
2148 # $ac_aux_dir/missing
2149 #    fails when called from a subdirectory if $ac_aux_dir is relative
2150 # $top_srcdir/$ac_aux_dir/missing
2151 #    fails if $ac_aux_dir is absolute,
2152 #    fails when called from a subdirectory in a VPATH build with
2153 #          a relative $ac_aux_dir
2154 #
2155 # The reason of the latter failure is that $top_srcdir and $ac_aux_dir
2156 # are both prefixed by $srcdir.  In an in-source build this is usually
2157 # harmless because $srcdir is `.', but things will broke when you
2158 # start a VPATH build or use an absolute $srcdir.
2159 #
2160 # So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
2161 # iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
2162 #   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
2163 # and then we would define $MISSING as
2164 #   MISSING="\${SHELL} $am_aux_dir/missing"
2165 # This will work as long as MISSING is not called from configure, because
2166 # unfortunately $(top_srcdir) has no meaning in configure.
2167 # However there are other variables, like CC, which are often used in
2168 # configure, and could therefore not use this "fixed" $ac_aux_dir.
2169 #
2170 # Another solution, used here, is to always expand $ac_aux_dir to an
2171 # absolute PATH.  The drawback is that using absolute paths prevent a
2172 # configured tree to be moved without reconfiguration.
2173
2174 # Rely on autoconf to set up CDPATH properly.
2175 AC_PREREQ([2.50])
2176
2177 AC_DEFUN([AM_AUX_DIR_EXPAND], [
2178 # expand $ac_aux_dir to an absolute path
2179 am_aux_dir=`cd $ac_aux_dir && pwd`
2180 ])
2181
2182 # AM_PROG_INSTALL_SH
2183 # ------------------
2184 # Define $install_sh.
2185
2186 # Copyright 2001 Free Software Foundation, Inc.
2187
2188 # This program is free software; you can redistribute it and/or modify
2189 # it under the terms of the GNU General Public License as published by
2190 # the Free Software Foundation; either version 2, or (at your option)
2191 # any later version.
2192
2193 # This program is distributed in the hope that it will be useful,
2194 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2195 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2196 # GNU General Public License for more details.
2197
2198 # You should have received a copy of the GNU General Public License
2199 # along with this program; if not, write to the Free Software
2200 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
2201 # 02111-1307, USA.
2202
2203 AC_DEFUN([AM_PROG_INSTALL_SH],
2204 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2205 install_sh=${install_sh-"$am_aux_dir/install-sh"}
2206 AC_SUBST(install_sh)])
2207
2208 # AM_PROG_INSTALL_STRIP
2209
2210 # Copyright 2001 Free Software Foundation, Inc.
2211
2212 # This program is free software; you can redistribute it and/or modify
2213 # it under the terms of the GNU General Public License as published by
2214 # the Free Software Foundation; either version 2, or (at your option)
2215 # any later version.
2216
2217 # This program is distributed in the hope that it will be useful,
2218 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2219 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2220 # GNU General Public License for more details.
2221
2222 # You should have received a copy of the GNU General Public License
2223 # along with this program; if not, write to the Free Software
2224 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
2225 # 02111-1307, USA.
2226
2227 # One issue with vendor `install' (even GNU) is that you can't
2228 # specify the program used to strip binaries.  This is especially
2229 # annoying in cross-compiling environments, where the build's strip
2230 # is unlikely to handle the host's binaries.
2231 # Fortunately install-sh will honor a STRIPPROG variable, so we
2232 # always use install-sh in `make install-strip', and initialize
2233 # STRIPPROG with the value of the STRIP variable (set by the user).
2234 AC_DEFUN([AM_PROG_INSTALL_STRIP],
2235 [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
2236 # Installed binaries are usually stripped using `strip' when the user
2237 # run `make install-strip'.  However `strip' might not be the right
2238 # tool to use in cross-compilation environments, therefore Automake
2239 # will honor the `STRIP' environment variable to overrule this program.
2240 dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
2241 if test "$cross_compiling" != no; then
2242   AC_CHECK_TOOL([STRIP], [strip], :)
2243 fi
2244 INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
2245 AC_SUBST([INSTALL_STRIP_PROGRAM])])
2246
2247 #                                                          -*- Autoconf -*-
2248 # Copyright (C) 2003  Free Software Foundation, Inc.
2249
2250 # This program is free software; you can redistribute it and/or modify
2251 # it under the terms of the GNU General Public License as published by
2252 # the Free Software Foundation; either version 2, or (at your option)
2253 # any later version.
2254
2255 # This program is distributed in the hope that it will be useful,
2256 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2257 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2258 # GNU General Public License for more details.
2259
2260 # You should have received a copy of the GNU General Public License
2261 # along with this program; if not, write to the Free Software
2262 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
2263 # 02111-1307, USA.
2264
2265 # serial 1
2266
2267 # Check whether the underlying file-system supports filenames
2268 # with a leading dot.  For instance MS-DOS doesn't.
2269 AC_DEFUN([AM_SET_LEADING_DOT],
2270 [rm -rf .tst 2>/dev/null
2271 mkdir .tst 2>/dev/null
2272 if test -d .tst; then
2273   am__leading_dot=.
2274 else
2275   am__leading_dot=_
2276 fi
2277 rmdir .tst 2>/dev/null
2278 AC_SUBST([am__leading_dot])])
2279
2280 # serial 5                                              -*- Autoconf -*-
2281
2282 # Copyright (C) 1999, 2000, 2001, 2002, 2003  Free Software Foundation, Inc.
2283
2284 # This program is free software; you can redistribute it and/or modify
2285 # it under the terms of the GNU General Public License as published by
2286 # the Free Software Foundation; either version 2, or (at your option)
2287 # any later version.
2288
2289 # This program is distributed in the hope that it will be useful,
2290 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2291 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2292 # GNU General Public License for more details.
2293
2294 # You should have received a copy of the GNU General Public License
2295 # along with this program; if not, write to the Free Software
2296 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
2297 # 02111-1307, USA.
2298
2299
2300 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
2301 # written in clear, in which case automake, when reading aclocal.m4,
2302 # will think it sees a *use*, and therefore will trigger all it's
2303 # C support machinery.  Also note that it means that autoscan, seeing
2304 # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
2305
2306
2307
2308 # _AM_DEPENDENCIES(NAME)
2309 # ----------------------
2310 # See how the compiler implements dependency checking.
2311 # NAME is "CC", "CXX", "GCJ", or "OBJC".
2312 # We try a few techniques and use that to set a single cache variable.
2313 #
2314 # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
2315 # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
2316 # dependency, and given that the user is not expected to run this macro,
2317 # just rely on AC_PROG_CC.
2318 AC_DEFUN([_AM_DEPENDENCIES],
2319 [AC_REQUIRE([AM_SET_DEPDIR])dnl
2320 AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
2321 AC_REQUIRE([AM_MAKE_INCLUDE])dnl
2322 AC_REQUIRE([AM_DEP_TRACK])dnl
2323
2324 ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
2325        [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
2326        [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
2327        [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
2328                    [depcc="$$1"   am_compiler_list=])
2329
2330 AC_CACHE_CHECK([dependency style of $depcc],
2331                [am_cv_$1_dependencies_compiler_type],
2332 [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
2333   # We make a subdir and do the tests there.  Otherwise we can end up
2334   # making bogus files that we don't know about and never remove.  For
2335   # instance it was reported that on HP-UX the gcc test will end up
2336   # making a dummy file named `D' -- because `-MD' means `put the output
2337   # in D'.
2338   mkdir conftest.dir
2339   # Copy depcomp to subdir because otherwise we won't find it if we're
2340   # using a relative directory.
2341   cp "$am_depcomp" conftest.dir
2342   cd conftest.dir
2343   # We will build objects and dependencies in a subdirectory because
2344   # it helps to detect inapplicable dependency modes.  For instance
2345   # both Tru64's cc and ICC support -MD to output dependencies as a
2346   # side effect of compilation, but ICC will put the dependencies in
2347   # the current directory while Tru64 will put them in the object
2348   # directory.
2349   mkdir sub
2350
2351   am_cv_$1_dependencies_compiler_type=none
2352   if test "$am_compiler_list" = ""; then
2353      am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2354   fi
2355   for depmode in $am_compiler_list; do
2356     # Setup a source with many dependencies, because some compilers
2357     # like to wrap large dependency lists on column 80 (with \), and
2358     # we should not choose a depcomp mode which is confused by this.
2359     #
2360     # We need to recreate these files for each test, as the compiler may
2361     # overwrite some of them when testing with obscure command lines.
2362     # This happens at least with the AIX C compiler.
2363     : > sub/conftest.c
2364     for i in 1 2 3 4 5 6; do
2365       echo '#include "conftst'$i'.h"' >> sub/conftest.c
2366       : > sub/conftst$i.h
2367     done
2368     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2369
2370     case $depmode in
2371     nosideeffect)
2372       # after this tag, mechanisms are not by side-effect, so they'll
2373       # only be used when explicitly requested
2374       if test "x$enable_dependency_tracking" = xyes; then
2375         continue
2376       else
2377         break
2378       fi
2379       ;;
2380     none) break ;;
2381     esac
2382     # We check with `-c' and `-o' for the sake of the "dashmstdout"
2383     # mode.  It turns out that the SunPro C++ compiler does not properly
2384     # handle `-M -o', and we need to detect this.
2385     if depmode=$depmode \
2386        source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
2387        depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2388        $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
2389          >/dev/null 2>conftest.err &&
2390        grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2391        grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
2392        ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2393       # icc doesn't choke on unknown options, it will just issue warnings
2394       # (even with -Werror).  So we grep stderr for any message
2395       # that says an option was ignored.
2396       if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else
2397         am_cv_$1_dependencies_compiler_type=$depmode
2398         break
2399       fi
2400     fi
2401   done
2402
2403   cd ..
2404   rm -rf conftest.dir
2405 else
2406   am_cv_$1_dependencies_compiler_type=none
2407 fi
2408 ])
2409 AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2410 AM_CONDITIONAL([am__fastdep$1], [
2411   test "x$enable_dependency_tracking" != xno \
2412   && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2413 ])
2414
2415
2416 # AM_SET_DEPDIR
2417 # -------------
2418 # Choose a directory name for dependency files.
2419 # This macro is AC_REQUIREd in _AM_DEPENDENCIES
2420 AC_DEFUN([AM_SET_DEPDIR],
2421 [AC_REQUIRE([AM_SET_LEADING_DOT])dnl
2422 AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
2423 ])
2424
2425
2426 # AM_DEP_TRACK
2427 # ------------
2428 AC_DEFUN([AM_DEP_TRACK],
2429 [AC_ARG_ENABLE(dependency-tracking,
2430 [  --disable-dependency-tracking Speeds up one-time builds
2431   --enable-dependency-tracking  Do not reject slow dependency extractors])
2432 if test "x$enable_dependency_tracking" != xno; then
2433   am_depcomp="$ac_aux_dir/depcomp"
2434   AMDEPBACKSLASH='\'
2435 fi
2436 AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
2437 AC_SUBST([AMDEPBACKSLASH])
2438 ])
2439
2440 # Generate code to set up dependency tracking.   -*- Autoconf -*-
2441
2442 # Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
2443
2444 # This program is free software; you can redistribute it and/or modify
2445 # it under the terms of the GNU General Public License as published by
2446 # the Free Software Foundation; either version 2, or (at your option)
2447 # any later version.
2448
2449 # This program is distributed in the hope that it will be useful,
2450 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2451 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2452 # GNU General Public License for more details.
2453
2454 # You should have received a copy of the GNU General Public License
2455 # along with this program; if not, write to the Free Software
2456 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
2457 # 02111-1307, USA.
2458
2459 #serial 2
2460
2461 # _AM_OUTPUT_DEPENDENCY_COMMANDS
2462 # ------------------------------
2463 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
2464 [for mf in $CONFIG_FILES; do
2465   # Strip MF so we end up with the name of the file.
2466   mf=`echo "$mf" | sed -e 's/:.*$//'`
2467   # Check whether this is an Automake generated Makefile or not.
2468   # We used to match only the files named `Makefile.in', but
2469   # some people rename them; so instead we look at the file content.
2470   # Grep'ing the first line is not enough: some people post-process
2471   # each Makefile.in and add a new line on top of each file to say so.
2472   # So let's grep whole file.
2473   if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
2474     dirpart=`AS_DIRNAME("$mf")`
2475   else
2476     continue
2477   fi
2478   grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue
2479   # Extract the definition of DEP_FILES from the Makefile without
2480   # running `make'.
2481   DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
2482   test -z "$DEPDIR" && continue
2483   # When using ansi2knr, U may be empty or an underscore; expand it
2484   U=`sed -n -e '/^U = / s///p' < "$mf"`
2485   test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
2486   # We invoke sed twice because it is the simplest approach to
2487   # changing $(DEPDIR) to its actual value in the expansion.
2488   for file in `sed -n -e '
2489     /^DEP_FILES = .*\\\\$/ {
2490       s/^DEP_FILES = //
2491       :loop
2492         s/\\\\$//
2493         p
2494         n
2495         /\\\\$/ b loop
2496       p
2497     }
2498     /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
2499        sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
2500     # Make sure the directory exists.
2501     test -f "$dirpart/$file" && continue
2502     fdir=`AS_DIRNAME(["$file"])`
2503     AS_MKDIR_P([$dirpart/$fdir])
2504     # echo "creating $dirpart/$file"
2505     echo '# dummy' > "$dirpart/$file"
2506   done
2507 done
2508 ])# _AM_OUTPUT_DEPENDENCY_COMMANDS
2509
2510
2511 # AM_OUTPUT_DEPENDENCY_COMMANDS
2512 # -----------------------------
2513 # This macro should only be invoked once -- use via AC_REQUIRE.
2514 #
2515 # This code is only required when automatic dependency tracking
2516 # is enabled.  FIXME.  This creates each `.P' file that we will
2517 # need in order to bootstrap the dependency handling code.
2518 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
2519 [AC_CONFIG_COMMANDS([depfiles],
2520      [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
2521      [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
2522 ])
2523
2524 # Check to see how 'make' treats includes.      -*- Autoconf -*-
2525
2526 # Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
2527
2528 # This program is free software; you can redistribute it and/or modify
2529 # it under the terms of the GNU General Public License as published by
2530 # the Free Software Foundation; either version 2, or (at your option)
2531 # any later version.
2532
2533 # This program is distributed in the hope that it will be useful,
2534 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2535 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2536 # GNU General Public License for more details.
2537
2538 # You should have received a copy of the GNU General Public License
2539 # along with this program; if not, write to the Free Software
2540 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
2541 # 02111-1307, USA.
2542
2543 # serial 2
2544
2545 # AM_MAKE_INCLUDE()
2546 # -----------------
2547 # Check to see how make treats includes.
2548 AC_DEFUN([AM_MAKE_INCLUDE],
2549 [am_make=${MAKE-make}
2550 cat > confinc << 'END'
2551 am__doit:
2552         @echo done
2553 .PHONY: am__doit
2554 END
2555 # If we don't find an include directive, just comment out the code.
2556 AC_MSG_CHECKING([for style of include used by $am_make])
2557 am__include="#"
2558 am__quote=
2559 _am_result=none
2560 # First try GNU make style include.
2561 echo "include confinc" > confmf
2562 # We grep out `Entering directory' and `Leaving directory'
2563 # messages which can occur if `w' ends up in MAKEFLAGS.
2564 # In particular we don't look at `^make:' because GNU make might
2565 # be invoked under some other name (usually "gmake"), in which
2566 # case it prints its new name instead of `make'.
2567 if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
2568    am__include=include
2569    am__quote=
2570    _am_result=GNU
2571 fi
2572 # Now try BSD make style include.
2573 if test "$am__include" = "#"; then
2574    echo '.include "confinc"' > confmf
2575    if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
2576       am__include=.include
2577       am__quote="\""
2578       _am_result=BSD
2579    fi
2580 fi
2581 AC_SUBST([am__include])
2582 AC_SUBST([am__quote])
2583 AC_MSG_RESULT([$_am_result])
2584 rm -f confinc confmf
2585 ])
2586