diff options
author | Joshua Root <jmr@macports.org> | 2024-04-17 09:26:10 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-17 09:26:10 (GMT) |
commit | 8515fd79fef1ac16d7848cec5ec1797294cb5366 (patch) | |
tree | 28cc3745dea1506bd2bb463bf21777ef46c67640 /configure | |
parent | f74e51229c83e3265f905dc15283bfe0ec1a659e (diff) | |
download | cpython-8515fd79fef1ac16d7848cec5ec1797294cb5366.zip cpython-8515fd79fef1ac16d7848cec5ec1797294cb5366.tar.gz cpython-8515fd79fef1ac16d7848cec5ec1797294cb5366.tar.bz2 |
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.
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 50 |
1 files changed, 50 insertions, 0 deletions
@@ -25367,6 +25367,56 @@ printf "%s\n" "#define HAVE_RL_COMPDISP_FUNC_T 1" >>confdefs.h fi + # Some editline versions declare rl_startup_hook as taking no args, others + # declare it as taking 2. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if rl_startup_hook takes arguments" >&5 +printf %s "checking if rl_startup_hook takes arguments... " >&6; } +if test ${ac_cv_readline_rl_startup_hook_takes_args+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #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 + + extern int test_hook_func(const char *text, int state); +int +main (void) +{ +rl_startup_hook=test_hook_func; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_readline_rl_startup_hook_takes_args=yes +else $as_nop + ac_cv_readline_rl_startup_hook_takes_args=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_readline_rl_startup_hook_takes_args" >&5 +printf "%s\n" "$ac_cv_readline_rl_startup_hook_takes_args" >&6; } + if test "x$ac_cv_readline_rl_startup_hook_takes_args" = xyes +then : + + +printf "%s\n" "#define Py_RL_STARTUP_HOOK_TAKES_ARGS 1" >>confdefs.h + + +fi + CFLAGS=$save_CFLAGS |