]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-109191: Fix build with newer editline (gh-110239)
authorBo Anderson <mail@boanderson.me>
Mon, 9 Oct 2023 13:21:20 +0000 (14:21 +0100)
committerGitHub <noreply@github.com>
Mon, 9 Oct 2023 13:21:20 +0000 (13:21 +0000)
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 4b473023c6e524dd702b63c95e26e1221395d4d2..fde552d124bc777cfdc6a1ac973373680ad32c7d 100644 (file)
@@ -446,7 +446,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 7c5fdec4c93aa989dd464715dd2761050ca5e625..1799323e53b79fec6bda47d818a85436ce2d1ffa 100755 (executable)
--- a/configure
+++ b/configure
@@ -24668,6 +24668,25 @@ printf "%s\n" "#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>
+      # include <readline/history.h>
+      #endif
+
+"
+if test "x$ac_cv_type_rl_compdisp_func_t" = xyes
+then :
+
+printf "%s\n" "#define HAVE_RL_COMPDISP_FUNC_T 1" >>confdefs.h
+
+fi
+
+
 
 
 CFLAGS=$save_CFLAGS
index 6093afa092605305233d6cbf0b797fc97e396404..cafc6df75e65001db3589dcb9fbe237f1edab51c 100644 (file)
@@ -5999,6 +5999,13 @@ AS_VAR_IF([with_readline], [no], [
       AC_DEFINE([HAVE_RL_APPEND_HISTORY], [1], [Define if readline supports append_history])
     ])
 
+    # 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])],
+                  [],
+                  [readline_includes])
+
     m4_undefine([readline_includes])
   ])dnl WITH_SAVE_ENV()
 ])
index 9924a9011ed4edfbc97e99e16e63abe95499d015..f07e677250a1573afbc5f65e7fdfb23b44b07781 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