build: silence libtool during tests

Libtool is picky about linking against a module library (aka a .so);
giving lots of warnings like this in the tests directory:

  CCLD   networkxml2argvtest

*** Warning: Linking the executable networkxml2argvtest against the loadable module
*** libvirt_driver_network.so is not portable!

Fix that by splitting things into a convenience library which can
be used directly by the tests, and making the real .so just wrap
the convenience library.

Based on a suggestion by Daniel P. Berrange.

* configure.ac (--with-driver-modules): Fix help test.
* src/Makefile.am (libvirt_driver_xen.la, libvirt_driver_libxl.la)
(libvirt_driver_qemu.la, libvirt_driver_lxc.la)
(libvirt_driver_uml.la): Factor into new convenience libraries.
* tests/Makefile.am (xen_LDADDS, qemu_LDADDS, lxc_LDADDS)
(networkxml2argvtest_LDADD): Link to convenience libraries, not
shared libraries.
This commit is contained in:
Eric Blake 2012-05-25 13:18:10 -06:00
parent 1e8ecfedeb
commit 1d22ba953b
3 changed files with 69 additions and 56 deletions

View File

@ -2421,7 +2421,8 @@ AM_CONDITIONAL([WITH_WIN_ICON], [test "$WINDRES" != ""])
dnl Driver-Modules library dnl Driver-Modules library
AC_ARG_WITH([driver-modules], AC_ARG_WITH([driver-modules],
AC_HELP_STRING([--with-driver-modules], [build drivers as loadable modules @<:@default=no@:>@]), AC_HELP_STRING([--with-driver-modules],
[build drivers as loadable modules @<:@default=check@:>@]),
[], [],
[with_driver_modules=check]) [with_driver_modules=check])

View File

