Index: configure.in
===================================================================
--- configure.in (revision 66050)
+++ configure.in (working copy)
@@ -3095,10 +3095,35 @@
# check where readline lives
# save the value of LIBS so we don't actually link Python with readline
LIBS_no_readline=$LIBS
-AC_CHECK_LIB(readline, readline)
-if test "$ac_cv_have_readline_readline" = no
-then
- AC_CHECK_LIB(termcap, readline)
+
+# On some systems we need to link readline to a termcap compatible
+# library. Note to keep precedence of listed libraries synchronised
+# with setup.py.
+py_cv_lib_readline=no
+AC_MSG_CHECKING([how to link readline libs])
+for py_libtermcap in "" ncursesw ncurses curses termcap; do
+ if test -z "$py_libtermcap"; then
+ READLINE_LIBS="-lreadline"
+ else
+ READLINE_LIBS="-lreadline -l$py_libtermcap"
+ fi
+ LIBS="$READLINE_LIBS $LIBS_no_readline"
+ AC_LINK_IFELSE(
+ [AC_LANG_CALL([],[readline])],
+ [py_cv_lib_readline=yes])
+ if test $py_cv_lib_readline = yes; then
+ break
+ fi
+done
+# Uncomment next if you want to use in makefile
+# and/or other scripts
+#AC_SUBST([READLINE_LIBS])
+if test $py_cv_lib_readline = !yes; then
+ AC_MSG_RESULT([none])
+else
+ AC_MSG_RESULT([$READLINE_LIBS])
+ AC_DEFINE(HAVE_LIBREADLINE, 1,
+ [Define to 1 if you have the `readline' library (-lreadline).])
fi
# check for readline 2.1
Index: pyconfig.h.in
===================================================================
--- pyconfig.h.in (revision 66050)
+++ pyconfig.h.in (working copy)
@@ -309,9 +309,6 @@
/* Define to 1 if you have the `resolv' library (-lresolv). */
#undef HAVE_LIBRESOLV
-/* Define to 1 if you have the `termcap' library (-ltermcap). */
-#undef HAVE_LIBTERMCAP
-
/* Define to 1 if you have the