summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/smbreadline/readline.m43
-rw-r--r--source4/lib/smbreadline/smbreadline.c2
2 files changed, 5 insertions, 0 deletions
diff --git a/source4/lib/smbreadline/readline.m4 b/source4/lib/smbreadline/readline.m4
index e19f0a1744..4eebd13b5a 100644
--- a/source4/lib/smbreadline/readline.m4
+++ b/source4/lib/smbreadline/readline.m4
@@ -68,6 +68,9 @@ AC_CHECK_LIB(readline, rl_completion_matches,
[],
[$TERMLIBS])
+# not all readline libs have rl_event_hook
+AC_CHECK_DECLS(rl_event_hook, [], [], [#include <readline/readline.h>])
+
AC_MSG_CHECKING(whether to use extern readline)
if test x"$EXTERNAL_READLINE" = x"yes"; then
AC_MSG_RESULT(yes)
diff --git a/source4/lib/smbreadline/smbreadline.c b/source4/lib/smbreadline/smbreadline.c
index 3d046f6099..6b8e54e1e3 100644
--- a/source4/lib/smbreadline/smbreadline.c
+++ b/source4/lib/smbreadline/smbreadline.c
@@ -127,8 +127,10 @@ char *smb_readline(const char *prompt, void (*callback)(void),
rl_attempted_completion_function = RL_COMPLETION_CAST completion_fn;
}
+#if HAVE_DECL_RL_EVENT_HOOK
if (callback)
rl_event_hook = (Function *)callback;
+#endif
ret = readline(prompt);
if (ret && *ret)
add_history(ret);