diff src/link.sh @ 2629:1ccc1ace9e5b v7.3.050

updated for version 7.3.050 Problem: The link script is clumsy. Solution: Use the --as-needed linker option if available. (Kirill A. Shutemov)
author Bram Moolenaar <bram@vim.org>
date Wed, 03 Nov 2010 22:32:24 +0100
parents 454f314d0e61
children e1e3805fcd96
line wrap: on
line diff
--- a/src/link.sh
+++ b/src/link.sh
@@ -5,7 +5,7 @@
 # libraries when they exist, but this doesn't mean they are needed for Vim.
 #
 #      Author: Bram Moolenaar
-# Last change: 2006 Sep 26
+# Last change: 2010 Nov 03
 #     License: Public domain
 #
 # Warning: This fails miserably if the linker doesn't return an error code!
@@ -16,11 +16,23 @@
 echo "$LINK " >link.cmd
 exit_value=0
 
+if test "$LINK_AS_NEEDED" = yes; then
+  echo "link.sh: \$LINK_AS_NEEDED set to 'yes': invoking linker directly."
+  cat link.cmd
+  if sh link.cmd; then
+    exit_value=0
+    echo "link.sh: Linked fine"
+  else
+    exit_value=$?
+    echo "link.sh: Linking failed"
+  fi
+else
+  if test -f auto/link.sed; then
+
 #
 # If auto/link.sed already exists, use it.  We assume a previous run of
 # link.sh has found the correct set of libraries.
 #
-if test -f auto/link.sed; then
   echo "link.sh: The file 'auto/link.sed' exists, which is going to be used now."
   echo "link.sh: If linking fails, try deleting the auto/link.sed file."
   echo "link.sh: If this fails too, try creating an empty auto/link.sed file."
@@ -124,6 +136,8 @@ if test -f auto/link.sed -a ! -s auto/li
   fi
 fi
 
+fi
+
 #
 # cleanup
 #