qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] configure: fix curl installed in non-standard places
@ 2009-07-21 14:15 Nathan Froyd
  2009-07-22 15:51 ` Nathan Froyd
  0 siblings, 1 reply; 2+ messages in thread
From: Nathan Froyd @ 2009-07-21 14:15 UTC (permalink / raw)
  To: qemu-devel

configure helpfully uses curl-config to figure out appropriate -L and -l
options for the compiler, but fails to check for any necessary -I
options.  If, perchance, you are using a compiler whose #include paths
have an older version of curl.h lying about, but have a newer version of
curl installed locally (say, $HOME), the small test program in configure
will succeed (with a warning, possibly).  But the compilation of
block/curl.c will fail because curl.c requires more up-to-date features.

To avoid this, grab --cflags from curl-config too.  It's not completely
foolproof (the test in configure should really be checking for all the
features that block/curl.c uses or block/curl.c should gracefully
cooperate with older versions), but it's more correct than what we have.
---
 Makefile  |    1 +
 configure |    4 +++-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index dc95869..9899651 100644
--- a/Makefile
+++ b/Makefile
@@ -175,6 +175,7 @@ LIBS+=$(VDE_LIBS)
 obj-$(CONFIG_XEN) += xen_backend.o xen_devconfig.o
 obj-$(CONFIG_XEN) += xen_console.o xenfb.o xen_disk.o xen_nic.o
 
+CPPFLAGS+=$(CURL_INCLUDES)
 LIBS+=$(CURL_LIBS)
 
 cocoa.o: cocoa.m
diff --git a/configure b/configure
index 0db885b..0f60328 100755
--- a/configure
+++ b/configure
@@ -1126,8 +1126,9 @@ if test "$curl" = "yes" ; then
 #include <curl/curl.h>
 int main(void) { return curl_easy_init(); }
 EOF
+  curl_includes=`curl-config --cflags 2>/dev/null`
   curl_libs=`curl-config --libs 2>/dev/null`
- if $cc $ARCH_CFLAGS $curl_libs -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
+ if $cc $ARCH_CFLAGS $curl_includes $curl_libs -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
     curl=yes
   fi
 fi # test "$curl"
@@ -1720,6 +1721,7 @@ if test "$inotify" = "yes" ; then
 fi
 if test "$curl" = "yes" ; then
   echo "CONFIG_CURL=y" >> $config_host_mak
+  echo "CURL_INCLUDES=$curl_includes" >> $config_host_mak
   echo "CURL_LIBS=$curl_libs" >> $config_host_mak
   echo "#define CONFIG_CURL 1" >> $config_host_h
 fi
-- 
1.6.2.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] configure: fix curl installed in non-standard places
  2009-07-21 14:15 [Qemu-devel] [PATCH] configure: fix curl installed in non-standard places Nathan Froyd
@ 2009-07-22 15:51 ` Nathan Froyd
  0 siblings, 0 replies; 2+ messages in thread
From: Nathan Froyd @ 2009-07-22 15:51 UTC (permalink / raw)
  To: qemu-devel

>From 553fc5fc9debd5a7c375e1160a22a3a93e21e36c Mon Sep 17 00:00:00 2001
From: Nathan Froyd <froydnj@codesourcery.com>
Date: Tue, 21 Jul 2009 06:39:07 -0700
Subject: [PATCH] configure: fix curl installed in non-standard places

configure helpfully uses curl-config to figure out appropriate -L and -l
options for the compiler, but fails to check for any necessary -I
options.  If, perchance, you are using a compiler whose #include paths
have an older version of curl.h lying about, but have a newer version of
curl installed locally (say, $HOME), the small test program in configure
will succeed (with a warning, possibly).  But the compilation of
block/curl.c will fail because curl.c requires more up-to-date features.

To avoid this, grab --cflags from curl-config too.  It's not completely
foolproof (the test in configure should really be checking for all the
features that block/curl.c uses or block/curl.c should gracefully
cooperate with older versions), but it's more correct than what we have.

Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
---
 Makefile  |    1 +
 configure |    4 +++-
 2 files changed, 4 insertions(+), 1 deletions(-)

[...thought format.signoff would work in all cases, but apparently not...]

diff --git a/Makefile b/Makefile
index dc95869..9899651 100644
--- a/Makefile
+++ b/Makefile
@@ -175,6 +175,7 @@ LIBS+=$(VDE_LIBS)
 obj-$(CONFIG_XEN) += xen_backend.o xen_devconfig.o
 obj-$(CONFIG_XEN) += xen_console.o xenfb.o xen_disk.o xen_nic.o
 
+CPPFLAGS+=$(CURL_INCLUDES)
 LIBS+=$(CURL_LIBS)
 
 cocoa.o: cocoa.m
diff --git a/configure b/configure
index 0db885b..0f60328 100755
--- a/configure
+++ b/configure
@@ -1126,8 +1126,9 @@ if test "$curl" = "yes" ; then
 #include <curl/curl.h>
 int main(void) { return curl_easy_init(); }
 EOF
+  curl_includes=`curl-config --cflags 2>/dev/null`
   curl_libs=`curl-config --libs 2>/dev/null`
- if $cc $ARCH_CFLAGS $curl_libs -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
+ if $cc $ARCH_CFLAGS $curl_includes $curl_libs -o $TMPE $TMPC > /dev/null 2> /dev/null ; then
     curl=yes
   fi
 fi # test "$curl"
@@ -1720,6 +1721,7 @@ if test "$inotify" = "yes" ; then
 fi
 if test "$curl" = "yes" ; then
   echo "CONFIG_CURL=y" >> $config_host_mak
+  echo "CURL_INCLUDES=$curl_includes" >> $config_host_mak
   echo "CURL_LIBS=$curl_libs" >> $config_host_mak
   echo "#define CONFIG_CURL 1" >> $config_host_h
 fi
-- 
1.6.2.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-07-22 15:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-21 14:15 [Qemu-devel] [PATCH] configure: fix curl installed in non-standard places Nathan Froyd
2009-07-22 15:51 ` Nathan Froyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).