This is an automated email from the git hooks/post-receive script.
ildumi pushed a commit to branch development
in repository libtool.
The following commit(s) were added to refs/heads/development by this push:
new f10d6a6c ltmain.in: Recognise explicit shared library args
f10d6a6c is described below
commit f10d6a6c838d53bb6090153b2cce58f90f8e4511
Author: Nicolas Boulenguez <[email protected]>
AuthorDate: Mon Feb 23 17:32:35 2026 +0100
ltmain.in: Recognise explicit shared library args
When linking a program, GNU Libtool recognises libfoo.so arguments, but
it does not when linking shared libraries. Now, libfoo.so will be
equivalent to linking with -l:libfoo.so or -lfoo.
Reported: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54726
* build-aux/ltmain.in: Link an explicit shared library.
* Makefile.am: Add new test file, deplib-path.at.
* tests/deplib-path.at: Add new test for shared linking deplibs by the
libN.so name.
---
Makefile.am | 1 +
build-aux/ltmain.in | 23 ++++++++++++--
tests/deplib-path.at | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 111 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 02d80926..52e00476 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -693,6 +693,7 @@ TESTSUITE_AT = tests/testsuite.at \
tests/execute-mode.at \
tests/bindir.at \
tests/cwrapper.at \
+ tests/deplib-path.at \
tests/deplib-in-subdir.at \
tests/infer-tag.at \
tests/localization.at \
diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
index 9108006c..df85f00b 100644
--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -5795,8 +5795,8 @@ func_mode_link ()
fi
;;
- *.$libext)
- # An archive.
+ *.$libext|*.so)
+ # An archive or an explicit shared library.
func_append deplibs " $arg"
func_append old_deplibs " $arg"
continue
@@ -6174,6 +6174,25 @@ func_mode_link ()
func_resolve_sysroot "$deplib"
lib=$func_resolve_sysroot_result
;;
+ *.so)
+ case $linkmode,$pass in
+ lib,*)
+ deplibs="$deplib $deplibs"
+ newdependency_libs="$deplib $newdependency_libs"
+ ;;
+ prog,link)
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ ;;
+ prog,*)
+ deplibs="$deplib $deplibs"
+ ;;
+ *)
+ func_warning "'$deplib' is ignored for archives/objects"
+ ;;
+ esac
+ continue
+ ;;
*.$libext)
if test conv = "$pass"; then
deplibs="$deplib $deplibs"
diff --git a/tests/deplib-path.at b/tests/deplib-path.at
new file mode 100644
index 00000000..0b2df158
--- /dev/null
+++ b/tests/deplib-path.at
@@ -0,0 +1,89 @@
+# deplib-path.at -- test shared linking deplibs by libN.so name -*- Autotest
-*-
+#
+# Copyright (C) 2020-2026 Free Software Foundation, Inc.
+# Written by Nicolas Boulenguez, 2020-2026
+#
+# This file is part of GNU Libtool.
+#
+# GNU Libtool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# GNU Libtool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool. If not, see <https://www.gnu.org/licenses/>.
+####
+
+# Ensures libN.so -l:libN.so -lN are equivalent
+
+AT_SETUP([shared linking deplibs by libN.so name])
+
+case $host_os in
+linux*) ;;
+*) noskip=false ;;
+esac
+
+AT_CHECK([$noskip || (exit 77)])
+
+AT_DATA([one.c],
+[[
+int one(void) { return 1; }
+]])
+
+AT_DATA([two.c],
+[[
+int two(void) { return 2; }
+]])
+
+AT_DATA([three.c],
+[[
+int three(void) { return 3; }
+]])
+
+AT_DATA([sum.c],
+[[
+extern int one(void);
+extern int two(void);
+extern int three(void);
+int sum(void) { return one()+two()+three(); }
+]])
+
+AT_DATA([configure.ac],
+[[
+AC_INIT([deplib-path], ]AT_PACKAGE_VERSION[, ]AT_PACKAGE_BUGREPORT[)
+AC_CONFIG_AUX_DIR([build-aux])
+AC_CONFIG_MACRO_DIR([m4])
+AM_INIT_AUTOMAKE
+AC_PROG_CC
+LT_INIT
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+]])
+
+AT_DATA([Makefile.am],
+[[
+AUTOMAKE_OPTIONS = no-dependencies foreign
+ACLOCAL_AMFLAGS = -I m4
+AM_LDFLAGS = -no-undefined
+lib_LTLIBRARIES = libsum.la
+libsum_la_SOURCES = sum.c
+libsum_la_LIBADD = libone.so -L. -l:libtwo.so -lthree
+EXTRA_libsum_la_DEPENDENCIES = libtwo.so libthree.so
+libone.so libtwo.so libthree.so: CFLAGS += -fPIC
+libone.so libtwo.so libthree.so: lib%.so: %.o
+ $(LINK.c) -shared -o $@ $^
+]])
+
+LT_AT_LIBTOOLIZE
+LT_AT_ACLOCAL([-I m4])
+LT_AT_AUTOMAKE([--add-missing])
+LT_AT_AUTOCONF
+LT_AT_CONFIGURE
+LT_AT_MAKE
+
+AT_CLEANUP