@ -662,25 +662,27 @@ endif WITH_REMOTE
$< $@ $< $@
if WITH_XEN if WITH_XEN
noinst_LTLIBRARIES += libvirt_driver_xen_impl.la
libvirt_driver_xen_la_SOURCES =
libvirt_driver_xen_la_LIBADD = libvirt_driver_xen_impl.la
if WITH_DRIVER_MODULES if WITH_DRIVER_MODULES
mod_LTLIBRARIES += libvirt_driver_xen.la mod_LTLIBRARIES += libvirt_driver_xen.la
libvirt_driver_xen_la_LIBADD += ../gnulib/lib/libgnu.la
libvirt_driver_xen_la_LDFLAGS = -module -avoid-version
else else
noinst_LTLIBRARIES += libvirt_driver_xen.la noinst_LTLIBRARIES += libvirt_driver_xen.la
# Stateful, so linked to daemon instead # Stateful, so linked to daemon instead
#libvirt_la_BUILT_LIBADD += libvirt_driver_xen.la #libvirt_la_BUILT_LIBADD += libvirt_driver_xen.la
endif endif
libvirt_driver_xen_la_CFLAGS = \
libvirt_driver_xen_impl_la_CFLAGS = \
$(XEN_CFLAGS) \ $(XEN_CFLAGS) \
-I$(top_srcdir)/src/conf \ -I$(top_srcdir)/src/conf \
-I$(top_srcdir)/src/xenxs \ -I$(top_srcdir)/src/xenxs \
$(AM_CFLAGS) $(AM_CFLAGS)
libvirt_driver_xen_la_LDFLAGS = $(AM_LDFLAGS) libvirt_driver_xen_impl_la_LDFLAGS = $(AM_LDFLAGS)
libvirt_driver_xen_la_LIBADD = $(XEN_LIBS) libvirt_driver_xen_impl_la_LIBADD = $(XEN_LIBS)
if WITH_DRIVER_MODULES libvirt_driver_xen_impl_la_SOURCES = $(XEN_DRIVER_SOURCES)
libvirt_driver_xen_la_LIBADD += ../gnulib/lib/libgnu.la
libvirt_driver_xen_la_LDFLAGS += -module -avoid-version
endif
libvirt_driver_xen_la_SOURCES = $(XEN_DRIVER_SOURCES)
endif endif
if WITH_PHYP if WITH_PHYP
@ -728,50 +730,54 @@ libvirt_driver_xenapi_la_SOURCES = $(XENAPI_DRIVER_SOURCES)
endif endif
if WITH_LIBXL if WITH_LIBXL
noinst_LTLIBRARIES += libvirt_driver_libxl_impl.la
libvirt_driver_libxl_la_SOURCES =
libvirt_driver_libxl_la_LIBADD = libvirt_driver_libxl_impl.la
if WITH_DRIVER_MODULES if WITH_DRIVER_MODULES
mod_LTLIBRARIES += libvirt_driver_libxl.la mod_LTLIBRARIES += libvirt_driver_libxl.la
libvirt_driver_libxl_la_LIBADD += ../gnulib/lib/libgnu.la
libvirt_driver_libxl_la_LDFLAGS = -module -avoid-version
else else
noinst_LTLIBRARIES += libvirt_driver_libxl.la noinst_LTLIBRARIES += libvirt_driver_libxl.la
# Stateful, so linked to daemon instead # Stateful, so linked to daemon instead
#libvirt_la_BUILT_LIBADD += libvirt_driver_libxl.la #libvirt_la_BUILT_LIBADD += libvirt_driver_libxl.la
endif endif
libvirt_driver_libxl_la_CFLAGS = $(LIBXL_CFLAGS) \
libvirt_driver_libxl_impl_la_CFLAGS = $(LIBXL_CFLAGS) \
-I$(top_srcdir)/src/conf \ -I$(top_srcdir)/src/conf \
-I$(top_srcdir)/src/xenxs \ -I$(top_srcdir)/src/xenxs \
$(AM_CFLAGS) $(AM_CFLAGS)
libvirt_driver_libxl_la_LDFLAGS = $(AM_LDFLAGS) libvirt_driver_libxl_impl_la_LDFLAGS = $(AM_LDFLAGS)
libvirt_driver_libxl_la_LIBADD = $(LIBXL_LIBS) libvirt_xenxs.la libvirt_driver_libxl_impl_la_LIBADD = $(LIBXL_LIBS) libvirt_xenxs.la
if WITH_DRIVER_MODULES libvirt_driver_libxl_impl_la_SOURCES = $(LIBXL_DRIVER_SOURCES)
libvirt_driver_libxl_la_LIBADD += ../gnulib/lib/libgnu.la
libvirt_driver_libxl_la_LDFLAGS += -module -avoid-version
endif
libvirt_driver_libxl_la_SOURCES = $(LIBXL_DRIVER_SOURCES)
endif endif
if WITH_QEMU if WITH_QEMU
noinst_LTLIBRARIES += libvirt_driver_qemu_impl.la
libvirt_driver_qemu_la_SOURCES =
libvirt_driver_qemu_la_LIBADD = libvirt_driver_qemu_impl.la
if WITH_DRIVER_MODULES if WITH_DRIVER_MODULES
mod_LTLIBRARIES += libvirt_driver_qemu.la mod_LTLIBRARIES += libvirt_driver_qemu.la
libvirt_driver_qemu_la_LIBADD += ../gnulib/lib/libgnu.la
libvirt_driver_qemu_la_LDFLAGS = -module -avoid-version
else else
noinst_LTLIBRARIES += libvirt_driver_qemu.la noinst_LTLIBRARIES += libvirt_driver_qemu.la
# Stateful, so linked to daemon instead # Stateful, so linked to daemon instead
#libvirt_la_BUILT_LIBADD += libvirt_driver_qemu.la #libvirt_la_BUILT_LIBADD += libvirt_driver_qemu.la
endif endif
libvirt_driver_qemu_la_CFLAGS = $(NUMACTL_CFLAGS) \
libvirt_driver_qemu_impl_la_CFLAGS = $(NUMACTL_CFLAGS) \
$(GNUTLS_CFLAGS) \ $(GNUTLS_CFLAGS) \
$(LIBXML_CFLAGS) \ $(LIBXML_CFLAGS) \
$(LIBNL_CFLAGS) \ $(LIBNL_CFLAGS) \
-I$(top_srcdir)/src/conf $(AM_CFLAGS) -I$(top_srcdir)/src/conf $(AM_CFLAGS)
libvirt_driver_qemu_la_LDFLAGS = $(AM_LDFLAGS) libvirt_driver_qemu_impl_la_LDFLAGS = $(AM_LDFLAGS)
libvirt_driver_qemu_la_LIBADD = $(NUMACTL_LIBS) \ libvirt_driver_qemu_impl_la_LIBADD = $(NUMACTL_LIBS) \
$(CAPNG_LIBS) \ $(CAPNG_LIBS) \
$(GNUTLS_LIBS) \ $(GNUTLS_LIBS) \
$(LIBXML_LIBS) \ $(LIBXML_LIBS) \
$(LIBNL_LIBS) $(LIBNL_LIBS)
if WITH_DRIVER_MODULES libvirt_driver_qemu_impl_la_SOURCES = $(QEMU_DRIVER_SOURCES)
libvirt_driver_qemu_la_LIBADD += ../gnulib/lib/libgnu.la
libvirt_driver_qemu_la_LDFLAGS += -module -avoid-version
endif
libvirt_driver_qemu_la_SOURCES = $(QEMU_DRIVER_SOURCES)
conf_DATA += qemu/qemu.conf conf_DATA += qemu/qemu.conf
@ -785,32 +791,34 @@ EXTRA_DIST += qemu/qemu.conf qemu/libvirtd_qemu.aug \
if WITH_LXC if WITH_LXC
noinst_LTLIBRARIES += libvirt_driver_lxc_impl.la
libvirt_driver_lxc_la_SOURCES =
libvirt_driver_lxc_la_LIBADD = libvirt_driver_lxc_impl.la
if WITH_DRIVER_MODULES if WITH_DRIVER_MODULES
mod_LTLIBRARIES += libvirt_driver_lxc.la mod_LTLIBRARIES += libvirt_driver_lxc.la
libvirt_driver_lxc_la_LIBADD += ../gnulib/lib/libgnu.la
libvirt_driver_lxc_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
else else
noinst_LTLIBRARIES += libvirt_driver_lxc.la noinst_LTLIBRARIES += libvirt_driver_lxc.la
# Stateful, so linked to daemon instead # Stateful, so linked to daemon instead
#libvirt_la_BUILT_LIBADD += libvirt_driver_lxc.la #libvirt_la_BUILT_LIBADD += libvirt_driver_lxc.la
endif endif
libvirt_driver_lxc_la_CFLAGS = \
libvirt_driver_lxc_impl_la_CFLAGS = \
$(LIBNL_CFLAGS) \ $(LIBNL_CFLAGS) \
-I$(top_srcdir)/src/conf $(AM_CFLAGS) -I$(top_srcdir)/src/conf $(AM_CFLAGS)
libvirt_driver_lxc_la_LIBADD = $(CAPNG_LIBS) $(LIBNL_LIBS) libvirt_driver_lxc_impl_la_LIBADD = $(CAPNG_LIBS) $(LIBNL_LIBS)
if HAVE_LIBBLKID if HAVE_LIBBLKID
libvirt_driver_lxc_la_CFLAGS += $(BLKID_CFLAGS) libvirt_driver_lxc_impl_la_CFLAGS += $(BLKID_CFLAGS)
libvirt_driver_lxc_la_LIBADD += $(BLKID_LIBS) libvirt_driver_lxc_impl_la_LIBADD += $(BLKID_LIBS)
endif endif
if WITH_SECDRIVER_SELINUX if WITH_SECDRIVER_SELINUX
libvirt_driver_lxc_la_LIBADD += $(SELINUX_LIBS) libvirt_driver_lxc_impl_la_LIBADD += $(SELINUX_LIBS)
endif endif
if WITH_SECDRIVER_APPARMOR if WITH_SECDRIVER_APPARMOR
libvirt_driver_lxc_la_LIBADD += $(APPARMOR_LIBS) libvirt_driver_lxc_impl_la_LIBADD += $(APPARMOR_LIBS)
endif endif
if WITH_DRIVER_MODULES libvirt_driver_lxc_impl_la_SOURCES = $(LXC_DRIVER_SOURCES)
libvirt_driver_lxc_la_LIBADD += ../gnulib/lib/libgnu.la
libvirt_driver_lxc_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
endif
libvirt_driver_lxc_la_SOURCES = $(LXC_DRIVER_SOURCES)
conf_DATA += lxc/lxc.conf conf_DATA += lxc/lxc.conf
@ -822,22 +830,24 @@ endif
EXTRA_DIST += lxc/lxc.conf lxc/libvirtd_lxc.aug lxc/test_libvirtd_lxc.aug.in EXTRA_DIST += lxc/lxc.conf lxc/libvirtd_lxc.aug lxc/test_libvirtd_lxc.aug.in
if WITH_UML if WITH_UML
noinst_LTLIBRARIES += libvirt_driver_uml_impl.la
libvirt_driver_uml_la_SOURCES =
libvirt_driver_uml_la_LIBADD = libvirt_driver_uml_impl.la
if WITH_DRIVER_MODULES if WITH_DRIVER_MODULES
mod_LTLIBRARIES += libvirt_driver_uml.la mod_LTLIBRARIES += libvirt_driver_uml.la
libvirt_driver_uml_la_LIBADD += ../gnulib/lib/libgnu.la
libvirt_driver_uml_la_LDFLAGS = -module -avoid-version
else else
noinst_LTLIBRARIES += libvirt_driver_uml.la noinst_LTLIBRARIES += libvirt_driver_uml.la
# Stateful, so linked to daemon instead # Stateful, so linked to daemon instead
#libvirt_la_BUILT_LIBADD += libvirt_driver_uml.la #libvirt_la_BUILT_LIBADD += libvirt_driver_uml.la
endif endif
libvirt_driver_uml_la_CFLAGS = $(NUMACTL_CFLAGS) \
libvirt_driver_uml_impl_la_CFLAGS = $(NUMACTL_CFLAGS) \
-I$(top_srcdir)/src/conf $(AM_CFLAGS) -I$(top_srcdir)/src/conf $(AM_CFLAGS)
libvirt_driver_uml_la_LDFLAGS = $(AM_LDFLAGS) libvirt_driver_uml_impl_la_LDFLAGS = $(AM_LDFLAGS)
libvirt_driver_uml_la_LIBADD = $(NUMACTL_LIBS) libvirt_driver_uml_impl_la_LIBADD = $(NUMACTL_LIBS)
if WITH_DRIVER_MODULES libvirt_driver_uml_impl_la_SOURCES = $(UML_DRIVER_SOURCES)
libvirt_driver_uml_la_LIBADD += ../gnulib/lib/libgnu.la
libvirt_driver_uml_la_LDFLAGS += -module -avoid-version
endif
libvirt_driver_uml_la_SOURCES = $(UML_DRIVER_SOURCES)
endif endif
@ -876,21 +886,23 @@ libvirt_driver_hyperv_la_SOURCES = $(HYPERV_DRIVER_SOURCES)
endif endif
if WITH_NETWORK if WITH_NETWORK
noinst_LTLIBRARIES += libvirt_driver_network_impl.la
libvirt_driver_network_la_SOURCES =
libvirt_driver_network_la_LIBADD = libvirt_driver_network_impl.la
if WITH_DRIVER_MODULES if WITH_DRIVER_MODULES
mod_LTLIBRARIES += libvirt_driver_network.la mod_LTLIBRARIES += libvirt_driver_network.la
libvirt_driver_network_la_LIBADD += ../gnulib/lib/libgnu.la $(LIBNL_LIBS)
libvirt_driver_network_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
else else
noinst_LTLIBRARIES += libvirt_driver_network.la noinst_LTLIBRARIES += libvirt_driver_network.la
# Stateful, so linked to daemon instead # Stateful, so linked to daemon instead
#libvirt_la_BUILT_LIBADD += libvirt_driver_network.la #libvirt_la_BUILT_LIBADD += libvirt_driver_network.la
endif endif
libvirt_driver_network_la_CFLAGS = \
libvirt_driver_network_impl_la_CFLAGS = \
$(LIBNL_CFLAGS) \ $(LIBNL_CFLAGS) \
-I$(top_srcdir)/src/conf $(AM_CFLAGS) -I$(top_srcdir)/src/conf $(AM_CFLAGS)
if WITH_DRIVER_MODULES libvirt_driver_network_impl_la_SOURCES = $(NETWORK_DRIVER_SOURCES)
libvirt_driver_network_la_LIBADD = ../gnulib/lib/libgnu.la $(LIBNL_LIBS)
libvirt_driver_network_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
endif
libvirt_driver_network_la_SOURCES = $(NETWORK_DRIVER_SOURCES)
endif endif
EXTRA_DIST += network/default.xml EXTRA_DIST += network/default.xml

