]> granicus.if.org Git - shadow/blob - configure.in
[svn-upgrade] Integrating new upstream version, shadow (4.0.14)
[shadow] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT
3 AM_INIT_AUTOMAKE(shadow, 4.0.14)
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 shadow.h lastlog.h \
35         locale.h rpc/key_prot.h)
36
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)
40 AC_SYS_LARGEFILE
41
42 dnl Checks for typedefs, structures, and compiler characteristics.
43 AC_C_CONST
44 AC_TYPE_UID_T
45 AC_TYPE_OFF_T
46 AC_TYPE_PID_T
47 AC_TYPE_MODE_T
48 AC_HEADER_STAT
49 AC_CHECK_MEMBERS([struct stat.st_rdev])
50 AC_HEADER_TIME
51 AC_STRUCT_TM
52
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,
56                 AC_COMPILE_IFELSE(
57                         [AC_LANG_PROGRAM([#include <utmp.h>],
58                                 [struct utmp ut; char *cp = ut.ut_host;]
59                         )],
60                         [ac_cv_struct_utmp_ut_host=yes],
61                         [ac_cv_struct_utmp_ut_host=no]
62                 )
63         )
64
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.])
67         fi
68
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;]
73                         )],
74                         [ac_cv_struct_utmp_ut_user=yes],
75                         [ac_cv_struct_utmp_ut_user=no]
76                 )
77         )
78
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).])
82         fi
83 fi
84
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;]
90                                 )],
91                         [ac_cv_struct_lastlog_ll_host=yes],
92                         [ac_cv_struct_lastlog_ll_host=no]
93                 )
94         )
95
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])
99         fi
100 fi
101
102 dnl Checks for library functions.
103 AC_TYPE_GETGROUPS
104 AC_TYPE_SIGNAL
105 AC_FUNC_UTIME_NULL
106 AC_FUNC_STRFTIME
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)
110
111 AC_CHECK_FUNC(setpgrp)
112 AC_FUNC_SETPGRP
113
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([
118                                 #include <shadow.h>
119                                 main()
120                                 {
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;
124                                 }]
125                         )],
126                         [ac_cv_libc_shadowgrp=yes],
127                         [ac_cv_libc_shadowgrp=no],
128                         [ac_cv_libc_shadowgrp=no]
129                 )
130         )
131
132         if test "$ac_cv_libc_shadowgrp" = "yes"; then
133                 AC_DEFINE(HAVE_SHADOWGRP, 1, [Have working shadow group support in libc])
134         fi
135 fi
136
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
140                 break
141         fi
142 done])
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.])
146 fi
147
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
151                 break
152         fi
153 done])
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.])
157 fi
158
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
162                 break
163         fi
164 done])
165 if test "$shadow_cv_utmpdir" = "none"; then
166         AC_MSG_WARN(utmp file not found)
167 fi
168 AC_DEFINE_UNQUOTED(_UTMP_FILE, "$shadow_cv_utmpdir/utmp",
169         [Path for utmp file.])
170
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
174                 break
175         fi
176 done])
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.])
183
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
187 else
188         shadow_cv_passwd_dir=/bin
189 fi])
190 AC_DEFINE_UNQUOTED(PASSWD_PROGRAM, "$shadow_cv_passwd_dir/passwd",
191         [Path to passwd program.])
192
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).])
197
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().])
203
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) ;;
210          esac],
211         [enable_shadowgrp="yes"]
212 )
213
214 AC_ARG_ENABLE(man,
215         [AC_HELP_STRING([--enable-man],
216                 [regenerate roff man pages from Docbook @<:@default=no@:>@])],
217         [enable_man=yes],
218         [enable_man=no]
219 )
220
221 AC_ARG_WITH(audit, 
222         [AC_HELP_STRING([--with-audit], [use auditing support @<:@default=yes if found@:>@])],
223         [with_audit=$withval], [with_audit=yes])
224 AC_ARG_WITH(libpam,
225         [AC_HELP_STRING([--with-libpam], [use libpam for PAM support @<:@default=yes if found@:>@])],
226         [with_libpam=$withval], [with_libpam=yes])
227 AC_ARG_WITH(selinux,
228         [AC_HELP_STRING([--with-selinux], [use SELinux support @<:@default=autodetect@:>@])],
229         [with_selinux=$withval], [with_selinux=yes])
230 AC_ARG_WITH(skey,
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])
236
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).
240
241 AC_SEARCH_LIBS(inet_ntoa, inet)
242 AC_SEARCH_LIBS(socket, socket)
243 AC_SEARCH_LIBS(gethostbyname, nsl)
244
245 if test "$enable_shadowgrp" = "yes"; then
246         AC_DEFINE(SHADOWGRP, 1, [Define to support the shadow group file.])
247 fi
248
249 if test "$enable_man" = "yes"; then
250         dnl
251         dnl Check for xsltproc
252         dnl
253         AC_PATH_PROG([XSLTPROC], [xsltproc])
254         if test -z "$XSLTPROC"; then
255                 enable_man=no
256         fi
257
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)
263 fi
264 AM_CONDITIONAL(ENABLE_REGENERATE_MAN, test x$enable_man != xno)
265
266 AC_SUBST(LIBCRYPT)
267 AC_CHECK_LIB(crypt, crypt, [LIBCRYPT=-lcrypt],
268         [AC_MSG_ERROR([crypt() not found])])
269
270 AC_SUBST(LIBAUDIT)
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])
276                         LIBAUDIT="-laudit"])
277         fi
278 fi
279
280 AC_SUBST(LIBCRACK)
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.]))
289 fi
290
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])])
295         AC_SUBST(LIBSELINUX)
296         AC_CHECK_HEADERS(selinux/selinux.h, [], [selinux/selinux.h is missing])
297         AC_DEFINE(WITH_SELINUX, 1, [Build shadow with SELinux support])
298 fi
299
300 AC_SUBST(LIBPAM)
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])
304                 LIBPAM="-lpam"
305                 AC_CHECK_LIB(pam_misc, main,
306                         [LIBPAM="$LIBPAM -lpam_misc"],
307                         AC_MSG_ERROR(libpam_misc is missing for enable PAM support)
308                 )],
309                 [AC_MSG_CHECKING(use login access checking if PAM not used)
310                 AC_MSG_RESULT(yes)]
311         )
312         AC_MSG_CHECKING(use login and su access checking if PAM not used)
313         AC_MSG_RESULT(no)
314 else
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.])
317         AC_MSG_RESULT(yes)
318 fi
319
320 AC_SUBST(LIBSKEY)
321 AC_SUBST(LIBMD)
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.])
327 fi
328
329 AM_GNU_GETTEXT_VERSION(0.12.1)
330 AM_GNU_GETTEXT([external], [need-ngettext])
331
332 AC_CONFIG_FILES([
333         Makefile
334         po/Makefile.in
335         doc/Makefile
336         man/Makefile
337         man/cs/Makefile
338         man/de/Makefile
339         man/es/Makefile
340         man/fi/Makefile
341         man/fr/Makefile
342         man/hu/Makefile
343         man/id/Makefile
344         man/it/Makefile
345         man/ja/Makefile
346         man/ko/Makefile
347         man/pl/Makefile
348         man/pt_BR/Makefile
349         man/ru/Makefile
350         man/tr/Makefile
351         man/zh_CN/Makefile
352         man/zh_TW/Makefile
353         libmisc/Makefile
354         lib/Makefile
355         src/Makefile
356         contrib/Makefile
357         etc/Makefile
358         etc/pam.d/Makefile
359         shadow.spec
360 ])
361 AC_OUTPUT
362
363 echo
364 echo "shadow will be compiled with the followig feactures:"
365 echo
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"
372 echo