From patchwork Fri Jul 24 17:28:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 499821 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 99F881402ED for ; Sat, 25 Jul 2015 03:28:29 +1000 (AEST) Received: from localhost ([::1]:46180 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIglm-0000uA-Uw for incoming@patchwork.ozlabs.org; Fri, 24 Jul 2015 13:28:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35270) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIglX-0000ce-NZ for qemu-devel@nongnu.org; Fri, 24 Jul 2015 13:28:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZIglW-0008Rz-Re for qemu-devel@nongnu.org; Fri, 24 Jul 2015 13:28:11 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:34750) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZIglW-0008RJ-KD for qemu-devel@nongnu.org; Fri, 24 Jul 2015 13:28:10 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1ZIglU-0005r9-2A; Fri, 24 Jul 2015 18:28:08 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 24 Jul 2015 18:28:08 +0100 Message-Id: <1437758888-22486-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Cc: Paolo Bonzini , patches@linaro.org Subject: [Qemu-devel] [PATCH] configure: Work around broken static pkg-config info for Ubuntu gnutls X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 Reviewed-by: Daniel P. Berrange --- 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"