3 # AMANDA_CHECK_READLINE
7 # Check for readline support. Defines HAVE_READLINE if readline
8 # is available, and also checks for a number of readline headers and
9 # adds readline libraries to READLINE_LIBS.
11 # See common-src/util.{c,h}.
13 AC_DEFUN([AMANDA_CHECK_READLINE], [
15 dnl no initial space here, so the results line up properly
16 AS_HELP_STRING([--with-readline], [require readline support (for amrecover)])
17 AS_HELP_STRING([--without-readline], [don't search for readline]),
20 y | ye | yes | n | no) : ;;
21 *) AC_MSG_ERROR([*** --with-readline does not take a value])
23 want_readline="$withval"
25 want_readline="maybe" # meaning "only if we can find it"
28 # unless the user said "no", look for readline.
29 if test x"$want_readline" != x"no"; then
30 # we need a tgetent() somewhere..
32 AC_CHECK_LIB(termcap, tgetent, [
33 READLINE_LIBS="-ltermcap"
36 AC_CHECK_LIB(curses, tgetent, [
37 READLINE_LIBS="-lcurses"
40 AC_CHECK_LIB(ncurses, tgetent, [
41 READLINE_LIBS="-lncurses"
49 AC_CHECK_HEADERS( history.h readline.h readline/history.h readline/readline.h, [
50 # found at least one of the headers, so we can proceed.
57 AC_CHECK_LIB(readline,readline, [
58 READLINE_LIBS="-lreadline $READLINE_LIBS"
65 AC_DEFINE(HAVE_READLINE, 1, [System has readline support (headers and libraries)])
67 # no readline. if the user *really* wanted it, bail out.
68 if test x"$want_readline" = x"yes"; then
69 AC_MSG_ERROR([*** No readline implementation found. Try using --with-libraries and --with-includes])
74 AC_SUBST(READLINE_LIBS)