- Applied patch from David Rankin <drankin@bohemians.lexington.ky.us>
   to fix libwrap support on NetBSD
diff --git a/ChangeLog b/ChangeLog
index 685b614..1352588 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,8 @@
      listen sock now.
    - [sshd.c]
      make that a fatal
+ - Applied patch from David Rankin <drankin@bohemians.lexington.ky.us>
+   to fix libwrap support on NetBSD
  - Released 1.2pre17
 
 19991208
diff --git a/Makefile.in b/Makefile.in
index 232f8e0..7148c50 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -15,6 +15,7 @@
 EXTRA_TARGETS=@GNOME_ASKPASS@
 TARGETS=libssh.a ssh sshd ssh-add ssh-keygen ssh-agent scp $(EXTRA_TARGETS)
 LIBS=@LIBS@
+LIBWRAP=@LIBWRAP@
 AR=@AR@
 RANLIB=@RANLIB@
 INSTALL=@INSTALL@
@@ -48,7 +49,7 @@
 sshd:	sshd.o auth-rhosts.o auth-passwd.o auth-rsa.o auth-rh-rsa.o \
   pty.o log-server.o login.o servconf.o serverloop.o bsd-login.o \
   md5crypt.o libssh.a
-	$(CC) -o $@ $^ $(LFLAGS) $(LIBS) 
+	$(CC) -o $@ $^ $(LFLAGS) $(LIBS) $(LIBWRAP)
 
 scp:	scp.o libssh.a
 	$(CC) -o $@ $^ $(LFLAGS) $(LIBS) 
diff --git a/configure.in b/configure.in
index e039552..2e7623b 100644
--- a/configure.in
+++ b/configure.in
@@ -276,9 +276,10 @@
 	[  --with-tcp-wrappers     Enable tcpwrappers support],
 	[
 		AC_DEFINE(LIBWRAP)
-		LIBS="$LIBS -lwrap"
+		LIBWRAP="-lwrap"
 	]
 )
+AC_SUBST(LIBWRAP)
 
 dnl Check whether to enable MD5 passwords
 AC_ARG_WITH(md5-passwords,