Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix compilation against readline-6.3
This is a squashed cherry-pick of the following commits:

  10f60e4
  6648136
  d2a8e28

They fix a problem where ruby cannot compile against
readline-6.3, because upstream dropped support for
"Function" in favor of rl_hook_func_t. This version of
readline is present, e.g., on Debian unstable.
  • Loading branch information
peff committed Apr 8, 2014
commit 510aad5abd366bad75355ed79c991ba86daa2b09
11 changes: 11 additions & 0 deletions ext/readline/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ def readline.have_func(func)
return super(func, headers)
end

def readline.have_type(type)
return super(type, headers)
end

dir_config('curses')
dir_config('ncurses')
dir_config('termcap')
Expand Down Expand Up @@ -94,4 +98,11 @@ def readline.have_func(func)
readline.have_func("rl_redisplay")
readline.have_func("rl_insert_text")
readline.have_func("rl_delete_text")
unless readline.have_type("rl_hook_func_t*")
# rl_hook_func_t is available since readline-4.2 (2001).
# Function is removed at readline-6.3 (2014).
# However, editline (NetBSD 6.1.3, 2014) doesn't have rl_hook_func_t.
$defs << "-Drl_hook_func_t=Function"
end

create_makefile("readline")
2 changes: 1 addition & 1 deletion ext/readline/readline.c
Original file line number Diff line number Diff line change
Expand Up @@ -1974,7 +1974,7 @@ Init_readline()

rl_attempted_completion_function = readline_attempted_completion_function;
#if defined(HAVE_RL_PRE_INPUT_HOOK)
rl_pre_input_hook = (Function *)readline_pre_input_hook;
rl_pre_input_hook = (rl_hook_func_t *)readline_pre_input_hook;
#endif
#ifdef HAVE_RL_CATCH_SIGNALS
rl_catch_signals = 0;
Expand Down