From b9802905ed709d1b08205af73bcd2a1125a4f2af Mon Sep 17 00:00:00 2001
From: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Date: Wed, 11 Mar 2026 10:53:06 +0000
Subject: [PATCH v1] Defend against -ffast-math in meson builds

We'are defending against -ffast-math in autoconf so this commit does the same
for meson builds.
---
 meson.build | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/meson.build b/meson.build
index 2df54409ca6..65344172368 100644
--- a/meson.build
+++ b/meson.build
@@ -2144,6 +2144,13 @@ elif cc.links('''
   cdata.set('HAVE__CPUIDEX', 1)
 endif
 
+# Defend against -ffast-math
+if not cc.compiles('''
+#ifdef __FAST_MATH__
+choke me
+#endif''', name: 'ffast-math check', args: test_c_args)
+  error('do not put -ffast-math in CFLAGS')
+endif
 
 # Defend against clang being used on x86-32 without SSE2 enabled.  As current
 # versions of clang do not understand -fexcess-precision=standard, the use of
-- 
2.34.1

