[PATCH 2/2] ltmain.in: defer warn dependency to static library

Alexandre Janniaux <[email protected]>
Newsgroups gmane.comp.gnu.libtool.patches
Message-ID <[email protected]>
When linking old library to any libtool target that is not an
executable, libtool warns that it might not be portable, in particular
because shared libraries need PIC from the static library to be working.

However, when adding an old library as dependency to a static libtool
library, there is no linkage, and thus no portability issue, so there's
no reason to warn. If the static libtool library is then linked to a
shared library, the dependency will be forwarded and the warning will
happen at this time.
---
 build-aux/ltmain.in | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
index d172deae..ecd9a5a0 100644
--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -5891,9 +5891,11 @@ func_mode_link ()
 		;;
 	      esac
 	      if $valid_a_lib; then
-		echo
-		$ECHO "*** Warning: Linking the shared library $output against the"
-		$ECHO "*** static library $deplib is not portable!"
+		if test yes != "$build_old_libs"; then
+			echo
+			$ECHO "*** Warning: Linking the shared library $output against the"
+			$ECHO "*** static library $deplib is not portable!"
+		fi
 		deplibs="$deplib $deplibs"
 	      else
 		echo
-- 
2.31.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.