AC_INIT(rlogind.c)
AC_PREFIX_DEFAULT(/usr/local/v6)

AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
INSTALL_LIB="\${INSTALL_DATA}"
AC_SUBST(INSTALL_LIB)
INSTALL_DIR="\${INSTALL} -d"
AC_SUBST(INSTALL_DIR)
AC_PROG_LN_S

AC_SEARCH_LIBS(pam_start, pam,
	AC_DEFINE(USE_PAM)
	USE_PAM=1,
	[AC_CHECK_FUNCS(shadow,,AC_CHECK_LIB(shadow, getspnam))],
	-lpam_misc)
AC_CHECK_LIB(pam_misc, misc_conv)
AC_CHECK_FUNCS(crypt,,AC_CHECK_LIB(crypt, crypt))
AC_CHECK_FUNCS(forkpty,,AC_SEARCH_LIBS(forkpty, util bsd))
AC_CHECK_FUNCS(logwtmp,,AC_SEARCH_LIBS(logwtmp, util bsd))

dnl AC_REPLACE_FUNCS(daemon)

AC_CHECK_HEADERS(security/pam_appl.h)
AC_CHECK_HEADERS(shadow.h)

AC_SUBST(USE_PAM)

CFLAGS="-I../libinet6/include $CFLAGS"
LIBS="-L../libinet6 -linet6 $LIBS"

AC_OUTPUT(Makefile)
