$OpenBSD: patch-configure_ac,v 1.1 2011/12/23 13:06:30 jasper Exp $
--- configure.ac.orig	Mon Oct 24 03:25:13 2011
+++ configure.ac	Tue Nov 29 21:30:07 2011
@@ -147,9 +147,23 @@ fi
 AC_SUBST(PCRE_CFLAGS)
 AC_SUBST(PCRE_LIBS)
 
-PKG_CHECK_MODULES([LIBEDIT], [libedit], 
-	[AC_DEFINE([HAVE_LIBEDIT], [1], [Define we have libedit])],
-	[AC_MSG_WARN([libedit not found, disabling libedit support])])
+case $target in
+*-*-*bsd*)
+	AC_CHECK_HEADERS([readline/readline.h])
+	AC_CHECK_LIB(edit, el_init,
+		[ AC_DEFINE([HAVE_LIBEDIT], [1], [Define we have libedit])
+		  LIBEDIT_CFLAGS=""
+		  LIBEDIT_LIBS="-ledit ${CURSES_LIBS}"
+		],
+		[AC_MSG_WARN([libedit not found, disabling libedit support])],
+		[${CURSES_LIBS}])
+	;;
+*)
+	PKG_CHECK_MODULES([LIBEDIT], [libedit], 
+		[AC_DEFINE([HAVE_LIBEDIT], [1], [Define we have libedit])],
+		[AC_MSG_WARN([libedit not found, disabling libedit support])])
+	;;
+esac
 
 # Checks for header files.
 AC_HEADER_STDC
@@ -341,7 +355,7 @@ AC_ARG_ENABLE(kqueue,
 
 if test "$enable_kqueue" = yes; then
 	case $target in
-	*-*-freebsd* | *-*-darwin9* | *-*-netbsd* )
+	*-*-freebsd* | *-*-darwin9* | *-*-netbsd* | *-*-openbsd*)
 		AC_CHECK_FUNCS([kqueue])
 		;;
 	*-*-bsd*)
