From patchwork Thu Jul 12 19:26:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Weil X-Patchwork-Id: 943177 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=weilnetz.de 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 41RQt81yqVz9s0n for ; Fri, 13 Jul 2018 05:26:54 +1000 (AEST) Received: from localhost ([::1]:33656 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fdhEp-0002oY-GB for incoming@patchwork.ozlabs.org; Thu, 12 Jul 2018 15:26:51 -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) X-Virus-Scanned: Debian amavisd-new at v2201612906741603.powersrv.de 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) 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 -######################################### -# zlib check - -if test "$zlib" != "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="$LIBS -lz" - ########################################## # lzo check @@ -3525,6 +3508,29 @@ if ! compile_prog "$glib_cflags -Werror" "$glib_libs" ; then fi fi +######################################### +# zlib check + +if test "$zlib" != "no" ; then + if $pkg_config --exists zlib; then + zlib_cflags=$($pkg_config --cflags zlib) + zlib_libs=$($pkg_config --libs zlib) + QEMU_CFLAGS="$zlib_cflags $QEMU_CFLAGS" + LIBS="$zlib_libs $LIBS" + else + cat > $TMPC << EOF +#include +int main(void) { zlibVersion(); return 0; } +EOF + if compile_prog "" "-lz" ; then + LIBS="$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" = yes; then