]> granicus.if.org Git - linux-pam/blob - configure.in
Relevant BUGIDs:
[linux-pam] / configure.in
1 dnl Process this file with autoconf to produce a configure script.
2 AC_INIT(conf/pam_conv1/pam_conv.y)
3 AM_INIT_AUTOMAKE("Linux-PAM", 0.99.1.0)
4 AM_CONFIG_HEADER(config.h)
5 AC_CANONICAL_HOST
6
7 AC_SUBST(PACKAGE)
8 AC_SUBST(VERSION)
9
10 ALL_LINGUAS="cs de es fi fr hu it ja nb pa pl pt_BR pt zh_CN zh_TW"
11
12 dnl
13 dnl By default, everything under PAM is installed below /usr.
14 dnl
15 AC_PREFIX_DEFAULT(/usr)
16
17 dnl and some hacks to use /etc and /lib
18 test "${prefix}" = "NONE" && prefix="/usr"
19 if test ${prefix} = '/usr'
20 then
21 dnl If we use /usr as prefix, use /etc for config files
22         if test ${sysconfdir} = '${prefix}/etc'
23         then
24                 sysconfdir="/etc"
25         fi
26         if test ${libdir} = '${exec_prefix}/lib'
27         then
28                 libdir="/lib"
29         fi
30         if test ${sbindir} = '${exec_prefix}/sbin'
31         then
32                 sbindir="/sbin"
33         fi
34 dnl If we use /usr as prefix, use /usr/share/man for manual pages
35         if test ${mandir} = '${prefix}/man'
36         then
37                 mandir='${prefix}/share/man'
38         fi
39 dnl Add security to include directory
40         if test ${includedir} = '${prefix}/include'
41         then
42                 includedir="${prefix}/include/security"
43         fi
44 fi
45
46
47 dnl Checks for programs.
48 AC_GNU_SOURCE
49 AC_PROG_CC
50 AC_PROG_YACC
51 AM_PROG_LEX
52 AC_PROG_INSTALL
53 AC_PROG_LN_S
54 AC_PROG_MAKE_SET
55 # per default don't build static libraries
56 AC_DISABLE_STATIC
57 AC_PROG_LIBTOOL
58
59 if test "$enable_static" = yes; then
60    CFLAGS="$CFLAGS -DPAM_STATIC"
61 fi
62 if test "$enable_shared" = yes; then
63    CFLAGS="$CFLAGS -DPAM_DYNAMIC"
64 fi
65
66 # Largefile support
67 AC_SYS_LARGEFILE
68
69 if eval "test x$GCC = xyes"; then
70   for flag in \
71       -W \
72       -Wall \
73       -Wbad-function-cast \
74       -Wcast-align \
75       -Wcast-qual \
76       -Wmissing-declarations \
77       -Wmissing-prototypes \
78       -Wpointer-arith \
79       -Wreturn-type \
80       -Wstrict-prototypes \
81       -Wwrite-strings \
82       -Winline \
83       -Wshadow
84   do
85     JAPHAR_GREP_CFLAGS($flag, [ CFLAGS="$CFLAGS $flag" ])
86   done
87 fi
88
89 AC_C___ATTRIBUTE__
90
91 dnl
92 dnl Check if --version-script is supported by ld
93 dnl 
94 AC_CACHE_CHECK(for .symver assembler directive, libc_cv_asm_symver_directive,
95 [cat > conftest.s <<EOF
96 ${libc_cv_dot_text}
97 _sym:
98 .symver _sym,sym@VERS
99 EOF
100 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
101   libc_cv_asm_symver_directive=yes
102 else
103   libc_cv_asm_symver_directive=no
104 fi
105 rm -f conftest*])
106 AC_CACHE_CHECK(for ld --version-script, libc_cv_ld_version_script_option, [dnl
107 if test $libc_cv_asm_symver_directive = yes; then
108   cat > conftest.s <<EOF
109 ${libc_cv_dot_text}
110 _sym:
111 .symver _sym,sym@VERS
112 EOF
113   cat > conftest.map <<EOF
114 VERS_1 {
115         global: sym;
116 };
117
118 VERS_2 {
119         global: sym;
120 } VERS_1;
121 EOF
122   if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; 
123 then
124     if AC_TRY_COMMAND([${CC-cc} $CFLAGS $LDFLAGS -shared
125                                 -o conftest.so conftest.o
126                                 -nostartfiles -nostdlib
127                                 -Wl,--version-script,conftest.map
128                        1>&AS_MESSAGE_LOG_FD]);
129     then
130       libc_cv_ld_version_script_option=yes
131     else
132       libc_cv_ld_version_script_option=no
133     fi
134   else
135     libc_cv_ld_version_script_option=no
136   fi
137 else
138   libc_cv_ld_version_script_option=no
139 fi
140 rm -f conftest*])
141 AM_CONDITIONAL([HAVE_VERSIONING],
142         [test "$libc_cv_ld_version_script_option" = "yes"])
143
144 dnl
145 dnl options and defaults
146 dnl
147
148 AM_PATH_LIBPRELUDE([0.9.0])
149 if test "$LIBPRELUDE_CONFIG" != "no" ; then
150   LIBPRELUDE_CFLAGS="$LIBPRELUDE_CFLAGS -DPRELUDE=1"
151 fi
152
153 dnl lots of debugging information goes to /var/run/pam-debug.log
154 AC_ARG_ENABLE([debug],
155     AC_HELP_STRING([--enable-debug],
156         [specify you are building with debugging on]),
157         WITH_DEBUG=yes ; AC_DEFINE([DEBUG],,
158                 [lots of stuff gets written to /var/run/pam-debug.log]),
159                 WITH_DEBUG=no)
160 AC_SUBST(WITH_DEBUG)
161
162 AC_ARG_ENABLE([memory-debug],
163     AC_HELP_STRING([--enable-memory-debug],[specify you want every malloc etc. call tracked]),
164     WITH_MEMORY_DEBUG=$enableval, WITH_MEMORY_DEBUG=no)
165 if test "$WITH_MEMORY_DEBUG" != "no" ; then
166     AC_DEFINE([MEMORY_DEBUG], 1, [Every malloc etc. call will be tracked])
167 fi
168 AH_VERBATIM([_MEMORY_DEBUG],
169 [#ifdef MEMORY_DEBUG
170 /*
171  * this is basically a hack - we need to include a semiarbitrary
172  * number of headers to ensure that we don't get silly prototype/macro
173  */
174 # include <string.h>
175 # include <stdlib.h>
176 # include <security/pam_malloc.h>
177 #endif /* MEMORY_DEBUG */])
178
179 AC_ARG_ENABLE(securedir,
180 [  --enable-securedir=<path to location of PAMs> [default \$libdir/security]],
181         SECUREDIR=$enableval, SECUREDIR=$libdir/security)
182 AC_SUBST(SECUREDIR)
183
184 AC_ARG_ENABLE([isadir],
185         AC_HELP_STRING([--enable-isadir=DIR],[path to arch-specific module files [default ../../`basename $libdir`/security]]),
186 ISA=$enableval,
187 ISA=../../`basename $libdir`/security)
188 unset mylibdirbase
189 AC_DEFINE_UNQUOTED(_PAM_ISA,"$ISA",[Define to the path, relative to SECUREDIR, where PAMs specific to this architecture can be found.])
190 AC_MSG_RESULT([Defining \$ISA to "$ISA"])
191
192 AC_ARG_ENABLE(sconfigdir,
193 [  --enable-sconfigdir=<path to module conf files> [default \$sysconfdir/security]],
194         SCONFIGDIR=$enableval, SCONFIGDIR=$sysconfdir/security)
195 AC_SUBST(SCONFIGDIR)
196
197 AC_ARG_ENABLE(docdir,
198 [  --enable-docdir=<path to store documentation in - /usr/share/doc/pam>],
199         DOCDIR=$enableval, DOCDIR=/usr/share/doc/pam)
200 AC_SUBST(DOCDIR)
201
202
203 AC_ARG_ENABLE(pamlocking,
204 [  --enable-pamlocking      configure libpam to observe a global authentication lock],
205         WITH_PAMLOCKING=yes ; AC_DEFINE([PAM_LOCKING],,
206                 [libpam should observe a global authentication lock]),
207                 WITH_PAMLOCKING=no)
208 AC_SUBST(WITH_PAMLOCKING)
209
210 AC_ARG_ENABLE(read-both-confs,
211 [  --enable-read-both-confs  read both /etc/pam.d and /etc/pam.conf files],
212         AC_DEFINE([PAM_READ_BOTH_CONFS],,
213                 [read both /etc/pam.d and /etc/pam.conf files]))
214 AC_SUBST(PAM_READ_BOTH_CONFS)
215
216 AC_ARG_ENABLE([lckpwdf],
217         AC_HELP_STRING([--disable-lckpwdf],[do not use the lckpwdf function]),
218         WITH_LCKPWDF=$enableval, WITH_LCKPWDF=yes)
219 if test "$WITH_LCKPWDF" == "yes" ; then
220     AC_DEFINE([USE_LCKPWDF], 1,
221                 [Define to 1 if the lckpwdf function should be used])
222 fi
223
224 AC_CHECK_HEADERS(paths.h)
225 AC_ARG_WITH(mailspool,
226 [  --with-mailspool        path to mail spool directory
227                           [default _PATH_MAILDIR if defined in paths.h, otherwise /var/spool/mail]],
228 with_mailspool=${withval})
229 if test x$with_mailspool != x ; then
230         pam_mail_spool="\"$with_mailspool\""
231 else
232         AC_TRY_RUN([
233 #include <paths.h>
234 int main() {
235 #ifdef _PATH_MAILDIR
236 exit(0);
237 #else
238 exit(1);
239 #endif
240 }], pam_mail_spool="_PATH_MAILDIR",
241 pam_mail_spool="\"/var/spool/mail\"",
242 pam_mail_spool="\"/var/spool/mail\"")
243 fi
244 AC_DEFINE_UNQUOTED(PAM_PATH_MAILDIR, $pam_mail_spool,
245         [Path where mails are stored])
246
247 AC_ARG_WITH(xauth,
248 [  --with-xauth            additional path to check for xauth when it is called from pam_xauth
249                           [added to the default of /usr/X11R6/bin/xauth, /usr/bin/xauth, /usr/bin/X11/xauth]],
250 pam_xauth_path=${withval})
251 if test x$with_xauth == x ; then
252         AC_PATH_PROG(pam_xauth_path, xauth)
253 dnl There is no sense in adding the first default path
254         if test x$pam_xauth_path == x/usr/X11R6/bin/xauth ; then
255                 unset pam_xauth_path
256         fi
257 fi
258
259 if test x$pam_xauth_path != x ; then
260         AC_DEFINE_UNQUOTED(PAM_PATH_XAUTH, "$pam_xauth_path",
261         [Additional path of xauth executable])
262 fi
263
264 dnl Checks for the existence of libdl - on BSD and Tru64 its part of libc
265 AC_CHECK_LIB([dl], [dlopen], LIBDL="-ldl", LIBDL="")
266 AC_SUBST(LIBDL)
267
268 BACKUP_LIBS=$LIBS
269 AC_SEARCH_LIBS([FascistCheck],[crack], LIBCRACK="-l$ac_lib", LIBCRACK="")
270 LIBS=$BACKUP_LIBS
271 AC_SUBST(LIBCRACK)
272 AM_CONDITIONAL([HAVE_LIBCRACK], [test ! -z "$LIBCRACK"])
273
274 BACKUP_LIBS=$LIBS
275 AC_SEARCH_LIBS([crypt],[xcrypt crypt], LIBCRYPT="-l$ac_lib", LIBCRYPT="")
276 LIBS=$BACKUP_LIBS
277 AC_SUBST(LIBCRYPT)
278
279 dnl check for libndbm or libdb as fallback
280 BACKUP_LIBS=$LIBS
281 AC_CHECK_LIB([ndbm],[dbm_store], LIBDB="-lndbm", LIBDB="") 
282 LIBS=$BACKUP_LIBS
283 if test -z "$LIBDB" ; then
284     BACKUP_LIBS=$LIBS
285     AC_CHECK_LIB([db], [dbm_store], LIBDB="-ldb", LIBDB="")
286     LIBS=$BACKUP_LIBS
287 fi
288 if test -z "$LIBDB" ; then
289     BACKUP_LIBS=$LIBS
290     AC_CHECK_LIB([db], [db_create], LIBDB="-ldb", LIBDB="")
291     LIBS=$BACKUP_LIBS
292 fi
293 AC_SUBST(LIBDB)
294 AM_CONDITIONAL([HAVE_LIBDB], [test ! -z "$LIBDB"])
295
296 BACKUP_LIBS=$LIBS
297 AC_CHECK_LIB([nsl],[yp_get_default_domain], LIBNSL="-lnsl", LIBNSL="")
298 LIBS=$BACKUP_LIBS
299 AC_SUBST(LIBNSL)
300
301 BACKUP_LIBS=$LIBS
302 AC_CHECK_LIB([selinux],[getfilecon], LIBSELINUX="-lselinux", LIBSELINUX="")
303 LIBS=$BACKUP_LIBS
304 AC_SUBST(LIBSELINUX)
305 AM_CONDITIONAL([HAVE_LIBSELINUX], [test ! -z "$LIBSELINUX"])
306
307 dnl Checks for Libcap
308 BACKUP_LIBS=$LIBS
309 AC_CHECK_LIB([cap], [cap_get_proc], LIBCAP="-lcap", LIBCAP="" )
310 LIBS=$BACKUP_LIBS
311 AC_SUBST(LIBCAP)
312 AM_CONDITIONAL([HAVE_LIBCAP], [test ! -z "$LIBCAP"])
313
314 BACKUP_LIBS=$LIBS
315 AC_CHECK_LIB([pwdb],[pwdb_db_name], LIBPWDB="-lpwdb", LIBPWDB="")
316 LIBS=$BACKUP_LIBS
317 AC_SUBST(LIBPWDB)
318 AM_CONDITIONAL([HAVE_LIBPWDB], [test ! -z "$LIBPWDB"])
319
320 dnl Checks for header files.
321 AC_HEADER_DIRENT
322 AC_HEADER_STDC
323 AC_HEADER_SYS_WAIT
324 AC_CHECK_HEADERS(fcntl.h limits.h malloc.h sys/file.h sys/ioctl.h sys/time.h syslog.h termio.h unistd.h sys/fsuid.h inittypes.h)
325
326 AC_CHECK_HEADERS(crypt.h)
327 AC_CHECK_HEADERS(crack.h)
328
329 dnl For module/pam_userdb
330 AC_CHECK_HEADERS(ndbm.h db.h)
331 dnl I suspect the following two lines are a hack.
332 HAVE_NDBM_H=$ac_cv_header_ndbm_h
333 AC_SUBST(HAVE_NDBM_H)
334
335 dnl For module/pam_lastlog
336 AC_CHECK_HEADERS(lastlog.h utmp.h utmpx.h)
337
338 dnl Checks for typedefs, structures, and compiler characteristics.
339 AC_C_BIGENDIAN
340 AC_C_CONST
341 AC_TYPE_UID_T
342 AC_TYPE_OFF_T
343 AC_TYPE_PID_T
344 AC_TYPE_SIZE_T
345 AC_HEADER_TIME
346 AC_STRUCT_TM
347
348 dnl Checks for library functions.
349 AC_TYPE_GETGROUPS
350 AC_PROG_GCC_TRADITIONAL
351 AC_FUNC_MEMCMP
352 AC_FUNC_VPRINTF
353 AC_CHECK_FUNCS(gethostname gettimeofday lckpwdf mkdir select strcspn strdup strerror strspn strstr strtol uname)
354
355 AC_CHECK_FUNCS(getpwnam_r getpwuid_r getgrnam_r getgrgid_r getspnam_r getgrouplist)
356
357 dnl Checks for programs/utilities
358 AC_CHECK_PROG(SGML2PS, sgml2ps, yes, no)
359 AC_CHECK_PROG(SGML2TXT, sgml2txt, yes, no)
360 AC_CHECK_PROG(SGML2HTML, sgml2html, yes, no)
361 AC_CHECK_PROG(SGML2LATEX, sgml2latex, yes, no)
362 AC_CHECK_PROG(PS2PDF, ps2pdf, yes, no)
363 AM_CONDITIONAL([HAVE_SGML2PS], [test "$SGML2PS" = yes || test "$SGML2LATEX" = yes])
364 AM_CONDITIONAL([HAVE_SGML2TXT], [test "$SGML2TXT" = yes])
365 AM_CONDITIONAL([HAVE_SGML2HTML], [test "$SGML2HTML" = yes])
366 AM_CONDITIONAL([HAVE_PS2PDF], [test "$PS2PDF" = yes])
367 if test $SGML2LATEX = "yes" ; then
368   if sgml2latex -h | grep -e --paper | grep  ' -p ' > /dev/null ; then
369     PSER="sgml2latex -o ps"
370   else
371     PSER="sgml2latex -p"
372   fi
373 else
374   if test $SGML2PS = yes ; then
375     PSER="sgml2ps"
376   fi
377 fi
378 AC_SUBST(PSER)
379
380 AM_GNU_GETTEXT_VERSION
381 AM_GNU_GETTEXT([external])
382
383 AH_VERBATIM([_ZZENABLE_NLS],
384 [#ifdef ENABLE_NLS
385 #include <libintl.h>
386 #define _(msgid) dgettext("Linux-PAM", msgid)
387 #define N_(msgid) msgid
388 #else
389 #define _(msgid) (msgid)
390 #define N_(msgid) msgid
391 #endif /* ENABLE_NLS */])
392
393 dnl Files to be created from when we run configure
394 AC_OUTPUT(Makefile libpam/Makefile libpamc/Makefile libpamc/test/Makefile \
395         libpam_misc/Makefile conf/Makefile conf/pam_conv1/Makefile \
396         po/Makefile.in \
397         modules/Makefile \
398         modules/pam_access/Makefile modules/pam_cracklib/Makefile \
399         modules/pam_debug/Makefile modules/pam_deny/Makefile \
400         modules/pam_echo/Makefile modules/pam_env/Makefile \
401         modules/pam_filter/Makefile modules/pam_filter/upperLOWER/Makefile \
402         modules/pam_ftp/Makefile modules/pam_group/Makefile \
403         modules/pam_issue/Makefile modules/pam_lastlog/Makefile \
404         modules/pam_limits/Makefile modules/pam_listfile/Makefile \
405         modules/pam_localuser/Makefile modules/pam_mail/Makefile \
406         modules/pam_mkhomedir/Makefile modules/pam_motd/Makefile \
407         modules/pam_nologin/Makefile modules/pam_permit/Makefile \
408         modules/pam_pwdb/Makefile modules/pam_rhosts/Makefile \
409         modules/pam_rootok/Makefile \
410         modules/pam_securetty/Makefile modules/pam_selinux/Makefile \
411         modules/pam_shells/Makefile modules/pam_stress/Makefile \
412         modules/pam_succeed_if/Makefile modules/pam_tally/Makefile \
413         modules/pam_time/Makefile modules/pam_umask/Makefile \
414         modules/pam_unix/Makefile modules/pam_userdb/Makefile \
415         modules/pam_warn/Makefile modules/pam_wheel/Makefile \
416         modules/pam_xauth/Makefile doc/Makefile doc/specs/Makefile \
417         examples/Makefile)