From 6e5b5bbc0af87816825aa32f30972f516e1624c8 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Fri, 14 May 2010 16:45:52 -0600 Subject: [PATCH] build: fix up some compiler flags 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 | 4 +++- proxy/Makefile.am | 4 ++-- src/Makefile.am | 6 +++--- tools/Makefile.am | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 7fa2d679a2..8c97184505 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -78,7 +78,9 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[ AC_MSG_RESULT($complCFLAGS) WARN_CFLAGS="$COMPILER_FLAGS $complCFLAGS" - AC_SUBST(WARN_CFLAGS) + WARN_LDFLAGS=$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 bee47d0775..471668348b 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 15bc8fcb2b..1c7d3e87cb 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 33a3216c05..fd05e8bd26 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 \