[PATCH skalibs] configure: use LDFLAFGS_POST in tryldflag function

From: Petr Vaněk <arkamar_at_atlas.cz>
Date: Sat, 22 Jan 2022 14:57:17 +0100

This prevents problematic situation when a user decides to use different
linker with -fuse-ld flag. Otherwise, configuration fails on a system
with default linker set to ld.bfd, see the following example:

$ env LDFLAGS="-fuse-ld=gold" ./configure
  [ snip ]
Checking required linker flags for socket functions...
./configure: unable to determine required linker flags for socket functions

The failure is caused by -Wl,--sort-section=alignment flag which is
checked by default bfd linker and appended to LDFLAGS_AUTO in tryldflag
function but it fails later in detectlibs function because -fuse-ld=gold
is set in LDFLAFGS_POST, which triggers the following fatal error:

$ gcc -fuse-ld=gold -Wl,--sort-section=alignment
/usr/lib/gcc/x86_64-gentoo-linux-musl/11.2.0/../../../../x86_64-gentoo-linux-musl/bin/ld.gold: fatal error: --sort-section=alignment: must take one of the following arguments: none, name
collect2: error: ld returned 1 exit status

Issue: https://bugs.gentoo.org/747595
Signed-off-by: Petr Vaněk <arkamar_at_atlas.cz>
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure b/configure
index 1aa8fc7..36d30f7 100755
--- a/configure
+++ b/configure
_at__at_ -113,7 +113,7 _at__at_ tryflag () {
 tryldflag () {
   echo "Checking whether linker accepts $2 ..."
   echo "typedef int x;" > "$tmpc"
-  if $CC_AUTO -nostdlib "$2" -o "$tmpe" "$tmpc" >/dev/null 2>&1 ; then
+  if $CC_AUTO $LDFLAGS_POST -nostdlib "$2" -o "$tmpe" "$tmpc" >/dev/null 2>&1 ; then
     echo "  ... yes"
     eval "$1=\"\${$1} \$2\""
     eval "$1=\${$1# }"
-- 
2.34.1
Received on Sat Jan 22 2022 - 14:57:17 CET

This archive was generated by hypermail 2.4.0 : Sat Jan 22 2022 - 14:57:55 CET