]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.2852: configure can add --as-needed a second time v8.2.2852
authorNatanael Copa <ncopa@alpinelinux.org>
Sat, 15 May 2021 12:25:37 +0000 (14:25 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 15 May 2021 12:25:37 +0000 (14:25 +0200)
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
src/configure.ac
src/version.c

index 934b34c24ee1251b5feee377944b1d137fec10cd..0b423a657755e395f8fe63eae9c3e6b9c87852d6 100755 (executable)
@@ -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
index 657cc97f702c4bd65e02def9f8c33976a3fcd59f..cc8d61f7f8b7441687bf9b8671c84b1df22cd1ed 100644 (file)
@@ -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
index 0d3c2ad52bd579d9017efc6d7d0942aa16d9c2e3..f7406eec7718370f0fbc085e65705f9dc55e0ace 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2852,
 /**/
     2851,
 /**/