1999-01-19 23:59:32 -05:00
|
|
|
require "mkmf"
|
|
|
|
|
2005-05-19 10:36:20 -04:00
|
|
|
$readline_headers = ["stdio.h"]
|
|
|
|
|
|
|
|
def have_readline_header(header)
|
2010-05-31 14:48:16 -04:00
|
|
|
if have_header(header, &$readline_extra_check)
|
2005-05-19 10:36:20 -04:00
|
|
|
$readline_headers.push(header)
|
|
|
|
return true
|
|
|
|
else
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def have_readline_var(var)
|
|
|
|
return have_var(var, $readline_headers)
|
|
|
|
end
|
|
|
|
|
2008-06-22 01:16:30 -04:00
|
|
|
def have_readline_func(func)
|
|
|
|
return have_func(func, $readline_headers)
|
|
|
|
end
|
|
|
|
|
2011-01-12 02:26:15 -05:00
|
|
|
def have_readline_macro(macro)
|
|
|
|
return have_macro(macro, $readline_headers)
|
|
|
|
end
|
|
|
|
|
2004-07-15 10:04:09 -04:00
|
|
|
dir_config('curses')
|
|
|
|
dir_config('ncurses')
|
|
|
|
dir_config('termcap')
|
1999-08-13 01:37:52 -04:00
|
|
|
dir_config("readline")
|
2005-05-19 10:36:20 -04:00
|
|
|
enable_libedit = enable_config("libedit")
|
2010-05-31 14:48:16 -04:00
|
|
|
|
2000-05-13 12:13:31 -04:00
|
|
|
have_library("user32", nil) if /cygwin/ === RUBY_PLATFORM
|
2005-05-19 10:36:20 -04:00
|
|
|
have_library("ncurses", "tgetnum") ||
|
|
|
|
have_library("termcap", "tgetnum") ||
|
2000-05-18 00:32:13 -04:00
|
|
|
have_library("curses", "tgetnum")
|
|
|
|
|
2011-04-12 05:08:08 -04:00
|
|
|
case enable_libedit
|
|
|
|
when true
|
2005-05-19 10:36:20 -04:00
|
|
|
unless (have_readline_header("editline/readline.h") ||
|
|
|
|
have_readline_header("readline/readline.h")) &&
|
|
|
|
have_library("edit", "readline")
|
|
|
|
exit
|
2001-09-06 01:14:06 -04:00
|
|
|
end
|
2011-04-12 05:08:08 -04:00
|
|
|
when nil
|
|
|
|
unless ((have_readline_header("readline/readline.h") &&
|
|
|
|
have_readline_header("readline/history.h")) &&
|
|
|
|
have_library("readline", "readline"))
|
|
|
|
exit
|
|
|
|
end
|
2005-05-19 10:36:20 -04:00
|
|
|
else
|
|
|
|
unless ((have_readline_header("readline/readline.h") &&
|
|
|
|
have_readline_header("readline/history.h")) &&
|
|
|
|
(have_library("readline", "readline") ||
|
|
|
|
have_library("edit", "readline"))) ||
|
|
|
|
(have_readline_header("editline/readline.h") &&
|
|
|
|
have_library("edit", "readline"))
|
|
|
|
exit
|
2001-09-06 01:14:06 -04:00
|
|
|
end
|
1999-01-19 23:59:32 -05:00
|
|
|
end
|
2005-05-19 10:36:20 -04:00
|
|
|
|
2010-08-16 18:50:40 -04:00
|
|
|
have_readline_func("rl_getc")
|
2009-04-26 12:25:15 -04:00
|
|
|
have_readline_func("rl_getc_function")
|
2008-06-22 01:16:30 -04:00
|
|
|
have_readline_func("rl_filename_completion_function")
|
|
|
|
have_readline_func("rl_username_completion_function")
|
|
|
|
have_readline_func("rl_completion_matches")
|
2009-07-10 09:03:40 -04:00
|
|
|
have_readline_func("rl_refresh_line")
|
2005-05-19 10:36:20 -04:00
|
|
|
have_readline_var("rl_deprep_term_function")
|
|
|
|
have_readline_var("rl_completion_append_character")
|
|
|
|
have_readline_var("rl_basic_word_break_characters")
|
|
|
|
have_readline_var("rl_completer_word_break_characters")
|
|
|
|
have_readline_var("rl_basic_quote_characters")
|
|
|
|
have_readline_var("rl_completer_quote_characters")
|
|
|
|
have_readline_var("rl_filename_quote_characters")
|
|
|
|
have_readline_var("rl_attempted_completion_over")
|
|
|
|
have_readline_var("rl_library_version")
|
2008-08-11 04:31:45 -04:00
|
|
|
have_readline_var("rl_editing_mode")
|
2009-07-10 08:13:18 -04:00
|
|
|
have_readline_var("rl_line_buffer")
|
|
|
|
have_readline_var("rl_point")
|
2008-02-20 09:43:39 -05:00
|
|
|
# workaround for native windows.
|
|
|
|
/mswin|bccwin|mingw/ !~ RUBY_PLATFORM && have_readline_var("rl_event_hook")
|
2009-07-17 09:31:00 -04:00
|
|
|
/mswin|bccwin|mingw/ !~ RUBY_PLATFORM && have_readline_var("rl_catch_sigwinch")
|
2009-07-17 11:26:30 -04:00
|
|
|
/mswin|bccwin|mingw/ !~ RUBY_PLATFORM && have_readline_var("rl_catch_signals")
|
2008-06-22 01:16:30 -04:00
|
|
|
have_readline_func("rl_cleanup_after_signal")
|
2010-08-16 18:50:40 -04:00
|
|
|
have_readline_func("rl_free_line_state")
|
2008-06-22 01:16:30 -04:00
|
|
|
have_readline_func("rl_clear_signals")
|
2009-02-03 07:21:08 -05:00
|
|
|
have_readline_func("rl_set_screen_size")
|
|
|
|
have_readline_func("rl_get_screen_size")
|
2008-06-22 01:16:30 -04:00
|
|
|
have_readline_func("rl_vi_editing_mode")
|
|
|
|
have_readline_func("rl_emacs_editing_mode")
|
|
|
|
have_readline_func("replace_history_entry")
|
|
|
|
have_readline_func("remove_history")
|
2008-08-01 11:04:37 -04:00
|
|
|
have_readline_func("clear_history")
|
2011-01-12 02:26:15 -05:00
|
|
|
have_readline_macro("RL_PROMPT_START_IGNORE")
|
|
|
|
have_readline_macro("RL_PROMPT_END_IGNORE")
|
2005-05-19 10:36:20 -04:00
|
|
|
create_makefile("readline")
|