]> granicus.if.org Git - shadow/blob - configure.in
* src/expiry.c: Ignore the return value of signal().
[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.2)
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 AC_HEADER_STDBOOL
32
33 AC_CHECK_HEADERS(errno.h fcntl.h limits.h unistd.h sys/time.h utmp.h \
34         utmpx.h termios.h termio.h sgtty.h sys/ioctl.h syslog.h paths.h \
35         utime.h ulimit.h sys/resource.h gshadow.h lastlog.h \
36         locale.h rpc/key_prot.h netdb.h)
37
38 dnl shadow now uses the libc's shadow implementation
39 AC_CHECK_HEADER([shadow.h],,[AC_MSG_ERROR([You need a libc with shadow.h])])
40
41 AC_CHECK_FUNCS(l64a fchmod fchown fsync getgroups gethostname getspnam \
42         gettimeofday getusershell getutent initgroups lchown lckpwdf lstat \
43         memcpy memset setgroups sigaction strchr updwtmp updwtmpx innetgr \
44         getpwnam_r getpwuid_r getgrnam_r getgrgid_r getspnam_r)
45 AC_SYS_LARGEFILE
46
47 dnl Checks for typedefs, structures, and compiler characteristics.
48 AC_C_CONST
49 AC_TYPE_UID_T
50 AC_TYPE_OFF_T
51 AC_TYPE_PID_T
52 AC_TYPE_MODE_T
53 AC_HEADER_STAT
54 AC_CHECK_MEMBERS([struct stat.st_rdev])
55 AC_HEADER_TIME
56 AC_STRUCT_TM
57
58 if test "$ac_cv_header_utmp_h" = "yes"; then
59         AC_CACHE_CHECK(for ut_host in struct utmp,
60                 ac_cv_struct_utmp_ut_host,
61                 AC_COMPILE_IFELSE(
62                         [AC_LANG_PROGRAM([#include <utmp.h>],
63                                 [struct utmp ut; char *cp = ut.ut_host;]
64                         )],
65                         [ac_cv_struct_utmp_ut_host=yes],
66                         [ac_cv_struct_utmp_ut_host=no]
67                 )
68         )
69
70         if test "$ac_cv_struct_utmp_ut_host" = "yes"; then
71                 AC_DEFINE(UT_HOST, 1, [Define if you have ut_host in struct utmp.])
72         fi
73
74         AC_CACHE_CHECK(for ut_user in struct utmp,
75                 ac_cv_struct_utmp_ut_user,
76                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <utmp.h>],
77                                 [struct utmp ut; char *cp = ut.ut_user;]
78                         )],
79                         [ac_cv_struct_utmp_ut_user=yes],
80                         [ac_cv_struct_utmp_ut_user=no]
81                 )
82         )
83
84         if test "$ac_cv_struct_utmp_ut_user" = "no"; then
85                 AC_DEFINE(ut_user, ut_name,
86                         [Define to ut_name if struct utmp has ut_name (not ut_user).])
87         fi
88 fi
89
90 if test "$ac_cv_header_lastlog_h" = "yes"; then
91         AC_CACHE_CHECK(for ll_host in struct lastlog,
92                 ac_cv_struct_lastlog_ll_host,
93                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <lastlog.h>],
94                                         [struct lastlog ll; char *cp = ll.ll_host;]
95                                 )],
96                         [ac_cv_struct_lastlog_ll_host=yes],
97                         [ac_cv_struct_lastlog_ll_host=no]
98                 )
99         )
100
101         if test "$ac_cv_struct_lastlog_ll_host" = "yes"; then
102                 AC_DEFINE(HAVE_LL_HOST, 1,
103                         [Define if struct lastlog has ll_host])
104         fi
105 fi
106
107 dnl Checks for library functions.
108 AC_TYPE_GETGROUPS
109 AC_TYPE_SIGNAL
110 AC_FUNC_UTIME_NULL
111 AC_FUNC_STRFTIME
112 AC_REPLACE_FUNCS(mkdir putgrent putpwent putspent rename rmdir)
113 AC_REPLACE_FUNCS(sgetgrent sgetpwent sgetspent)
114 AC_REPLACE_FUNCS(snprintf strcasecmp strdup strerror strstr)
115
116 AC_CHECK_FUNC(setpgrp)
117 AC_FUNC_SETPGRP
118
119 if test "$ac_cv_header_shadow_h" = "yes"; then
120         AC_CACHE_CHECK(for working shadow group support,
121                 ac_cv_libc_shadowgrp,
122                 AC_RUN_IFELSE([AC_LANG_SOURCE([
123                                 #include <shadow.h>
124                                 main()
125                                 {
126                                         struct sgrp *sg = sgetsgent("test:x::");
127                                         /* NYS libc on Red Hat 3.0.3 has broken shadow group support */
128                                         return !sg || !sg->sg_adm || !sg->sg_mem;
129                                 }]
130                         )],
131                         [ac_cv_libc_shadowgrp=yes],
132                         [ac_cv_libc_shadowgrp=no],
133                         [ac_cv_libc_shadowgrp=no]
134                 )
135         )
136
137         if test "$ac_cv_libc_shadowgrp" = "yes"; then
138                 AC_DEFINE(HAVE_SHADOWGRP, 1, [Have working shadow group support in libc])
139         fi
140 fi
141
142 AC_CACHE_CHECK([location of shared mail directory], shadow_cv_maildir,
143 [for shadow_cv_maildir in /var/mail /var/spool/mail /usr/spool/mail /usr/mail none; do
144         if test -d $shadow_cv_maildir; then
145                 break
146         fi
147 done])
148 if test $shadow_cv_maildir != none; then
149         AC_DEFINE_UNQUOTED(MAIL_SPOOL_DIR, "$shadow_cv_maildir",
150                 [Location of system mail spool directory.])
151 fi
152
153 AC_CACHE_CHECK([location of user mail file], shadow_cv_mailfile,
154 [for shadow_cv_mailfile in Mailbox mailbox Mail mail .mail none; do
155         if test -f $HOME/$shadow_cv_mailfile; then
156                 break
157         fi
158 done])
159 if test $shadow_cv_mailfile != none; then
160         AC_DEFINE_UNQUOTED(MAIL_SPOOL_FILE, "$shadow_cv_mailfile",
161                 [Name of user's mail spool file if stored in user's home directory.])
162 fi
163
164 AC_CACHE_CHECK([location of utmp], shadow_cv_utmpdir,
165 [for shadow_cv_utmpdir in /var/run /var/adm /usr/adm /etc none; do
166         if test -f $shadow_cv_utmpdir/utmp; then
167                 break
168         fi
169 done])
170 if test "$shadow_cv_utmpdir" = "none"; then
171         AC_MSG_WARN(utmp file not found)
172 fi
173 AC_DEFINE_UNQUOTED(_UTMP_FILE, "$shadow_cv_utmpdir/utmp",
174         [Path for utmp file.])
175
176 AC_CACHE_CHECK([location of faillog/lastlog/wtmp], shadow_cv_logdir,
177 [for shadow_cv_logdir in /var/log /var/adm /usr/adm /etc; do
178         if test -d $shadow_cv_logdir; then
179                 break
180         fi
181 done])
182 AC_DEFINE_UNQUOTED(_WTMP_FILE, "$shadow_cv_logdir/wtmp",
183         [Path for wtmp file.])
184 AC_DEFINE_UNQUOTED(LASTLOG_FILE, "$shadow_cv_logdir/lastlog",
185         [Path for lastlog file.])
186 AC_DEFINE_UNQUOTED(FAILLOG_FILE, "$shadow_cv_logdir/faillog",
187         [Path for faillog file.])
188
189 AC_CACHE_CHECK([location of the passwd program], shadow_cv_passwd_dir,
190 [if test -f /usr/bin/passwd; then
191         shadow_cv_passwd_dir=/usr/bin
192 else
193         shadow_cv_passwd_dir=/bin
194 fi])
195 AC_DEFINE_UNQUOTED(PASSWD_PROGRAM, "$shadow_cv_passwd_dir/passwd",
196         [Path to passwd program.])
197
198 dnl XXX - quick hack, should disappear before anyone notices :).
199 AC_DEFINE(USE_SYSLOG, 1, [Define to use syslog().])
200 AC_DEFINE(RLOGIN, 1, [Define if login should support the -r flag for rlogind.])
201 AC_DEFINE(RUSEROK, 0, [Define to the ruserok() "success" return value (0 or 1).])
202
203 AC_ARG_ENABLE(shadowgrp,
204         [AC_HELP_STRING([--enable-shadowgrp], [enable shadow group support @<:@default=yes@:>@])],
205         [case "${enableval}" in
206          yes) enable_shadowgrp="yes" ;;
207           no) enable_shadowgrp="no" ;;
208            *) AC_MSG_ERROR(bad value ${enableval} for --enable-shadowgrp) ;;
209          esac],
210         [enable_shadowgrp="yes"]
211 )
212
213 AC_ARG_ENABLE(man,
214         [AC_HELP_STRING([--enable-man],
215                 [regenerate roff man pages from Docbook @<:@default=no@:>@])],
216         [enable_man="${enableval}"],
217         [enable_man=no]
218 )
219
220 AC_ARG_WITH(audit, 
221         [AC_HELP_STRING([--with-audit], [use auditing support @<:@default=yes if found@:>@])],
222         [with_audit=$withval], [with_audit=maybe])
223 AC_ARG_WITH(libpam,
224         [AC_HELP_STRING([--with-libpam], [use libpam for PAM support @<:@default=yes if found@:>@])],
225         [with_libpam=$withval], [with_libpam=maybe])
226 AC_ARG_WITH(selinux,
227         [AC_HELP_STRING([--with-selinux], [use SELinux support @<:@default=yes if found@:>@])],
228         [with_selinux=$withval], [with_selinux=maybe])
229 AC_ARG_WITH(skey,
230         [AC_HELP_STRING([--with-skey], [use S/Key support @<:@default=no@:>@])],
231         [with_skey=$withval], [with_skey=no])
232 AC_ARG_WITH(libcrack,
233         [AC_HELP_STRING([--with-libcrack], [use libcrack @<:@default=yes if found and if PAM not enabled@:>@])],
234         [with_libcrack=$withval], [with_libcrack=no])
235 AC_ARG_WITH(sha-crypt,
236         [AC_HELP_STRING([--with-sha-crypt], [allow the SHA256 and SHA512 password encryption algorithms @<:@default=yes@:>@])],
237         [with_sha_crypt=$withval], [with_sha_crypt=yes])
238
239 AM_CONDITIONAL(USE_SHA_CRYPT, test "x$with_sha_crypt" = "xyes")
240 if test "$with_sha_crypt" = "yes"; then
241                 AC_DEFINE(USE_SHA_CRYPT, 1, [Define to allow the SHA256 and SHA512 password encryption algorithms])
242 fi
243
244 dnl Check for some functions in libc first, only if not found check for
245 dnl other libraries.  This should prevent linking libnsl if not really
246 dnl needed (Linux glibc, Irix), but still link it if needed (Solaris).
247
248 AC_SEARCH_LIBS(inet_ntoa, inet)
249 AC_SEARCH_LIBS(socket, socket)
250 AC_SEARCH_LIBS(gethostbyname, nsl)
251
252 if test "$enable_shadowgrp" = "yes"; then
253         AC_DEFINE(SHADOWGRP, 1, [Define to support the shadow group file.])
254 fi
255 AM_CONDITIONAL(SHADOWGRP, test "x$enable_shadowgrp" = "xyes")
256
257 if test "$enable_man" = "yes"; then
258         dnl
259         dnl Check for xsltproc
260         dnl
261         AC_PATH_PROG([XSLTPROC], [xsltproc])
262         if test -z "$XSLTPROC"; then
263                 enable_man=no
264         fi
265
266         dnl check for DocBook DTD and stylesheets in the local catalog.
267         JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.1.2//EN],
268                 [DocBook XML DTD V4.1.2], [], enable_man=no)
269         JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
270                 [DocBook XSL Stylesheets >= 1.70.1], [], enable_man=no)
271 fi
272 AM_CONDITIONAL(ENABLE_REGENERATE_MAN, test "x$enable_man" != "xno")
273
274 AC_SUBST(LIBCRYPT)
275 AC_CHECK_LIB(crypt, crypt, [LIBCRYPT=-lcrypt],
276         [AC_MSG_ERROR([crypt() not found])])
277
278 AC_SUBST(LIBAUDIT)
279 if test "$with_audit" != "no"; then
280         AC_CHECK_HEADER(libaudit.h, [audit_header="yes"], [audit_header="no"])
281         if test "$audit_header$with_audit" = "noyes" ; then
282                 AC_MSG_ERROR([libaudit.h is missing])
283         elif test "$audit_header" = "yes"; then
284                 AC_CHECK_LIB(audit, audit_log_acct_message,
285                              [audit_lib="yes"], [audit_lib="no"])
286                 if test "$audit_lib$with_audit" = "noyes" ; then
287                         AC_MSG_ERROR([libaudit not found])
288                 elif test "$audit_lib" = "no" ; then
289                         with_audit="no"
290                 else
291                         AC_DEFINE(WITH_AUDIT, 1,
292                                   [Define if you want to enable Audit messages])
293                         LIBAUDIT="-laudit"
294                         with_audit="yes"
295                 fi
296         else
297                 with_audit="no"
298         fi
299 fi
300
301 AC_SUBST(LIBCRACK)
302 if test "$with_libcrack" = "yes"; then
303         echo "checking cracklib flavour, don't be surprised by the results"
304         AC_CHECK_LIB(crack, FascistCheck,
305                 [LIBCRACK=-lcrack AC_DEFINE(HAVE_LIBCRACK, 1, [Defined if you have libcrack.])])
306         AC_CHECK_LIB(crack, FascistHistory,
307                 AC_DEFINE(HAVE_LIBCRACK_HIST, 1, [Defined if you have the ts&szs cracklib.]))
308         AC_CHECK_LIB(crack, FascistHistoryPw,
309                 AC_DEFINE(HAVE_LIBCRACK_PW, 1, [Defined if it includes *Pw functions.]))
310 fi
311
312 AC_SUBST(LIBSELINUX)
313 if test "$with_selinux" != "no"; then
314         AC_CHECK_HEADERS(selinux/selinux.h, [selinux_header="yes"], [selinux_header="no"])
315         if test "$selinux_header$with_selinux" = "noyes" ; then
316                 AC_MSG_ERROR([selinux/selinux.h is missing])
317         elif test "$selinux_header" = "yes" ; then
318                 AC_CHECK_LIB(selinux, is_selinux_enabled,
319                              [selinux_lib="yes"], [selinux_lib="no"])
320                 if test "$selinux_lib$with_selinux" = "noyes" ; then
321                         AC_MSG_ERROR([libselinux not found])
322                 elif test "$selinux_lib" = "no" ; then
323                         with_selinux="no"
324                 else
325                         AC_DEFINE(WITH_SELINUX, 1,
326                                   [Build shadow with SELinux support])
327                         LIBSELINUX="-lselinux"
328                         with_selinux="yes"
329                 fi
330         else
331                 with_selinux="no"
332         fi
333 fi
334
335 AC_SUBST(LIBPAM)
336 if test "$with_libpam" != "no"; then
337         AC_CHECK_LIB(pam, pam_start,
338                      [pam_lib="yes"], [pam_lib="no"])
339         if test "$pam_lib$with_libpam" = "noyes" ; then
340                 AC_MSG_ERROR(libpam not found)
341         fi
342
343         AC_CHECK_LIB(pam_misc, main,
344                      [pam_misc_lib="yes"], [pam_misc_lib="no"])
345         if test "$pam_misc_lib$with_libpam" = "noyes" ; then
346                 AC_MSG_ERROR(libpam_misc not found)
347         fi
348
349         if test "$pam_lib$pam_misc_lib" = "yesyes" ; then
350                 with_libpam="yes"
351         else
352                 with_libpam="no"
353         fi
354 fi
355 dnl Now with_libpam is either yes or no
356 if test "$with_libpam" = "yes"; then
357         AC_DEFINE(USE_PAM, 1, [Define to support Pluggable Authentication Modules])
358         AM_CONDITIONAL(USE_PAM, [true])
359         LIBPAM="-lpam -lpam_misc"
360         AC_MSG_CHECKING(use login and su access checking if PAM not used)
361         AC_MSG_RESULT(no)
362 else
363         AC_DEFINE(SU_ACCESS, 1, [Define to support /etc/suauth su access control.])
364         AM_CONDITIONAL(USE_PAM, [false])
365         AC_MSG_CHECKING(use login and su access checking if PAM not used)
366         AC_MSG_RESULT(yes)
367 fi
368
369 AC_SUBST(LIBSKEY)
370 AC_SUBST(LIBMD)
371 if test "$with_skey" = "yes"; then
372         AC_CHECK_LIB(md, MD5Init, [LIBMD=-lmd])
373         AC_CHECK_LIB(skey, skeychallenge, [LIBSKEY=-lskey],
374                 [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])])
375         AC_DEFINE(SKEY, 1, [Define to support S/Key logins.])
376         AC_TRY_COMPILE([
377                 #include <stdio.h>
378                 #include <skey.h>
379         ],[
380                 skeychallenge((void*)0, (void*)0, (void*)0, 0);
381         ],[AC_DEFINE(SKEY_BSD_STYLE, 1, [Define to support newer BSD S/Key API])])
382 fi
383
384 AM_GNU_GETTEXT_VERSION(0.16)
385 AM_GNU_GETTEXT([external], [need-ngettext])
386 AM_CONDITIONAL(USE_NLS, test "x$USE_NLS" = "xyes")
387
388 AC_CONFIG_FILES([
389         Makefile
390         po/Makefile.in
391         doc/Makefile
392         man/Makefile
393         man/po/Makefile.in
394         man/cs/Makefile
395         man/de/Makefile
396         man/es/Makefile
397         man/fi/Makefile
398         man/fr/Makefile
399         man/hu/Makefile
400         man/id/Makefile
401         man/it/Makefile
402         man/ja/Makefile
403         man/ko/Makefile
404         man/pl/Makefile
405         man/pt_BR/Makefile
406         man/ru/Makefile
407         man/sv/Makefile
408         man/tr/Makefile
409         man/zh_CN/Makefile
410         man/zh_TW/Makefile
411         libmisc/Makefile
412         lib/Makefile
413         src/Makefile
414         contrib/Makefile
415         etc/Makefile
416         etc/pam.d/Makefile
417         shadow.spec
418 ])
419 AC_OUTPUT
420
421 echo
422 echo "shadow will be compiled with the following features:"
423 echo
424 echo "  auditing support:               $with_audit"
425 echo "  CrackLib support:               $with_libcrack"
426 echo "  PAM support:                    $with_libpam"
427 echo "  SELinux support:                $with_selinux"
428 echo "  shadow group support:           $enable_shadowgrp"
429 echo "  S/Key support:                  $with_skey"
430 echo "  SHA passwords encryption:       $with_sha_crypt"
431 echo