From: wolf Date: Mon, 30 Sep 2002 16:15:00 +0000 (+0000) Subject: Work around a problem with cxx, which refuses to define EINTR even when including... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=97a47b544ca6c37d74ced2af52bce63893a7c1cd;p=dealii-svn.git Work around a problem with cxx, which refuses to define EINTR even when including errno.h, since it does not provide all error codes in its C/C++ compatibility headers... git-svn-id: https://svn.dealii.org/trunk@6562 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/aclocal.m4 b/deal.II/aclocal.m4 index d67c84ce1c..d5a0bc0721 100644 --- a/deal.II/aclocal.m4 +++ b/deal.II/aclocal.m4 @@ -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 +#include +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 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 diff --git a/deal.II/configure b/deal.II/configure index 621fff047d..ab37d73e68 100755 --- a/deal.II/configure +++ b/deal.II/configure @@ -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 +#include +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 diff --git a/deal.II/configure.in b/deal.II/configure.in index 8ebb41cfa8..fa3b2bc404 100644 --- a/deal.II/configure.in +++ b/deal.II/configure.in @@ -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) diff --git a/deal.II/contrib/hsl/source/detached_ma27.cc b/deal.II/contrib/hsl/source/detached_ma27.cc index c81d4ef2a8..3bb674b4d5 100644 --- a/deal.II/contrib/hsl/source/detached_ma27.cc +++ b/deal.II/contrib/hsl/source/detached_ma27.cc @@ -20,8 +20,6 @@ #include #include -#include -#include #include #include @@ -31,6 +29,14 @@ # include #endif +#ifndef DEAL_II_USE_DIRECT_ERRNO_H +# include +#else +# include +#endif + +#include + pid_t master_pid; diff --git a/deal.II/lac/source/sparse_direct.cc b/deal.II/lac/source/sparse_direct.cc index 96d3862ab0..b90dc4bbd1 100644 --- a/deal.II/lac/source/sparse_direct.cc +++ b/deal.II/lac/source/sparse_direct.cc @@ -20,7 +20,12 @@ #include #include #include -#include + +#ifndef DEAL_II_USE_DIRECT_ERRNO_H +# include +#else +# include +#endif #include