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