Re: [PATCH 3/5] nmbug-status: Add an nmbug-status(5) man page
[notmuch-archives.git] / 2d / 03ad9f63ca79ab4511a077d964bd2a288721a1
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 114D9431FC4\r
6         for <notmuch@notmuchmail.org>; Sun, 24 Nov 2013 09:08:53 -0800 (PST)\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 okPGHipKcDBi for <notmuch@notmuchmail.org>;\r
16         Sun, 24 Nov 2013 09:08:45 -0800 (PST)\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 1169C431FAE\r
19         for <notmuch@notmuchmail.org>; Sun, 24 Nov 2013 09:08:45 -0800 (PST)\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])\r
21         by guru.guru-group.fi (Postfix) with ESMTP id 861D410005E;\r
22         Sun, 24 Nov 2013 19:08:40 +0200 (EET)\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>\r
24 To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org\r
25 Subject: Re: [PATCH] new: Detect dirent.d_type support at configure time\r
26 In-Reply-To: <1385262952-29240-1-git-send-email-amdragon@mit.edu>\r
27 References: <1385262952-29240-1-git-send-email-amdragon@mit.edu>\r
28 User-Agent: Notmuch/0.16+175~g19e97d6 (http://notmuchmail.org) Emacs/24.3.1\r
29         (x86_64-unknown-linux-gnu)\r
30 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
31         $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
32         !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
33 Date: Sun, 24 Nov 2013 19:08:40 +0200\r
34 Message-ID: <m2ob59682v.fsf@guru.guru-group.fi>\r
35 MIME-Version: 1.0\r
36 Content-Type: text/plain\r
37 Cc: pi-notmuch@pihost.us\r
38 X-BeenThere: notmuch@notmuchmail.org\r
39 X-Mailman-Version: 2.1.13\r
40 Precedence: list\r
41 List-Id: "Use and development of the notmuch mail system."\r
42         <notmuch.notmuchmail.org>\r
43 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
44         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
45 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
46 List-Post: <mailto:notmuch@notmuchmail.org>\r
47 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
48 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
49         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
50 X-List-Received-Date: Sun, 24 Nov 2013 17:08:53 -0000\r
51 \r
52 On Sun, Nov 24 2013, Austin Clements <amdragon@MIT.EDU> wrote:\r
53 \r
54 > Support for dirent.d_type is OS-specific.  Previously, we used\r
55 > _DIRENT_HAVE_D_TYPE to detect support for this, but this is apparently\r
56 > a glic-ism (FreeBSD, for example, supports d_type, but does not define\r
57 > this).  Since there's no cross-platform way to detect support for\r
58 > dirent.d_type, detect it using a test compile at configure time.\r
59 > ---\r
60 \r
61 LGTM.\r
62 \r
63 Tomi\r
64 \r
65 >  compat/have_d_type.c | 10 ++++++++++\r
66 >  configure            | 16 ++++++++++++++++\r
67 >  notmuch-new.c        |  2 +-\r
68 >  3 files changed, 27 insertions(+), 1 deletion(-)\r
69 >  create mode 100644 compat/have_d_type.c\r
70 >\r
71 > diff --git a/compat/have_d_type.c b/compat/have_d_type.c\r
72 > new file mode 100644\r
73 > index 0000000..9ca6c6e\r
74 > --- /dev/null\r
75 > +++ b/compat/have_d_type.c\r
76 > @@ -0,0 +1,10 @@\r
77 > +#include <dirent.h>\r
78 > +\r
79 > +int main()\r
80 > +{\r
81 > +    struct dirent ent;\r
82 > +\r
83 > +    (void) ent.d_type;\r
84 > +\r
85 > +    return 0;\r
86 > +}\r
87 > diff --git a/configure b/configure\r
88 > index 1a8e939..d2d193c 100755\r
89 > --- a/configure\r
90 > +++ b/configure\r
91 > @@ -557,6 +557,17 @@ else\r
92 >  fi\r
93 >  rm -f compat/have_timegm\r
94 >  \r
95 > +printf "Checking for dirent.d_type... "\r
96 > +if ${CC} -o compat/have_d_type "$srcdir"/compat/have_d_type.c > /dev/null 2>&1\r
97 > +then\r
98 > +    printf "Yes.\n"\r
99 > +    have_d_type="1"\r
100 > +else\r
101 > +    printf "No (will use stat instead).\n"\r
102 > +    have_d_type="0"\r
103 > +fi\r
104 > +rm -f compat/have_d_type\r
105 > +\r
106 >  printf "Checking for standard version of getpwuid_r... "\r
107 >  if ${CC} -o compat/check_getpwuid "$srcdir"/compat/check_getpwuid.c > /dev/null 2>&1\r
108 >  then\r
109 > @@ -745,6 +756,9 @@ HAVE_STRCASESTR = ${have_strcasestr}\r
110 >  # build its own version)\r
111 >  HAVE_STRSEP = ${have_strsep}\r
112 >  \r
113 > +# Whether struct dirent has d_type (if not, then notmuch will use stat)\r
114 > +HAVE_D_TYPE = ${have_d_type}\r
115 > +\r
116 >  # Whether the Xapian version in use supports compaction\r
117 >  HAVE_XAPIAN_COMPACT = ${have_xapian_compact}\r
118 >  \r
119 > @@ -805,6 +819,7 @@ CONFIGURE_CFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS)      \\\r
120 >                  \$(VALGRIND_CFLAGS)                                   \\\r
121 >                  -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR)                 \\\r
122 >                  -DHAVE_STRSEP=\$(HAVE_STRSEP)                         \\\r
123 > +                -DHAVE_D_TYPE=\$(HAVE_D_TYPE)                         \\\r
124 >                  -DSTD_GETPWUID=\$(STD_GETPWUID)                       \\\r
125 >                  -DSTD_ASCTIME=\$(STD_ASCTIME)                         \\\r
126 >                  -DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT)\r
127 > @@ -813,6 +828,7 @@ CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS)    \\\r
128 >                    \$(VALGRIND_CFLAGS) \$(XAPIAN_CXXFLAGS)             \\\r
129 >                    -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR)               \\\r
130 >                    -DHAVE_STRSEP=\$(HAVE_STRSEP)                       \\\r
131 > +                  -DHAVE_D_TYPE=\$(HAVE_D_TYPE)                       \\\r
132 >                    -DSTD_GETPWUID=\$(STD_GETPWUID)                     \\\r
133 >                    -DSTD_ASCTIME=\$(STD_ASCTIME)                       \\\r
134 >                    -DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT)\r
135 > diff --git a/notmuch-new.c b/notmuch-new.c\r
136 > index ba05cb4..423e188 100644\r
137 > --- a/notmuch-new.c\r
138 > +++ b/notmuch-new.c\r
139 > @@ -167,7 +167,7 @@ dirent_type (const char *path, const struct dirent *entry)\r
140 >      char *abspath;\r
141 >      int err, saved_errno;\r
142 >  \r
143 > -#ifdef _DIRENT_HAVE_D_TYPE\r
144 > +#if HAVE_D_TYPE\r
145 >      /* Mapping from d_type to stat mode_t.  We omit DT_LNK so that\r
146 >       * we'll fall through to stat and get the real file type. */\r
147 >      static const mode_t modes[] = {\r
148 > -- \r
149 > 1.8.4.rc3\r
150 >\r
151 > _______________________________________________\r
152 > notmuch mailing list\r
153 > notmuch@notmuchmail.org\r
154 > http://notmuchmail.org/mailman/listinfo/notmuch\r