+AS_IF([test "$with_tty" != "no"],[
+ AS_MESSAGE(checking for TTY-related features)
+ dnl Check if needed calls are available at all...
+ tty_libs="ncurses curses terminfo termlib termcap"
+ tty_funcs="tgetent tgetstr tgetflag tparm tgoto tputs"
+ for func in $tty_funcs; do
+ AC_SEARCH_LIBS($func,$tty_libs)
+ done
+ AS_IF([test "$ac_cv_search_tgetent" = "no" -a \
+ "$ac_cv_search_tgetflag" = "no" -a \
+ "$ac_cv_search_tgetstr" = "no" -a \
+ "$ac_cv_search_tgoto" = "no" -a \
+ "$ac_cv_search_tparm" = "no" -a \
+ "$ac_cv_search_tputs" = "no" ],
+ have_tty=no)
+ AS_IF([test "$with_tty" = "yes" -a "$have_tty" = "no" ],[
+ AC_MSG_ERROR([Your system lacks necessary functions for requested TTY support])])
+],[
+ for feature in ncurses curses termcap terminfo termlib gpm; do
+ if eval "test -n \"\$with_${feature}\" -a \"\$with_${feature}\" != no" ; then
+ AC_MSG_WARN([--with-${feature} ignored: Not valid without TTY support])
+ fi
+ eval "with_${feature}=no"
+ done
+])
+
+AS_IF([test "$with_tty" != "no" -a "$have_tty" != "no" ],[
+ for lib in $tty_libs; do
+ SXE_CHECK_LINK_LIB($lib, , eval have_${lib}=no)
+ with_lib_eval=`eval echo \\$with_$lib`
+ have_lib_eval=`eval echo \\$have_$lib`
+ AS_IF([test "$have_lib_eval" = "yes" ], [
+ for func in $tty_funcs; do
+ AC_CHECK_LIB($lib, tgetent)
+ AC_CHECK_LIB($lib, tgetstr)
+ AC_CHECK_LIB($lib, tgetflags)
+ AC_CHECK_LIB($lib, tparm)
+ AC_CHECK_LIB($lib, tgoto)
+ AC_CHECK_LIB($lib, tputs)
+ done
+ ])
+ have_lib_eval=`eval echo \\$have_$lib`
+ AS_IF([test "$with_lib_eval" = "yes" -a \
+ "$have_lib_eval" = "no" ],
+ AC_MSG_WARN([Errors detected trying to use requested $lib. Continuing with autodetection.]))
+ done
+ AS_IF([test "$sxe_cv_c_lib_ncurses" = "no" -a \
+ "$sxe_cv_c_lib_curses" = "no" -a \
+ "$sxe_cv_c_lib_termcap" = "no" -a \
+ "$sxe_cv_c_lib_terminfo" = "no" -a \
+ "$sxe_cv_c_lib_termlib" = "no"],
+ have_tty=no)
+ AS_IF([test "$with_tty" = "yes" -a "$have_tty" = "no"],
+ AC_MSG_ERROR([Your system lacks necessary libraries for requested TTY support.]))
+])
+