1 dnl Process this file with autoconf to produce a configure script.
3 AC_CONFIG_SRCDIR([conf/pam_conv1/pam_conv_y.y])
4 AM_INIT_AUTOMAKE("Linux-PAM", 1.1.2)
6 AC_CONFIG_HEADERS([config.h])
7 AC_CONFIG_MACRO_DIR([m4])
14 dnl By default, everything under PAM is installed below /usr.
16 AC_PREFIX_DEFAULT(/usr)
18 dnl and some hacks to use /etc and /lib
19 test "${prefix}" = "NONE" && prefix="/usr"
20 if test ${prefix} = '/usr'
22 dnl If we use /usr as prefix, use /etc for config files
23 if test ${sysconfdir} = '${prefix}/etc'
27 if test ${libdir} = '${exec_prefix}/lib'
30 x86_64|ppc64|s390x|sparc64)
36 if test ${sbindir} = '${exec_prefix}/sbin'
40 dnl If we use /usr as prefix, use /usr/share/man for manual pages
41 if test ${mandir} = '${prefix}/man'
43 mandir='${prefix}/share/man'
45 dnl Add security to include directory
46 if test ${includedir} = '${prefix}/include'
48 includedir="${prefix}/include/security"
51 dnl Add /var directory
52 if test ${localstatedir} = '${prefix}/var'
60 dnl check if we should link everything static into libpam
62 AC_ARG_ENABLE(static-modules,AS_HELP_STRING([--enable-static-modules],
63 [do not make the modules dynamically loadable]),
64 STATIC_MODULES=$enableval,STATIC_MODULES=no)
65 if test "$STATIC_MODULES" != "no" ; then
66 CFLAGS="$CFLAGS -DPAM_STATIC"
67 AC_ENABLE_STATIC([yes])
68 AC_ENABLE_SHARED([no])
70 # per default don't build static libraries
71 AC_ENABLE_STATIC([no])
72 AC_ENABLE_SHARED([yes])
74 AM_CONDITIONAL([STATIC_MODULES], [test "$STATIC_MODULES" != "no"])
76 dnl Checks for programs.
77 AC_USE_SYSTEM_EXTENSIONS
93 dnl icc claims to be GCC compatible, but use other flags for warnings
94 if eval "test x$GCC = xyes -a $CC != icc"; then
101 -Wmissing-declarations \
102 -Wmissing-prototypes \
105 -Wstrict-prototypes \
110 JAPHAR_GREP_CFLAGS($flag, [ CFLAGS="$CFLAGS $flag" ])
113 dnl icc has special warning flags
114 if eval "test x$CC = xicc"; then
117 -Wmissing-prototypes \
120 -Wstrict-prototypes \
128 JAPHAR_GREP_CFLAGS($flag, [ CFLAGS="$CFLAGS $flag" ])
132 if test "x${CC_FOR_BUILD+set}" != "xset" ; then
133 if test "x$cross_compiling" = "xyes" ; then
134 AC_CHECK_PROGS(CC_FOR_BUILD, gcc cc)
139 AC_MSG_CHECKING([for CC_FOR_BUILD])
140 AC_MSG_RESULT([$CC_FOR_BUILD])
141 AC_SUBST(CC_FOR_BUILD)
143 if test "x${BUILD_CFLAGS+set}" != "xset" ; then
144 if test "x$cross_compiling" = "xyes" ; then
147 BUILD_CFLAGS=${CFLAGS}
150 AC_SUBST(BUILD_CFLAGS)
152 if test "x${BUILD_LDFLAGS+set}" != "xset" ; then
153 if test "x$cross_compiling" = "xyes" ; then
156 BUILD_LDFLAGS=${LDFLAGS}
159 AC_SUBST(BUILD_LDFLAGS)
164 dnl Check if --version-script is supported by ld
166 AC_CACHE_CHECK(for .symver assembler directive, libc_cv_asm_symver_directive,
167 [cat > conftest.s <<EOF
170 .symver _sym,sym@VERS
172 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
173 libc_cv_asm_symver_directive=yes
175 libc_cv_asm_symver_directive=no
178 AC_CACHE_CHECK(for ld --version-script, libc_cv_ld_version_script_option, [dnl
179 if test $libc_cv_asm_symver_directive = yes; then
180 cat > conftest.s <<EOF
183 .symver _sym,sym@VERS
185 cat > conftest.map <<EOF
194 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD;
196 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $LDFLAGS -shared
197 -o conftest.so conftest.o
198 -nostartfiles -nostdlib
199 -Wl,--version-script,conftest.map
200 1>&AS_MESSAGE_LOG_FD]);
202 libc_cv_ld_version_script_option=yes
204 libc_cv_ld_version_script_option=no
207 libc_cv_ld_version_script_option=no
210 libc_cv_ld_version_script_option=no
213 AM_CONDITIONAL([HAVE_VERSIONING],
214 [test "$libc_cv_ld_version_script_option" = "yes"])
217 dnl check for -fPIE/-pie support
219 dnl icc handles -fpie as -fp without error, so blacklist icc
221 AC_ARG_ENABLE(pie,AS_HELP_STRING([--disable-pie],
222 [disable position-independent executeables (PIE)]),
223 USE_PIE=$enableval, USE_PIE=yes)
225 AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
226 cat > conftest.c <<EOF
230 if test "$USE_PIE" = "yes" -a "$CC" != "icc" &&
231 AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -pie -fpie
232 -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
243 AC_SUBST(libc_cv_fpie)
245 AC_SUBST(PIE_LDFLAGS)
249 dnl options and defaults
252 AC_ARG_ENABLE([prelude],
253 AS_HELP_STRING([--disable-prelude],[do not use prelude]),
254 WITH_PRELUDE=$enableval, WITH_PRELUDE=yes)
255 if test "$WITH_PRELUDE" == "yes" ; then
256 AM_PATH_LIBPRELUDE([0.9.0])
257 if test "$LIBPRELUDE_CONFIG" != "no" ; then
258 LIBPRELUDE_CFLAGS="$LIBPRELUDE_CFLAGS -DPRELUDE=1"
262 dnl lots of debugging information goes to /var/run/pam-debug.log
263 AC_ARG_ENABLE([debug],
264 AS_HELP_STRING([--enable-debug],[specify you are building with debugging on]))
266 if test x"$enable_debug" = x"yes" ; then
267 AC_DEFINE([PAM_DEBUG],,
268 [lots of stuff gets written to /var/run/pam-debug.log])
271 AC_ARG_ENABLE(securedir,
272 AS_HELP_STRING([--enable-securedir=DIR],[path to location of PAMs @<:@default=$libdir/security@:>@]),
273 SECUREDIR=$enableval, SECUREDIR=$libdir/security)
276 AC_ARG_ENABLE([isadir],
277 AS_HELP_STRING([--enable-isadir=DIR],[path to arch-specific module files @<:@default=../../(basename of $libdir)/security@:>@]),
279 ISA=../../`basename $libdir`/security)
281 AC_DEFINE_UNQUOTED(_PAM_ISA,"$ISA",[Define to the path, relative to SECUREDIR, where PAMs specific to this architecture can be found.])
282 AC_MSG_RESULT([Defining \$ISA to "$ISA"])
284 AC_ARG_ENABLE(sconfigdir,
285 AS_HELP_STRING([--enable-sconfigdir=DIR],[path to module conf files @<:@default=$sysconfdir/security@:>@]),
286 SCONFIGDIR=$enableval, SCONFIGDIR=$sysconfdir/security)
289 AC_ARG_ENABLE(pamlocking,
290 AS_HELP_STRING([--enable-pamlocking],[configure libpam to observe a global authentication lock]))
292 if test x"$enable_pamlocking" = "xyes"; then
293 AC_DEFINE([PAM_LOCKING],,
294 [libpam should observe a global authentication lock])
297 AC_ARG_ENABLE(read-both-confs,
298 AS_HELP_STRING([--enable-read-both-confs],[read both /etc/pam.d and /etc/pam.conf files]))
300 if test x"$enable_read_both_confs" = "xyes"; then
301 AC_DEFINE([PAM_READ_BOTH_CONFS],,
302 [read both /etc/pam.d and /etc/pam.conf files])
305 AC_ARG_ENABLE([lckpwdf],
306 AS_HELP_STRING([--disable-lckpwdf],[do not use the lckpwdf function]),
307 WITH_LCKPWDF=$enableval, WITH_LCKPWDF=yes)
308 if test "$WITH_LCKPWDF" == "yes" ; then
309 AC_DEFINE([USE_LCKPWDF], 1,
310 [Define to 1 if the lckpwdf function should be used])
313 AC_CHECK_HEADERS(paths.h)
314 AC_ARG_WITH(mailspool,
315 [ --with-mailspool path to mail spool directory
316 [default _PATH_MAILDIR if defined in paths.h, otherwise /var/spool/mail]],
317 with_mailspool=${withval})
318 if test x$with_mailspool != x ; then
319 pam_mail_spool="\"$with_mailspool\""
321 AC_RUN_IFELSE([AC_LANG_SOURCE([[
329 }]])],[pam_mail_spool="_PATH_MAILDIR"],[pam_mail_spool="\"/var/spool/mail\""],[pam_mail_spool="\"/var/spool/mail\""])
331 AC_DEFINE_UNQUOTED(PAM_PATH_MAILDIR, $pam_mail_spool,
332 [Path where mails are stored])
335 [ --with-xauth additional path to check for xauth when it is called from pam_xauth
336 [added to the default of /usr/X11R6/bin/xauth, /usr/bin/xauth, /usr/bin/X11/xauth]],
337 pam_xauth_path=${withval})
338 if test x$with_xauth == x ; then
339 AC_PATH_PROG(pam_xauth_path, xauth)
340 dnl There is no sense in adding the first default path
341 if test x$pam_xauth_path == x/usr/X11R6/bin/xauth ; then
346 if test x$pam_xauth_path != x ; then
347 AC_DEFINE_UNQUOTED(PAM_PATH_XAUTH, "$pam_xauth_path",
348 [Additional path of xauth executable])
351 dnl Checks for the existence of libdl - on BSD and Tru64 its part of libc
352 AC_CHECK_LIB([dl], [dlopen], LIBDL="-ldl", LIBDL="")
356 AC_ARG_ENABLE([cracklib],
357 AS_HELP_STRING([--disable-cracklib],[do not use cracklib]),
358 WITH_CRACKLIB=$enableval, WITH_CRACKLIB=yes)
359 if test x"$WITH_CRACKLIB" != xno ; then
360 AC_CHECK_HEADERS([crack.h],
361 AC_CHECK_LIB([crack], [FascistCheck], LIBCRACK="-lcrack", LIBCRACK=""))
366 AM_CONDITIONAL([HAVE_LIBCRACK], [test ! -z "$LIBCRACK"])
368 dnl Look for Linux Auditing library - see documentation
369 AC_ARG_ENABLE([audit],
370 AS_HELP_STRING([--disable-audit],[do not enable audit support]),
371 WITH_LIBAUDIT=$enableval, WITH_LIBAUDIT=yes)
372 if test x"$WITH_LIBAUDIT" != xno ; then
373 AC_CHECK_HEADER([libaudit.h],
374 [AC_CHECK_LIB(audit, audit_log_acct_message, LIBAUDIT=-laudit, LIBAUDIT="")
375 AC_CHECK_TYPE([struct audit_tty_status],
376 [HAVE_AUDIT_TTY_STATUS=yes],
377 [HAVE_AUDIT_TTY_STATUS=""],
378 [#include <libaudit.h>])]
380 if test ! -z "$LIBAUDIT" -a "$ac_cv_header_libaudit_h" != "no" ; then
381 AC_DEFINE([HAVE_LIBAUDIT], 1, [Define to 1 if audit support should be compiled in.])
383 if test ! -z "$HAVE_AUDIT_TTY_STATUS" ; then
384 AC_DEFINE([HAVE_AUDIT_TTY_STATUS], 1, [Define to 1 if struct audit_tty_status exists.])
390 AM_CONDITIONAL([HAVE_AUDIT_TTY_STATUS],
391 [test "x$HAVE_AUDIT_TTY_STATUS" = xyes])
393 AC_CHECK_HEADERS(xcrypt.h crypt.h)
394 AS_IF([test "x$ac_cv_header_xcrypt_h" = "xyes"],
395 [crypt_libs="xcrypt crypt"],
396 [crypt_libs="crypt"])
399 AC_SEARCH_LIBS([crypt],[$crypt_libs], LIBCRYPT="-l$ac_lib", LIBCRYPT="")
400 AC_CHECK_FUNCS(crypt_r crypt_gensalt_r)
403 if test "$LIBCRYPT" = "-lxcrypt" -a "$ac_cv_header_xcrypt_h" = "yes" ; then
404 AC_DEFINE([HAVE_LIBXCRYPT], 1, [Define to 1 if xcrypt support should be compiled in.])
407 AC_ARG_WITH([randomdev], AS_HELP_STRING([--with-randomdev=(<path>|yes|no)],[use specified random device instead of /dev/urandom or 'no' to disable]), opt_randomdev=$withval)
408 if test "$opt_randomdev" = yes -o -z "$opt_randomdev"; then
409 opt_randomdev="/dev/urandom"
410 elif test "$opt_randomdev" = no; then
413 if test -n "$opt_randomdev"; then
414 AC_DEFINE_UNQUOTED(PAM_PATH_RANDOMDEV, "$opt_randomdev", [Random device path.])
417 dnl check for libdb or libndbm as fallback. Some libndbm compat
418 dnl libraries are unuseable, so try libdb first.
420 AS_HELP_STRING([--enable-db=(db|ndbm|yes|no)],[Default behavior 'yes', which is to check for libdb first, followed by ndbm. Use 'no' to disable db support.]),
421 WITH_DB=$enableval, WITH_DB=yes)
422 AC_ARG_WITH([db-uniquename],
423 AS_HELP_STRING([--with-db-uniquename=extension],[Unique name for db libraries and functions.]))
424 if test x"$WITH_DB" != xno ; then
425 if test x"$WITH_DB" = xyes -o x"$WITH_DB" = xdb ; then
427 LIBS="$LIBS -ldb$with_db_uniquename"
428 AC_CHECK_FUNCS([db_create$with_db_uniquename db_create dbm_store$with_db_uniquename dbm_store],
429 [LIBDB="-ldb$with_db_uniquename"; break])
432 if test -z "$LIBDB" ; then
433 AC_CHECK_LIB([ndbm],[dbm_store], LIBDB="-lndbm", LIBDB="")
434 if test ! -z "$LIBDB" ; then
435 AC_CHECK_HEADERS(ndbm.h)
438 AC_CHECK_HEADERS(db.h)
442 AM_CONDITIONAL([HAVE_LIBDB], [test ! -z "$LIBDB"])
444 AC_CHECK_LIB([nsl],[yp_get_default_domain], LIBNSL="-lnsl", LIBNSL="")
447 AC_CHECK_FUNCS(yp_get_default_domain getdomainname innetgr yperr_string yp_master yp_bind yp_match yp_unbind)
451 AC_ARG_ENABLE([selinux],
452 AS_HELP_STRING([--disable-selinux],[do not use SELinux]),
453 WITH_SELINUX=$enableval, WITH_SELINUX=yes)
454 if test "$WITH_SELINUX" == "yes" ; then
455 AC_CHECK_LIB([selinux],[getfilecon], LIBSELINUX="-lselinux", LIBSELINUX="")
460 AM_CONDITIONAL([HAVE_LIBSELINUX], [test ! -z "$LIBSELINUX"])
461 if test ! -z "$LIBSELINUX" ; then
462 AC_DEFINE([WITH_SELINUX], 1, [Defined if SE Linux support is compiled in])
464 LIBS="$LIBS $LIBSELINUX"
465 AC_CHECK_FUNCS(setkeycreatecon)
466 AC_CHECK_FUNCS(getseuser)
470 dnl Checks for header files.
474 AC_CHECK_HEADERS(fcntl.h limits.h malloc.h sys/file.h sys/ioctl.h sys/time.h syslog.h net/if.h termio.h unistd.h sys/fsuid.h inittypes.h rpcsvc/ypclnt.h rpcsvc/yp_prot.h)
476 dnl For module/pam_lastlog
477 AC_CHECK_HEADERS(lastlog.h utmp.h utmpx.h)
479 dnl Checks for typedefs, structures, and compiler characteristics.
489 dnl Checks for library functions.
491 AC_PROG_GCC_TRADITIONAL
494 AC_CHECK_FUNCS(fseeko gethostname gettimeofday lckpwdf mkdir select)
495 AC_CHECK_FUNCS(strcspn strdup strspn strstr strtol uname)
496 AC_CHECK_FUNCS(getutent_r getpwnam_r getpwuid_r getgrnam_r getgrgid_r getspnam_r)
497 AC_CHECK_FUNCS(getgrouplist getline getdelim)
498 AC_CHECK_FUNCS(inet_ntop inet_pton ruserok_af)
500 AC_CHECK_FUNCS(unshare, [UNSHARE=yes], [UNSHARE=no])
501 AM_CONDITIONAL([HAVE_UNSHARE], [test "$UNSHARE" = yes])
503 AC_ARG_ENABLE([regenerate-docu],
504 AC_HELP_STRING([--disable-regenerate-docu], [Don't re-build documentation from XML souces]),
505 [enable_docu=$enableval], [enable_docu=yes])
507 dnl Check for xsltproc
509 AC_PATH_PROG([XSLTPROC], [xsltproc])
510 if test -z "$XSLTPROC"; then
513 AC_PATH_PROG([XMLLINT], [xmllint],[/bin/true])
514 dnl check for DocBook DTD and stylesheets in the local catalog.
515 JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.4//EN],
516 [DocBook XML DTD V4.4], [], enable_docu=no)
517 JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
518 [DocBook XSL Stylesheets], [], enable_docu=no)
520 AC_PATH_PROG([BROWSER], [w3m])
521 if test ! -z "$BROWSER"; then
522 BROWSER="$BROWSER -T text/html -dump"
527 AC_PATH_PROG([FO2PDF], [fop])
529 AM_CONDITIONAL(ENABLE_REGENERATE_MAN, test x$enable_docu != xno)
530 AM_CONDITIONAL(ENABLE_GENERATE_PDF, test ! -z "$FO2PDF")
533 AM_GNU_GETTEXT_VERSION([0.15])
534 AM_GNU_GETTEXT([external])
535 AC_CHECK_FUNCS(dngettext)
537 AH_BOTTOM([#ifdef ENABLE_NLS
539 #define _(msgid) dgettext(PACKAGE, msgid)
540 #define N_(msgid) msgid
542 #define _(msgid) (msgid)
543 #define N_(msgid) msgid
544 #endif /* ENABLE_NLS */])
547 dnl Check for the availability of the kernel key management facility
548 dnl - The pam_keyinit module only requires the syscalls, not the error codes
550 AC_CHECK_DECL(__NR_keyctl, [have_key_syscalls=1],[have_key_syscalls=0],[#include <sys/syscall.h>])
551 AC_CHECK_DECL(ENOKEY, [have_key_errors=1],[have_key_errors=0],[#include <errno.h>])
553 HAVE_KEY_MANAGEMENT=0
554 if test $have_key_syscalls$have_key_errors = 11
556 HAVE_KEY_MANAGEMENT=1
559 if test $HAVE_KEY_MANAGEMENT = 1; then
560 AC_DEFINE([HAVE_KEY_MANAGEMENT], 1,
561 [Defined if the kernel key management facility is available])
563 AC_SUBST([HAVE_KEY_MANAGEMENT], $HAVE_KEY_MANAGEMENT)
565 AM_CONDITIONAL([HAVE_KEY_MANAGEMENT], [test "$have_key_syscalls" = 1])
567 dnl Files to be created from when we run configure
568 AC_CONFIG_FILES([Makefile libpam/Makefile libpamc/Makefile libpamc/test/Makefile \
569 libpam_misc/Makefile conf/Makefile conf/pam_conv1/Makefile \
572 modules/pam_access/Makefile modules/pam_cracklib/Makefile \
573 modules/pam_debug/Makefile modules/pam_deny/Makefile \
574 modules/pam_echo/Makefile modules/pam_env/Makefile \
575 modules/pam_faildelay/Makefile \
576 modules/pam_filter/Makefile modules/pam_filter/upperLOWER/Makefile \
577 modules/pam_ftp/Makefile modules/pam_group/Makefile \
578 modules/pam_issue/Makefile modules/pam_keyinit/Makefile \
579 modules/pam_lastlog/Makefile modules/pam_limits/Makefile \
580 modules/pam_listfile/Makefile modules/pam_localuser/Makefile \
581 modules/pam_loginuid/Makefile modules/pam_mail/Makefile \
582 modules/pam_mkhomedir/Makefile modules/pam_motd/Makefile \
583 modules/pam_namespace/Makefile \
584 modules/pam_nologin/Makefile modules/pam_permit/Makefile \
585 modules/pam_pwhistory/Makefile modules/pam_rhosts/Makefile \
586 modules/pam_rootok/Makefile modules/pam_exec/Makefile \
587 modules/pam_securetty/Makefile modules/pam_selinux/Makefile \
588 modules/pam_sepermit/Makefile \
589 modules/pam_shells/Makefile modules/pam_stress/Makefile \
590 modules/pam_succeed_if/Makefile modules/pam_tally/Makefile \
591 modules/pam_tally2/Makefile modules/pam_time/Makefile \
592 modules/pam_timestamp/Makefile modules/pam_tty_audit/Makefile \
593 modules/pam_umask/Makefile \
594 modules/pam_unix/Makefile modules/pam_userdb/Makefile \
595 modules/pam_warn/Makefile modules/pam_wheel/Makefile \
596 modules/pam_xauth/Makefile doc/Makefile doc/specs/Makefile \
597 doc/man/Makefile doc/sag/Makefile doc/adg/Makefile \
598 doc/mwg/Makefile examples/Makefile tests/Makefile \