configure: Only use -fno-fp-int-builtin-inexact if compiler supports it
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Thu, 20 Nov 2025 18:30:10 +0000 (15:30 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 21 Nov 2025 16:13:10 +0000 (13:13 -0300)
Checked on x86_64-linux-gnu.

Reviewed-by: Sam James <sam@gentoo.org>
configure
configure.ac
math/Makefile

index d5bd639586cda7a0aaaf349d368ad82d63c8a0f7..d2d83b40c04339c6ce742e288c6fa0f8b0889a12 100755 (executable)
--- a/configure
+++ b/configure
@@ -9210,6 +9210,66 @@ have-cc-gcs = $libc_cv_cc_gcs"
 config_vars="$config_vars
 have-test-cc-gcs = $libc_cv_test_cc_gcs"
 
+# Check if compiler supports -fno-fp-int-builtin-inexact
+
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if compiler supports -fno-fp-int-builtin-inexact" >&5
+printf %s "checking if compiler supports -fno-fp-int-builtin-inexact... " >&6; }
+if test ${libc_cv_cc_no_fp_builtin_inexact+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) if { ac_try='${CC-cc} -Werror -fno-fp-int-builtin-inexact -xc /dev/null -S -o /dev/null'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+then :
+  libc_cv_cc_no_fp_builtin_inexact=-fno-fp-int-builtin-inexact
+else case e in #(
+  e) libc_cv_cc_no_fp_builtin_inexact= ;;
+esac
+fi ;;
+esac
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_cc_no_fp_builtin_inexact" >&5
+printf "%s\n" "$libc_cv_cc_no_fp_builtin_inexact" >&6; }
+if test "$TEST_CC" = "$CC"; then
+  libc_cv_test_cc_no_fp_builtin_inexact=$libc_cv_cc_no_fp_builtin_inexact
+else
+
+saved_CC="$CC"
+CC="$TEST_CC"
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if compiler supports -fno-fp-int-builtin-inexact in testing" >&5
+printf %s "checking if compiler supports -fno-fp-int-builtin-inexact in testing... " >&6; }
+if test ${libc_cv_test_cc_no_fp_builtin_inexact+y}
+then :
+  printf %s "(cached) " >&6
+else case e in #(
+  e) if { ac_try='${CC-cc} -Werror -fno-fp-int-builtin-inexact -xc /dev/null -S -o /dev/null'
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; }
+then :
+  libc_cv_test_cc_no_fp_builtin_inexact=-fno-fp-int-builtin-inexact
+else case e in #(
+  e) libc_cv_test_cc_no_fp_builtin_inexact= ;;
+esac
+fi ;;
+esac
+fi
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_test_cc_no_fp_builtin_inexact" >&5
+printf "%s\n" "$libc_cv_test_cc_no_fp_builtin_inexact" >&6; }
+
+CC="$saved_CC"
+
+fi
+
+config_vars="$config_vars
+config-cflags-no-fp-builtin-inexact = $libc_cv_cc_no_fp_builtin_inexact"
+
 # Check if linker supports GCS marking
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for linker that supports -z gcs=always" >&5
 printf %s "checking for linker that supports -z gcs=always... " >&6; }
