From: Guido van Rossum Date: Tue, 10 Jul 2001 16:45:32 +0000 (+0000) Subject: SF Patch #432457 by Jason Tishler: support for readline 4.2. X-Git-Tag: v2.2a3~1290 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=353ae5896499d0ec297cff00e3686f4cd88668c3;p=python 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. --- diff --git a/Modules/readline.c b/Modules/readline.c index 841fe0219a..29d8999b5f 100644 --- a/Modules/readline.c +++ b/Modules/readline.c @@ -21,6 +21,10 @@ #include #include +#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 *); diff --git a/acconfig.h b/acconfig.h index 896bbfce7c..bee71f80f7 100644 --- a/acconfig.h +++ b/acconfig.h @@ -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* */ #undef HAVE_STDARG_PROTOTYPES diff --git a/config.h.in b/config.h.in index 14c477ca0c..4dab4e0124 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* */ #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 header file. */ -#undef HAVE_DB_H +/* Define if you have the header file. */ +#undef HAVE_DB_185_H /* Define if you have the header file. */ #undef HAVE_DB1_NDBM_H -/* Define if you have the header file. */ -#undef HAVE_DB_185_H +/* Define if you have the header file. */ +#undef HAVE_DB_H /* Define if you have the header file. */ #undef HAVE_DIRENT_H diff --git a/configure b/configure index 2f32b6e081..56f467704c 100755 --- a/configure +++ b/configure @@ -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 <&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 < #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 5fa50cfd50..65ee7b4afe 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