summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary V. Vaughan <git@mlists.thewrittenword.com>2010-05-14 09:31:40 +0000
committerJunio C Hamano <gitster@pobox.com>2010-05-31 17:36:27 -0700
commit0a9b167ede027c09eca7aa2ea7522f058e153a13 (patch)
tree92669f4d61a2497dde256bbb12e1b062fbd1d84f
parentfcf3a21acce45aa73001ee1d3ae119f653294def (diff)
downloadgit-0a9b167ede027c09eca7aa2ea7522f058e153a13.tar.gz
Makefile: some platforms do not have hstrerror anywhere
This patch improves the logic of the test for hstrerror, not to blindly assume that if there is no hstrerror in libc that it must exist in libresolv. Signed-off-by: Gary V. Vaughan <gary@thewrittenword.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--config.mak.in1
-rw-r--r--configure.ac17
2 files changed, 15 insertions, 3 deletions
diff --git a/config.mak.in b/config.mak.in
index 09bd5d417d..9a0d8deacd 100644
--- a/config.mak.in
+++ b/config.mak.in
@@ -43,6 +43,7 @@ NO_D_TYPE_IN_DIRENT=@NO_D_TYPE_IN_DIRENT@
NO_SOCKADDR_STORAGE=@NO_SOCKADDR_STORAGE@
NO_IPV6=@NO_IPV6@
NO_C99_FORMAT=@NO_C99_FORMAT@
+NO_HSTRERROR=@NO_HSTRERROR@
NO_STRCASESTR=@NO_STRCASESTR@
NO_MEMMEM=@NO_MEMMEM@
NO_STRLCPY=@NO_STRLCPY@
diff --git a/configure.ac b/configure.ac
index d8aab9a277..fbe5035c46 100644
--- a/configure.ac
+++ b/configure.ac
@@ -546,11 +546,22 @@ test -n "$NEEDS_SOCKET" && LIBS="$LIBS -lsocket"
#
# Define NEEDS_RESOLV if linking with -lnsl and/or -lsocket is not enough.
-# Notably on Solaris hstrerror resides in libresolv and on Solaris 7
-# inet_ntop and inet_pton additionally reside there.
-AC_CHECK_LIB([c], [hstrerror],
+# Notably on Solaris 7 inet_ntop and inet_pton additionally reside there.
+AC_CHECK_LIB([c], [inet_ntop],
[NEEDS_RESOLV=],
[NEEDS_RESOLV=YesPlease])
+#
+# Define NO_HSTRERROR if linking with -lresolv is not enough.
+# Solaris 2.6 in particular has no hstrerror, even in -lresolv.
+NO_HSTRERROR=
+AC_CHECK_FUNC([hstrerror],
+ [],
+ [AC_CHECK_LIB([resolv], [hstrerror],
+ [NEEDS_RESOLV=YesPlease],
+ [NO_HSTRERROR=YesPlease])
+])
+AC_SUBST(NO_HSTRERROR)
+
AC_SUBST(NEEDS_RESOLV)
test -n "$NEEDS_RESOLV" && LIBS="$LIBS -lresolv"