$NetBSD: patch-ac,v 1.2 2001/08/03 13:46:02 jlam Exp $

--- configure.in.orig	Tue Apr 17 19:00:52 2001
+++ configure.in
@@ -310,10 +310,18 @@
 
 ###############################################
 # test for where we get readline() from
+TERMLIBS=
 if test "$ac_cv_header_readline_h" = "yes" ||
    test "$ac_cv_header_readline_readline_h" = "yes"; then
-  AC_CHECK_LIB(readline,readline)
+  for termlib in termcap ncurses curses terminfo termlib; do
+    AC_CHECK_LIB(${termlib}, tgetent, [TERMLIBS="-l${termlib}"; break])
+  done
+  AC_CHECK_LIB(readline, readline,
+    [TERMLIBS="-lreadline $TERMLIBS"
+    AC_DEFINE(HAVE_LIBREADLINE)
+    break], [TERMLIBS=], $TERMLIBS)
 fi
+AC_SUBST(TERMLIBS)
 
 
 # The following test taken from the cvs sources
