m4/my_lib_readline: Fix check for additional libraries
MY_LIB_READLINE tries each readline-compatible library with a sequence
of additional libraries, starting with none. If the check with none
fails, all the others checks reuse the cached result, and also fail.
Broken in commit 1cbda2c7d
"client: Rewrite readline configuration",
v4.4.0.
Avoid the unwanted chaching.
Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
55c1d29efe
commit
55ff9cce09
1 changed files with 40 additions and 28 deletions
|
@ -1,31 +1,39 @@
|
||||||
AC_DEFUN([MY_LIB_READLINE], [
|
AC_DEFUN([MY_LIB_READLINE], [
|
||||||
have_readline=no
|
AC_CACHE_CHECK([for a readline compatible library],
|
||||||
|
my_cv_lib_readline, [
|
||||||
|
my_lib_readline_save_LIBS="$LIBS"
|
||||||
for readline_lib in readline edit editline; do
|
for readline_lib in readline edit editline; do
|
||||||
for termcap_lib in "" termlib termcap curses ncurses; do
|
for termcap_lib in "" termlib termcap curses ncurses; do
|
||||||
AC_CHECK_LIB([$readline_lib], [add_history],
|
if test -z "$termcap_lib"; then
|
||||||
[have_readline=yes; break 2], [], [$termcap_lib])
|
my_cv_lib_readline="-l$readline_lib"
|
||||||
|
else
|
||||||
|
my_cv_lib_readline="-l$readline_lib -l$termcap_lib"
|
||||||
|
fi
|
||||||
|
LIBS="$my_cv_lib_readline $my_lib_readline_save_LIBS"
|
||||||
|
AC_LINK_IFELSE([AC_LANG_CALL([], [add_history])],
|
||||||
|
[break 2], [my_cv_lib_readline=no])
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
])
|
||||||
|
|
||||||
if test "$have_readline" = yes; then
|
if test "$my_cv_lib_readline" != no; then
|
||||||
AC_CHECK_HEADER([readline/readline.h], [], [have_readline=no],
|
AC_CHECK_HEADER([readline/readline.h], [], [my_cv_lib_readline=no],
|
||||||
[AC_INCLUDES_DEFAULT])
|
[AC_INCLUDES_DEFAULT])
|
||||||
AC_CHECK_HEADER([readline/history.h], [], [have_readline=no],
|
fi
|
||||||
|
if test "$my_cv_lib_readline" != no; then
|
||||||
|
AC_CHECK_HEADER([readline/history.h], [], [my_cv_lib_readline=no],
|
||||||
[AC_INCLUDES_DEFAULT])
|
[AC_INCLUDES_DEFAULT])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$have_readline" = yes; then
|
if test "$my_cv_lib_readline" = no; then
|
||||||
if test "x$termcap_lib" != x; then
|
LIBS="$my_lib_readline_save_LIBS"
|
||||||
LIBS="-l$termcap_lib $LIBS"
|
else
|
||||||
fi
|
|
||||||
LIBS="-l$readline_lib $LIBS"
|
|
||||||
AC_DEFINE([HAVE_LIBREADLINE], [1],
|
AC_DEFINE([HAVE_LIBREADLINE], [1],
|
||||||
[Define if you have libreadline])
|
[Define if you have libreadline])
|
||||||
fi
|
fi
|
||||||
])
|
])
|
||||||
|
|
||||||
AC_DEFUN([MY_WITH_READLINE],
|
AC_DEFUN([MY_WITH_READLINE], [
|
||||||
[
|
|
||||||
AC_ARG_WITH([readline],
|
AC_ARG_WITH([readline],
|
||||||
[AS_HELP_STRING([--with-readline],
|
[AS_HELP_STRING([--with-readline],
|
||||||
[support fancy command line editing @<:@default=check@:>@])],
|
[support fancy command line editing @<:@default=check@:>@])],
|
||||||
|
@ -33,8 +41,12 @@ AC_DEFUN([MY_WITH_READLINE],
|
||||||
[with_readline=check])
|
[with_readline=check])
|
||||||
if test "x$with_readline" != xno; then
|
if test "x$with_readline" != xno; then
|
||||||
MY_LIB_READLINE
|
MY_LIB_READLINE
|
||||||
if test "x$have_readline$with_readline" = xnoyes; then
|
if test "x$my_cv_lib_readline$with_readline" = xnoyes; then
|
||||||
AC_MSG_FAILURE([--with-readline was given, but test for readline failed])
|
AC_MSG_FAILURE([--with-readline was given, but test for readline failed])
|
||||||
fi
|
fi
|
||||||
with_readline="$have_readline"
|
if test "$my_cv_lib_readline" = no; then
|
||||||
|
with_readline=no
|
||||||
|
else
|
||||||
|
with_readline=yes
|
||||||
|
fi
|
||||||
fi])
|
fi])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue