Libtool supports linking directly against .o files on some platforms
(such as Linux), which happens to be the only place where we are
actually doing that (for the dtrace-generated probes.o files). However,
it raises a big stink about the non-portability, even though we don't
attempt it on platforms where it would actually fail:
CCLD libvirt_driver_qemu.la
*** Warning: Linking the shared library libvirt_driver_qemu.la against
the non-libtool
*** objects libvirt_qemu_probes.o is not portable!
This shuts libtool up by creating a proper .lo file that matches
what libtool normally expects.
* src/Makefile.am (%_probes.lo): New rule.
(libvirt_probes.stp, libvirt_qemu_probes.stp): Simplify into...
(%_probes.stp): ...shorter rule.
(CLEANFILES): Clean new .lo files.
(libvirt_la_BUILT_LIBADD, libvirt_driver_qemu_la_LIBADD)
(libvirt_lxc_LDADD, virt_aa_helper_LDADD): Link against .lo file.
* tests/Makefile.am (PROBES_O, qemu_LDADDS): Likewise.
---
I got tired enough of the warning to figure out how to shut it up;
libtool was rather particular about parsing the first two lines of
comments embedded in the .lo file before declaring it to have correct
syntax.
However, I got stumped by the next round of warnings:
CCLD qemuxml2xmltest
*** Warning: Linking the executable qemuxml2xmltest against the loadable module
*** libvirt_driver_qemu.so is not portable!
Anyone have a clue on that one? Would a convenience library be the key?
src/Makefile.am | 28 ++++++++++++++++++----------
tests/Makefile.am | 4 ++--
2 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index bdb0ef4..0b20f1f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1246,7 +1246,7 @@ libvirt_la_CFLAGS = -DIN_LIBVIRT $(AM_CFLAGS)
libvirt_la_DEPENDENCIES = $(libvirt_la_BUILT_LIBADD) $(LIBVIRT_SYMBOL_FILE)
if WITH_DTRACE_PROBES
-libvirt_la_BUILT_LIBADD += libvirt_probes.o
+libvirt_la_BUILT_LIBADD += libvirt_probes.lo
libvirt_la_DEPENDENCIES += libvirt_probes.o
nodist_libvirt_la_SOURCES = libvirt_probes.h
if WITH_REMOTE
@@ -1256,7 +1256,7 @@ endif WITH_REMOTE
BUILT_SOURCES += libvirt_probes.h libvirt_probes.stp libvirt_functions.stp
if WITH_QEMU
-libvirt_driver_qemu_la_LIBADD += libvirt_qemu_probes.o
+libvirt_driver_qemu_la_LIBADD += libvirt_qemu_probes.lo
nodist_libvirt_driver_qemu_la_SOURCES = libvirt_qemu_probes.h
libvirt_driver_qemu_la_DEPENDENCIES = libvirt_qemu_probes.o
@@ -1272,6 +1272,15 @@ tapset_DATA = libvirt_probes.stp libvirt_qemu_probes.stp
libvirt_functions.stp
%_probes.o: %_probes.d
$(AM_V_GEN)$(DTRACE) -o $@ -G -s $<
+%_probes.lo: %_probes.o
+ $(AM_V_GEN)printf %s\\n \
+ '# $@ - a libtool object file' \
+ '# Generated by libtool (GNU libtool) 2.4' \
+ '# Actually generated by Makefile.am, in order to shut up libtool' \
+ "pic_object='$<'" \
+ "non_pic_object='$<'" \
+ > $@
+
RPC_PROBE_FILES = $(srcdir)/rpc/virnetprotocol.x \
$(srcdir)/rpc/virkeepaliveprotocol.x \
$(srcdir)/remote/remote_protocol.x \
@@ -1280,14 +1289,13 @@ RPC_PROBE_FILES = $(srcdir)/rpc/virnetprotocol.x \
libvirt_functions.stp: $(RPC_PROBE_FILES) $(srcdir)/rpc/gensystemtap.pl
$(AM_V_GEN)perl -w $(srcdir)/rpc/gensystemtap.pl $(RPC_PROBE_FILES) > $@
-libvirt_probes.stp: libvirt_probes.d $(srcdir)/dtrace2systemtap.pl
- $(AM_V_GEN)perl -w $(srcdir)/dtrace2systemtap.pl $(bindir) $(sbindir) $(libdir) $<
> $@
-
-libvirt_qemu_probes.stp: libvirt_qemu_probes.d $(srcdir)/dtrace2systemtap.pl
- $(AM_V_GEN)perl -w $(srcdir)/dtrace2systemtap.pl $(bindir) $(sbindir) $(libdir) $<
> $@
+%_probes.stp: %_probes.d $(srcdir)/dtrace2systemtap.pl
+ $(AM_V_GEN)perl -w $(srcdir)/dtrace2systemtap.pl \
+ $(bindir) $(sbindir) $(libdir) $< > $@
-CLEANFILES += libvirt_probes.h libvirt_probes.o \
+CLEANFILES += libvirt_probes.h libvirt_probes.o libvirt_probes.lo \
libvirt_qemu_probes.h libvirt_qemu_probes.o \
+ libvirt_qemu_probes.lo\
libvirt_functions.stp libvirt_probes.stp \
libvirt_qemu_probes.stp
endif
@@ -1479,7 +1487,7 @@ libvirt_lxc_LDADD = $(CAPNG_LIBS) $(YAJL_LIBS) \
$(RT_LIBS) $(DBUS_LIBS) \
../gnulib/lib/libgnu.la
if WITH_DTRACE_PROBES
-libvirt_lxc_LDADD += libvirt_probes.o
+libvirt_lxc_LDADD += libvirt_probes.lo
endif
if WITH_SECDRIVER_SELINUX
libvirt_lxc_LDADD += $(SELINUX_LIBS)
@@ -1524,7 +1532,7 @@ virt_aa_helper_LDADD = \
libvirt_util.la \
../gnulib/lib/libgnu.la
if WITH_DTRACE_PROBES
-virt_aa_helper_LDADD += libvirt_probes.o
+virt_aa_helper_LDADD += libvirt_probes.lo
endif
virt_aa_helper_CFLAGS = \
-I$(top_srcdir)/src/conf \
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 24818b1..d1106cf 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -31,7 +31,7 @@ endif
PROBES_O =
if WITH_DTRACE_PROBES
-PROBES_O += ../src/libvirt_probes.o
+PROBES_O += ../src/libvirt_probes.lo
endif
LDADDS = \
@@ -295,7 +295,7 @@ if WITH_NETWORK
qemu_LDADDS += ../src/libvirt_driver_network.la
endif
if WITH_DTRACE_PROBES
-qemu_LDADDS += ../src/libvirt_qemu_probes.o
+qemu_LDADDS += ../src/libvirt_qemu_probes.lo
endif
qemu_LDADDS += $(LDADDS)
--
1.7.7.6