[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] 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.
---
 configure.ac      |    3 +-
 src/Makefile.am   |  110 +++++++++++++++++++++++++++++-----------------------
 tests/Makefile.am |   12 +++---
 3 files changed, 69 insertions(+), 56 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5d06b47..27997ed 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2420,7 +2420,8 @@ AM_CONDITIONAL([WITH_WIN_ICON], [test "$WINDRES" != ""])

 dnl Driver-Modules library
 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])

diff --git a/src/Makefile.am b/src/Makefile.am
index 0b20f1f..53c246d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -662,25 +662,27 @@ endif WITH_REMOTE
 	       $< $@

 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
 mod_LTLIBRARIES += libvirt_driver_xen.la
+libvirt_driver_xen_la_LIBADD += ../gnulib/lib/libgnu.la
+libvirt_driver_xen_la_LDFLAGS = -module -avoid-version
 else
 noinst_LTLIBRARIES += libvirt_driver_xen.la
 # Stateful, so linked to daemon instead
 #libvirt_la_BUILT_LIBADD += libvirt_driver_xen.la
 endif
-libvirt_driver_xen_la_CFLAGS =					\
+
+libvirt_driver_xen_impl_la_CFLAGS =					\
 		$(XEN_CFLAGS)					\
 		-I$(top_srcdir)/src/conf			\
 		-I$(top_srcdir)/src/xenxs			\
 		$(AM_CFLAGS)
-libvirt_driver_xen_la_LDFLAGS = $(AM_LDFLAGS)
-libvirt_driver_xen_la_LIBADD = $(XEN_LIBS)
-if WITH_DRIVER_MODULES
-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)
+libvirt_driver_xen_impl_la_LDFLAGS = $(AM_LDFLAGS)
+libvirt_driver_xen_impl_la_LIBADD = $(XEN_LIBS)
+libvirt_driver_xen_impl_la_SOURCES = $(XEN_DRIVER_SOURCES)
 endif

 if WITH_PHYP
@@ -728,50 +730,54 @@ libvirt_driver_xenapi_la_SOURCES = $(XENAPI_DRIVER_SOURCES)
 endif

 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
 mod_LTLIBRARIES += libvirt_driver_libxl.la
+libvirt_driver_libxl_la_LIBADD += ../gnulib/lib/libgnu.la
+libvirt_driver_libxl_la_LDFLAGS = -module -avoid-version
 else
 noinst_LTLIBRARIES += libvirt_driver_libxl.la
 # Stateful, so linked to daemon instead
 #libvirt_la_BUILT_LIBADD += libvirt_driver_libxl.la
 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/xenxs			\
 		$(AM_CFLAGS)
-libvirt_driver_libxl_la_LDFLAGS = $(AM_LDFLAGS)
-libvirt_driver_libxl_la_LIBADD = $(LIBXL_LIBS) libvirt_xenxs.la
-if WITH_DRIVER_MODULES
-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)
+libvirt_driver_libxl_impl_la_LDFLAGS = $(AM_LDFLAGS)
+libvirt_driver_libxl_impl_la_LIBADD = $(LIBXL_LIBS) libvirt_xenxs.la
+libvirt_driver_libxl_impl_la_SOURCES = $(LIBXL_DRIVER_SOURCES)
 endif

 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
 mod_LTLIBRARIES += libvirt_driver_qemu.la
+libvirt_driver_qemu_la_LIBADD += ../gnulib/lib/libgnu.la
+libvirt_driver_qemu_la_LDFLAGS = -module -avoid-version
 else
 noinst_LTLIBRARIES += libvirt_driver_qemu.la
 # Stateful, so linked to daemon instead
 #libvirt_la_BUILT_LIBADD += libvirt_driver_qemu.la
 endif
-libvirt_driver_qemu_la_CFLAGS = $(NUMACTL_CFLAGS) \
+
+libvirt_driver_qemu_impl_la_CFLAGS = $(NUMACTL_CFLAGS) \
                                 $(GNUTLS_CFLAGS) \
                                 $(LIBXML_CFLAGS) \
                                 $(LIBNL_CFLAGS) \
 		-I$(top_srcdir)/src/conf $(AM_CFLAGS)
-libvirt_driver_qemu_la_LDFLAGS = $(AM_LDFLAGS)
-libvirt_driver_qemu_la_LIBADD = $(NUMACTL_LIBS) \
+libvirt_driver_qemu_impl_la_LDFLAGS = $(AM_LDFLAGS)
+libvirt_driver_qemu_impl_la_LIBADD = $(NUMACTL_LIBS) \
 				$(CAPNG_LIBS) \
                                 $(GNUTLS_LIBS) \
                                 $(LIBXML_LIBS) \
 				$(LIBNL_LIBS)
-if WITH_DRIVER_MODULES
-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)
+libvirt_driver_qemu_impl_la_SOURCES = $(QEMU_DRIVER_SOURCES)

 conf_DATA += qemu/qemu.conf

@@ -784,32 +790,34 @@ EXTRA_DIST += qemu/qemu.conf qemu/libvirtd_qemu.aug \


 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
 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
 noinst_LTLIBRARIES += libvirt_driver_lxc.la
 # Stateful, so linked to daemon instead
 #libvirt_la_BUILT_LIBADD += libvirt_driver_lxc.la
 endif
