Skip to content

Commit 0a9b167

Browse files
Gary V. Vaughangitster
authored andcommitted
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>
1 parent fcf3a21 commit 0a9b167

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

config.mak.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ NO_D_TYPE_IN_DIRENT=@NO_D_TYPE_IN_DIRENT@
4343
NO_SOCKADDR_STORAGE=@NO_SOCKADDR_STORAGE@
4444
NO_IPV6=@NO_IPV6@
4545
NO_C99_FORMAT=@NO_C99_FORMAT@
46+
NO_HSTRERROR=@NO_HSTRERROR@
4647
NO_STRCASESTR=@NO_STRCASESTR@
4748
NO_MEMMEM=@NO_MEMMEM@
4849
NO_STRLCPY=@NO_STRLCPY@

configure.ac

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -546,11 +546,22 @@ test -n "$NEEDS_SOCKET" && LIBS="$LIBS -lsocket"
546546

547547
#
548548
# Define NEEDS_RESOLV if linking with -lnsl and/or -lsocket is not enough.
549-
# Notably on Solaris hstrerror resides in libresolv and on Solaris 7
550-
# inet_ntop and inet_pton additionally reside there.
551-
AC_CHECK_LIB([c], [hstrerror],
549+
# Notably on Solaris 7 inet_ntop and inet_pton additionally reside there.
550+
AC_CHECK_LIB([c], [inet_ntop],
552551
[NEEDS_RESOLV=],
553552
[NEEDS_RESOLV=YesPlease])
553+
#
554+
# Define NO_HSTRERROR if linking with -lresolv is not enough.
555+
# Solaris 2.6 in particular has no hstrerror, even in -lresolv.
556+
NO_HSTRERROR=
557+
AC_CHECK_FUNC([hstrerror],
558+
[],
559+
[AC_CHECK_LIB([resolv], [hstrerror],
560+
[NEEDS_RESOLV=YesPlease],
561+
[NO_HSTRERROR=YesPlease])
562+
])
563+
AC_SUBST(NO_HSTRERROR)
564+
554565
AC_SUBST(NEEDS_RESOLV)
555566
test -n "$NEEDS_RESOLV" && LIBS="$LIBS -lresolv"
556567

0 commit comments

Comments
 (0)