]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Check for gethostname interactions.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 2 Mar 2005 16:05:34 +0000 (16:05 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 2 Mar 2005 16:05:34 +0000 (16:05 +0000)
git-svn-id: https://svn.dealii.org/trunk@9949 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/aclocal.m4
deal.II/configure.in

index f7a42447c20f82a629bc51143806eacccecf68d7..feee24282a63ac30f3e1fa4f6db77ed19b46409c 100644 (file)
@@ -3956,6 +3956,55 @@ using namespace std;
 
 
 
+dnl -------------------------------------------------------------
+dnl Check whether the gethostname() function is available. To
+dnl spice up things, some versions of cygwin have a problem in
+dnl that when you call that function on an AMD system, the FPU
+dnl is set into 64bit mode, rather than 80bit mode, and doesn't
+dnl do any long double computations any more, even though the
+dnl compiler still announces that it does through the std::limits
+dnl class. We have to check for this.
+dnl
+dnl Usage: DEAL_II_CHECK_GETHOSTNAME
+dnl
+dnl -------------------------------------------------------------
+AC_DEFUN(DEAL_II_CHECK_GETHOSTNAME, dnl
+[
+  AC_CHECK_FUNCS(gethostname)
+
+  AC_MSG_CHECKING(for bad gethostname/FPU interaction)
+  AC_LANG(C++)
+  CXXFLAGS="$CXXFLAGSG"
+  AC_TRY_RUN(
+    [
+#include <unistd.h>
+#include <limits>
+
+int main()
+{
+   char buf\[100\];
+   gethostname(buf,99);
+
+   volatile long double x=1.0;
+   x += std::numeric_limits<long double>::epsilon();
+
+   return (x != 1.0);
+}
+    ],
+    [
+      AC_MSG_RESULT(ok)
+    ],
+    [
+      AC_MSG_RESULT([yes. disabling gethostname()])
+      AC_DEFINE(DEAL_II_BROKEN_GETHOSTNAME, 1, 
+                [Define if the use of gethostname() leads to strange
+                 results with floating point computations on cygwin 
+                 systems.])
+    ])
+])
+
+
+
 dnl -------------------------------------------------------------
 dnl Check whether CXXFLAGSG and CXXFLAGSO are a valid combination
 dnl of flags or if there are contradicting flags in them.
index 95ff61c81a20eda6242382f66e630279d7503ed2..315bbc000a2709520bc81aff9ed7ce32c6a4e3f7 100644 (file)
@@ -206,7 +206,7 @@ DEAL_II_CHECK_ISNAN
 DEAL_II_CHECK_RAND_R
 DEAL_II_CHECK_QUAD_DEFINE
 DEAL_II_CHECK_ERROR_CODES_DEFINITION
-AC_CHECK_FUNCS(gethostname)
+DEAL_II_CHECK_GETHOSTNAME
 
 
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.