OSDN Git Service

* Makefile.in: Allow for PWDCMD to override hardcoded pwd.
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / acinclude.m4
index 9865cfb..f21ef60 100644 (file)
@@ -38,7 +38,7 @@ AC_DEFUN(GLIBCPP_CONFIGURE, [
   # These need to be absolute paths, yet at the same time need to
   # canonicalize only relative paths, because then amd will not unmount
   # drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
-  glibcpp_builddir=`pwd`
+  glibcpp_builddir=`${PWDCMD-pwd}`
   case $srcdir in
   [\\/$]* | ?:[\\/]*) glibcpp_srcdir=${srcdir} ;;
   *) glibcpp_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
@@ -554,6 +554,35 @@ AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_2, [
 
 
 dnl
+dnl Check to see if the (stdlib 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 THREE parameters
+dnl
+dnl GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_3
+AC_DEFUN(GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_3, [
+  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 <stdlib.h>], 
+                     [ $1(0, 0, 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
@@ -728,6 +757,7 @@ AC_DEFUN(GLIBCPP_CHECK_MATH_SUPPORT, [
   GLIBCPP_CHECK_MATH_DECLS_AND_LINKAGES_1(float round,
                                           float_round,
                                           ceilf floorf)
+  GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(expf)
   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isnanf)
   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_1(isinff)
   GLIBCPP_CHECK_MATH_DECL_AND_LINKAGE_2(atan2f)
@@ -814,17 +844,19 @@ AC_DEFUN(GLIBCPP_CHECK_COMPLEX_MATH_SUPPORT, [
   AC_CHECK_LIB(m, main)
   AC_REPLACE_MATHFUNCS(nan copysignf)
 
+  dnl For __signbit to signbit conversions.
+  AC_CHECK_FUNCS([__signbit], , [LIBMATHOBJS="$LIBMATHOBJS signbit.lo"])
+  AC_CHECK_FUNCS([__signbitf], , [LIBMATHOBJS="$LIBMATHOBJS signbitf.lo"])
+
   dnl Compile the long double complex functions only if the function 
   dnl provides the non-complex long double functions that are needed.
   dnl Currently this includes copysignl, which should be
   dnl cached from the GLIBCPP_CHECK_MATH_SUPPORT macro, above.
-  USE_COMPLEX_LONG_DOUBLE=no
   if test x$ac_cv_func_copysignl = x"yes"; then
-    USE_COMPLEX_LONG_DOUBLE=yes
-    AC_REPLACE_MATHFUNCS(signbitl)
+    AC_CHECK_FUNCS([__signbitl], , [LIBMATHOBJS="$LIBMATHOBJS signbitl.lo"])
   fi
 
-  AC_SUBST(USE_COMPLEX_LONG_DOUBLE)
+  AC_SUBST(LIBMATHOBJS)
 ])
 
 
@@ -1113,14 +1145,17 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
     esac
   fi
 
+  dnl Deal with gettext issues.
+  AC_ARG_ENABLE(nls,
+  [  --enable-nls            use Native Language Support (default)],
+  , enable_nls=yes)
+  USE_NLS=no
+
   dnl Set configure bits for specified locale package
   case x${enable_clocale_flag} in
     xgeneric)
       AC_MSG_RESULT(generic)
 
-      # Don't use gettext.
-      USE_NLS=no
-
       CLOCALE_H=config/locale/generic/c_locale.h
       CLOCALE_CC=config/locale/generic/c_locale.cc
       CCODECVT_H=config/locale/generic/codecvt_specializations.h
@@ -1139,9 +1174,12 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
       # languages.
       # For some reason, ALL_LINGUAS has to be before AM_GNU_GETTEXT
       ALL_LINGUAS="de fr"
+
       # Don't call AM_GNU_GETTEXT here. Instead, assume glibc.
-      # Need to deal with MSGFMT, USE_NLS, and glibcpp_[P,M]OFILES
-      USE_NLS=yes
+      AC_CHECK_PROG(check_msgfmt, msgfmt, yes, no)
+      if test x"$check_msgfmt" = x"yes" && test x"$enable_nls" = x"yes"; then
+       USE_NLS=yes
+      fi
 
       # Export the build objects.
       for ling in $ALL_LINGUAS; do \
@@ -1165,9 +1203,6 @@ AC_DEFUN(GLIBCPP_ENABLE_CLOCALE, [
     xieee_1003.1-2001)
       AC_MSG_RESULT(generic)
 
-      # Don't use gettext.
-      USE_NLS=no
-
       CLOCALE_H=config/locale/ieee_1003.1-2001/c_locale.h
       CLOCALE_CC=config/locale/ieee_1003.1-2001/c_locale.cc
       CCODECVT_H=config/locale/ieee_1003.1-2001/codecvt_specializations.h
@@ -1657,7 +1692,6 @@ changequote([, ])
     c_shadow) 
         CSHADOW_FLAGS="-fno-builtin"
         C_INCLUDE_DIR='${glibcpp_srcdir}/include/c_shadow'
-        AC_DEFINE(_GLIBCPP_USE_SHADOW_HEADERS)
         ;;
     c_std)   
         CSHADOW_FLAGS=""
@@ -1671,7 +1705,8 @@ changequote([, ])
 
   AC_SUBST(CSHADOW_FLAGS)
   AC_SUBST(C_INCLUDE_DIR)
-  AM_CONDITIONAL(GLIBCPP_USE_CSHADOW, test "$enable_cheaders" = c_shadow)
+  AM_CONDITIONAL(GLIBCPP_C_HEADERS_C, test "$enable_cheaders" = c)
+  AM_CONDITIONAL(GLIBCPP_C_HEADERS_C_STD, test "$enable_cheaders" = c_std)
 ])
 
 
@@ -1812,7 +1847,9 @@ if test $version_specific_libs = yes; then
   gcc_version_trigger=${srcdir}/../gcc/version.c
   gcc_version_full=`grep version_string ${gcc_version_trigger} | sed -e 's/.*\"\([^\"]*\)\".*/\1/'`
   gcc_version=`echo ${gcc_version_full} | sed -e 's/\([^ ]*\) .*/\1/'`
-  gxx_include_dir='$(libdir)/gcc-lib/$(target_alias)/'${gcc_version}/include/g++
+  if test x"$gxx_include_dir" = x"no"; then
+    gxx_include_dir='$(libdir)/gcc-lib/$(target_alias)/'${gcc_version}/include/g++
+  fi
   glibcpp_toolexecdir='$(libdir)/gcc-lib/$(target_alias)'
   glibcpp_toolexeclibdir='$(toolexecdir)/'${gcc_version}'$(MULTISUBDIR)'
   changequote([,])dnl
@@ -1859,10 +1896,7 @@ AC_SUBST(glibcpp_toolexeclibdir)
 
 dnl AC_REPLACE_MATHFUNCS(FUNCTION...)
 AC_DEFUN(AC_REPLACE_MATHFUNCS,
-[AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])
-AC_SUBST(LIBMATHOBJS)dnl
-])
-
+[AC_CHECK_FUNCS([$1], , [LIBMATHOBJS="$LIBMATHOBJS ${ac_func}.lo"])])
 
 
 dnl This macro searches for a GNU version of make.  If a match is found, the
@@ -1989,7 +2023,7 @@ AC_DEFUN(GLIBCPP_CONFIGURE_TESTSUITE, [
   GLIBCPP_CHECK_SETRLIMIT
 
   # Look for setenv, so that extended locale tests can be performed.
-  AC_CHECK_FUNCS(setenv)
+  GLIBCPP_CHECK_STDLIB_DECL_AND_LINKAGE_3(setenv)
 ])
 
 
@@ -2086,7 +2120,7 @@ enable_symvers=GLIBCPP_ENABLE_SYMVERS_DEFAULT)dnl
 # If we never went through the GLIBCPP_CHECK_LINKER_FEATURES macro, then we
 # don't know enough about $LD to do tricks... 
 if test x$enable_shared = xno || 
-       test x$LD = x || 
+       test "x$LD" = x || 
        test x$glibcpp_gnu_ld_version = x; then
   enable_symvers=no
 fi