958e1b
From 37782b793485e0f45a6e6f0da40d24c04191a13b Mon Sep 17 00:00:00 2001
958e1b
From: Fam Zheng <famz@redhat.com>
958e1b
Date: Wed, 16 Jul 2014 02:20:28 -0500
958e1b
Subject: [CHANGE 28/29] block: use per-object cflags and libs
958e1b
To: rhvirt-patches@redhat.com,
958e1b
    jen@redhat.com
958e1b
958e1b
RH-Author: Fam Zheng <famz@redhat.com>
958e1b
Message-id: <1405477228-11490-5-git-send-email-famz@redhat.com>
958e1b
Patchwork-id: 59918
958e1b
O-Subject: [RHEL-7 qemu-kvm PATCH 4/4] block: use per-object cflags and libs
958e1b
Bugzilla: 1017685
958e1b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
958e1b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
958e1b
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
958e1b
958e1b
From: Miroslav Rezanina <mrezanin@redhat.com>
958e1b
958e1b
Upstream: 6ebc91e5d0f408371460ab4329dc6de7f93306ac
958e1b
958e1b
No longer adds flags and libs for them to global variables, instead
958e1b
create config-host.mak variables like FOO_CFLAGS and FOO_LIBS, which is
958e1b
used as per object cflags and libs.
958e1b
958e1b
This removes unwanted dependencies from libcacard.
958e1b
958e1b
Signed-off-by: Fam Zheng <famz@redhat.com>
958e1b
[Split from Fam's patch to enable modules. - Paolo]
958e1b
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
958e1b
958e1b
Signed-off-by: Fam Zheng <famz@redhat.com>
958e1b
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
958e1b
958e1b
Manual backport.
958e1b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
958e1b
Signed-off-by: Fam Zheng <famz@redhat.com>
958e1b
---
958e1b
 block/Makefile.objs | 13 ++++++++++++-
958e1b
 configure           | 20 ++++++++------------
958e1b
 2 files changed, 20 insertions(+), 13 deletions(-)
958e1b
958e1b
Signed-off-by: jen <jen@redhat.com>
958e1b
---
958e1b
 block/Makefile.objs | 13 ++++++++++++-
958e1b
 configure           | 20 ++++++++------------
958e1b
 2 files changed, 20 insertions(+), 13 deletions(-)
958e1b
958e1b
diff --git a/block/Makefile.objs b/block/Makefile.objs
958e1b
index 84dd57f..dd01fb3 100644
958e1b
--- a/block/Makefile.objs
958e1b
+++ b/block/Makefile.objs
958e1b
@@ -24,4 +24,15 @@ common-obj-y += commit.o
958e1b
 common-obj-y += mirror.o
958e1b
 endif
958e1b
 
958e1b
-$(obj)/curl.o: QEMU_CFLAGS+=$(CURL_CFLAGS)
958e1b
+iscsi.o-cflags     := $(LIBISCSI_CFLAGS)
958e1b
+iscsi.o-libs       := $(LIBISCSI_LIBS)
958e1b
+curl.o-cflags      := $(CURL_CFLAGS)
958e1b
+curl.o-libs        := $(CURL_LIBS)
958e1b
+rbd.o-cflags       := $(RBD_CFLAGS)
958e1b
+rbd.o-libs         := $(RBD_LIBS)
958e1b
+gluster.o-cflags   := $(GLUSTERFS_CFLAGS)
958e1b
+gluster.o-libs     := $(GLUSTERFS_LIBS)
958e1b
+ssh.o-cflags       := $(LIBSSH2_CFLAGS)
958e1b
+ssh.o-libs         := $(LIBSSH2_LIBS)
958e1b
+qcow.o-libs        := -lz
958e1b
+linux-aio.o-libs   := -laio
958e1b
diff --git a/configure b/configure
958e1b
index 8c6f4e5..4552e08 100755
958e1b
--- a/configure
958e1b
+++ b/configure
958e1b
@@ -2290,8 +2290,6 @@ EOF
958e1b
   curl_libs=`$curlconfig --libs 2>/dev/null`
958e1b
   if compile_prog "$curl_cflags" "$curl_libs" ; then
958e1b
     curl=yes
958e1b
-    libs_tools="$curl_libs $libs_tools"
958e1b
-    libs_softmmu="$curl_libs $libs_softmmu"
958e1b
   else
958e1b
     if test "$curl" = "yes" ; then
958e1b
       feature_not_found "curl"
958e1b
@@ -2442,9 +2440,6 @@ if test "$libssh2" != "no" ; then
958e1b
     libssh2_cflags=`$pkg_config libssh2 --cflags`
958e1b
     libssh2_libs=`$pkg_config libssh2 --libs`
958e1b
     libssh2=yes
958e1b
-    libs_tools="$libssh2_libs $libs_tools"
958e1b
-    libs_softmmu="$libssh2_libs $libs_softmmu"
958e1b
-    QEMU_CFLAGS="$QEMU_CFLAGS $libssh2_cflags"
958e1b
   else
958e1b
     if test "$libssh2" = "yes" ; then
958e1b
       error_exit "libssh2 >= $min_libssh2_version required for --enable-libssh2"
958e1b
@@ -2490,8 +2485,6 @@ int main(void) { io_setup(0, NULL); io_set_eventfd(NULL, 0); eventfd(0, 0); retu
958e1b
 EOF
958e1b
   if compile_prog "" "-laio" ; then
958e1b
     linux_aio=yes
958e1b
-    libs_softmmu="$libs_softmmu -laio"
958e1b
-    libs_tools="$libs_tools -laio"
958e1b
   else
958e1b
     if test "$linux_aio" = "yes" ; then
958e1b
       feature_not_found "linux AIO"
958e1b
@@ -2644,8 +2637,6 @@ EOF
958e1b
   glusterfs_libs="-lgfapi -lgfrpc -lgfxdr"
958e1b
   if compile_prog "" "$glusterfs_libs" ; then
958e1b
     glusterfs=yes
958e1b
-    libs_tools="$glusterfs_libs $libs_tools"
958e1b
-    libs_softmmu="$glusterfs_libs $libs_softmmu"
958e1b
   else
958e1b
     if test "$glusterfs" = "yes" ; then
958e1b
       feature_not_found "GlusterFS backend support"
958e1b
@@ -3002,11 +2993,9 @@ EOF
958e1b
     libiscsi="yes"
958e1b
     libiscsi_cflags=$($pkg_config --cflags libiscsi 2>/dev/null)
958e1b
     libiscsi_libs=$($pkg_config --libs libiscsi 2>/dev/null)
958e1b
-    CFLAGS="$CFLAGS $libiscsi_cflags"
958e1b
-    LIBS="$LIBS $libiscsi_libs"
958e1b
   elif compile_prog "" "-liscsi" ; then
958e1b
     libiscsi="yes"
958e1b
-    LIBS="$LIBS -liscsi"
958e1b
+    libiscsi_libs="-liscsi"
958e1b
   else
958e1b
     if test "$libiscsi" = "yes" ; then
958e1b
       feature_not_found "libiscsi"
958e1b
@@ -3877,6 +3866,7 @@ fi
958e1b
 if test "$curl" = "yes" ; then
958e1b
   echo "CONFIG_CURL=y" >> $config_host_mak
958e1b
   echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
958e1b
+  echo "CURL_LIBS=$curl_libs" >> $config_host_mak
958e1b
 fi
958e1b
 if test "$brlapi" = "yes" ; then
958e1b
   echo "CONFIG_BRLAPI=y" >> $config_host_mak
958e1b
@@ -3966,6 +3956,8 @@ fi
958e1b
 
958e1b
 if test "$libiscsi" = "yes" ; then
958e1b
   echo "CONFIG_LIBISCSI=y" >> $config_host_mak
958e1b
+  echo "LIBISCSI_CFLAGS=$libiscsi_cflags" >> $config_host_mak
958e1b
+  echo "LIBISCSI_LIBS=$libiscsi_libs" >> $config_host_mak
958e1b
 fi
958e1b
 
958e1b
 if test "$seccomp" = "yes"; then
958e1b
@@ -4022,10 +4014,14 @@ fi
958e1b
 
958e1b
 if test "$glusterfs" = "yes" ; then
958e1b
   echo "CONFIG_GLUSTERFS=y" >> $config_host_mak
958e1b
+  echo "GLUSTERFS_CFLAGS=$glusterfs_cflags" >> $config_host_mak
958e1b
+  echo "GLUSTERFS_LIBS=$glusterfs_libs" >> $config_host_mak
958e1b
 fi
958e1b
 
958e1b
 if test "$libssh2" = "yes" ; then
958e1b
   echo "CONFIG_LIBSSH2=y" >> $config_host_mak
958e1b
+  echo "LIBSSH2_CFLAGS=$libssh2_cflags" >> $config_host_mak
958e1b
+  echo "LIBSSH2_LIBS=$libssh2_libs" >> $config_host_mak
958e1b
 fi
958e1b
 
958e1b
 if test "$virtio_blk_data_plane" = "yes" ; then
958e1b
-- 
958e1b
1.9.3
958e1b