+dnl Usage: GINAC_TERMCAP
+dnl libreadline is based on the termcap functions.
+dnl Some systems have tgetent(), tgetnum(), tgetstr(), tgetflag(), tputs(),
+dnl tgoto() in libc, some have it in libtermcap, some have it in libncurses.
+dnl When both libtermcap and libncurses exist, we prefer the latter, because
+dnl libtermcap is being phased out.
+AC_DEFUN(GINAC_TERMCAP,
+[LIBTERMCAP=
+AC_CHECK_FUNCS(tgetent)
+if test "x$ac_cv_func_tgetent" = "xyes"; then
+ :
+else
+ AC_CHECK_LIB(ncurses, tgetent, LIBTERMCAP="-lncurses")
+ if test -z "$LIBTERMCAP"; then
+ AC_CHECK_LIB(termcap, tgetent, LIBTERMCAP="-ltermcap")
+ fi
+fi
+AC_SUBST(LIBTERMCAP)
+])
+