-libvirt_driver_lxc_la_CFLAGS = \
+
+libvirt_driver_lxc_impl_la_CFLAGS = \
 		$(LIBNL_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
-libvirt_driver_lxc_la_CFLAGS += $(BLKID_CFLAGS)
-libvirt_driver_lxc_la_LIBADD += $(BLKID_LIBS)
+libvirt_driver_lxc_impl_la_CFLAGS += $(BLKID_CFLAGS)
+libvirt_driver_lxc_impl_la_LIBADD += $(BLKID_LIBS)
 endif
 if WITH_SECDRIVER_SELINUX
-libvirt_driver_lxc_la_LIBADD += $(SELINUX_LIBS)
+libvirt_driver_lxc_impl_la_LIBADD += $(SELINUX_LIBS)
 endif
 if WITH_SECDRIVER_APPARMOR
-libvirt_driver_lxc_la_LIBADD += $(APPARMOR_LIBS)
-endif
-if WITH_DRIVER_MODULES
-libvirt_driver_lxc_la_LIBADD += ../gnulib/lib/libgnu.la
-libvirt_driver_lxc_la_LDFLAGS = -module -avoid-version $(AM_LDFLAGS)
+libvirt_driver_lxc_impl_la_LIBADD += $(APPARMOR_LIBS)
 endif
-libvirt_driver_lxc_la_SOURCES = $(LXC_DRIVER_SOURCES)
+libvirt_driver_lxc_impl_la_SOURCES = $(LXC_DRIVER_SOURCES)

 conf_DATA += lxc/lxc.conf

@@ -820,22 +828,24 @@ endif
 EXTRA_DIST += lxc/lxc.conf lxc/libvirtd_lxc.aug lxc/test_libvirtd_lxc.aug

 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
 mod_LTLIBRARIES += libvirt_driver_uml.la
+libvirt_driver_uml_la_LIBADD += ../gnulib/lib/libgnu.la
+libvirt_driver_uml_la_LDFLAGS = -module -avoid-version
 else
 noinst_LTLIBRARIES += libvirt_driver_uml.la
 # Stateful, so linked to daemon instead
 #libvirt_la_BUILT_LIBADD += libvirt_driver_uml.la
 endif
-libvirt_driver_uml_la_CFLAGS = $(NUMACTL_CFLAGS) \
+
+libvirt_driver_uml_impl_la_CFLAGS = $(NUMACTL_CFLAGS) \
 		-I$(top_srcdir)/src/conf $(AM_CFLAGS)
-libvirt_driver_uml_la_LDFLAGS = $(AM_LDFLAGS)
-libvirt_driver_uml_la_LIBADD = $(NUMACTL_LIBS)
-if WITH_DRIVER_MODULES
-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)
+libvirt_driver_uml_impl_la_LDFLAGS = $(AM_LDFLAGS)
+libvirt_driver_uml_impl_la_LIBADD = $(NUMACTL_LIBS)
+libvirt_driver_uml_impl_la_SOURCES = $(UML_DRIVER_SOURCES)
 endif


@@ -874,21 +884,23 @@ libvirt_driver_hyperv_la_SOURCES = $(HYPERV_DRIVER_SOURCES)
 endif

 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
 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
 noinst_LTLIBRARIES += libvirt_driver_network.la
 # Stateful, so linked to daemon instead
 #libvirt_la_BUILT_LIBADD += libvirt_driver_network.la
 endif
-libvirt_driver_network_la_CFLAGS = \
+
+libvirt_driver_network_impl_la_CFLAGS = \
 		$(LIBNL_CFLAGS) \
 		-I$(top_srcdir)/src/conf $(AM_CFLAGS)
-if WITH_DRIVER_MODULES
-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)
+libvirt_driver_network_impl_la_SOURCES = $(NETWORK_DRIVER_SOURCES)
 endif
 EXTRA_DIST += network/default.xml

diff --git a/tests/Makefile.am b/tests/Makefile.am
index d1106cf..e3bd6d1 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -252,7 +252,7 @@ sockettest_SOURCES = \
 sockettest_LDADD = $(LDADDS)

 if WITH_XEN
-xen_LDADDS = ../src/libvirt_driver_xen.la
+xen_LDADDS = ../src/libvirt_driver_xen_impl.la
 xen_LDADDS += $(LDADDS)

 xml2sexprtest_SOURCES = \
@@ -290,9 +290,9 @@ endif

 if WITH_QEMU

-qemu_LDADDS = ../src/libvirt_driver_qemu.la
+qemu_LDADDS = ../src/libvirt_driver_qemu_impl.la
 if WITH_NETWORK
-qemu_LDADDS += ../src/libvirt_driver_network.la
+qemu_LDADDS += ../src/libvirt_driver_network_impl.la
 endif
 if WITH_DTRACE_PROBES
 qemu_LDADDS += ../src/libvirt_qemu_probes.lo
@@ -337,9 +337,9 @@ endif

 if WITH_LXC

-lxc_LDADDS = ../src/libvirt_driver_lxc.la
+lxc_LDADDS = ../src/libvirt_driver_lxc_impl.la
 if WITH_NETWORK
-lxc_LDADDS += ../src/libvirt_driver_network.la
+lxc_LDADDS += ../src/libvirt_driver_network_impl.la
 endif
 lxc_LDADDS += $(LDADDS)

@@ -393,7 +393,7 @@ if WITH_NETWORK
 networkxml2argvtest_SOURCES = \
 	networkxml2argvtest.c \
 	testutils.c testutils.h
-networkxml2argvtest_LDADD = ../src/libvirt_driver_network.la $(LDADDS)
+networkxml2argvtest_LDADD = ../src/libvirt_driver_network_impl.la $(LDADDS)
 else
 EXTRA_DIST += networkxml2argvtest.c
 endif
-- 
1.7.7.6


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]