1 dnl Process this file with autoconf to produce a configure script.
3 AM_INIT_AUTOMAKE(shadow, 4.1.1)
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 lastlog.h \
35 locale.h rpc/key_prot.h netdb.h)
37 dnl shadow now uses the libc's shadow implementation
38 AC_CHECK_HEADER([shadow.h],,[AC_MSG_ERROR([You need a libc with shadow.h])])
40 AC_CHECK_FUNCS(l64a fchmod fchown fsync getgroups gethostname getspnam \
41 gettimeofday getusershell getutent initgroups lchown lckpwdf lstat \
42 memcpy memset setgroups sigaction strchr updwtmp updwtmpx innetgr \
43 getpwnam_r getpwuid_r getgrnam_r getgrgid_r getspnam_r)
46 dnl Checks for typedefs, structures, and compiler characteristics.
53 AC_CHECK_MEMBERS([struct stat.st_rdev])
57 if test "$ac_cv_header_utmp_h" = "yes"; then
58 AC_CACHE_CHECK(for ut_host in struct utmp,
59 ac_cv_struct_utmp_ut_host,
61 [AC_LANG_PROGRAM([#include <utmp.h>],
62 [struct utmp ut; char *cp = ut.ut_host;]
64 [ac_cv_struct_utmp_ut_host=yes],
65 [ac_cv_struct_utmp_ut_host=no]
69 if test "$ac_cv_struct_utmp_ut_host" = "yes"; then
70 AC_DEFINE(UT_HOST, 1, [Define if you have ut_host in struct utmp.])
73 AC_CACHE_CHECK(for ut_user in struct utmp,
74 ac_cv_struct_utmp_ut_user,
75 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <utmp.h>],
76 [struct utmp ut; char *cp = ut.ut_user;]
78 [ac_cv_struct_utmp_ut_user=yes],
79 [ac_cv_struct_utmp_ut_user=no]
83 if test "$ac_cv_struct_utmp_ut_user" = "no"; then
84 AC_DEFINE(ut_user, ut_name,
85 [Define to ut_name if struct utmp has ut_name (not ut_user).])
89 if test "$ac_cv_header_lastlog_h" = "yes"; then
90 AC_CACHE_CHECK(for ll_host in struct lastlog,
91 ac_cv_struct_lastlog_ll_host,
92 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <lastlog.h>],
93 [struct lastlog ll; char *cp = ll.ll_host;]
95 [ac_cv_struct_lastlog_ll_host=yes],
96 [ac_cv_struct_lastlog_ll_host=no]
100 if test "$ac_cv_struct_lastlog_ll_host" = "yes"; then
101 AC_DEFINE(HAVE_LL_HOST, 1,
102 [Define if struct lastlog has ll_host])
106 dnl Checks for library functions.
111 AC_REPLACE_FUNCS(mkdir putgrent putpwent putspent rename rmdir)
112 AC_REPLACE_FUNCS(sgetgrent sgetpwent sgetspent)
113 AC_REPLACE_FUNCS(snprintf strcasecmp strdup strerror strstr)
115 AC_CHECK_FUNC(setpgrp)
118 if test "$ac_cv_header_shadow_h" = "yes"; then
119 AC_CACHE_CHECK(for working shadow group support,
120 ac_cv_libc_shadowgrp,
121 AC_RUN_IFELSE([AC_LANG_SOURCE([
125 struct sgrp *sg = sgetsgent("test:x::");
126 /* NYS libc on Red Hat 3.0.3 has broken shadow group support */
127 return !sg || !sg->sg_adm || !sg->sg_mem;
130 [ac_cv_libc_shadowgrp=yes],
131 [ac_cv_libc_shadowgrp=no],
132 [ac_cv_libc_shadowgrp=no]
136 if test "$ac_cv_libc_shadowgrp" = "yes"; then
137 AC_DEFINE(HAVE_SHADOWGRP, 1, [Have working shadow group support in libc])
141 AC_CACHE_CHECK([location of shared mail directory], shadow_cv_maildir,
142 [for shadow_cv_maildir in /var/mail /var/spool/mail /usr/spool/mail /usr/mail none; do
143 if test -d $shadow_cv_maildir; then
147 if test $shadow_cv_maildir != none; then
148 AC_DEFINE_UNQUOTED(MAIL_SPOOL_DIR, "$shadow_cv_maildir",
149 [Location of system mail spool directory.])
152 AC_CACHE_CHECK([location of user mail file], shadow_cv_mailfile,
153 [for shadow_cv_mailfile in Mailbox mailbox Mail mail .mail none; do
154 if test -f $HOME/$shadow_cv_mailfile; then
158 if test $shadow_cv_mailfile != none; then
159 AC_DEFINE_UNQUOTED(MAIL_SPOOL_FILE, "$shadow_cv_mailfile",
160 [Name of user's mail spool file if stored in user's home directory.])
163 AC_CACHE_CHECK([location of utmp], shadow_cv_utmpdir,
164 [for shadow_cv_utmpdir in /var/run /var/adm /usr/adm /etc none; do
165 if test -f $shadow_cv_utmpdir/utmp; then
169 if test "$shadow_cv_utmpdir" = "none"; then
170 AC_MSG_WARN(utmp file not found)
172 AC_DEFINE_UNQUOTED(_UTMP_FILE, "$shadow_cv_utmpdir/utmp",
173 [Path for utmp file.])
175 AC_CACHE_CHECK([location of faillog/lastlog/wtmp], shadow_cv_logdir,
176 [for shadow_cv_logdir in /var/log /var/adm /usr/adm /etc; do
177 if test -d $shadow_cv_logdir; then
181 AC_DEFINE_UNQUOTED(_WTMP_FILE, "$shadow_cv_logdir/wtmp",
182 [Path for wtmp file.])
183 AC_DEFINE_UNQUOTED(LASTLOG_FILE, "$shadow_cv_logdir/lastlog",
184 [Path for lastlog file.])
185 AC_DEFINE_UNQUOTED(FAILLOG_FILE, "$shadow_cv_logdir/faillog",
186 [Path for faillog file.])
188 AC_CACHE_CHECK([location of the passwd program], shadow_cv_passwd_dir,
189 [if test -f /usr/bin/passwd; then
190 shadow_cv_passwd_dir=/usr/bin
192 shadow_cv_passwd_dir=/bin
194 AC_DEFINE_UNQUOTED(PASSWD_PROGRAM, "$shadow_cv_passwd_dir/passwd",
195 [Path to passwd program.])
197 dnl XXX - quick hack, should disappear before anyone notices :).
198 AC_DEFINE(USE_SYSLOG, 1, [Define to use syslog().])
199 AC_DEFINE(RLOGIN, 1, [Define if login should support the -r flag for rlogind.])
200 AC_DEFINE(RUSEROK, 0, [Define to the ruserok() "success" return value (0 or 1).])
202 AC_ARG_ENABLE(shadowgrp,
203 [AC_HELP_STRING([--enable-shadowgrp], [enable shadow group support @<:@default=yes@:>@])],
204 [case "${enableval}" in
205 yes) enable_shadowgrp="yes" ;;
206 no) enable_shadowgrp="no" ;;
207 *) AC_MSG_ERROR(bad value ${enableval} for --enable-shadowgrp) ;;
209 [enable_shadowgrp="yes"]
213 [AC_HELP_STRING([--enable-man],
214 [regenerate roff man pages from Docbook @<:@default=no@:>@])],
220 [AC_HELP_STRING([--with-audit], [use auditing support @<:@default=yes if found@:>@])],
221 [with_audit=$withval], [with_audit=maybe])
223 [AC_HELP_STRING([--with-libpam], [use libpam for PAM support @<:@default=yes if found@:>@])],
224 [with_libpam=$withval], [with_libpam=yes])
226 [AC_HELP_STRING([--with-selinux], [use SELinux support @<:@default=yes if found@:>@])],
227 [with_selinux=$withval], [with_selinux=yes])
229 [AC_HELP_STRING([--with-skey], [use S/Key support @<:@default=no@:>@])],
230 [with_skey=$withval], [with_skey=no])
231 AC_ARG_WITH(libcrack,
232 [AC_HELP_STRING([--with-libcrack], [use libcrack @<:@default=yes if found and if PAM not enabled@:>@])],
233 [with_libcrack=$withval], [with_libcrack=no])
234 AC_ARG_WITH(sha-crypt,
235 [AC_HELP_STRING([--with-sha-crypt], [allow the SHA256 and SHA512 password encryption algorithms @<:@default=yes@:>@])],
236 [with_sha_crypt=$withval], [with_sha_crypt=yes])
238 AM_CONDITIONAL(USE_SHA_CRYPT, test "x$with_sha_crypt" = "xyes")
239 if test "$with_sha_crypt" = "yes"; then
240 AC_DEFINE(USE_SHA_CRYPT, 1, [Define to allow the SHA256 and SHA512 password encryption algorithms])
243 dnl Check for some functions in libc first, only if not found check for
244 dnl other libraries. This should prevent linking libnsl if not really
245 dnl needed (Linux glibc, Irix), but still link it if needed (Solaris).
247 AC_SEARCH_LIBS(inet_ntoa, inet)
248 AC_SEARCH_LIBS(socket, socket)
249 AC_SEARCH_LIBS(gethostbyname, nsl)
251 if test "$enable_shadowgrp" = "yes"; then
252 AC_DEFINE(SHADOWGRP, 1, [Define to support the shadow group file.])
254 AM_CONDITIONAL(SHADOWGRP, test "x$enable_shadowgrp" = "xyes")
256 if test "$enable_man" = "yes"; then
258 dnl Check for xsltproc
260 AC_PATH_PROG([XSLTPROC], [xsltproc])
261 if test -z "$XSLTPROC"; then
265 dnl check for DocBook DTD and stylesheets in the local catalog.
266 JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.1.2//EN],
267 [DocBook XML DTD V4.1.2], [], enable_man=no)
268 JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
269 [DocBook XSL Stylesheets >= 1.70.1], [], enable_man=no)
271 AM_CONDITIONAL(ENABLE_REGENERATE_MAN, test x$enable_man != xno)
274 AC_CHECK_LIB(crypt, crypt, [LIBCRYPT=-lcrypt],
275 [AC_MSG_ERROR([crypt() not found])])
278 if test "$with_audit" != "no"; then
279 AC_CHECK_HEADER(libaudit.h, [audit_header="yes"], [audit_header="no"])
280 if test "$audit_header$with_audit" = "noyes" ; then
281 AC_MSG_ERROR([libaudit.h is missing])
282 elif test "$audit_header" = "yes"; then
283 AC_CHECK_LIB(audit, audit_log_acct_message,
284 [audit_lib="yes"], [audit_lib="no"])
285 if test "$audit_lib$with_audit" = "noyes" ; then
286 AC_MSG_ERROR([libaudit not found])
287 elif test "$audit_lib" = "no" ; then
290 AC_DEFINE(WITH_AUDIT, 1,
291 [Define if you want to enable Audit messages])
301 if test "$with_libcrack" = "yes"; then
302 echo "checking cracklib flavour, don't be surprised by the results"
303 AC_CHECK_LIB(crack, FascistCheck,
304 [LIBCRACK=-lcrack AC_DEFINE(HAVE_LIBCRACK, 1, [Defined if you have libcrack.])])
305 AC_CHECK_LIB(crack, FascistHistory,
306 AC_DEFINE(HAVE_LIBCRACK_HIST, 1, [Defined if you have the ts&szs cracklib.]))
307 AC_CHECK_LIB(crack, FascistHistoryPw,
308 AC_DEFINE(HAVE_LIBCRACK_PW, 1, [Defined if it includes *Pw functions.]))
311 if test "$with_selinux" = "yes"; then
312 AC_CHECK_LIB(selinux, is_selinux_enabled,
313 [LIBSELINUX="-lselinux"
315 AC_CHECK_HEADERS(selinux/selinux.h, [],
316 [AC_MSG_ERROR([selinux/selinux.h is missing])])
317 AC_DEFINE(WITH_SELINUX, 1, [Build shadow with SELinux support])
319 [AC_MSG_ERROR([libselinux not found])])
323 if test "$with_libpam" = "yes"; then
324 AC_CHECK_LIB(pam, pam_start,
325 [AC_DEFINE(USE_PAM, 1, [Define to support Pluggable Authentication Modules])
326 AM_CONDITIONAL(USE_PAM, [true])
328 AC_CHECK_LIB(pam_misc, main,
329 [LIBPAM="$LIBPAM -lpam_misc"],
330 AC_MSG_ERROR(libpam_misc is missing for enable PAM support)
332 [AC_MSG_CHECKING(use login access checking if PAM not used)
333 AM_CONDITIONAL(USE_PAM, [false])
336 AC_MSG_CHECKING(use login and su access checking if PAM not used)
339 AC_MSG_CHECKING(use login and su access checking if PAM not used)
340 AC_DEFINE(SU_ACCESS, 1, [Define to support /etc/suauth su access control.])
342 AM_CONDITIONAL(USE_PAM, [false])
347 if test "$with_skey" = "yes"; then
348 AC_CHECK_LIB(md, MD5Init, [LIBMD=-lmd])
349 AC_CHECK_LIB(skey, skeychallenge, [LIBSKEY=-lskey],
350 [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])])
351 AC_DEFINE(SKEY, 1, [Define to support S/Key logins.])
356 skeychallenge((void*)0, (void*)0, (void*)0, 0);
357 ],[AC_DEFINE(SKEY_BSD_STYLE, 1, [Define to support newer BSD S/Key API])])
360 AM_GNU_GETTEXT_VERSION(0.16)
361 AM_GNU_GETTEXT([external], [need-ngettext])
362 AM_CONDITIONAL(USE_NLS, test "x$USE_NLS" = "xyes")
398 echo "shadow will be compiled with the following features:"
400 echo " auditing support: $with_audit"
401 echo " CrackLib support: $with_libcrack"
402 echo " PAM support: $with_libpam"
403 echo " SELinux support: $with_selinux"
404 echo " shadow group support: $enable_shadowgrp"
405 echo " S/Key support: $with_skey"
406 echo " SHA passwords encryption: $with_sha_crypt"