Search code examples
automakelibtool

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.


Solution

  • 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)