- Check for libwrap if --with-tcp-wrappers option specified. Suggestion
   Mate Wierdl <mw@moni.msci.memphis.edu>
diff --git a/ChangeLog b/ChangeLog
index 6a0e451..22d3377 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,8 @@
  - Explicitly seed OpenSSL's PRNG before checking rsa_alive()
  - Check for getpagesize in libucb.a if not found in libc. Fix for old
    Solaris from Andre Lucas <andre.lucas@dial.pipex.com>
+ - Check for libwrap if --with-tcp-wrappers option specified. Suggestion 
+   Mate Wierdl <mw@moni.msci.memphis.edu>
 
 20000303
  - Added "make host-key" target, Suggestion from Dominik Brettnacher
diff --git a/configure.in b/configure.in
index c9bd33b..4b5ee92 100644
--- a/configure.in
+++ b/configure.in
@@ -699,8 +699,25 @@
 	[  --with-tcp-wrappers     Enable tcpwrappers support],
 	[
 		if test "x$withval" != "$xno" ; then
-			AC_DEFINE(LIBWRAP)
+			saved_LIBS="$LIBS"
 			LIBS="$LIBS -lwrap"
+			AC_MSG_CHECKING(for libwrap)
+			AC_TRY_LINK(
+				[
+					#include <tcpd.h>
+					int deny_severity = 0, allow_severity = 0;
+				],
+				[hosts_access(0);],
+				[
+					AC_MSG_RESULT(yes)
+					AC_DEFINE(LIBWRAP)
+				],
+				[
+					AC_MSG_RESULT(no)
+					AC_MSG_WARN([*** libwrap missing - tcpwrapper support disabled ***])
+					LIBS="$saved_LIBS"
+				]
+			)
 		fi
 	]
 )