-dnl Check to see what the underlying c library's interface to ctype looks
-dnl like. Bits of locale rely on things like isspace, toupper, etc. This
-dnl stuff makes sure the right bits from the clibrary get called.
-dnl
-dnl Depending on what is found, select various configure/*/bits/ctype_base.h
-dnl Depending on what is found, select various configure/*/ctype.cc
-dnl
-dnl GLIBCPP_CHECK_CTYPE_SUPPORT
-AC_DEFUN(GLIBCPP_CHECK_CTYPE_SUPPORT, [
- AC_CHECK_HEADER(ctype.h, [
-
- dnl If doesn't match any specified, go with defaults.
- ctype_default=yes
-
- dnl Test for <ctype> functionality -- GNU/Linux
- AC_MSG_CHECKING([<ctype> for GNU/Linux])
- AC_TRY_COMPILE([#include <ctype.h>],
- [int
- foo (int a)
- { return _ISspace + _ISprint + _IScntrl + _ISupper + _ISlower + _ISalpha \
- + _ISdigit + _ISpunct + _ISxdigit + _ISalnum + _ISgraph \
- + __ctype_tolower[a] + __ctype_toupper[a] + __ctype_b[a];}], \
- ctype_linux=yes, ctype_linux=no)
- AC_MSG_RESULT($ctype_linux)
- if test $ctype_linux = "yes"; then
- ctype_include_dir="config/os/gnu-linux"
- ctype_default=no
- fi
-
- dnl Test for <ctype> functionality -- FreeBSD 4.0
- if test $ctype_default = "yes"; then
- AC_MSG_CHECKING([<ctype> for FreeBSD 4.0])
- AC_TRY_COMPILE([#include <ctype.h>],
- [int
- foo (int a)
- { return _CTYPE_S + _CTYPE_R + _CTYPE_C + _CTYPE_U + _CTYPE_L + _CTYPE_A \
- + _CTYPE_D + _CTYPE_P + _CTYPE_X + _CTYPE_G ;}], \
- ctype_bsd=yes, ctype_bsd=no)
- AC_MSG_RESULT($ctype_bsd)
- if test $ctype_bsd = "yes"; then
- ctype_include_dir="config/os/bsd"
- ctype_default=no
- fi
- fi
-
- dnl Test for <ctype> functionality -- FreeBSD 3.4
- if test $ctype_default = "yes"; then
- AC_MSG_CHECKING([<ctype> for FreeBSD 3.4])
- AC_TRY_COMPILE([#include <ctype.h>],
- [int
- foo (int a)
- { return _S + _R + _C + _U + _L + _A \
- + _D + _P + _X + _G + __istype (a, 0);}], \
- ctype_freebsd34=yes, ctype_freebsd34=no)
- AC_MSG_RESULT($ctype_freebsd34)
- if test $ctype_freebsd34 = "yes"; then
- ctype_include_dir="config/os/bsd"
- ctype_default=no
- fi
- fi
-
- dnl Test for <ctype> functionality -- Solaris 2.6 and up
- if test $ctype_default = "yes"; then
- AC_MSG_CHECKING([<ctype> for Solaris 2.6,7,8])
- AC_TRY_COMPILE([#include <ctype.h>],
- [int
- foo (int a)
- { return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \
- + _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \
- + __trans_lower[a] + __trans_upper[a] + __ctype_mask[a];}], \
- ctype_solaris=yes, ctype_solaris=no)
- AC_MSG_RESULT($ctype_solaris)
-
- if test $ctype_solaris = "yes"; then
- AC_MSG_CHECKING([ for version])
- AC_LANG_CPLUSPLUS
- AC_TRY_COMPILE([#include <ctype.h>],
- [typedef long* __to_type; __to_type const& _M_toupper = __trans_upper;],\
- ctype_solaris26=yes, ctype_solaris26=no)
- AC_LANG_C
- if test $ctype_solaris26 = "yes"; then
- ctype_include_dir="config/os/solaris/solaris2.6"
- AC_MSG_RESULT([Solaris 2.6])
- ctype_default=no
- else
- ctype_include_dir="config/os/solaris/solaris2.7"
- AC_MSG_RESULT([Solaris 7,8])
- ctype_default=no
- fi
- fi
- fi
-
- dnl Test for <ctype> functionality -- Solaris 2.5.1
- if test $ctype_default = "yes"; then
- AC_MSG_CHECKING([<ctype> for Solaris 2.5.1])
- AC_TRY_COMPILE([#include <ctype.h>],
- [int
- foo (int a)
- { return _U + _L + _N + _S + _P + _C + _X + _B \
- + __ctype[a];}], \
- ctype_solaris25=yes, ctype_solaris25=no)
- AC_MSG_RESULT($ctype_solaris25)
- if test $ctype_solaris25 = "yes"; then
- ctype_include_dir="config/os/solaris/solaris2.5"
- ctype_default=no
- fi
- fi
-
- dnl Test for <ctype> functionality -- AIX
- if test $ctype_default = "yes"; then
- AC_MSG_CHECKING([<ctype> for AIX])
- AC_TRY_COMPILE([#include <ctype.h>],
- [int
- foo (int a)
- { return _ISSPACE + _ISPRINT + _ISCNTRL + _ISUPPER + _ISLOWER + _ISALPHA \
- + _ISDIGIT + _ISPUNCT + _ISXDIGIT + _ISALNUM + _ISGRAPH \
- + _VALC('a') + _IS('c', 0);}], \
- ctype_aix=yes, ctype_aix=no)
- AC_MSG_RESULT($ctype_aix)
- if test $ctype_aix = "yes"; then
- ctype_include_dir="config/os/aix"
- ctype_default=no
- fi
- fi
-
- dnl Test for <ctype> functionality -- IRIX
- if test $ctype_default ="yes"; then
- AC_MSG_CHECKING([<ctype> for IRIX])
- AC_TRY_COMPILE([#include <ctype.h>],
- [int
- foo (int a)
- { return _U + _L + _N + _S + _P + _C + _B + _X + \
- _A + _PR + _G + _BL;}], \
- ctype_irix=yes, ctype_irix=no)
- AC_MSG_RESULT($ctype_irix)
- if test $ctype_irix = "yes"; then
- ctype_include_dir="config/os/irix"
- ctype_default=no
- fi
- fi
-
- dnl Test for <ctype> functionality -- newlib
- if test $ctype_default = "yes"; then
- AC_MSG_CHECKING([<ctype> for newlib])
- AC_TRY_COMPILE([#include <ctype.h>],
- [int
- foo (int a)
- { return _U + _L + _N + _S + _P + _C + _X + _B \
- + _ctype_[a];}], \
- ctype_newlib=yes, ctype_newlib=no)
- AC_MSG_RESULT($ctype_newlib)
- if test $ctype_newlib = "yes"; then
- ctype_include_dir="config/newlib"
- ctype_default=no
- fi
- fi
-
- if test $ctype_default = "yes"; then
- ctype_include_dir="config/os/generic"
- AC_MSG_WARN("Using default ctype headers.")
- fi
-
- AC_LINK_FILES($ctype_include_dir/bits/ctype_base.h,
- include/bits/ctype_base.h)
- AC_LINK_FILES($ctype_include_dir/bits/ctype_inline.h,
- include/bits/ctype_inline.h)
- AC_LINK_FILES($ctype_include_dir/bits/ctype_noninline.h, \
- include/bits/ctype_noninline.h)
- ])
-])
-
-
-dnl