Commit cd218003 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Check whether feenableexcept() exists before using it.

parent 77cb85ee
......@@ -381,7 +381,7 @@ AX_PTHREAD([LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
AC_CHECK_LIB(pthread, pthread_barrier_init,
AC_DEFINE([HAVE_PTHREAD_BARRIERS], [1], [The posix library implements barriers]),
AC_MSG_WARN(POSIX implementation does not have barriers. SWIFT will use home-made ones.))
AC_MSG_WARN(POSIX implementation does not have barriers. SWIFT will use home-made ones.))
# Check for metis. Note AX_LIB_METIS exists, but cannot be configured
# to be default off (i.e. given no option it tries to locate METIS), so we
......@@ -551,6 +551,10 @@ if test "$with_hdf5" = "yes"; then
fi
AM_CONDITIONAL([HAVEPARALLELHDF5],[test "$have_parallel_hdf5" = "yes"])
# Check for floating-point execeptions
AC_CHECK_FUNC(feenableexcept, AC_DEFINE([HAVE_FE_ENABLE_EXCEPT],[1],
[Defined if the floating-point exception can be enabled using non-standard GNU functions.]))
# Check for setaffinity.
AC_CHECK_FUNC(pthread_setaffinity_np, AC_DEFINE([HAVE_SETAFFINITY],[1],
[Defined if pthread_setaffinity_np exists.]) )
......
......@@ -203,7 +203,11 @@ int main(int argc, char *argv[]) {
with_drift_all = 1;
break;
case 'e':
#ifdef HAVE_FE_ENABLE_EXCEPT
with_fp_exceptions = 1;
#else
error("Need support for floating point exception on this platform");
#endif
break;
case 'f':
if (sscanf(optarg, "%llu", &cpufreq) != 1) {
......@@ -379,7 +383,9 @@ int main(int argc, char *argv[]) {
/* Do we choke on FP-exceptions ? */
if (with_fp_exceptions) {
#ifdef HAVE_FE_ENABLE_EXCEPT
feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW);
#endif
if (myrank == 0)
message("WARNING: Floating point exceptions will be reported.");
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment