OSDN Git Service

42399080ba378dca9b08cb4af5e5541630a7b5c4
[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 dnl Defines:
1293 dnl  _GLIBCXX_HOSTED   (always defined, either to 1 or 0)
1294 dnl
1295 AC_DEFUN(GLIBCXX_ENABLE_HOSTED, [
1296   AC_ARG_ENABLE([hosted-libstdcxx],
1297     AC_HELP_STRING([--disable-hosted-libstdcxx],
1298                    [only build freestanding C++ runtime support]),,
1299     [enable_hosted_libstdcxx=yes])
1300   if test "$enable_hosted_libstdcxx" = no; then
1301     AC_MSG_NOTICE([Only freestanding libraries will be built])
1302     is_hosted=no
1303     hosted_define=0
1304     enable_abi_check=no
1305     enable_libstdcxx_pch=no
1306   else
1307     is_hosted=yes
1308     hosted_define=1
1309   fi
1310   GLIBCXX_CONDITIONAL(GLIBCXX_HOSTED, test $is_hosted = yes)
1311   AC_DEFINE_UNQUOTED(_GLIBCXX_HOSTED, $hosted_define,
1312     [Define to 1 if a full hosted library is built, or 0 if freestanding.])
1313 ])
1314
1315
1316 dnl
1317 dnl Check for libunwind exception handling support.  If enabled, then
1318 dnl we assume that the _Unwind_* functions that make up the Unwind ABI
1319 dnl (_Unwind_RaiseException, _Unwind_Resume, etc.) are defined by
1320 dnl libunwind instead of libgcc, and that libstdc++ has a dependency
1321 dnl on libunwind as well as libgcc.
1322 dnl
1323 dnl --enable-libunwind-exceptions forces the use of libunwind.
1324 dnl --disable-libunwind-exceptions assumes there is no libunwind.
1325 dnl
1326 dnl Substs:
1327 dnl  LIBUNWIND_FLAG
1328 dnl
1329 AC_DEFUN(GLIBCXX_ENABLE_LIBUNWIND_EXCEPTIONS, [
1330   AC_MSG_CHECKING([for use of libunwind])
1331   GLIBCXX_ENABLE(libunwind-exceptions,no,,
1332     [force use of libunwind for exceptions])
1333   AC_MSG_RESULT($use_libunwind_exceptions)
1334   if test $enable_libunwind_exceptions = yes; then
1335     LIBUNWIND_FLAG="-lunwind"
1336   else
1337     LIBUNWIND_FLAG=""
1338   fi
1339   AC_SUBST(LIBUNWIND_FLAG)
1340 ])
1341
1342
1343 dnl
1344 dnl Check for template specializations for the 'long long' type extension.
1345 dnl The result determines only whether 'long long' I/O is enabled; things
1346 dnl like numeric_limits<> specializations are always available.
1347 dnl
1348 dnl --enable-long-long defines _GLIBCXX_USE_LONG_LONG
1349 dnl --disable-long-long leaves _GLIBCXX_USE_LONG_LONG undefined
1350 dnl  +  Usage:  GLIBCXX_ENABLE_LONG_LONG[(DEFAULT)]
1351 dnl       Where DEFAULT is either `yes' or `no'.
1352 dnl  +  If 'long long' stuff is not available, ignores DEFAULT and sets `no'.
1353 dnl
1354 AC_DEFUN(GLIBCXX_ENABLE_LONG_LONG, [
1355   GLIBCXX_ENABLE(long-long,$1,,[enables I/O support for 'long long'])
1356
1357   AC_LANG_SAVE
1358   AC_LANG_CPLUSPLUS
1359
1360   AC_MSG_CHECKING([for enabled long long I/O support])
1361   # iostreams require strtoll, strtoull to compile
1362   AC_TRY_COMPILE([#include <stdlib.h>],
1363                  [char* tmp; strtoll("gnu", &tmp, 10);],,[enable_long_long=no])
1364   AC_TRY_COMPILE([#include <stdlib.h>],
1365                  [char* tmp; strtoull("gnu", &tmp, 10);],,[enable_long_long=no])
1366
1367   # Option parsed, now set things appropriately
1368   if test $enable_long_long = yes; then
1369     AC_DEFINE(_GLIBCXX_USE_LONG_LONG)
1370   fi
1371   AC_MSG_RESULT($enable_long_long)
1372
1373   AC_LANG_RESTORE
1374 ])
1375
1376
1377 dnl
1378 dnl Check to see if building and using a C++ precompiled header can be done.
1379 dnl
1380 dnl --enable-libstdcxx-pch=yes
1381 dnl default, this shows intent to use stdc++.h.gch If it looks like it
1382 dnl may work, after some light-hearted attempts to puzzle out compiler
1383 dnl support, flip bits on in include/Makefile.am
1384 dnl
1385 dnl --disable-libstdcxx-pch
1386 dnl turns off attempts to use or build stdc++.h.gch.
1387 dnl
1388 dnl Substs:
1389 dnl  glibcxx_PCHFLAGS
1390 dnl
1391 AC_DEFUN(GLIBCXX_ENABLE_PCH, [
1392   AC_MSG_CHECKING([for enabled PCH])
1393   GLIBCXX_ENABLE(libstdcxx-pch,$1,,[build pre-compiled libstdc++ headers])
1394   AC_MSG_RESULT([$enable_libstdcxx_pch])
1395
1396   if test $enable_libstdcxx_pch = yes; then
1397     AC_CACHE_CHECK([for compiler with PCH support],
1398       [glibcxx_cv_prog_CXX_pch],
1399       [ac_save_CXXFLAGS="$CXXFLAGS"
1400        CXXFLAGS="$CXXFLAGS -Werror -Winvalid-pch -Wno-deprecated"
1401        AC_LANG_SAVE
1402        AC_LANG_CPLUSPLUS
1403        echo '#include <math.h>' > conftest.h
1404        if $CXX $CXXFLAGS $CPPFLAGS -x c++-header conftest.h \
1405                           -o conftest.h.gch 1>&5 2>&1 &&
1406                 echo '#error "pch failed"' > conftest.h &&
1407           echo '#include "conftest.h"' > conftest.cc &&
1408                $CXX -c $CXXFLAGS $CPPFLAGS conftest.cc 1>&5 2>&1 ;
1409        then
1410          glibcxx_cv_prog_CXX_pch=yes
1411        else
1412          glibcxx_cv_prog_CXX_pch=no
1413        fi
1414        rm -f conftest*
1415        CXXFLAGS=$ac_save_CXXFLAGS
1416        AC_LANG_RESTORE
1417       ])
1418     enable_libstdcxx_pch=$glibcxx_cv_prog_CXX_pch
1419   fi
1420
1421   GLIBCXX_CONDITIONAL(GLIBCXX_BUILD_PCH, test $enable_libstdcxx_pch = yes)
1422   if test $enable_libstdcxx_pch = yes; then
1423     glibcxx_PCHFLAGS="-include bits/stdc++.h"
1424   else
1425     glibcxx_PCHFLAGS=""
1426   fi
1427   AC_SUBST(glibcxx_PCHFLAGS)
1428 ])
1429
1430
1431 dnl
1432 dnl Check for exception handling support.  If an explicit enable/disable
1433 dnl sjlj exceptions is given, we don't have to detect.  Otherwise the
1434 dnl target may or may not support call frame exceptions.
1435 dnl
1436 dnl --enable-sjlj-exceptions forces the use of builtin setjmp.
1437 dnl --disable-sjlj-exceptions forces the use of call frame unwinding.
1438 dnl Neither one forces an attempt at detection.
1439 dnl
1440 dnl Defines:
1441 dnl  _GLIBCXX_SJLJ_EXCEPTIONS if the compiler is configured for it
1442 dnl
1443 AC_DEFUN(GLIBCXX_ENABLE_SJLJ_EXCEPTIONS, [
1444   AC_MSG_CHECKING([for exception model to use])
1445   AC_LANG_SAVE
1446   AC_LANG_CPLUSPLUS
1447   GLIBCXX_ENABLE(sjlj-exceptions,auto,,
1448     [force use of builtin_setjmp for exceptions],
1449     [permit yes|no|auto])
1450
1451   if test $enable_sjlj_exceptions = auto; then
1452     # Botheration.  Now we've got to detect the exception model.  Link tests
1453     # against libgcc.a are problematic since we've not been given proper -L
1454     # bits for single-tree newlib and libgloss.
1455     #
1456     # Fake what AC_TRY_COMPILE does.  XXX Look at redoing this new-style.
1457     cat > conftest.$ac_ext << EOF
1458 [#]line __oline__ "configure"
1459 struct S { ~S(); };
1460 void bar();
1461 void foo()
1462 {
1463   S s;
1464   bar();
1465 }
1466 EOF
1467     old_CXXFLAGS="$CXXFLAGS"
1468     CXXFLAGS=-S
1469     if AC_TRY_EVAL(ac_compile); then
1470       if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
1471         enable_sjlj_exceptions=yes
1472       elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
1473         enable_sjlj_exceptions=no
1474       fi
1475     fi
1476     CXXFLAGS="$old_CXXFLAGS"
1477     rm -f conftest*
1478   fi
1479
1480   # This is a tad weird, for hysterical raisins.  We have to map enable/disable 
1481   # to two different models.
1482   case $enable_sjlj_exceptions in
1483     yes)
1484       AC_DEFINE(_GLIBCXX_SJLJ_EXCEPTIONS, 1,
1485         [Define if the compiler is configured for setjmp/longjmp exceptions.])
1486       ac_exception_model_name=sjlj
1487       ;;
1488     no)
1489       ac_exception_model_name="call frame"
1490       ;;
1491     *)
1492       AC_MSG_ERROR([unable to detect exception model])
1493       ;;
1494   esac
1495  AC_LANG_RESTORE
1496  AC_MSG_RESULT($ac_exception_model_name)
1497 ])
1498
1499
1500 dnl
1501 dnl Add version tags to symbols in shared library (or not), additionally
1502 dnl marking other symbols as private/local (or not).
1503 dnl
1504 dnl --enable-symvers=style adds a version script to the linker call when
1505 dnl       creating the shared library.  The choice of version script is
1506 dnl       controlled by 'style'.
1507 dnl --disable-symvers does not.
1508 dnl  +  Usage:  GLIBCXX_ENABLE_SYMVERS[(DEFAULT)]
1509 dnl       Where DEFAULT is either 'yes' or 'no'.  Passing `yes' tries to
1510 dnl       choose a default style based on linker characteristics.  Passing
1511 dnl       'no' disables versioning.
1512 dnl
1513 AC_DEFUN(GLIBCXX_ENABLE_SYMVERS, [
1514
1515 GLIBCXX_ENABLE(symvers,$1,[=STYLE],
1516   [enables symbol versioning of the shared library],
1517   [permit yes|no|gnu])
1518
1519 # If we never went through the GLIBCXX_CHECK_LINKER_FEATURES macro, then we
1520 # don't know enough about $LD to do tricks...
1521 AC_REQUIRE([GLIBCXX_CHECK_LINKER_FEATURES])
1522 # FIXME  The following test is too strict, in theory.
1523 if test $enable_shared = no ||
1524         test "x$LD" = x ||
1525         test x$glibcxx_gnu_ld_version = x; then
1526   enable_symvers=no
1527 fi
1528
1529 # Check to see if libgcc_s exists, indicating that shared libgcc is possible.
1530 if test $enable_symvers != no; then
1531   AC_MSG_CHECKING([for shared libgcc])
1532   ac_save_CFLAGS="$CFLAGS"
1533   CFLAGS=' -lgcc_s'
1534   AC_TRY_LINK(, [return 0;], glibcxx_shared_libgcc=yes, glibcxx_shared_libgcc=no)
1535   CFLAGS="$ac_save_CFLAGS"
1536   AC_MSG_RESULT($glibcxx_shared_libgcc)
1537 fi
1538
1539 # For GNU ld, we need at least this version.  The format is described in
1540 # GLIBCXX_CHECK_LINKER_FEATURES above.
1541 glibcxx_min_gnu_ld_version=21400
1542 # XXXXXXXXXXX glibcxx_gnu_ld_version=21390
1543
1544 # Check to see if unspecified "yes" value can win, given results above.
1545 # Change "yes" into either "no" or a style name.
1546 if test $enable_symvers = yes; then
1547   if test $with_gnu_ld = yes &&
1548      test $glibcxx_shared_libgcc = yes;
1549   then
1550     if test $glibcxx_gnu_ld_version -ge $glibcxx_min_gnu_ld_version ; then
1551       enable_symvers=gnu
1552     else
1553       # The right tools, the right setup, but too old.  Fallbacks?
1554       AC_MSG_WARN(=== Linker version $glibcxx_gnu_ld_version is too old for)
1555       AC_MSG_WARN(=== full symbol versioning support in this release of GCC.)
1556       AC_MSG_WARN(=== You would need to upgrade your binutils to version)
1557       AC_MSG_WARN(=== $glibcxx_min_gnu_ld_version or later and rebuild GCC.)
1558       if test $glibcxx_gnu_ld_version -ge 21200 ; then
1559         # Globbing fix is present, proper block support is not.
1560         dnl AC_MSG_WARN([=== Dude, you are soooo close.  Maybe we can fake it.])
1561         dnl enable_symvers=???
1562         AC_MSG_WARN([=== Symbol versioning will be disabled.])
1563         enable_symvers=no
1564       else
1565         # 2.11 or older.
1566         AC_MSG_WARN([=== Symbol versioning will be disabled.])
1567         enable_symvers=no
1568       fi
1569     fi
1570   else
1571     # just fail for now
1572     AC_MSG_WARN([=== You have requested some kind of symbol versioning, but])
1573     AC_MSG_WARN([=== either you are not using a supported linker, or you are])
1574     AC_MSG_WARN([=== not building a shared libgcc_s (which is required).])
1575     AC_MSG_WARN([=== Symbol versioning will be disabled.])
1576     enable_symvers=no
1577   fi
1578 fi
1579
1580 # Everything parsed; figure out what file to use.
1581 case $enable_symvers in
1582   no)
1583     SYMVER_MAP=config/linker-map.dummy
1584     ;;
1585   gnu)
1586     SYMVER_MAP=config/linker-map.gnu
1587     AC_DEFINE(_GLIBCXX_SYMVER)
1588     ;;
1589 esac
1590
1591 AC_SUBST(SYMVER_MAP)
1592 AC_SUBST(port_specific_symbol_files)
1593 GLIBCXX_CONDITIONAL(GLIBCXX_BUILD_VERSIONED_SHLIB, test $enable_symvers != no)
1594 AC_MSG_NOTICE(versioning on shared library symbols is $enable_symvers)
1595 ])
1596
1597
1598 dnl
1599 dnl Setup to use the gcc gthr.h thread-specific memory and mutex model.
1600 dnl We must stage the required headers so that they will be installed
1601 dnl with the library (unlike libgcc, the STL implementation is provided
1602 dnl solely within headers).  Since we must not inject random user-space
1603 dnl macro names into user-provided C++ code, we first stage into <file>-in
1604 dnl and process to <file> with an output command.  The reason for a two-
1605 dnl stage process here is to correctly handle $srcdir!=$objdir without
1606 dnl having to write complex code (the sed commands to clean the macro
1607 dnl namespace are complex and fragile enough as it is).  We must also
1608 dnl add a relative path so that -I- is supported properly.
1609 dnl
1610 dnl Substs:
1611 dnl  glibcxx_thread_h
1612 dnl
1613 dnl Defines:
1614 dnl  HAVE_GTHR_DEFAULT
1615 dnl  _GLIBCXX_SUPPORTS_WEAK
1616 dnl
1617 AC_DEFUN(GLIBCXX_ENABLE_THREADS, [
1618   AC_MSG_CHECKING([for thread model used by GCC])
1619   target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'`
1620   AC_MSG_RESULT([$target_thread_file])
1621
1622   if test $target_thread_file != single; then
1623     AC_DEFINE(HAVE_GTHR_DEFAULT)
1624     AC_DEFINE(_GLIBCXX_SUPPORTS_WEAK, __GXX_WEAK__)
1625   fi
1626
1627   glibcxx_thread_h=gthr-$target_thread_file.h
1628   AC_SUBST(glibcxx_thread_h)
1629 ])
1630
1631
1632 # Check whether LC_MESSAGES is available in <locale.h>.
1633 # Ulrich Drepper <drepper@cygnus.com>, 1995.
1634 #
1635 # This file file be copied and used freely without restrictions.  It can
1636 # be used in projects which are not available under the GNU Public License
1637 # but which still want to provide support for the GNU gettext functionality.
1638 # Please note that the actual code is *not* freely available.
1639
1640 # serial 1
1641 AC_DEFUN(AC_LC_MESSAGES, [
1642   AC_CHECK_HEADER(locale.h, [
1643     AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
1644       [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1645        ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
1646     if test $ac_cv_val_LC_MESSAGES = yes; then
1647       AC_DEFINE(HAVE_LC_MESSAGES)
1648     fi
1649   ])
1650 ])
1651
1652
1653 sinclude([../libtool.m4])
1654 dnl The lines below arrange for aclocal not to bring an installed
1655 dnl libtool.m4 into aclocal.m4, while still arranging for automake to
1656 dnl add a definition of LIBTOOL to Makefile.in.
1657 ifelse(,,,[AC_SUBST(LIBTOOL)
1658 AC_DEFUN([AM_PROG_LIBTOOL])
1659 AC_DEFUN([AC_LIBTOOL_DLOPEN])
1660 AC_DEFUN([AC_PROG_LD])
1661 ])
1662
1663 dnl vim:et:ts=2:sw=2
1664
1665 # AM_CONDITIONAL                                              -*- Autoconf -*-
1666
1667 # Copyright 1997, 2000, 2001 Free Software Foundation, Inc.
1668
1669 # This program is free software; you can redistribute it and/or modify
1670 # it under the terms of the GNU General Public License as published by
1671 # the Free Software Foundation; either version 2, or (at your option)
1672 # any later version.
1673
1674 # This program is distributed in the hope that it will be useful,
1675 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1676 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1677 # GNU General Public License for more details.
1678
1679 # You should have received a copy of the GNU General Public License
1680 # along with this program; if not, write to the Free Software
1681 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1682 # 02111-1307, USA.
1683
1684 # serial 5
1685
1686 AC_PREREQ(2.52)
1687
1688 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
1689 # -------------------------------------
1690 # Define a conditional.
1691 AC_DEFUN([AM_CONDITIONAL],
1692 [ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
1693         [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
1694 AC_SUBST([$1_TRUE])
1695 AC_SUBST([$1_FALSE])
1696 if $2; then
1697   $1_TRUE=
1698   $1_FALSE='#'
1699 else
1700   $1_TRUE='#'
1701   $1_FALSE=
1702 fi
1703 AC_CONFIG_COMMANDS_PRE(
1704 [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
1705   AC_MSG_ERROR([conditional "$1" was never defined.
1706 Usually this means the macro was only invoked conditionally.])
1707 fi])])
1708
1709 # Copyright 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
1710
1711 # This program is free software; you can redistribute it and/or modify
1712 # it under the terms of the GNU General Public License as published by
1713 # the Free Software Foundation; either version 2, or (at your option)
1714 # any later version.
1715
1716 # This program is distributed in the hope that it will be useful,
1717 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1718 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1719 # GNU General Public License for more details.
1720
1721 # You should have received a copy of the GNU General Public License
1722 # along with this program; if not, write to the Free Software
1723 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1724 # 02111-1307, USA.
1725
1726 # serial 3
1727
1728 # AM_ENABLE_MULTILIB([MAKEFILE], [REL-TO-TOP-SRCDIR])
1729 # ---------------------------------------------------
1730 # Add --enable-multilib to configure.
1731 AC_DEFUN([AM_ENABLE_MULTILIB],
1732 [# Default to --enable-multilib
1733 AC_ARG_ENABLE(multilib,
1734 [  --enable-multilib         build many library versions (default)],
1735 [case "$enableval" in
1736   yes) multilib=yes ;;
1737   no)  multilib=no ;;
1738   *)   AC_MSG_ERROR([bad value $enableval for multilib option]) ;;
1739  esac],
1740               [multilib=yes])
1741
1742 # We may get other options which we leave undocumented:
1743 # --with-target-subdir, --with-multisrctop, --with-multisubdir
1744 # See config-ml.in if you want the gory details.
1745
1746 if test "$srcdir" = "."; then
1747   if test "$with_target_subdir" != "."; then
1748     multi_basedir="$srcdir/$with_multisrctop../$2"
1749   else
1750     multi_basedir="$srcdir/$with_multisrctop$2"
1751   fi
1752 else
1753   multi_basedir="$srcdir/$2"
1754 fi
1755 AC_SUBST(multi_basedir)
1756
1757 AC_OUTPUT_COMMANDS([
1758 # Only add multilib support code if we just rebuilt the top-level
1759 # Makefile.
1760 case " $CONFIG_FILES " in
1761  *" ]m4_default([$1],Makefile)[ "*)
1762    ac_file=]m4_default([$1],Makefile)[ . ${multi_basedir}/config-ml.in
1763    ;;
1764 esac],
1765                    [
1766 srcdir="$srcdir"
1767 host="$host"
1768 target="$target"
1769 with_multisubdir="$with_multisubdir"
1770 with_multisrctop="$with_multisrctop"
1771 with_target_subdir="$with_target_subdir"
1772 ac_configure_args="${multilib_arg} ${ac_configure_args}"
1773 multi_basedir="$multi_basedir"
1774 CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
1775 CC="$CC"])])dnl
1776
1777 # Add --enable-maintainer-mode option to configure.
1778 # From Jim Meyering
1779
1780 # Copyright 1996, 1998, 2000, 2001, 2002  Free Software Foundation, Inc.
1781
1782 # This program is free software; you can redistribute it and/or modify
1783 # it under the terms of the GNU General Public License as published by
1784 # the Free Software Foundation; either version 2, or (at your option)
1785 # any later version.
1786
1787 # This program is distributed in the hope that it will be useful,
1788 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1789 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1790 # GNU General Public License for more details.
1791
1792 # You should have received a copy of the GNU General Public License
1793 # along with this program; if not, write to the Free Software
1794 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1795 # 02111-1307, USA.
1796
1797 # serial 2
1798
1799 AC_DEFUN([AM_MAINTAINER_MODE],
1800 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
1801   dnl maintainer-mode is disabled by default
1802   AC_ARG_ENABLE(maintainer-mode,
1803 [  --enable-maintainer-mode enable make rules and dependencies not useful
1804                           (and sometimes confusing) to the casual installer],
1805       USE_MAINTAINER_MODE=$enableval,
1806       USE_MAINTAINER_MODE=no)
1807   AC_MSG_RESULT([$USE_MAINTAINER_MODE])
1808   AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
1809   MAINT=$MAINTAINER_MODE_TRUE
1810   AC_SUBST(MAINT)dnl
1811 ]
1812 )
1813
1814 AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
1815
1816 # Do all the work for Automake.                            -*- Autoconf -*-
1817
1818 # This macro actually does too much some checks are only needed if
1819 # your package does certain things.  But this isn't really a big deal.
1820
1821 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
1822 # Free Software Foundation, Inc.
1823
1824 # This program is free software; you can redistribute it and/or modify
1825 # it under the terms of the GNU General Public License as published by
1826 # the Free Software Foundation; either version 2, or (at your option)
1827 # any later version.
1828
1829 # This program is distributed in the hope that it will be useful,
1830 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1831 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1832 # GNU General Public License for more details.
1833
1834 # You should have received a copy of the GNU General Public License
1835 # along with this program; if not, write to the Free Software
1836 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1837 # 02111-1307, USA.
1838
1839 # serial 10
1840
1841 AC_PREREQ([2.54])
1842
1843 # Autoconf 2.50 wants to disallow AM_ names.  We explicitly allow
1844 # the ones we care about.
1845 m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
1846
1847 # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
1848 # AM_INIT_AUTOMAKE([OPTIONS])
1849 # -----------------------------------------------
1850 # The call with PACKAGE and VERSION arguments is the old style
1851 # call (pre autoconf-2.50), which is being phased out.  PACKAGE
1852 # and VERSION should now be passed to AC_INIT and removed from
1853 # the call to AM_INIT_AUTOMAKE.
1854 # We support both call styles for the transition.  After
1855 # the next Automake release, Autoconf can make the AC_INIT
1856 # arguments mandatory, and then we can depend on a new Autoconf
1857 # release and drop the old call support.
1858 AC_DEFUN([AM_INIT_AUTOMAKE],
1859 [AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
1860  AC_REQUIRE([AC_PROG_INSTALL])dnl
1861 # test to see if srcdir already configured
1862 if test "`cd $srcdir && pwd`" != "`pwd`" &&
1863    test -f $srcdir/config.status; then
1864   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
1865 fi
1866
1867 # test whether we have cygpath
1868 if test -z "$CYGPATH_W"; then
1869   if (cygpath --version) >/dev/null 2>/dev/null; then
1870     CYGPATH_W='cygpath -w'
1871   else
1872     CYGPATH_W=echo
1873   fi
1874 fi
1875 AC_SUBST([CYGPATH_W])
1876
1877 # Define the identity of the package.
1878 dnl Distinguish between old-style and new-style calls.
1879 m4_ifval([$2],
1880 [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
1881  AC_SUBST([PACKAGE], [$1])dnl
1882  AC_SUBST([VERSION], [$2])],
1883 [_AM_SET_OPTIONS([$1])dnl
1884  AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
1885  AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
1886
1887 _AM_IF_OPTION([no-define],,
1888 [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
1889  AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
1890
1891 # Some tools Automake needs.
1892 AC_REQUIRE([AM_SANITY_CHECK])dnl
1893 AC_REQUIRE([AC_ARG_PROGRAM])dnl
1894 AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
1895 AM_MISSING_PROG(AUTOCONF, autoconf)
1896 AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
1897 AM_MISSING_PROG(AUTOHEADER, autoheader)
1898 AM_MISSING_PROG(MAKEINFO, makeinfo)
1899 AM_MISSING_PROG(AMTAR, tar)
1900 AM_PROG_INSTALL_SH
1901 AM_PROG_INSTALL_STRIP
1902 # We need awk for the "check" target.  The system "awk" is bad on
1903 # some platforms.
1904 AC_REQUIRE([AC_PROG_AWK])dnl
1905 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
1906 AC_REQUIRE([AM_SET_LEADING_DOT])dnl
1907
1908 _AM_IF_OPTION([no-dependencies],,
1909 [AC_PROVIDE_IFELSE([AC_PROG_CC],
1910                   [_AM_DEPENDENCIES(CC)],
1911                   [define([AC_PROG_CC],
1912                           defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
1913 AC_PROVIDE_IFELSE([AC_PROG_CXX],
1914                   [_AM_DEPENDENCIES(CXX)],
1915                   [define([AC_PROG_CXX],
1916                           defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
1917 ])
1918 ])
1919
1920
1921 # When config.status generates a header, we must update the stamp-h file.
1922 # This file resides in the same directory as the config header
1923 # that is generated.  The stamp files are numbered to have different names.
1924
1925 # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
1926 # loop where config.status creates the headers, so we can generate
1927 # our stamp files there.
1928 AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
1929 [# Compute $1's index in $config_headers.
1930 _am_stamp_count=1
1931 for _am_header in $config_headers :; do
1932   case $_am_header in
1933     $1 | $1:* )
1934       break ;;
1935     * )
1936       _am_stamp_count=`expr $_am_stamp_count + 1` ;;
1937   esac
1938 done
1939 echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
1940
1941 # Copyright 2002  Free Software Foundation, Inc.
1942
1943 # This program is free software; you can redistribute it and/or modify
1944 # it under the terms of the GNU General Public License as published by
1945 # the Free Software Foundation; either version 2, or (at your option)
1946 # any later version.
1947
1948 # This program is distributed in the hope that it will be useful,
1949 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1950 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1951 # GNU General Public License for more details.
1952
1953 # You should have received a copy of the GNU General Public License
1954 # along with this program; if not, write to the Free Software
1955 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1956
1957 # AM_AUTOMAKE_VERSION(VERSION)
1958 # ----------------------------
1959 # Automake X.Y traces this macro to ensure aclocal.m4 has been
1960 # generated from the m4 files accompanying Automake X.Y.
1961 AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.7"])
1962
1963 # AM_SET_CURRENT_AUTOMAKE_VERSION
1964 # -------------------------------
1965 # Call AM_AUTOMAKE_VERSION so it can be traced.
1966 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
1967 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
1968          [AM_AUTOMAKE_VERSION([1.7.6])])
1969
1970 # Helper functions for option handling.                    -*- Autoconf -*-
1971
1972 # Copyright 2001, 2002  Free Software Foundation, Inc.
1973
1974 # This program is free software; you can redistribute it and/or modify
1975 # it under the terms of the GNU General Public License as published by
1976 # the Free Software Foundation; either version 2, or (at your option)
1977 # any later version.
1978
1979 # This program is distributed in the hope that it will be useful,
1980 # but WITHOUT ANY WARRANTY; without even the implied warranty of
1981 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1982 # GNU General Public License for more details.
1983
1984 # You should have received a copy of the GNU General Public License
1985 # along with this program; if not, write to the Free Software
1986 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1987 # 02111-1307, USA.
1988
1989 # serial 2
1990
1991 # _AM_MANGLE_OPTION(NAME)
1992 # -----------------------
1993 AC_DEFUN([_AM_MANGLE_OPTION],
1994 [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
1995
1996 # _AM_SET_OPTION(NAME)
1997 # ------------------------------
1998 # Set option NAME.  Presently that only means defining a flag for this option.
1999 AC_DEFUN([_AM_SET_OPTION],
2000 [m4_define(_AM_MANGLE_OPTION([$1]), 1)])
2001
2002 # _AM_SET_OPTIONS(OPTIONS)
2003 # ----------------------------------
2004 # OPTIONS is a space-separated list of Automake options.
2005 AC_DEFUN([_AM_SET_OPTIONS],
2006 [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
2007
2008 # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
2009 # -------------------------------------------
2010 # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
2011 AC_DEFUN([_AM_IF_OPTION],
2012 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
2013
2014 #
2015 # Check to make sure that the build environment is sane.
2016 #
2017
2018 # Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
2019
2020 # This program is free software; you can redistribute it and/or modify
2021 # it under the terms of the GNU General Public License as published by
2022 # the Free Software Foundation; either version 2, or (at your option)
2023 # any later version.
2024
2025 # This program is distributed in the hope that it will be useful,
2026 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2027 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2028 # GNU General Public License for more details.
2029
2030 # You should have received a copy of the GNU General Public License
2031 # along with this program; if not, write to the Free Software
2032 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
2033 # 02111-1307, USA.
2034
2035 # serial 3
2036
2037 # AM_SANITY_CHECK
2038 # ---------------
2039 AC_DEFUN([AM_SANITY_CHECK],
2040 [AC_MSG_CHECKING([whether build environment is sane])
2041 # Just in case
2042 sleep 1
2043 echo timestamp > conftest.file
2044 # Do `set' in a subshell so we don't clobber the current shell's
2045 # arguments.  Must try -L first in case configure is actually a
2046 # symlink; some systems play weird games with the mod time of symlinks
2047 # (eg FreeBSD returns the mod time of the symlink's containing
2048 # directory).
2049 if (
2050    set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
2051    if test "$[*]" = "X"; then
2052       # -L didn't work.
2053       set X `ls -t $srcdir/configure conftest.file`
2054    fi
2055    rm -f conftest.file
2056    if test "$[*]" != "X $srcdir/configure conftest.file" \
2057       && test "$[*]" != "X conftest.file $srcdir/configure"; then
2058
2059       # If neither matched, then we have a broken ls.  This can happen
2060       # if, for instance, CONFIG_SHELL is bash and it inherits a
2061       # broken ls alias from the environment.  This has actually
2062       # happened.  Such a system could not be considered "sane".
2063       AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
2064 alias in your environment])
2065    fi
2066
2067    test "$[2]" = conftest.file
2068    )
2069 then
2070    # Ok.
2071    :
2072 else
2073    AC_MSG_ERROR([newly created file is older than distributed files!
2074 Check your system clock])
2075 fi
2076 AC_MSG_RESULT(yes)])
2077
2078 #  -*- Autoconf -*-
2079
2080
2081 # Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
2082
2083 # This program is free software; you can redistribute it and/or modify
2084 # it under the terms of the GNU General Public License as published by
2085 # the Free Software Foundation; either version 2, or (at your option)
2086 # any later version.
2087
2088 # This program is distributed in the hope that it will be useful,
2089 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2090 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2091 # GNU General Public License for more details.
2092
2093 # You should have received a copy of the GNU General Public License
2094 # along with this program; if not, write to the Free Software
2095 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
2096 # 02111-1307, USA.
2097
2098 # serial 3
2099
2100 # AM_MISSING_PROG(NAME, PROGRAM)
2101 # ------------------------------
2102 AC_DEFUN([AM_MISSING_PROG],
2103 [AC_REQUIRE([AM_MISSING_HAS_RUN])
2104 $1=${$1-"${am_missing_run}$2"}
2105 AC_SUBST($1)])
2106
2107
2108 # AM_MISSING_HAS_RUN
2109 # ------------------
2110 # Define MISSING if not defined so far and test if it supports --run.
2111 # If it does, set am_missing_run to use it, otherwise, to nothing.
2112 AC_DEFUN([AM_MISSING_HAS_RUN],
2113 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2114 test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
2115 # Use eval to expand $SHELL
2116 if eval "$MISSING --run true"; then
2117   am_missing_run="$MISSING --run "
2118 else
2119   am_missing_run=
2120   AC_MSG_WARN([`missing' script is too old or missing])
2121 fi
2122 ])
2123
2124 # AM_AUX_DIR_EXPAND
2125
2126 # Copyright 2001 Free Software Foundation, Inc.
2127
2128 # This program is free software; you can redistribute it and/or modify
2129 # it under the terms of the GNU General Public License as published by
2130 # the Free Software Foundation; either version 2, or (at your option)
2131 # any later version.
2132
2133 # This program is distributed in the hope that it will be useful,
2134 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2135 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2136 # GNU General Public License for more details.
2137
2138 # You should have received a copy of the GNU General Public License
2139 # along with this program; if not, write to the Free Software
2140 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
2141 # 02111-1307, USA.
2142
2143 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
2144 # $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
2145 # `$srcdir', `$srcdir/..', or `$srcdir/../..'.
2146 #
2147 # Of course, Automake must honor this variable whenever it calls a
2148 # tool from the auxiliary directory.  The problem is that $srcdir (and
2149 # therefore $ac_aux_dir as well) can be either absolute or relative,
2150 # depending on how configure is run.  This is pretty annoying, since
2151 # it makes $ac_aux_dir quite unusable in subdirectories: in the top
2152 # source directory, any form will work fine, but in subdirectories a
2153 # relative path needs to be adjusted first.
2154 #
2155 # $ac_aux_dir/missing
2156 #    fails when called from a subdirectory if $ac_aux_dir is relative
2157 # $top_srcdir/$ac_aux_dir/missing
2158 #    fails if $ac_aux_dir is absolute,
2159 #    fails when called from a subdirectory in a VPATH build with
2160 #          a relative $ac_aux_dir
2161 #
2162 # The reason of the latter failure is that $top_srcdir and $ac_aux_dir
2163 # are both prefixed by $srcdir.  In an in-source build this is usually
2164 # harmless because $srcdir is `.', but things will broke when you
2165 # start a VPATH build or use an absolute $srcdir.
2166 #
2167 # So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
2168 # iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
2169 #   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
2170 # and then we would define $MISSING as
2171 #   MISSING="\${SHELL} $am_aux_dir/missing"
2172 # This will work as long as MISSING is not called from configure, because
2173 # unfortunately $(top_srcdir) has no meaning in configure.
2174 # However there are other variables, like CC, which are often used in
2175 # configure, and could therefore not use this "fixed" $ac_aux_dir.
2176 #
2177 # Another solution, used here, is to always expand $ac_aux_dir to an
2178 # absolute PATH.  The drawback is that using absolute paths prevent a
2179 # configured tree to be moved without reconfiguration.
2180
2181 # Rely on autoconf to set up CDPATH properly.
2182 AC_PREREQ([2.50])
2183
2184 AC_DEFUN([AM_AUX_DIR_EXPAND], [
2185 # expand $ac_aux_dir to an absolute path
2186 am_aux_dir=`cd $ac_aux_dir && pwd`
2187 ])
2188
2189 # AM_PROG_INSTALL_SH
2190 # ------------------
2191 # Define $install_sh.
2192
2193 # Copyright 2001 Free Software Foundation, Inc.
2194
2195 # This program is free software; you can redistribute it and/or modify
2196 # it under the terms of the GNU General Public License as published by
2197 # the Free Software Foundation; either version 2, or (at your option)
2198 # any later version.
2199
2200 # This program is distributed in the hope that it will be useful,
2201 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2202 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2203 # GNU General Public License for more details.
2204
2205 # You should have received a copy of the GNU General Public License
2206 # along with this program; if not, write to the Free Software
2207 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
2208 # 02111-1307, USA.
2209
2210 AC_DEFUN([AM_PROG_INSTALL_SH],
2211 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
2212 install_sh=${install_sh-"$am_aux_dir/install-sh"}
2213 AC_SUBST(install_sh)])
2214
2215 # AM_PROG_INSTALL_STRIP
2216
2217 # Copyright 2001 Free Software Foundation, Inc.
2218
2219 # This program is free software; you can redistribute it and/or modify
2220 # it under the terms of the GNU General Public License as published by
2221 # the Free Software Foundation; either version 2, or (at your option)
2222 # any later version.
2223
2224 # This program is distributed in the hope that it will be useful,
2225 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2226 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2227 # GNU General Public License for more details.
2228
2229 # You should have received a copy of the GNU General Public License
2230 # along with this program; if not, write to the Free Software
2231 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
2232 # 02111-1307, USA.
2233
2234 # One issue with vendor `install' (even GNU) is that you can't
2235 # specify the program used to strip binaries.  This is especially
2236 # annoying in cross-compiling environments, where the build's strip
2237 # is unlikely to handle the host's binaries.
2238 # Fortunately install-sh will honor a STRIPPROG variable, so we
2239 # always use install-sh in `make install-strip', and initialize
2240 # STRIPPROG with the value of the STRIP variable (set by the user).
2241 AC_DEFUN([AM_PROG_INSTALL_STRIP],
2242 [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
2243 # Installed binaries are usually stripped using `strip' when the user
2244 # run `make install-strip'.  However `strip' might not be the right
2245 # tool to use in cross-compilation environments, therefore Automake
2246 # will honor the `STRIP' environment variable to overrule this program.
2247 dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
2248 if test "$cross_compiling" != no; then
2249   AC_CHECK_TOOL([STRIP], [strip], :)
2250 fi
2251 INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
2252 AC_SUBST([INSTALL_STRIP_PROGRAM])])
2253
2254 #                                                          -*- Autoconf -*-
2255 # Copyright (C) 2003  Free Software Foundation, Inc.
2256
2257 # This program is free software; you can redistribute it and/or modify
2258 # it under the terms of the GNU General Public License as published by
2259 # the Free Software Foundation; either version 2, or (at your option)
2260 # any later version.
2261
2262 # This program is distributed in the hope that it will be useful,
2263 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2264 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2265 # GNU General Public License for more details.
2266
2267 # You should have received a copy of the GNU General Public License
2268 # along with this program; if not, write to the Free Software
2269 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
2270 # 02111-1307, USA.
2271
2272 # serial 1
2273
2274 # Check whether the underlying file-system supports filenames
2275 # with a leading dot.  For instance MS-DOS doesn't.
2276 AC_DEFUN([AM_SET_LEADING_DOT],
2277 [rm -rf .tst 2>/dev/null
2278 mkdir .tst 2>/dev/null
2279 if test -d .tst; then
2280   am__leading_dot=.
2281 else
2282   am__leading_dot=_
2283 fi
2284 rmdir .tst 2>/dev/null
2285 AC_SUBST([am__leading_dot])])
2286
2287 # serial 5                                              -*- Autoconf -*-
2288
2289 # Copyright (C) 1999, 2000, 2001, 2002, 2003  Free Software Foundation, Inc.
2290
2291 # This program is free software; you can redistribute it and/or modify
2292 # it under the terms of the GNU General Public License as published by
2293 # the Free Software Foundation; either version 2, or (at your option)
2294 # any later version.
2295
2296 # This program is distributed in the hope that it will be useful,
2297 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2298 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2299 # GNU General Public License for more details.
2300
2301 # You should have received a copy of the GNU General Public License
2302 # along with this program; if not, write to the Free Software
2303 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
2304 # 02111-1307, USA.
2305
2306
2307 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
2308 # written in clear, in which case automake, when reading aclocal.m4,
2309 # will think it sees a *use*, and therefore will trigger all it's
2310 # C support machinery.  Also note that it means that autoscan, seeing
2311 # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
2312
2313
2314
2315 # _AM_DEPENDENCIES(NAME)
2316 # ----------------------
2317 # See how the compiler implements dependency checking.
2318 # NAME is "CC", "CXX", "GCJ", or "OBJC".
2319 # We try a few techniques and use that to set a single cache variable.
2320 #
2321 # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
2322 # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
2323 # dependency, and given that the user is not expected to run this macro,
2324 # just rely on AC_PROG_CC.
2325 AC_DEFUN([_AM_DEPENDENCIES],
2326 [AC_REQUIRE([AM_SET_DEPDIR])dnl
2327 AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
2328 AC_REQUIRE([AM_MAKE_INCLUDE])dnl
2329 AC_REQUIRE([AM_DEP_TRACK])dnl
2330
2331 ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
2332        [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
2333        [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
2334        [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
2335                    [depcc="$$1"   am_compiler_list=])
2336
2337 AC_CACHE_CHECK([dependency style of $depcc],
2338                [am_cv_$1_dependencies_compiler_type],
2339 [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
2340   # We make a subdir and do the tests there.  Otherwise we can end up
2341   # making bogus files that we don't know about and never remove.  For
2342   # instance it was reported that on HP-UX the gcc test will end up
2343   # making a dummy file named `D' -- because `-MD' means `put the output
2344   # in D'.
2345   mkdir conftest.dir
2346   # Copy depcomp to subdir because otherwise we won't find it if we're
2347   # using a relative directory.
2348   cp "$am_depcomp" conftest.dir
2349   cd conftest.dir
2350   # We will build objects and dependencies in a subdirectory because
2351   # it helps to detect inapplicable dependency modes.  For instance
2352   # both Tru64's cc and ICC support -MD to output dependencies as a
2353   # side effect of compilation, but ICC will put the dependencies in
2354   # the current directory while Tru64 will put them in the object
2355   # directory.
2356   mkdir sub
2357
2358   am_cv_$1_dependencies_compiler_type=none
2359   if test "$am_compiler_list" = ""; then
2360      am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
2361   fi
2362   for depmode in $am_compiler_list; do
2363     # Setup a source with many dependencies, because some compilers
2364     # like to wrap large dependency lists on column 80 (with \), and
2365     # we should not choose a depcomp mode which is confused by this.
2366     #
2367     # We need to recreate these files for each test, as the compiler may
2368     # overwrite some of them when testing with obscure command lines.
2369     # This happens at least with the AIX C compiler.
2370     : > sub/conftest.c
2371     for i in 1 2 3 4 5 6; do
2372       echo '#include "conftst'$i'.h"' >> sub/conftest.c
2373       : > sub/conftst$i.h
2374     done
2375     echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
2376
2377     case $depmode in
2378     nosideeffect)
2379       # after this tag, mechanisms are not by side-effect, so they'll
2380       # only be used when explicitly requested
2381       if test "x$enable_dependency_tracking" = xyes; then
2382         continue
2383       else
2384         break
2385       fi
2386       ;;
2387     none) break ;;
2388     esac
2389     # We check with `-c' and `-o' for the sake of the "dashmstdout"
2390     # mode.  It turns out that the SunPro C++ compiler does not properly
2391     # handle `-M -o', and we need to detect this.
2392     if depmode=$depmode \
2393        source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
2394        depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
2395        $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
2396          >/dev/null 2>conftest.err &&
2397        grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
2398        grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
2399        ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
2400       # icc doesn't choke on unknown options, it will just issue warnings
2401       # (even with -Werror).  So we grep stderr for any message
2402       # that says an option was ignored.
2403       if grep 'ignoring option' conftest.err >/dev/null 2>&1; then :; else
2404         am_cv_$1_dependencies_compiler_type=$depmode
2405         break
2406       fi
2407     fi
2408   done
2409
2410   cd ..
2411   rm -rf conftest.dir
2412 else
2413   am_cv_$1_dependencies_compiler_type=none
2414 fi
2415 ])
2416 AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
2417 AM_CONDITIONAL([am__fastdep$1], [
2418   test "x$enable_dependency_tracking" != xno \
2419   && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
2420 ])
2421
2422
2423 # AM_SET_DEPDIR
2424 # -------------
2425 # Choose a directory name for dependency files.
2426 # This macro is AC_REQUIREd in _AM_DEPENDENCIES
2427 AC_DEFUN([AM_SET_DEPDIR],
2428 [AC_REQUIRE([AM_SET_LEADING_DOT])dnl
2429 AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
2430 ])
2431
2432
2433 # AM_DEP_TRACK
2434 # ------------
2435 AC_DEFUN([AM_DEP_TRACK],
2436 [AC_ARG_ENABLE(dependency-tracking,
2437 [  --disable-dependency-tracking Speeds up one-time builds
2438   --enable-dependency-tracking  Do not reject slow dependency extractors])
2439 if test "x$enable_dependency_tracking" != xno; then
2440   am_depcomp="$ac_aux_dir/depcomp"
2441   AMDEPBACKSLASH='\'
2442 fi
2443 AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
2444 AC_SUBST([AMDEPBACKSLASH])
2445 ])
2446
2447 # Generate code to set up dependency tracking.   -*- Autoconf -*-
2448
2449 # Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
2450
2451 # This program is free software; you can redistribute it and/or modify
2452 # it under the terms of the GNU General Public License as published by
2453 # the Free Software Foundation; either version 2, or (at your option)
2454 # any later version.
2455
2456 # This program is distributed in the hope that it will be useful,
2457 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2458 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2459 # GNU General Public License for more details.
2460
2461 # You should have received a copy of the GNU General Public License
2462 # along with this program; if not, write to the Free Software
2463 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
2464 # 02111-1307, USA.
2465
2466 #serial 2
2467
2468 # _AM_OUTPUT_DEPENDENCY_COMMANDS
2469 # ------------------------------
2470 AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
2471 [for mf in $CONFIG_FILES; do
2472   # Strip MF so we end up with the name of the file.
2473   mf=`echo "$mf" | sed -e 's/:.*$//'`
2474   # Check whether this is an Automake generated Makefile or not.
2475   # We used to match only the files named `Makefile.in', but
2476   # some people rename them; so instead we look at the file content.
2477   # Grep'ing the first line is not enough: some people post-process
2478   # each Makefile.in and add a new line on top of each file to say so.
2479   # So let's grep whole file.
2480   if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
2481     dirpart=`AS_DIRNAME("$mf")`
2482   else
2483     continue
2484   fi
2485   grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue
2486   # Extract the definition of DEP_FILES from the Makefile without
2487   # running `make'.
2488   DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
2489   test -z "$DEPDIR" && continue
2490   # When using ansi2knr, U may be empty or an underscore; expand it
2491   U=`sed -n -e '/^U = / s///p' < "$mf"`
2492   test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
2493   # We invoke sed twice because it is the simplest approach to
2494   # changing $(DEPDIR) to its actual value in the expansion.
2495   for file in `sed -n -e '
2496     /^DEP_FILES = .*\\\\$/ {
2497       s/^DEP_FILES = //
2498       :loop
2499         s/\\\\$//
2500         p
2501         n
2502         /\\\\$/ b loop
2503       p
2504     }
2505     /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
2506        sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
2507     # Make sure the directory exists.
2508     test -f "$dirpart/$file" && continue
2509     fdir=`AS_DIRNAME(["$file"])`
2510     AS_MKDIR_P([$dirpart/$fdir])
2511     # echo "creating $dirpart/$file"
2512     echo '# dummy' > "$dirpart/$file"
2513   done
2514 done
2515 ])# _AM_OUTPUT_DEPENDENCY_COMMANDS
2516
2517
2518 # AM_OUTPUT_DEPENDENCY_COMMANDS
2519 # -----------------------------
2520 # This macro should only be invoked once -- use via AC_REQUIRE.
2521 #
2522 # This code is only required when automatic dependency tracking
2523 # is enabled.  FIXME.  This creates each `.P' file that we will
2524 # need in order to bootstrap the dependency handling code.
2525 AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
2526 [AC_CONFIG_COMMANDS([depfiles],
2527      [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
2528      [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
2529 ])
2530
2531 # Check to see how 'make' treats includes.      -*- Autoconf -*-
2532
2533 # Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
2534
2535 # This program is free software; you can redistribute it and/or modify
2536 # it under the terms of the GNU General Public License as published by
2537 # the Free Software Foundation; either version 2, or (at your option)
2538 # any later version.
2539
2540 # This program is distributed in the hope that it will be useful,
2541 # but WITHOUT ANY WARRANTY; without even the implied warranty of
2542 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2543 # GNU General Public License for more details.
2544
2545 # You should have received a copy of the GNU General Public License
2546 # along with this program; if not, write to the Free Software
2547 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
2548 # 02111-1307, USA.
2549
2550 # serial 2
2551
2552 # AM_MAKE_INCLUDE()
2553 # -----------------
2554 # Check to see how make treats includes.
2555 AC_DEFUN([AM_MAKE_INCLUDE],
2556 [am_make=${MAKE-make}
2557 cat > confinc << 'END'
2558 am__doit:
2559         @echo done
2560 .PHONY: am__doit
2561 END
2562 # If we don't find an include directive, just comment out the code.
2563 AC_MSG_CHECKING([for style of include used by $am_make])
2564 am__include="#"
2565 am__quote=
2566 _am_result=none
2567 # First try GNU make style include.
2568 echo "include confinc" > confmf
2569 # We grep out `Entering directory' and `Leaving directory'
2570 # messages which can occur if `w' ends up in MAKEFLAGS.
2571 # In particular we don't look at `^make:' because GNU make might
2572 # be invoked under some other name (usually "gmake"), in which
2573 # case it prints its new name instead of `make'.
2574 if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
2575    am__include=include
2576    am__quote=
2577    _am_result=GNU
2578 fi
2579 # Now try BSD make style include.
2580 if test "$am__include" = "#"; then
2581    echo '.include "confinc"' > confmf
2582    if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
2583       am__include=.include
2584       am__quote="\""
2585       _am_result=BSD
2586    fi
2587 fi
2588 AC_SUBST([am__include])
2589 AC_SUBST([am__quote])
2590 AC_MSG_RESULT([$_am_result])
2591 rm -f confinc confmf
2592 ])
2593