Subject: bug#11863: Building test plugins

From: "Gary V. Vaughan" <[email-masked]>
Date: Thu, 5 Jul 2012 13:19:04 +0700

Hi Reuben,

On 5 Jul 2012, at 05:39, Reuben Thomas wrote:
> On 4 July 2012 23:35, Stefano Lattarini <[email-masked]> wrote:
>> tags 11863 + moreinfo
>> thanks
>> 
>> On 07/04/2012 10:43 PM, Reuben Thomas wrote:
>>> I have a library that I want to build just for tests. Hence, I add it
>>> to check_LTLIBRARIES. It's a plugin, so I want the .so (or .dll or
>>> whatever) to be built, but it isn't!
>>> 
>> It isn't built when you run "make check"?
> 
> The library is built, but no .so.

check_LTLIBRARIES works somewhat like noinst_LTLIBRARIES, in that Automake
instructs libtool to build a convenience archive by default in both cases
(a convenience archive being a static archive of pic objects).

Arguably that's not the right thing for check_LTLIBRARIES, for exactly the
reasons you have been tripped up by here.  And I'd be in favour of changing
the semantics of check_LTLIBRARIES accordingly - libltdl based module
loaders will continue to cope just fine because the .la file is examined
to determine how to link and load the module.

Currently the best way to tell Automake to only build a libtool library
for `make check' without installing it, but at the same time to tell libtool
not to make a convenience archive is:

  check_LTLIBRARIES += tests/libalientest.la

  tests_libalientest_la_LDFLAGS = -module -avoid-version -rpath /dev/null

The -rpath argument tells libtool that this is not a convenience archive.
The parameter can be anything, because Automake will not install a
check_LTLIBRARIES object anyway, but /dev/null makes it clearer that we'r
doing something a bit odd here.

Cheers,
-- 
Gary V. Vaughan (gary AT gnu DOT org)