mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-117845: Detect libedit hook function signature in configure (#117870)
Older libedit versions (like Apple's) use a different type signature for rl_startup_hook and rl_pre_input_hook. Add a configure check to determine which signature is accepted by introducing the Py_RL_STARTUP_HOOK_TAKES_ARGS macro in pyconfig.h.
This commit is contained in:
parent
f74e51229c
commit
8515fd79fe
5 changed files with 71 additions and 2 deletions
15
configure.ac
15
configure.ac
|
@ -6341,6 +6341,21 @@ AS_VAR_IF([with_readline], [no], [
|
|||
# in readline as well as newer editline (April 2023)
|
||||
AC_CHECK_TYPES([rl_compdisp_func_t], [], [], [readline_includes])
|
||||
|
||||
# Some editline versions declare rl_startup_hook as taking no args, others
|
||||
# declare it as taking 2.
|
||||
AC_CACHE_CHECK([if rl_startup_hook takes arguments], [ac_cv_readline_rl_startup_hook_takes_args], [
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM([readline_includes]
|
||||
[extern int test_hook_func(const char *text, int state);],
|
||||
[rl_startup_hook=test_hook_func;])],
|
||||
[ac_cv_readline_rl_startup_hook_takes_args=yes],
|
||||
[ac_cv_readline_rl_startup_hook_takes_args=no]
|
||||
)
|
||||
])
|
||||
AS_VAR_IF([ac_cv_readline_rl_startup_hook_takes_args], [yes], [
|
||||
AC_DEFINE([Py_RL_STARTUP_HOOK_TAKES_ARGS], [1], [Define if rl_startup_hook takes arguments])
|
||||
])
|
||||
|
||||
m4_undefine([readline_includes])
|
||||
])dnl WITH_SAVE_ENV()
|
||||
])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue