[PATCH v5 10/18] Make NO_{INET_NTOP,INET_PTON} configured independently

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Gary V. Vaughan
Date: Friday, May 14, 2010 - 2:31 am

Being careful not to overwrite the results of testing for hstrerror in
libresolv, also test whether inet_ntop/inet_pton are available from
that library.

Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com>
---
 config.mak.in |    2 ++
 configure.ac  |   37 ++++++++++++++++++++++++++++++-------
 2 files changed, 32 insertions(+), 7 deletions(-)

Index: b/configure.ac
===================================================================
--- a/configure.ac
+++ b/configure.ac
@@ -545,11 +545,33 @@ AC_SUBST(NEEDS_SOCKET)
 test -n "$NEEDS_SOCKET" && LIBS="$LIBS -lsocket"
 
 #
-# Define NEEDS_RESOLV if linking with -lnsl and/or -lsocket is not enough.
-# Notably on Solaris 7 inet_ntop and inet_pton additionally reside there.
-AC_CHECK_LIB([c], [inet_ntop],
-[NEEDS_RESOLV=],
-[NEEDS_RESOLV=YesPlease])
+# The next few tests will define NEEDS_RESOLV if linking with
+# libresolv provides some of the functions we would normally get
+# from libc.
+NEEDS_RESOLV=
+AC_SUBST(NEEDS_RESOLV)
+#
+# Define NO_INET_NTOP if linking with -lresolv is not enough.
+# Solaris 2.7 in particular hos inet_ntop in -lresolv.
+NO_INET_NTOP=
+AC_SUBST(NO_INET_NTOP)
+AC_CHECK_FUNC([inet_ntop],
+	[],
+    [AC_CHECK_LIB([resolv], [inet_ntop],
+	    [NEEDS_RESOLV=YesPlease],
+	[NO_INET_NTOP=YesPlease])
+])
+#
+# Define NO_INET_PTON if linking with -lresolv is not enough.
+# Solaris 2.7 in particular hos inet_pton in -lresolv.
+NO_INET_PTON=
+AC_SUBST(NO_INET_PTON)
+AC_CHECK_FUNC([inet_pton],
+	[],
+    [AC_CHECK_LIB([resolv], [inet_pton],
+	    [NEEDS_RESOLV=YesPlease],
+	[NO_INET_PTON=YesPlease])
+])
 #
 # Define NO_HSTRERROR if linking with -lresolv is not enough.
 # Solaris 2.6 in particular has no hstrerror, even in -lresolv.
@@ -561,8 +583,9 @@ AC_CHECK_FUNC([hstrerror],
 	[NO_HSTRERROR=YesPlease])
 ])
 AC_SUBST(NO_HSTRERROR)
-
-AC_SUBST(NEEDS_RESOLV)
+#
+# If any of the above tests determined that -lresolv is needed at
+# build-time, also set it here for remaining configure-time checks.
 test -n "$NEEDS_RESOLV" && LIBS="$LIBS -lresolv"
 
 AC_CHECK_LIB([c], [basename],
Index: b/config.mak.in
===================================================================
--- a/config.mak.in
+++ b/config.mak.in
@@ -53,6 +53,8 @@ NO_SETENV=@NO_SETENV@
 NO_UNSETENV=@NO_UNSETENV@
 NO_MKDTEMP=@NO_MKDTEMP@
 NO_MKSTEMPS=@NO_MKSTEMPS@
+NO_INET_NTOP=@NO_INET_NTOP@
+NO_INET_PTON=@NO_INET_PTON@
 NO_ICONV=@NO_ICONV@
 OLD_ICONV=@OLD_ICONV@
 NO_DEFLATE_BOUND=@NO_DEFLATE_BOUND@

-- 
Gary V. Vaughan (gary@thewrittenword.com)
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH v5 00/18] Portability patches for git-1.7.1, Gary V. Vaughan, (Fri May 14, 2:31 am)
[PATCH v5 04/18] enums: omit trailing comma for portability, Gary V. Vaughan, (Fri May 14, 2:31 am)
[PATCH v5 10/18] Make NO_{INET_NTOP,INET_PTON} configured ..., Gary V. Vaughan, (Fri May 14, 2:31 am)
[PATCH v5 11/18] Some platforms lack socklen_t type, Gary V. Vaughan, (Fri May 14, 2:31 am)
[PATCH v5 12/18] Allow disabling &quot;inline&quot;, Gary V. Vaughan, (Fri May 14, 2:31 am)
[PATCH v5 13/18] inline declaration does not work on AIX, Gary V. Vaughan, (Fri May 14, 2:31 am)
[PATCH v5 14/18] Makefile: SunOS 5.6 portability fix, Gary V. Vaughan, (Fri May 14, 2:31 am)
[PATCH v5 16/18] Makefile: HPUX11 portability fixes., Gary V. Vaughan, (Fri May 14, 2:31 am)
[PATCH v5 17/18] Makefile: HP-UX 10.20 portability fixes., Gary V. Vaughan, (Fri May 14, 2:31 am)
[PATCH v5 18/18] Makefile: Tru64 portability fix, Gary V. Vaughan, (Fri May 14, 2:31 am)
Re: [PATCH v5 00/18] Portability patches for git-1.7.1, Gary V. Vaughan, (Tue May 25, 10:56 pm)
Re: [PATCH v5 00/18] Portability patches for git-1.7.1, Gary V. Vaughan, (Mon Jun 7, 8:45 am)
Re: [PATCH v5 00/18] Portability patches for git-1.7.1, Junio C Hamano, (Mon Jun 7, 11:07 am)
Re: [PATCH v5 00/18] Portability patches for git-1.7.1, Junio C Hamano, (Thu Jun 10, 9:30 pm)