1From d77e5f3d45b0cbae850e3a6e23d52edc137be803 Mon Sep 17 00:00:00 2001
2From: "Yann E. MORIN" <yann.morin.1998@free.fr>
3Date: Wed, 8 Feb 2023 13:52:05 +0100
4Subject: [PATCH] configure: use ${LD} instead of hard-coding 'ld'
5
6When doing cross-compilation, we do not want to use the native tools to
7test, but the target tools.
8
9Note that the weird quoting is inherited from a legacy patch in
10Buildroot, which dates back ages (at least 2006), and as it has not been
11identified as breaking things, we keep it as-is... Meh...
12
13Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
14---
15 configure    | 12 ++++++------
16 configure.ac | 12 ++++++------
17 2 files changed, 12 insertions(+), 12 deletions(-)
18
19diff --git a/configure b/configure
20index 810636e..30a7ea3 100755
21--- a/configure
22+++ b/configure
23@@ -4377,12 +4377,12 @@ if ac_fn_c_try_compile "$LINENO"; then :
24             ac_cv_shared_link_args='# Could not configure shlib linking'
25             enable_shlib=no
26           fi
27-       elif (ld -shared --whole-archive -soname conftest.so -o conftest.so.t conftest.a) 2>&5; then
28-		ac_cv_shared_link_args='ld -shared --whole-archive -soname $@ -o $@.t'
29-	elif (ld -shared -o conftest.so.t -all -soname conftest.so.t -none -lc -all conftest.a) 2>&5; then
30-		ac_cv_shared_link_args='ld -shared -o $@.t -all -soname $@ -none -lc -all'
31-	elif (ld -G -o conftest.so.t conftest.a) 2>&5; then
32-		ac_cv_shared_link_args='ld -G -o $@.t'
33+       elif (${LD-ld} -shared --whole-archive -soname conftest.so -o conftest.so.t conftest.a) 2>&5; then
34+		ac_cv_shared_link_args="${LD-ld}"' -shared --whole-archive -soname $@ -o $@.t'
35+	elif (${LD-ld} -shared -o conftest.so.t -all -soname conftest.so.t -none -lc -all conftest.a) 2>&5; then
36+		ac_cv_shared_link_args="${LD-ld}"' -shared -o $@.t -all -soname $@ -none -lc -all'
37+	elif (${LD-ld} -G -o conftest.so.t conftest.a) 2>&5; then
38+		ac_cv_shared_link_args="${LD-ld}"' -G -o $@.t'
39 	else
40 		# oh well, toss an error
41 		ac_cv_shared_link_args='# Could not configure shlib linking'
42diff --git a/configure.ac b/configure.ac
43index 51bdf4d..0d80a78 100644
44--- a/configure.ac
45+++ b/configure.ac
46@@ -169,12 +169,12 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([ int foo(int val) { return val + 1; } ])],[
47             ac_cv_shared_link_args='# Could not configure shlib linking'
48             enable_shlib=no
49           fi
50-       elif (ld -shared --whole-archive -soname conftest.so -o conftest.so.t conftest.a) 2>&5; then
51-		ac_cv_shared_link_args='ld -shared --whole-archive -soname $@ -o $@.t'
52-	elif (ld -shared -o conftest.so.t -all -soname conftest.so.t -none -lc -all conftest.a) 2>&5; then
53-		ac_cv_shared_link_args='ld -shared -o $@.t -all -soname $@ -none -lc -all'
54-	elif (ld -G -o conftest.so.t conftest.a) 2>&5; then
55-		ac_cv_shared_link_args='ld -G -o $@.t'
56+       elif (${LD-ld} -shared --whole-archive -soname conftest.so -o conftest.so.t conftest.a) 2>&5; then
57+		ac_cv_shared_link_args="${LD-ld}"' -shared --whole-archive -soname $@ -o $@.t'
58+	elif (${LD-ld} -shared -o conftest.so.t -all -soname conftest.so.t -none -lc -all conftest.a) 2>&5; then
59+		ac_cv_shared_link_args="${LD-ld}"' -shared -o $@.t -all -soname $@ -none -lc -all'
60+	elif (${LD-ld} -G -o conftest.so.t conftest.a) 2>&5; then
61+		ac_cv_shared_link_args="${LD-ld}"' -G -o $@.t'
62 	else
63 		# oh well, toss an error
64 		ac_cv_shared_link_args='# Could not configure shlib linking'
65--
662.25.1
67
68