X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=config%2Famanda%2Freadline.m4;fp=config%2Famanda%2Freadline.m4;h=dbf8be5ed943d088eec73756ce507b50f9ff65be;hb=94a044f90357edefa6f4ae9f0b1d5885b0e34aee;hp=0000000000000000000000000000000000000000;hpb=d3b2175e084f88c8736ad7073eacbf4670147aec;p=debian%2Famanda diff --git a/config/amanda/readline.m4 b/config/amanda/readline.m4 new file mode 100644 index 0000000..dbf8be5 --- /dev/null +++ b/config/amanda/readline.m4 @@ -0,0 +1,75 @@ +# SYNOPSIS +# +# AMANDA_CHECK_READLINE +# +# OVERVIEW +# +# Check for readline support. Defines HAVE_READLINE if readline +# is available, and also checks for a number of readline headers and +# adds readline libraries to READLINE_LIBS. +# +# See common-src/util.{c,h}. +# +AC_DEFUN([AMANDA_CHECK_READLINE], [ + AC_ARG_WITH(readline, + dnl no initial space here, so the results line up properly +AS_HELP_STRING([--with-readline], [require readline support (for amrecover)]) +AS_HELP_STRING([--without-readline], [don't search for readline]), + [ + case "$withval" in + y | ye | yes | n | no) : ;; + *) AC_MSG_ERROR([*** --with-readline does not take a value]) + esac + want_readline="$withval" + ], [ + want_readline="maybe" # meaning "only if we can find it" + ]) + + # unless the user said "no", look for readline. + if test x"$want_readline" != x"no"; then + # we need a tgetent() somewhere.. + proceed="false" + AC_CHECK_LIB(termcap, tgetent, [ + READLINE_LIBS="-ltermcap" + proceed="true" + ], [ + AC_CHECK_LIB(curses, tgetent, [ + READLINE_LIBS="-lcurses" + proceed="true" + ], [ + AC_CHECK_LIB(ncurses, tgetent, [ + READLINE_LIBS="-lncurses" + proceed="true" + ]) + ]) + ]) + + if $proceed; then + proceed="false" + AC_CHECK_HEADERS( history.h readline.h readline/history.h readline/readline.h, [ + # found at least one of the headers, so we can proceed. + proceed="true" + ]) + fi + + if $proceed; then + proceed="false" + AC_CHECK_LIB(readline,readline, [ + READLINE_LIBS="-lreadline $READLINE_LIBS" + proceed="true" + ],,$READLINE_LIBS) + fi + + if $proceed; then + # we have readline! + AC_DEFINE(HAVE_READLINE, 1, [System has readline support (headers and libraries)]) + else + # no readline. if the user *really* wanted it, bail out. + if test x"$want_readline" = x"yes"; then + AC_MSG_ERROR([*** No readline implementation found. Try using --with-libraries and --with-includes]) + fi + READLINE_LIBS="" + fi + fi + AC_SUBST(READLINE_LIBS) +])