1 dnl Process this file with autoconf to produce a configure script.
3 AM_INIT_AUTOMAKE(shadow, 4.1.0)
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 netdb.h)
37 AC_CHECK_FUNCS(l64a fchmod fchown fsync getgroups gethostname getspnam \
38 gettimeofday getusershell getutent initgroups lchown lckpwdf lstat \
39 memcpy memset setgroups sigaction strchr updwtmp updwtmpx innetgr \
40 getpwnam_r getpwuid_r getgrnam_r getgrgid_r getspnam_r)
43 dnl Checks for typedefs, structures, and compiler characteristics.
50 AC_CHECK_MEMBERS([struct stat.st_rdev])
54 if test "$ac_cv_header_utmp_h" = "yes"; then
55 AC_CACHE_CHECK(for ut_host in struct utmp,
56 ac_cv_struct_utmp_ut_host,
58 [AC_LANG_PROGRAM([#include <utmp.h>],
59 [struct utmp ut; char *cp = ut.ut_host;]
61 [ac_cv_struct_utmp_ut_host=yes],
62 [ac_cv_struct_utmp_ut_host=no]
66 if test "$ac_cv_struct_utmp_ut_host" = "yes"; then
67 AC_DEFINE(UT_HOST, 1, [Define if you have ut_host in struct utmp.])
70 AC_CACHE_CHECK(for ut_user in struct utmp,
71 ac_cv_struct_utmp_ut_user,
72 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <utmp.h>],
73 [struct utmp ut; char *cp = ut.ut_user;]
75 [ac_cv_struct_utmp_ut_user=yes],
76 [ac_cv_struct_utmp_ut_user=no]
80 if test "$ac_cv_struct_utmp_ut_user" = "no"; then
81 AC_DEFINE(ut_user, ut_name,
82 [Define to ut_name if struct utmp has ut_name (not ut_user).])
86 if test "$ac_cv_header_lastlog_h" = "yes"; then
87 AC_CACHE_CHECK(for ll_host in struct lastlog,
88 ac_cv_struct_lastlog_ll_host,
89 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <lastlog.h>],
90 [struct lastlog ll; char *cp = ll.ll_host;]
92 [ac_cv_struct_lastlog_ll_host=yes],
93 [ac_cv_struct_lastlog_ll_host=no]
97 if test "$ac_cv_struct_lastlog_ll_host" = "yes"; then
98 AC_DEFINE(HAVE_LL_HOST, 1,
99 [Define if struct lastlog has ll_host])
103 dnl Checks for library functions.
108 AC_REPLACE_FUNCS(mkdir putgrent putpwent putspent rename rmdir)
109 AC_REPLACE_FUNCS(sgetgrent sgetpwent sgetspent)
110 AC_REPLACE_FUNCS(snprintf strcasecmp strdup strerror strstr)
112 AC_CHECK_FUNC(setpgrp)
115 if test "$ac_cv_header_shadow_h" = "yes"; then
116 AC_CACHE_CHECK(for working shadow group support,
117 ac_cv_libc_shadowgrp,
118 AC_RUN_IFELSE([AC_LANG_SOURCE([
122 struct sgrp *sg = sgetsgent("test:x::");
123 /* NYS libc on Red Hat 3.0.3 has broken shadow group support */
124 return !sg || !sg->sg_adm || !sg->sg_mem;
127 [ac_cv_libc_shadowgrp=yes],
128 [ac_cv_libc_shadowgrp=no],
129 [ac_cv_libc_shadowgrp=no]
133 if test "$ac_cv_libc_shadowgrp" = "yes"; then
134 AC_DEFINE(HAVE_SHADOWGRP, 1, [Have working shadow group support in libc])
138 AC_CACHE_CHECK([location of shared mail directory], shadow_cv_maildir,
139 [for shadow_cv_maildir in /var/mail /var/spool/mail /usr/spool/mail /usr/mail none; do
140 if test -d $shadow_cv_maildir; then
144 if test $shadow_cv_maildir != none; then
145 AC_DEFINE_UNQUOTED(MAIL_SPOOL_DIR, "$shadow_cv_maildir",
146 [Location of system mail spool directory.])
149 AC_CACHE_CHECK([location of user mail file], shadow_cv_mailfile,
150 [for shadow_cv_mailfile in Mailbox mailbox Mail mail .mail none; do
151 if test -f $HOME/$shadow_cv_mailfile; then
155 if test $shadow_cv_mailfile != none; then
156 AC_DEFINE_UNQUOTED(MAIL_SPOOL_FILE, "$shadow_cv_mailfile",
157 [Name of user's mail spool file if stored in user's home directory.])
160 AC_CACHE_CHECK([location of utmp], shadow_cv_utmpdir,
161 [for shadow_cv_utmpdir in /var/run /var/adm /usr/adm /etc none; do
162 if test -f $shadow_cv_utmpdir/utmp; then
166 if test "$shadow_cv_utmpdir" = "none"; then
167 AC_MSG_WARN(utmp file not found)
169 AC_DEFINE_UNQUOTED(_UTMP_FILE, "$shadow_cv_utmpdir/utmp",
170 [Path for utmp file.])
172 AC_CACHE_CHECK([location of faillog/lastlog/wtmp], shadow_cv_logdir,
173 [for shadow_cv_logdir in /var/log /var/adm /usr/adm /etc; do
174 if test -d $shadow_cv_logdir; then
178 AC_DEFINE_UNQUOTED(_WTMP_FILE, "$shadow_cv_logdir/wtmp",
179 [Path for wtmp file.])
180 AC_DEFINE_UNQUOTED(LASTLOG_FILE, "$shadow_cv_logdir/lastlog",
181 [Path for lastlog file.])
182 AC_DEFINE_UNQUOTED(FAILLOG_FILE, "$shadow_cv_logdir/faillog",
183 [Path for faillog file.])
185 AC_CACHE_CHECK([location of the passwd program], shadow_cv_passwd_dir,
186 [if test -f /usr/bin/passwd; then
187 shadow_cv_passwd_dir=/usr/bin
189 shadow_cv_passwd_dir=/bin
191 AC_DEFINE_UNQUOTED(PASSWD_PROGRAM, "$shadow_cv_passwd_dir/passwd",
192 [Path to passwd program.])
194 dnl XXX - quick hack, should disappear before anyone notices :).
195 AC_DEFINE(USE_SYSLOG, 1, [Define to use syslog().])
196 AC_DEFINE(RLOGIN, 1, [Define if login should support the -r flag for rlogind.])
197 AC_DEFINE(RUSEROK, 0, [Define to the ruserok() "success" return value (0 or 1).])
199 AC_ARG_ENABLE(shadowgrp,
200 [AC_HELP_STRING([--enable-shadowgrp], [enable shadow group support @<:@default=yes@:>@])],
201 [case "${enableval}" in
202 yes) enable_shadowgrp="yes" ;;
203 no) enable_shadowgrp="no" ;;
204 *) AC_MSG_ERROR(bad value ${enableval} for --enable-shadowgrp) ;;
206 [enable_shadowgrp="yes"]
210 [AC_HELP_STRING([--enable-man],
211 [regenerate roff man pages from Docbook @<:@default=no@:>@])],
217 [AC_HELP_STRING([--with-audit], [use auditing support @<:@default=yes if found@:>@])],
218 [with_audit=$withval], [with_audit=yes])
220 [AC_HELP_STRING([--with-libpam], [use libpam for PAM support @<:@default=yes if found@:>@])],
221 [with_libpam=$withval], [with_libpam=yes])
223 [AC_HELP_STRING([--with-selinux], [use SELinux support @<:@default=autodetect@:>@])],
224 [with_selinux=$withval], [with_selinux=yes])
226 [AC_HELP_STRING([--with-skey], [use S/Key support @<:@default=no@:>@])],
227 [with_skey=$withval], [with_skey=no])
228 AC_ARG_WITH(libcrack,
229 [AC_HELP_STRING([--with-libcrack], [use libcrack @<:@default=yes if found and if PAM not enabled@:>@])],
230 [with_libcrack=$withval], [with_libcrack=no])
231 AC_ARG_WITH(sha-crypt,
232 [AC_HELP_STRING([--with-sha-crypt], [allow the SHA256 and SHA512 password encryption algorithms @<:@default=yes@:>@])],
233 [with_sha_crypt=$withval], [with_sha_crypt=yes])
235 AM_CONDITIONAL(USE_SHA_CRYPT, test "x$with_sha_crypt" = "xyes")
236 if test "$with_sha_crypt" = "yes"; then
237 AC_DEFINE(USE_SHA_CRYPT, 1, [Define to allow the SHA256 and SHA512 password encryption algorithms])
240 dnl Check for some functions in libc first, only if not found check for
241 dnl other libraries. This should prevent linking libnsl if not really
242 dnl needed (Linux glibc, Irix), but still link it if needed (Solaris).
244 AC_SEARCH_LIBS(inet_ntoa, inet)
245 AC_SEARCH_LIBS(socket, socket)
246 AC_SEARCH_LIBS(gethostbyname, nsl)
248 if test "$enable_shadowgrp" = "yes"; then
249 AC_DEFINE(SHADOWGRP, 1, [Define to support the shadow group file.])
251 AM_CONDITIONAL(SHADOWGRP, test "x$enable_shadowgrp" = "xyes")
253 if test "$enable_man" = "yes"; then
255 dnl Check for xsltproc
257 AC_PATH_PROG([XSLTPROC], [xsltproc])
258 if test -z "$XSLTPROC"; then
262 dnl check for DocBook DTD and stylesheets in the local catalog.
263 JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.1.2//EN],
264 [DocBook XML DTD V4.1.2], [], enable_man=no)
265 JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
266 [DocBook XSL Stylesheets >= 1.70.1], [], enable_man=no)
268 AM_CONDITIONAL(ENABLE_REGENERATE_MAN, test x$enable_man != xno)
271 AC_CHECK_LIB(crypt, crypt, [LIBCRYPT=-lcrypt],
272 [AC_MSG_ERROR([crypt() not found])])
275 if test "$with_audit" = "yes"; then
276 AC_CHECK_HEADER(libaudit.h, [audit_header="yes"], [audit_header="no"])
277 if test "$audit_header" = "yes"; then
278 AC_CHECK_LIB(audit, audit_log_acct_message,
279 [AC_DEFINE(WITH_AUDIT, 1, [Define if you want to enable Audit messages])
285 if test "$with_libcrack" = "yes"; then
286 echo "checking cracklib flavour, don't be surprised by the results"
287 AC_CHECK_LIB(crack, FascistCheck,
288 [LIBCRACK=-lcrack AC_DEFINE(HAVE_LIBCRACK, 1, [Defined if you have libcrack.])])
289 AC_CHECK_LIB(crack, FascistHistory,
290 AC_DEFINE(HAVE_LIBCRACK_HIST, 1, [Defined if you have the ts&szs cracklib.]))
291 AC_CHECK_LIB(crack, FascistHistoryPw,
292 AC_DEFINE(HAVE_LIBCRACK_PW, 1, [Defined if it includes *Pw functions.]))
295 if test "$with_selinux" = "yes"; then
296 AC_CHECK_LIB(selinux, is_selinux_enabled,
297 [LIBSELINUX="-lselinux"
299 AC_CHECK_HEADERS(selinux/selinux.h, [],
300 [AC_MSG_ERROR([selinux/selinux.h is missing])])
301 AC_DEFINE(WITH_SELINUX, 1, [Build shadow with SELinux support])
303 [AC_MSG_ERROR([libselinux not found])])
307 if test "$with_libpam" = "yes"; then
308 AC_CHECK_LIB(pam, pam_start,
309 [AC_DEFINE(USE_PAM, 1, [Define to support Pluggable Authentication Modules])
310 AM_CONDITIONAL(USE_PAM, [true])
312 AC_CHECK_LIB(pam_misc, main,
313 [LIBPAM="$LIBPAM -lpam_misc"],
314 AC_MSG_ERROR(libpam_misc is missing for enable PAM support)
316 [AC_MSG_CHECKING(use login access checking if PAM not used)
317 AM_CONDITIONAL(USE_PAM, [false])
320 AC_MSG_CHECKING(use login and su access checking if PAM not used)
323 AC_MSG_CHECKING(use login and su access checking if PAM not used)
324 AC_DEFINE(SU_ACCESS, 1, [Define to support /etc/suauth su access control.])
326 AM_CONDITIONAL(USE_PAM, [false])
331 if test "$with_skey" = "yes"; then
332 AC_CHECK_LIB(md, MD5Init, [LIBMD=-lmd])
333 AC_CHECK_LIB(skey, skeychallenge, [LIBSKEY=-lskey],
334 [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])])
335 AC_DEFINE(SKEY, 1, [Define to support S/Key logins.])
340 skeychallenge((void*)0, (void*)0, (void*)0, 0);
341 ],[AC_DEFINE(SKEY_BSD_STYLE, 1, [Define to support newer BSD S/Key API])])
344 AM_GNU_GETTEXT_VERSION(0.16)
345 AM_GNU_GETTEXT([external], [need-ngettext])
346 AM_CONDITIONAL(USE_NLS, test "x$USE_NLS" = "xyes")
382 echo "shadow will be compiled with the following features:"
384 echo " auditing support: $with_audit"
385 echo " CrackLib support: $with_libcrack"
386 echo " PAM support: $with_libpam"
387 echo " SELinux support: $with_selinux"
388 echo " shadow group support: $enable_shadowgrp"
389 echo " S/Key support: $with_skey"
390 echo " SHA passwords encryption: $with_sha_crypt"