View File

@ -252,7 +252,7 @@ sockettest_SOURCES = \
sockettest_LDADD = $(LDADDS) sockettest_LDADD = $(LDADDS)
if WITH_XEN if WITH_XEN
xen_LDADDS = ../src/libvirt_driver_xen.la xen_LDADDS = ../src/libvirt_driver_xen_impl.la
xen_LDADDS += $(LDADDS) xen_LDADDS += $(LDADDS)
xml2sexprtest_SOURCES = \ xml2sexprtest_SOURCES = \
@ -290,9 +290,9 @@ endif
if WITH_QEMU if WITH_QEMU
qemu_LDADDS = ../src/libvirt_driver_qemu.la qemu_LDADDS = ../src/libvirt_driver_qemu_impl.la
if WITH_NETWORK if WITH_NETWORK
qemu_LDADDS += ../src/libvirt_driver_network.la qemu_LDADDS += ../src/libvirt_driver_network_impl.la
endif endif
if WITH_DTRACE_PROBES if WITH_DTRACE_PROBES
qemu_LDADDS += ../src/libvirt_qemu_probes.lo qemu_LDADDS += ../src/libvirt_qemu_probes.lo
@ -337,9 +337,9 @@ endif
if WITH_LXC if WITH_LXC
lxc_LDADDS = ../src/libvirt_driver_lxc.la lxc_LDADDS = ../src/libvirt_driver_lxc_impl.la
if WITH_NETWORK if WITH_NETWORK
lxc_LDADDS += ../src/libvirt_driver_network.la lxc_LDADDS += ../src/libvirt_driver_network_impl.la
endif endif
lxc_LDADDS += $(LDADDS) lxc_LDADDS += $(LDADDS)
@ -393,7 +393,7 @@ if WITH_NETWORK
networkxml2argvtest_SOURCES = \ networkxml2argvtest_SOURCES = \
networkxml2argvtest.c \ networkxml2argvtest.c \
testutils.c testutils.h testutils.c testutils.h
networkxml2argvtest_LDADD = ../src/libvirt_driver_network.la $(LDADDS) networkxml2argvtest_LDADD = ../src/libvirt_driver_network_impl.la $(LDADDS)
else else
EXTRA_DIST += networkxml2argvtest.c EXTRA_DIST += networkxml2argvtest.c
endif endif