$OpenBSD: patch-build_configure_in,v 1.1 2012/12/03 21:26:50 naddy Exp $
--- build/configure.in.orig	Mon Dec  3 22:18:08 2012
+++ build/configure.in	Mon Dec  3 22:20:33 2012
@@ -229,10 +229,8 @@ dnl for freebsd2.*, order DOES matter.  don't bother.
 		case "$host_os" in
 		bsdi2.1)
 			vi_cannapath="/usr/contrib/canna";;
-		freebsd2.2*|freebsd3*)
-			vi_cannapath="/usr/local";;
-		freebsd2*)
-			vi_cannapath="/usr/local/canna";;
+		freebsd*|netbsd*|openbsd*)
+			vi_cannapath="${prefix}";;
 		*)
 			vi_cannapath="/usr/local/canna";;
 		esac
@@ -616,14 +614,17 @@ fi
 AC_MSG_RESULT($vi_cv_gettimeofday)
 
 dnl Check for which version of openpty to use, System V or Berkeley.
-AC_MSG_CHECKING(for System V pty calls)
-AC_CACHE_VAL(vi_cv_sys5_pty, [dnl
-AC_TRY_LINK(, [grantpt(0);],
-	[vi_cv_sys5_pty=yes], [vi_cv_sys5_pty=no])])
-if test "$vi_cv_sys5_pty" = yes; then
-	AC_DEFINE(HAVE_SYS5_PTY)
-fi
-AC_MSG_RESULT($vi_cv_sys5_pty)
+AC_CHECK_FUNCS(openpty,,
+	[AC_CHECK_LIB(util,openpty,
+		[AC_DEFINE(HAVE_OPENPTY)] [LIBS="$LIBS -lutil"],
+		[AC_MSG_CHECKING(for System V pty calls)
+		AC_CACHE_VAL(vi_cv_sys5_pty, [dnl
+		AC_TRY_LINK(, [grantpt(0);],
+			[vi_cv_sys5_pty=yes], [vi_cv_sys5_pty=no])])
+		if test "$vi_cv_sys5_pty" = yes; then
+			AC_DEFINE(HAVE_SYS5_PTY)
+		fi
+		AC_MSG_RESULT($vi_cv_sys5_pty)])])
 
 dnl Check for the revoke system call.
 AC_MSG_CHECKING(for revoke system call)
