diff options
| -rw-r--r-- | acconfig.h | 3 | ||||
| -rw-r--r-- | configure.ac | 19 | ||||
| -rw-r--r-- | signal.c | 8 |
3 files changed, 24 insertions, 6 deletions
@@ -52,6 +52,9 @@ /* Define if you want to use GNU readline. */ #undef READLINE +/* Define if you have the older readline, with rl_deprep_terminal. */ +#undef READLINE_OLD + /* Define if RLIMIT_foo defines need _KERNEL. */ #undef RLIMIT_NEEDS_KERNEL diff --git a/configure.ac b/configure.ac index adf8de9..7fcc48a 100644 --- a/configure.ac +++ b/configure.ac @@ -290,12 +290,21 @@ AC_ARG_WITH(editline, [ --with-editline Simmule Turner's line editing], AC_DEFINE(EDITLINE) LIBS="$LIBS -ledit", AC_MSG_WARN(editline library not found))) -AC_ARG_WITH(readline, [ --with-readline Bloated GNU line editing], - AC_CHECK_LIB(readline, readline, [ +dnl Getting readline right is hard. There are (at least) two incompatible versions, +dnl and we need to know which one we are using. There are also two different +dnl names for the include files. +AC_ARG_WITH(readline, [ --with-readline Bloated GNU line editing], [ + AC_CHECK_LIB(readline, rl_deprep_terminal, [ + AC_DEFINE(READLINE) + AC_DEFINE(READLINE_OLD) + ], [ + AC_CHECK_LIB(readline, readline, [ AC_DEFINE(READLINE) - LIBS="$LIBS -lreadline -ltermcap" - AC_CHECK_HEADERS(readline.h readline/readline.h) - ], AC_MSG_WARN(readline library not found), -ltermcap)) + ], AC_MSG_WARN(readline library not found), -ltermcap) + ], -ltermcap) + LIBS="$LIBS -lreadline -ltermcap" + AC_CHECK_HEADERS(readline.h readline/readline.h) +]) AM_CONDITIONAL(AMC_READLINE, test "${with_readline+set}" = set) AC_OUTPUT(Makefile) @@ -28,10 +28,16 @@ extern void catcher(int s) { in_readline = FALSE; switch (s) { extern int rl_pending_input; - + extern VFunction *rl_deprep_term_function; + default: +#if READLINE_OLD rl_clean_up_for_exit(); rl_deprep_terminal(); +#else + _rl_clean_up_for_exit(); + (*rl_deprep_term_function)(); +#endif rl_clear_signals(); rl_pending_input = 0; break; |