]> granicus.if.org Git - python/commitdiff
Patch 659834 by Magnus Lie Hetland:
authorGuido van Rossum <guido@python.org>
Mon, 30 Dec 2002 16:25:41 +0000 (16:25 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 30 Dec 2002 16:25:41 +0000 (16:25 +0000)
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).

Modules/readline.c
configure
configure.in
pyconfig.h.in

index 462d52f9b88a5332b3bb75cad25fba931b044a60..a4bfc621bb41009ac496c14880b6061312eb37da 100644 (file)
@@ -574,7 +574,9 @@ setup_readline(void)
        rl_completer_word_break_characters =
                strdup(" \t\n`~!@#$%^&*()-=+[{]}\\|;:'\",<>/?");
                /* All nonalphanums except '.' */
+#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER
        rl_completion_append_character ='\0';
+#endif
 
        begidx = 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) {
                 rl_instream = sys_stdin;
                 rl_outstream = sys_stdout;
+#ifdef HAVE_RL_COMPLETION_APPEND_CHARACTER
                 rl_prep_terminal (1);
+#endif
         }
         
        p = readline(prompt);
index 207eddfc34d78ced8abcc6e47565a16995afccf0..5495840fa1343673d040234032525fa0f5cd8895 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #! /bin/sh
-# From configure.in Revision: 1.378 .
+# From configure.in Revision: 1.380 .
 # Guess values for system-dependent variables and create Makefiles.
 # 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
 # absolute.
 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_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
 
@@ -16228,6 +16228,56 @@ _ACEOF
 
 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
 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
@@ -17418,7 +17468,7 @@ esac
 # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
 # absolute.
 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_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
 
index b4bbdb649ad0168fb88dbdbebc4b7e1134b04ebd..4869dd10aff143d138d67aac290e27c5644ee631 100644 (file)
@@ -2381,6 +2381,17 @@ then
   [Define this if you have flockfile(), getc_unlocked(), and funlockfile()])
 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
 AC_CHECK_LIB(readline, rl_pre_input_hook,
        AC_DEFINE(HAVE_RL_PRE_INPUT_HOOK, 1,
index dd52efb315267924d203f2c0b290e9043ea1aaed..922147e339603c17de75cc73e2fbf72dc2f8b815 100644 (file)
 /* Define to 1 if you have the `readlink' function. */
 #undef HAVE_READLINK
 
+/* Define if you have readline 2.2 */
+#undef HAVE_RL_COMPLETION_APPEND_CHARACTER
+
 /* Define if you have readline 4.2 */
 #undef HAVE_RL_COMPLETION_MATCHES