diff --git a/am/libcurses.m4 b/am/libcurses.m4 index 3dd1259..fe09781 100644 --- a/am/libcurses.m4 +++ b/am/libcurses.m4 @@ -88,19 +88,37 @@ AC_DEFUN([IU_LIB_TERMCAP], [ if test "$LIBNCURSES"; then LIBTERMCAP="$LIBNCURSES" else - AC_CHECK_LIB(curses, tgetent, LIBTERMCAP=-lcurses) - if test "$ac_cv_lib_curses_tgetent" = no; then - AC_CHECK_LIB(termcap, tgetent, LIBTERMCAP=-ltermcap) + AC_CHECK_LIB(termcap, tgetent, LIBTERMCAP=-ltermcap) + AC_CHECK_HEADERS([termcap.h]) + if test "$ac_cv_lib_termcap_tgetent" = yes \ + || test "$ac_cv_header_termcap_h" = yes; then + AC_DEFINE([HAVE_TERMCAP_TGETENT], 1, + [Define to 1 if tgetent() exists in .]) + else + AC_CHECK_LIB(curses, tgetent, LIBTERMCAP=-lcurses) fi - if test "$ac_cv_lib_termcap_tgetent" = no; then + if test "$ac_cv_lib_curses_tgetent" = yes \ + && test "$ac_cv_lib_termcap_tgetent" = no; then + AC_DEFINE([HAVE_CURSES_TGETENT], 1, + [Define to 1 if tgetent() exists in .]) + fi + if test "$ac_cv_lib_curses_tgetent" = no \ + && test "$ac_cv_lib_termcap_tgetent" = no; then AC_CHECK_LIB(termlib, tgetent, LIBTERMCAP=-ltermlib) + if "$ac_cv_lib_termlib_tgetent" = yes; then + AC_DEFINE([HAVE_TERMINFO_TGETENT], 1, + [Define to 1 if tgetent() exists in libterminfo.]) + fi + fi + if test -n "$LIBTERMCAP"; then + AC_DEFINE([HAVE_TGETENT], 1, [Define to 1 if tgetent() exists.]) fi fi AC_SUBST(LIBTERMCAP)])dnl -dnl IU_LIB_CURSES -- checke for curses, and associated libraries +dnl IU_LIB_CURSES -- check for curses, and associated libraries dnl -dnl Checks for varions libraries implementing the curses interface, and if +dnl Checks for various libraries implementing the curses interface, and if dnl found, defines LIBCURSES to be the appropriate linker specification, dnl *including* any termcap libraries if needed (some versions of curses dnl don't need termcap). diff --git a/am/readline.m4 b/am/readline.m4 index b7ce9e4..1279c00 100644 --- a/am/readline.m4 +++ b/am/readline.m4 @@ -53,6 +53,20 @@ AC_DEFUN([gl_FUNC_READLINE], LIBS="$am_save_LIBS" ]) + dnl In case of failure, examine whether libedit can act + dnl as replacement. Small NetBSD systems use editline + dnl as wrapper for readline. + if test "$gl_cv_lib_readline" = no; then + am_save_LIBS="$LIBS" + LIBS="$am_save_LIBS -ledit" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include +#include ]], + [[readline((char*)0);]])], + [gl_cv_lib_readline="yes"]) + LIBS="$am_save_LIBS" + LIBREADLINE=-ledit + fi + if test "$gl_cv_lib_readline" != no; then AC_DEFINE([HAVE_READLINE], [1], [Define if you have the readline library.]) extra_lib=`echo "$gl_cv_lib_readline" | sed -n -e 's/yes, requires //p'` diff --git a/telnet/telnet.c b/telnet/telnet.c index c5b4b19..d0e33d3 100644 --- a/telnet/telnet.c +++ b/telnet/telnet.c @@ -73,7 +73,9 @@ #include "types.h" #include "general.h" -#ifdef HAVE_READLINE +#ifdef HAVE_TERMCAP_TGETENT +# include +#elif defined HAVE_CURSES_TGETENT # include # include #endif @@ -729,7 +731,7 @@ int init_term (char *tname, int fd, int *errp) { int err = -1; -#ifdef HAVE_READLINE +#ifdef HAVE_TGETENT err = tgetent (termbuf, tname); #endif if (err == 1) diff --git a/telnetd/utility.c b/telnetd/utility.c index c9dbeeb..0101331 100644 --- a/telnetd/utility.c +++ b/telnetd/utility.c @@ -37,7 +37,9 @@ # define NET_ENCRYPT() #endif -#ifdef HAVE_READLINE +#ifdef HAVE_TERMCAP_TGETENT +# include +#elif defined HAVE_CURSES_TGETENT # include # include #endif @@ -830,7 +832,7 @@ terminaltypeok (char *s) if (terminaltype == NULL) return 1; -#ifdef HAVE_READLINE +#ifdef HAVE_TGETENT if (tgetent (buf, s) == 0) #endif return 0;