OSDN Git Service

2003-05-19 Paolo Carlini <pcarlini@unitus.it>
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / acinclude.m4
index ab2a99f..c1bae22 100644 (file)
@@ -591,34 +591,6 @@ AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_3, [
 ])
 
 dnl
-dnl Check to see if the (unistd function) argument passed is
-dnl 1) declared when using the c++ compiler
-dnl 2) has "C" linkage
-dnl
-dnl argument 1 is name of function to check
-dnl
-dnl ASSUMES argument is a function with ONE parameter
-dnl
-dnl GLIBCPP_CHECK_UNISTD_DECL_AND_LINKAGE_1
-AC_DEFUN(GLIBCPP_CHECK_UNISTD_DECL_AND_LINKAGE_1, [
-  AC_MSG_CHECKING([for $1 declaration])
-  if test x${glibcpp_cv_func_$1_use+set} != xset; then
-    AC_CACHE_VAL(glibcpp_cv_func_$1_use, [
-      AC_LANG_SAVE
-      AC_LANG_CPLUSPLUS
-      AC_TRY_COMPILE([#include <unistd.h>],
-                     [ $1(0);],
-                     [glibcpp_cv_func_$1_use=yes], [glibcpp_cv_func_$1_use=no])
-      AC_LANG_RESTORE
-    ])
-  fi
-  AC_MSG_RESULT($glibcpp_cv_func_$1_use)
-  if test x$glibcpp_cv_func_$1_use = x"yes"; then
-    AC_CHECK_FUNCS($1)
-  fi
-])
-
-dnl
 dnl Because the builtins are picky picky picky about the arguments they take,
 dnl do an explict linkage tests here.
 dnl Check to see if the (math function) argument passed is
@@ -753,26 +725,6 @@ AC_DEFUN(GLIBCPP_CHECK_STDLIB_SUPPORT, [
 ])
 
 dnl
-dnl Check to see what the underlying c library is like
-dnl These checks need to do two things:
-dnl 1) make sure the name is declared when using the c++ compiler
-dnl 2) make sure the name has "C" linkage
-dnl This might seem like overkill but experience has shown that it's not...
-dnl
-dnl Define HAVE_ISATTY if "isatty" is declared and links
-dnl
-dnl GLIBCPP_CHECK_UNISTD_SUPPORT
-AC_DEFUN(GLIBCPP_CHECK_UNISTD_SUPPORT, [
-  ac_test_CXXFLAGS="${CXXFLAGS+set}"
-  ac_save_CXXFLAGS="$CXXFLAGS"
-  CXXFLAGS='-fno-builtins -D_GNU_SOURCE'
-
-  GLIBCPP_CHECK_UNISTD_DECL_AND_LINKAGE_1(isatty)
-
-  CXXFLAGS="$ac_save_CXXFLAGS"
-])
-
-dnl
 dnl Check to see what the underlying c library or math library is like.
 dnl These checks need to do two things:
 dnl 1) make sure the name is declared when using the c++ compiler
@@ -940,6 +892,8 @@ dnl Define HAVE_MBSTATE_T if mbstate_t is not in wchar.h
 dnl
 dnl GLIBCPP_CHECK_WCHAR_T_SUPPORT
 AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
+  dnl Wide characters disabled by default.
+  enable_wchar_t=no
 
   dnl Test wchar.h for mbstate_t, which is needed for char_traits and
   dnl others even if wchar_t support is not on.
@@ -985,7 +939,7 @@ AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
     ac_wfuncs=no)
 
     dnl Checks for names injected into std:: by the c_std headers.
