From 71a2e64aee90c9cae76e100497f1a09b5f373415 Mon Sep 17 00:00:00 2001
From: Alexandre Julliard <julliard@winehq.org>
Date: Fri, 23 Feb 2024 11:41:40 +0100
Subject: [PATCH] configure: Require floating point support on ARM targets.

PE code requires hardware floating point.
---
 configure    | 35 +++--------------------------------
 configure.ac | 27 +++------------------------
 2 files changed, 6 insertions(+), 56 deletions(-)

diff --git a/configure b/configure
index 026966a800d..59fa33ee6e7 100755
--- a/configure
+++ b/configure
@@ -929,7 +929,6 @@ with_capi
 with_coreaudio
 with_cups
 with_dbus
-with_float_abi
 with_fontconfig
 with_freetype
 with_gettext
@@ -2489,7 +2488,6 @@ Optional Packages:
   --without-coreaudio     do not use the CoreAudio sound support
   --without-cups          do not use CUPS
   --without-dbus          do not use DBus (dynamic device support)
-  --with-float-abi=abi    specify the ABI (soft|softfp|hard) for ARM platforms
   --without-fontconfig    do not use fontconfig
   --without-freetype      do not use the FreeType library
   --without-gettext       do not use gettext
@@ -4273,13 +4271,6 @@ then :
 fi
 
 
-# Check whether --with-float-abi was given.
-if test ${with_float_abi+y}
-then :
-  withval=$with_float_abi;
-fi
-
-
 # Check whether --with-fontconfig was given.
 if test ${with_fontconfig+y}
 then :
@@ -6367,19 +6358,8 @@ printf "%s\n" "$wine_cv_thumb2" >&6; }
     else
         CFLAGS="$CFLAGS -marm"
     fi
-    case $with_float_abi in
-      soft|softfp|hard)
-        float_abi=$with_float_abi ;;
-      *)
-        case $host_os in
-          *eabihf)
-            float_abi=hard ;;
-          *)
-            float_abi=softfp
-            saved_CFLAGS=$CFLAGS
-            CFLAGS="$CFLAGS -mfloat-abi=$float_abi"
-            { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -mfloat-abi=$float_abi" >&5
-printf %s "checking whether $CC supports -mfloat-abi=$float_abi... " >&6; }
+    { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC supports floating point instructions" >&5
+printf %s "checking whether $CC supports floating point instructions... " >&6; }
 if test ${wine_cv_float_abi+y}
 then :
   printf %s "(cached) " >&6
@@ -6406,16 +6386,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.beam \
 fi
 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $wine_cv_float_abi" >&5
 printf "%s\n" "$wine_cv_float_abi" >&6; }
-            if test $wine_cv_float_abi = no
-            then
-                float_abi=soft
-                as_fn_append wine_warnings "|Floating point is not supported for this target. The resulting build won't be compatible with Windows ARM binaries."
-            fi
-            CFLAGS=$saved_CFLAGS
-        esac
-        ;;
-    esac
-    CFLAGS="$CFLAGS -mfloat-abi=$float_abi"
+    test $wine_cv_float_abi != no || as_fn_error $? "The ARM target needs to support floating point instructions." "$LINENO" 5
     ;;
 esac
 
diff --git a/configure.ac b/configure.ac
index 2909bea2460..1c59651ba1e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,7 +29,6 @@ AC_ARG_WITH(capi,      AS_HELP_STRING([--without-capi],[do not use CAPI (ISDN su
 AC_ARG_WITH(coreaudio, AS_HELP_STRING([--without-coreaudio],[do not use the CoreAudio sound support]))
 AC_ARG_WITH(cups,      AS_HELP_STRING([--without-cups],[do not use CUPS]))
 AC_ARG_WITH(dbus,      AS_HELP_STRING([--without-dbus],[do not use DBus (dynamic device support)]))
-AC_ARG_WITH(float-abi, AS_HELP_STRING([--with-float-abi=abi],[specify the ABI (soft|softfp|hard) for ARM platforms]))
 AC_ARG_WITH(fontconfig,AS_HELP_STRING([--without-fontconfig],[do not use fontconfig]))
 AC_ARG_WITH(freetype,  AS_HELP_STRING([--without-freetype],[do not use the FreeType library]))
 AC_ARG_WITH(gettext,   AS_HELP_STRING([--without-gettext],[do not use gettext]))
@@ -149,29 +148,9 @@ case $host in
     else
         CFLAGS="$CFLAGS -marm"
     fi
-    case $with_float_abi in
-      soft|softfp|hard)
-        float_abi=$with_float_abi ;;
-      *)
-        case $host_os in
-          *eabihf)
-            float_abi=hard ;;
-          *)
-            float_abi=softfp
-            saved_CFLAGS=$CFLAGS
-            CFLAGS="$CFLAGS -mfloat-abi=$float_abi"
-            AC_CACHE_CHECK([whether $CC supports -mfloat-abi=$float_abi],wine_cv_float_abi,
-                [WINE_TRY_ASM_LINK(["vmrs r2,fpscr"],,,[wine_cv_float_abi=yes],[wine_cv_float_abi=no])])
-            if test $wine_cv_float_abi = no
-            then
-                float_abi=soft
-                WINE_WARNING([Floating point is not supported for this target. The resulting build won't be compatible with Windows ARM binaries.])
-            fi
-            CFLAGS=$saved_CFLAGS
-        esac
-        ;;
-    esac
-    CFLAGS="$CFLAGS -mfloat-abi=$float_abi"
+    AC_CACHE_CHECK([whether $CC supports floating point instructions],wine_cv_float_abi,
+                   [WINE_TRY_ASM_LINK(["vmrs r2,fpscr"],,,[wine_cv_float_abi=yes],[wine_cv_float_abi=no])])
+    test $wine_cv_float_abi != no || AC_MSG_ERROR([The ARM target needs to support floating point instructions.])
     ;;
 esac