#ifdef LE_EDITLINE
- static EditLine * ntp_el;
- static History * ntp_hist;
- static HistEvent hev;
-
- char * ntp_prompt_callback(EditLine *);
+# ifndef H_SETSIZE
+# define H_SETSIZE H_EVENT
+# endif
+static EditLine * ntp_el;
+static History * ntp_hist;
+static HistEvent hev;
+
+char * ntp_prompt_callback(EditLine *);
#endif /* LE_EDITLINE */
#ifdef LE_EDITLINE
if (NULL == ntp_el) {
+# if 4 == EL_INIT_ARGS
ntp_el = el_init(progname, stdin, stdout, stderr);
+# else
+ ntp_el = el_init(progname, stdin, stdout);
+# endif
if (ntp_el) {
el_set(ntp_el, EL_PROMPT, ntp_prompt_callback);
success = 0;
} else {
- memset(&hev, 0, sizeof hev);
-
- history(ntp_hist, &hev, H_SETSIZE, 128);
-
- el_set(ntp_el, EL_HIST, history, ntp_hist);
-
+ memset(&hev, 0, sizeof(hev));
+#ifdef H_SETSIZE
+ history(ntp_hist, &hev, H_SETSIZE, 128);
+#endif
+ el_set(ntp_el, EL_HIST, history,
+ ntp_hist);
/* use any .editrc */
el_source(ntp_el, NULL);
}
*)
AC_CHECK_HEADERS([readline.h readline/readline.h histedit.h])
AC_CHECK_HEADERS([history.h readline/history.h])
+
+ case "$ac_cv_header_histedit_h" in
+ yes)
+ AC_CACHE_CHECK(
+ [number of arguments to el_init()],
+ [ntp_cv_el_init_args],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[
+ #include <stdio.h>
+ #include <histedit.h>
+ ]],
+ [[
+ el_init("conftest", stdin, stdout, stderr);
+ ]]
+ )],
+ [ntp_cv_el_init_args=4],
+ [ntp_cv_el_init_args=3]
+ )]
+ )
+ AC_DEFINE_UNQUOTED(
+ [EL_INIT_ARGS],
+ [$ntp_cv_el_init_args],
+ [number of args to el_init()]
+ )
+ esac
AC_MSG_CHECKING([whether readline supports history])