1 Return-Path: <amdragon@mit.edu>
\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 1929E431FD5
\r
6 for <notmuch@notmuchmail.org>; Sat, 23 Nov 2013 19:16:13 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 gOj9JCQrZZKO for <notmuch@notmuchmail.org>;
\r
16 Sat, 23 Nov 2013 19:16:05 -0800 (PST)
\r
17 Received: from dmz-mailsec-scanner-1.mit.edu (dmz-mailsec-scanner-1.mit.edu
\r
19 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id D8122431FCB
\r
22 for <notmuch@notmuchmail.org>; Sat, 23 Nov 2013 19:16:04 -0800 (PST)
\r
23 X-AuditID: 1209190c-b7f7f6d000000bbd-84-52916f732467
\r
24 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])
\r
25 (using TLS with cipher AES256-SHA (256/256 bits))
\r
26 (Client did not present a certificate)
\r
27 by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP
\r
28 id 81.BF.03005.47F61925; Sat, 23 Nov 2013 22:16:04 -0500 (EST)
\r
29 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])
\r
30 by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id rAO3G01R003508;
\r
31 Sat, 23 Nov 2013 22:16:01 -0500
\r
32 Received: from drake.dyndns.org
\r
33 (216-15-114-40.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com
\r
34 [216.15.114.40]) (authenticated bits=0)
\r
35 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
36 by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id rAO3Fw0n006349
\r
37 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
38 Sat, 23 Nov 2013 22:16:00 -0500
\r
39 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)
\r
40 (envelope-from <amdragon@mit.edu>)
\r
41 id 1VkQAw-0007cL-Ay; Sat, 23 Nov 2013 22:15:58 -0500
\r
42 From: Austin Clements <amdragon@MIT.EDU>
\r
43 To: notmuch@notmuchmail.org
\r
44 Subject: [PATCH] new: Detect dirent.d_type support at configure time
\r
45 Date: Sat, 23 Nov 2013 22:15:52 -0500
\r
46 Message-Id: <1385262952-29240-1-git-send-email-amdragon@mit.edu>
\r
47 X-Mailer: git-send-email 1.8.4.rc3
\r
48 X-Brightmail-Tracker:
\r
49 H4sIAAAAAAAAA+NgFlrKIsWRmVeSWpSXmKPExsUixCmqrVuSPzHIYNFVVovrN2cyWxw928Pm
\r
50 wOTxbNUtZo+VLy6zBzBFcdmkpOZklqUW6dslcGXc/v+HtaBZqmLZ0egGxknCXYycHBICJhKP
\r
51 fy1ihbDFJC7cW8/WxcjFISQwm0ni+N4LzBDORkaJTRfaWSGcO0wSzafWQjlzGSX+9s9lA+ln
\r
52 E9CQ2LZ/OSOILSIgLbHz7mywucwCNhKf9r9lBrGFBVwket41gcVZBFQlns/ewAJi8wo4SNxe
\r
53 cJQJ4g4liYWntrFOYORdwMiwilE2JbdKNzcxM6c4NVm3ODkxLy+1SNdQLzezRC81pXQTIzg0
\r
54 JHl2ML45qHSIUYCDUYmHV+D+hCAh1sSy4srcQ4ySHExKoryLciYGCfEl5adUZiQWZ8QXleak
\r
55 Fh9ilOBgVhLh7YoHyvGmJFZWpRblw6SkOViUxHlvctgHCQmkJ5akZqemFqQWwWRlODiUJHil
\r
56 8oAaBYtS01Mr0jJzShDSTBycIMN5gIY7g9TwFhck5hZnpkPkTzEqSonzvs0FSgiAJDJK8+B6
\r
57 YbH7ilEc6BVhXhOQdh5g3MN1vwIazAQ0mF2yG2RwSSJCSqqB0SqKvW76s5bv3GFWa8vWv1Iv
\r
58 7VubHrfo8SUX+9xMW7FNM8rD+jMWqijtfR/hEzr7eA2D39P8Mrml/gI3JpzcHvKeRWnD3/XZ
\r
59 ucGzC+8LhUrOtl6ybNOkpCNBBUe8a6p+ND6dm/DvgquX8I0d6kEHKnLfpS++FdGjM8lbQKr0
\r
60 UW6Sc2nN7P0FSizFGYmGWsxFxYkAigEnHbgCAAA=
\r
61 Cc: pi-notmuch@pihost.us
\r
62 X-BeenThere: notmuch@notmuchmail.org
\r
63 X-Mailman-Version: 2.1.13
\r
65 List-Id: "Use and development of the notmuch mail system."
\r
66 <notmuch.notmuchmail.org>
\r
67 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
68 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
69 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
70 List-Post: <mailto:notmuch@notmuchmail.org>
\r
71 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
72 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
73 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
74 X-List-Received-Date: Sun, 24 Nov 2013 03:16:13 -0000
\r
76 Support for dirent.d_type is OS-specific. Previously, we used
\r
77 _DIRENT_HAVE_D_TYPE to detect support for this, but this is apparently
\r
78 a glic-ism (FreeBSD, for example, supports d_type, but does not define
\r
79 this). Since there's no cross-platform way to detect support for
\r
80 dirent.d_type, detect it using a test compile at configure time.
\r
82 compat/have_d_type.c | 10 ++++++++++
\r
83 configure | 16 ++++++++++++++++
\r
84 notmuch-new.c | 2 +-
\r
85 3 files changed, 27 insertions(+), 1 deletion(-)
\r
86 create mode 100644 compat/have_d_type.c
\r
88 diff --git a/compat/have_d_type.c b/compat/have_d_type.c
\r
89 new file mode 100644
\r
90 index 0000000..9ca6c6e
\r
92 +++ b/compat/have_d_type.c
\r
94 +#include <dirent.h>
\r
98 + struct dirent ent;
\r
100 + (void) ent.d_type;
\r
104 diff --git a/configure b/configure
\r
105 index 1a8e939..d2d193c 100755
\r
108 @@ -557,6 +557,17 @@ else
\r
110 rm -f compat/have_timegm
\r
112 +printf "Checking for dirent.d_type... "
\r
113 +if ${CC} -o compat/have_d_type "$srcdir"/compat/have_d_type.c > /dev/null 2>&1
\r
118 + printf "No (will use stat instead).\n"
\r
121 +rm -f compat/have_d_type
\r
123 printf "Checking for standard version of getpwuid_r... "
\r
124 if ${CC} -o compat/check_getpwuid "$srcdir"/compat/check_getpwuid.c > /dev/null 2>&1
\r
126 @@ -745,6 +756,9 @@ HAVE_STRCASESTR = ${have_strcasestr}
\r
127 # build its own version)
\r
128 HAVE_STRSEP = ${have_strsep}
\r
130 +# Whether struct dirent has d_type (if not, then notmuch will use stat)
\r
131 +HAVE_D_TYPE = ${have_d_type}
\r
133 # Whether the Xapian version in use supports compaction
\r
134 HAVE_XAPIAN_COMPACT = ${have_xapian_compact}
\r
136 @@ -805,6 +819,7 @@ CONFIGURE_CFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\
\r
137 \$(VALGRIND_CFLAGS) \\
\r
138 -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR) \\
\r
139 -DHAVE_STRSEP=\$(HAVE_STRSEP) \\
\r
140 + -DHAVE_D_TYPE=\$(HAVE_D_TYPE) \\
\r
141 -DSTD_GETPWUID=\$(STD_GETPWUID) \\
\r
142 -DSTD_ASCTIME=\$(STD_ASCTIME) \\
\r
143 -DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT)
\r
144 @@ -813,6 +828,7 @@ CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\
\r
145 \$(VALGRIND_CFLAGS) \$(XAPIAN_CXXFLAGS) \\
\r
146 -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR) \\
\r
147 -DHAVE_STRSEP=\$(HAVE_STRSEP) \\
\r
148 + -DHAVE_D_TYPE=\$(HAVE_D_TYPE) \\
\r
149 -DSTD_GETPWUID=\$(STD_GETPWUID) \\
\r
150 -DSTD_ASCTIME=\$(STD_ASCTIME) \\
\r
151 -DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT)
\r
152 diff --git a/notmuch-new.c b/notmuch-new.c
\r
153 index ba05cb4..423e188 100644
\r
154 --- a/notmuch-new.c
\r
155 +++ b/notmuch-new.c
\r
156 @@ -167,7 +167,7 @@ dirent_type (const char *path, const struct dirent *entry)
\r
158 int err, saved_errno;
\r
160 -#ifdef _DIRENT_HAVE_D_TYPE
\r
162 /* Mapping from d_type to stat mode_t. We omit DT_LNK so that
\r
163 * we'll fall through to stat and get the real file type. */
\r
164 static const mode_t modes[] = {
\r