Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automake: building shared module which is not to be installed

How to tell Automake to build a dynamic module which is not to be installed?

pkglib_LTLIBRARIES = mywrapper.la
mywrapper_la_LDFLAGS = -no-undefined -module -avoid-version

causes mywrapper.so to be installed to pkglibdir.

noinst_LTLIBRARIES = mywrapper.la
mywrapper_la_LDFLAGS = -no-undefined -module -avoid-version

causes static convenience library to be built instead.

The dynamic module in question is only used to run a test suite, and hence is not to be distributed.

like image 484
dottedmag Avatar asked Nov 26 '11 09:11

dottedmag


2 Answers

I had the same problem. This is what I did, including the peeved comment to myself for future reference:

# The rpath is necessary because stoopid libtool won't build a shared library
# if it's noinst_, because what POSSIBLE reason could you have to do that?
TEST_PLUGIN_LIBTOOL_FLAGS = \
    -module \
    -shared \
    -avoid-version \
    -export-symbols-regex "<whatever symbols you need to export>" \
    -rpath $(abs_builddir)

noinst_LTLIBRARIES = mywrapper.la
mywrapper_la_LDFLAGS = $(TEST_PLUGIN_LIBTOOL_FLAGS)
like image 142
ptomato Avatar answered Sep 28 '22 09:09

ptomato


You can use check_LTLIBRARIES which is for test targets. According to Automake's Uniform Naming Scheme:

The special prefix ‘check_’ indicates that the objects in question should not be built until the ‘make check’ command is run. Those objects are not installed either.

It also generates a static library by default. I managed to force it like this:

check_LTLIBRARIES = mywrapper.la
mywrapper_la_LDFLAGS = -no-undefined -module -shared -avoid-version -rpath /tmp

You can also compile and run a test suite executable.

check_PROGRAMS = suite

suite_SOURCES = ...
suite_LDFLAGS = ...
suite_LDADD = ...

check-local:
    ./suite
like image 38
wedesoft Avatar answered Sep 28 '22 08:09

wedesoft