[PATCH 03/10] gethostbyname: check for libnsl (Solaris support)
authorBlake Jones <blakej@foo.net>
Sun, 4 Nov 2012 03:15:55 +0000 (20:15 +1700)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:50:16 +0000 (09:50 -0800)
18/5e63c698f04717fb3ee0453bdf09a7d109d6f6 [new file with mode: 0644]

diff --git a/18/5e63c698f04717fb3ee0453bdf09a7d109d6f6 b/18/5e63c698f04717fb3ee0453bdf09a7d109d6f6
new file mode 100644 (file)
index 0000000..b3b148f
--- /dev/null
@@ -0,0 +1,119 @@
+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 184DE431FB6\r
+       for <notmuch@notmuchmail.org>; Sat,  3 Nov 2012 20:24:19 -0700 (PDT)\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 edyioyUum41W for <notmuch@notmuchmail.org>;\r
+       Sat,  3 Nov 2012 20:24:18 -0700 (PDT)\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 7B22C431FAE\r
+       for <notmuch@notmuchmail.org>; Sat,  3 Nov 2012 20:24:18 -0700 (PDT)\r
+Received: from foo.net (localhost [127.0.0.1])\r
+       by foo.net (8.14.5+Sun/8.14.5) with ESMTP id qA43GEIQ025666;\r
+       Sat, 3 Nov 2012 20:16:14 -0700 (PDT)\r
+Received: (from blakej@localhost)\r
+       by foo.net (8.14.5+Sun/8.14.5/Submit) id qA43GEpO025665;\r
+       Sat, 3 Nov 2012 20:16:14 -0700 (PDT)\r
+From: Blake Jones <blakej@foo.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 03/10] gethostbyname: check for libnsl (Solaris support)\r
+Date: Sat,  3 Nov 2012 20:15:55 -0700\r
+Message-Id: <1351998962-25135-4-git-send-email-blakej@foo.net>\r
+X-Mailer: git-send-email 1.7.3.2\r
+In-Reply-To: <1351998962-25135-1-git-send-email-blakej@foo.net>\r
+References: <1351998962-25135-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]); Sat, 03 Nov 2012 20:16:14 -0700 (PDT)\r
+X-Mailman-Approved-At: Sun, 04 Nov 2012 01:30:19 -0800\r
+Cc: Blake Jones <blakej@foo.net>\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: Sun, 04 Nov 2012 03:24:19 -0000\r
+\r
+Add a check to "configure" to see whether -lnsl is needed for programs\r
+that are using gethostbyname().  This change also adds the file\r
+"compat/check_ghbn.c", which configure uses to perform its check.\r
+---\r
+ compat/check_ghbn.c |    8 ++++++++\r
+ configure           |   17 ++++++++++++++++-\r
+ 2 files changed, 24 insertions(+), 1 deletion(-)\r
+ create mode 100644 compat/check_ghbn.c\r
+\r
+diff --git a/compat/check_ghbn.c b/compat/check_ghbn.c\r
+new file mode 100644\r
+index 0000000..ec5f227\r
+--- /dev/null\r
++++ b/compat/check_ghbn.c\r
+@@ -0,0 +1,8 @@\r
++#include <netdb.h>\r
++\r
++int main()\r
++{\r
++    (void) gethostbyname(NULL);\r
++\r
++    return (0);\r
++}\r
+diff --git a/configure b/configure\r
+index 047c011..28d4110 100755\r
+--- a/configure\r
++++ b/configure\r
+@@ -534,6 +534,17 @@ else\r
+ fi\r
+ rm -f compat/check_asctime\r
+ \r
++printf "Checking whether libnsl is needed for gethostbyname... "\r
++if ${CC} -o compat/check_ghbn "$srcdir"/compat/check_ghbn.c > /dev/null 2>&1\r
++then\r
++    printf "No.\n"\r
++    libnsl_ldflags=""\r
++else\r
++    printf "Yes.\n"\r
++    libnsl_ldflags="-lnsl"\r
++fi\r
++rm -f compat/check_ghbn\r
++\r
+ printf "int main(void){return 0;}\n" > minimal.c\r
+ \r
+ printf "Checking for rpath support... "\r
+@@ -723,6 +734,9 @@ GMIME_LDFLAGS = ${gmime_ldflags}\r
+ TALLOC_CFLAGS = ${talloc_cflags}\r
+ TALLOC_LDFLAGS = ${talloc_ldflags}\r
+ \r
++# Flags needed to get gethostbyname() at link time\r
++LIBNSL_LDFLAGS = ${libnsl_ldflags}\r
++\r
+ # Flags needed to have linker set rpath attribute\r
+ RPATH_LDFLAGS = ${rpath_ldflags}\r
+ \r
+@@ -757,5 +771,6 @@ CONFIGURE_CXXFLAGS = -DHAVE_GETLINE=\$(HAVE_GETLINE) \$(GMIME_CFLAGS)    \\\r
+                    -DHAVE_STRCASESTR=\$(HAVE_STRCASESTR)               \\\r
+                    -DSTD_GETPWUID=\$(STD_GETPWUID)                     \\\r
+                    -DSTD_ASCTIME=\$(STD_ASCTIME)\r
+-CONFIGURE_LDFLAGS =  \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(XAPIAN_LDFLAGS)\r
++CONFIGURE_LDFLAGS =  \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(XAPIAN_LDFLAGS) \\\r
++                   \$(LIBNSL_LDFLAGS)\r
+ EOF\r
+-- \r
+1.7.9.2\r
+\r