Change soft-fail to use the config, rather than env
[rbx.git] / stdlib / ext / readline / extconf.rb
blobb57a36f3a58a42d537aba0e8e82fa83ffabf222d
1 require "mkmf"
3 $readline_headers = ["stdio.h"]
5 def have_readline_header(header)
6   if have_header(header)
7     $readline_headers.push(header)
8     return true
9   else
10     return false
11   end
12 end
14 def have_readline_var(var)
15   return have_var(var, $readline_headers)
16 end
18 dir_config('curses')
19 dir_config('ncurses')
20 dir_config('termcap')
21 dir_config("readline")
22 enable_libedit = enable_config("libedit")
23 have_library("user32", nil) if /cygwin/ === RUBY_PLATFORM
24 have_library("ncurses", "tgetnum") ||
25   have_library("termcap", "tgetnum") ||
26   have_library("curses", "tgetnum")
28 if enable_libedit
29   unless (have_readline_header("editline/readline.h") ||
30           have_readline_header("readline/readline.h")) &&
31           have_library("edit", "readline")
32     exit
33   end
34 else
35   unless ((have_readline_header("readline/readline.h") &&
36            have_readline_header("readline/history.h")) &&
37            (have_library("readline", "readline") ||
38             have_library("edit", "readline"))) ||
39             (have_readline_header("editline/readline.h") &&
40              have_library("edit", "readline"))
41     exit
42   end
43 end
45 have_readline_var("rl_filename_completion_function")
46 have_readline_var("rl_username_completion_function")
47 have_readline_var("rl_completion_matches")
48 have_readline_var("rl_deprep_term_function")
49 have_readline_var("rl_completion_append_character")
50 have_readline_var("rl_basic_word_break_characters")
51 have_readline_var("rl_completer_word_break_characters")
52 have_readline_var("rl_basic_quote_characters")
53 have_readline_var("rl_completer_quote_characters")
54 have_readline_var("rl_filename_quote_characters")
55 have_readline_var("rl_attempted_completion_over")
56 have_readline_var("rl_library_version")
57 have_readline_var("rl_event_hook")
58 have_func("rl_cleanup_after_signal")
59 have_func("rl_clear_signals")
60 have_func("rl_vi_editing_mode")
61 have_func("rl_emacs_editing_mode")
62 have_func("rl_clear_signals")
63 have_func("replace_history_entry")
64 have_func("remove_history")
65 create_makefile("readline")