]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Work around a problem with cxx, which refuses to define EINTR even when including...
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 30 Sep 2002 16:15:00 +0000 (16:15 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 30 Sep 2002 16:15:00 +0000 (16:15 +0000)
git-svn-id: https://svn.dealii.org/trunk@6562 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/aclocal.m4
deal.II/configure
deal.II/configure.in
deal.II/contrib/hsl/source/detached_ma27.cc
deal.II/lac/source/sparse_direct.cc

index d67c84ce1cf10aaa69b8f49e670381e03fb8be40..d5a0bc0721601a584090a5e6069e77be311bc099 100644 (file)
@@ -2483,6 +2483,50 @@ AC_DEFUN(DEAL_II_CHECK_QUAD_DEFINE, dnl
 
 
 
+dnl -------------------------------------------------------------
+dnl On DEC OSF1, when we specify "-std strict_ansi", we can include
+dnl errno.h, and still not get the definition of the error codes
+dnl such as EINTR, EPIPE, etc.
+dnl
+dnl In this case, use a workaround by explicitly including 
+dnl /usr/include/errno.h, instead of just errno.h, which the compiler
+dnl maps to one of its own C/C++ compatibility headers, which only
+dnl define 3 error codes (for reasons unknown)
+dnl
+dnl Usage: DEAL_II_CHECK_ERROR_CODES_DEFINITION
+dnl
+dnl -------------------------------------------------------------
+AC_DEFUN(DEAL_II_CHECK_ERROR_CODES_DEFINITION, dnl
+[
+  AC_MSG_CHECKING(for defintions of error codes in errno.h)
+  AC_LANG(C++)
+  CXXFLAGS="$CXXFLAGSG"
+  AC_TRY_COMPILE(
+    [
+#include <iostream>
+#include <errno.h>
+using namespace std;
+    ],
+    [
+    cout << EINTR << endl;
+    ],
+    [
+      AC_MSG_RESULT(yes)
+    ],
+    [
+      AC_MSG_RESULT(no. working around)
+      AC_DEFINE(DEAL_II_USE_DIRECT_ERRNO_H, 1, 
+                [Define if the compiler provides a <errno.g> header file
+                which does not define all error codes such as EINTR. In
+                that case, use the system include file at /usr/include
+                instead. There is probably a better way to do this, but
+                it is not apparent by looking at the C/C++ compatibility
+                 header provided by the compiler.])
+    ])
+])
+
+
+
 
 dnl ------------------------------------------------------------
 dnl Check whether some of the HSL functions have been dropped
index 621fff047dc1e03016d5f7a3d418f00fd6f3df94..ab37d73e68a1d833a9d4f0b65a0dd71a6ab77905 100755 (executable)
@@ -5744,6 +5744,71 @@ echo "${ECHO_T}yes. working around" >&6
       CXXFLAGSG="$CXXFLAGSG -D_POSIX_SOURCE"
       CXXFLAGSO="$CXXFLAGSO -D_POSIX_SOURCE"
 
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+
+
+  echo "$as_me:$LINENO: checking for defintions of error codes in errno.h" >&5
+echo $ECHO_N "checking for defintions of error codes in errno.h... $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"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#include <iostream>
+#include <errno.h>
+using namespace std;
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+
+    cout << EINTR << endl;
+
+  ;
+  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
+
+      echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+
+      echo "$as_me:$LINENO: result: no. working around" >&5
+echo "${ECHO_T}no. working around" >&6
+
+cat >>confdefs.h <<\_ACEOF
+#define DEAL_II_USE_DIRECT_ERRNO_H 1
+_ACEOF
+
+
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 
index 8ebb41cfa82245851745026877980dc4a4e76399..fa3b2bc404d27666e3f13f4476231cc242adf663 100644 (file)
@@ -185,6 +185,7 @@ DEAL_II_CHECK_GETRUSAGE
 DEAL_II_CHECK_ISNAN
 DEAL_II_CHECK_RAND_R
 DEAL_II_CHECK_QUAD_DEFINE
+DEAL_II_CHECK_ERROR_CODES_DEFINITION
 AC_CHECK_FUNCS(gethostname)
 
 
index c81d4ef2a844fcd2d55bc0be8c628f213d5d8767..3bb674b4d51375798f15eac72dfc511362906043 100644 (file)
@@ -20,8 +20,6 @@
 #include <cstdlib>
 
 #include <unistd.h>
-#include <errno.h>
-#include <sys/errno.h>
 #include <pthread.h>
 #include <signal.h>
 
 #  include <strstream>
 #endif
 
+#ifndef DEAL_II_USE_DIRECT_ERRNO_H
+#  include <errno.h>
+#else
+#  include </usr/include/errno.h>
+#endif
+
+#include <sys/errno.h>
+
 
 pid_t master_pid;
 
index 96d3862ab00cca67a70cf61294b4d8bc68530e18..b90dc4bbd1c016c529aabf1debea55f56bb310b6 100644 (file)
 #include <iostream>
 #include <sys/wait.h>
 #include <unistd.h>
-#include <errno.h>
+
+#ifndef DEAL_II_USE_DIRECT_ERRNO_H
+#  include <errno.h>
+#else
+#  include </usr/include/errno.h>
+#endif
 #include <sys/errno.h>
 
 

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.