On a glibc system gethostbyname is in libc not libnsl
authordid447@gmail.com <did447@gmail.com>
Fri, 13 Oct 2006 19:35:38 +0000 (15:35 -0400)
committerNeil Brown <neilb@suse.de>
Mon, 16 Oct 2006 23:46:38 +0000 (09:46 +1000)
Signed-off-by: Kevin Coffman <kwc@citi.umich.edu>
Change configure test for gethostbyname, and properly
determine whether "-lnsl" or "-lsocket" are really
required.

configure.in

index a70b708..0ccc6b2 100644 (file)
@@ -147,8 +147,13 @@ AC_BSD_SIGNALS
 dnl *************************************************************
 dnl * Check for required libraries
 dnl *************************************************************
-AC_CHECK_LIB(socket, main, [LIBSOCKET="-lnsl"])
-AC_CHECK_LIB(nsl, main,        [LIBNSL="-lnsl"])
+AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname, [LIBNSL="-lnsl"])])
+AC_SUBST(LIBNSL)
+
+AC_CHECK_FUNC(connect, ,
+      AC_CHECK_LIB(socket, connect, [LIBSOCKET="-lsocket"],
+                AC_MSG_ERROR(Function 'socket' not found.), $LIBNSL))
+
 AC_CHECK_LIB(crypt, crypt, [LIBCRYPT="-lcrypt"])
 if test "$enable_nfsv4" = yes; then
     AC_CHECK_LIB(event, event_dispatch, [libevent=1], AC_MSG_ERROR([libevent needed for nfsv4 support]))
@@ -170,7 +175,6 @@ if test "$knfsd_cv_glibc2" = no; then
     AC_CHECK_LIB(bsd, daemon, [LIBBSD="-lbsd"])
 fi
 AC_SUBST(LIBSOCKET)
-AC_SUBST(LIBNSL)
 AC_SUBST(LIBCRYPT)
 AC_SUBST(LIBBSD)