configure.ac revision 185573
1#                                               -*- Autoconf -*-
2# Process this file with autoconf to produce a configure script.
3
4AC_PREREQ(2.59)
5AC_INIT([OpenBSM], [1.1alpha2], [trustedbsd-audit@TrustesdBSD.org],[openbsm])
6AC_REVISION([$P4: //depot/projects/trustedbsd/openbsm/configure.ac#42 $])
7AC_CONFIG_SRCDIR([bin/auditreduce/auditreduce.c])
8AC_CONFIG_AUX_DIR(config)
9AC_CONFIG_HEADER([config/config.h])
10AM_MAINTAINER_MODE
11
12# --with-native-includes forces the use of the system bsm headers.
13AC_ARG_WITH([native-includes],
14[AS_HELP_STRING([--with-native-includes],
15[Use the system native include files instead of those included with openbsm.])],
16[
17AC_DEFINE(USE_NATIVE_INCLUDES,, Define to use native include files)
18use_native_includes=true
19],
20[use_native_includes=false])
21AM_CONDITIONAL(USE_NATIVE_INCLUDES, $use_native_includes)
22
23AC_PATH_PROGS(MIG, mig)
24
25# Checks for programs.
26AC_PROG_CC
27AC_PROG_INSTALL
28AC_PROG_LIBTOOL
29
30AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
31
32AC_SEARCH_LIBS(dlsym, dl)
33AC_SEARCH_LIBS(clock_gettime, rt)
34
35# Checks for header files.
36AC_HEADER_STDC
37AC_HEADER_SYS_WAIT
38AC_CHECK_HEADERS([endian.h mach/mach.h machine/endian.h sys/endian.h])
39
40# Checks for typedefs, structures, and compiler characteristics.
41AC_C_CONST
42AC_TYPE_UID_T
43AC_TYPE_PID_T
44AC_TYPE_SIZE_T
45AC_CHECK_MEMBERS([struct stat.st_rdev])
46
47AC_CHECK_MEMBER([struct ipc_perm.__key],
48[AC_DEFINE(HAVE_IPC_PERM___KEY,, Define if ipc_perm.__key instead of key)],
49[],[
50#include <sys/types.h>
51#include <sys/ipc.h>
52])
53
54AC_CHECK_MEMBER([struct ipc_perm._key],
55[AC_DEFINE(HAVE_IPC_PERM__KEY,, Define if ipc_perm._key instead of key)],
56[],[
57#include <sys/types.h>
58#include <sys/ipc.h>
59])
60
61AC_CHECK_MEMBER([struct ipc_perm.__seq],
62[AC_DEFINE(HAVE_IPC_PERM___SEQ,, Define if ipc_perm.__seq instead of seq)],
63[],[
64#include <sys/types.h>
65#include <sys/ipc.h>
66])
67
68AC_CHECK_MEMBER([struct ipc_perm._seq],
69[AC_DEFINE(HAVE_IPC_PERM__SEQ,, Define if ipc_perm._seq instead of seq)],
70[],[
71#include <sys/types.h>
72#include <sys/ipc.h>
73])
74
75AC_HEADER_TIME
76AC_STRUCT_TM
77
78# Checks for library functions.
79AC_FUNC_CHOWN
80AC_FUNC_FORK
81AC_FUNC_MALLOC
82AC_FUNC_MKTIME
83AC_TYPE_SIGNAL
84AC_FUNC_STAT
85AC_FUNC_STRFTIME
86AC_CHECK_FUNCS([bzero clock_gettime ftruncate gettimeofday inet_ntoa memset strchr strerror strlcat strlcpy strrchr strstr strtol strtoul])
87
88# sys/queue.h exists on most systems, but its capabilities vary a great deal.
89# test for LIST_FIRST and TAILQ_FOREACH_SAFE, which appears to not exist in
90# all of them, and are necessary for OpenBSM.
91AC_TRY_LINK([
92	#include <sys/queue.h>
93], [
94
95	#ifndef LIST_FIRST
96	#error LIST_FIRST missing
97	#endif
98	#ifndef TAILQ_FOREACH_SAFE
99	#error TAILQ_FOREACH_SAFE
100	#endif
101], [
102AC_DEFINE(HAVE_FULL_QUEUE_H,, Define if queue.h includes LIST_FIRST)
103])
104
105# Systems may not define key audit system calls, in which case libbsm cannot
106# depend on them or it will generate link-time or run-time errors.  Test for
107# just one.
108AC_TRY_LINK([
109	#include <stdlib.h>
110
111	extern int auditon(int, void *, int);
112], [
113	int err;
114
115	err = auditon(0, NULL, 0);
116], [
117AC_DEFINE(HAVE_AUDIT_SYSCALLS,, Define if audit system calls present)
118have_audit_syscalls=true
119], [
120have_audit_syscalls=false
121])
122AM_CONDITIONAL(HAVE_AUDIT_SYSCALLS, $have_audit_syscalls)
123
124# Check to see if Mach IPC is used for trigger messages.  If so, use Mach IPC
125# instead of the default for sending trigger messages to the audit components.
126AC_CHECK_FILE([/usr/include/mach/audit_triggers.defs], [
127AC_DEFINE(USE_MACH_IPC,, Define if uses Mach IPC for Triggers messages)
128use_mach_ipc=true
129], [
130use_mach_ipc=false
131])
132AM_CONDITIONAL(USE_MACH_IPC, $use_mach_ipc)
133
134AC_CONFIG_FILES([Makefile
135                 bin/Makefile
136                 bin/audit/Makefile
137                 bin/auditd/Makefile
138                 bin/auditfilterd/Makefile
139                 bin/auditreduce/Makefile
140                 bin/praudit/Makefile
141                 bsm/Makefile
142                 libbsm/Makefile
143                 modules/Makefile
144                 modules/auditfilter_noop/Makefile
145                 man/Makefile
146                 sys/Makefile
147                 sys/bsm/Makefile
148                 test/Makefile
149                 test/bsm/Makefile
150                 tools/Makefile])
151
152AC_OUTPUT
153