acinclude.m4 revision 132720
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
623132720Skandnl Does any necessary configuration of the testsuite directory.  Generates
624132720Skandnl the testsuite_hooks.h header.
62597403Sobriendnl
626132720Skandnl GLIBCXX_ENABLE_SYMVERS and GLIBCXX_IS_NATIVE must be done before this.
62797403Sobriendnl
628132720Skandnl Sets:
629132720Skandnl  enable_abi_check / GLIBCXX_TEST_ABI
630132720Skandnl Substs:
631132720Skandnl  baseline_dir
63297403Sobriendnl
633132720SkanAC_DEFUN([GLIBCXX_CONFIGURE_TESTSUITE], [
634132720Skan  if $GLIBCXX_IS_NATIVE && test $is_hosted = yes; then
635132720Skan    # Do checks for resource limit functions.
636132720Skan    GLIBCXX_CHECK_SETRLIMIT
637132720Skan
638132720Skan    # Look for setenv, so that extended locale tests can be performed.
639132720Skan    GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_3(setenv)
640132720Skan
641132720Skan    if test $enable_symvers = no; then
642132720Skan      enable_abi_check=no
643132720Skan    else
644132720Skan      case "$host" in
645132720Skan        *-*-cygwin*)
646132720Skan          enable_abi_check=no ;;
647132720Skan        *)
648132720Skan          enable_abi_check=yes ;;
649132720Skan      esac
65097403Sobrien    fi
651132720Skan  else
652132720Skan    # Only build this as native, since automake does not understand
653132720Skan    # CXX_FOR_BUILD.
654132720Skan    enable_abi_check=no
65597403Sobrien  fi
656132720Skan
657132720Skan  # Export file names for ABI checking.
658132720Skan  baseline_dir="$glibcxx_srcdir/config/abi/${abi_baseline_pair}\$(MULTISUBDIR)"
659132720Skan  AC_SUBST(baseline_dir)
660132720Skan
661132720Skan  GLIBCXX_CONDITIONAL(GLIBCXX_TEST_WCHAR_T, test $enable_wchar_t = yes)
662132720Skan  GLIBCXX_CONDITIONAL(GLIBCXX_TEST_ABI, test $enable_abi_check = yes)
66397403Sobrien])
66497403Sobrien
66597403Sobrien
66697403Sobriendnl
667132720Skandnl Set up *_INCLUDES variables for all sundry Makefile.am's.
66897403Sobriendnl
669132720Skandnl Substs:
670132720Skandnl  GLIBCXX_INCLUDES
671132720Skandnl  TOPLEVEL_INCLUDES
67297403Sobriendnl
673132720SkanAC_DEFUN([GLIBCXX_EXPORT_INCLUDES], [
674132720Skan  # Used for every C++ compile we perform.
675132720Skan  GLIBCXX_INCLUDES="\
676132720Skan-I$glibcxx_builddir/include/$host_alias \
677132720Skan-I$glibcxx_builddir/include \
678132720Skan-I$glibcxx_srcdir/libsupc++"
67997403Sobrien
680132720Skan  # For Canadian crosses, pick this up too.
681132720Skan  if test $CANADIAN = yes; then
682132720Skan    GLIBCXX_INCLUDES="$GLIBCXX_INCLUDES -I\${includedir}"
683132720Skan  fi
68497403Sobrien
685132720Skan  # Stuff in the actual top level.  Currently only used by libsupc++ to
686132720Skan  # get unwind* headers from the gcc dir.
687132720Skan  #TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc -I$(toplevel_srcdir)/include'
688132720Skan  TOPLEVEL_INCLUDES='-I$(toplevel_srcdir)/gcc'
68997403Sobrien
690132720Skan  # Now, export this to all the little Makefiles....
691132720Skan  AC_SUBST(GLIBCXX_INCLUDES)
692132720Skan  AC_SUBST(TOPLEVEL_INCLUDES)
69397403Sobrien])
69497403Sobrien
695132720Skan
69697403Sobriendnl
697132720Skandnl Set up *_FLAGS and *FLAGS variables for all sundry Makefile.am's.
698132720Skandnl (SECTION_FLAGS is done under CHECK_COMPILER_FEATURES.)
69997403Sobriendnl
700132720Skandnl Substs:
701132720Skandnl  OPTIMIZE_CXXFLAGS
702132720Skandnl  WARN_FLAGS
70397403Sobriendnl
704132720SkanAC_DEFUN([GLIBCXX_EXPORT_FLAGS], [
705132720Skan  # Optimization flags that are probably a good idea for thrill-seekers. Just
706132720Skan  # uncomment the lines below and make, everything else is ready to go...
707132720Skan  # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
708132720Skan  OPTIMIZE_CXXFLAGS=
709132720Skan  AC_SUBST(OPTIMIZE_CXXFLAGS)
71097403Sobrien
711132720Skan  WARN_FLAGS='-Wall -W -Wwrite-strings -Wcast-qual'
712132720Skan  AC_SUBST(WARN_FLAGS)
71397403Sobrien])
71497403Sobrien
715132720Skan
716110614Skandnl
717132720Skandnl All installation directory information is determined here.
718110614Skandnl
719132720Skandnl Substs:
720132720Skandnl  gxx_install_dir
721132720Skandnl  glibcxx_prefixdir
722132720Skandnl  glibcxx_toolexecdir
723132720Skandnl  glibcxx_toolexeclibdir
724110614Skandnl
725132720Skandnl Assumes cross_compiling bits already done, and with_cross_host in
726132720Skandnl particular.
72797403Sobriendnl
728132720SkanAC_DEFUN([GLIBCXX_EXPORT_INSTALL_INFO], [
729132720Skan  glibcxx_toolexecdir=no
730132720Skan  glibcxx_toolexeclibdir=no
731132720Skan  glibcxx_prefixdir=$prefix
73297403Sobrien
733132720Skan  AC_MSG_CHECKING([for gxx-include-dir])
734132720Skan  AC_ARG_WITH([gxx-include-dir],
735132720Skan    AC_HELP_STRING([--with-gxx-include-dir=DIR],
736132720Skan                   [installation directory for include files]),
737132720Skan    [case "$withval" in
738132720Skan      yes) AC_MSG_ERROR([Missing directory for --with-gxx-include-dir]) ;;
739132720Skan      no)  gxx_include_dir=no ;;
740132720Skan      *)   gxx_include_dir=$withval ;;
741132720Skan     esac],
742132720Skan    [gxx_include_dir=no])
743132720Skan  AC_MSG_RESULT($gxx_include_dir)
74497403Sobrien
745132720Skan  AC_MSG_CHECKING([for --enable-version-specific-runtime-libs])
746132720Skan  AC_ARG_ENABLE([version-specific-runtime-libs],
747132720Skan    AC_HELP_STRING([--enable-version-specific-runtime-libs],
748132720Skan                   [Specify that runtime libraries should be installed in a compiler-specific directory]),
749132720Skan    [case "$enableval" in
750132720Skan      yes) version_specific_libs=yes ;;
751132720Skan      no)  version_specific_libs=no ;;
752132720Skan      *)   AC_MSG_ERROR([Unknown argument to enable/disable version-specific libs]);;
753132720Skan     esac],
754132720Skan    [version_specific_libs=no])
755132720Skan  AC_MSG_RESULT($version_specific_libs)
75697403Sobrien
757132720Skan  # Default case for install directory for include files.
758132720Skan  if test $version_specific_libs = no && test $gxx_include_dir = no; then
759132720Skan    gxx_include_dir='${prefix}'/include/c++/${gcc_version}
760132720Skan  fi
76197403Sobrien
762132720Skan  # Version-specific runtime libs processing.
763132720Skan  if test $version_specific_libs = yes; then
764132720Skan    # Need the gcc compiler version to know where to install libraries
765132720Skan    # and header files if --enable-version-specific-runtime-libs option
766132720Skan    # is selected.  FIXME: these variables are misnamed, there are
767132720Skan    # no executables installed in _toolexecdir or _toolexeclibdir.
768132720Skan    if test x"$gxx_include_dir" = x"no"; then
769132720Skan      gxx_include_dir='${libdir}/gcc/${host_alias}/'$gcc_version/include/c++
770132720Skan    fi
771132720Skan    glibcxx_toolexecdir='${libdir}/gcc/${host_alias}'
772132720Skan    glibcxx_toolexeclibdir='${toolexecdir}/'$gcc_version'$(MULTISUBDIR)'
773132720Skan  fi
77497403Sobrien
775132720Skan  # Calculate glibcxx_toolexecdir, glibcxx_toolexeclibdir
776132720Skan  # Install a library built with a cross compiler in tooldir, not libdir.
777132720Skan  if test x"$glibcxx_toolexecdir" = x"no"; then
778132720Skan    if test -n "$with_cross_host" &&
779132720Skan       test x"$with_cross_host" != x"no"; then
780132720Skan      glibcxx_toolexecdir='${exec_prefix}/${host_alias}'
781132720Skan      glibcxx_toolexeclibdir='${toolexecdir}/lib'
782132720Skan    else
783132720Skan      glibcxx_toolexecdir='${libdir}/gcc/${host_alias}'
784132720Skan      glibcxx_toolexeclibdir='${libdir}'
785132720Skan    fi
786132720Skan    multi_os_directory=`$CXX -print-multi-os-directory`
787132720Skan    case $multi_os_directory in
788132720Skan      .) ;; # Avoid trailing /.
789132720Skan      *) glibcxx_toolexeclibdir=$glibcxx_toolexeclibdir/$multi_os_directory ;;
790132720Skan    esac
791132720Skan  fi
79297403Sobrien
793132720Skan  AC_MSG_CHECKING([for install location])
794132720Skan  AC_MSG_RESULT($gxx_include_dir)
79597403Sobrien
796132720Skan  AC_SUBST(glibcxx_prefixdir)
797132720Skan  AC_SUBST(gxx_include_dir)
798132720Skan  AC_SUBST(glibcxx_toolexecdir)
799132720Skan  AC_SUBST(glibcxx_toolexeclibdir)
80097403Sobrien])
80197403Sobrien
80297403Sobrien
80397403Sobriendnl
804132720Skandnl GLIBCXX_ENABLE
805132720Skandnl    (FEATURE, DEFAULT, HELP-ARG, HELP-STRING)
806132720Skandnl    (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, permit a|b|c)
807132720Skandnl    (FEATURE, DEFAULT, HELP-ARG, HELP-STRING, SHELL-CODE-HANDLER)
80897403Sobriendnl
809132720Skandnl See docs/html/17_intro/configury.html#enable for documentation.
81097403Sobriendnl
811132720Skanm4_define([GLIBCXX_ENABLE],[dnl
812132720Skanm4_define([_g_switch],[--enable-$1])dnl
813132720Skanm4_define([_g_help],[AC_HELP_STRING(_g_switch$3,[$4 @<:@default=$2@:>@])])dnl
814132720Skan AC_ARG_ENABLE($1,_g_help,
815132720Skan  m4_bmatch([$5],
816132720Skan   [^permit ],
817132720Skan     [[
818132720Skan      case "$enableval" in
819132720Skan       m4_bpatsubst([$5],[permit ])) ;;
820132720Skan       *) AC_MSG_ERROR(Unknown argument to enable/disable $1) ;;
821132720Skan          dnl Idea for future:  generate a URL pointing to
822132720Skan          dnl "onlinedocs/configopts.html#whatever"
823132720Skan      esac
824132720Skan     ]],
825132720Skan   [^$],
826132720Skan     [[
827132720Skan      case "$enableval" in
828132720Skan       yes|no) ;;
829132720Skan       *) AC_MSG_ERROR(Argument to enable/disable $1 must be yes or no) ;;
830132720Skan      esac
831132720Skan     ]],
832132720Skan   [[$5]]),
833132720Skan  [enable_]m4_bpatsubst([$1],-,_)[=][$2])
834132720Skanm4_undefine([_g_switch])dnl
835132720Skanm4_undefine([_g_help])dnl
83697403Sobrien])
83797403Sobrien
83897403Sobrien
83997403Sobriendnl
840132720Skandnl Check for ISO/IEC 9899:1999 "C99" support.
84197403Sobriendnl
842132720Skandnl --enable-c99 defines _GLIBCXX_USE_C99
843132720Skandnl --disable-c99 leaves _GLIBCXX_USE_C99 undefined
844132720Skandnl  +  Usage:  GLIBCXX_ENABLE_C99[(DEFAULT)]
845132720Skandnl       Where DEFAULT is either `yes' or `no'.
846132720Skandnl  +  If 'C99' stuff is not available, ignores DEFAULT and sets `no'.
84797403Sobriendnl
848132720SkanAC_DEFUN([GLIBCXX_ENABLE_C99], [
849132720Skan  GLIBCXX_ENABLE(c99,$1,,[turns on ISO/IEC 9899:1999 support])
85097403Sobrien
851132720Skan  AC_LANG_SAVE
852132720Skan  AC_LANG_CPLUSPLUS
853132720Skan
854132720Skan  # Check for the existence of <math.h> functions used if C99 is enabled.
855132720Skan  ac_c99_math=yes;
856132720Skan  AC_MSG_CHECKING([for ISO C99 support in <math.h>])
857132720Skan  AC_TRY_COMPILE([#include <math.h>],[fpclassify(0.0);],, [ac_c99_math=no])
858132720Skan  AC_TRY_COMPILE([#include <math.h>],[isfinite(0.0);],, [ac_c99_math=no])
859132720Skan  AC_TRY_COMPILE([#include <math.h>],[isinf(0.0);],, [ac_c99_math=no])
860132720Skan  AC_TRY_COMPILE([#include <math.h>],[isnan(0.0);],, [ac_c99_math=no])
861132720Skan  AC_TRY_COMPILE([#include <math.h>],[isnormal(0.0);],, [ac_c99_math=no])
862132720Skan  AC_TRY_COMPILE([#include <math.h>],[signbit(0.0);],, [ac_c99_math=no])
863132720Skan  AC_TRY_COMPILE([#include <math.h>],[isgreater(0.0,0.0);],, [ac_c99_math=no])
864132720Skan  AC_TRY_COMPILE([#include <math.h>],
865132720Skan                 [isgreaterequal(0.0,0.0);],, [ac_c99_math=no])
866132720Skan  AC_TRY_COMPILE([#include <math.h>],[isless(0.0,0.0);],, [ac_c99_math=no])
867132720Skan  AC_TRY_COMPILE([#include <math.h>],[islessequal(0.0,0.0);],,[ac_c99_math=no])
868132720Skan  AC_TRY_COMPILE([#include <math.h>],
869132720Skan                 [islessgreater(0.0,0.0);],, [ac_c99_math=no])
870132720Skan  AC_TRY_COMPILE([#include <math.h>],
871132720Skan                 [isunordered(0.0,0.0);],, [ac_c99_math=no])
872132720Skan  AC_MSG_RESULT($ac_c99_math)
873132720Skan
874132720Skan  if test x"$ac_c99_math" = x"yes"; then
875132720Skan    AC_DEFINE(_GLIBCXX_USE_C99_MATH)
87697403Sobrien  fi
87797403Sobrien
878132720Skan  # Check for the existence in <stdio.h> of vscanf, et. al.
879132720Skan  ac_c99_stdio=yes;
880132720Skan  AC_MSG_CHECKING([for ISO C99 support in <stdio.h>])
881132720Skan  AC_TRY_COMPILE([#include <stdio.h>],
882132720Skan                 [snprintf("12", 0, "%i");],, [ac_c99_stdio=no])
883132720Skan  AC_TRY_COMPILE([#include <stdio.h>
884132720Skan                  #include <stdarg.h>
885132720Skan                  void foo(char* fmt, ...)
886132720Skan                  {va_list args; va_start(args, fmt);
887132720Skan                  vfscanf(stderr, "%i", args);}],
888132720Skan                  [],, [ac_c99_stdio=no])
889132720Skan  AC_TRY_COMPILE([#include <stdio.h>
890132720Skan                  #include <stdarg.h>
891132720Skan                  void foo(char* fmt, ...)
892132720Skan                  {va_list args; va_start(args, fmt);
893132720Skan                  vscanf("%i", args);}],
894132720Skan                  [],, [ac_c99_stdio=no])
895132720Skan  AC_TRY_COMPILE([#include <stdio.h>
896132720Skan                  #include <stdarg.h>
897132720Skan                  void foo(char* fmt, ...)
898132720Skan                  {va_list args; va_start(args, fmt);
899132720Skan                  vsnprintf(fmt, 0, "%i", args);}],
900132720Skan                  [],, [ac_c99_stdio=no])
901132720Skan  AC_TRY_COMPILE([#include <stdio.h>
902132720Skan                  #include <stdarg.h>
903132720Skan                  void foo(char* fmt, ...)
904132720Skan                  {va_list args; va_start(args, fmt);
905132720Skan                  vsscanf(fmt, "%i", args);}],
906132720Skan                  [],, [ac_c99_stdio=no])
907132720Skan  AC_MSG_RESULT($ac_c99_stdio)
90897403Sobrien
909132720Skan  # Check for the existence in <stdlib.h> of lldiv_t, et. al.
910132720Skan  ac_c99_stdlib=yes;
911132720Skan  AC_MSG_CHECKING([for lldiv_t declaration])
912132720Skan  AC_CACHE_VAL(ac_c99_lldiv_t, [
913132720Skan  AC_TRY_COMPILE([#include <stdlib.h>],
914132720Skan                   [ lldiv_t mydivt;],
915132720Skan                   [ac_c99_lldiv_t=yes], [ac_c99_lldiv_t=no])
916132720Skan  ])
917132720Skan  AC_MSG_RESULT($ac_c99_lldiv_t)
91897403Sobrien
919132720Skan  AC_MSG_CHECKING([for ISO C99 support in <stdlib.h>])
920132720Skan  AC_TRY_COMPILE([#include <stdlib.h>],
921132720Skan                 [char* tmp; strtof("gnu", &tmp);],, [ac_c99_stdlib=no])
922132720Skan  AC_TRY_COMPILE([#include <stdlib.h>],
923132720Skan                 [char* tmp; strtold("gnu", &tmp);],, [ac_c99_stdlib=no])
924132720Skan  AC_TRY_COMPILE([#include <stdlib.h>], [llabs(10);],, [ac_c99_stdlib=no])
925132720Skan  AC_TRY_COMPILE([#include <stdlib.h>], [lldiv(10,1);],, [ac_c99_stdlib=no])
926132720Skan  AC_TRY_COMPILE([#include <stdlib.h>], [atoll("10");],, [ac_c99_stdlib=no])
927132720Skan  AC_TRY_COMPILE([#include <stdlib.h>], [_Exit(0);],, [ac_c99_stdlib=no])
928132720Skan  if test x"$ac_c99_lldiv_t" = x"no"; then
929132720Skan    ac_c99_stdlib=no;
930132720Skan  fi;
931132720Skan  AC_MSG_RESULT($ac_c99_stdlib)
93297403Sobrien
933132720Skan  # Check for the existence of <wchar.h> functions used if C99 is enabled.
934132720Skan  # XXX the wchar.h checks should be rolled into the general C99 bits.
935132720Skan  ac_c99_wchar=yes;
936132720Skan  AC_MSG_CHECKING([for additional ISO C99 support in <wchar.h>])
937132720Skan  AC_TRY_COMPILE([#include <wchar.h>],
938132720Skan                 [wcstold(L"10.0", NULL);],, [ac_c99_wchar=no])
939132720Skan  AC_TRY_COMPILE([#include <wchar.h>],
940132720Skan                 [wcstoll(L"10", NULL, 10);],, [ac_c99_wchar=no])
941132720Skan  AC_TRY_COMPILE([#include <wchar.h>],
942132720Skan                 [wcstoull(L"10", NULL, 10);],, [ac_c99_wchar=no])
943132720Skan  AC_MSG_RESULT($ac_c99_wchar)
94497403Sobrien
945132720Skan  AC_MSG_CHECKING([for enabled ISO C99 support])
946132720Skan  if test x"$ac_c99_math" = x"no" ||
947132720Skan     test x"$ac_c99_stdio" = x"no" ||
948132720Skan     test x"$ac_c99_stdlib" = x"no" ||
949132720Skan     test x"$ac_c99_wchar" = x"no"; then
950132720Skan    enable_c99=no;
951132720Skan  fi;
952132720Skan  AC_MSG_RESULT($enable_c99)
953132720Skan
954132720Skan  if test x"$ac_99_math" = x"yes"; then
955132720Skan    AC_DEFINE(_GLIBCXX_USE_C99_MATH)
95697403Sobrien  fi
95797403Sobrien
958132720Skan  # Option parsed, now set things appropriately
959132720Skan  if test x"$enable_c99" = x"yes"; then
960132720Skan    AC_DEFINE(_GLIBCXX_USE_C99)
961132720Skan  fi
96297403Sobrien
963132720Skan  AC_LANG_RESTORE
964117397Skan])
96597403Sobrien
966117397Skan
967117397Skandnl
968132720Skandnl Check for what type of C headers to use.
969117397Skandnl
970132720Skandnl --enable-cheaders= [does stuff].
971132720Skandnl --disable-cheaders [does not do anything, really].
972132720Skandnl  +  Usage:  GLIBCXX_ENABLE_CHEADERS[(DEFAULT)]
973132720Skandnl       Where DEFAULT is either `c' or `c_std'.
974117397Skandnl
975132720SkanAC_DEFUN([GLIBCXX_ENABLE_CHEADERS], [
976132720Skan  GLIBCXX_ENABLE(cheaders,$1,[=KIND],
977132720Skan    [construct "C" headers for g++], [permit c|c_std])
978132720Skan  AC_MSG_NOTICE("C" header strategy set to $enable_cheaders)
979117397Skan
980132720Skan  C_INCLUDE_DIR='${glibcxx_srcdir}/include/'$enable_cheaders
981117397Skan
982132720Skan  AC_SUBST(C_INCLUDE_DIR)
983132720Skan  GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C, test $enable_cheaders = c)
984132720Skan  GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_C_STD, test $enable_cheaders = c_std)
985132720Skan  GLIBCXX_CONDITIONAL(GLIBCXX_C_HEADERS_COMPATIBILITY, test $c_compatibility = yes)
98697403Sobrien])
98797403Sobrien
98897403Sobrien
98997403Sobriendnl
990132720Skandnl Check for which locale library to use.  The choice is mapped to
991132720Skandnl a subdirectory of config/locale.
99297403Sobriendnl
993132720Skandnl Default is generic.
99497403Sobriendnl
995132720SkanAC_DEFUN([GLIBCXX_ENABLE_CLOCALE], [
996132720Skan  AC_MSG_CHECKING([for C locale to use])
997132720Skan  GLIBCXX_ENABLE(clocale,auto,[@<:@=MODEL@:>@],
998132720Skan    [use MODEL for target locale package],
999132720Skan    [permit generic|gnu|ieee_1003.1-2001|yes|no|auto])
1000132720Skan  
1001132720Skan  # If they didn't use this option switch, or if they specified --enable
1002132720Skan  # with no specific model, we'll have to look for one.  If they
1003132720Skan  # specified --disable (???), do likewise.
1004132720Skan  if test $enable_clocale = no || test $enable_clocale = yes; then
1005132720Skan     enable_clocale=auto
1006132720Skan  fi
100797403Sobrien
1008132720Skan  # Either a known package, or "auto"
100997403Sobrien  enable_clocale_flag=$enable_clocale
101097403Sobrien
1011132720Skan  # Probe for locale support if no specific model is specified.
1012132720Skan  # Default to "generic".
1013132720Skan  if test $enable_clocale_flag = auto; then
101497403Sobrien    case x${target_os} in
1015132720Skan      xlinux* | xgnu* | xkfreebsd*-gnu | xknetbsd*-gnu)
1016132720Skan        AC_EGREP_CPP([_GLIBCXX_ok], [
101797403Sobrien        #include <features.h>
1018132720Skan        #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)
1019132720Skan          _GLIBCXX_ok
102097403Sobrien        #endif
102197403Sobrien        ], enable_clocale_flag=gnu, enable_clocale_flag=generic)
102297403Sobrien
1023132720Skan        # Test for bugs early in glibc-2.2.x series
1024132720Skan          if test x$enable_clocale_flag = xgnu; then
1025132720Skan          AC_TRY_RUN([
1026132720Skan          #define _GNU_SOURCE 1
1027132720Skan          #include <locale.h>
1028132720Skan          #include <string.h>
1029132720Skan          #if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2)
1030132720Skan          extern __typeof(newlocale) __newlocale;
1031132720Skan          extern __typeof(duplocale) __duplocale;
1032132720Skan          extern __typeof(strcoll_l) __strcoll_l;
1033132720Skan          #endif
1034132720Skan          int main()
1035132720Skan          {
1036132720Skan              const char __one[] = "�uglein Augmen";
1037132720Skan              const char __two[] = "�uglein";
1038132720Skan              int i;
1039132720Skan              int j;
1040132720Skan              __locale_t        loc;
1041132720Skan               __locale_t        loc_dup;
1042132720Skan              loc = __newlocale(1 << LC_ALL, "de_DE", 0);
1043132720Skan              loc_dup = __duplocale(loc);
1044132720Skan              i = __strcoll_l(__one, __two, loc);
1045132720Skan              j = __strcoll_l(__one, __two, loc_dup);
1046132720Skan              return 0;
1047132720Skan          }
1048132720Skan          ],
1049132720Skan          [enable_clocale_flag=gnu],[enable_clocale_flag=generic],
1050132720Skan          [enable_clocale_flag=generic])
1051132720Skan          fi
105297403Sobrien
1053132720Skan        # ... at some point put __strxfrm_l tests in as well.
105497403Sobrien        ;;
105597403Sobrien      *)
1056132720Skan        enable_clocale_flag=generic
1057132720Skan        ;;
105897403Sobrien    esac
105997403Sobrien  fi
106097403Sobrien
1061132720Skan  # Deal with gettext issues.  Default to not using it (=no) until we detect
1062132720Skan  # support for it later.  Let the user turn it off via --e/d, but let that
1063132720Skan  # default to on for easier handling.
1064132720Skan  USE_NLS=no
106597403Sobrien  AC_ARG_ENABLE(nls,
1066132720Skan    AC_HELP_STRING([--enable-nls],[use Native Language Support (default)]),
1067132720Skan    [],
1068132720Skan    [enable_nls=yes])
106997403Sobrien
1070132720Skan  # Set configure bits for specified locale package
1071132720Skan  case ${enable_clocale_flag} in
1072132720Skan    generic)
107397403Sobrien      AC_MSG_RESULT(generic)
107497403Sobrien
107597403Sobrien      CLOCALE_H=config/locale/generic/c_locale.h
107697403Sobrien      CLOCALE_CC=config/locale/generic/c_locale.cc
107797403Sobrien      CCODECVT_H=config/locale/generic/codecvt_specializations.h
1078103447Skan      CCODECVT_CC=config/locale/generic/codecvt_members.cc
107997403Sobrien      CCOLLATE_CC=config/locale/generic/collate_members.cc
108097403Sobrien      CCTYPE_CC=config/locale/generic/ctype_members.cc
108197403Sobrien      CMESSAGES_H=config/locale/generic/messages_members.h
108297403Sobrien      CMESSAGES_CC=config/locale/generic/messages_members.cc
108397403Sobrien      CMONEY_CC=config/locale/generic/monetary_members.cc
108497403Sobrien      CNUMERIC_CC=config/locale/generic/numeric_members.cc
1085110614Skan      CTIME_H=config/locale/generic/time_members.h
108697403Sobrien      CTIME_CC=config/locale/generic/time_members.cc
1087103447Skan      CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
108897403Sobrien      ;;
1089132720Skan    gnu)
109097403Sobrien      AC_MSG_RESULT(gnu)
109197403Sobrien
109297403Sobrien      # Declare intention to use gettext, and add support for specific
109397403Sobrien      # languages.
1094102782Skan      # For some reason, ALL_LINGUAS has to be before AM-GNU-GETTEXT
109597403Sobrien      ALL_LINGUAS="de fr"
109697403Sobrien
1097102782Skan      # Don't call AM-GNU-GETTEXT here. Instead, assume glibc.
109897403Sobrien      AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
109997403Sobrien      if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
1100132720Skan        USE_NLS=yes
110197403Sobrien      fi
110297403Sobrien      # Export the build objects.
110397403Sobrien      for ling in $ALL_LINGUAS; do \
1104132720Skan        glibcxx_MOFILES="$glibcxx_MOFILES $ling.mo"; \
1105132720Skan        glibcxx_POFILES="$glibcxx_POFILES $ling.po"; \
110697403Sobrien      done
1107132720Skan      AC_SUBST(glibcxx_MOFILES)
1108132720Skan      AC_SUBST(glibcxx_POFILES)
110997403Sobrien
111097403Sobrien      CLOCALE_H=config/locale/gnu/c_locale.h
111197403Sobrien      CLOCALE_CC=config/locale/gnu/c_locale.cc
111297403Sobrien      CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h
1113103447Skan      CCODECVT_CC=config/locale/gnu/codecvt_members.cc
111497403Sobrien      CCOLLATE_CC=config/locale/gnu/collate_members.cc
111597403Sobrien      CCTYPE_CC=config/locale/gnu/ctype_members.cc
111697403Sobrien      CMESSAGES_H=config/locale/gnu/messages_members.h
111797403Sobrien      CMESSAGES_CC=config/locale/gnu/messages_members.cc
111897403Sobrien      CMONEY_CC=config/locale/gnu/monetary_members.cc
111997403Sobrien      CNUMERIC_CC=config/locale/gnu/numeric_members.cc
1120110614Skan      CTIME_H=config/locale/gnu/time_members.h
112197403Sobrien      CTIME_CC=config/locale/gnu/time_members.cc
1122103447Skan      CLOCALE_INTERNAL_H=config/locale/gnu/c++locale_internal.h
112397403Sobrien      ;;
1124132720Skan    ieee_1003.1-2001)
1125132720Skan      AC_MSG_RESULT(IEEE 1003.1)
112697403Sobrien
112797403Sobrien      CLOCALE_H=config/locale/ieee_1003.1-2001/c_locale.h
112897403Sobrien      CLOCALE_CC=config/locale/ieee_1003.1-2001/c_locale.cc
112997403Sobrien      CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h
1130103447Skan      CCODECVT_CC=config/locale/generic/codecvt_members.cc
113197403Sobrien      CCOLLATE_CC=config/locale/generic/collate_members.cc
113297403Sobrien      CCTYPE_CC=config/locale/generic/ctype_members.cc
113397403Sobrien      CMESSAGES_H=config/locale/ieee_1003.1-2001/messages_members.h
113497403Sobrien      CMESSAGES_CC=config/locale/ieee_1003.1-2001/messages_members.cc
113597403Sobrien      CMONEY_CC=config/locale/generic/monetary_members.cc
113697403Sobrien      CNUMERIC_CC=config/locale/generic/numeric_members.cc
1137110614Skan      CTIME_H=config/locale/generic/time_members.h
113897403Sobrien      CTIME_CC=config/locale/generic/time_members.cc
1139103447Skan      CLOCALE_INTERNAL_H=config/locale/generic/c++locale_internal.h
114097403Sobrien      ;;
114197403Sobrien  esac
114297403Sobrien
114397403Sobrien  # This is where the testsuite looks for locale catalogs, using the
114497403Sobrien  # -DLOCALEDIR define during testsuite compilation.
1145132720Skan  glibcxx_localedir=${glibcxx_builddir}/po/share/locale
1146132720Skan  AC_SUBST(glibcxx_localedir)
114797403Sobrien
1148132720Skan  # A standalone libintl (e.g., GNU libintl) may be in use.
1149132720Skan  if test $USE_NLS = yes; then
1150132720Skan    AC_CHECK_HEADERS([libintl.h], [], USE_NLS=no)
1151132720Skan    AC_SEARCH_LIBS(gettext, intl, [], USE_NLS=no)
1152132720Skan  fi
1153132720Skan  if test $USE_NLS = yes; then
1154132720Skan    AC_DEFINE(_GLIBCXX_USE_NLS)
1155132720Skan  fi
1156132720Skan
115797403Sobrien  AC_SUBST(USE_NLS)
115897403Sobrien  AC_SUBST(CLOCALE_H)
115997403Sobrien  AC_SUBST(CCODECVT_H)
116097403Sobrien  AC_SUBST(CMESSAGES_H)
1161117397Skan  AC_SUBST(CCODECVT_CC)
1162117397Skan  AC_SUBST(CCOLLATE_CC)
1163117397Skan  AC_SUBST(CCTYPE_CC)
1164117397Skan  AC_SUBST(CMESSAGES_CC)
1165117397Skan  AC_SUBST(CMONEY_CC)
1166117397Skan  AC_SUBST(CNUMERIC_CC)
1167110614Skan  AC_SUBST(CTIME_H)
1168117397Skan  AC_SUBST(CTIME_CC)
1169117397Skan  AC_SUBST(CLOCALE_CC)
1170117397Skan  AC_SUBST(CLOCALE_INTERNAL_H)
117197403Sobrien])
117297403Sobrien
117397403Sobrien
117497403Sobriendnl
1175132720Skandnl Check for which std::allocator base class to use.  The choice is
1176132720Skandnl mapped from a subdirectory of include/ext.
117797403Sobriendnl
1178132720Skandnl Default is new.
117997403Sobriendnl
1180132720SkanAC_DEFUN([GLIBCXX_ENABLE_ALLOCATOR], [
1181132720Skan  AC_MSG_CHECKING([for std::allocator base class to use])
1182132720Skan  GLIBCXX_ENABLE(libstdcxx-allocator,auto,[=KIND],
1183132720Skan    [use KIND for target std::allocator base],
1184132720Skan    [permit new|malloc|mt|bitmap|pool|yes|no|auto])
1185132720Skan  # If they didn't use this option switch, or if they specified --enable
1186132720Skan  # with no specific model, we'll have to look for one.  If they
1187132720Skan  # specified --disable (???), do likewise.
1188132720Skan  if test $enable_libstdcxx_allocator = no || test $enable_libstdcxx_allocator = yes; then
1189132720Skan     enable_libstdcxx_allocator=auto
1190132720Skan  fi
119197403Sobrien
1192132720Skan  # Either a known package, or "auto"
1193132720Skan  enable_libstdcxx_allocator_flag=$enable_libstdcxx_allocator
119497403Sobrien
1195132720Skan  # Probe for host-specific support if no specific model is specified.
1196132720Skan  # Default to "new".
1197132720Skan  if test $enable_libstdcxx_allocator_flag = auto; then
1198132720Skan    case ${target_os} in
1199132720Skan      *)
1200132720Skan        enable_libstdcxx_allocator_flag=new
1201132720Skan        ;;
1202132720Skan    esac
1203132720Skan  fi
1204132720Skan  AC_MSG_RESULT($enable_libstdcxx_allocator_flag)
1205132720Skan  
120697403Sobrien
1207132720Skan  # Set configure bits for specified locale package
1208132720Skan  case ${enable_libstdcxx_allocator_flag} in
1209132720Skan    bitmap)
1210132720Skan      ALLOCATOR_H=config/allocator/bitmap_allocator_base.h
1211132720Skan      ALLOCATOR_NAME=__gnu_cxx::bitmap_allocator
121297403Sobrien      ;;
1213132720Skan    malloc)
1214132720Skan      ALLOCATOR_H=config/allocator/malloc_allocator_base.h
1215132720Skan      ALLOCATOR_NAME=__gnu_cxx::malloc_allocator
121697403Sobrien      ;;
1217132720Skan    mt)
1218132720Skan      ALLOCATOR_H=config/allocator/mt_allocator_base.h
1219132720Skan      ALLOCATOR_NAME=__gnu_cxx::__mt_alloc
122097403Sobrien      ;;
1221132720Skan    new)
1222132720Skan      ALLOCATOR_H=config/allocator/new_allocator_base.h
1223132720Skan      ALLOCATOR_NAME=__gnu_cxx::new_allocator
1224132720Skan      ;;
1225132720Skan    pool)
1226132720Skan      ALLOCATOR_H=config/allocator/pool_allocator_base.h
1227132720Skan      ALLOCATOR_NAME=__gnu_cxx::__pool_alloc
1228132720Skan      ;;	
122997403Sobrien  esac
123097403Sobrien
1231132720Skan  AC_SUBST(ALLOCATOR_H)
1232132720Skan  AC_SUBST(ALLOCATOR_NAME)
123397403Sobrien])
123497403Sobrien
123597403Sobrien
123697403Sobriendnl
1237132720Skandnl Check for whether the Boost-derived checks should be turned on.
123897403Sobriendnl
1239132720Skandnl --enable-concept-checks turns them on.
1240132720Skandnl --disable-concept-checks leaves them off.
1241132720Skandnl  +  Usage:  GLIBCXX_ENABLE_CONCEPT_CHECKS[(DEFAULT)]
1242132720Skandnl       Where DEFAULT is either `yes' or `no'.
1243132720Skandnl
1244132720SkanAC_DEFUN([GLIBCXX_ENABLE_CONCEPT_CHECKS], [
1245132720Skan  GLIBCXX_ENABLE(concept-checks,$1,,[use Boost-derived template checks])
1246132720Skan  if test $enable_concept_checks = yes; then
1247132720Skan    AC_DEFINE(_GLIBCXX_CONCEPT_CHECKS)
124897403Sobrien  fi
124997403Sobrien])
125097403Sobrien
125197403Sobrien
125297403Sobriendnl
1253132720Skandnl Check for which I/O library to use:  stdio, or something specific.
125497403Sobriendnl
1255132720Skandnl Default is stdio.
125697403Sobriendnl
1257132720SkanAC_DEFUN([GLIBCXX_ENABLE_CSTDIO], [
1258132720Skan  AC_MSG_CHECKING([for underlying I/O to use])
1259132720Skan  GLIBCXX_ENABLE(cstdio,stdio,[=PACKAGE],
1260132720Skan    [use target-specific I/O package], [permit stdio])
126197403Sobrien
1262132720Skan  # Now that libio has been removed, you can have any color you want as long
1263132720Skan  # as it's black.  This is one big no-op until other packages are added, but
1264132720Skan  # showing the framework never hurts.
1265132720Skan  case ${enable_cstdio} in
1266132720Skan    stdio)
1267132720Skan      CSTDIO_H=config/io/c_io_stdio.h
1268132720Skan      BASIC_FILE_H=config/io/basic_file_stdio.h
1269132720Skan      BASIC_FILE_CC=config/io/basic_file_stdio.cc
1270132720Skan      AC_MSG_RESULT(stdio)
1271132720Skan      ;;
1272132720Skan  esac
127397403Sobrien
1274132720Skan  AC_SUBST(CSTDIO_H)
1275132720Skan  AC_SUBST(BASIC_FILE_H)
1276132720Skan  AC_SUBST(BASIC_FILE_CC)
127797403Sobrien])
127897403Sobrien
127997403Sobrien
128097403Sobriendnl
1281132720Skandnl Check for "unusual" flags to pass to the compiler while building.
128297403Sobriendnl
1283132720Skandnl --enable-cxx-flags='-foo -bar -baz' is a general method for passing
1284132720Skandnl     experimental flags such as -fpch, -fIMI, -Dfloat=char, etc.
1285132720Skandnl --disable-cxx-flags passes nothing.
1286132720Skandnl  +  See http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00131.html
1287132720Skandnl         http://gcc.gnu.org/ml/libstdc++/2000-q2/msg00284.html
1288132720Skandnl         http://gcc.gnu.org/ml/libstdc++/2000-q1/msg00035.html
1289132720Skandnl  +  Usage:  GLIBCXX_ENABLE_CXX_FLAGS(default flags)
1290132720Skandnl       If "default flags" is an empty string, the effect is the same
1291132720Skandnl       as --disable or --enable=no.
129297403Sobriendnl
1293132720SkanAC_DEFUN([GLIBCXX_ENABLE_CXX_FLAGS], [dnl
1294132720Skan  AC_MSG_CHECKING([for extra compiler flags for building])
1295132720Skan  GLIBCXX_ENABLE(cxx-flags,$1,[=FLAGS],
1296132720Skan    [pass compiler FLAGS when building library],
1297132720Skan    [case "x$enable_cxx_flags" in
1298132720Skan      xno | x)   enable_cxx_flags= ;;
1299132720Skan      x-*)       ;;
1300132720Skan      *)         AC_MSG_ERROR(_g_switch needs compiler flags as arguments) ;;
1301132720Skan     esac])
130297403Sobrien
1303132720Skan  # Run through flags (either default or command-line) and set anything
1304132720Skan  # extra (e.g., #defines) that must accompany particular g++ options.
1305132720Skan  if test -n "$enable_cxx_flags"; then
1306132720Skan    for f in $enable_cxx_flags; do
1307132720Skan      case "$f" in
1308132720Skan        -fhonor-std)  ;;
1309132720Skan        -*)  ;;
1310132720Skan        *)   # and we're trying to pass /what/ exactly?
1311132720Skan             AC_MSG_ERROR([compiler flags start with a -]) ;;
1312132720Skan      esac
1313132720Skan    done
131497403Sobrien  fi
131597403Sobrien
1316132720Skan  EXTRA_CXX_FLAGS="$enable_cxx_flags"
1317132720Skan  AC_MSG_RESULT($EXTRA_CXX_FLAGS)
1318132720Skan  AC_SUBST(EXTRA_CXX_FLAGS)
131997403Sobrien])
132097403Sobrien
132197403Sobrien
132297403Sobriendnl
132397403Sobriendnl Check for wide character support.  Has the same effect as the option
132497403Sobriendnl in gcc's configure, but in a form that autoconf can mess with.
132597403Sobriendnl
132697403Sobriendnl --enable-c-mbchar requests all the wchar_t stuff.
132797403Sobriendnl --disable-c-mbchar doesn't.
1328132720Skandnl  +  Usage:  GLIBCXX_ENABLE_C_MBCHAR[(DEFAULT)]
1329132720Skandnl       Where DEFAULT is either `yes' or `no'.
1330132720Skandnl
1331132720SkanAC_DEFUN([GLIBCXX_ENABLE_C_MBCHAR], [
1332132720Skan  GLIBCXX_ENABLE(c-mbchar,$1,,[enable multibyte (wide) characters])
1333132720Skan  # Option parsed, now other scripts can test enable_c_mbchar for yes/no.
133497403Sobrien])
133597403Sobrien
133697403Sobrien
133797403Sobriendnl
1338132720Skandnl Check to see if debugging libraries are to be built.
133997403Sobriendnl
1340132720Skandnl --enable-libstdcxx-debug
1341132720Skandnl builds a separate set of debugging libraries in addition to the
1342132720Skandnl normal (shared, static) libstdc++ binaries.
134397403Sobriendnl
1344132720Skandnl --disable-libstdcxx-debug
1345132720Skandnl builds only one (non-debug) version of libstdc++.
1346132720Skandnl
1347132720Skandnl --enable-libstdcxx-debug-flags=FLAGS
1348132720Skandnl iff --enable-debug == yes, then use FLAGS to build the debug library.
1349132720Skandnl
1350132720Skandnl  +  Usage:  GLIBCXX_ENABLE_DEBUG[(DEFAULT)]
1351132720Skandnl       Where DEFAULT is either `yes' or `no'.
1352132720Skandnl
1353132720SkanAC_DEFUN([GLIBCXX_ENABLE_DEBUG], [
1354132720Skan  AC_MSG_CHECKING([for additional debug build])
1355132720Skan  GLIBCXX_ENABLE(libstdcxx-debug,$1,,[build extra debug library])
1356132720Skan  AC_MSG_RESULT($enable_libstdcxx_debug)
1357132720Skan  GLIBCXX_CONDITIONAL(GLIBCXX_BUILD_DEBUG, test $enable_libstdcxx_debug = yes)
135897403Sobrien])
135997403Sobrien
136097403Sobrien
136197403Sobriendnl
1362132720Skandnl Check for explicit debug flags.
136397403Sobriendnl
1364132720Skandnl --enable-libstdcxx-debug-flags='-O1'
1365132720Skandnl is a general method for passing flags to be used when
1366132720Skandnl building debug libraries with --enable-debug.
136797403Sobriendnl
1368132720Skandnl --disable-libstdcxx-debug-flags does nothing.
1369132720Skandnl  +  Usage:  GLIBCXX_ENABLE_DEBUG_FLAGS(default flags)
1370132720Skandnl       If "default flags" is an empty string, the effect is the same
1371132720Skandnl       as --disable or --enable=no.
137297403Sobriendnl
1373132720SkanAC_DEFUN([GLIBCXX_ENABLE_DEBUG_FLAGS], [
1374132720Skan  GLIBCXX_ENABLE(libstdcxx-debug-flags,[$1],[=FLAGS],
1375132720Skan    [pass compiler FLAGS when building debug library],
1376132720Skan    [case "x$enable_libstdcxx_debug_flags" in
1377132720Skan      xno | x)    enable_libstdcxx_debug_flags= ;;
1378132720Skan      x-*)        ;;
1379132720Skan      *)          AC_MSG_ERROR(_g_switch needs compiler flags as arguments) ;;
1380132720Skan     esac])
138197403Sobrien
1382132720Skan  # Option parsed, now set things appropriately
1383132720Skan  DEBUG_FLAGS="$enable_libstdcxx_debug_flags"
1384132720Skan  AC_SUBST(DEBUG_FLAGS)
138597403Sobrien
1386132720Skan  AC_MSG_NOTICE([Debug build flags set to $DEBUG_FLAGS])
138797403Sobrien])
138897403Sobrien
138997403Sobrien
139097403Sobriendnl
1391132720Skandnl Check if the user only wants a freestanding library implementation.
139297403Sobriendnl
1393132720Skandnl --disable-hosted-libstdcxx will turn off most of the library build,
1394132720Skandnl installing only the headers required by [17.4.1.3] and the language
1395132720Skandnl support library.  More than that will be built (to keep the Makefiles
1396132720Skandnl conveniently clean), but not installed.
139797403Sobriendnl
1398132720Skandnl Sets:
1399132720Skandnl  is_hosted  (yes/no)
140097403Sobriendnl
1401132720Skandnl Defines:
1402132720Skandnl  _GLIBCXX_HOSTED   (always defined, either to 1 or 0)
140397403Sobriendnl
1404132720SkanAC_DEFUN([GLIBCXX_ENABLE_HOSTED], [
1405132720Skan  AC_ARG_ENABLE([hosted-libstdcxx],
1406132720Skan    AC_HELP_STRING([--disable-hosted-libstdcxx],
1407132720Skan                   [only build freestanding C++ runtime support]),,
1408132720Skan    [enable_hosted_libstdcxx=yes])
1409132720Skan  if test "$enable_hosted_libstdcxx" = no; then
1410132720Skan    AC_MSG_NOTICE([Only freestanding libraries will be built])
1411132720Skan    is_hosted=no
1412132720Skan    hosted_define=0
1413132720Skan    enable_abi_check=no
1414132720Skan    enable_libstdcxx_pch=no
141597403Sobrien  else
1416132720Skan    is_hosted=yes
1417132720Skan    hosted_define=1
141897403Sobrien  fi
1419132720Skan  GLIBCXX_CONDITIONAL(GLIBCXX_HOSTED, test $is_hosted = yes)
1420132720Skan  AC_DEFINE_UNQUOTED(_GLIBCXX_HOSTED, $hosted_define,
1421132720Skan    [Define to 1 if a full hosted library is built, or 0 if freestanding.])
142297403Sobrien])
142397403Sobrien
142497403Sobrien
1425132720Skandnl
1426132720Skandnl Check for template specializations for the 'long long' type extension.
1427132720Skandnl The result determines only whether 'long long' I/O is enabled; things
1428132720Skandnl like numeric_limits<> specializations are always available.
1429132720Skandnl
1430132720Skandnl --enable-long-long defines _GLIBCXX_USE_LONG_LONG
1431132720Skandnl --disable-long-long leaves _GLIBCXX_USE_LONG_LONG undefined
1432132720Skandnl  +  Usage:  GLIBCXX_ENABLE_LONG_LONG[(DEFAULT)]
1433132720Skandnl       Where DEFAULT is either `yes' or `no'.
1434132720Skandnl
1435132720SkanAC_DEFUN([GLIBCXX_ENABLE_LONG_LONG], [
1436132720Skan  GLIBCXX_ENABLE(long-long,$1,,[enables I/O support for 'long long'])
1437132720Skan  if test $enable_long_long = yes; then
1438132720Skan    AC_DEFINE(_GLIBCXX_USE_LONG_LONG)
143997403Sobrien  fi
144097403Sobrien])
144197403Sobrien
144297403Sobrien
144397403Sobriendnl
1444132720Skandnl Check to see if building and using a C++ precompiled header can be done.
144597403Sobriendnl
1446132720Skandnl --enable-libstdcxx-pch=yes
1447132720Skandnl default, this shows intent to use stdc++.h.gch If it looks like it
1448132720Skandnl may work, after some light-hearted attempts to puzzle out compiler
1449132720Skandnl support, flip bits on in include/Makefile.am
1450132720Skandnl
1451132720Skandnl --disable-libstdcxx-pch
1452132720Skandnl turns off attempts to use or build stdc++.h.gch.
1453132720Skandnl
1454132720Skandnl Substs:
1455132720Skandnl  glibcxx_PCHFLAGS
1456132720Skandnl
1457132720SkanAC_DEFUN([GLIBCXX_ENABLE_PCH], [
1458132720Skan  AC_MSG_CHECKING([for enabled PCH])
1459132720Skan  GLIBCXX_ENABLE(libstdcxx-pch,$1,,[build pre-compiled libstdc++ headers])
1460132720Skan  AC_MSG_RESULT([$enable_libstdcxx_pch])
146197403Sobrien
1462132720Skan  if test $enable_libstdcxx_pch = yes; then
1463132720Skan    AC_CACHE_CHECK([for compiler with PCH support],
1464132720Skan      [glibcxx_cv_prog_CXX_pch],
1465132720Skan      [ac_save_CXXFLAGS="$CXXFLAGS"
1466132720Skan       CXXFLAGS="$CXXFLAGS -Werror -Winvalid-pch -Wno-deprecated"
1467132720Skan       AC_LANG_SAVE
1468132720Skan       AC_LANG_CPLUSPLUS
1469132720Skan       echo '#include <math.h>' > conftest.h
1470132720Skan       if $CXX $CXXFLAGS $CPPFLAGS -x c++-header conftest.h \
1471132720Skan		          -o conftest.h.gch 1>&5 2>&1 &&
1472132720Skan	        echo '#error "pch failed"' > conftest.h &&
1473132720Skan          echo '#include "conftest.h"' > conftest.cc &&
1474132720Skan	       $CXX -c $CXXFLAGS $CPPFLAGS conftest.cc 1>&5 2>&1 ;
1475132720Skan       then
1476132720Skan         glibcxx_cv_prog_CXX_pch=yes
1477132720Skan       else
1478132720Skan         glibcxx_cv_prog_CXX_pch=no
1479132720Skan       fi
1480132720Skan       rm -f conftest*
1481132720Skan       CXXFLAGS=$ac_save_CXXFLAGS
1482132720Skan       AC_LANG_RESTORE
1483132720Skan      ])
1484132720Skan    enable_libstdcxx_pch=$glibcxx_cv_prog_CXX_pch
1485117397Skan  fi
1486102782Skan
1487132720Skan  GLIBCXX_CONDITIONAL(GLIBCXX_BUILD_PCH, test $enable_libstdcxx_pch = yes)
1488132720Skan  if test $enable_libstdcxx_pch = yes; then
1489132720Skan    glibcxx_PCHFLAGS="-include bits/stdc++.h"
1490117397Skan  else
1491132720Skan    glibcxx_PCHFLAGS=""
1492117397Skan  fi
1493132720Skan  AC_SUBST(glibcxx_PCHFLAGS)
149497403Sobrien])
149597403Sobrien
149697403Sobrien
1497117397Skandnl
1498132720Skandnl Check for exception handling support.  If an explicit enable/disable
1499132720Skandnl sjlj exceptions is given, we don't have to detect.  Otherwise the
1500132720Skandnl target may or may not support call frame exceptions.
1501117397Skandnl
1502132720Skandnl --enable-sjlj-exceptions forces the use of builtin setjmp.
1503132720Skandnl --disable-sjlj-exceptions forces the use of call frame unwinding.
1504132720Skandnl Neither one forces an attempt at detection.
1505117397Skandnl
1506132720Skandnl Defines:
1507132720Skandnl  _GLIBCXX_SJLJ_EXCEPTIONS if the compiler is configured for it
1508117397Skandnl
1509132720SkanAC_DEFUN([GLIBCXX_ENABLE_SJLJ_EXCEPTIONS], [
1510132720Skan  AC_MSG_CHECKING([for exception model to use])
1511132720Skan  AC_LANG_SAVE
1512132720Skan  AC_LANG_CPLUSPLUS
1513132720Skan  GLIBCXX_ENABLE(sjlj-exceptions,auto,,
1514132720Skan    [force use of builtin_setjmp for exceptions],
1515132720Skan    [permit yes|no|auto])
1516117397Skan
1517132720Skan  if test $enable_sjlj_exceptions = auto; then
1518132720Skan    # Botheration.  Now we've got to detect the exception model.  Link tests
1519132720Skan    # against libgcc.a are problematic since we've not been given proper -L
1520132720Skan    # bits for single-tree newlib and libgloss.
1521132720Skan    #
1522132720Skan    # Fake what AC_TRY_COMPILE does.  XXX Look at redoing this new-style.
1523132720Skan    cat > conftest.$ac_ext << EOF
1524132720Skan[#]line __oline__ "configure"
1525132720Skanstruct S { ~S(); };
1526132720Skanvoid bar();
1527132720Skanvoid foo()
1528132720Skan{
1529132720Skan  S s;
1530132720Skan  bar();
1531132720Skan}
1532132720SkanEOF
1533132720Skan    old_CXXFLAGS="$CXXFLAGS"
1534132720Skan    CXXFLAGS=-S
1535132720Skan    if AC_TRY_EVAL(ac_compile); then
1536132720Skan      if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
1537132720Skan        enable_sjlj_exceptions=yes
1538132720Skan      elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
1539132720Skan        enable_sjlj_exceptions=no
1540132720Skan      fi
1541132720Skan    fi
1542132720Skan    CXXFLAGS="$old_CXXFLAGS"
1543132720Skan    rm -f conftest*
1544117397Skan  fi
1545117397Skan
1546132720Skan  # This is a tad weird, for hysterical raisins.  We have to map enable/disable 
1547132720Skan  # to two different models.
1548132720Skan  case $enable_sjlj_exceptions in
1549132720Skan    yes)
1550132720Skan      AC_DEFINE(_GLIBCXX_SJLJ_EXCEPTIONS, 1,
1551132720Skan        [Define if the compiler is configured for setjmp/longjmp exceptions.])
1552132720Skan      ac_exception_model_name=sjlj
1553132720Skan      ;;
1554132720Skan    no)
1555132720Skan      ac_exception_model_name="call frame"
1556132720Skan      ;;
1557132720Skan    *)
1558132720Skan      AC_MSG_ERROR([unable to detect exception model])
1559132720Skan      ;;
1560132720Skan  esac
1561132720Skan AC_LANG_RESTORE
1562132720Skan AC_MSG_RESULT($ac_exception_model_name)
156397403Sobrien])
156497403Sobrien
156597403Sobrien
156697403Sobriendnl
156797403Sobriendnl Add version tags to symbols in shared library (or not), additionally
156897403Sobriendnl marking other symbols as private/local (or not).
156997403Sobriendnl
157097403Sobriendnl --enable-symvers=style adds a version script to the linker call when
157197403Sobriendnl       creating the shared library.  The choice of version script is
157297403Sobriendnl       controlled by 'style'.
157397403Sobriendnl --disable-symvers does not.
1574132720Skandnl  +  Usage:  GLIBCXX_ENABLE_SYMVERS[(DEFAULT)]
1575132720Skandnl       Where DEFAULT is either 'yes' or 'no'.  Passing `yes' tries to
1576132720Skandnl       choose a default style based on linker characteristics.  Passing
1577132720Skandnl       'no' disables versioning.
1578132720Skandnl
1579132720SkanAC_DEFUN([GLIBCXX_ENABLE_SYMVERS], [
158097403Sobrien
1581132720SkanGLIBCXX_ENABLE(symvers,$1,[=STYLE],
1582132720Skan  [enables symbol versioning of the shared library],
1583132720Skan  [permit yes|no|gnu])
1584132720Skan
1585132720Skan# If we never went through the GLIBCXX_CHECK_LINKER_FEATURES macro, then we
1586132720Skan# don't know enough about $LD to do tricks...
1587132720SkanAC_REQUIRE([GLIBCXX_CHECK_LINKER_FEATURES])
1588132720Skan# FIXME  The following test is too strict, in theory.
1589132720Skanif test $enable_shared = no ||
1590132720Skan        test "x$LD" = x ||
1591132720Skan        test x$glibcxx_gnu_ld_version = x; then
159297403Sobrien  enable_symvers=no
159397403Sobrienfi
159497403Sobrien
159597403Sobrien# Check to see if libgcc_s exists, indicating that shared libgcc is possible.
1596117397Skanif test $enable_symvers != no; then
1597117397Skan  AC_MSG_CHECKING([for shared libgcc])
1598117397Skan  ac_save_CFLAGS="$CFLAGS"
1599117397Skan  CFLAGS=' -lgcc_s'
1600132720Skan  AC_TRY_LINK(, [return 0;], glibcxx_shared_libgcc=yes, glibcxx_shared_libgcc=no)
1601117397Skan  CFLAGS="$ac_save_CFLAGS"
1602132720Skan  if test $glibcxx_shared_libgcc = no; then
1603132720Skan    cat > conftest.c <<EOF
1604132720Skanint main (void) { return 0; }
1605132720SkanEOF
1606132720Skanchangequote(,)dnl
1607132720Skan    glibcxx_libgcc_s_suffix=`${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
1608132720Skan			     -shared -shared-libgcc -o conftest.so \
1609132720Skan			     conftest.c -v 2>&1 >/dev/null \
1610132720Skan			     | sed -n 's/^.* -lgcc_s\([^ ]*\) .*$/\1/p'`
1611132720Skanchangequote([,])dnl
1612132720Skan    rm -f conftest.c conftest.so
1613132720Skan    if test x${glibcxx_libgcc_s_suffix+set} = xset; then
1614132720Skan      CFLAGS=" -lgcc_s$glibcxx_libgcc_s_suffix"
1615132720Skan      AC_TRY_LINK(, [return 0;], glibcxx_shared_libgcc=yes)
1616132720Skan      CFLAGS="$ac_save_CFLAGS"
1617132720Skan    fi
1618132720Skan  fi
1619132720Skan  AC_MSG_RESULT($glibcxx_shared_libgcc)
1620117397Skanfi
162197403Sobrien
1622132720Skan# For GNU ld, we need at least this version.  The format is described in
1623132720Skan# GLIBCXX_CHECK_LINKER_FEATURES above.
1624132720Skanglibcxx_min_gnu_ld_version=21400
1625132720Skan# XXXXXXXXXXX glibcxx_gnu_ld_version=21390
162697403Sobrien
1627132720Skan# Check to see if unspecified "yes" value can win, given results above.
1628132720Skan# Change "yes" into either "no" or a style name.
1629132720Skanif test $enable_symvers = yes; then
163097403Sobrien  if test $with_gnu_ld = yes &&
1631132720Skan     test $glibcxx_shared_libgcc = yes;
163297403Sobrien  then
1633132720Skan    if test $glibcxx_gnu_ld_version -ge $glibcxx_min_gnu_ld_version ; then
1634132720Skan      enable_symvers=gnu
163597403Sobrien    else
1636132720Skan      # The right tools, the right setup, but too old.  Fallbacks?
1637132720Skan      AC_MSG_WARN(=== Linker version $glibcxx_gnu_ld_version is too old for)
1638132720Skan      AC_MSG_WARN(=== full symbol versioning support in this release of GCC.)
1639132720Skan      AC_MSG_WARN(=== You would need to upgrade your binutils to version)
1640132720Skan      AC_MSG_WARN(=== $glibcxx_min_gnu_ld_version or later and rebuild GCC.)
1641132720Skan      if test $glibcxx_gnu_ld_version -ge 21200 ; then
1642132720Skan        # Globbing fix is present, proper block support is not.
1643132720Skan        dnl AC_MSG_WARN([=== Dude, you are soooo close.  Maybe we can fake it.])
1644132720Skan        dnl enable_symvers=???
1645132720Skan        AC_MSG_WARN([=== Symbol versioning will be disabled.])
1646132720Skan        enable_symvers=no
164797403Sobrien      else
1648132720Skan        # 2.11 or older.
1649132720Skan        AC_MSG_WARN([=== Symbol versioning will be disabled.])
1650132720Skan        enable_symvers=no
165197403Sobrien      fi
165297403Sobrien    fi
165397403Sobrien  else
165497403Sobrien    # just fail for now
1655132720Skan    AC_MSG_WARN([=== You have requested some kind of symbol versioning, but])
1656132720Skan    AC_MSG_WARN([=== either you are not using a supported linker, or you are])
1657132720Skan    AC_MSG_WARN([=== not building a shared libgcc_s (which is required).])
1658132720Skan    AC_MSG_WARN([=== Symbol versioning will be disabled.])
165997403Sobrien    enable_symvers=no
166097403Sobrien  fi
166197403Sobrienfi
166297403Sobrien
1663132720Skan# Everything parsed; figure out what file to use.
166497403Sobriencase $enable_symvers in
166597403Sobrien  no)
1666132720Skan    SYMVER_MAP=config/linker-map.dummy
1667132720Skan    ;;
166897403Sobrien  gnu)
1669132720Skan    SYMVER_MAP=config/linker-map.gnu
1670132720Skan    AC_DEFINE(_GLIBCXX_SYMVER)
1671132720Skan    ;;
167297403Sobrienesac
167397403Sobrien
1674117397SkanAC_SUBST(SYMVER_MAP)
1675132720SkanAC_SUBST(port_specific_symbol_files)
1676132720SkanGLIBCXX_CONDITIONAL(GLIBCXX_BUILD_VERSIONED_SHLIB, test $enable_symvers != no)
1677132720SkanAC_MSG_NOTICE(versioning on shared library symbols is $enable_symvers)
167897403Sobrien])
167997403Sobrien
1680132720Skan
1681132720Skandnl
1682132720Skandnl Setup to use the gcc gthr.h thread-specific memory and mutex model.
1683132720Skandnl We must stage the required headers so that they will be installed
1684132720Skandnl with the library (unlike libgcc, the STL implementation is provided
1685132720Skandnl solely within headers).  Since we must not inject random user-space
1686132720Skandnl macro names into user-provided C++ code, we first stage into <file>-in
1687132720Skandnl and process to <file> with an output command.  The reason for a two-
1688132720Skandnl stage process here is to correctly handle $srcdir!=$objdir without
1689132720Skandnl having to write complex code (the sed commands to clean the macro
1690132720Skandnl namespace are complex and fragile enough as it is).  We must also
1691132720Skandnl add a relative path so that -I- is supported properly.
1692132720Skandnl
1693132720Skandnl Substs:
1694132720Skandnl  glibcxx_thread_h
1695132720Skandnl
1696132720Skandnl Defines:
1697132720Skandnl  HAVE_GTHR_DEFAULT
1698132720Skandnl
1699132720SkanAC_DEFUN([GLIBCXX_ENABLE_THREADS], [
1700132720Skan  AC_MSG_CHECKING([for thread model used by GCC])
1701132720Skan  target_thread_file=`$CXX -v 2>&1 | sed -n 's/^Thread model: //p'`
1702132720Skan  AC_MSG_RESULT([$target_thread_file])
1703132720Skan
1704132720Skan  if test $target_thread_file != single; then
1705132720Skan    AC_DEFINE(HAVE_GTHR_DEFAULT)
1706132720Skan  fi
1707132720Skan
1708132720Skan  glibcxx_thread_h=gthr-$target_thread_file.h
1709132720Skan  AC_SUBST(glibcxx_thread_h)
1710132720Skan])
1711132720Skan
1712132720Skan
1713132720Skan# Check whether LC_MESSAGES is available in <locale.h>.
1714132720Skan# Ulrich Drepper <drepper@cygnus.com>, 1995.
1715132720Skan#
1716132720Skan# This file file be copied and used freely without restrictions.  It can
1717132720Skan# be used in projects which are not available under the GNU Public License
1718132720Skan# but which still want to provide support for the GNU gettext functionality.
1719132720Skan# Please note that the actual code is *not* freely available.
1720132720Skan
1721132720Skan# serial 1
1722132720SkanAC_DEFUN([AC_LC_MESSAGES], [
1723132720Skan  AC_CHECK_HEADER(locale.h, [
1724132720Skan    AC_CACHE_CHECK([for LC_MESSAGES], ac_cv_val_LC_MESSAGES,
1725132720Skan      [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES],
1726132720Skan       ac_cv_val_LC_MESSAGES=yes, ac_cv_val_LC_MESSAGES=no)])
1727132720Skan    if test $ac_cv_val_LC_MESSAGES = yes; then
1728132720Skan      AC_DEFINE(HAVE_LC_MESSAGES)
1729132720Skan    fi
1730132720Skan  ])
1731132720Skan])
1732132720Skan
1733132720Skan
1734132720Skansinclude([../libtool.m4])
1735132720Skandnl The lines below arrange for aclocal not to bring an installed
1736132720Skandnl libtool.m4 into aclocal.m4, while still arranging for automake to
1737132720Skandnl add a definition of LIBTOOL to Makefile.in.
1738132720Skanifelse(,,,[AC_SUBST(LIBTOOL)
1739132720SkanAC_DEFUN([AM_PROG_LIBTOOL])
1740132720SkanAC_DEFUN([AC_LIBTOOL_DLOPEN])
1741132720SkanAC_DEFUN([AC_PROG_LD])
1742132720Skan])
1743132720Skan
1744132720Skandnl vim:et:ts=2:sw=2
1745