-    AC_CHECK_FUNCS(btowc wctob fgetwc fgetwc fgetws fputwc fputws fwide \
+    AC_CHECK_FUNCS(btowc wctob fgetwc fgetws fputwc fputws fwide \
     fwprintf fwscanf swprintf swscanf vfwprintf vfwscanf vswprintf vswscanf \
     vwprintf vwscanf wprintf wscanf getwc getwchar mbsinit mbrlen mbrtowc \
     mbsrtowcs wcsrtombs putwc putwchar ungetwc wcrtomb wcstod wcstof wcstol \
@@ -1030,18 +984,15 @@ AC_DEFUN(GLIBCPP_CHECK_WCHAR_T_SUPPORT, [
 
     dnl At the moment, only enable wchar_t specializations if all the
     dnl above support is present.
-    AC_MSG_CHECKING([for enabled wchar_t specializations])
-    if test x"$ac_isoC99_wchar_t" = xyes &&
-       test x"$ac_XPG2_wchar_t" = xyes; then
+    if test x"$ac_isoC99_wchar_t" = xyes && 
+       test x"$ac_XPG2_wchar_t" = xyes; then
       AC_DEFINE(_GLIBCPP_USE_WCHAR_T)
-      AC_MSG_RESULT("yes")
-    else
-      AC_MSG_RESULT("no")
+      enable_wchar_t=yes
     fi
-  else
-    dnl Wide characters disabled by the user.
-    AC_MSG_WARN([wchar_t support disabled.])
   fi
+  AC_MSG_CHECKING([for enabled wchar_t specializations])
+  AC_MSG_RESULT($enable_wchar_t)       
+  AM_CONDITIONAL(GLIBCPP_TEST_WCHAR_T, test "$enable_wchar_t" = yes)   
 ])
 
 
@@ -1067,7 +1018,7 @@ AC_DEFUN(GLIBCPP_ENABLE_DEBUG, [dnl
 define([GLIBCPP_ENABLE_DEBUG_DEFAULT], ifelse($1, yes, yes, no))dnl
 AC_ARG_ENABLE(debug,
 changequote(<<, >>)dnl
-<<  --enable-debug          extra debugging, turn off optimization [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT],
+<<  --enable-debug          build extra debug library [default=>>GLIBCPP_ENABLE_DEBUG_DEFAULT],
 changequote([, ])dnl
 [case "${enableval}" in
  yes) enable_debug=yes ;;
@@ -1312,7 +1263,7 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
       CLOCALE_INTERNAL_H=config/locale/gnu/c++locale_internal.h
       ;;
     xieee_1003.1-2001)
-      AC_MSG_RESULT(generic)
+      AC_MSG_RESULT(IEEE 1003.1)
 
       CLOCALE_H=config/locale/ieee_1003.1-2001/c_locale.h
       CLOCALE_CC=config/locale/ieee_1003.1-2001/c_locale.cc
@@ -1339,6 +1290,15 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
   glibcpp_localedir=${glibcpp_builddir}/po/share/locale
   AC_SUBST(glibcpp_localedir)
 
+  # A standalone libintl (e.g., GNU libintl) may be in use.
+  if test $USE_NLS = yes; then
+    AC_CHECK_HEADERS([libintl.h], [], USE_NLS=no)
+    AC_SEARCH_LIBS(gettext, intl, [], USE_NLS=no)
+  fi
+  if test $USE_NLS = yes; then
+    AC_DEFINE(_GLIBCPP_USE_NLS)
+  fi
+
   AC_SUBST(USE_NLS)
   AC_SUBST(CLOCALE_H)
   AC_SUBST(CCODECVT_H)
@@ -1474,6 +1434,36 @@ AC_DEFUN(GLIBCPP_ENABLE_CSTDIO, [
 
 
 dnl
+dnl Check to see if building and using a C++ precompiled header can be done.
+dnl
+dnl GLIBCPP_CHECK_PCH
+dnl
+dnl If it looks like it may work, flip bits on in include/Makefile.am
+dnl
+AC_DEFUN(GLIBCPP_CHECK_PCH, [
+  ac_test_CXXFLAGS="${CXXFLAGS+set}"
+  ac_save_CXXFLAGS="$CXXFLAGS"
+  CXXFLAGS='-Werror -Winvalid-pch -Wno-deprecated -x c++-header'
+
+  AC_MSG_CHECKING([for compiler that seems to compile .gch files])
+  if test x${glibcpp_pch_comp+set} != xset; then
+    AC_CACHE_VAL(glibcpp_pch_comp, [
+      AC_LANG_SAVE
+      AC_LANG_CPLUSPLUS
+      AC_TRY_COMPILE([#include <math.h>
+                    ],
+                     [ $1(0);],
+                     [glibcpp_pch_comp=yes], [glibcpp_pch_comp=no])
+      AC_LANG_RESTORE
+    ])
+  fi
+  AC_MSG_RESULT([$glibcpp_pch_comp])
+
+  CXXFLAGS="$ac_save_CXXFLAGS"
+  AM_CONDITIONAL(GLIBCPP_BUILD_PCH, test "$glibcpp_pch_comp" = yes)
+])
+
+dnl
 dnl Setup to use the gcc gthr.h thread-specific memory and mutex model.
 dnl We must stage the required headers so that they will be installed
 dnl with the library (unlike libgcc, the STL implementation is provided
@@ -1888,7 +1878,7 @@ AC_DEFUN(GLIBCPP_EXPORT_FLAGS, [
   OPTIMIZE_CXXFLAGS=
   AC_SUBST(OPTIMIZE_CXXFLAGS)
 
-  WARN_FLAGS='-Wall -Wno-format -W -Wwrite-strings -Winline'
+  WARN_FLAGS='-Wall -Wno-format -W -Wwrite-strings'
   AC_SUBST(WARN_FLAGS)
 ])
 
@@ -1964,11 +1954,16 @@ if test x"$glibcpp_toolexecdir" = x"no"; then
   if test -n "$with_cross_host" &&
      test x"$with_cross_host" != x"no"; then
     glibcpp_toolexecdir='$(exec_prefix)/$(target_alias)'
-    glibcpp_toolexeclibdir='$(toolexecdir)/lib$(MULTISUBDIR)'
+    glibcpp_toolexeclibdir='$(toolexecdir)/lib'
   else
     glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
-    glibcpp_toolexeclibdir='$(libdir)$(MULTISUBDIR)'
+    glibcpp_toolexeclibdir='$(libdir)'
   fi
+  multi_os_directory=`$CC -print-multi-os-directory`
+  case $multi_os_directory in
+  .) ;; # Avoid trailing /.
+  *) glibcpp_toolexeclibdir=$glibcpp_toolexeclibdir/$multi_os_directory ;;
+  esac
 fi
 
 AC_MSG_CHECKING([for install location])
@@ -2128,9 +2123,15 @@ AC_DEFUN(GLIBCPP_CONFIGURE_TESTSUITE, [
   baseline_file="${glibcpp_srcdir}/config/abi/${abi_baseline_triplet}/baseline_symbols.txt"
   AC_SUBST(baseline_file)
 
+  case "$target" in
+    *-*-cygwin* ) enable_abi_check=no ;;
+    * ) enable_abi_check=yes ;;
+  esac
+
   # Don't do ABI checking unless native.
   AM_CONDITIONAL(GLIBCPP_BUILD_ABI_CHECK,
-                 test x"$build" = x"$host" && test -z "$with_cross_host")
+                 test x"$build" = x"$host" && test -z "$with_cross_host" \
+                && test "$enable_abi_check" = yes )
 ])
 
 
@@ -2144,6 +2145,45 @@ AC_DEFUN([AC_LIBTOOL_DLOPEN])
 AC_DEFUN([AC_PROG_LD])
 ])
 
