acinclude.m4 revision 146897
1132720Skan
297403Sobriendnl
3132720Skandnl GLIBCXX_CONDITIONAL (NAME, SHELL-TEST)
497403Sobriendnl
5132720Skandnl Exactly like AM_CONDITIONAL, but delays evaluation of the test until the
6132720Skandnl end of configure.  This lets tested variables be reassigned, and the
7132720Skandnl conditional will depend on the final state of the variable.  For a simple
8132720Skandnl example of why this is needed, see GLIBCXX_ENABLE_HOSTED.
9132720Skandnl
10132720Skanm4_define([_m4_divert(glibcxx_diversion)], 8000)dnl
11132720SkanAC_DEFUN([GLIBCXX_CONDITIONAL], [dnl
12132720Skan  m4_divert_text([glibcxx_diversion],dnl
13132720Skan   AM_CONDITIONAL([$1],[$2])
14132720Skan  )dnl
15132720Skan])dnl
16132720SkanAC_DEFUN([GLIBCXX_EVALUATE_CONDITIONALS], [m4_undivert([glibcxx_diversion])])dnl
1797403Sobrien
18132720Skan
19132720Skandnl
20132720Skandnl Check to see what architecture and operating system we are compiling
21132720Skandnl for.  Also, if architecture- or OS-specific flags are required for
22132720Skandnl compilation, pick them up here.
23132720Skandnl
24132720SkanAC_DEFUN([GLIBCXX_CHECK_HOST], [
25132720Skan  . $glibcxx_srcdir/configure.host
26132720Skan  AC_MSG_NOTICE([CPU config directory is $cpu_include_dir])
27132720Skan  AC_MSG_NOTICE([OS config directory is $os_include_dir])
28132720Skan])
29132720Skan
30132720Skan
31132720Skandnl
32132720Skandnl Initialize basic configure bits.
33132720Skandnl
34132720Skandnl Substs:
35132720Skandnl  multi_basedir
36132720Skandnl
37132720SkanAC_DEFUN([GLIBCXX_TOPREL_CONFIGURE], [
38132720Skan  # Sets up multi_basedir, which is srcdir/.. plus the usual
39132720Skan  # "multi_source_toprel_bottom_adjust" lunacy as needed.
40132720Skan  AM_ENABLE_MULTILIB(, ..)
41132720Skan
42132720Skan  # The generated code is exactly the same, except that automake's looks in
43132720Skan  # ".. $srcdir/.." and autoconf's looks in multi_basedir.  Apparently other
44132720Skan  # things are triggered on the presence of the two ...AUX_DIR[S], but I don't
45132720Skan  # know what they are or what the other differences might be (and they keep
46132720Skan  # changing anyhow).
47132720Skan  #
48132720Skan  # Looking in multi_basedir seems smarter, so actually execute that branch.
49132720Skan  if false; then
50132720Skan    # this is for automake
51132720Skan    AC_CONFIG_AUX_DIR(..)
5297403Sobrien  else
53132720Skan    # this is for autoconf
54132720Skan    AC_CONFIG_AUX_DIRS(${multi_basedir})
5597403Sobrien  fi
56132720Skan
57132720Skan  dnl XXX Turn this on.
58132720Skan  dnl AC_LANG_CPLUSPLUS
59102782Skan])
6097403Sobrien
61132720Skan
62102782Skandnl
63132720Skandnl Initialize the rest of the library configury.  At this point we have
64132720Skandnl variables like $host.
65102782Skandnl
66132720Skandnl Sets:
67132720Skandnl  gcc_version          (x.y.z format)
68132720Skandnl  SUBDIRS
69132720Skandnl Substs:
70132720Skandnl  glibcxx_builddir     (absolute path)
71132720Skandnl  glibcxx_srcdir       (absolute path)
72132720Skandnl  toplevel_srcdir      (absolute path)
73132720Skandnl  with_cross_host
74132720Skandnl  with_newlib
75132720Skandnl  with_target_subdir
76132720Skandnl plus
77132720Skandnl  - the variables in GLIBCXX_CHECK_HOST / configure.host
78132720Skandnl  - default settings for all AM_CONFITIONAL test variables
79132720Skandnl  - lots of tools, like CC and CXX
80132720Skandnl
81132720SkanAC_DEFUN([GLIBCXX_CONFIGURE], [
82132720Skan  # Keep these sync'd with the list in Makefile.am.  The first provides an
83132720Skan  # expandable list at autoconf time; the second provides an expandable list
84132720Skan  # (i.e., shell variable) at configure time.
85132720Skan  m4_define([glibcxx_SUBDIRS],[include libmath libsupc++ src po testsuite])
86132720Skan  SUBDIRS='glibcxx_SUBDIRS'
87132720Skan
8897403Sobrien  # These need to be absolute paths, yet at the same time need to
8997403Sobrien  # canonicalize only relative paths, because then amd will not unmount
9097403Sobrien  # drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
91132720Skan  glibcxx_builddir=`${PWDCMD-pwd}`
9297403Sobrien  case $srcdir in
93132720Skan    [\\/$]* | ?:[\\/]*) glibcxx_srcdir=${srcdir} ;;
94132720Skan    *) glibcxx_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
9597403Sobrien  esac
96132720Skan  toplevel_srcdir=${glibcxx_srcdir}/..
97132720Skan  AC_SUBST(glibcxx_builddir)
98132720Skan  AC_SUBST(glibcxx_srcdir)
99132720Skan  AC_SUBST(toplevel_srcdir)
10097403Sobrien
101132720Skan  # We use these options to decide which functions to include.  They are
102132720Skan  # set from the top level.
103132720Skan  AC_ARG_WITH([target-subdir],
104132720Skan    AC_HELP_STRING([--with-target-subdir=SUBDIR],
105132720Skan                   [configuring in a subdirectory]))
10697403Sobrien
107132720Skan  AC_ARG_WITH([cross-host],
108132720Skan    AC_HELP_STRING([--with-cross-host=HOST],
109132720Skan                   [configuring with a cross compiler]))
11097403Sobrien
111132720Skan  AC_ARG_WITH([newlib],
112132720Skan    AC_HELP_STRING([--with-newlib],
113132720Skan                   [assume newlib as a system C library]))
11497403Sobrien
115132720Skan  # We're almost certainly being configured before anything else which uses
116132720Skan  # C++, so all of our AC_PROG_* discoveries will be cached.  It's vital that
117132720Skan  # we not cache the value of CXX that we "discover" here, because it's set
118132720Skan  # to something unique for us and libjava.  Other target libraries need to
119132720Skan  # find CXX for themselves.  We yank the rug out from under the normal AC_*
120132720Skan  # process by sneakily renaming the cache variable.  This also lets us debug
121132720Skan  # the value of "our" CXX in postmortems.
122132720Skan  #
123132720Skan  # We must also force CXX to /not/ be a precious variable, otherwise the
124132720Skan  # wrong (non-multilib-adjusted) value will be used in multilibs.  This
125132720Skan  # little trick also affects CPPFLAGS, CXXFLAGS, and LDFLAGS.  And as a side
126132720Skan  # effect, CXXFLAGS is no longer automagically subst'd, so we have to do
127132720Skan  # that ourselves.  Un-preciousing AC_PROG_CC also affects CC and CFLAGS.
128132720Skan  #
129132720Skan  # -fno-builtin must be present here so that a non-conflicting form of
130132720Skan  # std::exit can be guessed by AC_PROG_CXX, and used in later tests.
13197403Sobrien
132132720Skan  m4_define([ac_cv_prog_CXX],[glibcxx_cv_prog_CXX])
133132720Skan  m4_rename([_AC_ARG_VAR_PRECIOUS],[glibcxx_PRECIOUS])
134132720Skan  m4_define([_AC_ARG_VAR_PRECIOUS],[])
135132720Skan  save_CXXFLAGS="$CXXFLAGS"
136132720Skan  CXXFLAGS="$CXXFLAGS -fno-builtin"
137132720Skan  AC_PROG_CC
138132720Skan  AC_PROG_CXX
139132720Skan  CXXFLAGS="$save_CXXFLAGS"
140132720Skan  m4_rename([glibcxx_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
141132720Skan  AC_SUBST(CFLAGS)
142132720Skan  AC_SUBST(CXXFLAGS)
14397403Sobrien
144102782Skan  # For directory versioning (e.g., headers) and other variables.
145102782Skan  AC_MSG_CHECKING([for GCC version number])
146132720Skan  gcc_version=`$CXX -dumpversion`
147102782Skan  AC_MSG_RESULT($gcc_version)
148102782Skan
149132720Skan  # Will set LN_S to either 'ln -s', 'ln', or 'cp -p' (if linking isn't
150132720Skan  # available).  Uncomment the next line to force a particular method.
151132720Skan  AC_PROG_LN_S
152132720Skan  #LN_S='cp -p'
15397403Sobrien
15497403Sobrien  AC_CHECK_TOOL(AS, as)
15597403Sobrien  AC_CHECK_TOOL(AR, ar)
15697403Sobrien  AC_CHECK_TOOL(RANLIB, ranlib, ranlib-not-found-in-path-error)
15797403Sobrien
15897403Sobrien  AM_MAINTAINER_MODE
15997403Sobrien
160132720Skan  # Set up safe default values for all subsequent AM_CONDITIONAL tests
161132720Skan  # which are themselves conditionally expanded.
162132720Skan  ## (Right now, this only matters for enable_wchar_t, but nothing prevents
163132720Skan  ## other macros from doing the same.  This should be automated.)  -pme
164132720Skan  need_libmath=no
165132720Skan  enable_wchar_t=no
166132720Skan  #enable_libstdcxx_debug=no
167132720Skan  #enable_libstdcxx_pch=no
168132720Skan  #enable_cheaders=c
169132720Skan  #c_compatibility=no
170132720Skan  #enable_abi_check=no
171132720Skan  #enable_symvers=no
172132720Skan  #enable_hosted_libstdcxx=yes
17397403Sobrien
174132720Skan  # Find platform-specific directories containing configuration info.
175132720Skan  # Also possibly modify flags used elsewhere, as needed by the platform.
176132720Skan  GLIBCXX_CHECK_HOST
17797403Sobrien])
17897403Sobrien
17997403Sobrien
180132720Skanm4_include([linkage.m4])
181132720Skanm4_include([../config/no-executables.m4])
18297403Sobrien
18397403Sobrien
18497403Sobriendnl
18597403Sobriendnl Tests for newer compiler features, or features that are present in newer
18697403Sobriendnl compiler versions but not older compiler versions still in use, should
18797403Sobriendnl be placed here.
18897403Sobriendnl
189132720Skandnl Defines:
190132720Skandnl  WERROR='-Werror' if requested and possible; g++'s that lack the
191132720Skandnl   new inlining code or the new system_header pragma will die on -Werror.
192132720Skandnl   Leave it out by default and use maint-mode to use it.
193132720Skandnl  SECTION_FLAGS='-ffunction-sections -fdata-sections' if
194132720Skandnl   compiler supports it and the user has not requested debug mode.
19597403Sobriendnl
196132720SkanAC_DEFUN([GLIBCXX_CHECK_COMPILER_FEATURES], [
19797403Sobrien  # All these tests are for C++; save the language and the compiler flags.
19897403Sobrien  # The CXXFLAGS thing is suspicious, but based on similar bits previously
199132720Skan  # found in GLIBCXX_CONFIGURE.
20097403Sobrien  AC_LANG_SAVE
20197403Sobrien  AC_LANG_CPLUSPLUS
20297403Sobrien  ac_test_CXXFLAGS="${CXXFLAGS+set}"
20397403Sobrien  ac_save_CXXFLAGS="$CXXFLAGS"
20497403Sobrien
20597403Sobrien  # Check for maintainer-mode bits.
20697403Sobrien  if test x"$USE_MAINTAINER_MODE" = xno; then
20797403Sobrien    WERROR=''
20897403Sobrien  else
20997403Sobrien    WERROR='-Werror'
21097403Sobrien  fi
21197403Sobrien
21297403Sobrien  # Check for -ffunction-sections -fdata-sections
21397403Sobrien  AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections])
21497403Sobrien  CXXFLAGS='-Werror -ffunction-sections -fdata-sections'
215132720Skan  AC_TRY_COMPILE(, [int foo;], [ac_fdsections=yes], [ac_fdsections=no])
21697403Sobrien  if test "$ac_test_CXXFLAGS" = set; then
21797403Sobrien    CXXFLAGS="$ac_save_CXXFLAGS"
21897403Sobrien  else
21997403Sobrien    # this is the suspicious part
22097403Sobrien    CXXFLAGS=''
22197403Sobrien  fi
222117397Skan  if test x"$ac_fdsections" = x"yes"; then
22397403Sobrien    SECTION_FLAGS='-ffunction-sections -fdata-sections'
22497403Sobrien  fi
22597403Sobrien  AC_MSG_RESULT($ac_fdsections)
22697403Sobrien
22797403Sobrien  AC_LANG_RESTORE
22897403Sobrien  AC_SUBST(WERROR)
22997403Sobrien  AC_SUBST(SECTION_FLAGS)
23097403Sobrien])
23197403Sobrien
23297403Sobrien
23397403Sobriendnl
23497403Sobriendnl If GNU ld is in use, check to see if tricky linker opts can be used.  If
23597403Sobriendnl the native linker is in use, all variables will be defined to something
23697403Sobriendnl safe (like an empty string).
23797403Sobriendnl
238132720Skandnl Defines:
239132720Skandnl  SECTION_LDFLAGS='-Wl,--gc-sections' if possible
240132720Skandnl  OPT_LDFLAGS='-Wl,-O1' if possible
241132720Skandnl  LD (as a side effect of testing)
242132720Skandnl Sets:
243132720Skandnl  with_gnu_ld
244132720Skandnl  glibcxx_gnu_ld_version (possibly)
24597403Sobriendnl
246132720Skandnl The last will be a single integer, e.g., version 1.23.45.0.67.89 will
247132720Skandnl set glibcxx_gnu_ld_version to 12345.  Zeros cause problems.
248132720Skandnl
249132720SkanAC_DEFUN([GLIBCXX_CHECK_LINKER_FEATURES], [
25097403Sobrien  # If we're not using GNU ld, then there's no point in even trying these
25197403Sobrien  # tests.  Check for that first.  We should have already tested for gld
25297403Sobrien  # by now (in libtool), but require it now just to be safe...
25397403Sobrien  test -z "$SECTION_LDFLAGS" && SECTION_LDFLAGS=''
25497403Sobrien  test -z "$OPT_LDFLAGS" && OPT_LDFLAGS=''
25597403Sobrien  AC_REQUIRE([AC_PROG_LD])
256132720Skan  AC_REQUIRE([AC_PROG_AWK])
25797403Sobrien
25897403Sobrien  # The name set by libtool depends on the version of libtool.  Shame on us
25997403Sobrien  # for depending on an impl detail, but c'est la vie.  Older versions used
26097403Sobrien  # ac_cv_prog_gnu_ld, but now it's lt_cv_prog_gnu_ld, and is copied back on
26197403Sobrien  # top of with_gnu_ld (which is also set by --with-gnu-ld, so that actually
26297403Sobrien  # makes sense).  We'll test with_gnu_ld everywhere else, so if that isn't
26397403Sobrien  # set (hence we're using an older libtool), then set it.
26497403Sobrien  if test x${with_gnu_ld+set} != xset; then
26597403Sobrien    if test x${ac_cv_prog_gnu_ld+set} != xset; then
26697403Sobrien      # We got through "ac_require(ac_prog_ld)" and still not set?  Huh?
26797403Sobrien      with_gnu_ld=no
26897403Sobrien    else
26997403Sobrien      with_gnu_ld=$ac_cv_prog_gnu_ld
27097403Sobrien    fi
27197403Sobrien  fi
27297403Sobrien
27397403Sobrien  # Start by getting the version number.  I think the libtool test already
27497403Sobrien  # does some of this, but throws away the result.
27597403Sobrien  changequote(,)
27697403Sobrien  ldver=`$LD --version 2>/dev/null | head -1 | \
27797403Sobrien         sed -e 's/GNU ld version \([0-9.][0-9.]*\).*/\1/'`
27897403Sobrien  changequote([,])
279132720Skan  glibcxx_gnu_ld_version=`echo $ldver | \
28097403Sobrien         $AWK -F. '{ if (NF<3) [$]3=0; print ([$]1*100+[$]2)*100+[$]3 }'`
28197403Sobrien
28297403Sobrien  # Set --gc-sections.
28397403Sobrien  if test "$with_gnu_ld" = "notbroken"; then
28497403Sobrien    # GNU ld it is!  Joy and bunny rabbits!
28597403Sobrien
28697403Sobrien    # All these tests are for C++; save the language and the compiler flags.
28797403Sobrien    # Need to do this so that g++ won't try to link in libstdc++
28897403Sobrien    ac_test_CFLAGS="${CFLAGS+set}"
28997403Sobrien    ac_save_CFLAGS="$CFLAGS"
29097403Sobrien    CFLAGS='-x c++  -Wl,--gc-sections'
29197403Sobrien
29297403Sobrien    # Check for -Wl,--gc-sections
293132720Skan    # XXX This test is broken at the moment, as symbols required for linking
294132720Skan    # are now in libsupc++ (not built yet).  In addition, this test has
295132720Skan    # cored on solaris in the past.  In addition, --gc-sections doesn't
296132720Skan    # really work at the moment (keeps on discarding used sections, first
297132720Skan    # .eh_frame and now some of the glibc sections for iconv).
298132720Skan    # Bzzzzt.  Thanks for playing, maybe next time.
29997403Sobrien    AC_MSG_CHECKING([for ld that supports -Wl,--gc-sections])
30097403Sobrien    AC_TRY_RUN([
301132720Skan     int main(void)
30297403Sobrien     {
30397403Sobrien       try { throw 1; }
30497403Sobrien       catch (...) { };
30597403Sobrien       return 0;
30697403Sobrien     }
30797403Sobrien    ], [ac_sectionLDflags=yes],[ac_sectionLDflags=no], [ac_sectionLDflags=yes])
30897403Sobrien    if test "$ac_test_CFLAGS" = set; then
30997403Sobrien      CFLAGS="$ac_save_CFLAGS"
31097403Sobrien    else
31197403Sobrien      # this is the suspicious part
31297403Sobrien      CFLAGS=''
31397403Sobrien    fi
31497403Sobrien    if test "$ac_sectionLDflags" = "yes"; then
31597403Sobrien      SECTION_LDFLAGS="-Wl,--gc-sections $SECTION_LDFLAGS"
31697403Sobrien    fi
31797403Sobrien    AC_MSG_RESULT($ac_sectionLDflags)
31897403Sobrien  fi
31997403Sobrien
32097403Sobrien  # Set linker optimization flags.
321117397Skan  if test x"$with_gnu_ld" = x"yes"; then
32297403Sobrien    OPT_LDFLAGS="-Wl,-O1 $OPT_LDFLAGS"
32397403Sobrien  fi
32497403Sobrien
32597403Sobrien  AC_SUBST(SECTION_LDFLAGS)
32697403Sobrien  AC_SUBST(OPT_LDFLAGS)
32797403Sobrien])
32897403Sobrien
32997403Sobrien
33097403Sobriendnl
331132720Skandnl Check to see if this target can enable the wchar_t parts.
332132720Skandnl If --disable-c-mbchar was given, no wchar_t stuff is enabled.  (This
333132720Skandnl must have been previously checked.)  By default, wide characters are
334132720Skandnl disabled.
33597403Sobriendnl
336132720Skandnl Defines:
337132720Skandnl  HAVE_MBSTATE_T if mbstate_t is not in wchar.h
338132720Skandnl  _GLIBCXX_USE_WCHAR_T if all the bits are found.
339132720Skandnl
340132720SkanAC_DEFUN([GLIBCXX_CHECK_WCHAR_T_SUPPORT], [
341132720Skan  # Test wchar.h for mbstate_t, which is needed for char_traits and
342132720Skan  # others even if wchar_t support is not on.
343132720Skan  AC_MSG_CHECKING([for mbstate_t])
344132720Skan  AC_TRY_COMPILE([#include <wchar.h>],
345132720Skan  [mbstate_t teststate;],
346132720Skan  have_mbstate_t=yes, have_mbstate_t=no)
347132720Skan  AC_MSG_RESULT($have_mbstate_t)
348132720Skan  if test x"$have_mbstate_t" = xyes; then
349132720Skan    AC_DEFINE(HAVE_MBSTATE_T)
35097403Sobrien  fi
35197403Sobrien
352132720Skan  # Sanity check for existence of ISO C99 headers for extended encoding.
353132720Skan  AC_CHECK_HEADERS(wchar.h, ac_has_wchar_h=yes, ac_has_wchar_h=no)
354132720Skan  AC_CHECK_HEADERS(wctype.h, ac_has_wctype_h=yes, ac_has_wctype_h=no)
355132720Skan
356132720Skan  # Only continue checking if the ISO C99 headers exist and support is on.
357132720Skan  if test x"$ac_has_wchar_h" = xyes &&
358132720Skan     test x"$ac_has_wctype_h" = xyes &&
359132720Skan     test x"$enable_c_mbchar" != xno; then
360132720Skan
361132720Skan    # Test wchar.h for WCHAR_MIN, WCHAR_MAX, which is needed before
362132720Skan    # numeric_limits can instantiate type_traits<wchar_t>
363132720Skan    AC_MSG_CHECKING([for WCHAR_MIN and WCHAR_MAX])
364132720Skan    AC_TRY_COMPILE([#include <wchar.h>],
365132720Skan    [int i = WCHAR_MIN; int j = WCHAR_MAX;],
366132720Skan    has_wchar_minmax=yes, has_wchar_minmax=no)
367132720Skan    AC_MSG_RESULT($has_wchar_minmax)
368132720Skan
369132720Skan    # Test wchar.h for WEOF, which is what we use to determine whether
370132720Skan    # to specialize for char_traits<wchar_t> or not.
371132720Skan    AC_MSG_CHECKING([for WEOF])
372132720Skan    AC_TRY_COMPILE([
373132720Skan      #include <wchar.h>
374132720Skan      #include <stddef.h>],
375132720Skan    [wint_t i = WEOF;],
376132720Skan    has_weof=yes, has_weof=no)
377132720Skan    AC_MSG_RESULT($has_weof)
378132720Skan
379132720Skan    # Tests for wide character functions used in char_traits<wchar_t>.
380132720Skan    ac_wfuncs=yes
381132720Skan    AC_CHECK_FUNCS([wcslen wmemchr wmemcmp wmemcpy wmemmove wmemset],
382132720Skan    [],[ac_wfuncs=no])
383132720Skan
384132720Skan    # Checks for names injected into std:: by the c_std headers.
385132720Skan    AC_CHECK_FUNCS([btowc wctob fgetwc fgetws fputwc fputws fwide \
386132720Skan    fwprintf fwscanf swprintf swscanf vfwprintf vswprintf \
387132720Skan    vwprintf wprintf wscanf getwc getwchar mbsinit mbrlen mbrtowc \
388132720Skan    mbsrtowcs wcsrtombs putwc putwchar ungetwc wcrtomb wcstod wcstol \
389132720Skan    wcstoul wcscpy wcsncpy wcscat wcsncat wcscmp wcscoll wcsncmp wcsxfrm \
390132720Skan    wcscspn wcsspn wcstok wcsftime wcschr wcspbrk wcsrchr wcsstr],
391132720Skan    [],[ac_wfuncs=no])
392132720Skan
393132720Skan    # Checks for wide character functions that are not required
394132720Skan    # for basic wchar_t support.  Don't disable support if they are missing.
395132720Skan    # Injection of these is wrapped with guard macros.
396132720Skan    AC_CHECK_FUNCS([vfwscanf vswscanf vwscanf wcstof iswblank],[],[])
397132720Skan
398132720Skan    AC_MSG_CHECKING([for ISO C99 wchar_t support])
399132720Skan    if test x"$has_weof" = xyes &&
400132720Skan       test x"$has_wchar_minmax" = xyes &&
401132720Skan       test x"$ac_wfuncs" = xyes;
402132720Skan    then
403132720Skan      ac_isoC99_wchar_t=yes
404132720Skan    else
405132720Skan      ac_isoC99_wchar_t=no
40697403Sobrien    fi
407132720Skan    AC_MSG_RESULT($ac_isoC99_wchar_t)
408132720Skan
409132720Skan    # Use iconv for wchar_t to char conversions. As such, check for
410132720Skan    # X/Open Portability Guide, version 2 features (XPG2).
411132720Skan    AC_CHECK_HEADER(iconv.h, ac_has_iconv_h=yes, ac_has_iconv_h=no)
412132720Skan    AC_CHECK_HEADER(langinfo.h, ac_has_langinfo_h=yes, ac_has_langinfo_h=no)
413132720Skan
414132720Skan    # Check for existence of libiconv.a providing XPG2 wchar_t support.
415132720Skan    AC_CHECK_LIB(iconv, iconv, libiconv="-liconv")
416132720Skan    ac_save_LIBS="$LIBS"
417132720Skan    LIBS="$LIBS $libiconv"
418132720Skan
419132720Skan    AC_CHECK_FUNCS([iconv_open iconv_close iconv nl_langinfo],
420132720Skan    [ac_XPG2funcs=yes], [ac_XPG2funcs=no])
421132720Skan
422132720Skan    LIBS="$ac_save_LIBS"
423132720Skan
424132720Skan    AC_MSG_CHECKING([for XPG2 wchar_t support])
425132720Skan    if test x"$ac_has_iconv_h" = xyes &&
426132720Skan       test x"$ac_has_langinfo_h" = xyes &&
427132720Skan       test x"$ac_XPG2funcs" = xyes;
428132720Skan    then
429132720Skan      ac_XPG2_wchar_t=yes
430132720Skan    else
431132720Skan      ac_XPG2_wchar_t=no
432132720Skan    fi
433132720Skan    AC_MSG_RESULT($ac_XPG2_wchar_t)
434132720Skan
435132720Skan    # At the moment, only enable wchar_t specializations if all the
436132720Skan    # above support is present.
437132720Skan    if test x"$ac_isoC99_wchar_t" = xyes &&
438132720Skan       test x"$ac_XPG2_wchar_t" = xyes;
439132720Skan    then
440132720Skan      AC_DEFINE(_GLIBCXX_USE_WCHAR_T)
441132720Skan      enable_wchar_t=yes
442132720Skan    fi
44397403Sobrien  fi
444132720Skan  AC_MSG_CHECKING([for enabled wchar_t specializations])
445132720Skan  AC_MSG_RESULT($enable_wchar_t)
44697403Sobrien])
44797403Sobrien
44897403Sobrien
44997403Sobriendnl
450132720Skandnl Check for headers for, and arguments to, the setrlimit() function.
451132720Skandnl Used only in testsuite_hooks.h.  Called from GLIBCXX_CONFIGURE_TESTSUITE.
452132720Skandnl
453132720Skandnl Defines:
454132720Skandnl  _GLIBCXX_RES_LIMITS if we can set artificial resource limits 
455132720Skandnl  various HAVE_LIMIT_* for individual limit names
456132720Skandnl
457132720SkanAC_DEFUN([GLIBCXX_CHECK_SETRLIMIT_ancilliary], [
458132720Skan  AC_TRY_COMPILE(
459132720Skan    [#include <unistd.h>
460132720Skan     #include <sys/time.h>
461132720Skan     #include <sys/resource.h>
462132720Skan    ],
463132720Skan    [ int f = RLIMIT_$1 ; ],
464132720Skan    [glibcxx_mresult=1], [glibcxx_mresult=0])
465132720Skan  AC_DEFINE_UNQUOTED(HAVE_LIMIT_$1, $glibcxx_mresult,
466132720Skan                     [Only used in build directory testsuite_hooks.h.])
46797403Sobrien])
46897403Sobrien
469132720SkanAC_DEFUN([GLIBCXX_CHECK_SETRLIMIT], [
470132720Skan  setrlimit_have_headers=yes
471132720Skan  AC_CHECK_HEADERS(unistd.h sys/time.h sys/resource.h,
472132720Skan                   [],
473132720Skan                   [setrlimit_have_headers=no])
474132720Skan  # If don't have the headers, then we can't run the tests now, and we
475132720Skan  # won't be seeing any of these during testsuite compilation.
476132720Skan  if test $setrlimit_have_headers = yes; then
477132720Skan    # Can't do these in a loop, else the resulting syntax is wrong.
478132720Skan    GLIBCXX_CHECK_SETRLIMIT_ancilliary(DATA)
479132720Skan    GLIBCXX_CHECK_SETRLIMIT_ancilliary(RSS)
480132720Skan    GLIBCXX_CHECK_SETRLIMIT_ancilliary(VMEM)
481132720Skan    GLIBCXX_CHECK_SETRLIMIT_ancilliary(AS)
482132720Skan    GLIBCXX_CHECK_SETRLIMIT_ancilliary(FSIZE)
483132720Skan
484132720Skan    # Check for rlimit, setrlimit.
485132720Skan    AC_CACHE_VAL(ac_setrlimit, [
486132720Skan      AC_TRY_COMPILE(
487132720Skan        [#include <unistd.h>
488132720Skan         #include <sys/time.h>
489132720Skan         #include <sys/resource.h>
490132720Skan        ],
491132720Skan        [struct rlimit r;
492132720Skan         setrlimit(0, &r);],
493132720Skan        [ac_setrlimit=yes], [ac_setrlimit=no])
49497403Sobrien    ])
49597403Sobrien  fi
49697403Sobrien
497132720Skan  AC_MSG_CHECKING([for testsuite resource limits support])
498132720Skan  if test $setrlimit_have_headers = yes && test $ac_setrlimit = yes; then
499132720Skan    ac_res_limits=yes
500132720Skan    AC_DEFINE(_GLIBCXX_RES_LIMITS)
50197403Sobrien  else
502132720Skan    ac_res_limits=no
50397403Sobrien  fi
504132720Skan  AC_MSG_RESULT($ac_res_limits)
50597403Sobrien])
50697403Sobrien
50797403Sobrien
50897403Sobriendnl
509132720Skandnl Check whether S_ISREG (Posix) or S_IFREG is available in <sys/stat.h>.
510132720Skandnl Define HAVE_S_ISREG / HAVE_S_IFREG appropriately.
51197403Sobriendnl
512132720SkanAC_DEFUN([GLIBCXX_CHECK_S_ISREG_OR_S_IFREG], [
513132720Skan  AC_CACHE_VAL(glibcxx_cv_S_ISREG, [
514132720Skan    AC_TRY_LINK(
515132720Skan      [#include <sys/stat.h>],
516132720Skan      [struct stat buffer;
517132720Skan       fstat(0, &buffer);
518132720Skan       S_ISREG(buffer.st_mode);],
519132720Skan      [glibcxx_cv_S_ISREG=yes],
520132720Skan      [glibcxx_cv_S_ISREG=no])
521132720Skan  ])
522132720Skan  AC_CACHE_VAL(glibcxx_cv_S_IFREG, [
523132720Skan    AC_TRY_LINK(
524132720Skan      [#include <sys/stat.h>],
525132720Skan      [struct stat buffer;
526132720Skan       fstat(0, &buffer);
527132720Skan       S_IFREG & buffer.st_mode;],
528132720Skan      [glibcxx_cv_S_IFREG=yes],
529132720Skan      [glibcxx_cv_S_IFREG=no])
530132720Skan  ])
531132720Skan  if test $glibcxx_cv_S_ISREG = yes; then
532132720Skan    AC_DEFINE(HAVE_S_ISREG)
533132720Skan  elif test $glibcxx_cv_S_IFREG = yes; then
534132720Skan    AC_DEFINE(HAVE_S_IFREG)
53597403Sobrien  fi
53697403Sobrien])
53797403Sobrien
538132720Skan
53997403Sobriendnl
540132720Skandnl Check whether poll is available in <poll.h>, and define HAVE_POLL.
54197403Sobriendnl
542132720SkanAC_DEFUN([GLIBCXX_CHECK_POLL], [
543132720Skan  AC_CACHE_VAL(glibcxx_cv_POLL, [
544132720Skan    AC_TRY_LINK(
545132720Skan      [#include <poll.h>],
546132720Skan      [struct pollfd pfd[1];
547132720Skan       pfd[0].events = POLLIN;
548132720Skan       poll(pfd, 1, 0);],
549132720Skan      [glibcxx_cv_POLL=yes],
550132720Skan      [glibcxx_cv_POLL=no])
551132720Skan  ])
552132720Skan  if test $glibcxx_cv_POLL = yes; then
553132720Skan    AC_DEFINE(HAVE_POLL)
55497403Sobrien  fi
55597403Sobrien])
55697403Sobrien
55797403Sobrien
55897403Sobriendnl
559132720Skandnl Check whether writev is available in <sys/uio.h>, and define HAVE_WRITEV.
56097403Sobriendnl
561132720SkanAC_DEFUN([GLIBCXX_CHECK_WRITEV], [
562132720Skan  AC_CACHE_VAL(glibcxx_cv_WRITEV, [
563132720Skan    AC_TRY_LINK(
564132720Skan      [#include <sys/uio.h>],
565132720Skan      [struct iovec iov[2];
566132720Skan       writev(0, iov, 0);],
567132720Skan      [glibcxx_cv_WRITEV=yes],
568132720Skan      [glibcxx_cv_WRITEV=no])
569132720Skan  ])
570132720Skan  if test $glibcxx_cv_WRITEV = yes; then
571132720Skan    AC_DEFINE(HAVE_WRITEV)
57297403Sobrien  fi
57397403Sobrien])
57497403Sobrien
57597403Sobrien
57697403Sobriendnl
577132720Skandnl Check whether int64_t is available in <stdint.h>, and define HAVE_INT64_T.
57897403Sobriendnl
579132720SkanAC_DEFUN([GLIBCXX_CHECK_INT64_T], [
580132720Skan  AC_CACHE_VAL(glibcxx_cv_INT64_T, [
581132720Skan    AC_TRY_COMPILE(
582132720Skan      [#include <stdint.h>],
583132720Skan      [int64_t var;],
584132720Skan      [glibcxx_cv_INT64_T=yes],
585132720Skan      [glibcxx_cv_INT64_T=no])
586132720Skan  ])
587132720Skan  if test $glibcxx_cv_INT64_T = yes; then
588132720Skan    AC_DEFINE(HAVE_INT64_T)
58997403Sobrien  fi
59097403Sobrien])
59197403Sobrien
592132720Skan
593110614Skandnl
594132720Skandnl Check whether LFS support is available.
595110614Skandnl
596132720SkanAC_DEFUN([GLIBCXX_CHECK_LFS], [
597132720Skan  AC_LANG_SAVE
598132720Skan  AC_LANG_CPLUSPLUS
599132720Skan  ac_save_CXXFLAGS="$CXXFLAGS"
600132720Skan  CXXFLAGS="$CXXFLAGS -fno-exceptions"	
601132720Skan  AC_CACHE_VAL(glibcxx_cv_LFS, [
602132720Skan    AC_TRY_LINK(
603132720Skan      [#include <unistd.h>
604132720Skan       #include <stdio.h>
605132720Skan      ],
606132720Skan      [FILE* fp;
607132720Skan       fopen64("t", "w");
608132720Skan       fseeko64(fp, 0, SEEK_CUR);
609132720Skan       ftello64(fp);
610132720Skan       lseek64(1, 0, SEEK_CUR);],	
611132720Skan      [glibcxx_cv_LFS=yes],
612132720Skan      [glibcxx_cv_LFS=no])
613132720Skan  ])
614132720Skan  if test $glibcxx_cv_LFS = yes; then
615132720Skan    AC_DEFINE(_GLIBCXX_USE_LFS)
616110614Skan  fi
617132720Skan  CXXFLAGS="$ac_save_CXXFLAGS"
618132720Skan  AC_LANG_RESTORE
619110614Skan])
62097403Sobrien
621132720Skan
62297403Sobriendnl
623146897Skandnl Check for whether a fully dynamic basic_string implementation should
624146897Skandnl be turned on, that does not put empty objects in per-process static
625146897Skandnl memory (mostly useful together with shared memory allocators, see PR
626146897Skandnl libstdc++/16612 for details).
627146897Skandnl
628146897Skandnl --enable-fully-dynamic-string defines _GLIBCXX_FULLY_DYNAMIC_STRING
629146897Skandnl --disable-fully-dynamic-string leaves _GLIBCXX_FULLY_DYNAMIC_STRING undefined
630146897Skandnl  +  Usage:  GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING[(DEFAULT)]
631146897Skandnl       Where DEFAULT is either `yes' or `no'.
632146897Skandnl
633146897SkanAC_DEFUN([GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING], [
634146897Skan  GLIBCXX_ENABLE(fully-dynamic-string,$1,,[do not put empty strings in per-process static memory])
635146897Skan  if test $enable_fully_dynamic_string = yes; then
636146897Skan    AC_DEFINE(_GLIBCXX_FULLY_DYNAMIC_STRING)
637146897Skan  fi
638146897Skan])
639146897Skan
640146897Skan
641146897Skandnl
642132720Skandnl Does any necessary configuration of the testsuite directory.  Generates
643132720Skandnl the testsuite_hooks.h header.
64497403Sobriendnl
645132720Skandnl GLIBCXX_ENABLE_SYMVERS and GLIBCXX_IS_NATIVE must be done before this.
64697403Sobriendnl
647132720Skandnl Sets:
648132720Skandnl  enable_abi_check / GLIBCXX_TEST_ABI
649132720Skandnl Substs:
650132720Skandnl  baseline_dir
65197403Sobriendnl
652132720SkanAC_DEFUN([GLIBCXX_CONFIGURE_TESTSUITE], [
653132720Skan  if $GLIBCXX_IS_NATIVE && test $is_hosted = yes; then
654132720Skan    # Do checks for resource limit functions.
655132720Skan    GLIBCXX_CHECK_SETRLIMIT
656132720Skan
657132720Skan    # Look for setenv, so that extended locale tests can be performed.
658132720Skan    GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_3(setenv)
659132720Skan
660132720Skan    if test $enable_symvers = no; then
661132720Skan      enable_abi_check=no
662132720Skan    else
663132720Skan      case "$host" in
664132720Skan        *-*-cygwin*)
665132720Skan          enable_abi_check=no ;;
666132720Skan        *)
667132720Skan          enable_abi_check=yes ;;
668132720Skan      esac
66997403Sobrien    fi
670132720Skan  else
671132720Skan    # Only build this as native, since automake does not understand
672132720Skan    # CXX_FOR_BUILD.
673132720Skan    enable_abi_check=no
67497403Sobrien  fi
675132720Skan
676132720Skan  # Export file names for ABI checking.
677132720Skan  baseline_dir="$glibcxx_srcdir/config/abi/${abi_baseline_pair}\$(MULTISUBDIR)"
678132720Skan  AC_SUBST(baseline_dir)
679132720Skan
680132720Skan  GLIBCXX_CONDITIONAL(GLIBCXX_TEST_WCHAR_T, test $enable_wchar_t = yes)
681132720Skan  GLIBCXX_CONDITIONAL(GLIBCXX_TEST_ABI, test $enable_abi_check = yes)
68297403Sobrien])
68397403Sobrien
68497403Sobrien
68597403Sobriendnl
686132720Skandnl Set up *_INCLUDES variables for all sundry Makefile.am's.
68797403Sobriendnl
688132720Skandnl Substs:
689132720Skandnl  GLIBCXX_INCLUDES
690132720Skandnl  TOPLEVEL_INCLUDES
69197403Sobriendnl
692132720SkanAC_DEFUN([GLIBCXX_EXPORT_INCLUDES], [
693132720Skan  # Used for every C++ compile we perform.
694132720Skan  GLIBCXX_INCLUDES="\
695132720Skan-I$glibcxx_builddir/include/$host_alias \
696132720Skan-I$glibcxx_builddir/include \
697132720Skan-I$glibcxx_srcdir/libsupc++"
69897403Sobrien
699132720Skan  # For Canadian crosses, pick this up too.
700132720Skan  if test $CANADIAN = yes; then
701132720Skan    GLIBCXX_INCLUDES="$GLIBCXX_INCLUDES -I\${includedir}"
702132720Skan  fi
70397403Sobrien
704132720Skan  # Stuff in the actual top level.  Currently only used by libsupc++ to
705132720Skan  # get unwind* headers from the gcc dir.
706132720Skan  #TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc -I$(toplevel_srcdir)/include'
707132720Skan  TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc'
70897403Sobrien
709132720Skan  # Now, export this to all the little Makefiles....
710132720Skan  AC_SUBST(GLIBCXX_INCLUDES)
711132720Skan  AC_SUBST(TOPLEVEL_INCLUDES)
71297403Sobrien])
71397403Sobrien
714132720Skan
71597403Sobriendnl
716132720Skandnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's.
717132720Skandnl (SECTION_FLAGS is done under CHECK_COMPILER_FEATURES.)
71897403Sobriendnl
719132720Skandnl Substs:
720132720Skandnl  OPTIMIZE_CXXFLAGS
721132720Skandnl  WARN_FLAGS
72297403Sobriendnl
723132720SkanAC_DEFUN([GLIBCXX_EXPORT_FLAGS], [
724132720Skan  # Optimization flags that are probably a good idea for thrill-seekers. Just
725132720Skan  # uncomment the lines below and make, everything else is ready to go...
726132720Skan  # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
727132720Skan  OPTIMIZE_CXXFLAGS=
728132720Skan  AC_SUBST(OPTIMIZE_CXXFLAGS)
72997403Sobrien
730132720Skan  WARN_FLAGS='-Wall -W -Wwrite-strings -Wcast-qual'
731132720Skan  AC_SUBST(WARN_FLAGS)
73297403Sobrien])
73397403Sobrien
734132720Skan
735110614Skandnl
736132720Skandnl All installation directory information is determined here.
737110614Skandnl
738132720Skandnl Substs:
739132720Skandnl  gxx_install_dir
740132720Skandnl  glibcxx_prefixdir
741132720Skandnl  glibcxx_toolexecdir
742132720Skandnl  glibcxx_toolexeclibdir
743110614Skandnl
744132720Skandnl Assumes cross_compiling bits already done, and with_cross_host in
745132720Skandnl particular.
74697403Sobriendnl
747132720SkanAC_DEFUN([GLIBCXX_EXPORT_INSTALL_INFO], [
748132720Skan  glibcxx_toolexecdir=no
749132720Skan  glibcxx_toolexeclibdir=no
750132720Skan  glibcxx_prefixdir=$prefix
75197403Sobrien
752132720Skan  AC_MSG_CHECKING([for gxx-include-dir])
753132720Skan  AC_ARG_WITH([gxx-include-dir],
754132720Skan    AC_HELP_STRING([--with-gxx-include-dir=DIR],
755132720Skan                   [installation directory for include files]),
756132720Skan    [case "$withval" in
757132720Skan      yes) AC_MSG_ERROR([Missing directory for --with-gxx-include-dir]) ;;
758132720Skan      no)  gxx_include_dir=no ;;
759132720Skan      *)   gxx_include_dir=$withval ;;
760132720Skan     esac],
761132720Skan    [gxx_include_dir=no])
762132720Skan  AC_MSG_RESULT($gxx_include_dir)
76397403Sobrien
764132720Skan  AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
765132720Skan  AC_ARG_ENABLE([version-specific-runtime-libs],
766132720Skan    AC_HELP_STRING([--enable-version-specific-runtime-libs],
767132720Skan                   [Specify that runtime libraries should be installed in a compiler-specific directory]),
768132720Skan    [case "$enableval" in
769132720Skan      yes) version_specific_libs=yes ;;
770132720Skan      no)  version_specific_libs=no ;;
771132720Skan      *)   AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
772132720Skan     esac],
773132720Skan    [version_specific_libs=no])
774132720Skan  AC_MSG_RESULT($version_specific_libs)
77597403Sobrien
776132720Skan  # Default case for install directory for include files.
777132720Skan  if test $version_specific_libs = no && test $gxx_include_dir = no; then
778132720Skan    gxx_include_dir='${prefix}'/include/c++/${gcc_version}
779132720Skan  fi
78097403Sobrien
781132720Skan  # Version-specific runtime libs processing.
782132720Skan  if test $version_specific_libs = yes; then
783132720Skan    # Need the gcc compiler version to know where to install libraries
784132720Skan    # and header files if --enable-version-specific-runtime-libs option
785132720Skan    # is selected.  FIXME: these variables are misnamed, there are
786132720Skan    # no executables installed in _toolexecdir or _toolexeclibdir.
787132720Skan    if test x"$gxx_include_dir" = x"no"; then
788132720Skan      gxx_include_dir='${libdir}/gcc/${host_alias}/'$gcc_version/include/c++
789132720Skan    fi
790132720Skan    glibcxx_toolexecdir='${libdir}/gcc/${host_alias}'
791132720Skan    glibcxx_toolexeclibdir='${toolexecdir}/'$gcc_version'$(MULTISUBDIR)'
792132720Skan  fi
79397403Sobrien
794132720Skan  # Calculate glibcxx_toolexecdir, glibcxx_toolexeclibdir
795132720Skan  # Install a library built with a cross compiler in tooldir, not libdir.
796132720Skan  if test x"$glibcxx_toolexecdir" = x"no"; then
797132720Skan    if test -n "$with_cross_host" &&
798132720Skan       test x"$with_cross_host" != x"no"; then
799132720Skan      glibcxx_toolexecdir='${exec_prefix}/${host_alias}'
800132720Skan      glibcxx_toolexeclibdir='${toolexecdir}/lib'
801132720Skan    else
802132720Skan      glibcxx_toolexecdir='${libdir}/gcc/${host_alias}'
803132720Skan      glibcxx_toolexeclibdir='${libdir}'
804132720Skan    fi
805132720Skan    multi_os_directory=`$CXX -print-multi-os-directory`
806132720Skan    case $multi_os_directory in
807132720Skan      .) ;; # Avoid trailing /.
808132720Skan      *) glibcxx_toolexeclibdir=$glibcxx_toolexeclibdir/$multi_os_directory ;;
809132720Skan    esac
810132720Skan  fi
81197403Sobrien
812132720Skan  AC_MSG_CHECKING([for install location])
813132720Skan  AC_MSG_RESULT($gxx_include_dir)
81497403Sobrien
815132720Skan  AC_SUBST(glibcxx_prefixdir)
816132720Skan  AC_SUBST(gxx_include_dir)
817132720Skan  AC_SUBST(glibcxx_toolexecdir)
818132720Skan  AC_SUBST(glibcxx_toolexeclibdir)
81997403Sobrien])
82097403Sobrien
82197403Sobrien
82297403Sobriendnl
823132720Skandnl GLIBCXX_ENABLE
824132720Skandnl    (FEATURE, DEFAULT, HELP-ARG, HELP-STRING)
825132720Skandnl    (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, permit a|b|c)
826132720Skandnl    (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, SHELL-CODE-HANDLER)
82797403Sobriendnl
828132720Skandnl See docs/html/17_intro/configury.html#enable for documentation.
82997403Sobriendnl
830132720Skanm4_define([GLIBCXX_ENABLE],[dnl
831132720Skanm4_define([_g_switch],[--enable-$1])dnl
832132720Skanm4_define([_g_help],[AC_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl
833132720Skan AC_ARG_ENABLE($1,_g_help,
834132720Skan  m4_bmatch([$5],
835132720Skan   [^permit ],
836132720Skan     [[
837132720Skan      case "$enableval" in
838132720Skan       m4_bpatsubst([$5],[permit ])) ;;
839132720Skan       *) AC_MSG_ERROR(Unknown argument to enable/disable $1) ;;
840132720Skan          dnl Idea for future:  generate a URL pointing to
841132720Skan          dnl "onlinedocs/configopts.html#whatever"
842132720Skan      esac
843132720Skan     ]],
844132720Skan   [^$],
845132720Skan     [[
846132720Skan      case "$enableval" in
847132720Skan       yes|no) ;;
848132720Skan       *) AC_MSG_ERROR(Argument to enable/disable $1 must be yes or no) ;;
849132720Skan      esac
850132720Skan     ]],
851132720Skan   [[$5]]),
852132720Skan  [enable_]m4_bpatsubst([$1],-,_)[=][$2])
853132720Skanm4_undefine([_g_switch])dnl
854132720Skanm4_undefine([_g_help])dnl
85597403Sobrien])
85697403Sobrien
85797403Sobrien
85897403Sobriendnl
859132720Skandnl Check for ISO/IEC 9899:1999 "C99" support.
86097403Sobriendnl
861132720Skandnl --enable-c99 defines _GLIBCXX_USE_C99
862132720Skandnl --disable-c99 leaves _GLIBCXX_USE_C99 undefined
863132720Skandnl  +  Usage:  GLIBCXX_ENABLE_C99[(DEFAULT)]
864132720Skandnl       Where DEFAULT is either `yes' or `no'.
865132720Skandnl  +  If 'C99' stuff is not available, ignores DEFAULT and sets `no'.
86697403Sobriendnl
867132720SkanAC_DEFUN([GLIBCXX_ENABLE_C99], [
868132720Skan  GLIBCXX_ENABLE(c99,$1,,[turns on ISO/IEC 9899:1999 support])
86997403Sobrien
870132720Skan  AC_LANG_SAVE
871132720Skan  AC_LANG_CPLUSPLUS
872132720Skan
873132720Skan  # Check for the existence of <math.h> functions used if C99 is enabled.
874132720Skan  ac_c99_math=yes;
875132720Skan  AC_MSG_CHECKING([for ISO C99 support in <math.h>])
876132720Skan  AC_TRY_COMPILE([#include <math.h>],[fpclassify(0.0);],, [ac_c99_math=no])
877132720Skan  AC_TRY_COMPILE([#include <math.h>],[isfinite(0.0);],, [ac_c99_math=no])
878132720Skan  AC_TRY_COMPILE([#include <math.h>],[isinf(0.0);],, [ac_c99_math=no])
879132720Skan  AC_TRY_COMPILE([#include <math.h>],[isnan(0.0);],, [ac_c99_math=no])
880132720Skan  AC_TRY_COMPILE([#include <math.h>],[isnormal(0.0);],, [ac_c99_math=no])
881132720Skan  AC_TRY_COMPILE([#include <math.h>],[signbit(0.0);],, [ac_c99_math=no])
882132720Skan  AC_TRY_COMPILE([#include <math.h>],[isgreater(0.0,0.0);],, [ac_c99_math=no])
883132720Skan  AC_TRY_COMPILE([#include <math.h>],
884132720Skan                 [isgreaterequal(0.0,0.0);],, [ac_c99_math=no])
885132720Skan  AC_TRY_COMPILE([#include <math.h>],[isless(0.0,0.0);],, [ac_c99_math=no])
886132720Skan  AC_TRY_COMPILE([#include <math.h>],[islessequal(0.0,0.0);],,[ac_c99_math=no])
887132720Skan  AC_TRY_COMPILE([#include <math.h>],
888132720Skan                 [islessgreater(0.0,0.0);],, [ac_c99_math=no])
889132720Skan  AC_TRY_COMPILE([#include <math.h>],
890132720Skan                 [isunordered(0.0,0.0);],, [ac_c99_math=no])
891132720Skan  AC_MSG_RESULT($ac_c99_math)
892132720Skan
893132720Skan  if test x"$ac_c99_math" = x"yes"; then
894132720Skan    AC_DEFINE(_GLIBCXX_USE_C99_MATH)
89597403Sobrien  fi
89697403Sobrien
897132720Skan  # Check for the existence in <stdio.h> of vscanf, et. al.
898132720Skan  ac_c99_stdio=yes;
899132720Skan  AC_MSG_CHECKING([for ISO C99 support in <stdio.h>])
900132720Skan  AC_TRY_COMPILE([#include <stdio.h>],
901132720Skan                 [snprintf("12", 0, "%i");],, [ac_c99_stdio=no])
902132720Skan  AC_TRY_COMPILE([#include <stdio.h>
903132720Skan                  #include <stdarg.h>
904132720Skan                  void foo(char* fmt, ...)
905132720Skan                  {va_list args; va_start(args, fmt);
906132720Skan                  vfscanf(stderr, "%i", args);}],
907132720Skan                  [],, [ac_c99_stdio=no])
908132720Skan  AC_TRY_COMPILE([#include <stdio.h>
909132720Skan                  #include <stdarg.h>
910132720Skan                  void foo(char* fmt, ...)
911132720Skan                  {va_list args; va_start(args, fmt);
912132720Skan                  vscanf("%i", args);}],
913132720Skan                  [],, [ac_c99_stdio=no])
914132720Skan  AC_TRY_COMPILE([#include <stdio.h>
915132720Skan                  #include <stdarg.h>
916132720Skan                  void foo(char* fmt, ...)
917132720Skan                  {va_list args; va_start(args, fmt);
918132720Skan                  vsnprintf(fmt, 0, "%i", args);}],
919132720Skan                  [],, [ac_c99_stdio=no])
920132720Skan  AC_TRY_COMPILE([#include <stdio.h>
921132720Skan                  #include <stdarg.h>
922132720Skan                  void foo(char* fmt, ...)
923132720Skan                  {va_list args; va_start(args, fmt);
924132720Skan                  vsscanf(fmt, "%i", args);}],
925132720Skan                  [],, [ac_c99_stdio=no])
926132720Skan  AC_MSG_RESULT($ac_c99_stdio)
92797403Sobrien
928132720Skan  # Check for the existence in <stdlib.h> of lldiv_t, et. al.
929132720Skan  ac_c99_stdlib=yes;
930132720Skan  AC_MSG_CHECKING([for lldiv_t declaration])
931132720Skan  AC_CACHE_VAL(ac_c99_lldiv_t, [
932132720Skan  AC_TRY_COMPILE([#include <stdlib.h>],
933132720Skan                   [ lldiv_t mydivt;],
934132720Skan                   [ac_c99_lldiv_t=yes], [ac_c99_lldiv_t=no])
935132720Skan  ])
936132720Skan  AC_MSG_RESULT($ac_c99_lldiv_t)
93797403Sobrien
938132720Skan  AC_MSG_CHECKING([for ISO C99 support in <stdlib.h>])
939132720Skan  AC_TRY_COMPILE([#include <stdlib.h>],
940132720Skan                 [char* tmp; strtof("gnu", &tmp);],, [ac_c99_stdlib=no])
941132720Skan  AC_TRY_COMPILE([#include <stdlib.h>],
942132720Skan                 [char* tmp; strtold("gnu", &tmp);],, [ac_c99_stdlib=no])
943132720Skan  AC_TRY_COMPILE([#include <stdlib.h>], [llabs(10);],, [ac_c99_stdlib=no])
944132720Skan  AC_TRY_COMPILE([#include <stdlib.h>], [lldiv(10,1);],, [ac_c99_stdlib=no])
945132720Skan  AC_TRY_COMPILE([#include <stdlib.h>], [atoll("10");],, [ac_c99_stdlib=no])
946132720Skan  AC_TRY_COMPILE([#include <stdlib.h>], [_Exit(0);],, [ac_c99_stdlib=no])
947132720Skan  if test x"$ac_c99_lldiv_t" = x"no"; then
948132720Skan    ac_c99_stdlib=no;
949132720Skan  fi;
950132720Skan  AC_MSG_RESULT($ac_c99_stdlib)
95197403Sobrien
952132720Skan  # Check for the existence of <wchar.h> functions used if C99 is enabled.
953132720Skan  # XXX the wchar.h checks should be rolled into the general C99 bits.
954132720Skan  ac_c99_wchar=yes;
955132720Skan  AC_MSG_CHECKING([for additional ISO C99 support in <wchar.h>])
956132720Skan  AC_TRY_COMPILE([#include <wchar.h>],
957132720Skan                 [wcstold(L"10.0", NULL);],, [ac_c99_wchar=no])
958132720Skan  AC_TRY_COMPILE([#include <wchar.h>],
959132720Skan                 [wcstoll(L"10", NULL, 10);],, [ac_c99_wchar=no])
960132720Skan  AC_TRY_COMPILE([#include <wchar.h>],
961132720Skan                 [wcstoull(L"10", NULL, 10);],, [ac_c99_wchar=no])
962132720Skan  AC_MSG_RESULT($ac_c99_wchar)
96397403Sobrien
964132720Skan  AC_MSG_CHECKING([for enabled ISO C99 support])
965132720Skan  if test x"$ac_c99_math" = x"no" ||
966132720Skan     test x"$ac_c99_stdio" = x"no" ||
967132720Skan     test x"$ac_c99_stdlib" = x"no" ||
968132720Skan     test x"$ac_c99_wchar" = x"no"; then
969132720Skan    enable_c99=no;
970132720Skan  fi;
971132720Skan  AC_MSG_RESULT($enable_c99)
972132720Skan
973132720Skan  if test x"$ac_99_math" = x"yes"; then
974132720Skan    AC_DEFINE(_GLIBCXX_USE_C99_MATH)
97597403Sobrien  fi
97697403Sobrien
977132720Skan  # Option parsed, now set things appropriately
978132720Skan  if test x"$enable_c99" = x"yes"; then
979132720Skan    AC_DEFINE(_GLIBCXX_USE_C99)
980132720Skan  fi
98197403Sobrien
982132720Skan  AC_LANG_RESTORE
983117397Skan])
98497403Sobrien
985117397Skan
986117397Skandnl
987132720Skandnl Check for what type of C headers to use.
988117397Skandnl
989132720Skandnl --enable-cheaders= [does stuff].
990132720Skandnl --disable-cheaders [does not do anything, really].
991132720Skandnl  +  Usage:  GLIBCXX_ENABLE_CHEADERS[(DEFAULT)]
992132720Skandnl       Where DEFAULT is either `c' or `c_std'.
993117397Skandnl
994132720SkanAC_DEFUN([GLIBCXX_ENABLE_CHEADERS], [
995132720Skan  GLIBCXX_ENABLE(cheaders,$1,[=KIND],
996132720Skan    [construct "C" headers for g++], [permit c|c_std])
997132720Skan  AC_MSG_NOTICE("C" header strategy set to $enable_cheaders)
998117397Skan
999132720Skan  C_INCLUDE_DIR='${glibcxx_srcdir}/include/'$enable_cheaders
1000117397Skan
1001132720Skan  AC_SUBST(C_INCLUDE_DIR)
1002132720Skan  GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C, test $enable_cheaders = c)
1003132720Skan  GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C_STD, test $enable_cheaders = c_std)
1004132720Skan  GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_COMPATIBILITY, test $c_compatibility = yes)
100597403Sobrien])
100697403Sobrien
100797403Sobrien
100897403Sobriendnl
1009132720Skandnl Check for which locale library to use.  The choice is mapped to
1010132720Skandnl a subdirectory of config/locale.
101197403Sobriendnl
1012132720Skandnl Default is generic.
101397403Sobriendnl
1014132720SkanAC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
1015132720Skan  AC_MSG_CHECKING([for C locale to use])
1016132720Skan  GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@],
1017132720Skan    [use MODEL for target locale package],
1018132720Skan    [permit generic|gnu|ieee_1003.1-2001|yes|no|auto])
1019132720Skan  
1020132720Skan  # If they didn't use this option switch, or if they specified --enable
1021132720Skan  # with no specific model, we'll have to look for one.  If they
1022132720Skan  # specified --disable (???), do likewise.
1023132720Skan  if test $enable_clocale = no || test $enable_clocale = yes; then
1024132720Skan     enable_clocale=auto
1025132720Skan  fi
102697403Sobrien
1027132720Skan  # Either a known package, or "auto"
102897403Sobrien  enable_clocale_flag=$enable_clocale
102997403Sobrien
1030132720Skan  # Probe for locale support if no specific model is specified.
1031132720Skan  # Default to "generic".
1032132720Skan  if test $enable_clocale_flag = auto; then
103397403Sobrien    case x${target_os} in
1034132720Skan      xlinux* | xgnu* | xkfreebsd*-gnu | xknetbsd*-gnu)
1035132720Skan        AC_EGREP_CPP([_GLIBCXX_ok], [
103697403Sobrien        #include <features.h>
1037132720Skan        #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
1038132720Skan          _GLIBCXX_ok
103997403Sobrien        #endif
104097403Sobrien        ], enable_clocale_flag=gnu, enable_clocale_flag=generic)
104197403Sobrien
1042132720Skan        # Test for bugs early in glibc-2.2.x series
1043132720Skan          if test x$enable_clocale_flag = xgnu; then
1044132720Skan          AC_TRY_RUN([
1045132720Skan          #define _GNU_SOURCE 1
1046132720Skan          #include <locale.h>
1047132720Skan          #include <string.h>
1048132720Skan          #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
1049132720Skan          extern __typeof(newlocale) __newlocale;
1050132720Skan          extern __typeof(duplocale) __duplocale;
1051132720Skan          extern __typeof(strcoll_l) __strcoll_l;
1052132720Skan          #endif
1053132720Skan          int main()
1054132720Skan          {
1055132720Skan              const char __one[] = "�uglein Augmen";
1056132720Skan              const char __two[] = "�uglein";
1057132720Skan              int i;
1058132720Skan              int j;
1059132720Skan              __locale_t        loc;
1060132720Skan               __locale_t        loc_dup;
1061132720Skan              loc = __newlocale(1 << LC_ALL, "de_DE", 0);
1062132720Skan              loc_dup = __duplocale(loc);
1063132720Skan              i = __strcoll_l(__one, __two, loc);
1064132720Skan              j = __strcoll_l(__one, __two, loc_dup);
1065132720Skan              return 0;
1066132720Skan          }
1067132720Skan          ],
1068132720Skan          [enable_clocale_flag=gnu],[enable_clocale_flag=generic],
1069132720Skan          [enable_clocale_flag=generic])
1070132720Skan          fi
107197403Sobrien
1072132720Skan        # ... at some point put __strxfrm_l tests in as well.
107397403Sobrien        ;;
107497403Sobrien      *)
1075132720Skan        enable_clocale_flag=generic
1076132720Skan        ;;
107797403Sobrien    esac
107897403Sobrien  fi
107997403Sobrien
1080132720Skan  # Deal with gettext issues.  Default to not using it (=no) until we detect
1081132720Skan  # support for it later.  Let the user turn it off via --e/d, but let that
1082132720Skan  # default to on for easier handling.
1083132720Skan  USE_NLS=no
108497403Sobrien  AC_ARG_ENABLE(nls,
1085132720Skan    AC_HELP_STRING([--enable-nls],[use Native Language Support (default)]),
1086132720Skan    [],
1087132720Skan    [enable_nls=yes])
108897403Sobrien
1089132720Skan  # Set configure bits for specified locale package
1090132720Skan  case ${enable_clocale_flag} in
1091132720Skan    generic)
109297403Sobrien      AC_MSG_RESULT(generic)
109397403Sobrien
109497403Sobrien      CLOCALE_H=config/locale/generic/c_locale.h
109597403Sobrien      CLOCALE_CC=config/locale/generic/c_locale.cc
109697403Sobrien      CCODECVT_H=config/locale/generic/codecvt_specializations.h
1097103447Skan      CCODECVT_CC=config/locale/generic/codecvt_members.cc
109897403Sobrien      CCOLLATE_CC=config/locale/generic/collate_members.cc
109997403Sobrien      CCTYPE_CC=config/locale/generic/ctype_members.cc
110097403Sobrien      CMESSAGES_H=config/locale/generic/messages_members.h
110197403Sobrien      CMESSAGES_CC=config/locale/generic/messages_members.cc
110297403Sobrien      CMONEY_CC=config/locale/generic/monetary_members.cc
110397403Sobrien      CNUMERIC_CC=config/locale/generic/numeric_members.cc
1104110614Skan      CTIME_H=config/locale/generic/time_members.h
110597403Sobrien      CTIME_CC=config/locale/generic/time_members.cc
1106103447Skan      CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
110797403Sobrien      ;;
1108132720Skan    gnu)
110997403Sobrien      AC_MSG_RESULT(gnu)
111097403Sobrien
111197403Sobrien      # Declare intention to use gettext, and add support for specific
111297403Sobrien      # languages.
1113102782Skan      # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
111497403Sobrien      ALL_LINGUAS="de fr"
111597403Sobrien
1116102782Skan      # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
111797403Sobrien      AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
111897403Sobrien      if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
1119132720Skan        USE_NLS=yes
112097403Sobrien      fi
112197403Sobrien      # Export the build objects.
112297403Sobrien      for ling in $ALL_LINGUAS; do \
1123132720Skan        glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
1124132720Skan        glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
112597403Sobrien      done
1126132720Skan      AC_SUBST(glibcxx_MOFILES)
1127132720Skan      AC_SUBST(glibcxx_POFILES)
112897403Sobrien
112997403Sobrien      CLOCALE_H=config/locale/gnu/c_locale.h
113097403Sobrien      CLOCALE_CC=config/locale/gnu/c_locale.cc
113197403Sobrien      CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h
1132103447Skan      CCODECVT_CC=config/locale/gnu/codecvt_members.cc
113397403Sobrien      CCOLLATE_CC=config/locale/gnu/collate_members.cc
113497403Sobrien      CCTYPE_CC=config/locale/gnu/ctype_members.cc
113597403Sobrien      CMESSAGES_H=config/locale/gnu/messages_members.h
113697403Sobrien      CMESSAGES_CC=config/locale/gnu/messages_members.cc
113797403Sobrien      CMONEY_CC=config/locale/gnu/monetary_members.cc
113897403Sobrien      CNUMERIC_CC=config/locale/gnu/numeric_members.cc
1139110614Skan      CTIME_H=config/locale/gnu/time_members.h
114097403Sobrien      CTIME_CC=config/locale/gnu/time_members.cc
1141103447Skan      CLOCALE_INTERNAL_H=config/locale/gnu/c++locale_internal.h
114297403Sobrien      ;;
1143132720Skan    ieee_1003.1-2001)
1144132720Skan      AC_MSG_RESULT(IEEE 1003.1)
114597403Sobrien
114697403Sobrien      CLOCALE_H=config/locale/ieee_1003.1-2001/c_locale.h
114797403Sobrien      CLOCALE_CC=config/locale/ieee_1003.1-2001/c_locale.cc
114897403Sobrien      CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h
1149103447Skan      CCODECVT_CC=config/locale/generic/codecvt_members.cc
115097403Sobrien      CCOLLATE_CC=config/locale/generic/collate_members.cc
115197403Sobrien      CCTYPE_CC=config/locale/generic/ctype_members.cc
115297403Sobrien      CMESSAGES_H=config/locale/ieee_1003.1-2001/messages_members.h
115397403Sobrien      CMESSAGES_CC=config/locale/ieee_1003.1-2001/messages_members.cc
115497403Sobrien      CMONEY_CC=config/locale/generic/monetary_members.cc
115597403Sobrien      CNUMERIC_CC=config/locale/generic/numeric_members.cc
1156110614Skan      CTIME_H=config/locale/generic/time_members.h
115797403Sobrien      CTIME_CC=config/locale/generic/time_members.cc
1158103447Skan      CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
115997403Sobrien      ;;
116097403Sobrien  esac
116197403Sobrien
116297403Sobrien  # This is where the testsuite looks for locale catalogs, using the
116397403Sobrien  # -DLOCALEDIR define during testsuite compilation.
1164132720Skan  glibcxx_localedir=${glibcxx_builddir}/po/share/locale
1165132720Skan  AC_SUBST(glibcxx_localedir)
116697403Sobrien
1167132720Skan  # A standalone libintl (e.g., GNU libintl) may be in use.
1168132720Skan  if test $USE_NLS = yes; then
1169132720Skan    AC_CHECK_HEADERS([libintl.h], [], USE_NLS=no)
1170132720Skan    AC_SEARCH_LIBS(gettext, intl, [], USE_NLS=no)
1171132720Skan  fi
1172132720Skan  if test $USE_NLS = yes; then
1173132720Skan    AC_DEFINE(_GLIBCXX_USE_NLS)
1174132720Skan  fi
1175132720Skan
117697403Sobrien  AC_SUBST(USE_NLS)
117797403Sobrien  AC_SUBST(CLOCALE_H)
117897403Sobrien  AC_SUBST(CCODECVT_H)
117997403Sobrien  AC_SUBST(CMESSAGES_H)
1180117397Skan  AC_SUBST(CCODECVT_CC)
1181117397Skan  AC_SUBST(CCOLLATE_CC)
1182117397Skan  AC_SUBST(CCTYPE_CC)
1183117397Skan  AC_SUBST(CMESSAGES_CC)
1184117397Skan  AC_SUBST(CMONEY_CC)
1185117397Skan  AC_SUBST(CNUMERIC_CC)
1186110614Skan  AC_SUBST(CTIME_H)
1187117397Skan  AC_SUBST(CTIME_CC)
1188117397Skan  AC_SUBST(CLOCALE_CC)
1189117397Skan  AC_SUBST(CLOCALE_INTERNAL_H)
119097403Sobrien])
119197403Sobrien
119297403Sobrien
119397403Sobriendnl
1194132720Skandnl Check for which std::allocator base class to use.  The choice is
1195132720Skandnl mapped from a subdirectory of include/ext.
119697403Sobriendnl
1197132720Skandnl Default is new.
119897403Sobriendnl
1199132720SkanAC_DEFUN([GLIBCXX_ENABLE_ALLOCATOR], [
1200132720Skan  AC_MSG_CHECKING([for std::allocator base class to use])
1201132720Skan  GLIBCXX_ENABLE(libstdcxx-allocator,auto,[=KIND],
1202132720Skan    [use KIND for target std::allocator base],
1203132720Skan    [permit new|malloc|mt|bitmap|pool|yes|no|auto])
1204132720Skan  # If they didn't use this option switch, or if they specified --enable
1205132720Skan  # with no specific model, we'll have to look for one.  If they
1206132720Skan  # specified --disable (???), do likewise.
1207132720Skan  if test $enable_libstdcxx_allocator = no || test $enable_libstdcxx_allocator = yes; then
1208132720Skan     enable_libstdcxx_allocator=auto
1209132720Skan  fi
121097403Sobrien
1211132720Skan  # Either a known package, or "auto"
1212132720Skan  enable_libstdcxx_allocator_flag=$enable_libstdcxx_allocator
121397403Sobrien
1214132720Skan  # Probe for host-specific support if no specific model is specified.
1215132720Skan  # Default to "new".
1216132720Skan  if test $enable_libstdcxx_allocator_flag = auto; then
1217132720Skan    case ${target_os} in
1218132720Skan      *)
1219132720Skan        enable_libstdcxx_allocator_flag=new
1220132720Skan        ;;
1221132720Skan    esac
1222132720Skan  fi
1223132720Skan  AC_MSG_RESULT($enable_libstdcxx_allocator_flag)
1224132720Skan  
122597403Sobrien
1226132720Skan  # Set configure bits for specified locale package
1227132720Skan  case ${enable_libstdcxx_allocator_flag} in
1228132720Skan    bitmap)
1229132720Skan      ALLOCATOR_H=config/allocator/bitmap_allocator_base.h
1230132720Skan      ALLOCATOR_NAME=__gnu_cxx::bitmap_allocator
123197403Sobrien      ;;
1232132720Skan    malloc)
1233132720Skan      ALLOCATOR_H=config/allocator/malloc_allocator_base.h
1234132720Skan      ALLOCATOR_NAME=__gnu_cxx::malloc_allocator
123597403Sobrien      ;;
1236132720Skan    mt)
1237132720Skan      ALLOCATOR_H=config/allocator/mt_allocator_base.h
1238132720Skan      ALLOCATOR_NAME=__gnu_cxx::__mt_alloc
123997403Sobrien      ;;
1240132720Skan    new)
1241132720Skan      ALLOCATOR_H=config/allocator/new_allocator_base.h
1242132720Skan      ALLOCATOR_NAME=__gnu_cxx::new_allocator
1243132720Skan      ;;
1244132720Skan    pool)
1245132720Skan      ALLOCATOR_H=config/allocator/pool_allocator_base.h
1246132720Skan      ALLOCATOR_NAME=__gnu_cxx::__pool_alloc
1247132720Skan      ;;	
124897403Sobrien  esac
124997403Sobrien
1250132720Skan  AC_SUBST(ALLOCATOR_H)
1251132720Skan  AC_SUBST(ALLOCATOR_NAME)
125297403Sobrien])
125397403Sobrien
125497403Sobrien
125597403Sobriendnl
1256132720Skandnl Check for whether the Boost-derived checks should be turned on.
125797403Sobriendnl
1258132720Skandnl --enable-concept-checks turns them on.
1259132720Skandnl --disable-concept-checks leaves them off.
1260132720Skandnl  +  Usage:  GLIBCXX_ENABLE_CONCEPT_CHECKS[(DEFAULT)]
1261132720Skandnl       Where DEFAULT is either `yes' or `no'.
1262132720Skandnl
1263132720SkanAC_DEFUN([GLIBCXX_ENABLE_CONCEPT_CHECKS], [
1264132720Skan  GLIBCXX_ENABLE(concept-checks,$1,,[use Boost-derived template checks])
1265132720Skan  if test $enable_concept_checks = yes; then
1266132720Skan    AC_DEFINE(_GLIBCXX_CONCEPT_CHECKS)
126797403Sobrien  fi
126897403Sobrien])
126997403Sobrien
127097403Sobrien
127197403Sobriendnl
1272132720Skandnl Check for which I/O library to use:  stdio, or something specific.
127397403Sobriendnl
1274132720Skandnl Default is stdio.
127597403Sobriendnl
1276132720SkanAC_DEFUN([GLIBCXX_ENABLE_CSTDIO], [
1277132720Skan  AC_MSG_CHECKING([for underlying I/O to use])
1278132720Skan  GLIBCXX_ENABLE(cstdio,stdio,[=PACKAGE],
1279132720Skan    [use target-specific I/O package], [permit stdio])
128097403Sobrien
1281132720Skan  # Now that libio has been removed, you can have any color you want as long
1282132720Skan  # as it's black.  This is one big no-op until other packages are added, but
1283132720Skan  # showing the framework never hurts.
1284132720Skan  case ${enable_cstdio} in
1285132720Skan    stdio)
1286132720Skan      CSTDIO_H=config/io/c_io_stdio.h
1287132720Skan      BASIC_FILE_H=config/io/basic_file_stdio.h
1288132720Skan      BASIC_FILE_CC=config/io/basic_file_stdio.cc
1289132720Skan      AC_MSG_RESULT(stdio)
1290132720Skan      ;;
1291132720Skan  esac
129297403Sobrien
1293132720Skan  AC_SUBST(CSTDIO_H)
1294132720Skan  AC_SUBST(BASIC_FILE_H)
1295132720Skan  AC_SUBST(BASIC_FILE_CC)
129697403Sobrien])
129797403Sobrien
129897403Sobrien
129997403Sobriendnl
1300132720Skandnl Check for "unusual" flags to pass to the compiler while building.
130197403Sobriendnl
1302132720Skandnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing
1303132720Skandnl     experimental flags such as -fpch, -fIMI, -Dfloat=char, etc.
1304132720Skandnl --disable-cxx-flags passes nothing.
1305132720Skandnl  +  See http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00131.html
1306132720Skandnl         http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00284.html
1307132720Skandnl         http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00035.html
1308132720Skandnl  +  Usage:  GLIBCXX_ENABLE_CXX_FLAGS(default flags)
1309132720Skandnl       If "default flags" is an empty string, the effect is the same
1310132720Skandnl       as --disable or --enable=no.
131197403Sobriendnl
1312132720SkanAC_DEFUN([GLIBCXX_ENABLE_CXX_FLAGS], [dnl
1313132720Skan  AC_MSG_CHECKING([for extra compiler flags for building])
1314132720Skan  GLIBCXX_ENABLE(cxx-flags,$1,[=FLAGS],
1315132720Skan    [pass compiler FLAGS when building library],
1316132720Skan    [case "x$enable_cxx_flags" in
1317132720Skan      xno | x)   enable_cxx_flags= ;;
1318132720Skan      x-*)       ;;
1319132720Skan      *)         AC_MSG_ERROR(_g_switch needs compiler flags as arguments) ;;
1320132720Skan     esac])
132197403Sobrien
1322132720Skan  # Run through flags (either default or command-line) and set anything
1323132720Skan  # extra (e.g., #defines) that must accompany particular g++ options.
1324132720Skan  if test -n "$enable_cxx_flags"; then
1325132720Skan    for f in $enable_cxx_flags; do
1326132720Skan      case "$f" in
1327132720Skan        -fhonor-std)  ;;
1328132720Skan        -*)  ;;
1329132720Skan        *)   # and we're trying to pass /what/ exactly?
1330132720Skan             AC_MSG_ERROR([compiler flags start with a -]) ;;
1331132720Skan      esac
1332132720Skan    done
133397403Sobrien  fi
133497403Sobrien
1335132720Skan  EXTRA_CXX_FLAGS="$enable_cxx_flags"
1336132720Skan  AC_MSG_RESULT($EXTRA_CXX_FLAGS)
1337132720Skan  AC_SUBST(EXTRA_CXX_FLAGS)
133897403Sobrien])
133997403Sobrien
134097403Sobrien
134197403Sobriendnl
134297403Sobriendnl Check for wide character support.  Has the same effect as the option
134397403Sobriendnl in gcc's configure, but in a form that autoconf can mess with.
134497403Sobriendnl
134597403Sobriendnl --enable-c-mbchar requests all the wchar_t stuff.
134697403Sobriendnl --disable-c-mbchar doesn't.
1347132720Skandnl  +  Usage:  GLIBCXX_ENABLE_C_MBCHAR[(DEFAULT)]
1348132720Skandnl       Where DEFAULT is either `yes' or `no'.
1349132720Skandnl
1350132720SkanAC_DEFUN([GLIBCXX_ENABLE_C_MBCHAR], [
1351132720Skan  GLIBCXX_ENABLE(c-mbchar,$1,,[enable multibyte (wide) characters])
1352132720Skan  # Option parsed, now other scripts can test enable_c_mbchar for yes/no.
135397403Sobrien])
135497403Sobrien
135597403Sobrien
135697403Sobriendnl
1357132720Skandnl Check to see if debugging libraries are to be built.
135897403Sobriendnl
1359132720Skandnl --enable-libstdcxx-debug
1360132720Skandnl builds a separate set of debugging libraries in addition to the
1361132720Skandnl normal (shared, static) libstdc++ binaries.
136297403Sobriendnl
1363132720Skandnl --disable-libstdcxx-debug
1364132720Skandnl builds only one (non-debug) version of libstdc++.
1365132720Skandnl
1366132720Skandnl --enable-libstdcxx-debug-flags=FLAGS
1367132720Skandnl iff --enable-debug == yes, then use FLAGS to build the debug library.
1368132720Skandnl
1369132720Skandnl  +  Usage:  GLIBCXX_ENABLE_DEBUG[(DEFAULT)]
1370132720Skandnl       Where DEFAULT is either `yes' or `no'.
1371132720Skandnl
1372132720SkanAC_DEFUN([GLIBCXX_ENABLE_DEBUG], [
1373132720Skan  AC_MSG_CHECKING([for additional debug build])
1374132720Skan  GLIBCXX_ENABLE(libstdcxx-debug,$1,,[build extra debug library])
1375132720Skan  AC_MSG_RESULT($enable_libstdcxx_debug)
1376132720Skan  GLIBCXX_CONDITIONAL(GLIBCXX_BUILD_DEBUG, test $enable_libstdcxx_debug = yes)
137797403Sobrien])
137897403Sobrien
137997403Sobrien
138097403Sobriendnl
1381132720Skandnl Check for explicit debug flags.
138297403Sobriendnl
1383132720Skandnl --enable-libstdcxx-debug-flags='-O1'
1384132720Skandnl is a general method for passing flags to be used when
1385132720Skandnl building debug libraries with --enable-debug.
138697403Sobriendnl
1387132720Skandnl --disable-libstdcxx-debug-flags does nothing.
1388132720Skandnl  +  Usage:  GLIBCXX_ENABLE_DEBUG_FLAGS(default flags)
1389132720Skandnl       If "default flags" is an empty string, the effect is the same
1390132720Skandnl       as --disable or --enable=no.
139197403Sobriendnl
1392132720SkanAC_DEFUN([GLIBCXX_ENABLE_DEBUG_FLAGS], [
1393132720Skan  GLIBCXX_ENABLE(libstdcxx-debug-flags,[$1],[=FLAGS],
1394132720Skan    [pass compiler FLAGS when building debug library],
1395132720Skan    [case "x$enable_libstdcxx_debug_flags" in
1396132720Skan      xno | x)    enable_libstdcxx_debug_flags= ;;
1397132720Skan      x-*)        ;;
1398132720Skan      *)          AC_MSG_ERROR(_g_switch needs compiler flags as arguments) ;;
1399132720Skan     esac])
140097403Sobrien
1401132720Skan  # Option parsed, now set things appropriately
1402132720Skan  DEBUG_FLAGS="$enable_libstdcxx_debug_flags"
1403132720Skan  AC_SUBST(DEBUG_FLAGS)
140497403Sobrien
1405132720Skan  AC_MSG_NOTICE([Debug build flags set to $DEBUG_FLAGS])
140697403Sobrien])
140797403Sobrien
140897403Sobrien
140997403Sobriendnl
1410132720Skandnl Check if the user only wants a freestanding library implementation.
141197403Sobriendnl
1412132720Skandnl --disable-hosted-libstdcxx will turn off most of the library build,
1413132720Skandnl installing only the headers required by [17.4.1.3] and the language
1414132720Skandnl support library.  More than that will be built (to keep the Makefiles
1415132720Skandnl conveniently clean), but not installed.
141697403Sobriendnl
1417132720Skandnl Sets:
1418132720Skandnl  is_hosted  (yes/no)
141997403Sobriendnl
1420132720Skandnl Defines:
1421132720Skandnl  _GLIBCXX_HOSTED   (always defined, either to 1 or 0)
142297403Sobriendnl
1423132720SkanAC_DEFUN([GLIBCXX_ENABLE_HOSTED], [
1424132720Skan  AC_ARG_ENABLE([hosted-libstdcxx],
1425132720Skan    AC_HELP_STRING([--disable-hosted-libstdcxx],
1426132720Skan                   [only build freestanding C++ runtime support]),,
1427132720Skan    [enable_hosted_libstdcxx=yes])
1428132720Skan  if test "$enable_hosted_libstdcxx" = no; then
1429132720Skan    AC_MSG_NOTICE([Only freestanding libraries will be built])
1430132720Skan    is_hosted=no
1431132720Skan    hosted_define=0
1432132720Skan    enable_abi_check=no
1433132720Skan    enable_libstdcxx_pch=no
143497403Sobrien  else
1435132720Skan    is_hosted=yes
1436132720Skan    hosted_define=1
143797403Sobrien  fi
1438132720Skan  GLIBCXX_CONDITIONAL(GLIBCXX_HOSTED, test $is_hosted = yes)
1439132720Skan  AC_DEFINE_UNQUOTED(_GLIBCXX_HOSTED, $hosted_define,
1440132720Skan    [Define to 1 if a full hosted library is built, or 0 if freestanding.])
144197403Sobrien])
144297403Sobrien
144397403Sobrien
1444132720Skandnl
1445132720Skandnl Check for template specializations for the 'long long' type extension.
1446132720Skandnl The result determines only whether 'long long' I/O is enabled; things
1447132720Skandnl like numeric_limits<> specializations are always available.
1448132720Skandnl
1449132720Skandnl --enable-long-long defines _GLIBCXX_USE_LONG_LONG
1450132720Skandnl --disable-long-long leaves _GLIBCXX_USE_LONG_LONG undefined
1451132720Skandnl  +  Usage:  GLIBCXX_ENABLE_LONG_LONG[(DEFAULT)]
1452132720Skandnl       Where DEFAULT is either `yes' or `no'.
1453132720Skandnl
1454132720SkanAC_DEFUN([GLIBCXX_ENABLE_LONG_LONG], [
1455132720Skan  GLIBCXX_ENABLE(long-long,$1,,[enables I/O support for 'long long'])
1456132720Skan  if test $enable_long_long = yes; then
1457132720Skan    AC_DEFINE(_GLIBCXX_USE_LONG_LONG)
145897403Sobrien  fi
145997403Sobrien])
146097403Sobrien
146197403Sobrien
146297403Sobriendnl
1463132720Skandnl Check to see if building and using a C++ precompiled header can be done.
146497403Sobriendnl
1465132720Skandnl --enable-libstdcxx-pch=yes
1466132720Skandnl default, this shows intent to use stdc++.h.gch If it looks like it
1467132720Skandnl may work, after some light-hearted attempts to puzzle out compiler
1468132720Skandnl support, flip bits on in include/Makefile.am
1469132720Skandnl
1470132720Skandnl --disable-libstdcxx-pch
1471132720Skandnl turns off attempts to use or build stdc++.h.gch.
1472132720Skandnl
1473132720Skandnl Substs:
1474132720Skandnl  glibcxx_PCHFLAGS
1475132720Skandnl
1476132720SkanAC_DEFUN([GLIBCXX_ENABLE_PCH], [
1477132720Skan  AC_MSG_CHECKING([for enabled PCH])
1478132720Skan  GLIBCXX_ENABLE(libstdcxx-pch,$1,,[build pre-compiled libstdc++ headers])
1479132720Skan  AC_MSG_RESULT([$enable_libstdcxx_pch])
148097403Sobrien
1481132720Skan  if test $enable_libstdcxx_pch = yes; then
1482132720Skan    AC_CACHE_CHECK([for compiler with PCH support],
1483132720Skan      [glibcxx_cv_prog_CXX_pch],
1484132720Skan      [ac_save_CXXFLAGS="$CXXFLAGS"
1485132720Skan       CXXFLAGS="$CXXFLAGS -Werror -Winvalid-pch -Wno-deprecated"
1486132720Skan       AC_LANG_SAVE
1487132720Skan       AC_LANG_CPLUSPLUS
1488132720Skan       echo '#include <math.h>' > conftest.h
1489132720Skan       if $CXX $CXXFLAGS $CPPFLAGS -x c++-header conftest.h \
1490132720Skan		          -o conftest.h.gch 1>&5 2>&1 &&
1491132720Skan	        echo '#error "pch failed"' > conftest.h &&
1492132720Skan          echo '#include "conftest.h"' > conftest.cc &&
1493132720Skan	       $CXX -c $CXXFLAGS $CPPFLAGS conftest.cc 1>&5 2>&1 ;
1494132720Skan       then
1495132720Skan         glibcxx_cv_prog_CXX_pch=yes
1496132720Skan       else
1497132720Skan         glibcxx_cv_prog_CXX_pch=no
1498132720Skan       fi
1499132720Skan       rm -f conftest*
1500132720Skan       CXXFLAGS=$ac_save_CXXFLAGS
1501132720Skan       AC_LANG_RESTORE
1502132720Skan      ])
1503132720Skan    enable_libstdcxx_pch=$glibcxx_cv_prog_CXX_pch
1504117397Skan  fi
1505102782Skan
1506132720Skan  GLIBCXX_CONDITIONAL(GLIBCXX_BUILD_PCH, test $enable_libstdcxx_pch = yes)
1507132720Skan  if test $enable_libstdcxx_pch = yes; then
1508132720Skan    glibcxx_PCHFLAGS="-include bits/stdc++.h"
1509117397Skan  else
1510132720Skan    glibcxx_PCHFLAGS=""
1511117397Skan  fi
1512132720Skan  AC_SUBST(glibcxx_PCHFLAGS)
151397403Sobrien])
151497403Sobrien
151597403Sobrien
1516117397Skandnl
1517132720Skandnl Check for exception handling support.  If an explicit enable/disable
1518132720Skandnl sjlj exceptions is given, we don't have to detect.  Otherwise the
1519132720Skandnl target may or may not support call frame exceptions.
1520117397Skandnl
1521132720Skandnl --enable-sjlj-exceptions forces the use of builtin setjmp.
1522132720Skandnl --disable-sjlj-exceptions forces the use of call frame unwinding.
1523132720Skandnl Neither one forces an attempt at detection.
1524117397Skandnl
1525132720Skandnl Defines:
1526132720Skandnl  _GLIBCXX_SJLJ_EXCEPTIONS if the compiler is configured for it
1527117397Skandnl
1528132720SkanAC_DEFUN([GLIBCXX_ENABLE_SJLJ_EXCEPTIONS], [
1529132720Skan  AC_MSG_CHECKING([for exception model to use])
1530132720Skan  AC_LANG_SAVE
1531132720Skan  AC_LANG_CPLUSPLUS
1532132720Skan  GLIBCXX_ENABLE(sjlj-exceptions,auto,,
1533132720Skan    [force use of builtin_setjmp for exceptions],
1534132720Skan    [permit yes|no|auto])
1535117397Skan
1536132720Skan  if test $enable_sjlj_exceptions = auto; then
1537132720Skan    # Botheration.  Now we've got to detect the exception model.  Link tests
1538132720Skan    # against libgcc.a are problematic since we've not been given proper -L
1539132720Skan    # bits for single-tree newlib and libgloss.
1540132720Skan    #
1541132720Skan    # Fake what AC_TRY_COMPILE does.  XXX Look at redoing this new-style.
1542132720Skan    cat > conftest.$ac_ext << EOF
1543132720Skan[#]line __oline__ "configure"
1544132720Skanstruct S { ~S(); };
1545132720Skanvoid bar();
1546132720Skanvoid foo()
1547132720Skan{
1548132720Skan  S s;
1549132720Skan  bar();
1550132720Skan}
1551132720SkanEOF
1552132720Skan    old_CXXFLAGS="$CXXFLAGS"
1553132720Skan    CXXFLAGS=-S
1554132720Skan    if AC_TRY_EVAL(ac_compile); then
1555132720Skan      if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
1556132720Skan        enable_sjlj_exceptions=yes
1557132720Skan      elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
1558132720Skan        enable_sjlj_exceptions=no
1559132720Skan      fi
1560132720Skan    fi
1561132720Skan    CXXFLAGS="$old_CXXFLAGS"
1562132720Skan    rm -f conftest*
1563117397Skan  fi
1564117397Skan
1565132720Skan  # This is a tad weird, for hysterical raisins.  We have to map enable/disable 
1566132720Skan  # to two different models.
1567132720Skan  case $enable_sjlj_exceptions in
1568132720Skan    yes)
1569132720Skan      AC_DEFINE(_GLIBCXX_SJLJ_EXCEPTIONS, 1,
1570132720Skan        [Define if the compiler is configured for setjmp/longjmp exceptions.])
1571132720Skan      ac_exception_model_name=sjlj
1572132720Skan      ;;
1573132720Skan    no)
1574132720Skan      ac_exception_model_name="call frame"
1575132720Skan      ;;
1576132720Skan    *)
1577132720Skan      AC_MSG_ERROR([unable to detect exception model])
1578132720Skan      ;;
1579132720Skan  esac
1580132720Skan AC_LANG_RESTORE
1581132720Skan AC_MSG_RESULT($ac_exception_model_name)
158297403Sobrien])
158397403Sobrien
158497403Sobrien
158597403Sobriendnl
158697403Sobriendnl Add version tags to symbols in shared library (or not), additionally
158797403Sobriendnl marking other symbols as private/local (or not).
158897403Sobriendnl
158997403Sobriendnl --enable-symvers=style adds a version script to the linker call when
159097403Sobriendnl       creating the shared library.  The choice of version script is
159197403Sobriendnl       controlled by 'style'.
159297403Sobriendnl --disable-symvers does not.
1593132720Skandnl  +  Usage:  GLIBCXX_ENABLE_SYMVERS[(DEFAULT)]
1594132720Skandnl       Where DEFAULT is either 'yes' or 'no'.  Passing `yes' tries to
1595132720Skandnl       choose a default style based on linker characteristics.  Passing
1596132720Skandnl       'no' disables versioning.
1597132720Skandnl
1598132720SkanAC_DEFUN([GLIBCXX_ENABLE_SYMVERS], [
159997403Sobrien
1600132720SkanGLIBCXX_ENABLE(symvers,$1,[=STYLE],
1601132720Skan  [enables symbol versioning of the shared library],
1602132720Skan  [permit yes|no|gnu])
1603132720Skan
1604132720Skan# If we never went through the GLIBCXX_CHECK_LINKER_FEATURES macro, then we
1605132720Skan# don't know enough about $LD to do tricks...
1606132720SkanAC_REQUIRE([GLIBCXX_CHECK_LINKER_FEATURES])
1607132720Skan# FIXME  The following test is too strict, in theory.
1608132720Skanif test $enable_shared = no ||
1609132720Skan        test "x$LD" = x ||
1610132720Skan        test x$glibcxx_gnu_ld_version = x; then
161197403Sobrien  enable_symvers=no
161297403Sobrienfi
161397403Sobrien
161497403Sobrien# Check to see if libgcc_s exists, indicating that shared libgcc is possible.
1615117397Skanif test $enable_symvers != no; then
1616117397Skan  AC_MSG_CHECKING([for shared libgcc])
1617117397Skan  ac_save_CFLAGS="$CFLAGS"
1618117397Skan  CFLAGS=' -lgcc_s'
1619132720Skan  AC_TRY_LINK(, [return 0;], glibcxx_shared_libgcc=yes, glibcxx_shared_libgcc=no)
1620117397Skan  CFLAGS="$ac_save_CFLAGS"
1621132720Skan  if test $glibcxx_shared_libgcc = no; then
1622132720Skan    cat > conftest.c <<EOF
1623132720Skanint main (void) { return 0; }
1624132720SkanEOF
1625132720Skanchangequote(,)dnl
1626132720Skan    glibcxx_libgcc_s_suffix=`${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
1627132720Skan			     -shared -shared-libgcc -o conftest.so \
1628132720Skan			     conftest.c -v 2>&1 >/dev/null \
1629132720Skan			     | sed -n 's/^.* -lgcc_s\([^ ]*\) .*$/\1/p'`
1630132720Skanchangequote([,])dnl
1631132720Skan    rm -f conftest.c conftest.so
1632132720Skan    if test x${glibcxx_libgcc_s_suffix+set} = xset; then
1633132720Skan      CFLAGS=" -lgcc_s$glibcxx_libgcc_s_suffix"
1634132720Skan      AC_TRY_LINK(, [return 0;], glibcxx_shared_libgcc=yes)
1635132720Skan      CFLAGS="$ac_save_CFLAGS"
1636132720Skan    fi
1637132720Skan  fi
1638132720Skan  AC_MSG_RESULT($glibcxx_shared_libgcc)
1639117397Skanfi
164097403Sobrien
1641132720Skan# For GNU ld, we need at least this version.  The format is described in
1642132720Skan# GLIBCXX_CHECK_LINKER_FEATURES above.
1643132720Skanglibcxx_min_gnu_ld_version=21400
1644132720Skan# XXXXXXXXXXX glibcxx_gnu_ld_version=21390
164597403Sobrien
1646132720Skan# Check to see if unspecified "yes" value can win, given results above.
1647132720Skan# Change "yes" into either "no" or a style name.
1648132720Skanif test $enable_symvers = yes; then
164997403Sobrien  if test $with_gnu_ld = yes &&
1650132720Skan     test $glibcxx_shared_libgcc = yes;
165197403Sobrien  then
1652132720Skan    if test $glibcxx_gnu_ld_version -ge $glibcxx_min_gnu_ld_version ; then
1653132720Skan      enable_symvers=gnu
165497403Sobrien    else
1655132720Skan      # The right tools, the right setup, but too old.  Fallbacks?
1656132720Skan      AC_MSG_WARN(=== Linker version $glibcxx_gnu_ld_version is too old for)
1657132720Skan      AC_MSG_WARN(=== full symbol versioning support in this release of GCC.)
1658132720Skan      AC_MSG_WARN(=== You would need to upgrade your binutils to version)
1659132720Skan      AC_MSG_WARN(=== $glibcxx_min_gnu_ld_version or later and rebuild GCC.)
1660132720Skan      if test $glibcxx_gnu_ld_version -ge 21200 ; then
1661132720Skan        # Globbing fix is present, proper block support is not.
1662132720Skan        dnl AC_MSG_WARN([=== Dude, you are soooo close.  Maybe we can fake it.])
1663132720Skan        dnl enable_symvers=???
1664132720Skan        AC_MSG_WARN([=== Symbol versioning will be disabled.])
1665132720Skan        enable_symvers=no
166697403Sobrien      else
1667132720Skan        # 2.11 or older.
1668132720Skan        AC_MSG_WARN([=== Symbol versioning will be disabled.])
1669132720Skan        enable_symvers=no
167097403Sobrien      fi
167197403Sobrien    fi
167297403Sobrien  else
167397403Sobrien    # just fail for now
1674132720Skan    AC_MSG_WARN([=== You have requested some kind of symbol versioning, but])
1675132720Skan    AC_MSG_WARN([=== either you are not using a supported linker, or you are])
1676132720Skan    AC_MSG_WARN([=== not building a shared libgcc_s (which is required).])
1677132720Skan    AC_MSG_WARN([=== Symbol versioning will be disabled.])
167897403Sobrien    enable_symvers=no
167997403Sobrien  fi
168097403Sobrienfi
168197403Sobrien
1682132720Skan# Everything parsed; figure out what file to use.
168397403Sobriencase $enable_symvers in
168497403Sobrien  no)
1685132720Skan    SYMVER_MAP=config/linker-map.dummy
1686132720Skan    ;;
168797403Sobrien  gnu)
1688132720Skan    SYMVER_MAP=config/linker-map.gnu
1689132720Skan    AC_DEFINE(_GLIBCXX_SYMVER)
1690132720Skan    ;;
169197403Sobrienesac
169297403Sobrien
1693117397SkanAC_SUBST(SYMVER_MAP)
1694132720SkanAC_SUBST(port_specific_symbol_files)
1695132720SkanGLIBCXX_CONDITIONAL(GLIBCXX_BUILD_VERSIONED_SHLIB, test $enable_symvers != no)
1696132720SkanAC_MSG_NOTICE(versioning on shared library symbols is $enable_symvers)
169797403Sobrien])
169897403Sobrien
1699132720Skan
1700132720Skandnl
1701132720Skandnl Setup to use the gcc gthr.h thread-specific memory and mutex model.
1702132720Skandnl We must stage the required headers so that they will be installed
1703132720Skandnl with the library (unlike libgcc, the STL implementation is provided
1704132720Skandnl solely within headers).  Since we must not inject random user-space
1705132720Skandnl macro names into user-provided C++ code, we first stage into <file>-in
1706132720Skandnl and process to <file> with an output command.  The reason for a two-
1707132720Skandnl stage process here is to correctly handle $srcdir!=$objdir without
1708132720Skandnl having to write complex code (the sed commands to clean the macro
1709132720Skandnl namespace are complex and fragile enough as it is).  We must also
1710132720Skandnl add a relative path so that -I- is supported properly.
1711132720Skandnl
1712132720Skandnl Substs:
1713132720Skandnl  glibcxx_thread_h
1714132720Skandnl
1715132720Skandnl Defines:
1716132720Skandnl  HAVE_GTHR_DEFAULT
1717132720Skandnl
1718132720SkanAC_DEFUN([GLIBCXX_ENABLE_THREADS], [
1719132720Skan  AC_MSG_CHECKING([for thread model used by GCC])
1720132720Skan  target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'`
1721132720Skan  AC_MSG_RESULT([$target_thread_file])
1722132720Skan
1723132720Skan  if test $target_thread_file != single; then
1724132720Skan    AC_DEFINE(HAVE_GTHR_DEFAULT)
1725132720Skan  fi
1726132720Skan
1727132720Skan  glibcxx_thread_h=gthr-$target_thread_file.h
1728132720Skan  AC_SUBST(glibcxx_thread_h)
1729132720Skan])
1730132720Skan
1731132720Skan
1732132720Skan# Check whether LC_MESSAGES is available in <locale.h>.
1733132720Skan# Ulrich Drepper <drepper@cygnus.com>, 1995.
1734132720Skan#
1735132720Skan# This file file be copied and used freely without restrictions.  It can
1736132720Skan# be used in projects which are not available under the GNU Public License
1737132720Skan# but which still want to provide support for the GNU gettext functionality.
1738132720Skan# Please note that the actual code is *not* freely available.
1739132720Skan
1740132720Skan# serial 1
1741132720SkanAC_DEFUN([AC_LC_MESSAGES], [
1742132720Skan  AC_CHECK_HEADER(locale.h, [
1743132720Skan    AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
1744132720Skan      [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1745132720Skan       ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
1746132720Skan    if test $ac_cv_val_LC_MESSAGES = yes; then
1747132720Skan      AC_DEFINE(HAVE_LC_MESSAGES)
1748132720Skan    fi
1749132720Skan  ])
1750132720Skan])
1751132720Skan
1752132720Skan
1753132720Skansinclude([../libtool.m4])
1754132720Skandnl The lines below arrange for aclocal not to bring an installed
1755132720Skandnl libtool.m4 into aclocal.m4, while still arranging for automake to
1756132720Skandnl add a definition of LIBTOOL to Makefile.in.
1757132720Skanifelse(,,,[AC_SUBST(LIBTOOL)
1758132720SkanAC_DEFUN([AM_PROG_LIBTOOL])
1759132720SkanAC_DEFUN([AC_LIBTOOL_DLOPEN])
1760132720SkanAC_DEFUN([AC_PROG_LD])
1761132720Skan])
1762132720Skan
1763132720Skandnl vim:et:ts=2:sw=2
1764