]> granicus.if.org Git - shadow/blob - configure.in
Document --with-selinux as "yes if found" rather than "autodetected" for consistency...
[shadow] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT
3 AM_INIT_AUTOMAKE(shadow, 4.1.1)
4 AC_CONFIG_HEADERS([config.h])
5
6 dnl Some hacks...
7 test "$prefix" = "NONE" && prefix="/usr"
8 test "$prefix" = "/usr" && exec_prefix=""
9
10 AC_GNU_SOURCE
11
12 AM_DISABLE_SHARED
13 AM_ENABLE_STATIC
14
15 AM_MAINTAINER_MODE
16
17 dnl Checks for programs.
18 AC_PROG_CC
19 AC_ISC_POSIX
20 AC_PROG_LN_S
21 AC_PROG_YACC
22 AM_C_PROTOTYPES
23 AM_PROG_LIBTOOL
24
25 dnl Checks for libraries.
26
27 dnl Checks for header files.
28 AC_HEADER_DIRENT
29 AC_HEADER_STDC
30 AC_HEADER_SYS_WAIT
31
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)
36
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])])
39
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)
44 AC_SYS_LARGEFILE
45
46 dnl Checks for typedefs, structures, and compiler characteristics.
47 AC_C_CONST
48 AC_TYPE_UID_T
49 AC_TYPE_OFF_T
50 AC_TYPE_PID_T
51 AC_TYPE_MODE_T
52 AC_HEADER_STAT
53 AC_CHECK_MEMBERS([struct stat.st_rdev])
54 AC_HEADER_TIME
55 AC_STRUCT_TM
56
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,
60                 AC_COMPILE_IFELSE(
61                         [AC_LANG_PROGRAM([#include <utmp.h>],
62                                 [struct utmp ut; char *cp = ut.ut_host;]
63                         )],
64                         [ac_cv_struct_utmp_ut_host=yes],
65                         [ac_cv_struct_utmp_ut_host=no]
66                 )
67         )
68
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.])
71         fi
72
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;]
77                         )],
78                         [ac_cv_struct_utmp_ut_user=yes],
79                         [ac_cv_struct_utmp_ut_user=no]
80                 )
81         )
82
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).])
86         fi
87 fi
88
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;]
94                                 )],
95                         [ac_cv_struct_lastlog_ll_host=yes],
96                         [ac_cv_struct_lastlog_ll_host=no]
97                 )
98         )
99
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])
103         fi
104 fi
105
106 dnl Checks for library functions.
107 AC_TYPE_GETGROUPS
108 AC_TYPE_SIGNAL
109 AC_FUNC_UTIME_NULL
110 AC_FUNC_STRFTIME
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)
114
115 AC_CHECK_FUNC(setpgrp)
116 AC_FUNC_SETPGRP
117
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([
122                                 #include <shadow.h>
123                                 main()
124                                 {
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;
128                                 }]
129                         )],
130                         [ac_cv_libc_shadowgrp=yes],
131                         [ac_cv_libc_shadowgrp=no],
132                         [ac_cv_libc_shadowgrp=no]
133                 )
134         )
135
136         if test "$ac_cv_libc_shadowgrp" = "yes"; then
137                 AC_DEFINE(HAVE_SHADOWGRP, 1, [Have working shadow group support in libc])
138         fi
139 fi
140
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
144                 break
145         fi
146 done])
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.])
150 fi
151
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
155                 break
156         fi
157 done])
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.])
161 fi
162
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
166                 break
167         fi
168 done])
169 if test "$shadow_cv_utmpdir" = "none"; then
170         AC_MSG_WARN(utmp file not found)
171 fi
172 AC_DEFINE_UNQUOTED(_UTMP_FILE, "$shadow_cv_utmpdir/utmp",
173         [Path for utmp file.])
174
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
178                 break
179         fi
180 done])
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.])
187
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
191 else
192         shadow_cv_passwd_dir=/bin
193 fi])
194 AC_DEFINE_UNQUOTED(PASSWD_PROGRAM, "$shadow_cv_passwd_dir/passwd",
195         [Path to passwd program.])
196
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).])
201
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) ;;
208          esac],
209         [enable_shadowgrp="yes"]
210 )
211
212 AC_ARG_ENABLE(man,
213         [AC_HELP_STRING([--enable-man],
214                 [regenerate roff man pages from Docbook @<:@default=no@:>@])],
215         [enable_man=yes],
216         [enable_man=no]
217 )
218
219 AC_ARG_WITH(audit, 
220         [AC_HELP_STRING([--with-audit], [use auditing support @<:@default=yes if found@:>@])],
221         [with_audit=$withval], [with_audit=maybe])
222 AC_ARG_WITH(libpam,
223         [AC_HELP_STRING([--with-libpam], [use libpam for PAM support @<:@default=yes if found@:>@])],
224         [with_libpam=$withval], [with_libpam=yes])
225 AC_ARG_WITH(selinux,
226         [AC_HELP_STRING([--with-selinux], [use SELinux support @<:@default=yes if found@:>@])],
227         [with_selinux=$withval], [with_selinux=yes])
228 AC_ARG_WITH(skey,
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])
237
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])
241 fi
242
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).
246
247 AC_SEARCH_LIBS(inet_ntoa, inet)
248 AC_SEARCH_LIBS(socket, socket)
249 AC_SEARCH_LIBS(gethostbyname, nsl)
250
251 if test "$enable_shadowgrp" = "yes"; then
252         AC_DEFINE(SHADOWGRP, 1, [Define to support the shadow group file.])
253 fi
254 AM_CONDITIONAL(SHADOWGRP, test "x$enable_shadowgrp" = "xyes")
255
256 if test "$enable_man" = "yes"; then
257         dnl
258         dnl Check for xsltproc
259         dnl
260         AC_PATH_PROG([XSLTPROC], [xsltproc])
261         if test -z "$XSLTPROC"; then
262                 enable_man=no
263         fi
264
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)
270 fi
271 AM_CONDITIONAL(ENABLE_REGENERATE_MAN, test x$enable_man != xno)
272
273 AC_SUBST(LIBCRYPT)
274 AC_CHECK_LIB(crypt, crypt, [LIBCRYPT=-lcrypt],
275         [AC_MSG_ERROR([crypt() not found])])
276
277 AC_SUBST(LIBAUDIT)
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
288                         with_audit="no"
289                 else
290                         AC_DEFINE(WITH_AUDIT, 1,
291                                   [Define if you want to enable Audit messages])
292                         LIBAUDIT="-laudit"
293                         with_audit="yes"
294                 fi
295         else
296                 with_audit="no"
297         fi
298 fi
299
300 AC_SUBST(LIBCRACK)
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.]))
309 fi
310
311 if test "$with_selinux" = "yes"; then
312         AC_CHECK_LIB(selinux, is_selinux_enabled,
313                 [LIBSELINUX="-lselinux"
314                 AC_SUBST(LIBSELINUX)
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])
318                 ],
319                 [AC_MSG_ERROR([libselinux not found])])
320 fi
321
322 AC_SUBST(LIBPAM)
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])
327                 LIBPAM="-lpam"
328                 AC_CHECK_LIB(pam_misc, main,
329                         [LIBPAM="$LIBPAM -lpam_misc"],
330                         AC_MSG_ERROR(libpam_misc is missing for enable PAM support)
331                 )],
332                 [AC_MSG_CHECKING(use login access checking if PAM not used)
333                 AM_CONDITIONAL(USE_PAM, [false])
334                 AC_MSG_RESULT(yes)]
335         )
336         AC_MSG_CHECKING(use login and su access checking if PAM not used)
337         AC_MSG_RESULT(no)
338 else
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.])
341         AC_MSG_RESULT(yes)
342         AM_CONDITIONAL(USE_PAM, [false])
343 fi
344
345 AC_SUBST(LIBSKEY)
346 AC_SUBST(LIBMD)
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.])
352         AC_TRY_COMPILE([
353                 #include <stdio.h>
354                 #include <skey.h>
355         ],[
356                 skeychallenge((void*)0, (void*)0, (void*)0, 0);
357         ],[AC_DEFINE(SKEY_BSD_STYLE, 1, [Define to support newer BSD S/Key API])])
358 fi
359
360 AM_GNU_GETTEXT_VERSION(0.16)
361 AM_GNU_GETTEXT([external], [need-ngettext])
362 AM_CONDITIONAL(USE_NLS, test "x$USE_NLS" = "xyes")
363
364 AC_CONFIG_FILES([
365         Makefile
366         po/Makefile.in
367         doc/Makefile
368         man/Makefile
369         man/po/Makefile.in
370         man/cs/Makefile
371         man/de/Makefile
372         man/es/Makefile
373         man/fi/Makefile
374         man/fr/Makefile
375         man/hu/Makefile
376         man/id/Makefile
377         man/it/Makefile
378         man/ja/Makefile
379         man/ko/Makefile
380         man/pl/Makefile
381         man/pt_BR/Makefile
382         man/ru/Makefile
383         man/sv/Makefile
384         man/tr/Makefile
385         man/zh_CN/Makefile
386         man/zh_TW/Makefile
387         libmisc/Makefile
388         lib/Makefile
389         src/Makefile
390         contrib/Makefile
391         etc/Makefile
392         etc/pam.d/Makefile
393         shadow.spec
394 ])
395 AC_OUTPUT
396
397 echo
398 echo "shadow will be compiled with the following features:"
399 echo
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"
407 echo