summaryrefslogtreecommitdiffstats
path: root/configure.in
diff options
context:
space:
mode:
authorGregory P. Smith <greg@mad-scientist.com>2008-09-07 06:24:49 (GMT)
committerGregory P. Smith <greg@mad-scientist.com>2008-09-07 06:24:49 (GMT)
commit188209465a966cf046ed7946589aa21767f95e68 (patch)
tree9a1cba96af2009f4d648204c0adde5d142064962 /configure.in
parentd43029ba5a38200f6244af3c2be566fca3c8d77a (diff)
downloadcpython-188209465a966cf046ed7946589aa21767f95e68.zip
cpython-188209465a966cf046ed7946589aa21767f95e68.tar.gz
cpython-188209465a966cf046ed7946589aa21767f95e68.tar.bz2
Merged revisions 66179,66283 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r66179 | gregory.p.smith | 2008-09-02 22:57:48 -0700 (Tue, 02 Sep 2008) Fix issue 3645: OpenBSD required -lcurses when linking with readline to get the correct completion_matches function to avoid crashes on x86_64 (amd64). ........ r66283 | gregory.p.smith | 2008-09-06 22:15:18 -0700 (Sat, 06 Sep 2008) - Issue #1204: The configure script now tests for additional libraries that may be required when linking against readline. This fixes issues with x86_64 builds on some platforms (at least a few Linux flavors as well as OpenBSD/amd64). ........
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in40
1 files changed, 32 insertions, 8 deletions
diff --git a/configure.in b/configure.in
index bc91c07..7f3b9f7 100644
--- a/configure.in
+++ b/configure.in
@@ -3220,16 +3220,40 @@ fi
# 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: Keep the 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 this line if you want to use READINE_LIBS in Makefile or 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 if you have the readline library (-lreadline).])
fi
# check for readline 2.1
AC_CHECK_LIB(readline, rl_callback_handler_install,
AC_DEFINE(HAVE_RL_CALLBACK, 1,
- [Define if you have readline 2.1]), , )
+ [Define if you have readline 2.1]), ,$READLINE_LIBS)
# check for readline 2.2
AC_TRY_CPP([#include <readline/readline.h>],
@@ -3245,17 +3269,17 @@ fi
# check for readline 4.0
AC_CHECK_LIB(readline, rl_pre_input_hook,
AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
- [Define if you have readline 4.0]), , )
+ [Define if you have readline 4.0]), ,$READLINE_LIBS)
# also in 4.0
AC_CHECK_LIB(readline, rl_completion_display_matches_hook,
AC_DEFINE(HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK, 1,
- [Define if you have readline 4.0]), , )
+ [Define if you have readline 4.0]), ,$READLINE_LIBS)
# check for readline 4.2
AC_CHECK_LIB(readline, rl_completion_matches,
AC_DEFINE(HAVE_RL_COMPLETION_MATCHES, 1,
- [Define if you have readline 4.2]), , )
+ [Define if you have readline 4.2]), ,$READLINE_LIBS)
# also in readline 4.2
AC_TRY_CPP([#include <readline/readline.h>],