From 8cccc08f413228a4444b2de9189e0c3316ae2b3b Mon Sep 17 00:00:00 2001 From: Roy Stogner Date: Mon, 20 Jul 2026 11:37:45 -0500 Subject: [PATCH] Only use -fexcess-precision if C++ supports it Otherwise we get an error from older GCC --- acsm_compiler_flags.m4 | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/acsm_compiler_flags.m4 b/acsm_compiler_flags.m4 index 3d778d0..3c043da 100644 --- a/acsm_compiler_flags.m4 +++ b/acsm_compiler_flags.m4 @@ -387,7 +387,24 @@ AC_DEFUN([ACSM_SET_CXX_FLAGS], ACSM_CXXFLAGS_DEVEL="$ACSM_CXXFLAGS_DEVEL -Wpointer-arith -Wformat -Wparentheses -Wuninitialized -fstrict-aliasing -Woverloaded-virtual -Wdisabled-optimization" ACSM_CXXFLAGS_DBG="$ACSM_CXXFLAGS_DBG -O0 -felide-constructors -g -pedantic -W -Wall -Wextra -Wno-long-long -Wunused -Wpointer-arith -Wformat -Wparentheses -Woverloaded-virtual" - ACSM_IEEE754_FLAGS="-fno-unsafe-math-optimizations -fexcess-precision=standard -ffp-contract=off" + # The former is the default but the latter can be necessary + ACSM_IEEE754_FLAGS="-fno-unsafe-math-optimizations -ffp-contract=off" + + # Older gcc only supported disabling x87 rounding in C, not C++ + AS_IF([test "x$ACSM_GXX_VERSION" != "xgcc11" && + test "x$ACSM_GXX_VERSION" != "xgcc10" && + test "x$ACSM_GXX_VERSION" != "xgcc9" && + test "x$ACSM_GXX_VERSION" != "xgcc8" && + test "x$ACSM_GXX_VERSION" != "xgcc7" && + test "x$ACSM_GXX_VERSION" != "xgcc5" && + test "x$ACSM_GXX_VERSION" != "xgcc5" && + test "x$ACSM_GXX_VERSION" != "xgcc4.9" && + test "x$ACSM_GXX_VERSION" != "xgcc4.8" && + test "x$ACSM_GXX_VERSION" != "xgcc4.7" && + test "x$ACSM_GXX_VERSION" != "xgcc4.6"], + [ + ACSM_IEEE754_FLAGS="$ACSM_IEEE754_FLAGS -fexcess-precision=standard" + ]) ACSM_NODEPRECATEDFLAG="-Wno-deprecated"