From 86f29950e9cc13e8466937496d55ace4b9d36b9c Mon Sep 17 00:00:00 2001
From: Ben Gamari <ben@smart-cactus.org>
Date: Mon, 18 Nov 2024 20:21:05 -0500
Subject: [PATCH] configure: Implement ld override whitelist

Bring `configure` into alignment with `ghc-toolchain`, ensuring that the
ld-override logic will only take effect on Linux and Windows.

Fixes #25501.

(cherry picked from commit 992259962191b0b774dfeeabb46729376c7fe7cf)
---
 m4/find_ld.m4 | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/m4/find_ld.m4 b/m4/find_ld.m4
index 091b7938b6f..fc7a2a5751a 100644
--- a/m4/find_ld.m4
+++ b/m4/find_ld.m4
@@ -79,13 +79,16 @@ AC_DEFUN([FIND_LD],[
         dnl See #21712.
         AC_CHECK_TARGET_TOOL([LD], [ld])
         ;;
-    *)
+    *-linux*|*-mingw32)
         if test "x$enable_ld_override" = "xyes"; then
             find_ld
         else
             AC_CHECK_TARGET_TOOL([LD], [ld])
         fi
         ;;
+    *)
+        AC_CHECK_TARGET_TOOL([LD], [ld])
+        ;;
     esac
     CHECK_LD_COPY_BUG([$1])
 ])
-- 
GitLab