[libvirt] [PATCH] build: fix up some compiler flags

Eric Blake eblake at redhat.com
Fri May 14 22:58:14 UTC 2010


Matthias noted that the line:
virt_aa_helper_LDFLAGS = $(WARN_CFLAGS)
looks inconsistent, so I did an audit.

Currently, the set of compiler warning flags passed to gcc as $CC are
equally permitted as the set of linker flags passed to gcc as $LD, so
there was no problem with that usage.  But if we ever get in a
situation where $CC and $LD treat particular flags differently, using
the right variable form will make it easier.

In the process, I spotted a couple of typos that were omitting useful
flags, as well as specifying a -l under the wrong variable.

* acinclude.m4 (LIBVIRT_COMPILE_WARNINGS): Define WARN_LDFLAGS as
an alias for WARN_CFLAGS.
* tools/Makefile.am (virsh_LDFLAGS): Use more canonical spelling.
* proxy/Makefile.am (libvirt_proxy_LDFLAGS): Likewise. Move
library...
(libvirt_proxy_LDADD): ...here.
* src/Makefile.am (virt_aa_helper_LDFLAGS): Use more canonical
spelling of WARN_LDFLAGS.
(libvirt_parthelper_LDFLAGS, libvirt_lxc_LDFLAGS): Likewise.  Use
correct spelling of COVERAGE_LDFLAGS.
Reported by Matthias Bolte.
---
 acinclude.m4      |    3 ++-
 proxy/Makefile.am |    4 ++--
 src/Makefile.am   |    6 +++---
 tools/Makefile.am |    4 ++--
 4 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/acinclude.m4 b/acinclude.m4
index 7fa2d67..f048879 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -78,7 +78,8 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
     AC_MSG_RESULT($complCFLAGS)

     WARN_CFLAGS="$COMPILER_FLAGS $complCFLAGS"
-    AC_SUBST(WARN_CFLAGS)
+    AC_SUBST([WARN_CFLAGS])
+    AC_SUBST([WARN_LDFLAGS])

     dnl Needed to keep compile quiet on python 2.4
     COMPILER_FLAGS=
diff --git a/proxy/Makefile.am b/proxy/Makefile.am
index bee47d0..4716683 100644
--- a/proxy/Makefile.am
+++ b/proxy/Makefile.am
@@ -32,9 +32,9 @@ libvirt_proxy_SOURCES = libvirt_proxy.c \
 	    @top_srcdir@/src/xen/xen_hypervisor.c \
 	    @top_srcdir@/src/xen/sexpr.c  \
             @top_srcdir@/src/xen/xs_internal.c
-libvirt_proxy_LDFLAGS = $(WARN_CFLAGS) $(XEN_LIBS)
+libvirt_proxy_LDFLAGS = $(WARN_LDFLAGS)
 libvirt_proxy_DEPENDENCIES =
-libvirt_proxy_LDADD = ../gnulib/lib/libgnu.la $(LIB_PTHREAD)
+libvirt_proxy_LDADD = ../gnulib/lib/libgnu.la $(XEN_LIBS) $(LIB_PTHREAD)

 install-exec-hook:
 	chmod u+s $(DESTDIR)$(libexecdir)/libvirt_proxy
diff --git a/src/Makefile.am b/src/Makefile.am
index 72f23a7..034feec 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1004,7 +1004,7 @@ if WITH_LIBVIRTD
 libexec_PROGRAMS += libvirt_parthelper

 libvirt_parthelper_SOURCES = $(STORAGE_HELPER_DISK_SOURCES)
-libvirt_parthelper_LDFLAGS = $(WARN_CFLAGS) $(COVERAGE_LDCFLAGS)
+libvirt_parthelper_LDFLAGS = $(WARN_LDFLAGS) $(COVERAGE_LDFLAGS)
 libvirt_parthelper_LDADD = $(LIBPARTED_LIBS)
 libvirt_parthelper_CFLAGS =  $(LIBPARTED_CFLAGS)
 endif
@@ -1024,7 +1024,7 @@ libvirt_lxc_SOURCES =						\
 		$(DOMAIN_CONF_SOURCES)				\
 		$(CPU_CONF_SOURCES)				\
 		$(NWFILTER_PARAM_CONF_SOURCES)
-libvirt_lxc_LDFLAGS = $(WARN_CFLAGS) $(COVERAGE_LDCFLAGS)
+libvirt_lxc_LDFLAGS = $(WARN_CFLAGS) $(COVERAGE_LDFLAGS)
 libvirt_lxc_LDADD = $(CAPNG_LIBS) $(YAJL_LIBS) \
 		$(LIBXML_LIBS) $(NUMACTL_LIBS) $(LIB_PTHREAD) \
 		../gnulib/lib/libgnu.la
@@ -1044,7 +1044,7 @@ libexec_PROGRAMS += virt-aa-helper

 virt_aa_helper_SOURCES = $(SECURITY_DRIVER_APPARMOR_HELPER_SOURCES)

-virt_aa_helper_LDFLAGS = $(WARN_CFLAGS)
+virt_aa_helper_LDFLAGS = $(WARN_LDFLAGS)
 virt_aa_helper_LDADD =						\
 		$(LIBXML_LIBS)					\
 		libvirt_conf.la					\
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 33a3216..fd05e8b 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -34,14 +34,14 @@ virsh_SOURCES =							\
 		console.c console.h				\
 		virsh.c

-virsh_LDFLAGS = $(WARN_CFLAGS) $(COVERAGE_LDFLAGS)
+virsh_LDFLAGS = $(WARN_LDFLAGS) $(COVERAGE_LDFLAGS)
 virsh_LDADD =							\
 		$(STATIC_BINARIES)				\
 		$(WARN_CFLAGS)					\
 		../src/libvirt.la				\
 		../gnulib/lib/libgnu.la				\
 		$(VIRSH_LIBS)
-virsh_CFLAGS = 							\
+virsh_CFLAGS =							\
 		-I$(top_srcdir)/gnulib/lib -I../gnulib/lib	\
 		-I../include -I$(top_srcdir)/include		\
 		-I$(top_srcdir)/src				\
-- 
1.7.0.1




More information about the libvir-list mailing list