[PATCH v2 05/14] cli/reply: reorganize create_reply_message()
[notmuch-archives.git] / bb / 523deb4ec88f188fd436639fbc008182bcddc8
1 Return-Path: <blakej@foo.net>\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 368A5431FCB\r
6         for <notmuch@notmuchmail.org>; Tue, 13 Nov 2012 18:10:12 -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 6lYQbIMuhzfc for <notmuch@notmuchmail.org>;\r
16         Tue, 13 Nov 2012 18:10:11 -0800 (PST)\r
17 Received: from foo.net (70-36-235-136.dsl.static.sonic.net [70.36.235.136])\r
18         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id EBB18431FBC\r
21         for <notmuch@notmuchmail.org>; Tue, 13 Nov 2012 18:10:10 -0800 (PST)\r
22 Received: from foo.net (localhost [127.0.0.1])\r
23         by foo.net (8.14.5+Sun/8.14.5) with ESMTP id qAE2A92E018895;\r
24         Tue, 13 Nov 2012 18:10:09 -0800 (PST)\r
25 Received: (from blakej@localhost)\r
26         by foo.net (8.14.5+Sun/8.14.5/Submit) id qAE2A9bA018891;\r
27         Tue, 13 Nov 2012 18:10:09 -0800 (PST)\r
28 From: Blake Jones <blakej@foo.net>\r
29 To: notmuch@notmuchmail.org\r
30 Subject: [PATCH v3 02/10] asctime: check for standards compliance (Solaris\r
31         support)\r
32 Date: Tue, 13 Nov 2012 18:09:57 -0800\r
33 Message-Id: <1352859005-18631-3-git-send-email-blakej@foo.net>\r
34 X-Mailer: git-send-email 1.7.3.2\r
35 In-Reply-To: <1352859005-18631-1-git-send-email-blakej@foo.net>\r
36 References: <1352859005-18631-1-git-send-email-blakej@foo.net>\r
37 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2\r
38         (foo.net [127.0.0.1]); Tue, 13 Nov 2012 18:10:09 -0800 (PST)\r
39 X-BeenThere: notmuch@notmuchmail.org\r
40 X-Mailman-Version: 2.1.13\r
41 Precedence: list\r
42 List-Id: "Use and development of the notmuch mail system."\r
43         <notmuch.notmuchmail.org>\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
45         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
47 List-Post: <mailto:notmuch@notmuchmail.org>\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
50         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
51 X-List-Received-Date: Wed, 14 Nov 2012 02:10:12 -0000\r
52 \r
53 Add checks to "configure" to see whether _POSIX_PTHREAD_SEMANTICS needs\r
54 to be defined to get the right number of arguments in the prototypes for\r
55 asctime_r().  Solaris' default implementation conforms to POSIX.1c\r
56 Draft 6, rather than the final POSIX.1c spec.  The standards-compliant\r
57 version can be used by defining _POSIX_PTHREAD_SEMANTICS.\r
58 \r
59 This change also adds the file "compat/check_asctime.c", which\r
60 configure uses to perform its check, and modifies compat/compat.h to\r
61 define _POSIX_PTHREAD_SEMANTICS if configure detected it was needed.\r
62 ---\r
63  compat/check_asctime.c |   18 ++++++++++++++++++\r
64  compat/compat.h        |    3 +++\r
65  configure              |   22 ++++++++++++++++++++--\r
66  3 files changed, 41 insertions(+), 2 deletions(-)\r
67  create mode 100644 compat/check_asctime.c\r
68 \r
69 diff --git a/compat/check_asctime.c b/compat/check_asctime.c\r
70 new file mode 100644\r
71 index 0000000..c508fbf\r
72 --- /dev/null\r
73 +++ b/compat/check_asctime.c\r
74 @@ -0,0 +1,18 @@\r
75 +/*\r
76 + * This compatibility check actually succeeds (on Solaris) if\r
77 + * _POSIX_PTHREAD_SEMANTICS is not defined.  But we need to #define that to get\r
78 + * the right version of getpwuid_r(), so we define it here to ensure that the\r
79 + * compatibility check ends up doing the same thing as the rest of the code.\r
80 + */\r
81 +#define        _POSIX_PTHREAD_SEMANTICS 1\r
82 +#include <time.h>\r
83 +#include <stdio.h>\r
84 +\r
85 +int main()\r
86 +{\r
87 +    struct tm tm;\r
88 +\r
89 +    (void) asctime_r (&tm, NULL, 0);\r
90 +\r
91 +    return (0);\r
92 +}\r
93 diff --git a/compat/compat.h b/compat/compat.h\r
94 index efea023..e5f833e 100644\r
95 --- a/compat/compat.h\r
96 +++ b/compat/compat.h\r
97 @@ -57,6 +57,9 @@ char* strcasestr(const char *haystack, const char *needle);\r
98  #if !STD_GETPWUID\r
99  #define _POSIX_PTHREAD_SEMANTICS 1\r
100  #endif\r
101 +#if !STD_ASCTIME\r
102 +#define _POSIX_PTHREAD_SEMANTICS 1\r
103 +#endif\r
104  \r
105  #ifdef __cplusplus\r
106  }\r
107 diff --git a/configure b/configure\r
108 index bb5031e..d153f57 100755\r
109 --- a/configure\r
110 +++ b/configure\r
111 @@ -523,6 +523,17 @@ else\r
112  fi\r
113  rm -f compat/check_getpwuid\r
114  \r
115 +printf "Checking for standard version of asctime_r... "\r
116 +if ${CC} -o compat/check_asctime "$srcdir"/compat/check_asctime.c > /dev/null 2>&1\r
117 +then\r
118 +    printf "Yes.\n"\r
119 +    std_asctime=1\r
120 +else\r
121 +    printf "No (will define _POSIX_PTHREAD_SEMANTICS to get it).\n"\r
122 +    std_asctime=0\r
123 +fi\r
124 +rm -f compat/check_asctime\r
125 +\r
126  printf "int main(void){return 0;}\n" > minimal.c\r
127  \r
128  printf "Checking for rpath support... "\r
129 @@ -687,6 +698,11 @@ HAVE_STRCASESTR = ${have_strcasestr}\r
130  # to enable the standards-compliant version -- needed for Solaris)\r
131  STD_GETPWUID = ${std_getpwuid}\r
132  \r
133 +# Whether the asctime_r function is standards-compliant\r
134 +# (if not, then notmuch will #define _POSIX_PTHREAD_SEMANTICS\r
135 +# to enable the standards-compliant version -- needed for Solaris)\r
136 +STD_ASCTIME = ${std_asctime}\r
137 +\r
138  # Supported platforms (so far) are: LINUX, MACOSX, SOLARIS, FREEBSD, OPENBSD\r
139  PLATFORM = ${platform}\r
140  \r
141 @@ -733,11 +749,13 @@ CONFIGURE_CFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS)      \\\r
142                    \$(TALLOC_CFLAGS) -DHAVE_VALGRIND=\$(HAVE_VALGRIND)   \\\r
143                    \$(VALGRIND_CFLAGS)                                   \\\r
144                    -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR)                 \\\r
145 -                  -DSTD_GETPWUID=\$(STD_GETPWUID)\r
146 +                  -DSTD_GETPWUID=\$(STD_GETPWUID)                       \\\r
147 +                  -DSTD_ASCTIME=\$(STD_ASCTIME)\r
148  CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS)    \\\r
149                      \$(TALLOC_CFLAGS) -DHAVE_VALGRIND=\$(HAVE_VALGRIND) \\\r
150                      \$(VALGRIND_CFLAGS) \$(XAPIAN_CXXFLAGS)             \\\r
151                      -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR)               \\\r
152 -                    -DSTD_GETPWUID=\$(STD_GETPWUID)\r
153 +                    -DSTD_GETPWUID=\$(STD_GETPWUID)                     \\\r
154 +                    -DSTD_ASCTIME=\$(STD_ASCTIME)\r
155  CONFIGURE_LDFLAGS =  \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(XAPIAN_LDFLAGS)\r
156  EOF\r
157 -- \r
158 1.7.3.2\r
159 \r