login.so: OpenBSD fixes.
[userinfo.git] / configure.ac
blob07e84b74941f67c961f5ab9b708b1f9bfd28163b
1 dnl Process this file with autoconf to produce a configure script.
2 AC_PREREQ(2.60)
3 AC_INIT(userinfo, 2.3, [Ben Kibbey bjk@luxsci.net])
4 AC_CONFIG_MACRO_DIR([m4])
5 AC_CONFIG_AUX_DIR(build)
6 AC_CANONICAL_TARGET
7 AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip])
8 AC_LIBTOOL_DLOPEN
9 AC_DISABLE_STATIC
10 AC_PROG_LIBTOOL
11 AM_CONFIG_HEADER([config.h])
12 AC_CONFIG_SRCDIR([src/ui.c])
14 LIBTOOL="$LIBTOOL --silent"
16 dnl Checks for programs.
17 AC_PROG_CC
18 AC_PROG_CPP
19 AC_PROG_INSTALL
20 AC_PROG_AWK
21 AC_PROG_LN_S
22 AC_PROG_MAKE_SET
24 dnl Checks for header files.
25 AC_HEADER_DIRENT
26 AC_HEADER_STDC
27 AC_CHECK_HEADERS([fcntl.h limits.h paths.h stdlib.h string.h sys/param.h \
28                   unistd.h libgen.h err.h shadow.h lastlog.h err.h \
29                   sys/mman.h getopt.h utmp.h utmpx.h])
31 dnl Checks for typedefs, structures, and compiler characteristics.
32 AC_C_CONST
33 AC_TYPE_UID_T
34 AC_TYPE_SIZE_T
35 AC_TYPE_PID_T
36 AC_STRUCT_TM
38 dnl Checks for library functions.
39 AC_FUNC_GETGROUPS
40 AC_FUNC_LSTAT
41 AC_FUNC_MALLOC
42 AC_FUNC_STAT
43 AC_FUNC_STRFTIME
44 AC_FUNC_MMAP
45 AC_CHECK_FUNCS([memset getspnam munmap setpassent setgroupent strchr strdup \
46                 strerror strsep getgrent setutxent])
47 AC_CHECK_FUNC([__progname])
49 # Test for struct passwd members.
50 AC_MSG_CHECKING([for pw_change member in struct passwd])
51 AC_TRY_COMPILE([#include <pwd.h>],
52                          [struct passwd pwd;
53                          (void)pwd.pw_change;], have_passwd_change=yes)
54 if test x"$have_passwd_change" = "xyes"; then
55          AC_MSG_RESULT([yes])
56          AC_DEFINE(HAVE_PASSWD_CHANGE, 1, [Define if struct passwd contains pw_change.])
57 else
58          AC_MSG_RESULT([no])
61 AC_MSG_CHECKING([for pw_expire member in struct passwd])
62 AC_TRY_COMPILE([#include <pwd.h>],
63                          [struct passwd pwd;
64                          (void)pwd.pw_expire;], [have_passwd_expire=yes])
65 if test x"$have_passwd_expire" = "xyes"; then
66          AC_MSG_RESULT([yes])
67          AC_DEFINE(HAVE_PASSWD_EXPIRE, 1, [Define if struct passwd contains pw_expire.])
68 else
69          AC_MSG_RESULT([no])
72 AC_MSG_CHECKING([for pw_gecos member in struct passwd])
73 AC_TRY_COMPILE([#include <pwd.h>],
74                          [struct passwd pwd;
75                          (void)pwd.pw_gecos;], [have_passwd_gecos=yes])
76 if test x"$have_passwd_gecos" = "xyes"; then
77          AC_MSG_RESULT([yes])
78          AC_DEFINE(HAVE_PASSWD_GECOS, 1, [Define if struct passwd contains pw_gecos.])
79 else
80          AC_MSG_RESULT([no])
83 dnl /proc filesystem support
84 AC_MSG_CHECKING(for /proc filesystem)
86 if test -e /proc/self -o -e /proc/curproc; then
87     AC_MSG_RESULT(yes)
88     HAVE_PROCFS=1
89     AC_DEFINE(HAVE_PROCFS, 1, [Define if you have a /proc file system.])
90 else
91     AC_MSG_RESULT(no)
94 AM_CONDITIONAL(SOLARIS, false)
95 AM_CONDITIONAL(KVM, false)
97 case "$target_os" in
98     *bsd*) 
99         AC_CHECK_HEADERS(kvm.h, AC_DEFINE([BSD_KVM], 1, [Define for BSD KVM.]))
100         AC_CHECK_LIB(kvm, kvm_openfiles, AM_CONDITIONAL(KVM, true))
101         ;;
102     *linux*) 
103         if test ! $HAVE_PROCFS; then
104             AC_MSG_WARN(no /proc filesystem found. PPID info will be unavailable)
105         fi
106         ;;
107     *solaris*)
108         AM_CONDITIONAL(SOLARIS, true)
109         ;;
110     *)
111         ;;
112 esac
114 AC_SUBST(DLOPEN_LIBS, $lt_cv_dlopen_libs)
116 dnl default alias file
117 alias_file="/etc/aliases"
119 AC_ARG_WITH(aliases,
120 [  --with-aliases=FILE     location of mail aliases file (/etc/aliases)],
121 alias_file="$withval")
123 AC_MSG_CHECKING(for mail aliases file)
124 if test -f $alias_file; then
125     AC_MSG_RESULT($alias_file)
126 else
127     AC_MSG_RESULT([$alias_file not found (using it anyway)])
130 AC_DEFUN([AC_DEBUG],
132     if test "$1"; then
133         ac_cv_sys_debug=$1
134     fi
136     AC_CACHE_CHECK([if debugging is wanted], [ac_cv_sys_debug],
137         [ac_cv_sys_debug=no])
139     if test "$ac_cv_sys_debug" = "yes"; then
140         CPPFLAGS="$CPPFLAGS -DDEBUG"
141     fi
144 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Enable debugging.]),
145     AC_DEBUG([$enableval]), AC_DEBUG)
147 AC_DEFINE_UNQUOTED([ALIAS_FILE], "$alias_file", [Location of your mail alias file.])
148 AC_DEFINE([DEFAULT_DELIMINATING_CHAR], ':', [Default field deliminator.])
149 AC_DEFINE_UNQUOTED([DEFAULT_MULTI_CHAR], [','], [Default multi-string value deliminator.])
150 AC_DEFINE([DEFAULT_TIMEFORMAT], "%s", [Default strftime() time format.])
152 AM_WITH_DMALLOC
154 AC_CONFIG_FILES([Makefile src/Makefile src/modules/Makefile doc/Makefile contrib/Makefile])
155 AC_OUTPUT