]> code.citadel.org Git - citadel.git/blobdiff - citadel/configure.in
* Makefile.in, configure.in, chkpwd.c, acconfig.h: support for
[citadel.git] / citadel / configure.in
index 258bd3150fc705fa07e3430c229a8466ad8ce5c1..4c11a186ee31c88f6312e21939a75f63f13e2edc 100644 (file)
@@ -10,6 +10,8 @@ else
 fi
 
 AC_ARG_ENABLE(autologin, [  --disable-autologin     disable autologin (default is enabled if possible)])
 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.
 
 dnl By default, we only build the client (citadel and whobbs) unless we can
 dnl figure out how to build with POSIX threads.
@@ -26,8 +28,8 @@ case "$host" in
                SO=.mo
                AC_DEFINE(HAVE_NONREENTRANT_NETDB)
        ;;
                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
        alpha*-dec-osf*)
                test -z "$CC" && CC=cc
                SERVER_LDFLAGS=-pthread
@@ -71,20 +73,39 @@ dnl We want to test for crypt() and dlopen() in libc before checking for
 dnl -lcrypt and -ldl, because some systems (like Irix) have both.
 AC_CHECK_FUNCS(crypt dlopen)
 
 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
 
 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)
 fi
 
 AC_CHECK_LIB(gdbm, gdbm_open)
@@ -127,13 +148,16 @@ AC_FUNC_GETPGRP
 AC_PROG_GCC_TRADITIONAL
 AC_TYPE_SIGNAL
 AC_FUNC_VPRINTF
 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_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(SO)
+AC_SUBST(CHKPWD)
 AC_SUBST(CURSES)
 AC_SUBST(CURSES)
+AC_SUBST(chkpwd_LIBS)
 AC_SUBST(TARGETS)
 AC_SUBST(SERVER_LDFLAGS)
 AC_SUBST(PICFLAGS)
 AC_SUBST(TARGETS)
 AC_SUBST(SERVER_LDFLAGS)
 AC_SUBST(PICFLAGS)