changeset 24626:7b48e331519d v8.2.2852

patch 8.2.2852: configure can add --as-needed a second time Commit: https://github.com/vim/vim/commit/761ead497feff5fd259c9f6ca76d184bb8755373 Author: Natanael Copa <ncopa@alpinelinux.org> Date: Sat May 15 14:25:37 2021 +0200 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)
author Bram Moolenaar <Bram@vim.org>
date Sat, 15 May 2021 14:30:02 +0200
parents 4bb3aeaba950
children 8a45d77243c8
files src/auto/configure src/configure.ac src/version.c
diffstat 3 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/auto/configure
+++ b/src/auto/configure
@@ -14937,7 +14937,9 @@ LDFLAGS=`echo "$LDFLAGS" | sed -e 's/-L 
 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
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -4519,7 +4519,9 @@ AC_MSG_CHECKING(linker --as-needed suppo
 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
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    2852,
+/**/
     2851,
 /**/
     2850,