diff --git a/src/CHANGELOG b/src/CHANGELOG index 22004fc8a..74909644f 100644 --- a/src/CHANGELOG +++ b/src/CHANGELOG @@ -39,6 +39,9 @@ ECL 8.9.0: - In Unix-type systems, ECL now installs with a "soname" and using versioned directory names, such as /usr/lib/ecl-8.9.0, /usr/lib/libecl.so.8.9, etc + - New configuration flag, --without-fpe, to disable floating point exception + code in platforms that have buggy implementations of feenableexcept(). + * Bugs fixed: - The optimizer for COERCE might enter an infinite loop for certain diff --git a/src/c/unixint.d b/src/c/unixint.d index 18299d2fc..891ac051d 100644 --- a/src/c/unixint.d +++ b/src/c/unixint.d @@ -16,7 +16,7 @@ */ #include -#if defined(HAVE_FENV_H) +#if defined(HAVE_FENV_H) && !defined(ECL_AVOID_FENV_H) # define _GNU_SOURCE # include # ifndef FE_UNDERFLOW @@ -88,7 +88,7 @@ handle_signal(int sig) break; case SIGFPE: { cl_object condition = @'arithmetic-error'; -#if defined(HAVE_FENV_H) +#if defined(HAVE_FENV_H) & !defined(ECL_AVOID_FENV_H) int bits = fetestexcept(FE_ALL_EXCEPT); if (bits & FE_DIVBYZERO) condition = @'division-by-zero'; @@ -298,7 +298,7 @@ BOOL WINAPI W32_console_ctrl_handler(DWORD type) cl_object si_trap_fpe(cl_object condition, cl_object flag) { -#if (defined(HAVE_FENV_H) && defined(HAVE_FEENABLEEXCEPT)) || defined(_MSC_VER) || defined(mingw32) +#if (defined(HAVE_FENV_H) && defined(HAVE_FEENABLEEXCEPT) && !defined(ECL_AVOID_FENV_H)) || defined(_MSC_VER) || defined(mingw32) static int last_bits = 0; int bits = 0; if (condition == @'division-by-zero') diff --git a/src/configure b/src/configure index c692e3e88..dc4a9fd92 100755 --- a/src/configure +++ b/src/configure @@ -786,6 +786,7 @@ with_defsystem with_cmp with_rt with_profile +with_fpe enable_unicode enable_longdouble enable_c99complex @@ -1488,6 +1489,7 @@ Optional Packages: --with-rt include MIT-RT testing environment (default=YES) --with-profile include CMUCL's simple profiler (default=YES if Boehm-Weiser garbage collector used) + --with-fpe detect floating point exceptions (default=YES) --with-x use the X Window System Some influential environment variables: @@ -2215,6 +2217,15 @@ else fi + +# Check whether --with-fpe was given. +if test "${with_fpe+set}" = set; then + withval=$with_fpe; +else + with_fpe=yes +fi + + # Check whether --enable-unicode was given. if test "${enable_unicode+set}" = set; then enableval=$enable_unicode; @@ -5170,6 +5181,13 @@ fi +if test "${with_fpe}" != yes; then + cat >>confdefs.h <<\_ACEOF +#define ECL_AVOID_FPE_H 1 +_ACEOF + +fi + { $as_echo "$as_me:$LINENO: checking for X" >&5 diff --git a/src/configure.in b/src/configure.in index 19785de83..b34466019 100644 --- a/src/configure.in +++ b/src/configure.in @@ -171,6 +171,12 @@ AC_ARG_WITH(profile, [(default=YES if Boehm-Weiser garbage collector used)]), [], [with_profile=yes]) +AC_ARG_WITH(fpe, + AS_HELP_STRING( [--with-fpe], + [detect floating point exceptions] + [(default=YES)]), + [], [with_fpe=yes]) + AC_ARG_ENABLE(unicode, AS_HELP_STRING( [--enable-unicode], [enable support for unicode (default=NO)]), @@ -414,6 +420,12 @@ AC_SUBST(SONAME1) AC_SUBST(SONAME) AC_SUBST(SONAME_LDFLAGS) +dnl ---------------------------------------------------------------------- +dnl Deactivate floating point exceptions if asked to +if test "${with_fpe}" != yes; then + AC_DEFINE(ECL_AVOID_FPE_H) +fi + dnl ===================================================================== dnl Checks for header files diff --git a/src/h/config.h.in b/src/h/config.h.in index b156cedeb..7252d2708 100644 --- a/src/h/config.h.in +++ b/src/h/config.h.in @@ -266,6 +266,8 @@ typedef unsigned @CL_FIXNUM_TYPE@ cl_hashkey; #undef HAVE_FENV_H /* can activate individual traps in floating point environment */ #undef HAVE_FEENABLEEXCEPT +/* do we want to deactivate all support for floating point exceptions */ +#undef ECL_AVOID_FPE_H /* has support for large files */ #undef HAVE_FSEEKO /* the tzset() function gets the current time zone */ @@ -380,7 +382,11 @@ typedef unsigned @CL_FIXNUM_TYPE@ cl_hashkey; #define ECL_ARCHITECTURE "@ARCHITECTURE@" -#include "@ECL_FPE_CODE@" +#ifdef ECL_AVOID_FPE_H +# define ecl_detect_fpe() +#else +# include "@ECL_FPE_CODE@" +#endif #if defined(ECL_THREADS) # if defined(darwin) || defined(freebsd) || defined(gnu)