1 dnl Process this file with autoconf to produce a configure script.
3 AM_INIT_AUTOMAKE(shadow, 4.0.14)
4 AC_CONFIG_HEADERS([config.h])
7 test "$prefix" = "NONE" && prefix="/usr"
8 test "$prefix" = "/usr" && exec_prefix=""
17 dnl Checks for programs.
25 dnl Checks for libraries.
27 dnl Checks for header files.
32 AC_CHECK_HEADERS(errno.h fcntl.h limits.h unistd.h sys/time.h utmp.h \
33 utmpx.h termios.h termio.h sgtty.h sys/ioctl.h syslog.h paths.h \
34 utime.h ulimit.h sys/resource.h gshadow.h shadow.h lastlog.h \
35 locale.h rpc/key_prot.h)
37 AC_CHECK_FUNCS(a64l fchmod fchown fsync getgroups gethostname getspnam \
38 gettimeofday getusershell getutent initgroups lchown lckpwdf lstat \
39 memcpy memset setgroups sigaction strchr updwtmp updwtmpx)
42 dnl Checks for typedefs, structures, and compiler characteristics.
49 AC_CHECK_MEMBERS([struct stat.st_rdev])
53 if test "$ac_cv_header_utmp_h" = "yes"; then
54 AC_CACHE_CHECK(for ut_host in struct utmp,
55 ac_cv_struct_utmp_ut_host,
57 [AC_LANG_PROGRAM([#include <utmp.h>],
58 [struct utmp ut; char *cp = ut.ut_host;]
60 [ac_cv_struct_utmp_ut_host=yes],
61 [ac_cv_struct_utmp_ut_host=no]
65 if test "$ac_cv_struct_utmp_ut_host" = "yes"; then
66 AC_DEFINE(UT_HOST, 1, [Define if you have ut_host in struct utmp.])
69 AC_CACHE_CHECK(for ut_user in struct utmp,
70 ac_cv_struct_utmp_ut_user,
71 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <utmp.h>],
72 [struct utmp ut; char *cp = ut.ut_user;]
74 [ac_cv_struct_utmp_ut_user=yes],
75 [ac_cv_struct_utmp_ut_user=no]
79 if test "$ac_cv_struct_utmp_ut_user" = "no"; then
80 AC_DEFINE(ut_user, ut_name,
81 [Define to ut_name if struct utmp has ut_name (not ut_user).])
85 if test "$ac_cv_header_lastlog_h" = "yes"; then
86 AC_CACHE_CHECK(for ll_host in struct lastlog,
87 ac_cv_struct_lastlog_ll_host,
88 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <lastlog.h>],
89 [struct lastlog ll; char *cp = ll.ll_host;]
91 [ac_cv_struct_lastlog_ll_host=yes],
92 [ac_cv_struct_lastlog_ll_host=no]
96 if test "$ac_cv_struct_lastlog_ll_host" = "yes"; then
97 AC_DEFINE(HAVE_LL_HOST, 1,
98 [Define if struct lastlog has ll_host])
102 dnl Checks for library functions.
107 AC_REPLACE_FUNCS(mkdir putgrent putpwent putspent rename rmdir)
108 AC_REPLACE_FUNCS(sgetgrent sgetpwent sgetspent)
109 AC_REPLACE_FUNCS(snprintf strcasecmp strdup strerror strstr)
111 AC_CHECK_FUNC(setpgrp)
114 if test "$ac_cv_header_shadow_h" = "yes"; then
115 AC_CACHE_CHECK(for working shadow group support,
116 ac_cv_libc_shadowgrp,
117 AC_RUN_IFELSE([AC_LANG_SOURCE([
121 struct sgrp *sg = sgetsgent("test:x::");
122 /* NYS libc on Red Hat 3.0.3 has broken shadow group support */
123 return !sg || !sg->sg_adm || !sg->sg_mem;
126 [ac_cv_libc_shadowgrp=yes],
127 [ac_cv_libc_shadowgrp=no],
128 [ac_cv_libc_shadowgrp=no]
132 if test "$ac_cv_libc_shadowgrp" = "yes"; then
133 AC_DEFINE(HAVE_SHADOWGRP, 1, [Have working shadow group support in libc])
137 AC_CACHE_CHECK([location of shared mail directory], shadow_cv_maildir,
138 [for shadow_cv_maildir in /var/mail /var/spool/mail /usr/spool/mail /usr/mail none; do
139 if test -d $shadow_cv_maildir; then
143 if test $shadow_cv_maildir != none; then
144 AC_DEFINE_UNQUOTED(MAIL_SPOOL_DIR, "$shadow_cv_maildir",
145 [Location of system mail spool directory.])
148 AC_CACHE_CHECK([location of user mail file], shadow_cv_mailfile,
149 [for shadow_cv_mailfile in Mailbox mailbox Mail mail .mail none; do
150 if test -f $HOME/$shadow_cv_mailfile; then
154 if test $shadow_cv_mailfile != none; then
155 AC_DEFINE_UNQUOTED(MAIL_SPOOL_FILE, "$shadow_cv_mailfile",
156 [Name of user's mail spool file if stored in user's home directory.])
159 AC_CACHE_CHECK([location of utmp], shadow_cv_utmpdir,
160 [for shadow_cv_utmpdir in /var/run /var/adm /usr/adm /etc none; do
161 if test -f $shadow_cv_utmpdir/utmp; then
165 if test "$shadow_cv_utmpdir" = "none"; then
166 AC_MSG_WARN(utmp file not found)
168 AC_DEFINE_UNQUOTED(_UTMP_FILE, "$shadow_cv_utmpdir/utmp",
169 [Path for utmp file.])
171 AC_CACHE_CHECK([location of faillog/lastlog/wtmp], shadow_cv_logdir,
172 [for shadow_cv_logdir in /var/log /var/adm /usr/adm /etc; do
173 if test -d $shadow_cv_logdir; then
177 AC_DEFINE_UNQUOTED(_WTMP_FILE, "$shadow_cv_logdir/wtmp",
178 [Path for wtmp file.])
179 AC_DEFINE_UNQUOTED(LASTLOG_FILE, "$shadow_cv_logdir/lastlog",
180 [Path for lastlog file.])
181 AC_DEFINE_UNQUOTED(FAILLOG_FILE, "$shadow_cv_logdir/faillog",
182 [Path for faillog file.])
184 AC_CACHE_CHECK([location of the passwd program], shadow_cv_passwd_dir,
185 [if test -f /usr/bin/passwd; then
186 shadow_cv_passwd_dir=/usr/bin
188 shadow_cv_passwd_dir=/bin
190 AC_DEFINE_UNQUOTED(PASSWD_PROGRAM, "$shadow_cv_passwd_dir/passwd",
191 [Path to passwd program.])
193 dnl XXX - quick hack, should disappear before anyone notices :).
194 AC_DEFINE(USE_SYSLOG, 1, [Define to use syslog().])
195 AC_DEFINE(RLOGIN, 1, [Define if login should support the -r flag for rlogind.])
196 AC_DEFINE(RUSEROK, 0, [Define to the ruserok() "success" return value (0 or 1).])
198 dnl Use our own version of getpass(), which handles long passwords
199 dnl (unlike many systems which have a limit of 8 characters), and can
200 dnl be interrupted with Ctrl-C (unlike Linux libc).
201 AC_DEFINE(getpass, libshadow_getpass,
202 [Define to libshadow_getpass to use our own version of getpass().])
204 AC_ARG_ENABLE(shadowgrp,
205 [AC_HELP_STRING([--enable-shadowgrp], [enable shadow group support @<:@default=yes@:>@])],
206 [case "${enableval}" in
207 yes) enable_shadowgrp="yes" ;;
208 no) enable_shadowgrp="no" ;;
209 *) AC_MSG_ERROR(bad value ${enableval} for --enable-shadowgrp) ;;
211 [enable_shadowgrp="yes"]
215 [AC_HELP_STRING([--enable-man],
216 [regenerate roff man pages from Docbook @<:@default=no@:>@])],
222 [AC_HELP_STRING([--with-audit], [use auditing support @<:@default=yes if found@:>@])],
223 [with_audit=$withval], [with_audit=yes])
225 [AC_HELP_STRING([--with-libpam], [use libpam for PAM support @<:@default=yes if found@:>@])],
226 [with_libpam=$withval], [with_libpam=yes])
228 [AC_HELP_STRING([--with-selinux], [use SELinux support @<:@default=autodetect@:>@])],
229 [with_selinux=$withval], [with_selinux=yes])
231 [AC_HELP_STRING([--with-skey], [use S/Key support @<:@default=no@:>@])],
232 [with_skey=$withval], [with_skey=no])
233 AC_ARG_WITH(libcrack,
234 [AC_HELP_STRING([--with-libcrack], [use libcrack @<:@default=yes if found and if PAM not enabled@:>@])],
235 [with_libcrack=$withval], [with_libcrack=no])
237 dnl Check for some functions in libc first, only if not found check for
238 dnl other libraries. This should prevent linking libnsl if not really
239 dnl needed (Linux glibc, Irix), but still link it if needed (Solaris).
241 AC_SEARCH_LIBS(inet_ntoa, inet)
242 AC_SEARCH_LIBS(socket, socket)
243 AC_SEARCH_LIBS(gethostbyname, nsl)
245 if test "$enable_shadowgrp" = "yes"; then
246 AC_DEFINE(SHADOWGRP, 1, [Define to support the shadow group file.])
249 if test "$enable_man" = "yes"; then
251 dnl Check for xsltproc
253 AC_PATH_PROG([XSLTPROC], [xsltproc])
254 if test -z "$XSLTPROC"; then
258 dnl check for DocBook DTD and stylesheets in the local catalog.
259 JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.1.2//EN],
260 [DocBook XML DTD V4.1.2], [], enable_man=no)
261 JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
262 [DocBook XSL Stylesheets], [], enable_man=no)
264 AM_CONDITIONAL(ENABLE_REGENERATE_MAN, test x$enable_man != xno)
267 AC_CHECK_LIB(crypt, crypt, [LIBCRYPT=-lcrypt],
268 [AC_MSG_ERROR([crypt() not found])])
271 if test "$with_audit" = "yes"; then
272 AC_CHECK_HEADER(libaudit.h, [audit_header="yes"], [audit_header="no"])
273 if test "$audit_header" = "yes"; then
274 AC_CHECK_LIB(audit, audit_log_acct_message,
275 [AC_DEFINE(WITH_AUDIT, 1, [Define if you want to enable Audit messages])
281 if test "$with_libcrack" = "yes"; then
282 echo "checking cracklib flavour, don't be surprised by the results"
283 AC_CHECK_LIB(crack, FascistCheck,
284 [LIBCRACK=-lcrack AC_DEFINE(HAVE_LIBCRACK, 1, [Defined if you have libcrack.])])
285 AC_CHECK_LIB(crack, FascistHistory,
286 AC_DEFINE(HAVE_LIBCRACK_HIST, 1, [Defined if you have the ts&szs cracklib.]))
287 AC_CHECK_LIB(crack, FascistHistoryPw,
288 AC_DEFINE(HAVE_LIBCRACK_PW, 1, [Defined if it includes *Pw functions.]))
291 if test "$with_selinux" = "yes"; then
292 AC_CHECK_LIB(selinux, is_selinux_enabled,
293 [LIBSELINUX="-lselinux"],
294 [AC_MSG_ERROR([libselinux not found])])
296 AC_CHECK_HEADERS(selinux/selinux.h, [], [selinux/selinux.h is missing])
297 AC_DEFINE(WITH_SELINUX, 1, [Build shadow with SELinux support])
301 if test "$with_libpam" = "yes"; then
302 AC_CHECK_LIB(pam, pam_start,
303 [AC_DEFINE(USE_PAM, 1, [Define to support Pluggable Authentication Modules])
305 AC_CHECK_LIB(pam_misc, main,
306 [LIBPAM="$LIBPAM -lpam_misc"],
307 AC_MSG_ERROR(libpam_misc is missing for enable PAM support)
309 [AC_MSG_CHECKING(use login access checking if PAM not used)
312 AC_MSG_CHECKING(use login and su access checking if PAM not used)
315 AC_MSG_CHECKING(use login and su access checking if PAM not used)
316 AC_DEFINE(SU_ACCESS, 1, [Define to support /etc/suauth su access control.])
322 if test "$with_skey" = "yes"; then
323 AC_CHECK_LIB(md, MD5Init, [LIBMD=-lmd])
324 AC_CHECK_LIB(skey, skeychallenge, [LIBSKEY=-lskey],
325 [AC_MSG_ERROR([liskey missing. You can download S/Key source code from http://rsync1.it.gentoo.org/gentoo/distfiles/skey-1.1.5.tar.bz2])])
326 AC_DEFINE(SKEY, 1, [Define to support S/Key logins.])
329 AM_GNU_GETTEXT_VERSION(0.12.1)
330 AM_GNU_GETTEXT([external], [need-ngettext])
364 echo "shadow will be compiled with the followig feactures:"
366 echo " auditing support: $with_audit"
367 echo " CrackLib support: $with_libcrack"
368 echo " PAM support: $with_libpam"
369 echo " SELinux support: $with_selinux"
370 echo " shadow group support: $enable_shadowgrp"
371 echo " S/Key support: $with_skey"