1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

Detect libreadline>=4.0, and set HAVE_NEW_LIBREADLINE. At the moment

this is only to get the cast right, but it might help with other parts
of the API that changed later.
This commit is contained in:
Martin Pool -
parent 4b7c0c9928
commit b792c9317a
4 changed files with 559 additions and 495 deletions

1025
source/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -483,6 +483,15 @@ AC_ARG_WITH(readline,
AC_SUBST(TERMLIBS) AC_SUBST(TERMLIBS)
AC_SUBST(TERMLDFLAGS) AC_SUBST(TERMLDFLAGS)
# The readline API changed slightly from readline3 to readline4, so
# code will generate warnings on one of them unless we have a few
# special cases.
AC_CHECK_LIB(readline, rl_completion_matches,
[AC_DEFINE(HAVE_NEW_LIBREADLINE, 1,
[Do we have rl_completion_matches?])],
[],
[$TERMLIBS])
# The following test taken from the cvs sources # The following test taken from the cvs sources
# If we can't find connect, try looking in -lsocket, -lnsl, and -linet. # If we can't find connect, try looking in -lsocket, -lnsl, and -linet.
# The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has # The Irix 5 libc.so has connect and gethostbyname, but Irix 5 also has

View File

@ -1,4 +1,4 @@
/* include/config.h.in. Generated automatically from configure.in by autoheader. */ /* include/config.h.in. Generated automatically from configure.in by autoheader 2.13. */
/* Define if on AIX 3. /* Define if on AIX 3.
System headers sometimes define this. System headers sometimes define this.
@ -1050,6 +1050,9 @@
/* Define if you have the socket library (-lsocket). */ /* Define if you have the socket library (-lsocket). */
#undef HAVE_LIBSOCKET #undef HAVE_LIBSOCKET
/* Do we have rl_completion_matches? */
#undef HAVE_NEW_LIBREADLINE
/* Define if you have working AF_LOCAL sockets */ /* Define if you have working AF_LOCAL sockets */
#undef HAVE_WORKING_AF_LOCAL #undef HAVE_WORKING_AF_LOCAL

View File

@ -22,6 +22,13 @@
#include "includes.h" #include "includes.h"
#ifdef HAVE_NEW_LIBREADLINE
# define RL_COMPLETION_CAST (rl_completion_func_t *)
#else
/* This type is missing from libreadline<4.0 (approximately) */
# define RL_COMPLETION_FUNC_T
#endif /* HAVE_NEW_LIBREADLINE */
/**************************************************************************** /****************************************************************************
display the prompt and wait for input. Call callback() regularly display the prompt and wait for input. Call callback() regularly
@ -76,11 +83,9 @@ char *smb_readline(char *prompt, void (*callback)(void),
/* The callback prototype has changed slightly between /* The callback prototype has changed slightly between
different versions of Readline, so the same function different versions of Readline, so the same function
works in all of them to date, but we get compiler works in all of them to date, but we get compiler
warnings in some. NOTE: that not all versions of warnings in some. */
readline have rl_completion_func_t so attempting to cast rl_attempted_completion_function = RL_COMPLETION_CAST
the statement below to get rid of the warning will not completion_fn;
compile for everyone. */
rl_attempted_completion_function = completion_fn;
} }
if (callback) rl_event_hook = (Function *)callback; if (callback) rl_event_hook = (Function *)callback;