1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 19:30:36 +02:00

Compile with -fexcess-precision=standard for i[3456]86 when we can

* configure.ac: when -fexcess-precision=standard is available and we're
building for i[3456]86, use it.  This fixes floating point precision
problems caused by x87 (80-bit) floating point, and detected by
numbers.test.

Closes: 43262
This commit is contained in:
Rob Browning 2024-10-05 17:18:06 -05:00
parent 1c96e4ab6d
commit 9b1effb585
2 changed files with 26 additions and 0 deletions

View file

@ -62,6 +62,30 @@ AC_PROG_INSTALL
AC_PROG_CC
gl_EARLY
AC_MSG_CHECKING([whether the compiler supports -fexcess-precision=standard])
old_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fexcess-precision=standard"
fexcess_precision=''
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int foo;], [])], [fexcess_precision=1]])
CFLAGS="$old_CFLAGS"
if test -n "$fexcess_precision"; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
fi
AC_MSG_CHECKING([whether we want -fexcess-precision=standard for $target_cpu])
case "$target_cpu" in
i[[3456]]86)
AC_MSG_RESULT([yes])
if test -n "$fexcess_precision"; then
CFLAGS="$CFLAGS -fexcess-precision=standard"
else
AC_MSG_WARN([floating-point precision may exceed C99 rules])
fi
;;
*) AC_MSG_RESULT([no]) ;;
esac
AC_MSG_CHECKING([whether the compiler supports -flto])
old_CFLAGS="$CFLAGS"
LTO_CFLAGS="-flto"