fi
AC_ARG_ENABLE(autologin, [ --disable-autologin disable autologin (default is enabled if possible)])
+AC_ARG_ENABLE(chkpwd, [ --enable-chkpwd build 'chkpwd' (use this if you have shadow passwords)])
+AC_ARG_WITH(pam, [ --with-pam use PAM if present])
dnl By default, we only build the client (citadel and whobbs) unless we can
dnl figure out how to build with POSIX threads.
SO=.mo
AC_DEFINE(HAVE_NONREENTRANT_NETDB)
;;
- dnl Digital Unix has an odd way to build pthreads, and we can't build
- dnl pthreads programs with gcc due to header problems.
+ dnl Digital Unix has an odd way to build for pthreads, and we can't
+ dnl build pthreads programs with gcc due to header problems.
alpha*-dec-osf*)
test -z "$CC" && CC=cc
SERVER_LDFLAGS=-pthread
dnl -lcrypt and -ldl, because some systems (like Irix) have both.
AC_CHECK_FUNCS(crypt dlopen)
-dnl We only need crypt() if we're using autologin. FIXME: implement shadow
-dnl passwords and/or PAM...
-if test "$enable_autologin" != no -a "$ac_cv_func_crypt" = no; then
- AC_CHECK_LIB(crypt, crypt)
-fi
-
-dnl Enable autologin if the feature is requested (which is the default) and
-dnl a crypt() functin is available.
-if test "$enable_autologin" != no -a \( "$ac_cv_func_crypt" = yes -o "$ac_cv_lib_crypt_crypt" = yes \); then
- AC_DEFINE(ENABLE_AUTOLOGIN)
+if test "$ac_cv_func_dlopen" = no; then
+ AC_CHECK_LIB(dl, dlopen, [LIBS="-ldl $LIBS"
+ chkpwd_LIBS=-ldl])
fi
-if test "$ac_cv_func_dlopen" = no; then
- AC_CHECK_LIB(dl, dlopen)
+dnl Determine the system's authentication capabilities, if autologin is
+dnl requested. We currently support PAM, standard getpwnam(), and getspnam()
+dnl (Linux shadow passwords)
+if test "$enable_autologin" != no; then
+ if test "$with_pam" = yes; then
+ save_LIBS=$LIBS
+ AC_CHECK_LIB(pam, pam_start, [chkpwd_LIBS="-lpam $chkpwd_LIBS"
+ LIBS="-lpam $LIBS"])
+ AC_CHECK_FUNCS(pam_start)
+ test "$enable_chkpwd" = yes && LIBS=$save_LIBS
+ fi
+ if test "$ac_cv_func_pam_start" = no -o "$with_pam" != yes; then
+ AC_CHECK_LIB(shadow, getspnam)
+ if test "$ac_cv_func_crypt" = no; then
+ AC_CHECK_LIB(crypt, crypt, [chkpwd_LIBS=-lcrypt
+ test "$enable_chkpwd" != yes && \
+ LIBS="-lcrypt $LIBS"])
+ fi
+ fi
+ if test "$ac_cv_func_crypt" = yes -o "$ac_cv_lib_crypt_crypt" = yes -o "$ac_cv_func_pam_start" = yes; then
+ AC_DEFINE(ENABLE_AUTOLOGIN)
+ if test "$enable_chkpwd" = yes; then
+ AC_DEFINE(ENABLE_CHKPWD)
+ CHKPWD=chkpwd
+ else
+ AUTH=auth.ro
+ fi
+ fi
fi
AC_CHECK_LIB(gdbm, gdbm_open)
AC_PROG_GCC_TRADITIONAL
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF
-AC_CHECK_FUNCS(mkdir mkfifo mktime pthread_cancel rmdir select socket strerror)
+AC_CHECK_FUNCS(getspnam mkdir mkfifo mktime pthread_cancel rmdir select socket strerror)
AC_CHECK_FUNC(pthread_create, TARGETS="client server utils serv_modules")
AC_REPLACE_FUNCS(snprintf getutline)
dnl Done! Now write the Makefile and sysdep.h
+AC_SUBST(AUTH)
AC_SUBST(SO)
+AC_SUBST(CHKPWD)
AC_SUBST(CURSES)
+AC_SUBST(chkpwd_LIBS)
AC_SUBST(TARGETS)
AC_SUBST(SERVER_LDFLAGS)
AC_SUBST(PICFLAGS)