Automake: building shared module which is not to be installed
Asked Answered
F

2

5

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.

Flexuous answered 26/11, 2011 at 9:27 Comment(0)
M
5

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)
Martine answered 26/11, 2011 at 13:41 Comment(0)
G
2

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
Grimsby answered 30/6, 2016 at 11:23 Comment(1)
If this works then it could be a good solution. Do you know if there is a check_PROGRAMS? Or do we use noinst_PROGRAMS?Manymanya

© 2022 - 2024 — McMap. All rights reserved.