]> granicus.if.org Git - shadow/blob - configure.in
[svn-upgrade] Integrating new upstream version, shadow (4.0.7)
[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.7)
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 AM_DISABLE_SHARED
11 AM_ENABLE_STATIC
12
13 AM_MAINTAINER_MODE
14
15 dnl Checks for programs.
16 AC_PROG_CC
17 AC_ISC_POSIX
18 AC_PROG_LN_S
19 AC_PROG_YACC
20 AM_C_PROTOTYPES
21 AM_PROG_LIBTOOL
22
23 dnl Checks for libraries.
24
25 dnl Checks for header files.
26 AC_HEADER_DIRENT
27 AC_HEADER_STDC
28 AC_HEADER_SYS_WAIT
29
30 AC_CHECK_HEADERS(errno.h fcntl.h limits.h unistd.h sys/time.h utmp.h \
31         utmpx.h termios.h termio.h sgtty.h sys/ioctl.h syslog.h paths.h \
32         utime.h ulimit.h sys/resource.h gshadow.h shadow.h lastlog.h \
33         locale.h rpc/key_prot.h)
34
35 AC_CHECK_FUNCS(a64l fchmod fchown fseeko fsync getgroups gethostname getspnam \
36         gettimeofday getusershell getutent initgroups lchown lckpwdf lstat \
37         memcpy memset setgroups sigaction strchr updwtmp updwtmpx)
38 AC_SYS_LARGEFILE
39
40 dnl Checks for typedefs, structures, and compiler characteristics.
41 AC_C_CONST
42 AC_TYPE_UID_T
43 AC_TYPE_OFF_T
44 AC_TYPE_PID_T
45 AC_TYPE_MODE_T
46 AC_HEADER_STAT
47 AC_CHECK_MEMBERS([struct stat.st_rdev])
48 AC_HEADER_TIME
49 AC_STRUCT_TM
50
51 if test "$ac_cv_header_utmp_h" = "yes"; then
52         AC_CACHE_CHECK(for ut_host in struct utmp,
53                 ac_cv_struct_utmp_ut_host,
54                 AC_COMPILE_IFELSE(
55                         [AC_LANG_PROGRAM([#include <utmp.h>],
56                                 [struct utmp ut; char *cp = ut.ut_host;]
57                         )],
58                         [ac_cv_struct_utmp_ut_host=yes],
59                         [ac_cv_struct_utmp_ut_host=no]
60                 )
61         )
62
63         if test "$ac_cv_struct_utmp_ut_host" = "yes"; then
64                 AC_DEFINE(UT_HOST)
65         fi
66
67         AC_CACHE_CHECK(for ut_user in struct utmp,
68                 ac_cv_struct_utmp_ut_user,
69                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <utmp.h>],
70                                 [struct utmp ut; char *cp = ut.ut_user;]
71                         )],
72                         [ac_cv_struct_utmp_ut_user=yes],
73                         [ac_cv_struct_utmp_ut_user=no]
74                 )
75         )
76
77         if test "$ac_cv_struct_utmp_ut_user" = "no"; then
78                 AC_DEFINE(ut_user, ut_name)
79         fi
80 fi
81
82 if test "$ac_cv_header_lastlog_h" = "yes"; then
83         AC_CACHE_CHECK(for ll_host in struct lastlog,
84                 ac_cv_struct_lastlog_ll_host,
85                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <lastlog.h>],
86                                         [struct lastlog ll; char *cp = ll.ll_host;]
87                                 )],
88                         [ac_cv_struct_lastlog_ll_host=yes],
89                         [ac_cv_struct_lastlog_ll_host=no]
90                 )
91         )
92
93         if test "$ac_cv_struct_lastlog_ll_host" = "yes"; then
94                 AC_DEFINE(HAVE_LL_HOST)
95         fi
96 fi
97
98 dnl Checks for library functions.
99 AC_TYPE_GETGROUPS
100 AC_PROG_GCC_TRADITIONAL
101 AC_TYPE_SIGNAL
102 AC_FUNC_UTIME_NULL
103 AC_FUNC_STRFTIME
104 AC_REPLACE_FUNCS(mkdir putgrent putpwent putspent rename rmdir)
105 AC_REPLACE_FUNCS(sgetgrent sgetpwent sgetspent)
106 AC_REPLACE_FUNCS(snprintf strcasecmp strdup strerror strstr)
107
108 AC_CHECK_FUNC(setpgrp)
109 AC_FUNC_SETPGRP
110
111 if test "$ac_cv_header_shadow_h" = "yes"; then
112 AC_CACHE_CHECK(for working shadow group support,
113         ac_cv_libc_shadowgrp,
114         AC_RUN_IFELSE([AC_LANG_SOURCE([
115                         #include <shadow.h>
116                         main()
117                         {
118                                 struct sgrp *sg = sgetsgent("test:x::");
119                                 /* NYS libc on Red Hat 3.0.3 has broken shadow group support */
120                                 return !sg || !sg->sg_adm || !sg->sg_mem;
121                         }]
122                 )],
123                 [ac_cv_libc_shadowgrp=yes],
124                 [ac_cv_libc_shadowgrp=no],
125                 [ac_cv_libc_shadowgrp=no]
126         )
127 )
128
129 if test "$ac_cv_libc_shadowgrp" = "yes"; then
130         AC_DEFINE(HAVE_SHADOWGRP)
131 fi
132 fi
133
134 AC_CACHE_CHECK([location of shared mail directory], shadow_cv_maildir,
135 [for shadow_cv_maildir in /var/mail /var/spool/mail /usr/spool/mail /usr/mail none; do
136         if test -d $shadow_cv_maildir; then
137                 break
138         fi
139 done])
140 if test $shadow_cv_maildir != none; then
141         AC_DEFINE_UNQUOTED(MAIL_SPOOL_DIR, "$shadow_cv_maildir")
142 fi
143
144 AC_CACHE_CHECK([location of user mail file], shadow_cv_mailfile,
145 [for shadow_cv_mailfile in Mailbox mailbox Mail mail .mail none; do
146         if test -f $HOME/$shadow_cv_mailfile; then
147                 break
148         fi
149 done])
150 if test $shadow_cv_mailfile != none; then
151         AC_DEFINE_UNQUOTED(MAIL_SPOOL_FILE, "$shadow_cv_mailfile")
152 fi
153
154 AC_CACHE_CHECK([location of utmp], shadow_cv_utmpdir,
155 [for utmpdir in /var/run /var/adm /usr/adm /etc none; do
156         if test -f $shadow_cv_utmpdir/utmp; then
157                 break
158         fi
159 done])
160 if test "$shadow_cv_utmpdir" = "none"; then
161         AC_MSG_WARN(utmp file not found)
162 fi
163 AC_DEFINE_UNQUOTED(_UTMP_FILE, "$shadow_cv_utmpdir/utmp")
164
165 AC_CACHE_CHECK([location of faillog/lastlog/wtmp], shadow_cv_logdir,
166 [for shadow_cv_logdir in /var/log /var/adm /usr/adm /etc; do
167         if test -d $logdir; then
168                 break
169         fi
170 done])
171 AC_DEFINE_UNQUOTED(_WTMP_FILE, "$shadow_cv_logdir/wtmp")
172 AC_DEFINE_UNQUOTED(LASTLOG_FILE, "$shadow_cv_logdir/lastlog")
173 AC_DEFINE_UNQUOTED(FAILLOG_FILE, "$shadow_cv_logdir/faillog")
174
175 AC_CACHE_CHECK([location of the passwd program], shadow_cv_passwd_dir,
176 [if test -f /usr/bin/passwd; then
177         shadow_cv_passwd_dir=/usr/bin
178 else
179         shadow_cv_passwd_dir=/bin
180 fi])
181 AC_DEFINE_UNQUOTED(PASSWD_PROGRAM, "$shadow_cv_passwd_dir/passwd")
182
183 dnl XXX - quick hack, should disappear before anyone notices :).
184 AC_DEFINE(SHADOWPWD)
185 AC_DEFINE(USG)
186 AC_DEFINE(USE_SYSLOG)
187 AC_DEFINE(RLOGIN)
188 AC_DEFINE(RUSEROK, 0)
189
190 dnl Use our own version of getpass(), which handles long passwords
191 dnl (unlike many systems which have a limit of 8 characters), and can
192 dnl be interrupted with Ctrl-C (unlike Linux libc).
193 AC_DEFINE(getpass, libshadow_getpass)
194
195 AC_ARG_ENABLE(desrpc, [  --enable-desrpc         try to use secure RPC in login (default if found)])
196 AC_ARG_ENABLE(shadowgrp, [  --enable-shadowgrp      enable shadow group support [default=yes]])
197
198 AC_ARG_WITH(libcrack, [  --with-libcrack        try to use libcrack (default if found)])
199 AC_ARG_WITH(libcrypt, [  --with-libcrypt        try to use libcrypt (default if found)])
200 AC_ARG_WITH(libopie,  [  --with-libopie         use libopie for OPIE support])
201 AC_ARG_WITH(libpam,   [  --with-libpam          use libpam for PAM support])
202 AC_ARG_WITH(libskey,  [  --with-libskey         use libskey for S/Key support])
203 AC_ARG_WITH(selinux,  [  --with-selinux         use SELinux support])
204
205 dnl Check for some functions in libc first, only if not found check for
206 dnl other libraries.  This should prevent linking libnsl if not really
207 dnl needed (Linux glibc, Irix), but still link it if needed (Solaris).
208
209 AC_SEARCH_LIBS(inet_ntoa, inet)
210 AC_SEARCH_LIBS(socket, socket)
211 AC_SEARCH_LIBS(gethostbyname, nsl)
212
213 dnl XXX - getsecretkey() causes login to hang for 5 minutes on at least
214 dnl one RH 4.0 system.  Use --disable-desrpc if you have this problem.
215 dnl Reported by Mohan Khurana <mohan@stealth.net>.
216
217 if test "$enable_desrpc" != "no" -a "$ac_cv_header_rpc_key_prot_h" = "yes" ; then
218         AC_CHECK_FUNC(getsecretkey, AC_DEFINE(DES_RPC),
219                 AC_CHECK_LIB(rpcsvc, getsecretkey, AC_DEFINE(DES_RPC)))
220 fi
221
222 if test "$enable_shadowgrp" != "no"; then
223         AC_DEFINE(SHADOWGRP)
224 fi
225
226 AC_SUBST(LIBCRYPT)
227 if test "$with_libcrypt" != "no"; then
228         AC_CHECK_LIB(crypt, crypt, [AC_DEFINE(HAVE_LIBCRYPT) LIBCRYPT=-lcrypt])
229 fi
230
231 AC_SUBST(LIBCRACK)
232 if test "$with_libcrack" != "no"; then
233         echo "checking cracklib flavour, don't be surprised by the results"
234         AC_CHECK_LIB(crack, FascistCheck, AC_DEFINE(HAVE_LIBCRACK) LIBCRACK=-lcrack)
235         AC_CHECK_LIB(crack, FascistHistory, AC_DEFINE(HAVE_LIBCRACK_HIST))
236         AC_CHECK_LIB(crack, FascistHistoryPw, AC_DEFINE(HAVE_LIBCRACK_PW))
237 fi
238
239 AC_SUBST(LIBSKEY)
240 AC_SUBST(LIBMD)
241 if test "$with_libskey" = "yes"; then
242         AC_CHECK_LIB(md, MD5Init, LIBMD=-lmd)
243         AC_CHECK_LIB(skey, skeychallenge, AC_DEFINE(SKEY) LIBSKEY=-lskey, [], $LIBMD $LIBCRYPT)
244 elif test "$with_libopie" = "yes"; then
245         AC_CHECK_LIB(opie, opiechallenge, AC_DEFINE(OPIE) LIBSKEY=-lopie, [], $LIBCRYPT)
246 fi
247
248 if test "$with_selinux" = "yes"; then
249         AC_CHECK_LIB(selinux, is_selinux_enabled, [LIBSELINUX="-lselinux"], [SELinuux enabled but libselinux not found])
250         AC_SUBST(LIBSELINUX)
251         AC_CHECK_HEADERS(selinux/selinux.h, [], [selinux/selinux.h is missing])
252         AC_DEFINE(WITH_SELINUX, 1, [Build shadow with SELinux support])
253 fi
254
255 AC_SUBST(LIBPAM)
256 if test "$with_libpam" = "yes"; then
257         AC_CHECK_LIB(pam, pam_start,
258                 [AC_DEFINE(USE_PAM, 1, [Define to support Pluggable Authentication Modules])
259                 LIBPAM="-lpam"
260                 AC_CHECK_LIB(pam_misc, main,
261                         [LIBPAM="$LIBPAM -lpam_misc"],
262                         AC_MSG_ERROR(libpam_misc is missing)
263                 )]
264                 [AC_MSG_CHECKING(use login access checking if PAM not used)
265                 AC_DEFINE(LOGIN_ACCESS)
266                 AC_MSG_RESULT(yes)]
267         )
268         AC_MSG_CHECKING(use login and su access checking if PAM not used)
269         AC_MSG_RESULT(no)
270 else
271         AC_MSG_CHECKING(use login and su access checking if PAM not used)
272         AC_DEFINE(LOGIN_ACCESS)
273         AC_DEFINE(SU_ACCESS)
274         AC_MSG_RESULT(yes)
275 fi
276
277 AM_GNU_GETTEXT_VERSION(0.12.1)
278 AM_GNU_GETTEXT([external])
279 AC_DEFINE_UNQUOTED(LOCALEDIR, "${datadir}/locale", [locale directory])
280
281 AC_CONFIG_FILES([
282         Makefile
283         po/Makefile.in
284         doc/Makefile
285         man/Makefile
286         man/cs/Makefile
287         man/de/Makefile
288         man/es/Makefile
289         man/fr/Makefile
290         man/hu/Makefile
291         man/id/Makefile
292         man/it/Makefile
293         man/ja/Makefile
294         man/ko/Makefile
295         man/pl/Makefile
296         man/pt_BR/Makefile
297         man/ru/Makefile
298         man/zh_CN/Makefile
299         man/zh_TW/Makefile
300         libmisc/Makefile
301         lib/Makefile
302         src/Makefile
303         contrib/Makefile
304         etc/Makefile
305         etc/pam.d/Makefile
306         shadow.spec
307 ])
308 AC_OUTPUT