]> granicus.if.org Git - shadow/blob - configure.in
Assume <errno.h> declares errno.
[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.0)
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=yes])
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=autodetect@:>@])],
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" = "yes"; then
279         AC_CHECK_HEADER(libaudit.h, [audit_header="yes"], [audit_header="no"])
280         if test "$audit_header" = "yes"; then
281                 AC_CHECK_LIB(audit, audit_log_acct_message,
282                         [AC_DEFINE(WITH_AUDIT, 1, [Define if you want to enable Audit messages])
283                         LIBAUDIT="-laudit"])
284         fi
285 fi
286
287 AC_SUBST(LIBCRACK)
288 if test "$with_libcrack" = "yes"; then
289         echo "checking cracklib flavour, don't be surprised by the results"
290         AC_CHECK_LIB(crack, FascistCheck,
291                 [LIBCRACK=-lcrack AC_DEFINE(HAVE_LIBCRACK, 1, [Defined if you have libcrack.])])
292         AC_CHECK_LIB(crack, FascistHistory,
293                 AC_DEFINE(HAVE_LIBCRACK_HIST, 1, [Defined if you have the ts&szs cracklib.]))
294         AC_CHECK_LIB(crack, FascistHistoryPw,
295                 AC_DEFINE(HAVE_LIBCRACK_PW, 1, [Defined if it includes *Pw functions.]))
296 fi
297
298 if test "$with_selinux" = "yes"; then
299         AC_CHECK_LIB(selinux, is_selinux_enabled,
300                 [LIBSELINUX="-lselinux"
301                 AC_SUBST(LIBSELINUX)
302                 AC_CHECK_HEADERS(selinux/selinux.h, [],
303                         [AC_MSG_ERROR([selinux/selinux.h is missing])])
304                 AC_DEFINE(WITH_SELINUX, 1, [Build shadow with SELinux support])
305                 ],
306                 [AC_MSG_ERROR([libselinux not found])])
307 fi
308
309 AC_SUBST(LIBPAM)
310 if test "$with_libpam" = "yes"; then
311         AC_CHECK_LIB(pam, pam_start,
312                 [AC_DEFINE(USE_PAM, 1, [Define to support Pluggable Authentication Modules])
313                 AM_CONDITIONAL(USE_PAM, [true])
314                 LIBPAM="-lpam"
315                 AC_CHECK_LIB(pam_misc, main,
316                         [LIBPAM="$LIBPAM -lpam_misc"],
317                         AC_MSG_ERROR(libpam_misc is missing for enable PAM support)
318                 )],
319                 [AC_MSG_CHECKING(use login access checking if PAM not used)
320                 AM_CONDITIONAL(USE_PAM, [false])
321                 AC_MSG_RESULT(yes)]
322         )
323         AC_MSG_CHECKING(use login and su access checking if PAM not used)
324         AC_MSG_RESULT(no)
325 else
326         AC_MSG_CHECKING(use login and su access checking if PAM not used)
327         AC_DEFINE(SU_ACCESS, 1, [Define to support /etc/suauth su access control.])
328         AC_MSG_RESULT(yes)
329         AM_CONDITIONAL(USE_PAM, [false])
330 fi
331
332 AC_SUBST(LIBSKEY)
333 AC_SUBST(LIBMD)
334 if test "$with_skey" = "yes"; then
335         AC_CHECK_LIB(md, MD5Init, [LIBMD=-lmd])
336         AC_CHECK_LIB(skey, skeychallenge, [LIBSKEY=-lskey],
337                 [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])])
338         AC_DEFINE(SKEY, 1, [Define to support S/Key logins.])
339         AC_TRY_COMPILE([
340                 #include <stdio.h>
341                 #include <skey.h>
342         ],[
343                 skeychallenge((void*)0, (void*)0, (void*)0, 0);
344         ],[AC_DEFINE(SKEY_BSD_STYLE, 1, [Define to support newer BSD S/Key API])])
345 fi
346
347 AM_GNU_GETTEXT_VERSION(0.16)
348 AM_GNU_GETTEXT([external], [need-ngettext])
349 AM_CONDITIONAL(USE_NLS, test "x$USE_NLS" = "xyes")
350
351 AC_CONFIG_FILES([
352         Makefile
353         po/Makefile.in
354         doc/Makefile
355         man/Makefile
356         man/po/Makefile.in
357         man/cs/Makefile
358         man/de/Makefile
359         man/es/Makefile
360         man/fi/Makefile
361         man/fr/Makefile
362         man/hu/Makefile
363         man/id/Makefile
364         man/it/Makefile
365         man/ja/Makefile
366         man/ko/Makefile
367         man/pl/Makefile
368         man/pt_BR/Makefile
369         man/ru/Makefile
370         man/sv/Makefile
371         man/tr/Makefile
372         man/zh_CN/Makefile
373         man/zh_TW/Makefile
374         libmisc/Makefile
375         lib/Makefile
376         src/Makefile
377         contrib/Makefile
378         etc/Makefile
379         etc/pam.d/Makefile
380         shadow.spec
381 ])
382 AC_OUTPUT
383
384 echo
385 echo "shadow will be compiled with the following features:"
386 echo
387 echo "  auditing support:               $with_audit"
388 echo "  CrackLib support:               $with_libcrack"
389 echo "  PAM support:                    $with_libpam"
390 echo "  SELinux support:                $with_selinux"
391 echo "  shadow group support:           $enable_shadowgrp"
392 echo "  S/Key support:                  $with_skey"
393 echo "  SHA passwords encryption:       $with_sha_crypt"
394 echo