From 757a95abe98d32a2d238ef8cfbf3e7f21939af09 Mon Sep 17 00:00:00 2001
From: Raul E Rangel <rrangel@chromium.org>
Date: Wed, 13 Dec 2023 09:44:57 -0700
Subject: [PATCH] m4/libtool.m4: Use $LD when checking for --whole-archive

Using `$CC -print-prog-name=ld` will always use the `ld` linker. We
should instead be using the $LD variable so that we use the proper
linker.

There is already another part of the code that does this same check,
so I just copy/pasted the if line.

Signed-off-by: Raul E Rangel <rrangel@chromium.org>
---
 m4/libtool.m4 | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/m4/libtool.m4 b/m4/libtool.m4
index 79a2451e..9d0e5e76 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -6421,8 +6421,7 @@ if test yes != "$_lt_caught_CXX_error"; then
         wlarc='$wl'
 
         # ancient GNU ld didn't support --whole-archive et. al.
-        if eval "`$CC -print-prog-name=ld` --help 2>&1" |
-	  $GREP 'no-whole-archive' > /dev/null; then
+        if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
           _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive'
         else
           _LT_TAGVAR(whole_archive_flag_spec, $1)=
-- 
2.43.0.472.g3155946c3a-goog

