aports/testing/vim-classic/configure-as-needed.patch
mio c8e962ddd7 testing/vim-classic: new aport
https://vim-classic.org
Fork of Vim 8.x text editor for long-term maintenance
2026-04-05 03:11:20 +00:00

47 lines
1.9 KiB
Diff

Patch-Source: https://github.com/vim/vim/commit/761ead497feff5fd259c9f6ca76d184bb8755373
---
From 761ead497feff5fd259c9f6ca76d184bb8755373 Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Sat, 15 May 2021 14:25:37 +0200
Subject: [PATCH] patch 8.2.2852: configure can add --as-needed a second time
Problem: Configure can add --as-needed a second time.
Solution: Only add --as-needed if not already there. (Natanael Copa,
closes #8189, closes #8181)
---
src/auto/configure | 4 +++-
src/configure.ac | 4 +++-
src/version.c | 2 ++
3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/auto/configure b/src/auto/configure
index 934b34c24ee125..0b423a657755e3 100755
--- a/src/auto/configure
+++ b/src/auto/configure
@@ -14937,7 +14937,9 @@ $as_echo_n "checking linker --as-needed support... " >&6; }
LINK_AS_NEEDED=
# Check if linker supports --as-needed and --no-as-needed options
if $CC -Wl,--help 2>/dev/null | grep as-needed > /dev/null; then
- LDFLAGS=`echo "$LDFLAGS" | sed -e 's/ *-Wl,--as-needed//g' | sed -e 's/$/ -Wl,--as-needed/'`
+ if ! echo "$LDFLAGS" | grep -q -- '-Wl,[^[:space:]]*--as-needed'; then
+ LDFLAGS="$LDFLAGS -Wl,--as-needed"
+ fi
LINK_AS_NEEDED=yes
fi
if test "$LINK_AS_NEEDED" = yes; then
diff --git a/src/configure.ac b/src/configure.ac
index 657cc97f702c4b..cc8d61f7f8b744 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -4519,7 +4519,9 @@ AC_MSG_CHECKING(linker --as-needed support)
LINK_AS_NEEDED=
# Check if linker supports --as-needed and --no-as-needed options
if $CC -Wl,--help 2>/dev/null | grep as-needed > /dev/null; then
- LDFLAGS=`echo "$LDFLAGS" | sed -e 's/ *-Wl,--as-needed//g' | sed -e 's/$/ -Wl,--as-needed/'`
+ if ! echo "$LDFLAGS" | grep -q -- '-Wl,[[^[:space:]]]*--as-needed'; then
+ LDFLAGS="$LDFLAGS -Wl,--as-needed"
+ fi
LINK_AS_NEEDED=yes
fi
if test "$LINK_AS_NEEDED" = yes; then