Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 1EB2B431FC0 for ; Sat, 10 May 2014 00:58:28 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4HIYIr3PEWeL for ; Sat, 10 May 2014 00:58:20 -0700 (PDT) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by olra.theworths.org (Postfix) with ESMTP id 8B04A431FBF for ; Sat, 10 May 2014 00:58:20 -0700 (PDT) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id B71B51000E5; Sat, 10 May 2014 10:58:12 +0300 (EEST) From: Tomi Ollila To: =?utf-8?B?WMSrY8Oy?= , notmuch@notmuchmail.org Subject: Re: [PATCH] Fallback check for zlib. In-Reply-To: <1399700023-8041-2-git-send-email-xico@atelo.org> References: <874n0y5qo5.fsf@maritornes.cs.unb.ca> <1399700023-8041-1-git-send-email-xico@atelo.org> <1399700023-8041-2-git-send-email-xico@atelo.org> User-Agent: Notmuch/0.18+11~gbc95cc5 (http://notmuchmail.org) Emacs/24.3.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 May 2014 07:58:28 -0000 On Sat, May 10 2014, X=C4=ABc=C3=B2 wrote: > --- I must say I like the patch. One thing I would change: + return (ZLIB_VERNUM) < (MINVER) || zlibVersion()[0] !=3D (ZLIB_VERSION= )[0]; i.e. short-circuiting potential failure before executing zlibVersion()... (parenthesising macros is just extra fanciness I thought just before sending this email ;D) Tomi > compat/have_zlib.c | 6 ++++++ > configure | 21 ++++++++++++++++----- > 2 files changed, 22 insertions(+), 5 deletions(-) > create mode 100644 compat/have_zlib.c > > diff --git a/compat/have_zlib.c b/compat/have_zlib.c > new file mode 100644 > index 0000000..998c697 > --- /dev/null > +++ b/compat/have_zlib.c > @@ -0,0 +1,6 @@ > +#include > + > +int main(void) > +{ > + return zlibVersion()[0] !=3D ZLIB_VERSION[0] || ZLIB_VERNUM < MINVER; > +} > diff --git a/configure b/configure > index 9bde2eb..7a11ded 100755 > --- a/configure > +++ b/configure > @@ -340,16 +340,27 @@ else > errors=3D$((errors + 1)) > fi >=20=20 > -printf "Checking for zlib (>=3D 1.2.5.2)... " > +zv1=3D1 zv2=3D2 zv3=3D5 zv4=3D1 > +printf "Checking for zlib (>=3D $zv1.$zv2.$zv3.$zv4)... " > have_zlib=3D0 > -if pkg-config --atleast-version=3D1.2.5.2 zlib; then > +if pkg-config --atleast-version=3D$zv1.$zv2.$zv3.$zv4 zlib; then > printf "Yes.\n" > have_zlib=3D1 > zlib_cflags=3D$(pkg-config --cflags zlib) > zlib_ldflags=3D$(pkg-config --libs zlib) > else > - printf "No.\n" > - errors=3D$((errors + 1)) > + # Try finding zlib directly (e.g. on FreeBSD) > + zlib_cflags=3D > + zlib_ldflags=3D-lz > + if ${CC} ${zlib_cflags} -DMINVER=3D0x$zv1$zv2$zv3$zv4 -o compat/have= _zlib "$srcdir"/compat/have_zlib.c ${zlib_ldflags} > /dev/null 2>&1 && ./co= mpat/have_zlib > + then > + printf "Yes.\n" > + have_zlib=3D1 > + else > + printf "No.\n" > + errors=3D$((errors + 1)) > + fi > + rm -f compat/have_zlib > fi >=20=20 > printf "Checking for talloc development files... " > @@ -509,7 +520,7 @@ EOF > echo " http://xapian.org/" > fi > if [ $have_zlib -eq 0 ]; then > - echo " zlib library (>=3D version 1.2.5.2, including development files = such as headers)" > + echo " zlib library (>=3D version $zv1.$zv2.$zv3.$zv4, including develo= pment files such as headers)" > echo " http://zlib.net/" > echo > fi > --=20 > 1.9.2