From abec8f96e3e35fbb306c957674809c4ace04a620 Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Wed, 27 Oct 2004 23:03:44 +0000 Subject: [PATCH] Changes to support rand48 tests git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@17284 91177308-0d34-0410-b5e6-96231b3b80d8 --- autoconf/AutoRegen.sh | 2 +- autoconf/configure.ac | 3 +- autoconf/m4/func_isinf.m4 | 36 ++- autoconf/m4/func_isnan.m4 | 27 ++- autoconf/m4/rand48.m4 | 12 + autoconf/m4/single_cxx_check.m4 | 18 +- configure | 228 ++++++++++++++---- .../Interpreter/ExternalFunctions.cpp | 15 ++ 8 files changed, 255 insertions(+), 86 deletions(-) create mode 100644 autoconf/m4/rand48.m4 diff --git a/autoconf/AutoRegen.sh b/autoconf/AutoRegen.sh index c3210bf1876..55f56f32c9c 100755 --- a/autoconf/AutoRegen.sh +++ b/autoconf/AutoRegen.sh @@ -48,5 +48,5 @@ echo "Regenerating configure with autoconf 2.59" autoconf --force --warnings=all -o ../$outfile $configfile || die "autoconf failed" cd .. echo "Regenerating config.h.in with autoheader 2.59" -autoheader -I autoconf -I autoconf/m4 autoconf/$configfile || die "autoheader failed" +autoheader --warnings=all -I autoconf -I autoconf/m4 autoconf/$configfile || die "autoheader failed" exit 0 diff --git a/autoconf/configure.ac b/autoconf/configure.ac index 82f1eeedfb2..b86ff8d888a 100644 --- a/autoconf/configure.ac +++ b/autoconf/configure.ac @@ -1,5 +1,5 @@ dnl Initialize autoconf -AC_INIT([[LLVM]],[[1.4]],[llvmbugs@cs.uiuc.edu]) +AC_INIT([[llvm]],[[1.4]],[llvmbugs@cs.uiuc.edu]) dnl Place all of the extra autoconf files into the config subdirectory dnl Tell various tools where the m4 autoconf macros are @@ -318,6 +318,7 @@ AC_CXX_HAVE_FWD_ITERATOR AC_FUNC_ISNAN AC_FUNC_ISINF +AC_FUNC_RAND48 dnl Checks for library functions. AC_FUNC_ALLOCA diff --git a/autoconf/m4/func_isinf.m4 b/autoconf/m4/func_isinf.m4 index dc0c22e9258..c372dd8578b 100644 --- a/autoconf/m4/func_isinf.m4 +++ b/autoconf/m4/func_isinf.m4 @@ -3,22 +3,34 @@ # platform. # AC_DEFUN([AC_FUNC_ISINF],[ -AC_SINGLE_CXX_CHECK([HAVE_ISINF_IN_MATH_H], [ac_cv_func_isinf_in_math_h], +AC_SINGLE_CXX_CHECK([ac_cv_func_isinf_in_math_h], [isinf], [], - [#include - int foo(float f) {return isinf(f);}]) -AC_SINGLE_CXX_CHECK([HAVE_ISINF_IN_CMATH], [ac_cv_func_isinf_in_cmath], + [float f; isinf(f);]) +if test "$ac_cv_func_isinf_in_math_h" = "yes" ; then + AC_DEFINE([HAVE_ISINF_IN_MATH_H],1,[Set to 1 if the isinf function is found in ]) +fi + +AC_SINGLE_CXX_CHECK([ac_cv_func_isinf_in_cmath], [isinf], [], - [#include - int foo(float f) {return isinf(f);}]) -AC_SINGLE_CXX_CHECK([HAVE_STD_ISINF_IN_CMATH], [ac_cv_func_std_isinf_in_cmath], + [float f; isinf(f);]) +if test "$ac_cv_func_isinf_in_cmath" = "yes" ; then + AC_DEFINE([HAVE_ISINF_IN_CMATH],1,[Set to 1 if the isinf function is found in ]) +fi + +AC_SINGLE_CXX_CHECK([ac_cv_func_std_isinf_in_cmath], [std::isinf], [], - [#include - using std::isinf; int foo(float f) {return isinf(f);}]) -AC_SINGLE_CXX_CHECK([HAVE_FINITE_IN_IEEEFP_H], [ac_cv_func_finite_in_ieeefp_h], + [float f; std::isinf(f)}]) +if test "$ac_cv_func_std_isinf_in_cmath" = "yes" ; then + AC_DEFINE([HAVE_STD_ISINF_IN_CMATH],1,[Set to 1 if the std::isinf function is found in ]) +fi + +AC_SINGLE_CXX_CHECK([ac_cv_func_finite_in_ieeefp_h], [finite], [], - [#include - int foo(float f) {return finite(f);}]) + [float f; finite(f);]) +if test "$ac_cv_func_finite_in_ieefp_h" = "yes" ; then + AC_DEFINE([HAVE_FINITE_IN_IEEFP_H],1,[Set to 1 if the finite function is found in ]) +fi + ]) diff --git a/autoconf/m4/func_isnan.m4 b/autoconf/m4/func_isnan.m4 index 8e626fe15b3..eb5ca0daeb5 100644 --- a/autoconf/m4/func_isnan.m4 +++ b/autoconf/m4/func_isnan.m4 @@ -3,16 +3,25 @@ # platform. # AC_DEFUN([AC_FUNC_ISNAN],[ -AC_SINGLE_CXX_CHECK([HAVE_ISNAN_IN_MATH_H], [ac_cv_func_isnan_in_math_h], +AC_SINGLE_CXX_CHECK([ac_cv_func_isnan_in_math_h], [isnan], [], - [#include - int foo(float f) {return isnan(f);}]) -AC_SINGLE_CXX_CHECK([HAVE_ISNAN_IN_CMATH], [ac_cv_func_isnan_in_cmath], + [float f; isnan(f);]) + +if test "$ac_cv_func_isnan_in_math_h" = "yes" ; then + AC_DEFINE([HAVE_ISNAN_IN_MATH_H],1,[Set to 1 if the isnan function is found in ]) +fi + +AC_SINGLE_CXX_CHECK([ac_cv_func_isnan_in_cmath], [isnan], [], - [#include - int foo(float f) {return isnan(f);}]) -AC_SINGLE_CXX_CHECK([HAVE_STD_ISNAN_IN_CMATH], [ac_cv_func_std_isnan_in_cmath], + [float f; isnan(f);]) +if test "$ac_cv_func_isnan_in_cmath" = "yes" ; then + AC_DEFINE([HAVE_ISNAN_IN_CMATH],1,[Set to 1 if the isnan function is found in ]) +fi + +AC_SINGLE_CXX_CHECK([ac_cv_func_std_isnan_in_cmath], [std::isnan], [], - [#include - using std::isnan; int foo(float f) {return isnan(f);}]) + [float f; std::isnan(f);]) +if test "$ac_cv_func_std_isnan_in_cmath" = "yes" ; then + AC_DEFINE([HAVE_STD_ISNAN_IN_CMATH],1,[Set to 1 if the std::isnan function is found in ]) +fi ]) diff --git a/autoconf/m4/rand48.m4 b/autoconf/m4/rand48.m4 new file mode 100644 index 00000000000..56705d85c9c --- /dev/null +++ b/autoconf/m4/rand48.m4 @@ -0,0 +1,12 @@ +# +# This function determins if the the srand48,drand48,lrand48 functions are +# available on this platform. +# +AC_DEFUN([AC_FUNC_RAND48],[ +AC_SINGLE_CXX_CHECK([ac_cv_func_rand48], + [srand48/lrand48/drand48], [], + [srand48(0);lrand48();drand48();]) +if test "$ac_cv_func_rand48" = "yes" ; then +AC_DEFINE([HAVE_RAND48],1,[Define to 1 if srand48/lrand48/drand48 exist in ]) +fi +]) diff --git a/autoconf/m4/single_cxx_check.m4 b/autoconf/m4/single_cxx_check.m4 index 516bc9f605d..21efa4bed35 100644 --- a/autoconf/m4/single_cxx_check.m4 +++ b/autoconf/m4/single_cxx_check.m4 @@ -1,14 +1,10 @@ -dnl AC_SINGLE_CXX_CHECK(DEFINEVAR, CACHEVAR, FUNCTION, HEADER, PROGRAM) -dnl $1, $2, $3, $4, $5 +dnl AC_SINGLE_CXX_CHECK(CACHEVAR, FUNCTION, HEADER, PROGRAM) +dnl $1, $2, $3, $4, dnl AC_DEFUN([AC_SINGLE_CXX_CHECK], -[AC_CACHE_CHECK([for $3 in $4], [$2], - [AC_LANG_PUSH([C++]) - AC_COMPILE_IFELSE(AC_LANG_SOURCE([$5]),[$2=yes],[$2=no]) - AC_LANG_POP([C++])]) - if test "$$2" = "yes" - then - AC_DEFINE($1, 1, [Define to 1 if your compiler defines $3 in the $4 - header file.]) - fi]) + [AC_CACHE_CHECK([for $2 in $3], [$1], + [AC_LANG_PUSH([C++]) + AC_COMPILE_IFELSE(AC_LANG_PROGRAM([#include $3],[$4]),[$1=yes],[$1=no]) + AC_LANG_POP([C++])]) + ]) diff --git a/configure b/configure index 9d5b997c92d..675d7dabf6f 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for LLVM 1.4. +# Generated by GNU Autoconf 2.59 for llvm 1.4. # # Report bugs to . # @@ -421,10 +421,10 @@ SHELL=${CONFIG_SHELL-/bin/sh} : ${ac_max_here_lines=38} # Identity of this package. -PACKAGE_NAME='LLVM' +PACKAGE_NAME='llvm' PACKAGE_TARNAME='-llvm-' PACKAGE_VERSION='1.4' -PACKAGE_STRING='LLVM 1.4' +PACKAGE_STRING='llvm 1.4' PACKAGE_BUGREPORT='llvmbugs@cs.uiuc.edu' ac_unique_file=""Makefile.config.in"" @@ -962,7 +962,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures LLVM 1.4 to adapt to many kinds of systems. +\`configure' configures llvm 1.4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1024,7 +1024,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of LLVM 1.4:";; + short | recursive ) echo "Configuration of llvm 1.4:";; esac cat <<\_ACEOF @@ -1164,7 +1164,7 @@ fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -LLVM configure 1.4 +llvm configure 1.4 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -1178,7 +1178,7 @@ cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by LLVM $as_me 1.4, which was +It was created by llvm $as_me 1.4, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -22562,14 +22562,20 @@ 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 + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include - int foo(float f) {return isnan(f);} +int +main () +{ +float f; isnan(f); + ; + return 0; +} _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -22601,7 +22607,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_isnan_in_math_h=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=c + 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' @@ -22610,14 +22616,16 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_func_isnan_in_math_h" >&5 echo "${ECHO_T}$ac_cv_func_isnan_in_math_h" >&6 - if test "$ac_cv_func_isnan_in_math_h" = "yes" - then + + +if test "$ac_cv_func_isnan_in_math_h" = "yes" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_ISNAN_IN_MATH_H 1 _ACEOF - fi +fi + echo "$as_me:$LINENO: checking for isnan in " >&5 echo $ECHO_N "checking for isnan in ... $ECHO_C" >&6 if test "${ac_cv_func_isnan_in_cmath+set}" = set; then @@ -22629,14 +22637,20 @@ 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 + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include - int foo(float f) {return isnan(f);} +int +main () +{ +float f; isnan(f); + ; + return 0; +} _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -22668,7 +22682,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_isnan_in_cmath=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=c + 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' @@ -22677,14 +22691,15 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_func_isnan_in_cmath" >&5 echo "${ECHO_T}$ac_cv_func_isnan_in_cmath" >&6 - if test "$ac_cv_func_isnan_in_cmath" = "yes" - then + +if test "$ac_cv_func_isnan_in_cmath" = "yes" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_ISNAN_IN_CMATH 1 _ACEOF - fi +fi + echo "$as_me:$LINENO: checking for std::isnan in " >&5 echo $ECHO_N "checking for std::isnan in ... $ECHO_C" >&6 if test "${ac_cv_func_std_isnan_in_cmath+set}" = set; then @@ -22696,14 +22711,20 @@ 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 + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include - using std::isnan; int foo(float f) {return isnan(f);} +int +main () +{ +float f; std::isnan(f); + ; + return 0; +} _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -22735,7 +22756,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_std_isnan_in_cmath=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=c + 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' @@ -22744,14 +22765,14 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_func_std_isnan_in_cmath" >&5 echo "${ECHO_T}$ac_cv_func_std_isnan_in_cmath" >&6 - if test "$ac_cv_func_std_isnan_in_cmath" = "yes" - then + +if test "$ac_cv_func_std_isnan_in_cmath" = "yes" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_STD_ISNAN_IN_CMATH 1 _ACEOF - fi +fi echo "$as_me:$LINENO: checking for isinf in " >&5 @@ -22765,14 +22786,20 @@ 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 + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include - int foo(float f) {return isinf(f);} +int +main () +{ +float f; isinf(f); + ; + return 0; +} _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -22804,7 +22831,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_isinf_in_math_h=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=c + 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' @@ -22813,14 +22840,15 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_func_isinf_in_math_h" >&5 echo "${ECHO_T}$ac_cv_func_isinf_in_math_h" >&6 - if test "$ac_cv_func_isinf_in_math_h" = "yes" - then + +if test "$ac_cv_func_isinf_in_math_h" = "yes" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_ISINF_IN_MATH_H 1 _ACEOF - fi +fi + echo "$as_me:$LINENO: checking for isinf in " >&5 echo $ECHO_N "checking for isinf in ... $ECHO_C" >&6 if test "${ac_cv_func_isinf_in_cmath+set}" = set; then @@ -22832,14 +22860,20 @@ 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 + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include - int foo(float f) {return isinf(f);} +int +main () +{ +float f; isinf(f); + ; + return 0; +} _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -22871,7 +22905,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_isinf_in_cmath=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=c + 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' @@ -22880,14 +22914,15 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_func_isinf_in_cmath" >&5 echo "${ECHO_T}$ac_cv_func_isinf_in_cmath" >&6 - if test "$ac_cv_func_isinf_in_cmath" = "yes" - then + +if test "$ac_cv_func_isinf_in_cmath" = "yes" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_ISINF_IN_CMATH 1 _ACEOF - fi +fi + echo "$as_me:$LINENO: checking for std::isinf in " >&5 echo $ECHO_N "checking for std::isinf in ... $ECHO_C" >&6 if test "${ac_cv_func_std_isinf_in_cmath+set}" = set; then @@ -22899,14 +22934,20 @@ 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 + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include - using std::isinf; int foo(float f) {return isinf(f);} +int +main () +{ +float f; std::isinf(f)} + ; + return 0; +} _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -22938,7 +22979,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_std_isinf_in_cmath=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=c + 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' @@ -22947,14 +22988,15 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_func_std_isinf_in_cmath" >&5 echo "${ECHO_T}$ac_cv_func_std_isinf_in_cmath" >&6 - if test "$ac_cv_func_std_isinf_in_cmath" = "yes" - then + +if test "$ac_cv_func_std_isinf_in_cmath" = "yes" ; then cat >>confdefs.h <<\_ACEOF #define HAVE_STD_ISINF_IN_CMATH 1 _ACEOF - fi +fi + echo "$as_me:$LINENO: checking for finite in " >&5 echo $ECHO_N "checking for finite in ... $ECHO_C" >&6 if test "${ac_cv_func_finite_in_ieeefp_h+set}" = set; then @@ -22966,14 +23008,20 @@ 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 + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include - int foo(float f) {return finite(f);} +int +main () +{ +float f; finite(f); + ; + return 0; +} _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 @@ -23005,7 +23053,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_finite_in_ieeefp_h=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - ac_ext=c + 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' @@ -23014,14 +23062,90 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_func_finite_in_ieeefp_h" >&5 echo "${ECHO_T}$ac_cv_func_finite_in_ieeefp_h" >&6 - if test "$ac_cv_func_finite_in_ieeefp_h" = "yes" - then + +if test "$ac_cv_func_finite_in_ieefp_h" = "yes" ; then cat >>confdefs.h <<\_ACEOF -#define HAVE_FINITE_IN_IEEEFP_H 1 +#define HAVE_FINITE_IN_IEEFP_H 1 _ACEOF - fi +fi + + + +echo "$as_me:$LINENO: checking for srand48/lrand48/drand48 in " >&5 +echo $ECHO_N "checking for srand48/lrand48/drand48 in ... $ECHO_C" >&6 +if test "${ac_cv_func_rand48+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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +srand48(0);lrand48();drand48(); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_cxx_werror_flag" + || test ! -s conftest.err' + { (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); }; } && + { 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 + ac_cv_func_rand48=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_rand48=no +fi +rm -f conftest.err 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 +echo "$as_me:$LINENO: result: $ac_cv_func_rand48" >&5 +echo "${ECHO_T}$ac_cv_func_rand48" >&6 + +if test "$ac_cv_func_rand48" = "yes" ; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_RAND48 1 +_ACEOF + +fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works @@ -24875,7 +24999,7 @@ _ASBOX } >&5 cat >&5 <<_CSEOF -This file was extended by LLVM $as_me 1.4, which was +This file was extended by llvm $as_me 1.4, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -24941,7 +25065,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -LLVM config.status 1.4 +llvm config.status 1.4 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" diff --git a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp b/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp index def406a4b70..2f3469ca854 100644 --- a/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp +++ b/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp @@ -213,6 +213,8 @@ GenericValue lle_X_floor(FunctionType *M, const vector &Args) { return GV; } +#ifdef HAVE_RAND48 + // double drand48() GenericValue lle_X_drand48(FunctionType *M, const vector &Args) { assert(Args.size() == 0); @@ -236,6 +238,16 @@ GenericValue lle_X_srand48(FunctionType *M, const vector &Args) { return GenericValue(); } +#endif + +// int rand() +GenericValue lle_X_rand(FunctionType *M, const vector &Args) { + assert(Args.size() == 0); + GenericValue GV; + GV.IntVal = rand(); + return GV; +} + // void srand(uint) GenericValue lle_X_srand(FunctionType *M, const vector &Args) { assert(Args.size() == 1); @@ -676,9 +688,12 @@ void Interpreter::initializeExternalFunctions() { FuncNames["lle_X_log"] = lle_X_log; FuncNames["lle_X_floor"] = lle_X_floor; FuncNames["lle_X_srand"] = lle_X_srand; + FuncNames["lle_X_rand"] = lle_X_rand; +#ifdef HAVE_RAND48 FuncNames["lle_X_drand48"] = lle_X_drand48; FuncNames["lle_X_srand48"] = lle_X_srand48; FuncNames["lle_X_lrand48"] = lle_X_lrand48; +#endif FuncNames["lle_X_sqrt"] = lle_X_sqrt; FuncNames["lle_X_puts"] = lle_X_puts; FuncNames["lle_X_printf"] = lle_X_printf;