--- /dev/null
+Return-Path: <blakej@foo.net>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 4F1ED431FBC\r
+ for <notmuch@notmuchmail.org>; Tue, 13 Nov 2012 18:10:12 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id NhTsbD1LKcMs for <notmuch@notmuchmail.org>;\r
+ Tue, 13 Nov 2012 18:10:11 -0800 (PST)\r
+Received: from foo.net (70-36-235-136.dsl.static.sonic.net [70.36.235.136])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 07B74431FBD\r
+ for <notmuch@notmuchmail.org>; Tue, 13 Nov 2012 18:10:10 -0800 (PST)\r
+Received: from foo.net (localhost [127.0.0.1])\r
+ by foo.net (8.14.5+Sun/8.14.5) with ESMTP id qAE2A9tU018889;\r
+ Tue, 13 Nov 2012 18:10:09 -0800 (PST)\r
+Received: (from blakej@localhost)\r
+ by foo.net (8.14.5+Sun/8.14.5/Submit) id qAE2A9Np018888;\r
+ Tue, 13 Nov 2012 18:10:09 -0800 (PST)\r
+From: Blake Jones <blakej@foo.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v3 01/10] getpwuid: check for standards compliance (Solaris\r
+ support)\r
+Date: Tue, 13 Nov 2012 18:09:56 -0800\r
+Message-Id: <1352859005-18631-2-git-send-email-blakej@foo.net>\r
+X-Mailer: git-send-email 1.7.3.2\r
+In-Reply-To: <1352859005-18631-1-git-send-email-blakej@foo.net>\r
+References: <1352859005-18631-1-git-send-email-blakej@foo.net>\r
+X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.2\r
+ (foo.net [127.0.0.1]); Tue, 13 Nov 2012 18:10:09 -0800 (PST)\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 14 Nov 2012 02:10:12 -0000\r
+\r
+Add checks to "configure" to see whether _POSIX_PTHREAD_SEMANTICS needs\r
+to be defined to get the right number of arguments in the prototypes for\r
+getpwuid_r(). Solaris' default implementation conforms to POSIX.1c\r
+Draft 6, rather than the final POSIX.1c spec. The standards-compliant\r
+version can be used by defining _POSIX_PTHREAD_SEMANTICS.\r
+\r
+This change also adds the file "compat/check_getpwuid.c", which\r
+configure uses to perform its check, and modifies compat/compat.h to\r
+define _POSIX_PTHREAD_SEMANTICS if configure detected it was needed.\r
+---\r
+ compat/check_getpwuid.c | 11 +++++++++++\r
+ compat/compat.h | 4 ++++\r
+ configure | 23 +++++++++++++++++++++--\r
+ 3 files changed, 36 insertions(+), 2 deletions(-)\r
+ create mode 100644 compat/check_getpwuid.c\r
+\r
+diff --git a/compat/check_getpwuid.c b/compat/check_getpwuid.c\r
+new file mode 100644\r
+index 0000000..c435eb8\r
+--- /dev/null\r
++++ b/compat/check_getpwuid.c\r
+@@ -0,0 +1,11 @@\r
++#include <stdio.h>\r
++#include <pwd.h>\r
++\r
++int main()\r
++{\r
++ struct passwd passwd, *ignored;\r
++\r
++ (void) getpwuid_r (0, &passwd, NULL, 0, &ignored);\r
++\r
++ return (0);\r
++}\r
+diff --git a/compat/compat.h b/compat/compat.h\r
+index b2e2736..efea023 100644\r
+--- a/compat/compat.h\r
++++ b/compat/compat.h\r
+@@ -54,6 +54,10 @@ char* strcasestr(const char *haystack, const char *needle);\r
+ #define IGNORE_RESULT(x) x\r
+ #endif /* __GNUC__ */\r
+ \r
++#if !STD_GETPWUID\r
++#define _POSIX_PTHREAD_SEMANTICS 1\r
++#endif\r
++\r
+ #ifdef __cplusplus\r
+ }\r
+ #endif\r
+diff --git a/configure b/configure\r
+index ea8a1ad..bb5031e 100755\r
+--- a/configure\r
++++ b/configure\r
+@@ -512,6 +512,17 @@ else\r
+ fi\r
+ rm -f compat/have_strcasestr\r
+ \r
++printf "Checking for standard version of getpwuid_r... "\r
++if ${CC} -o compat/check_getpwuid "$srcdir"/compat/check_getpwuid.c > /dev/null 2>&1\r
++then\r
++ printf "Yes.\n"\r
++ std_getpwuid=1\r
++else\r
++ printf "No (will define _POSIX_PTHREAD_SEMANTICS to get it).\n"\r
++ std_getpwuid=0\r
++fi\r
++rm -f compat/check_getpwuid\r
++\r
+ printf "int main(void){return 0;}\n" > minimal.c\r
+ \r
+ printf "Checking for rpath support... "\r
+@@ -671,6 +682,11 @@ HAVE_GETLINE = ${have_getline}\r
+ # build its own version)\r
+ HAVE_STRCASESTR = ${have_strcasestr}\r
+ \r
++# Whether the getpwuid_r function is standards-compliant\r
++# (if not, then notmuch will #define _POSIX_PTHREAD_SEMANTICS\r
++# to enable the standards-compliant version -- needed for Solaris)\r
++STD_GETPWUID = ${std_getpwuid}\r
++\r
+ # Supported platforms (so far) are: LINUX, MACOSX, SOLARIS, FREEBSD, OPENBSD\r
+ PLATFORM = ${platform}\r
+ \r
+@@ -715,10 +731,13 @@ WITH_ZSH = ${WITH_ZSH}\r
+ # Combined flags for compiling and linking against all of the above\r
+ CONFIGURE_CFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\\r
+ \$(TALLOC_CFLAGS) -DHAVE_VALGRIND=\$(HAVE_VALGRIND) \\\r
+- \$(VALGRIND_CFLAGS) -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR)\r
++ \$(VALGRIND_CFLAGS) \\\r
++ -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR) \\\r
++ -DSTD_GETPWUID=\$(STD_GETPWUID)\r
+ CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS) \\\r
+ \$(TALLOC_CFLAGS) -DHAVE_VALGRIND=\$(HAVE_VALGRIND) \\\r
+ \$(VALGRIND_CFLAGS) \$(XAPIAN_CXXFLAGS) \\\r
+- -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR)\r
++ -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR) \\\r
++ -DSTD_GETPWUID=\$(STD_GETPWUID)\r
+ CONFIGURE_LDFLAGS = \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(XAPIAN_LDFLAGS)\r
+ EOF\r
+-- \r
+1.7.3.2\r
+\r