Load module symbols immediately (RTLD_NOW).
[userinfo.git] / configure.ac
blob2a34b55e03e5988146600cc2e63f422836368128
1 dnl $Id: configure.ac,v 2.2 2005-07-30 12:57:04 bjk Exp $
2 dnl
3 dnl Process this file with autoconf to produce a configure script.
4 AC_PREREQ(2.59)
5 AC_INIT(userinfo, 2.2, [Ben Kibbey <bjk@luxsci.net>])
6 AC_CONFIG_AUX_DIR(build)
7 AC_CANONICAL_TARGET
8 AM_INIT_AUTOMAKE([foreign])
9 AC_PROG_MAKE_SET
10 AC_LIBTOOL_DLOPEN
11 AC_DISABLE_STATIC
12 AC_PROG_LIBTOOL
13 AM_CONFIG_HEADER([config.h])
14 AC_CONFIG_SRCDIR([src/ui.c])
16 LIBTOOL="$LIBTOOL --silent"
18 dnl Checks for programs.
19 AC_PROG_CC
20 AC_PROG_INSTALL
22 dnl Checks for header files.
23 AC_HEADER_DIRENT
24 AC_HEADER_STDC
25 AC_CHECK_HEADERS([fcntl.h limits.h paths.h stdlib.h string.h sys/param.h \
26                   unistd.h sys/syslimits.h libgen.h err.h shadow.h \
27                   lastlog.h err.h sys/mman.h getopt.h])
29 dnl Some systems have utmpx.h but don't utilize it (they use the older utmp
30 dnl format).
31 AC_CHECK_HEADER([utmpx.h], [have_utmpx=1], [have_utmpx=0])
33 if test $have_utmpx = 1; then
34     AC_MSG_CHECKING([how utmp is utilized])
35     AC_RUN_IFELSE([\
36                 #include <stdio.h>
37                 #include <utmpx.h>
39                 int main()
40                 {
41                     struct utmpx *u; 
43                     if ((u = getutxent()) == NULL)
44                         exit(1);
46                     exit(0);
47                 }
48                 ], [utmpx_works=1], [utmpx_works=0])
49     
50     if test $utmpx_works = 1; then
51         AC_MSG_RESULT([utmpx])
52         AC_DEFINE([UTMPX_FORMAT], 1, [Define if your system USES utmpx.])
53     else
54         AC_MSG_RESULT([utmp])
55     fi
58 dnl Checks for typedefs, structures, and compiler characteristics.
59 AC_C_CONST
60 AC_TYPE_UID_T
61 AC_TYPE_SIZE_T
62 AC_TYPE_PID_T
63 AC_STRUCT_TM
65 dnl Checks for library functions.
66 AC_FUNC_GETGROUPS
67 AC_FUNC_LSTAT
68 AC_FUNC_MALLOC
69 AC_FUNC_STAT
70 AC_FUNC_STRFTIME
71 AC_FUNC_MMAP
72 AC_CHECK_FUNCS([memset getspnam munmap setpassent setgroupent strchr strdup \
73                 strerror strsep])
74 AC_CHECK_FUNC([__progname])
76 dnl /proc filesystem support
77 AC_MSG_CHECKING(for /proc filesystem)
79 if test -e /proc/self -o -e /proc/curproc; then
80     AC_MSG_RESULT(yes)
81     HAVE_PROCFS=1
82     AC_DEFINE(HAVE_PROCFS, 1, [Define if you have a /proc file system.])
83 else
84     AC_MSG_RESULT(no)
87 AM_CONDITIONAL(SOLARIS, false)
88 AM_CONDITIONAL(KVM, false)
90 case "$target_os" in
91     *bsd*) 
92         AC_CHECK_HEADERS(kvm.h, AC_DEFINE([BSD_KVM], 1, [Define for BSD KVM.]))
93         AC_CHECK_LIB(kvm, kvm_openfiles, AM_CONDITIONAL(KVM, true))
94         ;;
95     *linux*) 
96         if test ! $HAVE_PROCFS; then
97             AC_MSG_WARN(no /proc filesystem found. PPID info will be unavailable)
98         fi
99         ;;
100     *solaris*)
101         AM_CONDITIONAL(SOLARIS, true)
102         ;;
103     *)
104         ;;
105 esac
107 AC_SUBST(DLOPEN_LIBS, $lt_cv_dlopen_libs)
109 dnl default alias file
110 alias_file="/etc/aliases"
112 AC_ARG_WITH(aliases,
113 [  --with-aliases=FILE     location of mail aliases file (/etc/aliases)],
114 alias_file="$withval")
116 AC_MSG_CHECKING(for mail aliases file)
117 if test -f $alias_file; then
118     AC_MSG_RESULT($alias_file)
119 else
120     AC_MSG_RESULT([$alias_file not found (using it anyway)])
123 AC_DEFUN([AC_DEBUG],
125     if test "$1"; then
126         ac_cv_sys_debug=$1
127     fi
129     AC_CACHE_CHECK([if debugging is wanted], [ac_cv_sys_debug],
130         [ac_cv_sys_debug=no])
132     if test "$ac_cv_sys_debug" = "yes"; then
133         CPPFLAGS="$CPPFLAGS -DDEBUG"
134     fi
137 AC_ARG_ENABLE(debug, AC_HELP_STRING([--enable-debug], [Enable debugging.]),
138     AC_DEBUG([$enableval]), AC_DEBUG)
140 AC_DEFINE_UNQUOTED([ALIAS_FILE], "$alias_file", [Location of your mail alias file.])
141 AC_DEFINE([DEFAULT_DELIMINATING_CHAR], ':', [Default field deliminator.])
142 AC_DEFINE_UNQUOTED([DEFAULT_MULTI_CHAR], [','], [Default multi-string value deliminator.])
143 AC_DEFINE([DEFAULT_TIMEFORMAT], "%s", [Default strftime() time format.])
145 AM_WITH_DMALLOC
147 AC_CONFIG_FILES([Makefile src/Makefile src/modules/Makefile doc/Makefile contrib/Makefile])
148 AC_OUTPUT