summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortgoodwin <tgoodwin>1998-07-13 10:22:06 +0000
committerToby Goodwin <toby@paccrat.org>2015-05-16 21:23:08 +0100
commit75b4f0440f1e83b020e17b0d09dafe37dbf7e4ee (patch)
treeb70bfedb865cfe5118679a9205926b293cd92711
parent769ce647bc9079b54d745d4e56c790622aff0d57 (diff)
add READLINE_OLD
-rw-r--r--acconfig.h3
-rw-r--r--configure.ac19
-rw-r--r--signal.c8
3 files changed, 24 insertions, 6 deletions
diff --git a/acconfig.h b/acconfig.h
index e194b78..96b5432 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -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)
diff --git a/signal.c b/signal.c
index 876f069..22ea2a4 100644
--- a/signal.c
+++ b/signal.c
@@ -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;