Commit 222a5b1d by Rainer Orth Committed by Rainer Orth

linkage.m4 (GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_0): Define.

	* linkage.m4 (GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_0): Define.
	(GLIBCXX_CHECK_STDLIB_SUPPORT): Use it to test for lrand48
	instead of drand48.
	* acconfig.h (HAVE_DRAND48): Renamed to HAVE_LRAND48.
	* crossconfig.m4 (*-freebsd*): Define HAVE_LRAND48 instead of
	HAVE_DRAND48.
	* config.h.in, configure: Regenerate.
	* include/bits/stl_algo.h: Use _GLIBCXX_HAVE_LRAND48 to guard
	lrand48 use.

From-SVN: r71990
parent 64177a6d
2003-10-01 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* linkage.m4 (GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_0): Define.
(GLIBCXX_CHECK_STDLIB_SUPPORT): Use it to test for lrand48
instead of drand48.
* acconfig.h (HAVE_DRAND48): Renamed to HAVE_LRAND48.
* crossconfig.m4 (*-freebsd*): Define HAVE_LRAND48 instead of
HAVE_DRAND48.
* config.h.in, configure: Regenerate.
* include/bits/stl_algo.h: Use _GLIBCXX_HAVE_LRAND48 to guard
lrand48 use.
2003-10-01 Nathan Myers <ncm@cantrip.org> 2003-10-01 Nathan Myers <ncm@cantrip.org>
* include/bits/locale_facets.tcc (time_put::put): Avoid * include/bits/locale_facets.tcc (time_put::put): Avoid
......
...@@ -63,8 +63,8 @@ ...@@ -63,8 +63,8 @@
// Define if gthr-default.h exists (meaning that threading support is enabled). // Define if gthr-default.h exists (meaning that threading support is enabled).
#undef HAVE_GTHR_DEFAULT #undef HAVE_GTHR_DEFAULT
// Define if drand48 exists. // Define if lrand48 exists.
#undef HAVE_DRAND48 #undef HAVE_LRAND48
// Define if getpagesize exists. // Define if getpagesize exists.
#undef HAVE_GETPAGESIZE #undef HAVE_GETPAGESIZE
......
...@@ -64,8 +64,8 @@ ...@@ -64,8 +64,8 @@
// Define if gthr-default.h exists (meaning that threading support is enabled). // Define if gthr-default.h exists (meaning that threading support is enabled).
#undef HAVE_GTHR_DEFAULT #undef HAVE_GTHR_DEFAULT
// Define if drand48 exists. // Define if lrand48 exists.
#undef HAVE_DRAND48 #undef HAVE_LRAND48
// Define if getpagesize exists. // Define if getpagesize exists.
#undef HAVE_GETPAGESIZE #undef HAVE_GETPAGESIZE
...@@ -221,8 +221,8 @@ ...@@ -221,8 +221,8 @@
/* Define to 1 if you have the `cosl' function. */ /* Define to 1 if you have the `cosl' function. */
#undef HAVE_COSL #undef HAVE_COSL
/* Define to 1 if you have the `drand48' function. */ /* Define to 1 if you have the `lrand48' function. */
#undef HAVE_DRAND48 #undef HAVE_LRAND48
/* Define to 1 if you have the <endian.h> header file. */ /* Define to 1 if you have the <endian.h> header file. */
#undef HAVE_ENDIAN_H #undef HAVE_ENDIAN_H
......
...@@ -26140,7 +26140,72 @@ done ...@@ -26140,7 +26140,72 @@ done
fi fi
for ac_func in drand48 echo "$as_me:$LINENO: checking for lrand48 declaration" >&5
echo $ECHO_N "checking for lrand48 declaration... $ECHO_C" >&6
if test x${glibcxx_cv_func_lrand48_use+set} != xset; then
if test "${glibcxx_cv_func_lrand48_use+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_ext=cc
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <stdlib.h>
int
main ()
{
lrand48();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
glibcxx_cv_func_lrand48_use=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
glibcxx_cv_func_lrand48_use=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
fi
fi
echo "$as_me:$LINENO: result: $glibcxx_cv_func_lrand48_use" >&5
echo "${ECHO_T}$glibcxx_cv_func_lrand48_use" >&6
if test x$glibcxx_cv_func_lrand48_use = x"yes"; then
for ac_func in lrand48
do do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5 echo "$as_me:$LINENO: checking for $ac_func" >&5
...@@ -26228,6 +26293,8 @@ _ACEOF ...@@ -26228,6 +26293,8 @@ _ACEOF
fi fi
done done
fi
CXXFLAGS="$ac_save_CXXFLAGS" CXXFLAGS="$ac_save_CXXFLAGS"
...@@ -46100,7 +46167,72 @@ done ...@@ -46100,7 +46167,72 @@ done
fi fi
for ac_func in drand48 echo "$as_me:$LINENO: checking for lrand48 declaration" >&5
echo $ECHO_N "checking for lrand48 declaration... $ECHO_C" >&6
if test x${glibcxx_cv_func_lrand48_use+set} != xset; then
if test "${glibcxx_cv_func_lrand48_use+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_ext=cc
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <stdlib.h>
int
main ()
{
lrand48();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -s conftest.$ac_objext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); }; }; then
glibcxx_cv_func_lrand48_use=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
glibcxx_cv_func_lrand48_use=no
fi
rm -f conftest.$ac_objext conftest.$ac_ext
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu
fi
fi
echo "$as_me:$LINENO: result: $glibcxx_cv_func_lrand48_use" >&5
echo "${ECHO_T}$glibcxx_cv_func_lrand48_use" >&6
if test x$glibcxx_cv_func_lrand48_use = x"yes"; then
for ac_func in lrand48
do do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
echo "$as_me:$LINENO: checking for $ac_func" >&5 echo "$as_me:$LINENO: checking for $ac_func" >&5
...@@ -46188,6 +46320,8 @@ _ACEOF ...@@ -46188,6 +46320,8 @@ _ACEOF
fi fi
done done
fi
CXXFLAGS="$ac_save_CXXFLAGS" CXXFLAGS="$ac_save_CXXFLAGS"
...@@ -48730,7 +48864,7 @@ echo "${ECHO_T}$enable_wchar_t" >&6 ...@@ -48730,7 +48864,7 @@ echo "${ECHO_T}$enable_wchar_t" >&6
_ACEOF _ACEOF
cat >>confdefs.h <<\_ACEOF cat >>confdefs.h <<\_ACEOF
#define HAVE_DRAND48 1 #define HAVE_LRAND48 1
_ACEOF _ACEOF
cat >>confdefs.h <<\_ACEOF cat >>confdefs.h <<\_ACEOF
...@@ -54,7 +54,7 @@ case "${host}" in ...@@ -54,7 +54,7 @@ case "${host}" in
GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT GLIBCXX_CHECK_COMPLEX_MATH_SUPPORT
GLIBCXX_CHECK_WCHAR_T_SUPPORT GLIBCXX_CHECK_WCHAR_T_SUPPORT
AC_DEFINE(HAVE_LC_MESSAGES) AC_DEFINE(HAVE_LC_MESSAGES)
AC_DEFINE(HAVE_DRAND48) AC_DEFINE(HAVE_LRAND48)
AC_DEFINE(HAVE_GETPAGESIZE) AC_DEFINE(HAVE_GETPAGESIZE)
AC_DEFINE(HAVE_SETENV) AC_DEFINE(HAVE_SETENV)
AC_DEFINE(HAVE_SIGSETJMP) AC_DEFINE(HAVE_SIGSETJMP)
......
...@@ -1612,7 +1612,7 @@ namespace std ...@@ -1612,7 +1612,7 @@ namespace std
inline _Distance inline _Distance
__random_number(_Distance __n) __random_number(_Distance __n)
{ {
#ifdef _GLIBCXX_HAVE_DRAND48 #ifdef _GLIBCXX_HAVE_LRAND48
return lrand48() % __n; return lrand48() % __n;
#else #else
return rand() % __n; return rand() % __n;
......
...@@ -173,6 +173,35 @@ dnl 2) has "C" linkage ...@@ -173,6 +173,35 @@ dnl 2) has "C" linkage
dnl dnl
dnl argument 1 is name of function to check dnl argument 1 is name of function to check
dnl dnl
dnl ASSUMES argument is a stdlib function without parameters
dnl
dnl GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_0
AC_DEFUN(GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_0, [
AC_MSG_CHECKING([for $1 declaration])
if test x${glibcxx_cv_func_$1_use+set} != xset; then
AC_CACHE_VAL(glibcxx_cv_func_$1_use, [
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
AC_TRY_COMPILE([#include <stdlib.h>],
[ $1();],
[glibcxx_cv_func_$1_use=yes], [glibcxx_cv_func_$1_use=no])
AC_LANG_RESTORE
])
fi
AC_MSG_RESULT($glibcxx_cv_func_$1_use)
if test x$glibcxx_cv_func_$1_use = x"yes"; then
AC_CHECK_FUNCS($1)
fi
])
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 math function with TWO parameters dnl ASSUMES argument is a math function with TWO parameters
dnl dnl
dnl GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_2 dnl GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_2
...@@ -342,7 +371,7 @@ dnl This might seem like overkill but experience has shown that it's not... ...@@ -342,7 +371,7 @@ dnl This might seem like overkill but experience has shown that it's not...
dnl dnl
dnl Define HAVE_STRTOLD if "strtold" is declared and links dnl Define HAVE_STRTOLD if "strtold" is declared and links
dnl Define HAVE_STRTOF if "strtof" is declared and links dnl Define HAVE_STRTOF if "strtof" is declared and links
dnl Define HAVE_DRAND48 if "drand48" is declared and links dnl Define HAVE_LRAND48 if "lrand48" is declared and links
dnl dnl
dnl GLIBCXX_CHECK_STDLIB_SUPPORT dnl GLIBCXX_CHECK_STDLIB_SUPPORT
AC_DEFUN(GLIBCXX_CHECK_STDLIB_SUPPORT, [ AC_DEFUN(GLIBCXX_CHECK_STDLIB_SUPPORT, [
...@@ -352,7 +381,7 @@ AC_DEFUN(GLIBCXX_CHECK_STDLIB_SUPPORT, [ ...@@ -352,7 +381,7 @@ AC_DEFUN(GLIBCXX_CHECK_STDLIB_SUPPORT, [
GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtold) GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtold)
GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtof) GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_2(strtof)
AC_CHECK_FUNCS(drand48) GLIBCXX_CHECK_STDLIB_DECL_AND_LINKAGE_0(lrand48)
CXXFLAGS="$ac_save_CXXFLAGS" CXXFLAGS="$ac_save_CXXFLAGS"
]) ])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment