AC_HEADER_STDBOOL
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
-AC_CHECK_HEADERS([bsdtty.h fcntl.h fenv.h limits.h malloc.h sgtty.h stropts.h time.h])
+AC_CHECK_HEADERS([bsdtty.h fcntl.h fenv.h ieeefp.h limits.h malloc.h sgtty.h])
+AC_CHECK_HEADERS([stropts.h time.h])
AC_CHECK_HEADERS([sys/file.h sys/ioctl.h sys/mount.h sys/param.h sys/poll.h])
AC_CHECK_HEADERS([sys/ptyio.h sys/socket.h sys/time.h sys/un.h sys/vfs.h])
AC_CHECK_HEADERS([termio.h termios.h unistd.h utime.h])
AC_CHECK_FUNCS([ctermid])
AC_CHECK_FUNCS([dup2])
AC_CHECK_FUNCS([fcntl fdatasync fegetround fesetround floor fpathconf frexp])
-AC_CHECK_FUNCS([fsync fsync_range ftruncate])
+AC_CHECK_FUNCS([fpgetround fpsetround fsync fsync_range ftruncate])
AC_CHECK_FUNCS([getcwd gethostbyname gethostname getlogin getpagesize getpgrp])
AC_CHECK_FUNCS([getpt gettimeofday getwd grantpt])
AC_CHECK_FUNCS([kill])
PRIMITIVE_RETURN (cc_block_linkage_info (ARG_REF (1)));
}
\f
+/* Emulate <fenv.h> with BSD's <ieeefp.h>. */
+
+#if !defined(HAVE_FENV_H) && defined(HAVE_IEEEFP_H)
+# include <ieeefp.h>
+#endif
+
+#if !defined(HAVE_FEGETROUND) && defined(HAVE_FPGETROUND)
+# define fegetround fpgetround
+# define HAVE_FEGETROUND
+#endif
+
+#if !defined(HAVE_FESETROUND) && defined(HAVE_FPSETROUND)
+
+static inline int
+fesetround (int mode)
+{
+ /* fpsetround never fails; instead, it returns the old rounding mode,
+ which has only a one-in-four chance in general of being 0 as the
+ SET-FLOAT-ROUNDING-MODE primitive wants. */
+ (void) fpsetround (mode);
+ return (0);
+}
+
+# define HAVE_FESETROUND
+#endif
+
+#if !defined(FE_TONEAREST) && defined(FP_RN)
+# define FE_TONEAREST FP_RN
+#endif
+
+#if !defined(FE_TOWARDZERO) && defined(FP_RZ)
+# define FE_TOWARDZERO FP_RZ
+#endif
+
+#if !defined(FE_DOWNWARD) && defined(FP_RM)
+# define FE_DOWNWARD FP_RM
+#endif
+
+#if !defined(FE_UPWARD) && defined(FP_RP)
+# define FE_UPWARD FP_RP
+#endif
+\f
#ifndef __GNUC__
# pragma STDC FENV_ACCESS ON
#endif