AC_INIT(telnetd.c)
CONFIG_RULES
AC_PROG_INSTALL
AC_CHECK_LIB(util,main)
AC_CHECK_LIB(termcap,main,AC_DEFINE(TERMCAP)
LIBS="$LIBS -ltermcap",
  AC_CHECK_LIB(curses,setupterm,LIBS="$LIBS -lcurses",
  AC_CHECK_LIB(ncurses,setupterm,LIBS="$LIBS -lncurses")
))
AC_HEADER_CHECK(termios.h,AC_DEFINE(USE_TERMIO) ac_termio=1)
if test -z "$ac_termio"; then
AC_HEADER_CHECK(termio.h,AC_DEFINE(SYSV_TERMIO),ac_sysv_termio=1)
if test -z "$ac_sysv_termio"; then
  AC_MSG_CHECKING([for cc_t in termio.h])
  AC_CACHE_VAL(krb_cv_type_cc_t,
  [AC_TRY_LINK([cc_t],[#include <termio.h>],
  [cc_t foo;],krb_cv_type_cc_t=yes,krb_cv_type_cc_t=no)])
  AC_MSG_RESULT($krb_cv_type_cc_t)
  if test $krb_cv_type_cc_t = no; then
    AC_DEFINE(NO_CC_T)
  fi
fi
fi
AC_HEADER_TIME
AC_CHECK_HEADERS(string.h arpa/nameser.h utmp.h sys/time.h sys/tty.h sac.h sys/ptyvar.h sys/filio.h sys/stream.h sys/utsname.h)
AC_CHECK_FUNCS(gettosbyname)
dnl Make our operating system-specific security checks and definitions for
dnl login.
dnl
case $krb5_cv_host in
*-*-hpux*)
     broken_streams=yes
     ;;
*-*-linux*)
     # Someday Linux may have a Streams user-level interface, so checking
     # for sys/stream.h may not always work.  But I'm reasonably
     # sure Linux will never require pushing magic streams modules onto 
     # pty's! :-)   --- TYT
     broken_streams=yes
     ;;
*-*-irix*)
     # Irix doesn't have a working granpt, and more over
     # you can't push anything onto a pty, so telnetd really
     # Really wants to treat it as if it doesn't have streams
     broken_streams=yes
     ;;
esac
if test -z "$broken_streams" -a "$ac_cv_header_sys_stream_h" = yes; then
    AC_FUNC_CHECK(grantpt,AC_DEFINE(STREAMSPTY))
fi
AC_MSG_CHECKING([if setpgrp takes two arguments])
dnl
AC_CACHE_VAL(krb5_cv_sys_setpgrp_two,
[AC_TRY_LINK( 
[#include <unistd.h>],[setpgrp(0,0)],
krb5_cv_sys_setpgrp_two=yes,krb5_cv_sys_setpgrp_two=no)])
AC_MSG_RESULT($krb5_cv_sys_setpgrp_two)
if test $krb5_cv_sys_setpgrp_two = yes; then
  AC_DEFINE(SETPGRP_TWOARG)
fi
dnl
KRB5_BUILD_PROGRAM
V5_AC_OUTPUT_MAKEFILE
