]> granicus.if.org Git - shadow/blob - configure.in
* configure.in: SHADOWGRP added to AM_CONDITIONAL for the
[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.18.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
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)
36
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)
41 AC_SYS_LARGEFILE
42
43 dnl Checks for typedefs, structures, and compiler characteristics.
44 AC_C_CONST
45 AC_TYPE_UID_T
46 AC_TYPE_OFF_T
47 AC_TYPE_PID_T
48 AC_TYPE_MODE_T
49 AC_HEADER_STAT
50 AC_CHECK_MEMBERS([struct stat.st_rdev])
51 AC_HEADER_TIME
52 AC_STRUCT_TM
53
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,
57                 AC_COMPILE_IFELSE(
58                         [AC_LANG_PROGRAM([#include <utmp.h>],
59                                 [struct utmp ut; char *cp = ut.ut_host;]
60                         )],
61                         [ac_cv_struct_utmp_ut_host=yes],
62                         [ac_cv_struct_utmp_ut_host=no]
63                 )
64         )
65
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.])
68         fi
69
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;]
74                         )],
75                         [ac_cv_struct_utmp_ut_user=yes],
76                         [ac_cv_struct_utmp_ut_user=no]
77                 )
78         )
79
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).])
83         fi
84 fi
85
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;]
91                                 )],
92                         [ac_cv_struct_lastlog_ll_host=yes],
93                         [ac_cv_struct_lastlog_ll_host=no]
94                 )
95         )
96
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])
100         fi
101 fi
102
103 dnl Checks for library functions.
104 AC_TYPE_GETGROUPS
105 AC_TYPE_SIGNAL
106 AC_FUNC_UTIME_NULL
107 AC_FUNC_STRFTIME
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)
111
112 AC_CHECK_FUNC(setpgrp)
113 AC_FUNC_SETPGRP
114
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([
119                                 #include <shadow.h>
120                                 main()
121                                 {
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;
125                                 }]
126                         )],
127                         [ac_cv_libc_shadowgrp=yes],
128                         [ac_cv_libc_shadowgrp=no],
129                         [ac_cv_libc_shadowgrp=no]
130                 )
131         )
132
133         if test "$ac_cv_libc_shadowgrp" = "yes"; then
134                 AC_DEFINE(HAVE_SHADOWGRP, 1, [Have working shadow group support in libc])
135         fi
136 fi
137
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
141                 break
142         fi
143 done])
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.])
147 fi
148
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
152                 break
153         fi
154 done])
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.])
158 fi
159
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
163                 break
164         fi
165 done])
166 if test "$shadow_cv_utmpdir" = "none"; then
167         AC_MSG_WARN(utmp file not found)
168 fi
169 AC_DEFINE_UNQUOTED(_UTMP_FILE, "$shadow_cv_utmpdir/utmp",
170         [Path for utmp file.])
171
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
175                 break
176         fi
177 done])
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.])
184
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
188 else
189         shadow_cv_passwd_dir=/bin
190 fi])
191 AC_DEFINE_UNQUOTED(PASSWD_PROGRAM, "$shadow_cv_passwd_dir/passwd",
192         [Path to passwd program.])
193
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).])
198
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) ;;
205          esac],
206         [enable_shadowgrp="yes"]
207 )
208
209 AC_ARG_ENABLE(man,
210         [AC_HELP_STRING([--enable-man],
211                 [regenerate roff man pages from Docbook @<:@default=no@:>@])],
212         [enable_man=yes],
213         [enable_man=no]
214 )
215
216 AC_ARG_WITH(audit, 
217         [AC_HELP_STRING([--with-audit], [use auditing support @<:@default=yes if found@:>@])],
218         [with_audit=$withval], [with_audit=yes])
219 AC_ARG_WITH(libpam,
220         [AC_HELP_STRING([--with-libpam], [use libpam for PAM support @<:@default=yes if found@:>@])],
221         [with_libpam=$withval], [with_libpam=yes])
222 AC_ARG_WITH(selinux,
223         [AC_HELP_STRING([--with-selinux], [use SELinux support @<:@default=autodetect@:>@])],
224         [with_selinux=$withval], [with_selinux=yes])
225 AC_ARG_WITH(skey,
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
232 dnl Check for some functions in libc first, only if not found check for
233 dnl other libraries.  This should prevent linking libnsl if not really
234 dnl needed (Linux glibc, Irix), but still link it if needed (Solaris).
235
236 AC_SEARCH_LIBS(inet_ntoa, inet)
237 AC_SEARCH_LIBS(socket, socket)
238 AC_SEARCH_LIBS(gethostbyname, nsl)
239
240 if test "$enable_shadowgrp" = "yes"; then
241         AC_DEFINE(SHADOWGRP, 1, [Define to support the shadow group file.])
242 fi
243 AM_CONDITIONAL(SHADOWGRP, test "x$enable_shadowgrp" = "xyes")
244
245 if test "$enable_man" = "yes"; then
246         dnl
247         dnl Check for xsltproc
248         dnl
249         AC_PATH_PROG([XSLTPROC], [xsltproc])
250         if test -z "$XSLTPROC"; then
251                 enable_man=no
252         fi
253
254         dnl check for DocBook DTD and stylesheets in the local catalog.
255         JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.1.2//EN],
256                 [DocBook XML DTD V4.1.2], [], enable_man=no)
257         JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
258                 [DocBook XSL Stylesheets >= 1.70.1], [], enable_man=no)
259 fi
260 AM_CONDITIONAL(ENABLE_REGENERATE_MAN, test x$enable_man != xno)
261
262 AC_SUBST(LIBCRYPT)
263 AC_CHECK_LIB(crypt, crypt, [LIBCRYPT=-lcrypt],
264         [AC_MSG_ERROR([crypt() not found])])
265
266 AC_SUBST(LIBAUDIT)
267 if test "$with_audit" = "yes"; then
268         AC_CHECK_HEADER(libaudit.h, [audit_header="yes"], [audit_header="no"])
269         if test "$audit_header" = "yes"; then
270                 AC_CHECK_LIB(audit, audit_log_acct_message,
271                         [AC_DEFINE(WITH_AUDIT, 1, [Define if you want to enable Audit messages])
272                         LIBAUDIT="-laudit"])
273         fi
274 fi
275
276 AC_SUBST(LIBCRACK)
277 if test "$with_libcrack" = "yes"; then
278         echo "checking cracklib flavour, don't be surprised by the results"
279         AC_CHECK_LIB(crack, FascistCheck,
280                 [LIBCRACK=-lcrack AC_DEFINE(HAVE_LIBCRACK, 1, [Defined if you have libcrack.])])
281         AC_CHECK_LIB(crack, FascistHistory,
282                 AC_DEFINE(HAVE_LIBCRACK_HIST, 1, [Defined if you have the ts&szs cracklib.]))
283         AC_CHECK_LIB(crack, FascistHistoryPw,
284                 AC_DEFINE(HAVE_LIBCRACK_PW, 1, [Defined if it includes *Pw functions.]))
285 fi
286
287 if test "$with_selinux" = "yes"; then
288         AC_CHECK_LIB(selinux, is_selinux_enabled,
289                 [LIBSELINUX="-lselinux"
290                 AC_SUBST(LIBSELINUX)
291                 AC_CHECK_HEADERS(selinux/selinux.h, [],
292                         [AC_MSG_ERROR([selinux/selinux.h is missing])])
293                 AC_DEFINE(WITH_SELINUX, 1, [Build shadow with SELinux support])
294                 ],
295                 [AC_MSG_ERROR([libselinux not found])])
296 fi
297
298 AC_SUBST(LIBPAM)
299 if test "$with_libpam" = "yes"; then
300         AC_CHECK_LIB(pam, pam_start,
301                 [AC_DEFINE(USE_PAM, 1, [Define to support Pluggable Authentication Modules])
302                 AM_CONDITIONAL(USE_PAM, [true])
303                 LIBPAM="-lpam"
304                 AC_CHECK_LIB(pam_misc, main,
305                         [LIBPAM="$LIBPAM -lpam_misc"],
306                         AC_MSG_ERROR(libpam_misc is missing for enable PAM support)
307                 )],
308                 [AC_MSG_CHECKING(use login access checking if PAM not used)
309                 AM_CONDITIONAL(USE_PAM, [false])
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         AM_CONDITIONAL(USE_PAM, [false])
319 fi
320
321 AC_SUBST(LIBSKEY)
322 AC_SUBST(LIBMD)
323 if test "$with_skey" = "yes"; then
324         AC_CHECK_LIB(md, MD5Init, [LIBMD=-lmd])
325         AC_CHECK_LIB(skey, skeychallenge, [LIBSKEY=-lskey],
326                 [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])])
327         AC_DEFINE(SKEY, 1, [Define to support S/Key logins.])
328         AC_TRY_COMPILE([
329                 #include <stdio.h>
330                 #include <skey.h>
331         ],[
332                 skeychallenge((void*)0, (void*)0, (void*)0, 0);
333         ],[AC_DEFINE(SKEY_BSD_STYLE, 1, [Define to support newer BSD S/Key API])])
334 fi
335
336 AM_GNU_GETTEXT_VERSION(0.16)
337 AM_GNU_GETTEXT([external], [need-ngettext])
338 AM_CONDITIONAL(USE_NLS, test "x$USE_NLS" = "xyes")
339
340 AC_CONFIG_FILES([
341         Makefile
342         po/Makefile.in
343         doc/Makefile
344         man/Makefile
345         man/cs/Makefile
346         man/de/Makefile
347         man/es/Makefile
348         man/fi/Makefile
349         man/fr/Makefile
350         man/hu/Makefile
351         man/id/Makefile
352         man/it/Makefile
353         man/ja/Makefile
354         man/ko/Makefile
355         man/pl/Makefile
356         man/pt_BR/Makefile
357         man/ru/Makefile
358         man/sv/Makefile
359         man/tr/Makefile
360         man/zh_CN/Makefile
361         man/zh_TW/Makefile
362         libmisc/Makefile
363         lib/Makefile
364         src/Makefile
365         contrib/Makefile
366         etc/Makefile
367         etc/pam.d/Makefile
368         shadow.spec
369 ])
370 AC_OUTPUT
371
372 echo
373 echo "shadow will be compiled with the following features:"
374 echo
375 echo "  auditing support:               $with_audit"
376 echo "  CrackLib support:               $with_libcrack"
377 echo "  PAM support:                    $with_libpam"
378 echo "  SELinux support:                $with_selinux"
379 echo "  shadow group support:           $enable_shadowgrp"
380 echo "  S/Key support:                  $with_skey"
381 echo