]> 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.4.0)
4 AM_CONFIG_HEADER(config.h)
5 AC_CANONICAL_HOST
6
7 AC_SUBST(PACKAGE)
8 AC_SUBST(VERSION)
9
10 dnl
11 dnl By default, everything under PAM is installed below /usr.
12 dnl
13 AC_PREFIX_DEFAULT(/usr)
14
15 dnl and some hacks to use /etc and /lib
16 test "${prefix}" = "NONE" && prefix="/usr"
17 if test ${prefix} = '/usr'
18 then
19 dnl If we use /usr as prefix, use /etc for config files
20         if test ${sysconfdir} = '${prefix}/etc'
21         then
22                 sysconfdir="/etc"
23         fi
24         if test ${libdir} = '${exec_prefix}/lib'
25         then
26                 libdir="/lib"
27         fi
28         if test ${sbindir} = '${exec_prefix}/sbin'
29         then
30                 sbindir="/sbin"
31         fi
32 dnl If we use /usr as prefix, use /usr/share/man for manual pages
33         if test ${mandir} = '${prefix}/man'
34         then
35                 mandir='${prefix}/share/man'
36         fi
37 dnl Add security to include directory
38         if test ${includedir} = '${prefix}/include'
39         then
40                 includedir="${prefix}/include/security"
41         fi
42 fi
43
44 dnl
45 dnl check if we should link everything static into libpam
46 dnl
47 AC_ARG_ENABLE(static-modules,AS_HELP_STRING([--enable-static-modules],
48         [do not make the modules dynamically loadable]),
49         STATIC_MODULES=$enableval,STATIC_MODULES=no)
50 if test "$STATIC_MODULES" != "no" ; then
51         CFLAGS="$CFLAGS -DPAM_STATIC"
52         AC_ENABLE_STATIC([yes])
53         AC_ENABLE_SHARED([no])
54 else
55 # per default don't build static libraries
56         AC_ENABLE_STATIC([no])
57         AC_ENABLE_SHARED([yes])
58 fi
59 AM_CONDITIONAL([STATIC_MODULES], [test "$STATIC_MODULES" != "no"])
60
61 dnl Checks for programs.
62 AC_GNU_SOURCE
63 AC_PROG_CC
64 AC_PROG_YACC
65 AM_PROG_LEX
66 AC_PROG_INSTALL
67 AC_PROG_LN_S
68 AC_PROG_MAKE_SET
69 AC_PROG_LIBTOOL
70 PAM_LD_AS_NEEDED
71 PAM_LD_O1
72
73 dnl Largefile support
74 AC_SYS_LARGEFILE
75
76 dnl icc claims to be GCC compatible, but use other flags for warnings
77 if eval "test x$GCC = xyes -a $CC != icc"; then
78   for flag in \
79       -W \
80       -Wall \
81       -Wbad-function-cast \
82       -Wcast-align \
83       -Wcast-qual \
84       -Wmissing-declarations \
85       -Wmissing-prototypes \
86       -Wpointer-arith \
87       -Wreturn-type \
88       -Wstrict-prototypes \
89       -Wwrite-strings \
90       -Winline \
91       -Wshadow
92   do
93     JAPHAR_GREP_CFLAGS($flag, [ CFLAGS="$CFLAGS $flag" ])
94   done
95 fi
96 dnl icc has special warning flags
97 if eval "test x$CC = xicc"; then
98   for flag in \
99       -Wall \
100       -Wmissing-prototypes \
101       -Wpointer-arith \
102       -Wreturn-type \
103       -Wstrict-prototypes \
104       -Wwrite-strings \
105       -Wshadow \
106       -Wp64 \
107       -Wdeprecated \
108       -Wuninitialized \
109       -Wmain
110   do
111     JAPHAR_GREP_CFLAGS($flag, [ CFLAGS="$CFLAGS $flag" ])
112   done
113 fi
114
115 AC_C___ATTRIBUTE__
116
117 dnl
118 dnl Check if --version-script is supported by ld
119 dnl
120 AC_CACHE_CHECK(for .symver assembler directive, libc_cv_asm_symver_directive,
121 [cat > conftest.s <<EOF
122 ${libc_cv_dot_text}
123 _sym:
124 .symver _sym,sym@VERS
125 EOF
126 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
127   libc_cv_asm_symver_directive=yes
128 else
129   libc_cv_asm_symver_directive=no
130 fi
131 rm -f conftest*])
132 AC_CACHE_CHECK(for ld --version-script, libc_cv_ld_version_script_option, [dnl
133 if test $libc_cv_asm_symver_directive = yes; then
134   cat > conftest.s <<EOF
135 ${libc_cv_dot_text}
136 _sym:
137 .symver _sym,sym@VERS
138 EOF
139   cat > conftest.map <<EOF
140 VERS_1 {
141         global: sym;
142 };
143
144 VERS_2 {
145         global: sym;
146 } VERS_1;
147 EOF
148   if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD;
149 then
150     if AC_TRY_COMMAND([${CC-cc} $CFLAGS $LDFLAGS -shared
151                                 -o conftest.so conftest.o
152                                 -nostartfiles -nostdlib
153                                 -Wl,--version-script,conftest.map
154                        1>&AS_MESSAGE_LOG_FD]);
155     then
156       libc_cv_ld_version_script_option=yes
157     else
158       libc_cv_ld_version_script_option=no
159     fi
160   else
161     libc_cv_ld_version_script_option=no
162   fi
163 else
164   libc_cv_ld_version_script_option=no
165 fi
166 rm -f conftest*])
167 AM_CONDITIONAL([HAVE_VERSIONING],
168         [test "$libc_cv_ld_version_script_option" = "yes"])
169
170 dnl
171 dnl check for -fPIE/-pie support
172 dnl
173 dnl icc handles -fpie as -fp without error, so blacklist icc
174 dnl
175 AC_ARG_ENABLE(pie,AS_HELP_STRING([--disable-pie],
176                         [Disable position-independent executeables (PIE)]),
177         USE_PIE=$enableval, USE_PIE=yes)
178
179 AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
180   cat > conftest.c <<EOF
181 int foo;
182 main () { return 0;}
183 EOF
184   if test "$USE_PIE" = "yes" -a "$CC" != "icc" &&
185         AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -pie -fpie
186                               -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
187   then
188     libc_cv_fpie=yes
189     PIE_CFLAGS="-fpie"
190     PIE_LDFLAGS="-pie"
191   else
192     libc_cv_fpie=no
193     PIE_CFLAGS=""
194     PIE_LDFLAGS=""
195   fi
196   rm -f conftest*])
197 AC_SUBST(libc_cv_fpie)
198 AC_SUBST(PIE_CFLAGS)
199 AC_SUBST(PIE_LDFLAGS)
200
201
202 dnl
203 dnl options and defaults
204 dnl
205
206 AC_ARG_ENABLE([prelude],
207         AC_HELP_STRING([--disable-prelude],[do not use prelude]),
208         WITH_PRELUDE=$enableval, WITH_PRELUDE=yes)
209 if test "$WITH_PRELUDE" == "yes" ; then
210   AM_PATH_LIBPRELUDE([0.9.0])
211   if test "$LIBPRELUDE_CONFIG" != "no" ; then
212     LIBPRELUDE_CFLAGS="$LIBPRELUDE_CFLAGS -DPRELUDE=1"
213   fi
214 fi
215
216 dnl lots of debugging information goes to /var/run/pam-debug.log
217 AC_ARG_ENABLE([debug],
218     AC_HELP_STRING([--enable-debug],
219         [specify you are building with debugging on]),
220         WITH_DEBUG=yes ; AC_DEFINE([DEBUG],,
221                 [lots of stuff gets written to /var/run/pam-debug.log]),
222                 WITH_DEBUG=no)
223 AC_SUBST(WITH_DEBUG)
224
225 AC_ARG_ENABLE(securedir,
226 [  --enable-securedir=<path to location of PAMs> [default \$libdir/security]],
227         SECUREDIR=$enableval, SECUREDIR=$libdir/security)
228 AC_SUBST(SECUREDIR)
229
230 AC_ARG_ENABLE([isadir],
231         AC_HELP_STRING([--enable-isadir=DIR],[path to arch-specific module files [default ../../`basename $libdir`/security]]),
232 ISA=$enableval,
233 ISA=../../`basename $libdir`/security)
234 unset mylibdirbase
235 AC_DEFINE_UNQUOTED(_PAM_ISA,"$ISA",[Define to the path, relative to SECUREDIR, where PAMs specific to this architecture can be found.])
236 AC_MSG_RESULT([Defining \$ISA to "$ISA"])
237
238 AC_ARG_ENABLE(sconfigdir,
239 [  --enable-sconfigdir=<path to module conf files> [default \$sysconfdir/security]],
240         SCONFIGDIR=$enableval, SCONFIGDIR=$sysconfdir/security)
241 AC_SUBST(SCONFIGDIR)
242
243 AC_ARG_ENABLE(docdir,
244 [  --enable-docdir=<path to store documentation in - /usr/share/doc/pam>],
245         DOCDIR=$enableval, DOCDIR=/usr/share/doc/pam)
246 AC_SUBST(DOCDIR)
247
248
249 AC_ARG_ENABLE(pamlocking,
250 [  --enable-pamlocking      configure libpam to observe a global authentication lock],
251         WITH_PAMLOCKING=yes ; AC_DEFINE([PAM_LOCKING],,
252                 [libpam should observe a global authentication lock]),
253                 WITH_PAMLOCKING=no)
254 AC_SUBST(WITH_PAMLOCKING)
255
256 AC_ARG_ENABLE(read-both-confs,
257 [  --enable-read-both-confs  read both /etc/pam.d and /etc/pam.conf files],
258         AC_DEFINE([PAM_READ_BOTH_CONFS],,
259                 [read both /etc/pam.d and /etc/pam.conf files]))
260 AC_SUBST(PAM_READ_BOTH_CONFS)
261
262 AC_ARG_ENABLE([lckpwdf],
263         AC_HELP_STRING([--disable-lckpwdf],[do not use the lckpwdf function]),
264         WITH_LCKPWDF=$enableval, WITH_LCKPWDF=yes)
265 if test "$WITH_LCKPWDF" == "yes" ; then
266     AC_DEFINE([USE_LCKPWDF], 1,
267                 [Define to 1 if the lckpwdf function should be used])
268 fi
269
270 AC_CHECK_HEADERS(paths.h)
271 AC_ARG_WITH(mailspool,
272 [  --with-mailspool        path to mail spool directory
273                           [default _PATH_MAILDIR if defined in paths.h, otherwise /var/spool/mail]],
274 with_mailspool=${withval})
275 if test x$with_mailspool != x ; then
276         pam_mail_spool="\"$with_mailspool\""
277 else
278         AC_TRY_RUN([
279 #include <paths.h>
280 int main() {
281 #ifdef _PATH_MAILDIR
282 exit(0);
283 #else
284 exit(1);
285 #endif
286 }], pam_mail_spool="_PATH_MAILDIR",
287 pam_mail_spool="\"/var/spool/mail\"",
288 pam_mail_spool="\"/var/spool/mail\"")
289 fi
290 AC_DEFINE_UNQUOTED(PAM_PATH_MAILDIR, $pam_mail_spool,
291         [Path where mails are stored])
292
293 AC_ARG_WITH(xauth,
294 [  --with-xauth            additional path to check for xauth when it is called from pam_xauth
295                           [added to the default of /usr/X11R6/bin/xauth, /usr/bin/xauth, /usr/bin/X11/xauth]],
296 pam_xauth_path=${withval})
297 if test x$with_xauth == x ; then
298         AC_PATH_PROG(pam_xauth_path, xauth)
299 dnl There is no sense in adding the first default path
300         if test x$pam_xauth_path == x/usr/X11R6/bin/xauth ; then
301                 unset pam_xauth_path
302         fi
303 fi
304
305 if test x$pam_xauth_path != x ; then
306         AC_DEFINE_UNQUOTED(PAM_PATH_XAUTH, "$pam_xauth_path",
307         [Additional path of xauth executable])
308 fi
309
310 dnl Checks for the existence of libdl - on BSD and Tru64 its part of libc
311 AC_CHECK_LIB([dl], [dlopen], LIBDL="-ldl", LIBDL="")
312 AC_SUBST(LIBDL)
313
314 AC_CHECK_LIB([crack], [FascistCheck], LIBCRACK="-lcrack", LIBCRACK="")
315 AC_SUBST(LIBCRACK)
316 AM_CONDITIONAL([HAVE_LIBCRACK], [test ! -z "$LIBCRACK"])
317
318 dnl Look for Linux Auditing library - see documentation
319 AC_CHECK_HEADER([libaudit.h],
320   [AC_CHECK_LIB(audit, audit_log_user_message, LIBAUDIT=-laudit, LIBAUDIT="")]
321 )
322 AC_SUBST(LIBAUDIT)
323 if test ! -z "$LIBAUDIT" -a "ac_cv_header_libaudit_h" != "no" ; then
324     AC_DEFINE([HAVE_LIBAUDIT], 1, [Defined if audit support should be compiled in])
325 fi
326
327 BACKUP_LIBS=$LIBS
328 AC_SEARCH_LIBS([crypt],[xcrypt crypt], LIBCRYPT="-l$ac_lib", LIBCRYPT="")
329 LIBS=$BACKUP_LIBS
330 AC_SUBST(LIBCRYPT)
331
332 dnl check for libdb or libndbm as fallback. Some libndbm compat
333 dnl libraries are unuseable, so try libdb first.
334 AC_CHECK_LIB([db], [db_create], LIBDB="-ldb", LIBDB="")
335 if test -z "$LIBDB" ; then
336     AC_CHECK_LIB([db], [dbm_store], LIBDB="-ldb", LIBDB="")
337 fi
338 if test -z "$LIBDB" ; then
339     AC_CHECK_LIB([ndbm],[dbm_store], LIBDB="-lndbm", LIBDB="")
340     if test ! -z "$LIBDB" ; then
341         AC_CHECK_HEADERS(ndbm.h)
342     fi
343 else
344     AC_CHECK_HEADERS(db.h)
345 fi
346 AC_SUBST(LIBDB)
347 AM_CONDITIONAL([HAVE_LIBDB], [test ! -z "$LIBDB"])
348
349 AC_CHECK_LIB([nsl],[yp_get_default_domain], LIBNSL="-lnsl", LIBNSL="")
350 LIBS="$LIBS $LIBNSL"
351 AC_CHECK_FUNCS(yp_get_default_domain)
352 LIBS=$BACKUP_LIBS
353 AC_SUBST(LIBNSL)
354
355 AC_CHECK_LIB([selinux],[getfilecon], LIBSELINUX="-lselinux", LIBSELINUX="")
356 AC_SUBST(LIBSELINUX)
357 AM_CONDITIONAL([HAVE_LIBSELINUX], [test ! -z "$LIBSELINUX"])
358 if test ! -z "$LIBSELINUX" ; then
359     AC_DEFINE([WITH_SELINUX], 1, [Defined if SE Linux support is compiled in])
360 fi
361
362 dnl Checks for header files.
363 AC_HEADER_DIRENT
364 AC_HEADER_STDC
365 AC_HEADER_SYS_WAIT
366 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)
367
368 AC_CHECK_HEADERS(crypt.h)
369 AC_CHECK_HEADERS(crack.h)
370
371 dnl For module/pam_lastlog
372 AC_CHECK_HEADERS(lastlog.h utmp.h utmpx.h)
373
374 dnl Checks for typedefs, structures, and compiler characteristics.
375 AC_C_BIGENDIAN
376 AC_C_CONST
377 AC_TYPE_UID_T
378 AC_TYPE_OFF_T
379 AC_TYPE_PID_T
380 AC_TYPE_SIZE_T
381 AC_HEADER_TIME
382 AC_STRUCT_TM
383
384 dnl Checks for library functions.
385 AC_TYPE_GETGROUPS
386 AC_PROG_GCC_TRADITIONAL
387 AC_FUNC_MEMCMP
388 AC_FUNC_VPRINTF
389 AC_CHECK_FUNCS(fseeko gethostname gettimeofday lckpwdf mkdir select)
390 AC_CHECK_FUNCS(strcspn strdup strspn strstr strtol uname)
391 AC_CHECK_FUNCS(getpwnam_r getpwuid_r getgrnam_r getgrgid_r getspnam_r)
392 AC_CHECK_FUNCS(getgrouplist getline getdelim)
393 AC_CHECK_FUNCS(inet_ntop inet_pton)
394 AC_CHECK_FUNCS(unshare, [UNSHARE=yes], [UNSHARE=no])
395 AM_CONDITIONAL([HAVE_UNSHARE], [test "$UNSHARE" = yes])
396
397 dnl Checks for programs/utilities
398 AC_CHECK_PROG(SGML2PS, sgml2ps, yes, no)
399 AC_CHECK_PROG(SGML2TXT, sgml2txt, yes, no)
400 AC_CHECK_PROG(SGML2HTML, sgml2html, yes, no)
401 AC_CHECK_PROG(SGML2LATEX, sgml2latex, yes, no)
402 AC_CHECK_PROG(PS2PDF, ps2pdf, yes, no)
403 AM_CONDITIONAL([HAVE_SGML2PS], [test "$SGML2PS" = yes || test "$SGML2LATEX" = yes])
404 AM_CONDITIONAL([HAVE_SGML2TXT], [test "$SGML2TXT" = yes])
405 AM_CONDITIONAL([HAVE_SGML2HTML], [test "$SGML2HTML" = yes])
406 AM_CONDITIONAL([HAVE_PS2PDF], [test "$PS2PDF" = yes])
407 if test $SGML2LATEX = "yes" ; then
408   if sgml2latex -h | grep -e --paper | grep  ' -p ' > /dev/null ; then
409     PSER="sgml2latex -o ps"
410   else
411     PSER="sgml2latex -p"
412   fi
413 else
414   if test $SGML2PS = yes ; then
415     PSER="sgml2ps"
416   fi
417 fi
418 AC_SUBST(PSER)
419
420 dnl
421 dnl Check for xsltproc
422 dnl
423 enable_man=yes
424 AC_PATH_PROG([XSLTPROC], [xsltproc])
425 if test -z "$XSLTPROC"; then
426      enable_man=no
427 fi
428 AC_PATH_PROG([XMLLINT], [xmllint],[/bin/true])
429 dnl check for DocBook DTD and stylesheets in the local catalog.
430 JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.4//EN],
431                 [DocBook XML DTD V4.4], [], enable_man=no)
432 JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
433                 [DocBook XSL Stylesheets], [], enable_man=no)
434
435 AC_PATH_PROG([BROWSER], [w3m])
436 if test ! -z "$BROWSER"; then
437      BROWSER="$BROWSER -T text/html -dump"
438 else
439      enable_man=no
440 fi
441
442 AM_CONDITIONAL(ENABLE_REGENERATE_MAN, test x$enable_man != xno)
443
444
445 AM_GNU_GETTEXT_VERSION
446 AM_GNU_GETTEXT([external])
447 AC_CHECK_FUNCS(dngettext)
448
449 AH_VERBATIM([_ZZENABLE_NLS],
450 [#ifdef ENABLE_NLS
451 #include <libintl.h>
452 #define _(msgid) dgettext(PACKAGE, msgid)
453 #define N_(msgid) msgid
454 #else
455 #define _(msgid) (msgid)
456 #define N_(msgid) msgid
457 #endif /* ENABLE_NLS */])
458
459 dnl
460 dnl Check for the availability of the kernel key management facility
461 dnl - The pam_keyinit module only requires the syscalls, not the error codes
462 dnl
463 have_key_syscalls=0
464 AC_CHECK_DECL(__NR_keyctl, [have_key_syscalls=1],,[#include <sys/syscall.h>])
465 have_key_errors=0
466 AC_CHECK_DECL(ENOKEY, [have_key_errors=1])
467
468 HAVE_KEY_MANAGEMENT=0
469 if test $have_key_syscalls$have_key_errors = 11
470 then
471         HAVE_KEY_MANAGEMENT=1
472 fi
473
474 if test $HAVE_KEY_MANAGEMENT = 1; then
475    AC_DEFINE([HAVE_KEY_MANAGEMENT], 1,
476              [Defined if the kernel key management facility is available])
477 fi
478 AC_SUBST([HAVE_KEY_MANAGEMENT], $HAVE_KEY_MANAGEMENT)
479
480 AM_CONDITIONAL([HAVE_KEY_MANAGEMENT], [test ! -z "$have_key_syscalls"])
481
482 dnl Files to be created from when we run configure
483 AC_OUTPUT(Makefile libpam/Makefile libpamc/Makefile libpamc/test/Makefile \
484         libpam_misc/Makefile conf/Makefile conf/pam_conv1/Makefile \
485         po/Makefile.in \
486         modules/Makefile \
487         modules/pam_access/Makefile modules/pam_cracklib/Makefile \
488         modules/pam_debug/Makefile modules/pam_deny/Makefile \
489         modules/pam_echo/Makefile modules/pam_env/Makefile \
490         modules/pam_filter/Makefile modules/pam_filter/upperLOWER/Makefile \
491         modules/pam_ftp/Makefile modules/pam_group/Makefile \
492         modules/pam_issue/Makefile \
493         modules/pam_keyinit/Makefile modules/pam_lastlog/Makefile \
494         modules/pam_limits/Makefile modules/pam_listfile/Makefile \
495         modules/pam_localuser/Makefile modules/pam_mail/Makefile \
496         modules/pam_mkhomedir/Makefile modules/pam_motd/Makefile \
497         modules/pam_namespace/Makefile \
498         modules/pam_nologin/Makefile modules/pam_permit/Makefile \
499         modules/pam_rhosts/Makefile \
500         modules/pam_rootok/Makefile modules/pam_exec/Makefile \
501         modules/pam_securetty/Makefile modules/pam_selinux/Makefile \
502         modules/pam_shells/Makefile modules/pam_stress/Makefile \
503         modules/pam_succeed_if/Makefile modules/pam_tally/Makefile \
504         modules/pam_time/Makefile modules/pam_umask/Makefile \
505         modules/pam_unix/Makefile modules/pam_userdb/Makefile \
506         modules/pam_warn/Makefile modules/pam_wheel/Makefile \
507         modules/pam_xauth/Makefile doc/Makefile doc/specs/Makefile \
508         doc/man/Makefile examples/Makefile tests/Makefile)