Re: [PATCH v4 02/16] Move crypto.c into libutil
[notmuch-archives.git] / 58 / 7f1b459ef00abfa2d85b159bfaf26e1054ea95
1 Return-Path: <tomi.ollila@iki.fi>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 1EB2B431FC0\r
6         for <notmuch@notmuchmail.org>; Sat, 10 May 2014 00:58:28 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id 4HIYIr3PEWeL for <notmuch@notmuchmail.org>;\r
16         Sat, 10 May 2014 00:58:20 -0700 (PDT)\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
18         by olra.theworths.org (Postfix) with ESMTP id 8B04A431FBF\r
19         for <notmuch@notmuchmail.org>; Sat, 10 May 2014 00:58:20 -0700 (PDT)\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
21         by guru.guru-group.fi (Postfix) with ESMTP id B71B51000E5;\r
22         Sat, 10 May 2014 10:58:12 +0300 (EEST)\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>\r
24 To: =?utf-8?B?WMSrY8Oy?= <xico@atelo.org>, notmuch@notmuchmail.org\r
25 Subject: Re: [PATCH] Fallback check for zlib.\r
26 In-Reply-To: <1399700023-8041-2-git-send-email-xico@atelo.org>\r
27 References: <874n0y5qo5.fsf@maritornes.cs.unb.ca>\r
28         <1399700023-8041-1-git-send-email-xico@atelo.org>\r
29         <1399700023-8041-2-git-send-email-xico@atelo.org>\r
30 User-Agent: Notmuch/0.18+11~gbc95cc5 (http://notmuchmail.org) Emacs/24.3.1\r
31         (x86_64-unknown-linux-gnu)\r
32 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
33         $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
34         !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
35 Date: Sat, 10 May 2014 10:58:12 +0300\r
36 Message-ID: <m2r442gj57.fsf@guru.guru-group.fi>\r
37 MIME-Version: 1.0\r
38 Content-Type: text/plain; charset=utf-8\r
39 Content-Transfer-Encoding: quoted-printable\r
40 X-BeenThere: notmuch@notmuchmail.org\r
41 X-Mailman-Version: 2.1.13\r
42 Precedence: list\r
43 List-Id: "Use and development of the notmuch mail system."\r
44         <notmuch.notmuchmail.org>\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
46         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
48 List-Post: <mailto:notmuch@notmuchmail.org>\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
51         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
52 X-List-Received-Date: Sat, 10 May 2014 07:58:28 -0000\r
53 \r
54 On Sat, May 10 2014, X=C4=ABc=C3=B2 <xico@atelo.org> wrote:\r
55 \r
56 > ---\r
57 \r
58 I must say I like the patch. One thing I would change:\r
59 \r
60 +    return (ZLIB_VERNUM) < (MINVER) || zlibVersion()[0] !=3D (ZLIB_VERSION=\r
61 )[0];\r
62 \r
63 i.e. short-circuiting potential failure before executing zlibVersion()...\r
64 \r
65 (parenthesising macros is just extra fanciness I thought just before\r
66 sending this email ;D)\r
67 \r
68 Tomi\r
69 \r
70 >  compat/have_zlib.c |  6 ++++++\r
71 >  configure          | 21 ++++++++++++++++-----\r
72 >  2 files changed, 22 insertions(+), 5 deletions(-)\r
73 >  create mode 100644 compat/have_zlib.c\r
74 >\r
75 > diff --git a/compat/have_zlib.c b/compat/have_zlib.c\r
76 > new file mode 100644\r
77 > index 0000000..998c697\r
78 > --- /dev/null\r
79 > +++ b/compat/have_zlib.c\r
80 > @@ -0,0 +1,6 @@\r
81 > +#include <zlib.h>\r
82 > +\r
83 > +int main(void)\r
84 > +{\r
85 > +    return zlibVersion()[0] !=3D ZLIB_VERSION[0] || ZLIB_VERNUM < MINVER;\r
86 > +}\r
87 > diff --git a/configure b/configure\r
88 > index 9bde2eb..7a11ded 100755\r
89 > --- a/configure\r
90 > +++ b/configure\r
91 > @@ -340,16 +340,27 @@ else\r
92 >      errors=3D$((errors + 1))\r
93 >  fi\r
94 >=20=20\r
95 > -printf "Checking for zlib (>=3D 1.2.5.2)... "\r
96 > +zv1=3D1 zv2=3D2 zv3=3D5 zv4=3D1\r
97 > +printf "Checking for zlib (>=3D $zv1.$zv2.$zv3.$zv4)... "\r
98 >  have_zlib=3D0\r
99 > -if pkg-config --atleast-version=3D1.2.5.2 zlib; then\r
100 > +if pkg-config --atleast-version=3D$zv1.$zv2.$zv3.$zv4 zlib; then\r
101 >      printf "Yes.\n"\r
102 >      have_zlib=3D1\r
103 >      zlib_cflags=3D$(pkg-config --cflags zlib)\r
104 >      zlib_ldflags=3D$(pkg-config --libs zlib)\r
105 >  else\r
106 > -    printf "No.\n"\r
107 > -    errors=3D$((errors + 1))\r
108 > +    # Try finding zlib directly (e.g. on FreeBSD)\r
109 > +    zlib_cflags=3D\r
110 > +    zlib_ldflags=3D-lz\r
111 > +    if ${CC} ${zlib_cflags} -DMINVER=3D0x$zv1$zv2$zv3$zv4 -o compat/have=\r
112 _zlib "$srcdir"/compat/have_zlib.c ${zlib_ldflags} > /dev/null 2>&1 && ./co=\r
113 mpat/have_zlib\r
114 > +    then\r
115 > +        printf "Yes.\n"\r
116 > +        have_zlib=3D1\r
117 > +    else\r
118 > +        printf "No.\n"\r
119 > +        errors=3D$((errors + 1))\r
120 > +    fi\r
121 > +    rm -f compat/have_zlib\r
122 >  fi\r
123 >=20=20\r
124 >  printf "Checking for talloc development files... "\r
125 > @@ -509,7 +520,7 @@ EOF\r
126 >       echo "  http://xapian.org/"\r
127 >      fi\r
128 >      if [ $have_zlib -eq 0 ]; then\r
129 > -     echo "  zlib library (>=3D version 1.2.5.2, including development files =\r
130 such as headers)"\r
131 > +     echo "  zlib library (>=3D version $zv1.$zv2.$zv3.$zv4, including develo=\r
132 pment files such as headers)"\r
133 >       echo "  http://zlib.net/"\r
134 >       echo\r
135 >      fi\r
136 > --=20\r
137 > 1.9.2\r