diff options
author | Guido van Rossum <guido@python.org> | 2001-07-10 16:45:32 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2001-07-10 16:45:32 (GMT) |
commit | 353ae5896499d0ec297cff00e3686f4cd88668c3 (patch) | |
tree | 2d4bc47e3fc79a3c702b7ef6ff16101620341b4a | |
parent | d854831ddd2adbec80f38ffb26a0f355b9c8772e (diff) | |
download | cpython-353ae5896499d0ec297cff00e3686f4cd88668c3.zip cpython-353ae5896499d0ec297cff00e3686f4cd88668c3.tar.gz cpython-353ae5896499d0ec297cff00e3686f4cd88668c3.tar.bz2 |
SF Patch #432457 by Jason Tishler: support for readline 4.2.
This patch allows the readline module to build cleanly with GNU
readline 4.2 without breaking the build for earlier GNU readline
versions. The configure script checks for the presence of
rl_completion_matches in libreadline.
-rw-r--r-- | Modules/readline.c | 4 | ||||
-rw-r--r-- | acconfig.h | 3 | ||||
-rw-r--r-- | config.h.in | 17 | ||||
-rwxr-xr-x | configure | 53 | ||||
-rw-r--r-- | configure.in | 4 |
5 files changed, 70 insertions, 11 deletions
diff --git a/Modules/readline.c b/Modules/readline.c index 841fe02..29d8999 100644 --- a/Modules/readline.c +++ b/Modules/readline.c @@ -21,6 +21,10 @@ #include <readline/readline.h> #include <readline/history.h> +#ifdef HAVE_RL_COMPLETION_MATCHES +#define completion_matches(x, y) rl_completion_matches((x), ((rl_compentry_func_t *)(y))) +#endif + /* Pointers needed from outside (but not declared in a header file). */ extern DL_IMPORT(int) (*PyOS_InputHook)(void); extern DL_IMPORT(char) *(*PyOS_ReadlineFunctionPointer)(char *); @@ -86,6 +86,9 @@ /* Define if you have GNU PTH threads */ #undef HAVE_PTH +/* Define if you have readline 4.2 */ +#undef HAVE_RL_COMPLETION_MATCHES + /* Define if your compiler supports variable length function prototypes (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h> */ #undef HAVE_STDARG_PROTOTYPES diff --git a/config.h.in b/config.h.in index 14c477c..4dab4e0 100644 --- a/config.h.in +++ b/config.h.in @@ -148,6 +148,9 @@ /* Define if you have GNU PTH threads */ #undef HAVE_PTH +/* Define if you have readline 4.2 */ +#undef HAVE_RL_COMPLETION_MATCHES + /* Define if your compiler supports variable length function prototypes (e.g. void fprintf(FILE *, char *, ...);) *and* <stdarg.h> */ #undef HAVE_STDARG_PROTOTYPES @@ -296,9 +299,6 @@ /* The number of bytes in a wchar_t. */ #undef SIZEOF_WCHAR_T -/* Define if you have the _getpty function. */ -#undef HAVE__GETPTY - /* Define if you have the alarm function. */ #undef HAVE_ALARM @@ -392,6 +392,9 @@ /* Define if you have the getpid function. */ #undef HAVE_GETPID +/* Define if you have the _getpty function. */ +#undef HAVE__GETPTY + /* Define if you have the getpwent function. */ #undef HAVE_GETPWENT @@ -554,14 +557,14 @@ /* Define if you have the waitpid function. */ #undef HAVE_WAITPID -/* Define if you have the <db.h> header file. */ -#undef HAVE_DB_H +/* Define if you have the <db_185.h> header file. */ +#undef HAVE_DB_185_H /* Define if you have the <db1/ndbm.h> header file. */ #undef HAVE_DB1_NDBM_H -/* Define if you have the <db_185.h> header file. */ -#undef HAVE_DB_185_H +/* Define if you have the <db.h> header file. */ +#undef HAVE_DB_H /* Define if you have the <dirent.h> header file. */ #undef HAVE_DIRENT_H @@ -1,6 +1,6 @@ #! /bin/sh -# From configure.in Revision: 1.222 +# From configure.in Revision: 1.224 # Guess values for system-dependent variables and create Makefiles. # Generated automatically using autoconf version 2.13 @@ -6814,6 +6814,51 @@ EOF fi +# check for readline 4.2 +echo $ac_n "checking for rl_completion_matches in -lreadline""... $ac_c" 1>&6 +echo "configure:6820: checking for rl_completion_matches in -lreadline" >&5 +ac_lib_var=`echo readline'_'rl_completion_matches | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lreadline -ltermcap $LIBS" +cat > conftest.$ac_ext <<EOF +#line 6828 "configure" +#include "confdefs.h" +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char rl_completion_matches(); + +int main() { +rl_completion_matches() +; return 0; } +EOF +if { (eval echo configure:6839: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_RL_COMPLETION_MATCHES 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + + # THIS MUST BE LAST, IT CAN BREAK OTHER TESTS! # Add sys/socket.h to confdefs.h cat >> confdefs.h <<\EOF @@ -6822,12 +6867,12 @@ cat >> confdefs.h <<\EOF #endif EOF echo $ac_n "checking for socklen_t""... $ac_c" 1>&6 -echo "configure:6826: checking for socklen_t" >&5 +echo "configure:6871: checking for socklen_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_socklen_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 6831 "configure" +#line 6876 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -6876,7 +6921,7 @@ done SRCDIRS="Parser Grammar Objects Python Modules" echo $ac_n "checking for build directories""... $ac_c" 1>&6 -echo "configure:6880: checking for build directories" >&5 +echo "configure:6925: checking for build directories" >&5 for dir in $SRCDIRS; do if test ! -d $dir; then mkdir $dir diff --git a/configure.in b/configure.in index 5fa50cf..65ee7b4 100644 --- a/configure.in +++ b/configure.in @@ -1661,6 +1661,10 @@ then AC_DEFINE(HAVE_GETC_UNLOCKED) fi +# check for readline 4.2 +AC_CHECK_LIB(readline, rl_completion_matches, + AC_DEFINE(HAVE_RL_COMPLETION_MATCHES), , -ltermcap) + # THIS MUST BE LAST, IT CAN BREAK OTHER TESTS! # Add sys/socket.h to confdefs.h cat >> confdefs.h <<\EOF |