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