From patchwork Fri May 10 17:30:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 10939291 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 019A81390 for ; Fri, 10 May 2019 17:32:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB43F28CA1 for ; Fri, 10 May 2019 17:32:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CF6F828CA3; Fri, 10 May 2019 17:32:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 50A0528CA1 for ; Fri, 10 May 2019 17:32:42 +0000 (UTC) Received: from localhost ([127.0.0.1]:47492 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP9Nx-0000L8-Jc for patchwork-qemu-devel@patchwork.kernel.org; Fri, 10 May 2019 13:32:41 -0400 Received: from eggs.gnu.org ([209.51.188.92]:58951) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hP9MF-0007IC-Ci for qemu-devel@nongnu.org; Fri, 10 May 2019 13:30:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hP9ME-0005y4-3Y for qemu-devel@nongnu.org; Fri, 10 May 2019 13:30:55 -0400 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]:42598) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hP9MD-0005xX-Tu for qemu-devel@nongnu.org; Fri, 10 May 2019 13:30:54 -0400 Received: by mail-pl1-x642.google.com with SMTP id x15so3127194pln.9 for ; Fri, 10 May 2019 10:30:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=p3cfnV5JbT6H/nwjKGY4Kezh5D3MhbPkpcQaspyBazo=; b=Xv1QtOJyGKmPVc5wOfKNqKuFiKfEoYGPwYdml96HohiJdk/ZKN2BjqJn2iT3b52BYg jADBwofGV5ksLI6TP4E1x1osCpftbDAX7ld9yK2znpfGwI+nvoXJm56iMcezni1w4zJE SFhtsHob0ooKXnH2uR5p0vb1G/NhtOXgk8WW044lvQOyRvQDdrsz65heiQIf2nHpKhD3 tPKfzQZdRs6PBiPHb/755Pn5GGw9Mt1zVv/eYrgw+jTBnjw7I10U5M+xIc0X5ItoCMET h8H62b0S2Z1D5QdqMCfxdbZEZhvPqzeA92urnqUmBxLI7JbDJbRnkUXLIwOfmFyWbTf7 CzXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=p3cfnV5JbT6H/nwjKGY4Kezh5D3MhbPkpcQaspyBazo=; b=bvbMwOn9ZQHIak3ZEmsrTBkdnD2kQp/FtCBcmW7JfKAD8YQmixvwyNuReUsG1KXfWL hifDG73xXeRksOXlZwBgpsWem2YNFnTDA38nk8Bwd2HURGz1eOdlQJI3uvDsPx1nFWm2 EhPDZzB4Eul+bAdeFG2BJqS7fd1j5WQAG0KBFquen34VfzVKzuPNwgr11+YHUpshbR3W eCwm9PU8o2f5tqLwl1SgQlAx5jPRtR8WAqK/mX5YqEExZKknugvSnBj3HZS74ljTrsAy mx11ZzOzk5TjoWfH8cL/jQ8lsiubHsKP00Wj9mqH5kHOgmNU+U0ptutj7j0pjHUXcS5h oZRw== X-Gm-Message-State: APjAAAVFNK79vo9+ahMuX7m5f+l26fiUPVAQDsTRYGftciYA3B5vJ9lJ SPKp+T0+bZ5UV90+W1MmcE8nkK2Ufh0= X-Google-Smtp-Source: APXvYqxTle9LPl167Ulwvb+qVEJxdh+zzfKwzOJoX+rSmbg/kXuC3A08qSrRUo4O5pifru1GEh6IGg== X-Received: by 2002:a17:902:263:: with SMTP id 90mr14917245plc.257.1557509452590; Fri, 10 May 2019 10:30:52 -0700 (PDT) Received: from localhost.localdomain (97-113-13-231.tukw.qwest.net. [97.113.13.231]) by smtp.gmail.com with ESMTPSA id v64sm7936792pfv.106.2019.05.10.10.30.51 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 May 2019 10:30:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 10 May 2019 10:30:25 -0700 Message-Id: <20190510173049.28171-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190510173049.28171-1-richard.henderson@linaro.org> References: <20190510173049.28171-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::642 Subject: [Qemu-devel] [PATCH v6 01/25] configure: Link test before auto-enabling crypto libraries X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP At least ubuntu 18.04 does not package static gnutls libraries. At least Fedora 30 does not ship static nettle and gcrypt libraries. Tested-by: Laurent Vivier Reviewed-by: Laurent Vivier Reviewed-by: Daniel P. Berrangé Signed-off-by: Richard Henderson --- v5: Include nettle, gcrypt. --- configure | 72 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 44 insertions(+), 28 deletions(-) diff --git a/configure b/configure index 63f312bd1f..c4f27ed453 100755 --- a/configure +++ b/configure @@ -2784,17 +2784,24 @@ fi # GNUTLS probe if test "$gnutls" != "no"; then + pass="no" if $pkg_config --exists "gnutls >= 3.1.18"; then gnutls_cflags=$($pkg_config --cflags gnutls) gnutls_libs=$($pkg_config --libs gnutls) - libs_softmmu="$gnutls_libs $libs_softmmu" - libs_tools="$gnutls_libs $libs_tools" - QEMU_CFLAGS="$QEMU_CFLAGS $gnutls_cflags" - gnutls="yes" - elif test "$gnutls" = "yes"; then + # Packaging for the static libraries is not always correct. + # At least ubuntu 18.04 ships only shared libraries. + write_c_skeleton + if compile_prog "" "$gnutls_libs" ; then + libs_softmmu="$gnutls_libs $libs_softmmu" + libs_tools="$gnutls_libs $libs_tools" + QEMU_CFLAGS="$QEMU_CFLAGS $gnutls_cflags" + pass="yes" + fi + fi + if test "$pass" = "no" && test "$gnutls" = "yes"; then feature_not_found "gnutls" "Install gnutls devel >= 3.1.18" else - gnutls="no" + gnutls="$pass" fi fi @@ -2849,43 +2856,54 @@ has_libgcrypt() { if test "$nettle" != "no"; then + pass="no" if $pkg_config --exists "nettle >= 2.7.1"; then nettle_cflags=$($pkg_config --cflags nettle) nettle_libs=$($pkg_config --libs nettle) nettle_version=$($pkg_config --modversion nettle) - libs_softmmu="$nettle_libs $libs_softmmu" - libs_tools="$nettle_libs $libs_tools" - QEMU_CFLAGS="$QEMU_CFLAGS $nettle_cflags" - nettle="yes" - - if test -z "$gcrypt"; then - gcrypt="no" + # Link test to make sure the given libraries work (e.g for static). + write_c_skeleton + if compile_prog "" "$nettle_libs" ; then + libs_softmmu="$nettle_libs $libs_softmmu" + libs_tools="$nettle_libs $libs_tools" + QEMU_CFLAGS="$QEMU_CFLAGS $nettle_cflags" + if test -z "$gcrypt"; then + gcrypt="no" + fi + pass="yes" fi + fi + if test "$pass" = "no" && test "$nettle" = "yes"; then + feature_not_found "nettle" "Install nettle devel >= 2.7.1" else - if test "$nettle" = "yes"; then - feature_not_found "nettle" "Install nettle devel >= 2.7.1" - else - nettle="no" - fi + nettle="$pass" fi fi if test "$gcrypt" != "no"; then + pass="no" if has_libgcrypt; then gcrypt_cflags=$(libgcrypt-config --cflags) gcrypt_libs=$(libgcrypt-config --libs) - # Debian has remove -lgpg-error from libgcrypt-config + # Debian has removed -lgpg-error from libgcrypt-config # as it "spreads unnecessary dependencies" which in # turn breaks static builds... if test "$static" = "yes" then gcrypt_libs="$gcrypt_libs -lgpg-error" fi - libs_softmmu="$gcrypt_libs $libs_softmmu" - libs_tools="$gcrypt_libs $libs_tools" - QEMU_CFLAGS="$QEMU_CFLAGS $gcrypt_cflags" - gcrypt="yes" + # Link test to make sure the given libraries work (e.g for static). + write_c_skeleton + if compile_prog "" "$gcrypt_libs" ; then + libs_softmmu="$gcrypt_libs $libs_softmmu" + libs_tools="$gcrypt_libs $libs_tools" + QEMU_CFLAGS="$QEMU_CFLAGS $gcrypt_cflags" + pass="yes" + fi + fi + if test "$pass" = "yes"; then + gcrypt="yes" cat > $TMPC << EOF #include int main(void) { @@ -2898,12 +2916,10 @@ EOF if compile_prog "$gcrypt_cflags" "$gcrypt_libs" ; then gcrypt_hmac=yes fi + elif test "$gcrypt" = "yes"; then + feature_not_found "gcrypt" "Install gcrypt devel >= 1.5.0" else - if test "$gcrypt" = "yes"; then - feature_not_found "gcrypt" "Install gcrypt devel >= 1.5.0" - else - gcrypt="no" - fi + gcrypt="no" fi fi