]> granicus.if.org Git - python/commitdiff
SF Patch #432457 by Jason Tishler: support for readline 4.2.
authorGuido van Rossum <guido@python.org>
Tue, 10 Jul 2001 16:45:32 +0000 (16:45 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 10 Jul 2001 16:45:32 +0000 (16:45 +0000)
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.

Modules/readline.c
acconfig.h
config.h.in
configure
configure.in

index 841fe0219a4ba4b311351974cec7023cc7590878..29d8999b5fda29da0fd11af01fa4eb18e2597c7d 100644 (file)
 #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 *);
index 896bbfce7cbdc7fc7082941acafd3645a09780e0..bee71f80f7bf10c139e03fba1d7a943335f45d85 100644 (file)
@@ -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
index 14c477ca0c260419234aa514af07cb1f54ba0702..4dab4e0124aaec3048a3f11f4e759c00863bc773 100644 (file)
 /* 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
 /* 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
 
 /* 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
 
 /* 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
index 2f32b6e081846a3ff811c125d693d8aa466ac7d8..56f467704cb2f0856f0b9127a4e289a80e227896 100755 (executable)
--- 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 <<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
index 5fa50cfd50e506e5ac2dcab0b9d7944fef830eeb..65ee7b4afe9cae77e44e92ad6718c24fcdfeace4 100644 (file)
@@ -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