5

如何告诉 Automake 构建一个不需要安装的动态模块?

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

导致 mywrapper.so 安装到pkglibdir.

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

导致改为构建静态便利库。

有问题的动态模块仅用于运行测试套件,因此不被分发。

4

2 回答 2

4

我有同样的问题。这就是我所做的,包括对自己的愤怒评论以供将来参考:

# 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)
于 2011-11-26T13:41:50.233 回答
2

您可以将check_LTLIBRARIESwhich is 用于测试目标。根据 Automake 的统一命名方案

特殊前缀“check_”表示在运行“make check”命令之前不应构建有问题的对象。这些对象也没有安装。

它还默认生成一个静态库。我设法像这样强迫它:

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

您还可以编译和运行测试套件可执行文件。

check_PROGRAMS = suite

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

check-local:
    ./suite
于 2016-06-30T11:23:28.287 回答