1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
require "mkmf"
readline = Struct.new(:headers, :extra_check).new(["stdio.h"])
def readline.have_header(header)
if super(header, &extra_check)
headers.push(header)
return true
else
return false
end
end
def readline.have_var(var)
return super(var, headers)
end
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')
dir_config("readline")
enable_libedit = enable_config("libedit")
have_library("user32", nil) if /cygwin/ === RUBY_PLATFORM
have_library("ncurses", "tgetnum") ||
have_library("termcap", "tgetnum") ||
have_library("curses", "tgetnum")
case enable_libedit
when true
# --enable-libedit
unless (readline.have_header("editline/readline.h") ||
readline.have_header("readline/readline.h")) &&
have_library("edit", "readline")
raise "libedit not found"
end
when false
# --disable-libedit
unless ((readline.have_header("readline/readline.h") &&
readline.have_header("readline/history.h")) &&
have_library("readline", "readline"))
raise "readline not found"
end
else
# does not specify
unless ((readline.have_header("readline/readline.h") &&
readline.have_header("readline/history.h")) &&
(have_library("readline", "readline") ||
have_library("edit", "readline"))) ||
(readline.have_header("editline/readline.h") &&
have_library("edit", "readline"))
raise "readline nor libedit not found"
end
end
readline.have_func("rl_getc")
readline.have_func("rl_getc_function")
readline.have_func("rl_filename_completion_function")
readline.have_func("rl_username_completion_function")
readline.have_func("rl_completion_matches")
readline.have_func("rl_refresh_line")
readline.have_var("rl_deprep_term_function")
readline.have_var("rl_completion_append_character")
readline.have_var("rl_basic_word_break_characters")
readline.have_var("rl_completer_word_break_characters")
readline.have_var("rl_basic_quote_characters")
readline.have_var("rl_completer_quote_characters")
readline.have_var("rl_filename_quote_characters")
readline.have_var("rl_attempted_completion_over")
readline.have_var("rl_library_version")
readline.have_var("rl_editing_mode")
readline.have_var("rl_line_buffer")
readline.have_var("rl_point")
# workaround for native windows.
/mswin|bccwin|mingw/ !~ RUBY_PLATFORM && readline.have_var("rl_event_hook")
/mswin|bccwin|mingw/ !~ RUBY_PLATFORM && readline.have_var("rl_catch_sigwinch")
/mswin|bccwin|mingw/ !~ RUBY_PLATFORM && readline.have_var("rl_catch_signals")
readline.have_var("rl_pre_input_hook")
readline.have_var("rl_special_prefixes")
readline.have_func("rl_cleanup_after_signal")
readline.have_func("rl_free_line_state")
readline.have_func("rl_clear_signals")
readline.have_func("rl_set_screen_size")
readline.have_func("rl_get_screen_size")
readline.have_func("rl_vi_editing_mode")
readline.have_func("rl_emacs_editing_mode")
readline.have_func("replace_history_entry")
readline.have_func("remove_history")
readline.have_func("clear_history")
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
$INCFLAGS << " -I$(top_srcdir)"
create_makefile("readline")
|