AC_MSG_CHECKING([whether user requested readline support])
LIBREADLINE=
have_libreadline=0
+readline_compentry_func_returns_charp=0
READLINE_LIBS=
if test "$with_readline" = no; then
AC_MSG_RESULT([no, readline disabled by user])
fi
if test "$with_readline" = yes; then
have_libreadline=1
+ AC_MSG_CHECKING([for type of rl_completion_entry_function])
+ AC_LANG_PUSH([C++])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
+#include <readline/readline.h>
+char* foo(const char*, int) { return (char*)0; }],[
+::rl_completion_entry_function = foo;])],
+ [AC_MSG_RESULT([char* (*)(const char*, int)])
+ readline_compentry_func_returns_charp=1],
+ [AC_MSG_FAILURE([Function])])
+ AC_LANG_POP([C++])
else
have_libreadline=0
READLINE_LIBS=
AC_ARG_WITH([readline], [AS_HELP_STRING([--with-readline], [support the readline library])], [], [with_readline=check])
CVC4_CHECK_FOR_READLINE
AC_DEFINE_UNQUOTED([HAVE_LIBREADLINE], $have_libreadline, [Define to 1 to use libreadline])
+AC_DEFINE_UNQUOTED([READLINE_COMPENTRY_FUNC_RETURNS_CHARP], $readline_compentry_func_returns_charp, [Define to 1 if rl_completion_entry_function is declared to return pointer to char])
AC_SUBST([READLINE_LIBS])
AC_SEARCH_LIBS([clock_gettime], [rt],
#if HAVE_LIBREADLINE
if(d_in == cin) {
- ::rl_readline_name = "CVC4";
+ ::rl_readline_name = const_cast<char*>("CVC4");
+#if READLINE_COMPENTRY_FUNC_RETURNS_CHARP
::rl_completion_entry_function = commandGenerator;
+#else /* READLINE_COMPENTRY_FUNC_RETURNS_CHARP */
+ ::rl_completion_entry_function = (Function) commandGenerator;
+#endif /* READLINE_COMPENTRY_FUNC_RETURNS_CHARP */
::using_history();
switch(OutputLanguage lang = toOutputLanguage(d_options[options::inputLanguage])) {