AC_INIT
AC_CONFIG_SRCDIR([aclocal.m4])
dnl
dnl autoconf 2.49 defaults to a /dev/null cache file, which is what we
dnl do not want for performance reasons. 
if test "x$cache_file" = "x/dev/null"; then
  cache_file=./config.cache
  AC_CACHE_LOAD
fi
dnl
CONFIG_RULES
dnl
dnl Determine version from patchlevel.h
eval `sed 's/#define \([A-Z0-9_]*\)[ \t]*\(.*\)/\1=\2/' < $srcdir/patchlevel.h`
KRB5_VERSION="$KRB5_MAJOR_RELEASE.$KRB5_MINOR_RELEASE.$KRB5_PATCHLEVEL"
AC_SUBST(KRB5_VERSION)
dnl
AC_REQUIRE_CPP
dnl
dnl The following lines are so that configure --help gives some global 
dnl configuration options.
dnl
AC_ARG_ENABLE([kdc-replay-cache],
[  --enable-kdc-replay-cache	check for replayed/retransmitted KDC requests
				(recommended for replay attack detection
				 when hardware preauthentication is in use)
  --disable-kdc-replay-cache	omit replay detection])dnl
KRB5_LIB_AUX
AC_KRB5_TCL
AC_ARG_ENABLE([athena],
[  --enable-athena         build with MIT Project Athena configuration],,)
dnl
if test -z "$KRB4_LIB"; then
kadminv4=""
krb524=""
libkrb4=""
KRB4=""
else
kadminv4=kadmin.v4
krb524=krb524
libkrb4=lib/krb4
KRB4=krb4
fi
AC_SUBST(KRB4)
AC_SUBST(krb524)
dnl
dnl Begin autoconf tests for the Makefiles generated out of the top-level
dnl configure.in...
dnl
AC_CHECK_FUNCS(memmove)
KRB5_BUILD_LIBOBJS
KRB5_BUILD_LIBRARY
KRB5_BUILD_PROGRAM
dnl
HOST_TYPE=$krb5_cv_host
AC_SUBST(HOST_TYPE)
dnl
dnl
if test "$COM_ERR_VERSION" = k5 ; then
  AC_CONFIG_SUBDIRS(util/et)
fi
if test "$SS_VERSION" = k5 ; then
  AC_CONFIG_SUBDIRS(util/ss)
fi
AC_CONFIG_SUBDIRS(util/profile util/pty)
if test "$DB_VERSION" = k5 ; then
  AC_CONFIG_SUBDIRS(util/db2)
fi
AC_CONFIG_SUBDIRS(include lib/crypto lib/krb5 lib/des425)
if test -n "$KRB4_LIB"; then
  AC_CONFIG_SUBDIRS(lib/krb4)
fi
AC_CONFIG_SUBDIRS(lib/kdb lib/gssapi lib/rpc lib/kadm5)
if test -n "$KRB4_LIB"; then
  AC_CONFIG_SUBDIRS(krb524)
fi
AC_CONFIG_SUBDIRS(kdc kadmin slave clients appl tests)
AC_CONFIG_FILES(krb5-config, [chmod +x krb5-config])
V5_AC_OUTPUT_MAKEFILE(. util util/send-pr lib config-files gen-manpages)
