From nobody Tue Nov 4 21:45:04 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.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 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 153142366692641.28917525744271; Thu, 12 Jul 2018 12:27:46 -0700 (PDT) Received: from localhost ([::1]:33660 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fdhFc-0003i4-7g for importer@patchew.org; Thu, 12 Jul 2018 15:27:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42802) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fdhEH-0002lo-9I for qemu-devel@nongnu.org; Thu, 12 Jul 2018 15:26:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fdhEC-0003kw-8Z for qemu-devel@nongnu.org; Thu, 12 Jul 2018 15:26:17 -0400 Received: from mail.weilnetz.de ([37.120.169.71]:38512 helo=v2201612906741603.powersrv.de) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fdhEC-0003hV-0y; Thu, 12 Jul 2018 15:26:12 -0400 Received: from localhost (localhost [127.0.0.1]) by v2201612906741603.powersrv.de (Postfix) with ESMTP id C8355DADA94; Thu, 12 Jul 2018 21:26:08 +0200 (CEST) Received: from v2201612906741603.powersrv.de ([127.0.0.1]) by localhost (v2201612906741603.powersrv.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id U36jjJ-yr9cK; Thu, 12 Jul 2018 21:26:07 +0200 (CEST) Received: from qemu.weilnetz.de (qemu.weilnetz.de [188.68.58.204]) by v2201612906741603.powersrv.de (Postfix) with ESMTP id AD473DAD85E; Thu, 12 Jul 2018 21:26:07 +0200 (CEST) Received: by qemu.weilnetz.de (Postfix, from userid 1000) id 09B8E4606D3; Thu, 12 Jul 2018 21:26:06 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at v2201612906741603.powersrv.de From: Stefan Weil To: QEMU Developer Date: Thu, 12 Jul 2018 21:26:03 +0200 Message-Id: <20180712192603.11599-1-sw@weilnetz.de> X-Mailer: git-send-email 2.11.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 37.120.169.71 Subject: [Qemu-devel] [PATCH] configure: Support pkg-config for zlib 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: , Cc: QEMU Trivial , Stefan Weil Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This is needed for builds with the mingw64-* packages from Cygwin, but also works for Linux. Move the zlib test also more to the end because users should get information on the really important missing packages (which also require zlib) first. Signed-off-by: Stefan Weil Reviewed-by: Stefan Hajnoczi --- configure | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/configure b/configure index 2a7796ea80..dcaab01729 100755 --- a/configure +++ b/configure @@ -2140,23 +2140,6 @@ EOF fi fi =20 -######################################### -# zlib check - -if test "$zlib" !=3D "no" ; then - cat > $TMPC << EOF -#include -int main(void) { zlibVersion(); return 0; } -EOF - if compile_prog "" "-lz" ; then - : - else - error_exit "zlib check failed" \ - "Make sure to have the zlib libs and headers installed." - fi -fi -LIBS=3D"$LIBS -lz" - ########################################## # lzo check =20 @@ -3525,6 +3508,29 @@ if ! compile_prog "$glib_cflags -Werror" "$glib_libs= " ; then fi fi =20 +######################################### +# zlib check + +if test "$zlib" !=3D "no" ; then + if $pkg_config --exists zlib; then + zlib_cflags=3D$($pkg_config --cflags zlib) + zlib_libs=3D$($pkg_config --libs zlib) + QEMU_CFLAGS=3D"$zlib_cflags $QEMU_CFLAGS" + LIBS=3D"$zlib_libs $LIBS" + else + cat > $TMPC << EOF +#include +int main(void) { zlibVersion(); return 0; } +EOF + if compile_prog "" "-lz" ; then + LIBS=3D"$LIBS -lz" + else + error_exit "zlib check failed" \ + "Make sure to have the zlib libs and headers installed." + fi + fi +fi + ########################################## # SHA command probe for modules if test "$modules" =3D yes; then --=20 2.11.0