index aaf686494a6335ddb91c3a5ba411e0fb7430fc57..3b9f3688f10973c0a6ca3b98cf3682dcb3a91477 100644 (file)
@@ -2061,6 +2061,17 @@ LIBC_TRY_CC_AND_TEST_CC_OPTION([if compiler supports -mbranch-protection=gcs],
 LIBC_CONFIG_VAR([have-cc-gcs], [$libc_cv_cc_gcs])
 LIBC_CONFIG_VAR([have-test-cc-gcs], [$libc_cv_test_cc_gcs])
 
+# Check if compiler supports -fno-fp-int-builtin-inexact
+LIBC_TRY_CC_AND_TEST_CC_OPTION([if compiler supports -fno-fp-int-builtin-inexact],
+  [-Werror -fno-fp-int-builtin-inexact],
+  libc_cv_cc_no_fp_builtin_inexact,
+  [libc_cv_cc_no_fp_builtin_inexact=-fno-fp-int-builtin-inexact],
+  [libc_cv_cc_no_fp_builtin_inexact=],
+  libc_cv_test_cc_no_fp_builtin_inexact,
+  [libc_cv_test_cc_no_fp_builtin_inexact=-fno-fp-int-builtin-inexact],
+  [libc_cv_test_cc_no_fp_builtin_inexact=])
+LIBC_CONFIG_VAR([config-cflags-no-fp-builtin-inexact], [$libc_cv_cc_no_fp_builtin_inexact])
+
 # Check if linker supports GCS marking
 LIBC_LINKER_FEATURE([-z gcs=always], [-Wl,-z,gcs=always],
                    [libc_cv_ld_gcs=yes], [libc_cv_ld_gcs=no])
index d05108def1a6cb6e6700cd58b33f7d2582ecb185..f7a1d9016cfb9b7e10a6535d10b7bc879de5f261 100644 (file)
@@ -1827,22 +1827,22 @@ CFLAGS-s_modff128.c += $(config-cflags-signaling-nans)
 # These files rely on C23 semantics for avoiding "inexact" exceptions
 # from rounding functions.  These settings can be removed when glibc
 # builds with -std=gnu23 or later.
-CFLAGS-s_fromfp.c += -fno-fp-int-builtin-inexact
-CFLAGS-s_fromfpx.c += -fno-fp-int-builtin-inexact
-CFLAGS-s_ufromfp.c += -fno-fp-int-builtin-inexact
-CFLAGS-s_ufromfpx.c += -fno-fp-int-builtin-inexact
-CFLAGS-s_fromfpf.c += -fno-fp-int-builtin-inexact
-CFLAGS-s_fromfpxf.c += -fno-fp-int-builtin-inexact
-CFLAGS-s_ufromfpf.c += -fno-fp-int-builtin-inexact
-CFLAGS-s_ufromfpxf.c += -fno-fp-int-builtin-inexact
-CFLAGS-s_fromfpl.c += -fno-fp-int-builtin-inexact
-CFLAGS-s_fromfpxl.c += -fno-fp-int-builtin-inexact
-CFLAGS-s_ufromfpl.c += -fno-fp-int-builtin-inexact
-CFLAGS-s_ufromfpxl.c += -fno-fp-int-builtin-inexact
-CFLAGS-s_fromfpf128.c += -fno-fp-int-builtin-inexact
-CFLAGS-s_fromfpxf128.c += -fno-fp-int-builtin-inexact
-CFLAGS-s_ufromfpf128.c += -fno-fp-int-builtin-inexact
-CFLAGS-s_ufromfpxf128.c += -fno-fp-int-builtin-inexact
+CFLAGS-s_fromfp.c += $(config-cflags-no-fp-builtin-inexact)
+CFLAGS-s_fromfpx.c += $(config-cflags-no-fp-builtin-inexact)
+CFLAGS-s_ufromfp.c += $(config-cflags-no-fp-builtin-inexact)
+CFLAGS-s_ufromfpx.c += $(config-cflags-no-fp-builtin-inexact)
+CFLAGS-s_fromfpf.c += $(config-cflags-no-fp-builtin-inexact)
+CFLAGS-s_fromfpxf.c += $(config-cflags-no-fp-builtin-inexact)
+CFLAGS-s_ufromfpf.c += $(config-cflags-no-fp-builtin-inexact)
+CFLAGS-s_ufromfpxf.c += $(config-cflags-no-fp-builtin-inexact)
+CFLAGS-s_fromfpl.c += $(config-cflags-no-fp-builtin-inexact)
+CFLAGS-s_fromfpxl.c += $(config-cflags-no-fp-builtin-inexact)
+CFLAGS-s_ufromfpl.c += $(config-cflags-no-fp-builtin-inexact)
+CFLAGS-s_ufromfpxl.c += $(config-cflags-no-fp-builtin-inexact)
+CFLAGS-s_fromfpf128.c += $(config-cflags-no-fp-builtin-inexact)
+CFLAGS-s_fromfpxf128.c += $(config-cflags-no-fp-builtin-inexact)
+CFLAGS-s_ufromfpf128.c += $(config-cflags-no-fp-builtin-inexact)
+CFLAGS-s_ufromfpxf128.c += $(config-cflags-no-fp-builtin-inexact)
 
 $(addprefix $(objpfx),\
            $(filter-out $(tests-static) $(libm-tests-vector),\
This page took 0.115821 seconds and 5 git commands to generate.