client: Rewrite readline configuration
AX_LIB_READLINE tries to cope with systems where readline lacks history support, or lacks headers, or needs headers included in unorthodox ways. It puts six HAVE_ macros into config.h, and its usage example takes 24 lines of code just to include two headers. Way too complicated for my taste. Replace with new MY_LIB_READLINE, which succeeds only when you have a sane readline, and then defines *one* macro: HAVE_LIBREADLINE. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
60fee0e6ae
commit
1cbda2c7dd
7 changed files with 35 additions and 140 deletions
25
m4/my_lib_readline.m4
Normal file
25
m4/my_lib_readline.m4
Normal file
|
@ -0,0 +1,25 @@
|
|||
AC_DEFUN([MY_LIB_READLINE], [
|
||||
have_readline=no
|
||||
for readline_lib in readline edit editline; do
|
||||
for termcap_lib in "" termlib termcap curses ncurses; do
|
||||
AC_CHECK_LIB([$readline_lib], [add_history],
|
||||
[have_readline=yes; break 2], [], [$termcap_lib])
|
||||
done
|
||||
done
|
||||
|
||||
if test "$have_readline" = yes; then
|
||||
AC_CHECK_HEADER([readline/readline.h], [], [have_readline=no],
|
||||
[AC_INCLUDES_DEFAULT])
|
||||
AC_CHECK_HEADER([readline/history.h], [], [have_readline=no],
|
||||
[AC_INCLUDES_DEFAULT])
|
||||
fi
|
||||
|
||||
if test "$have_readline" = yes; then
|
||||
if test "x$termcap_lib" != x; then
|
||||
LIBS="-l$termcap_lib $LIBS"
|
||||
fi
|
||||
LIBS="-l$readline_lib $LIBS"
|
||||
AC_DEFINE([HAVE_LIBREADLINE], [1],
|
||||
[Define if you have libreadline])
|
||||
fi
|
||||
])
|
Loading…
Add table
Add a link
Reference in a new issue