AC_INIT(configure.in)
CONFIG_RULES
AC_PROG_INSTALL
AC_PROG_YACC
AC_PROG_AWK
AC_CHECK_HEADERS(unistd.h stdlib.h krb_db.h kdc.h regex.h alloca.h sys/time.h sys/select.h memory.h arpa/inet.h)
AC_CHECK_FUNCS(ftime timezone getcwd strstr waitpid vsprintf)
AC_REPLACE_FUNCS([memmove strftime])
KRB5_NEED_PROTO([#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif],daemon,1)
AC_HEADER_TIME
CHECK_SIGNALS
CHECK_WAIT_TYPE
CHECK_SETJMP
KRB5_GETSOCKNAME_ARGS
AC_CANONICAL_HOST
ath_compat=
AC_ARG_ENABLE([athena],
[  --enable-athena         build with MIT Project Athena configuration],
ath_compat=compat,)
dnl
dnl The following are tests for the presence of programs required for testing 
AC_CHECK_PROG(have_RUNTEST,runtest,runtest)
AC_CHECK_PROG(have_PERL,perl,perl)
AC_KRB5_TCL	
if test "$have_PERL" = perl -a "$have_RUNTEST" = runtest -a "$TCL_LIBS" != ""; then
 	DO_TEST=ok
fi
AC_SUBST(DO_TEST) 
dnl
DO_V4_TEST=
if test "$have_PERL" = perl -a "$have_RUNTEST" = runtest -a "$TCL_LIBS" != "" -a "$ath_compat" != ""; then
 	DO_V4_TEST=ok
fi
AC_SUBST(DO_V4_TEST)
dnl
dnl For ndbm password checking kludge.
dnl
if test "$ath_compat" = "compat"; then
	AC_DEFINE(NDBM_PW_CHECK)
fi
dnl
dnl The following are substituted into testing/scripts/env-setup.sh
RBUILD=`pwd`/..
AC_SUBST(RBUILD)
case "$srcdir" in
/*)
	S_TOP=$srcdir/..
	;;
*)
	S_TOP=`pwd`/$srcdir/..
	;;
esac
AC_SUBST(S_TOP)
AC_PATH_PROG(PERL,perl)
AC_PATH_PROG(EXPECT,expect)
dnl
KRB5_RUN_FLAGS
dnl For testing/util/Makefile.in
if test "$TCL_LIBS" != "" ;  then
	DO_ALL=tcl
fi
AC_SUBST(DO_ALL)
dnl See if we should build v4server
if test -z "$KRB4_LIB"; then
V4SERVER=""
else
V4SERVER=v4server
fi
AC_SUBST(V4SERVER)
dnl
KRB5_BUILD_PROGRAM
KRB5_AC_PRIOCNTL_HACK
dnl
K5_GEN_FILE(testing/scripts/env-setup.sh:testing/scripts/env-setup.shin)
V5_AC_OUTPUT_MAKEFILE(. cli dbutil passwd passwd/unit-test ktutil server v4server v4server/unit-test v5passwdd testing testing/scripts testing/util)
