[PATCH] configure: test whether -lresolv is needed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Check if -lresolv is needed for hstrerror; set NEEDS_RESOLV
accordingly, and substitute in config.mak.in.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@xxxxxx>
---

* Jakub Narebski wrote on Sat, Jun 06, 2009 at 09:29:34AM CEST:
> 
> CC-ed Ralf Wildenhues and David Syzdek (who hopefully can produce
> autoconf patch to squash with this one).

Completely untested, but also completely mechanical.  HTH.

Cheers,
Ralf

 config.mak.in |    1 +
 configure.ac  |    9 +++++++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/config.mak.in b/config.mak.in
index e8d96e8..dd60451 100644
--- a/config.mak.in
+++ b/config.mak.in
@@ -33,6 +33,7 @@ NO_EXPAT=@NO_EXPAT@
 NO_LIBGEN_H=@NO_LIBGEN_H@
 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 108a97f..7937e60 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])
-- 
1.6.3.2.199.g31f34
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]