empserver/m4/my_lib_readline.m4
Markus Armbruster 1cbda2c7dd 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>
2017-08-06 11:22:29 +02:00

25 lines
737 B
Text

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
])