]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-109191: Fix build with newer editline (gh-110239) (#110575)
authorBo Anderson <mail@boanderson.me>
Mon, 9 Oct 2023 19:42:25 +0000 (20:42 +0100)
committerGitHub <noreply@github.com>
Mon, 9 Oct 2023 19:42:25 +0000 (19:42 +0000)
(cherry picked from commit f4cb0d27cc08f490c42a22e646eb73cc7072d54a)

Misc/NEWS.d/next/Build/2023-10-05-11-46-20.gh-issue-109191.imUkVN.rst [new file with mode: 0644]
Modules/readline.c
configure
configure.ac
pyconfig.h.in

diff --git a/Misc/NEWS.d/next/Build/2023-10-05-11-46-20.gh-issue-109191.imUkVN.rst b/Misc/NEWS.d/next/Build/2023-10-05-11-46-20.gh-issue-109191.imUkVN.rst
new file mode 100644 (file)
index 0000000..27e5df7
--- /dev/null
@@ -0,0 +1 @@
+Fix compile error when building with recent versions of libedit.
index 27b89de72794643bb9f23651847cf117a9cb19c4..8c7f526d418f8247c98526405d31dd836651ecc5 100644 (file)
@@ -440,7 +440,7 @@ readline_set_completion_display_matches_hook_impl(PyObject *module,
        default completion display. */
     rl_completion_display_matches_hook =
         readlinestate_global->completion_display_matches_hook ?
-#if defined(_RL_FUNCTION_TYPEDEF)
+#if defined(HAVE_RL_COMPDISP_FUNC_T)
         (rl_compdisp_func_t *)on_completion_display_matches_hook : 0;
 #else
         (VFunction *)on_completion_display_matches_hook : 0;
index af4a5bbfdfa1a4cc8069f67f4e4fe20a35fd27ee..b294f93a5564b48fdedaaef1ef52783e8d4594c0 100755 (executable)
--- a/configure
+++ b/configure
@@ -21289,6 +21289,23 @@ if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
 
 $as_echo "#define HAVE_RL_APPEND_HISTORY 1" >>confdefs.h
 
+fi
+
+
+  # in readline as well as newer editline (April 2023)
+  ac_fn_c_check_type "$LINENO" "rl_compdisp_func_t" "ac_cv_type_rl_compdisp_func_t" "
+#include <stdio.h> /* Must be first for Gnu Readline */
+#ifdef WITH_EDITLINE
+# include <editline/readline.h>
+#else
+# include <readline/readline.h>
+#endif
+
+"
+if test "x$ac_cv_type_rl_compdisp_func_t" = xyes; then :
+
+$as_echo "#define HAVE_RL_COMPDISP_FUNC_T 1" >>confdefs.h
+
 fi
 
 fi
index e1cbb7c7fbe9d94d72ac9ce001f284ba5d0a7dcd..629b7b76c3c315ff4d6c04b69c3e5773bc6503f6 100644 (file)
@@ -5918,6 +5918,20 @@ if test "$py_cv_lib_readline" = yes; then
   AC_CHECK_LIB($LIBREADLINE, append_history,
     AC_DEFINE(HAVE_RL_APPEND_HISTORY, 1,
       [Define if readline supports append_history]),,$READLINE_LIBS)
+
+  # in readline as well as newer editline (April 2023)
+  AC_CHECK_TYPE([rl_compdisp_func_t],
+                [AC_DEFINE([HAVE_RL_COMPDISP_FUNC_T], [1],
+                           [Define if readline supports rl_compdisp_func_t])],
+                [],
+                [
+#include <stdio.h> /* Must be first for Gnu Readline */
+#ifdef WITH_EDITLINE
+# include <editline/readline.h>
+#else
+# include <readline/readline.h>
+#endif
+                ])
 fi
 
 # End of readline checks: restore LIBS
index 0536047f573ce651876829bcf3b1b8908043edac..94d02e14c444ac9aacb059ba226afb77bad9af6a 100644 (file)
 /* Define if you can turn off readline's signal handling. */
 #undef HAVE_RL_CATCH_SIGNAL
 
+/* Define if readline supports rl_compdisp_func_t */
+#undef HAVE_RL_COMPDISP_FUNC_T
+
 /* Define if you have readline 2.2 */
 #undef HAVE_RL_COMPLETION_APPEND_CHARACTER