+dnl
+dnl Check whether S_ISREG (Posix) or S_IFREG is available in <sys/stat.h>.
+dnl
+
+AC_DEFUN(GLIBCPP_CHECK_S_ISREG_OR_S_IFREG, [
+  AC_CACHE_VAL(glibcpp_cv_S_ISREG, [
+    AC_TRY_LINK([#include <sys/stat.h>],
+                [struct stat buffer; fstat(0, &buffer); S_ISREG(buffer.st_mode); ],
+                [glibcpp_cv_S_ISREG=yes],
+                [glibcpp_cv_S_ISREG=no])
+  ])
+  AC_CACHE_VAL(glibcpp_cv_S_IFREG, [
+    AC_TRY_LINK([#include <sys/stat.h>],
+                [struct stat buffer; fstat(0, &buffer); S_IFREG & buffer.st_mode; ],
+                [glibcpp_cv_S_IFREG=yes],
+                [glibcpp_cv_S_IFREG=no])
+  ])
+  if test x$glibcpp_cv_S_ISREG = xyes; then
+    AC_DEFINE(HAVE_S_ISREG)
+  elif test x$glibcpp_cv_S_IFREG = xyes; then
+    AC_DEFINE(HAVE_S_IFREG)
+  fi
+])
+
+dnl
+dnl Check whether poll is available in <poll.h>.
+dnl
+
+AC_DEFUN(GLIBCPP_CHECK_POLL, [
+  AC_CACHE_VAL(glibcpp_cv_POLL, [
+    AC_TRY_COMPILE([#include <poll.h>],
+                [struct pollfd pfd[1]; pfd[0].events = POLLIN; poll(pfd, 1, 0); ],
+                [glibcpp_cv_POLL=yes],
+                [glibcpp_cv_POLL=no])
+  ])
+  if test x$glibcpp_cv_POLL = xyes; then
+    AC_DEFINE(HAVE_POLL)
+  fi
+])
 
 # Check whether LC_MESSAGES is available in <locale.h>.
 # Ulrich Drepper <drepper@cygnus.com>, 1995.