1 dnl Process this file with autoconf to produce a configure script.
3 AM_INIT_AUTOMAKE(shadow, 4.0.7)
4 AC_CONFIG_HEADERS([config.h])
7 test "$prefix" = "NONE" && prefix="/usr"
8 test "$prefix" = "/usr" && exec_prefix=""
15 dnl Checks for programs.
23 dnl Checks for libraries.
25 dnl Checks for header files.
30 AC_CHECK_HEADERS(errno.h fcntl.h limits.h unistd.h sys/time.h utmp.h \
31 utmpx.h termios.h termio.h sgtty.h sys/ioctl.h syslog.h paths.h \
32 utime.h ulimit.h sys/resource.h gshadow.h shadow.h lastlog.h \
33 locale.h rpc/key_prot.h)
35 AC_CHECK_FUNCS(a64l fchmod fchown fseeko fsync getgroups gethostname getspnam \
36 gettimeofday getusershell getutent initgroups lchown lckpwdf lstat \
37 memcpy memset setgroups sigaction strchr updwtmp updwtmpx)
40 dnl Checks for typedefs, structures, and compiler characteristics.
47 AC_CHECK_MEMBERS([struct stat.st_rdev])
51 if test "$ac_cv_header_utmp_h" = "yes"; then
52 AC_CACHE_CHECK(for ut_host in struct utmp,
53 ac_cv_struct_utmp_ut_host,
55 [AC_LANG_PROGRAM([#include <utmp.h>],
56 [struct utmp ut; char *cp = ut.ut_host;]
58 [ac_cv_struct_utmp_ut_host=yes],
59 [ac_cv_struct_utmp_ut_host=no]
63 if test "$ac_cv_struct_utmp_ut_host" = "yes"; then
67 AC_CACHE_CHECK(for ut_user in struct utmp,
68 ac_cv_struct_utmp_ut_user,
69 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <utmp.h>],
70 [struct utmp ut; char *cp = ut.ut_user;]
72 [ac_cv_struct_utmp_ut_user=yes],
73 [ac_cv_struct_utmp_ut_user=no]
77 if test "$ac_cv_struct_utmp_ut_user" = "no"; then
78 AC_DEFINE(ut_user, ut_name)
82 if test "$ac_cv_header_lastlog_h" = "yes"; then
83 AC_CACHE_CHECK(for ll_host in struct lastlog,
84 ac_cv_struct_lastlog_ll_host,
85 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <lastlog.h>],
86 [struct lastlog ll; char *cp = ll.ll_host;]
88 [ac_cv_struct_lastlog_ll_host=yes],
89 [ac_cv_struct_lastlog_ll_host=no]
93 if test "$ac_cv_struct_lastlog_ll_host" = "yes"; then
94 AC_DEFINE(HAVE_LL_HOST)
98 dnl Checks for library functions.
100 AC_PROG_GCC_TRADITIONAL
104 AC_REPLACE_FUNCS(mkdir putgrent putpwent putspent rename rmdir)
105 AC_REPLACE_FUNCS(sgetgrent sgetpwent sgetspent)
106 AC_REPLACE_FUNCS(snprintf strcasecmp strdup strerror strstr)
108 AC_CHECK_FUNC(setpgrp)
111 if test "$ac_cv_header_shadow_h" = "yes"; then
112 AC_CACHE_CHECK(for working shadow group support,
113 ac_cv_libc_shadowgrp,
114 AC_RUN_IFELSE([AC_LANG_SOURCE([
118 struct sgrp *sg = sgetsgent("test:x::");
119 /* NYS libc on Red Hat 3.0.3 has broken shadow group support */
120 return !sg || !sg->sg_adm || !sg->sg_mem;
123 [ac_cv_libc_shadowgrp=yes],
124 [ac_cv_libc_shadowgrp=no],
125 [ac_cv_libc_shadowgrp=no]
129 if test "$ac_cv_libc_shadowgrp" = "yes"; then
130 AC_DEFINE(HAVE_SHADOWGRP)
134 AC_CACHE_CHECK([location of shared mail directory], shadow_cv_maildir,
135 [for shadow_cv_maildir in /var/mail /var/spool/mail /usr/spool/mail /usr/mail none; do
136 if test -d $shadow_cv_maildir; then
140 if test $shadow_cv_maildir != none; then
141 AC_DEFINE_UNQUOTED(MAIL_SPOOL_DIR, "$shadow_cv_maildir")
144 AC_CACHE_CHECK([location of user mail file], shadow_cv_mailfile,
145 [for shadow_cv_mailfile in Mailbox mailbox Mail mail .mail none; do
146 if test -f $HOME/$shadow_cv_mailfile; then
150 if test $shadow_cv_mailfile != none; then
151 AC_DEFINE_UNQUOTED(MAIL_SPOOL_FILE, "$shadow_cv_mailfile")
154 AC_CACHE_CHECK([location of utmp], shadow_cv_utmpdir,
155 [for utmpdir in /var/run /var/adm /usr/adm /etc none; do
156 if test -f $shadow_cv_utmpdir/utmp; then
160 if test "$shadow_cv_utmpdir" = "none"; then
161 AC_MSG_WARN(utmp file not found)
163 AC_DEFINE_UNQUOTED(_UTMP_FILE, "$shadow_cv_utmpdir/utmp")
165 AC_CACHE_CHECK([location of faillog/lastlog/wtmp], shadow_cv_logdir,
166 [for shadow_cv_logdir in /var/log /var/adm /usr/adm /etc; do
167 if test -d $logdir; then
171 AC_DEFINE_UNQUOTED(_WTMP_FILE, "$shadow_cv_logdir/wtmp")
172 AC_DEFINE_UNQUOTED(LASTLOG_FILE, "$shadow_cv_logdir/lastlog")
173 AC_DEFINE_UNQUOTED(FAILLOG_FILE, "$shadow_cv_logdir/faillog")
175 AC_CACHE_CHECK([location of the passwd program], shadow_cv_passwd_dir,
176 [if test -f /usr/bin/passwd; then
177 shadow_cv_passwd_dir=/usr/bin
179 shadow_cv_passwd_dir=/bin
181 AC_DEFINE_UNQUOTED(PASSWD_PROGRAM, "$shadow_cv_passwd_dir/passwd")
183 dnl XXX - quick hack, should disappear before anyone notices :).
186 AC_DEFINE(USE_SYSLOG)
188 AC_DEFINE(RUSEROK, 0)
190 dnl Use our own version of getpass(), which handles long passwords
191 dnl (unlike many systems which have a limit of 8 characters), and can
192 dnl be interrupted with Ctrl-C (unlike Linux libc).
193 AC_DEFINE(getpass, libshadow_getpass)
195 AC_ARG_ENABLE(desrpc, [ --enable-desrpc try to use secure RPC in login (default if found)])
196 AC_ARG_ENABLE(shadowgrp, [ --enable-shadowgrp enable shadow group support [default=yes]])
198 AC_ARG_WITH(libcrack, [ --with-libcrack try to use libcrack (default if found)])
199 AC_ARG_WITH(libcrypt, [ --with-libcrypt try to use libcrypt (default if found)])
200 AC_ARG_WITH(libopie, [ --with-libopie use libopie for OPIE support])
201 AC_ARG_WITH(libpam, [ --with-libpam use libpam for PAM support])
202 AC_ARG_WITH(libskey, [ --with-libskey use libskey for S/Key support])
203 AC_ARG_WITH(selinux, [ --with-selinux use SELinux support])
205 dnl Check for some functions in libc first, only if not found check for
206 dnl other libraries. This should prevent linking libnsl if not really
207 dnl needed (Linux glibc, Irix), but still link it if needed (Solaris).
209 AC_SEARCH_LIBS(inet_ntoa, inet)
210 AC_SEARCH_LIBS(socket, socket)
211 AC_SEARCH_LIBS(gethostbyname, nsl)
213 dnl XXX - getsecretkey() causes login to hang for 5 minutes on at least
214 dnl one RH 4.0 system. Use --disable-desrpc if you have this problem.
215 dnl Reported by Mohan Khurana <mohan@stealth.net>.
217 if test "$enable_desrpc" != "no" -a "$ac_cv_header_rpc_key_prot_h" = "yes" ; then
218 AC_CHECK_FUNC(getsecretkey, AC_DEFINE(DES_RPC),
219 AC_CHECK_LIB(rpcsvc, getsecretkey, AC_DEFINE(DES_RPC)))
222 if test "$enable_shadowgrp" != "no"; then
227 if test "$with_libcrypt" != "no"; then
228 AC_CHECK_LIB(crypt, crypt, [AC_DEFINE(HAVE_LIBCRYPT) LIBCRYPT=-lcrypt])
232 if test "$with_libcrack" != "no"; then
233 echo "checking cracklib flavour, don't be surprised by the results"
234 AC_CHECK_LIB(crack, FascistCheck, AC_DEFINE(HAVE_LIBCRACK) LIBCRACK=-lcrack)
235 AC_CHECK_LIB(crack, FascistHistory, AC_DEFINE(HAVE_LIBCRACK_HIST))
236 AC_CHECK_LIB(crack, FascistHistoryPw, AC_DEFINE(HAVE_LIBCRACK_PW))
241 if test "$with_libskey" = "yes"; then
242 AC_CHECK_LIB(md, MD5Init, LIBMD=-lmd)
243 AC_CHECK_LIB(skey, skeychallenge, AC_DEFINE(SKEY) LIBSKEY=-lskey, [], $LIBMD $LIBCRYPT)
244 elif test "$with_libopie" = "yes"; then
245 AC_CHECK_LIB(opie, opiechallenge, AC_DEFINE(OPIE) LIBSKEY=-lopie, [], $LIBCRYPT)
248 if test "$with_selinux" = "yes"; then
249 AC_CHECK_LIB(selinux, is_selinux_enabled, [LIBSELINUX="-lselinux"], [SELinuux enabled but libselinux not found])
251 AC_CHECK_HEADERS(selinux/selinux.h, [], [selinux/selinux.h is missing])
252 AC_DEFINE(WITH_SELINUX, 1, [Build shadow with SELinux support])
256 if test "$with_libpam" = "yes"; then
257 AC_CHECK_LIB(pam, pam_start,
258 [AC_DEFINE(USE_PAM, 1, [Define to support Pluggable Authentication Modules])
260 AC_CHECK_LIB(pam_misc, main,
261 [LIBPAM="$LIBPAM -lpam_misc"],
262 AC_MSG_ERROR(libpam_misc is missing)
264 [AC_MSG_CHECKING(use login access checking if PAM not used)
265 AC_DEFINE(LOGIN_ACCESS)
268 AC_MSG_CHECKING(use login and su access checking if PAM not used)
271 AC_MSG_CHECKING(use login and su access checking if PAM not used)
272 AC_DEFINE(LOGIN_ACCESS)
277 AM_GNU_GETTEXT_VERSION(0.12.1)
278 AM_GNU_GETTEXT([external])
279 AC_DEFINE_UNQUOTED(LOCALEDIR, "${datadir}/locale", [locale directory])