Patchwork [RFC,4/4] build-sys: move -lcurl out of libs and specify it for curl.o

login
register
mail settings
Submitter Michael Tokarev
Date June 18, 2013, 5:34 p.m.
Message ID <1371576844-28743-5-git-send-email-mjt@msgid.tls.msk.ru>
Download mbox | patch
Permalink /patch/252393/
State New
Headers show

Comments

Michael Tokarev - June 18, 2013, 5:34 p.m.
We only need to link -lcurl into executables which actually
use/link curl.o, so make -lcurl object-specific library,
using curl.libs variable.

While at it, also use new curl.cflags variable to specify
curl-specific cflags, for symmetry with .libs, and move
whole declaration into the if..endif block where curl.o
is defined.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 block/Makefile.objs |    4 ++--
 configure           |    3 +--
 2 files changed, 3 insertions(+), 4 deletions(-)

Patch

diff --git a/block/Makefile.objs b/block/Makefile.objs
index 7b7189c..9dc54c9 100644
--- a/block/Makefile.objs
+++ b/block/Makefile.objs
@@ -13,6 +13,8 @@  ifeq ($(CONFIG_POSIX),y)
 block-obj-y += nbd.o sheepdog.o
 block-obj-$(CONFIG_LIBISCSI) += iscsi.o
 block-obj-$(CONFIG_CURL) += curl.o
+$(obj)curl.cflags = $(CURL_CFLAGS)
+$(obj)curl.libs = $(CURL_LIBS)
 block-obj-$(CONFIG_RBD) += rbd.o
 block-obj-$(CONFIG_GLUSTERFS) += gluster.o
 block-obj-$(CONFIG_LIBSSH2) += ssh.o
@@ -21,5 +23,3 @@  endif
 common-obj-y += stream.o
 common-obj-y += commit.o
 common-obj-y += mirror.o
-
-$(obj)curl.o: QEMU_CFLAGS+=$(CURL_CFLAGS)
diff --git a/configure b/configure
index ad32f87..fe6d8b1 100755
--- a/configure
+++ b/configure
@@ -2176,8 +2176,6 @@  EOF
   curl_libs=`$curlconfig --libs 2>/dev/null`
   if compile_prog "$curl_cflags" "$curl_libs" ; then
     curl=yes
-    libs_tools="$curl_libs $libs_tools"
-    libs_softmmu="$curl_libs $libs_softmmu"
   else
     if test "$curl" = "yes" ; then
       feature_not_found "curl"
@@ -3784,6 +3782,7 @@  fi
 if test "$curl" = "yes" ; then
   echo "CONFIG_CURL=y" >> $config_host_mak
   echo "CURL_CFLAGS=$curl_cflags" >> $config_host_mak
+  echo "CURL_LIBS=$curl_libs" >> $config_host_mak
 fi
 if test "$brlapi" = "yes" ; then
   echo "CONFIG_BRLAPI=y" >> $config_host_mak