$NetBSD$

--- configure.in.orig	2002-03-20 14:44:16.000000000 +0000
+++ configure.in	2003-12-15 17:54:00.425996281 +0000
@@ -116,7 +116,7 @@
 dnl Checks for header files.
 AC_HEADER_STDC
 AC_CHECK_HEADERS(fcntl.h unistd.h sys/endian.h endian.h machine/endian.h sys/machine.h sys/isa_defs.h sys/poll.h)
-AC_CHECK_HEADERS(stddef.h wchar.h wcstr.h wctype.h machine/types.h tcpd.h)
+AC_CHECK_HEADERS(alloca.h stddef.h wchar.h wcstr.h wctype.h machine/types.h tcpd.h)
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
@@ -154,6 +154,7 @@
 # Modified to prefer shared libwrap by Adam Powell
 
 AC_MSG_CHECKING("whether to use TCP wrappers")
+if test -z "$LIBWRAP_PATH" && test -z "$LIB_WRAP"; then
 LIBWRAP_PATH=""
 LIB_WRAP=""
 for I in $LDFLAGS $LIBS -L/usr/lib; do
@@ -175,6 +176,7 @@
 	fi
 	esac
 done
+fi
 if test -n "$LIBWRAP_PATH" || test -n "$LIB_WRAP"; then
 	AC_MSG_RESULT(yes)
 else
