Skip to content

Commit 8fccb00

Browse files
Ralf Wildenhuesgitster
authored andcommitted
configure: test whether -lresolv is needed
Check if -lresolv is needed for hstrerror; set NEEDS_RESOLV accordingly, and substitute in config.mak.in. Signed-off-by: Ralf Wildenhues <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 61dbb3c commit 8fccb00

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

config.mak.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ NO_CURL=@NO_CURL@
3232
NO_EXPAT=@NO_EXPAT@
3333
NEEDS_LIBICONV=@NEEDS_LIBICONV@
3434
NEEDS_SOCKET=@NEEDS_SOCKET@
35+
NEEDS_RESOLV=@NEEDS_RESOLV@
3536
NO_SYS_SELECT_H=@NO_SYS_SELECT_H@
3637
NO_D_INO_IN_DIRENT=@NO_D_INO_IN_DIRENT@
3738
NO_D_TYPE_IN_DIRENT=@NO_D_TYPE_IN_DIRENT@

configure.ac

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,15 @@ AC_CHECK_LIB([c], [socket],
467467
AC_SUBST(NEEDS_SOCKET)
468468
test -n "$NEEDS_SOCKET" && LIBS="$LIBS -lsocket"
469469

470+
#
471+
# Define NEEDS_RESOLV if linking with -lnsl and/or -lsocket is not enough.
472+
# Notably on Solaris hstrerror resides in libresolv and on Solaris 7
473+
# inet_ntop and inet_pton additionally reside there.
474+
AC_CHECK_LIB([resolv], [hstrerror],
475+
[NEEDS_RESOLV=],
476+
[NEEDS_RESOLV=YesPlease])
477+
AC_SUBST(NEEDS_RESOLV)
478+
test -n "$NEEDS_RESOLV" && LIBS="$LIBS -lresolv"
470479

471480
## Checks for header files.
472481
AC_MSG_NOTICE([CHECKS for header files])

0 commit comments

Comments
 (0)