AC_INIT(configure.in)
CONFIG_RULES
dnl
dnl
dnl We cannot use the autoconf form as it is too generic and sets other
dnl variables. This is only for the purpose of changing the link options.
AC_MSG_CHECKING(whether we are using GNU C)
AC_CACHE_VAL(krb5_cv_prog_gcc,
[
AC_EGREP_CPP(yes,[#ifdef __GNUC__
yes;
#endif],krb5_cv_prog_gcc=yes,krb5_cv_prog_gcc=no)
])dnl
AC_MSG_RESULT($krb5_cv_prog_gcc)
dnl
AC_MSG_CHECKING([for build host])
AC_CACHE_VAL(krb5_cv_host, [export CC
AC_CANONICAL_HOST
krb5_cv_host=$host])
AC_MSG_RESULT($krb5_cv_host)
AC_ARG_ENABLE([shared],
[  --enable-shared         build shared libraries],[
case $krb5_cv_host in
*-*-netbsd*)
	echo "Enabling shared libraries for NetBSD...."
	krb5_cv_shlibs_cflags=-fpic
	krb5_cv_shlibs_ext=so.0.0
	krb5_cv_noshlibs_ext=a
	krb5_cv_shlibs_dir=shared
	krb5_cv_shlibs_ldflag=
	krb5_cv_noshlibs_ldflag="-static"
	krb5_cv_shlibs_sym_ufo="-u "
	krb5_cv_shlibs_dirhead="-L"
	krb5_cv_exe_need_dirs=yes
	krb5_cv_shlibs_use_dirs=yes
	krb5_cv_shlibs_use_colon_dirs=no
	krb5_cv_shlibs_tail_comp=
	krb5_cv_shlibs_enabled=yes
	krb5_cv_staticlibs_enabled=yes
	;;
*-*-linux*)
	echo "Enabling shared libraries for Linux...."
	krb5_cv_shlibs_cflags=-fPIC
	krb5_cv_shlibs_ext=so
	krb5_cv_noshlibs_ext=a
	krb5_cv_shlibs_dir=shared
	krb5_cv_shlibs_ldflag="-dy"
	krb5_cv_noshlibs_ldflag="-dn"
	krb5_cv_shlibs_sym_ufo="-u "
	krb5_cv_shlibs_dirhead="-R"
	krb5_cv_exe_need_dirs=yes
	krb5_cv_shlibs_use_dirs=yes
	krb5_cv_shlibs_use_colon_dirs=no
	krb5_cv_shlibs_tail_comp=
	krb5_cv_shlibs_enabled=yes
	krb5_cv_staticlibs_enabled=yes
	;;
*-*-aix*)
	echo "Enabling shared libraries for AIX...."
	krb5_cv_shlibs_cflags=
	krb5_cv_shlibs_ext=a
	krb5_cv_noshlibs_ext=do-not-make
	krb5_cv_shlibs_dir=
	if test $krb5_cv_prog_gcc = yes ; then
     krb5_cv_shlibs_ldflag="-Xlinker -bex4:\$(BUILDTOP)/util/aix.bincmds"
     krb5_cv_noshlibs_ldflag=
else
     krb5_cv_shlibs_ldflag="-bex4:\$(BUILDTOP)/util/aix.bincmds"
	krb5_cv_noshlibs_ldflag=
fi
	krb5_cv_shlibs_sym_ufo=
	krb5_cv_shlibs_dirhead="-L"
	krb5_cv_exe_need_dirs=yes
	krb5_cv_shlibs_use_dirs=no
	krb5_cv_shlibs_use_colon_dirs=no
	krb5_cv_staticlibs_enabled=
	krb5_cv_shlibs_tail_comp=
	krb5_cv_shlibs_enabled=yes
;;
*-*-solaris*)
	echo "Enabling shared libraries for Solaris...."
	if test $krb5_cv_prog_gcc = yes; then
		krb5_cv_shlibs_cflags=-fpic
	else
		krb5_cv_shlibs_cflags=-Kpic
	fi
	krb5_cv_shlibs_ext=so
	krb5_cv_noshlibs_ext=a
	krb5_cv_shlibs_dir=shared
	krb5_cv_shlibs_ldflag="-dy"
	krb5_cv_noshlibs_ldflag="-dn"
	krb5_cv_shlibs_sym_ufo="-u "
	krb5_cv_shlibs_dirhead="-R"
	krb5_cv_exe_need_dirs=yes
	krb5_cv_shlibs_use_dirs=yes
	krb5_cv_shlibs_use_colon_dirs=no
	krb5_cv_shlibs_tail_comp=
	krb5_cv_staticlibs_enabled=yes
	krb5_cv_shlibs_enabled=yes
	;;
alpha-dec-osf*)
	echo "Enabling shared libraries for Alpha OSF...."
	krb5_cv_shlibs_cflags=
	krb5_cv_shlibs_ext=so
	krb5_cv_noshlibs_ext=a
	krb5_cv_shlibs_dir=
	krb5_cv_shlibs_ldflag="-call_shared"
	krb5_cv_noshlibs_ldflag="-non_shared"
	krb5_cv_shlibs_sym_ufo="-expect_unresolved "
	krb5_cv_shlibs_dirhead="-rpath"
	krb5_cv_exe_need_dirs=no
	krb5_cv_shlibs_use_dirs=yes
	krb5_cv_shlibs_use_colon_dirs=yes
	krb5_cv_shlibs_tail_comp=
	krb5_cv_staticlibs_enabled=yes
	krb5_cv_shlibs_enabled=yes
	if test ! -f so_locations; then
		cp -p /usr/shlib/so_locations .
	fi
	if test $krb5_cv_prog_gcc = yes; then
		krb5_cv_shlibs_ldflag=
		krb5_cv_noshlibs_ldflag="-static"
	fi
	;;

*) 
	echo " "
	echo "Shared libraries not supported on $krb5_cv_host"
	exit 1
	;;
esac],[krb5_cv_shlibs_cflags=
krb5_cv_shlibs_ext=
krb5_cv_noshlibs_ext=a
krb5_cv_shlibs_dir=
krb5_cv_shlibs_ldflag=
krb5_cv_noshlibs_ldflag=
krb5_cv_shlibs_sym_ufo=
krb5_cv_shlibs_dirhead=
krb5_cv_shlibs_tail_comp=
krb5_cv_staticlibs_enabled=yes
krb5_cv_shlibs_enabled=])

AC_ARG_ENABLE([athena],
[  --enable-athena         build with MIT Project Athena configuration],,)
if test -z "$KRB4_LIB"; then
kadminv4=""
krb524=""
else
kadminv4=kadmin.v4
krb524=krb524
fi
CONFIG_DIRS(util include lib kdc admin kadmin $kadminv4 kadmin.old $krb524 slave clients appl tests)
DO_SUBDIRS
dnl dnl AC_OUTPUT(Makefile,[EXTRA_RULES])
V5_AC_OUTPUT_MAKEFILE
