From 8fccb009fa539080a6c4fb18204dfea0be434433 Mon Sep 17 00:00:00 2001 From: Ralf Wildenhues Date: Sun, 7 Jun 2009 07:40:29 +0200 Subject: [PATCH] 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 Signed-off-by: Junio C Hamano --- config.mak.in | 1 + configure.ac | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/config.mak.in b/config.mak.in index 7cce0c12d..d0cd15581 100644 --- a/config.mak.in +++ b/config.mak.in @@ -32,6 +32,7 @@ NO_CURL=@NO_CURL@ NO_EXPAT=@NO_EXPAT@ NEEDS_LIBICONV=@NEEDS_LIBICONV@ NEEDS_SOCKET=@NEEDS_SOCKET@ +NEEDS_RESOLV=@NEEDS_RESOLV@ NO_SYS_SELECT_H=@NO_SYS_SELECT_H@ NO_D_INO_IN_DIRENT=@NO_D_INO_IN_DIRENT@ NO_D_TYPE_IN_DIRENT=@NO_D_TYPE_IN_DIRENT@ diff --git a/configure.ac b/configure.ac index 4e728bca3..0a37af74a 100644 --- a/configure.ac +++ b/configure.ac @@ -467,6 +467,15 @@ AC_CHECK_LIB([c], [socket], 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 hstrerror resides in libresolv and on Solaris 7 +# inet_ntop and inet_pton additionally reside there. +AC_CHECK_LIB([resolv], [hstrerror], +[NEEDS_RESOLV=], +[NEEDS_RESOLV=YesPlease]) +AC_SUBST(NEEDS_RESOLV) +test -n "$NEEDS_RESOLV" && LIBS="$LIBS -lresolv" ## Checks for header files. AC_MSG_NOTICE([CHECKS for header files]) -- 2.26.2