M4_FLAGS="${M4_FLAGS} -P __linux__,1"
DO_GCC_TESTS=yes
GNU_LD=yes
+ # In Ubuntu 11.04 on i386 eglibc-2.13's fesetenv(FE_DFL_ENV) does
+ # not mask all FPEs. Its feclear/disableexcept() functions are
+ # not effective either. A callout to pango_layout_get_pixel_
+ # extents can use these and still SIGFPE Underflow. However the
+ # emulation in cmpintmd/x86-fenv.c IS effective. Defining
+ # BORKED_FENV causes libc's fenv.h to be ignored and x86-fenv.c to
+ # be included. Not all linux-gnu/i386 hosts need this, but the
+ # emulation should work on all of them.
+ if test "x${mit_scheme_native_code}" = "xi386"; then
+ BORKED_FENV=yes
+ fi
;;
freebsd*)
M4_FLAGS="${M4_FLAGS} -P SUPPRESS_LEADING_UNDERSCORE,1"
define_c_label(x87_read_control_word)
enter IMM(4),IMM(0)
- fnstcw IND(REG(esp))
- OP(mov,w) TW(IND(REG(esp)),REG(ax))
+ fnstcw IND(REG(rsp))
+ OP(mov,w) TW(IND(REG(rsp)),REG(ax))
leave
ret
define_c_label(x87_write_control_word)
enter IMM(4),IMM(0)
OP(mov,w) TW(REG(di),IND(REG(rsp)))
- fldcw IND(REG(esp))
+ fldcw IND(REG(rsp))
leave
ret
define_c_label(x87_read_status_word)
enter IMM(4),IMM(0)
- fnstsw IND(REG(esp))
- OP(mov,w) TW(IND(REG(esp)),REG(ax))
+ fnstsw IND(REG(rsp))
+ OP(mov,w) TW(IND(REG(rsp)),REG(ax))
leave
ret
fnstenv IND(REG(rdi))
# fnstenv masks all exceptions (go figure), so we must load
# the control word back in order to undo that.
- fldcw IND(REG(eax))
+ fldcw IND(REG(rdi))
ret
define_c_label(x87_write_environment)
#endif /* _MACH_UNIX */
}
-#ifndef HAVE_FENV_H
+#if !defined(HAVE_FENV_H) || defined(BORKED_FENV)
extern int i387_presence;
extern int sse_presence;
# define x87_p i387_presence
extern int ia32_cpuid_needed;
-#ifndef HAVE_FENV_H
+#if !defined(HAVE_FENV_H) || defined(BORKED_FENV)
# define CMPINTMD_EMULATES_FENV
# include "cmpintmd/x86-fenv.h"
#endif
/* C99 <fenv.h> emulation for x86 (shared between i386 and amd64) */
+#ifdef BORKED_FENV
+# undef HAVE_FEGETROUND
+# undef HAVE_FESETROUND
+# undef HAVE_FECLEAREXCEPT
+# undef HAVE_FEGETEXCEPTFLAG
+# undef HAVE_FERAISEEXCEPT
+# undef HAVE_FESETEXCEPTFLAG
+# undef HAVE_FETESTEXCEPT
+# undef HAVE_FEDISABLEEXCEPT
+# undef HAVE_FEENABLEEXCEPT
+# undef HAVE_FEGETEXCEPT
+# undef HAVE_FEGETENV
+# undef HAVE_FESETENV
+# undef HAVE_FEHOLDEXCEPT
+# undef HAVE_FEUPDATEENV
+#endif
+
#define HAVE_FENV_T
#define HAVE_FEXCEPT_T
])
if test "x$ac_cv_header_fenv_h" = "xyes"; then
- AC_CHECK_TYPES([fenv_t], [], [], [SCM_INC_FENV])
- AC_CHECK_TYPES([fexcept_t], [], [], [SCM_INC_FENV])
+ if test "x$BORKED_FENV" = "xyes"; then
+ AC_DEFINE([BORKED_FENV], [1],
+ [Define to 1 if your fenv implementation is broken.])
+ else
+ AC_CHECK_TYPES([fenv_t], [], [], [SCM_INC_FENV])
+ AC_CHECK_TYPES([fexcept_t], [], [], [SCM_INC_FENV])
+ fi
fi
AC_CHECK_SIZEOF([time_t])
#include "cmpintmd.h"
-#if (defined (HAVE_FENV_H))
+#if (defined (HAVE_FENV_H) && !defined (BORKED_FENV))
# include <fenv.h>
# ifdef HAVE_FENV_T
# define scheme_fenv_t fenv_t