Patch 659834 by Magnus Lie Hetland:

Check for readline 2.2 features.  This should make it possible to
compile readline.c again with GNU readline versions 2.0 or 2.1; this
ability was removed in readline.c rev. 2.49.  Apparently the older
versions are still in widespread deployment on older Solaris
installations.  With an older readline, completion behavior is subtly
different (a space is always added).
This commit is contained in:
Guido van Rossum 2002-12-30 16:25:41 +00:00
parent 1fb22bb24f
commit faf5e4d48f
4 changed files with 71 additions and 3 deletions

View File

@ -574,7 +574,9 @@ setup_readline(void)
rl_completer_word_break_characters = rl_completer_word_break_characters =
strdup(" \t\n`~!@#$%^&*()-=+[{]}\\|;:'\",<>/?"); strdup(" \t\n`~!@#$%^&*()-=+[{]}\\|;:'\",<>/?");
/* All nonalphanums except '.' */ /* All nonalphanums except '.' */
#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER
rl_completion_append_character ='\0'; rl_completion_append_character ='\0';
#endif
begidx = PyInt_FromLong(0L); begidx = PyInt_FromLong(0L);
endidx = PyInt_FromLong(0L); endidx = PyInt_FromLong(0L);
@ -626,7 +628,9 @@ call_readline(FILE *sys_stdin, FILE *sys_stdout, char *prompt)
if (sys_stdin != rl_instream || sys_stdout != rl_outstream) { if (sys_stdin != rl_instream || sys_stdout != rl_outstream) {
rl_instream = sys_stdin; rl_instream = sys_stdin;
rl_outstream = sys_stdout; rl_outstream = sys_stdout;
#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER
rl_prep_terminal (1); rl_prep_terminal (1);
#endif
} }
p = readline(prompt); p = readline(prompt);

56
configure vendored
View File

@ -1,5 +1,5 @@
#! /bin/sh #! /bin/sh
# From configure.in Revision: 1.378 . # From configure.in Revision: 1.380 .
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.53 for python 2.3. # Generated by GNU Autoconf 2.53 for python 2.3.
# #
@ -908,7 +908,7 @@ esac
# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
# absolute. # absolute.
ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd`
ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
@ -16228,6 +16228,56 @@ _ACEOF
fi fi
# check for readline 2.2
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
#include <readline/readline.h>
_ACEOF
if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
(eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
ac_status=$?
egrep -v '^ *\+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } >/dev/null; then
if test -s conftest.err; then
ac_cpp_err=$ac_c_preproc_warn_flag
else
ac_cpp_err=
fi
else
ac_cpp_err=yes
fi
if test -z "$ac_cpp_err"; then
have_readline=yes
else
echo "$as_me: failed program was:" >&5
cat conftest.$ac_ext >&5
have_readline=no
fi
rm -f conftest.err conftest.$ac_ext
if test $have_readline = yes
then
cat >conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
#include "confdefs.h"
#include <readline/readline.h>
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
egrep "extern int rl_completion_append_character;" >/dev/null 2>&1; then
cat >>confdefs.h <<\_ACEOF
#define HAVE_RL_COMPLETION_APPEND_CHARACTER 1
_ACEOF
fi
rm -f conftest*
fi
# check for readline 4.0 # check for readline 4.0
echo "$as_me:$LINENO: checking for rl_pre_input_hook in -lreadline" >&5 echo "$as_me:$LINENO: checking for rl_pre_input_hook in -lreadline" >&5
echo $ECHO_N "checking for rl_pre_input_hook in -lreadline... $ECHO_C" >&6 echo $ECHO_N "checking for rl_pre_input_hook in -lreadline... $ECHO_C" >&6
@ -17418,7 +17468,7 @@ esac
# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
# absolute. # absolute.
ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd`
ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`

View File

@ -2381,6 +2381,17 @@ then
[Define this if you have flockfile(), getc_unlocked(), and funlockfile()]) [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
fi fi
# check for readline 2.2
AC_TRY_CPP([#include <readline/readline.h>],
have_readline=yes, have_readline=no)
if test $have_readline = yes
then
AC_EGREP_HEADER([extern int rl_completion_append_character;],
[readline/readline.h],
AC_DEFINE(HAVE_RL_COMPLETION_APPEND_CHARACTER, 1,
[Define if you have readline 2.2]), )
fi
# check for readline 4.0 # check for readline 4.0
AC_CHECK_LIB(readline, rl_pre_input_hook, AC_CHECK_LIB(readline, rl_pre_input_hook,
AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1, AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,

View File

@ -333,6 +333,9 @@
/* Define to 1 if you have the `readlink' function. */ /* Define to 1 if you have the `readlink' function. */
#undef HAVE_READLINK #undef HAVE_READLINK
/* Define if you have readline 2.2 */
#undef HAVE_RL_COMPLETION_APPEND_CHARACTER
/* Define if you have readline 4.2 */ /* Define if you have readline 4.2 */
#undef HAVE_RL_COMPLETION_MATCHES #undef HAVE_RL_COMPLETION_MATCHES