AC_INIT(README.gssftp)
CONFIG_RULES
AC_CONST
AC_PROG_INSTALL
AC_PROG_YACC
KRB5_SIGTYPE
CHECK_SIGNALS
CHECK_SIGPROCMASK
CHECK_SETJMP
CHECK_WAIT_TYPE
DECLARE_SYS_ERRLIST
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_FUNC_VFORK
AC_HAVE_FUNCS(getcwd getdtablesize)
AC_HEADER_STDARG
AC_HEADER_CHECK(termios.h,AC_FUNC_CHECK(cfsetispeed,AC_DEFINE(POSIX_TERMIOS)))
AC_CHECK_HEADERS(unistd.h stdlib.h string.h sys/select.h sys/sockio.h paths.h)
CHECK_UTMP
DECLARE_SYS_ERRLIST
AC_REPLACE_FUNCS(getdtablesize)
AC_HAVE_FUNCS(getcwd getusershell seteuid setreuid setresuid)
AC_CHECK_LIB(crypt,crypt) dnl 
AC_CHECK_LIB(util,logwtmp) dnl
dnl 
dnl copied from appl/bsd/configure.in
dnl
AC_MSG_CHECKING([setenv])
AC_CACHE_VAL(krb5_cv_setenv,
[AC_TRY_LINK(
[],[setenv("PATH","/bin",0);],
krb5_cv_setenv=yes,krb5_cv_setenv=no)])
AC_MSG_RESULT($krb5_cv_setenv)
if test $krb5_cv_setenv = no; then
SETENVSRC='$(srcdir)/../bsd/setenv.c'
SETENVOBJ=setenv.o
AC_SUBST([SETENVSRC])
AC_SUBST([SETENVOBJ])
fi
dnl
dnl
dnl
AC_MSG_CHECKING([shadow password support])
AC_CACHE_VAL(krb5_cv_shadow_pwd,
[AC_TRY_LINK(
[#include <sys/types.h>
#include <pwd.h>
#include <shadow.h>],
[struct spwd *sp = getspnam("root")],
krb5_cv_shadow_pwd=yes, krb5_cv_shadow_pwd=no)])
AC_MSG_RESULT($krb5_cv_shadow_pwd)
if test $krb5_cv_shadow_pwd = yes; then
AC_DEFINE(HAVE_SHADOW)
fi
AC_ARG_WITH([krb4],
[  --without-krb4          don't include Kerberos V4 backwards compatibility
  --with-krb4             use V4 libraries included with V5 (default)
  --with-krb4=KRB4DIR     use preinstalled V4 libraries],
,
withval=yes
)dnl
if test $withval = no; then
	AC_MSG_RESULT(no krb4 support)
else 
	AC_MSG_RESULT(Adding in krb4 support)
	FTPD_LIBS="../../../krb524/libkrb524.a"
fi
case $krb5_cv_host in
alpha*-dec-osf*)
	AC_CHECK_LIB(security,setluid,
		AC_DEFINE(HAVE_SETLUID)
		FTPD_LIBS="$FTPD_LIBS -lsecurity"
	)
	;;
esac
dnl
dnl
dnl
AC_SUBST(FTPD_LIBS)
dnl
dnl
dnl
KRB5_BUILD_PROGRAM
K5_GEN_MAKEFILE(.)
K5_GEN_MAKEFILE(ftp)
K5_GEN_MAKEFILE(ftpd)
K5_AC_OUTPUT
