qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] configure: Work around broken static pkg-config info for Ubuntu gnutls
@ 2015-07-24 17:28 Peter Maydell
  2015-07-24 17:35 ` Daniel P. Berrange
  0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2015-07-24 17:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, patches

Unfortunately Ubuntu's pkg-config information for gnutls is broken
for the static linking case, and outputs --libs options which the
compiler does not recognize. Work around this problem by testing
that the --cflags/--libs output will at least allow compilation
before enabling gnutls support.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 configure | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index cc0338d..704b34c 100755
--- a/configure
+++ b/configure
@@ -2116,10 +2116,26 @@ fi
 ##########################################
 # GNUTLS probe
 
+gnutls_works() {
+    # Unfortunately some distros have bad pkg-config information for gnutls
+    # such that it claims to exist but you get a compiler error if you try
+    # to use the options returned by --libs. Specifically, Ubuntu for --static
+    # builds doesn't work:
+    # https://bugs.launchpad.net/ubuntu/+source/gnutls26/+bug/1478035
+    #
+    # So sanity check the cflags/libs before assuming gnutls can be used.
+    if ! $pkg_config --exists "gnutls"; then
+        return 1
+    fi
+
+    write_c_skeleton
+    compile_prog "$($pkg_config --cflags gnutls)" "$($pkg_config --libs gnutls)"
+}
+
 gnutls_gcrypt=no
 gnutls_nettle=no
 if test "$gnutls" != "no"; then
-    if $pkg_config --exists "gnutls"; then
+    if gnutls_works; then
         gnutls_cflags=`$pkg_config --cflags gnutls`
         gnutls_libs=`$pkg_config --libs gnutls`
         libs_softmmu="$gnutls_libs $libs_softmmu"
-- 
1.9.1

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

* Re: [Qemu-devel] [PATCH] configure: Work around broken static pkg-config info for Ubuntu gnutls
  2015-07-24 17:28 [Qemu-devel] [PATCH] configure: Work around broken static pkg-config info for Ubuntu gnutls Peter Maydell
@ 2015-07-24 17:35 ` Daniel P. Berrange
  2015-07-27 16:09   ` Peter Maydell
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel P. Berrange @ 2015-07-24 17:35 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Paolo Bonzini, qemu-devel, patches

On Fri, Jul 24, 2015 at 06:28:08PM +0100, Peter Maydell wrote:
> Unfortunately Ubuntu's pkg-config information for gnutls is broken
> for the static linking case, and outputs --libs options which the
> compiler does not recognize. Work around this problem by testing
> that the --cflags/--libs output will at least allow compilation
> before enabling gnutls support.
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Reviewed-by: Daniel P. Berrange <berrange@redhat.com>

Looks like a reasonable approach to me.

> ---
>  configure | 18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index cc0338d..704b34c 100755
> --- a/configure
> +++ b/configure
> @@ -2116,10 +2116,26 @@ fi
>  ##########################################
>  # GNUTLS probe
>  
> +gnutls_works() {
> +    # Unfortunately some distros have bad pkg-config information for gnutls
> +    # such that it claims to exist but you get a compiler error if you try
> +    # to use the options returned by --libs. Specifically, Ubuntu for --static
> +    # builds doesn't work:
> +    # https://bugs.launchpad.net/ubuntu/+source/gnutls26/+bug/1478035
> +    #
> +    # So sanity check the cflags/libs before assuming gnutls can be used.
> +    if ! $pkg_config --exists "gnutls"; then
> +        return 1
> +    fi
> +
> +    write_c_skeleton
> +    compile_prog "$($pkg_config --cflags gnutls)" "$($pkg_config --libs gnutls)"
> +}
> +
>  gnutls_gcrypt=no
>  gnutls_nettle=no
>  if test "$gnutls" != "no"; then
> -    if $pkg_config --exists "gnutls"; then
> +    if gnutls_works; then
>          gnutls_cflags=`$pkg_config --cflags gnutls`
>          gnutls_libs=`$pkg_config --libs gnutls`
>          libs_softmmu="$gnutls_libs $libs_softmmu"

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

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

* Re: [Qemu-devel] [PATCH] configure: Work around broken static pkg-config info for Ubuntu gnutls
  2015-07-24 17:35 ` Daniel P. Berrange
@ 2015-07-27 16:09   ` Peter Maydell
  0 siblings, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2015-07-27 16:09 UTC (permalink / raw)
  To: Daniel P. Berrange; +Cc: Paolo Bonzini, QEMU Developers, Patch Tracking

On 24 July 2015 at 18:35, Daniel P. Berrange <berrange@redhat.com> wrote:
> On Fri, Jul 24, 2015 at 06:28:08PM +0100, Peter Maydell wrote:
>> Unfortunately Ubuntu's pkg-config information for gnutls is broken
>> for the static linking case, and outputs --libs options which the
>> compiler does not recognize. Work around this problem by testing
>> that the --cflags/--libs output will at least allow compilation
>> before enabling gnutls support.
>>
>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>
> Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
>
> Looks like a reasonable approach to me.

Applied to master, thanks.

-- PMM

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

end of thread, other threads:[~2015-07-27 16:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-24 17:28 [Qemu-devel] [PATCH] configure: Work around broken static pkg-config info for Ubuntu gnutls Peter Maydell
2015-07-24 17:35 ` Daniel P. Berrange
2015-07-27 16:09   ` Peter Maydell

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).