Subject: bug#14709: NetBSD: ld option -l:bar.so and libtool (_LT_CHECK_MAGIC_METHOD is not pass_all)

From: Anthony Mallet <[email-masked]>
Date: Mon, 24 Jun 2013 19:36:11 +0200

Hi,

To make a long story short, I want to link a shared library on NetBSD (6.0.1
and -current, on amd64 && i386 for that matter), using gcc-4.5.3, ld-2.21.1 and
libtool-2.4.2.

% uname -sm
NetBSD amd64
% libtool --mode=link gcc -rpath /foo -o libfoo.la -l:bar.so
[bla bla]
*** Warning: linker path does not have real file for library -l:bar.so.
[bla bla]
libtool: link: gcc -shared      -Wl,-soname -Wl,libfoo.so.0 -o .libs/libfoo.so.0.0.0
[bla bla]

libtool is dropping my -l:bar.so because it can't find a file named ':bar.so'
(with a leading colon, no matter if bar.so exists or not), but ld supports the
special -l:bar.so, so clearly libtool is misbehaving here.

I found that the problem resides indirectly in this bit of code in libtool.m4
(summarized):
# _LT_CHECK_MAGIC_METHOD
# ----------------------
# how to check for library dependencies
netbsd* | netbsdelf*-gnu)
  lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'

I would like to see lt_cv_deplibs_check_method set to "pass_all" here. But I'm
not sure if this can raise unexpected side effects or what should be checked
exactly in order to know if it is correct to set "pass_all" here.

Or maybe would you have another suggestion for fixing the issue?
Thanks in advance for any hint,

Anthony