From fcc94136e70cda4112321b6661eac456eb703510 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Wed, 2 Mar 2005 16:19:15 +0000 Subject: [PATCH] Check for bad interaction between gethostname and FP computations. git-svn-id: https://svn.dealii.org/trunk@9951 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/aclocal.m4 | 8 +++-- deal.II/configure | 80 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 85 insertions(+), 3 deletions(-) diff --git a/deal.II/aclocal.m4 b/deal.II/aclocal.m4 index 4de5129f7d..77dc38b897 100644 --- a/deal.II/aclocal.m4 +++ b/deal.II/aclocal.m4 @@ -3979,6 +3979,7 @@ AC_DEFUN(DEAL_II_CHECK_GETHOSTNAME, dnl [ #include #include +#include int main() { @@ -3988,11 +3989,14 @@ int main() volatile long double x=1.0; x += std::numeric_limits::epsilon(); - return (x != 1.0); + if (x == 1.0) + return 1; // this shouldn't happen... + else + return 0; } ], [ - AC_MSG_RESULT(ok) + AC_MSG_RESULT(no) ], [ AC_MSG_RESULT([yes. disabling gethostname()]) diff --git a/deal.II/configure b/deal.II/configure index 0b86de7bb9..d4d836f43d 100755 --- a/deal.II/configure +++ b/deal.II/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 1.185 . +# From configure.in Revision: 1.186 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59. # @@ -8126,6 +8126,7 @@ fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + for ac_func in gethostname do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` @@ -8228,6 +8229,83 @@ fi done + echo "$as_me:$LINENO: checking for bad gethostname/FPU interaction" >&5 +echo $ECHO_N "checking for bad gethostname/FPU interaction... $ECHO_C" >&6 + 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 + + CXXFLAGS="$CXXFLAGSG" + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#include +#include +#include + +int main() +{ + char buf[100]; + gethostname(buf,99); + + volatile long double x=1.0; + x += std::numeric_limits::epsilon(); + + if (x == 1.0) + return 1; // this shouldn't happen... + else + return 0; +} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (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 + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) + + echo "$as_me:$LINENO: result: yes. disabling gethostname()" >&5 +echo "${ECHO_T}yes. disabling gethostname()" >&6 + +cat >>confdefs.h <<\_ACEOF +#define DEAL_II_BROKEN_GETHOSTNAME 1 +_ACEOF + + +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + -- 2.39.5