AC_INIT(configure.in)
CONFIG_RULES
AC_PROG_ARCHIVE
AC_PROG_ARCHIVE_ADD
AC_PROG_RANLIB
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
dnl berzerkely types, to avoid collisions.
AC_CHECK_TYPE(u_int8_t, unsigned char)
AC_CHECK_TYPE(int16_t, short)
AC_CHECK_TYPE(u_int16_t, unsigned short)
AC_CHECK_TYPE(int32_t, int)
AC_CHECK_TYPE(u_int32_t, unsigned int)
AC_MSG_CHECKING(Whether pgno_t is defined)
AC_CACHE_VAL(krb5_cv_pgno_t,[AC_TRY_COMPILE(
[#include <sys/types.h>
#include <ndbm.h>
],[
pgno_t t;],
krb5_cv_pgno_t=yes,krb5_cv_pgno_t=no)])
AC_MSG_RESULT($krb5_cv_pgno_t)
if test $krb5_cv_pgno_t = no; then
   AC_DEFINE_UNQUOTED(pgno_t, u_int32_t)
   fi
dnl
dnl Determine the size of datum and DBT size fields. If they are not the same
dnl then the elements need to be copied.
AC_MSG_CHECKING(size of datum.dsize)
AC_CACHE_VAL(ac_cv_sizeof_datum_dsize,
[AC_TRY_RUN([#include <stdio.h>
#include <ndbm.h>
main()
{
  FILE *f=fopen("conftestval", "w");
  datum k;
  if (!f) exit(1);
  fprintf(f, "%d\n", sizeof(k.dsize));
  exit(0);
}], ac_cv_sizeof_datum_dsize=`cat conftestval`)])dnl
AC_MSG_RESULT($ac_cv_sizeof_datum_dsize)
AC_DEFINE_UNQUOTED(SIZEOF_DATUM_DSIZE, $ac_cv_sizeof_datum_dsize)

AC_MSG_CHECKING(size of DBT.size)
AC_CACHE_VAL(ac_cv_sizeof_dbt_size,
[AC_TRY_RUN([#include <stdio.h>
#include <sys/types.h>
typedef struct {
	void	*data;			/* data */
	size_t	 size;			/* data length */
} DBT;
main()
{
  FILE *f=fopen("conftestval", "w");
  DBT k;
  if (!f) exit(1);
  fprintf(f, "%d\n", sizeof(k.size));
  exit(0);
}], ac_cv_sizeof_dbt_size=`cat conftestval`)])dnl
AC_MSG_RESULT($ac_cv_sizeof_dbt_size)
AC_DEFINE_UNQUOTED(SIZEOF_DBT_SIZE, $ac_cv_sizeof_dbt_size)

AC_CHECK_FUNCS(mktemp mkstemp memmove)
CHECK_SIGNALS
dnl
dnl Check for sys/cdefs.h.
dnl
CDEFS_INCLUDE=["-I${srcdir}/../PORT/krb5"]
AC_HAVE_HEADERS(sys/cdefs.h, CDEFS_INCLUDE=)
AC_SUBST(CDEFS_INCLUDE)
SubdirLibraryRule([$(OBJS)])
V5_SHARED_LIB_OBJS
V5_AC_OUTPUT_MAKEFILE
