From nobody Tue Apr 30 16:35:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1567076566; cv=none; d=zoho.com; s=zohoarc; b=R4/yO43cG5C6TWOJuIMOrfCq3IbMPfWFvnKuCJFGwyjOUXtEKUAGGNUQClo38J8bHKKyf3p653gscaezjgtbz1Zoti55HtSTPfTueJdx+oWA7a9qAH+ebsLSmXo6lIOoV1SnJlubT2Zxa+F+3RvfkufCIEsIg+2RXBcF/PpUhoo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567076566; h=Content-Type:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=7Y1zijdDnACU/SVpqK1Z4DzV3FbUqZpZh5Jn/IngcrU=; b=ELen5FQ9Go8nRCcVUTJhrFo0QnjbpnT3dXEmniupX0osXD8oouBhztXdOBIvsBLQdmd2lmEcVaUu7howFE4Xw38ZQBN4iJy90Vqvz32FkwLZq/muPRuRwkunZqQJpnzGfKU2jdr0FExN07iWYM7H0fJYyqnZRfA9frJaH1dHXgA= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1567076566820696.1837459909136; Thu, 29 Aug 2019 04:02:46 -0700 (PDT) Received: from localhost ([::1]:48174 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i3ICO-0003Y3-2C for importer@patchew.org; Thu, 29 Aug 2019 07:02:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52759) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i3IAC-0001a5-KR for qemu-devel@nongnu.org; Thu, 29 Aug 2019 07:00:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i3IAA-0004XZ-Qd for qemu-devel@nongnu.org; Thu, 29 Aug 2019 07:00:24 -0400 Received: from mail1.windriver.com ([147.11.146.13]:62681) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i3IA8-0004Uq-M3 for qemu-devel@nongnu.org; Thu, 29 Aug 2019 07:00:22 -0400 Received: from ALA-HCA.corp.ad.wrs.com ([147.11.189.40]) by mail1.windriver.com (8.15.2/8.15.1) with ESMTPS id x7T8q3l8015075 (version=TLSv1 cipher=AES128-SHA bits=128 verify=FAIL); Thu, 29 Aug 2019 01:52:03 -0700 (PDT) Received: from pek-lpg-core2.corp.ad.wrs.com (128.224.153.41) by ALA-HCA.corp.ad.wrs.com (147.11.189.40) with Microsoft SMTP Server id 14.3.468.0; Thu, 29 Aug 2019 01:52:02 -0700 From: To: , , , , , , Date: Thu, 29 Aug 2019 16:51:59 +0800 Message-ID: <1567068719-359846-1-git-send-email-zhe.he@windriver.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 147.11.146.13 Subject: [Qemu-devel] [PATCH] configure: Add pkg-config handling for libgcrypt X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: He Zhe libgcrypt may also be controlled by pkg-config, this patch adds pkg-config handling for libgcrypt. Signed-off-by: He Zhe --- configure | 48 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/configure b/configure index e44e454..0f362a7 100755 --- a/configure +++ b/configure @@ -2875,6 +2875,30 @@ has_libgcrypt() { return 0 } =20 +has_libgcrypt_pkgconfig() { + if ! has $pkg_config ; then + return 1 + fi + + if ! $pkg_config --list-all | grep libgcrypt > /dev/null 2>&1 ; then + return 1 + fi + + if test -n "$cross_prefix" ; then + host=3D$($pkg_config --variable=3Dhost libgcrypt) + if test "${host%-gnu}-" !=3D "${cross_prefix%-gnu}" ; then + print_error "host($host) does not match cross_prefix($cross_pr= efix)" + return 1 + fi + fi + + if ! $pkg_config --atleast-version=3D1.5.0 libgcrypt ; then + print_error "libgcrypt version is $($pkg_config --modversion libgc= rypt)" + return 1 + fi + + return 0 +} =20 if test "$nettle" !=3D "no"; then pass=3D"no" @@ -2902,7 +2926,14 @@ fi =20 if test "$gcrypt" !=3D "no"; then pass=3D"no" - if has_libgcrypt; then + if has_libgcrypt_pkgconfig; then + gcrypt_cflags=3D$($pkg_config --cflags libgcrypt) + if test "$static" =3D "yes" ; then + gcrypt_libs=3D$($pkg_config --libs --static libgcrypt) + else + gcrypt_libs=3D$($pkg_config --libs libgcrypt) + fi + elif has_libgcrypt; then gcrypt_cflags=3D$(libgcrypt-config --cflags) gcrypt_libs=3D$(libgcrypt-config --libs) # Debian has removed -lgpg-error from libgcrypt-config @@ -2912,15 +2943,16 @@ if test "$gcrypt" !=3D "no"; then then gcrypt_libs=3D"$gcrypt_libs -lgpg-error" fi + fi =20 - # Link test to make sure the given libraries work (e.g for static). - write_c_skeleton - if compile_prog "" "$gcrypt_libs" ; then - LIBS=3D"$gcrypt_libs $LIBS" - QEMU_CFLAGS=3D"$QEMU_CFLAGS $gcrypt_cflags" - pass=3D"yes" - fi + # Link test to make sure the given libraries work (e.g for static). + write_c_skeleton + if compile_prog "" "$gcrypt_libs" ; then + LIBS=3D"$gcrypt_libs $LIBS" + QEMU_CFLAGS=3D"$QEMU_CFLAGS $gcrypt_cflags" + pass=3D"yes" fi + if test "$pass" =3D "yes"; then gcrypt=3D"yes" cat > $TMPC << EOF --=20 2.7.4