configure.ac revision 185573
1156283Srwatson#                                               -*- Autoconf -*-
2156283Srwatson# Process this file with autoconf to produce a configure script.
3156283Srwatson
4156283SrwatsonAC_PREREQ(2.59)
5185573SrwatsonAC_INIT([OpenBSM], [1.1alpha2], [trustedbsd-audit@TrustesdBSD.org],[openbsm])
6185573SrwatsonAC_REVISION([$P4: //depot/projects/trustedbsd/openbsm/configure.ac#42 $])
7156283SrwatsonAC_CONFIG_SRCDIR([bin/auditreduce/auditreduce.c])
8156283SrwatsonAC_CONFIG_AUX_DIR(config)
9156283SrwatsonAC_CONFIG_HEADER([config/config.h])
10156283SrwatsonAM_MAINTAINER_MODE
11156283Srwatson
12185573Srwatson# --with-native-includes forces the use of the system bsm headers.
13185573SrwatsonAC_ARG_WITH([native-includes],
14185573Srwatson[AS_HELP_STRING([--with-native-includes],
15185573Srwatson[Use the system native include files instead of those included with openbsm.])],
16185573Srwatson[
17185573SrwatsonAC_DEFINE(USE_NATIVE_INCLUDES,, Define to use native include files)
18185573Srwatsonuse_native_includes=true
19185573Srwatson],
20185573Srwatson[use_native_includes=false])
21185573SrwatsonAM_CONDITIONAL(USE_NATIVE_INCLUDES, $use_native_includes)
22185573Srwatson
23185573SrwatsonAC_PATH_PROGS(MIG, mig)
24185573Srwatson
25156283Srwatson# Checks for programs.
26156283SrwatsonAC_PROG_CC
27156283SrwatsonAC_PROG_INSTALL
28156283SrwatsonAC_PROG_LIBTOOL
29156283Srwatson
30156283SrwatsonAM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
31156283Srwatson
32159248SrwatsonAC_SEARCH_LIBS(dlsym, dl)
33159248SrwatsonAC_SEARCH_LIBS(clock_gettime, rt)
34156283Srwatson
35156283Srwatson# Checks for header files.
36156283SrwatsonAC_HEADER_STDC
37156283SrwatsonAC_HEADER_SYS_WAIT
38156283SrwatsonAC_CHECK_HEADERS([endian.h mach/mach.h machine/endian.h sys/endian.h])
39156283Srwatson
40156283Srwatson# Checks for typedefs, structures, and compiler characteristics.
41156283SrwatsonAC_C_CONST
42156283SrwatsonAC_TYPE_UID_T
43156283SrwatsonAC_TYPE_PID_T
44156283SrwatsonAC_TYPE_SIZE_T
45156283SrwatsonAC_CHECK_MEMBERS([struct stat.st_rdev])
46156283Srwatson
47156283SrwatsonAC_CHECK_MEMBER([struct ipc_perm.__key],
48156283Srwatson[AC_DEFINE(HAVE_IPC_PERM___KEY,, Define if ipc_perm.__key instead of key)],
49156283Srwatson[],[
50156283Srwatson#include <sys/types.h>
51156283Srwatson#include <sys/ipc.h>
52156283Srwatson])
53156283Srwatson
54185573SrwatsonAC_CHECK_MEMBER([struct ipc_perm._key],
55185573Srwatson[AC_DEFINE(HAVE_IPC_PERM__KEY,, Define if ipc_perm._key instead of key)],
56185573Srwatson[],[
57185573Srwatson#include <sys/types.h>
58185573Srwatson#include <sys/ipc.h>
59185573Srwatson])
60185573Srwatson
61156283SrwatsonAC_CHECK_MEMBER([struct ipc_perm.__seq],
62156283Srwatson[AC_DEFINE(HAVE_IPC_PERM___SEQ,, Define if ipc_perm.__seq instead of seq)],
63156283Srwatson[],[
64156283Srwatson#include <sys/types.h>
65156283Srwatson#include <sys/ipc.h>
66156283Srwatson])
67156283Srwatson
68185573SrwatsonAC_CHECK_MEMBER([struct ipc_perm._seq],
69185573Srwatson[AC_DEFINE(HAVE_IPC_PERM__SEQ,, Define if ipc_perm._seq instead of seq)],
70185573Srwatson[],[
71185573Srwatson#include <sys/types.h>
72185573Srwatson#include <sys/ipc.h>
73185573Srwatson])
74185573Srwatson
75156283SrwatsonAC_HEADER_TIME
76156283SrwatsonAC_STRUCT_TM
77156283Srwatson
78156283Srwatson# Checks for library functions.
79156283SrwatsonAC_FUNC_CHOWN
80156283SrwatsonAC_FUNC_FORK
81156283SrwatsonAC_FUNC_MALLOC
82156283SrwatsonAC_FUNC_MKTIME
83156283SrwatsonAC_TYPE_SIGNAL
84156283SrwatsonAC_FUNC_STAT
85156283SrwatsonAC_FUNC_STRFTIME
86185573SrwatsonAC_CHECK_FUNCS([bzero clock_gettime ftruncate gettimeofday inet_ntoa memset strchr strerror strlcat strlcpy strrchr strstr strtol strtoul])
87156283Srwatson
88156283Srwatson# sys/queue.h exists on most systems, but its capabilities vary a great deal.
89159985Srwatson# test for LIST_FIRST and TAILQ_FOREACH_SAFE, which appears to not exist in
90159985Srwatson# all of them, and are necessary for OpenBSM.
91156283SrwatsonAC_TRY_LINK([
92156283Srwatson	#include <sys/queue.h>
93156283Srwatson], [
94156283Srwatson
95159985Srwatson	#ifndef LIST_FIRST
96159985Srwatson	#error LIST_FIRST missing
97159985Srwatson	#endif
98159985Srwatson	#ifndef TAILQ_FOREACH_SAFE
99159985Srwatson	#error TAILQ_FOREACH_SAFE
100159985Srwatson	#endif
101156283Srwatson], [
102156283SrwatsonAC_DEFINE(HAVE_FULL_QUEUE_H,, Define if queue.h includes LIST_FIRST)
103156283Srwatson])
104156283Srwatson
105156283Srwatson# Systems may not define key audit system calls, in which case libbsm cannot
106156283Srwatson# depend on them or it will generate link-time or run-time errors.  Test for
107156283Srwatson# just one.
108156283SrwatsonAC_TRY_LINK([
109156283Srwatson	#include <stdlib.h>
110156283Srwatson
111156283Srwatson	extern int auditon(int, void *, int);
112156283Srwatson], [
113156283Srwatson	int err;
114156283Srwatson
115156283Srwatson	err = auditon(0, NULL, 0);
116156283Srwatson], [
117156283SrwatsonAC_DEFINE(HAVE_AUDIT_SYSCALLS,, Define if audit system calls present)
118156283Srwatsonhave_audit_syscalls=true
119156283Srwatson], [
120156283Srwatsonhave_audit_syscalls=false
121156283Srwatson])
122156283SrwatsonAM_CONDITIONAL(HAVE_AUDIT_SYSCALLS, $have_audit_syscalls)
123156283Srwatson
124185573Srwatson# Check to see if Mach IPC is used for trigger messages.  If so, use Mach IPC
125185573Srwatson# instead of the default for sending trigger messages to the audit components.
126185573SrwatsonAC_CHECK_FILE([/usr/include/mach/audit_triggers.defs], [
127185573SrwatsonAC_DEFINE(USE_MACH_IPC,, Define if uses Mach IPC for Triggers messages)
128185573Srwatsonuse_mach_ipc=true
129185573Srwatson], [
130185573Srwatsonuse_mach_ipc=false
131185573Srwatson])
132185573SrwatsonAM_CONDITIONAL(USE_MACH_IPC, $use_mach_ipc)
133185573Srwatson
134156283SrwatsonAC_CONFIG_FILES([Makefile
135156283Srwatson                 bin/Makefile
136156283Srwatson                 bin/audit/Makefile
137156283Srwatson                 bin/auditd/Makefile
138159248Srwatson                 bin/auditfilterd/Makefile
139156283Srwatson                 bin/auditreduce/Makefile
140156283Srwatson                 bin/praudit/Makefile
141156283Srwatson                 bsm/Makefile
142156283Srwatson                 libbsm/Makefile
143159248Srwatson                 modules/Makefile
144159248Srwatson                 modules/auditfilter_noop/Makefile
145156283Srwatson                 man/Makefile
146185573Srwatson                 sys/Makefile
147185573Srwatson                 sys/bsm/Makefile
148159248Srwatson                 test/Makefile
149159248Srwatson                 test/bsm/Makefile
150156283Srwatson                 tools/Makefile])
151156283Srwatson
152156283SrwatsonAC_OUTPUT
153