configure.ac revision 159248
1156283Srwatson#                                               -*- Autoconf -*-
2156283Srwatson# Process this file with autoconf to produce a configure script.
3156283Srwatson
4156283SrwatsonAC_PREREQ(2.59)
5159248SrwatsonAC_INIT([OpenBSM], [1.0a6], [trustedbsd-audit@TrustesdBSD.org],[openbsm])
6159248SrwatsonAC_REVISION([$P4: //depot/projects/trustedbsd/openbsm/configure.ac#22 $])
7156283SrwatsonAC_CONFIG_SRCDIR([bin/auditreduce/auditreduce.c])
8156283SrwatsonAC_CONFIG_AUX_DIR(config)
9156283SrwatsonAC_CONFIG_HEADER([config/config.h])
10156283SrwatsonAM_MAINTAINER_MODE
11156283Srwatson
12156283Srwatson# Checks for programs.
13156283SrwatsonAC_PROG_CC
14156283SrwatsonAC_PROG_INSTALL
15156283SrwatsonAC_PROG_LIBTOOL
16156283Srwatson
17156283SrwatsonAM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
18156283Srwatson
19159248SrwatsonAC_SEARCH_LIBS(dlsym, dl)
20159248SrwatsonAC_SEARCH_LIBS(clock_gettime, rt)
21156283Srwatson
22156283Srwatson# Checks for header files.
23156283SrwatsonAC_HEADER_STDC
24156283SrwatsonAC_HEADER_SYS_WAIT
25156283SrwatsonAC_CHECK_HEADERS([endian.h mach/mach.h machine/endian.h sys/endian.h])
26156283Srwatson
27156283Srwatson# Checks for typedefs, structures, and compiler characteristics.
28156283SrwatsonAC_C_CONST
29156283SrwatsonAC_TYPE_UID_T
30156283SrwatsonAC_TYPE_PID_T
31156283SrwatsonAC_TYPE_SIZE_T
32156283SrwatsonAC_CHECK_MEMBERS([struct stat.st_rdev])
33156283Srwatson
34156283SrwatsonAC_CHECK_MEMBER([struct ipc_perm.__key],
35156283Srwatson[AC_DEFINE(HAVE_IPC_PERM___KEY,, Define if ipc_perm.__key instead of key)],
36156283Srwatson[],[
37156283Srwatson#include <sys/types.h>
38156283Srwatson#include <sys/ipc.h>
39156283Srwatson])
40156283Srwatson
41156283SrwatsonAC_CHECK_MEMBER([struct ipc_perm.__seq],
42156283Srwatson[AC_DEFINE(HAVE_IPC_PERM___SEQ,, Define if ipc_perm.__seq instead of seq)],
43156283Srwatson[],[
44156283Srwatson#include <sys/types.h>
45156283Srwatson#include <sys/ipc.h>
46156283Srwatson])
47156283Srwatson
48156283SrwatsonAC_HEADER_TIME
49156283SrwatsonAC_STRUCT_TM
50156283Srwatson
51156283Srwatson# Checks for library functions.
52156283SrwatsonAC_FUNC_CHOWN
53156283SrwatsonAC_FUNC_FORK
54156283SrwatsonAC_FUNC_MALLOC
55156283SrwatsonAC_FUNC_MKTIME
56156283SrwatsonAC_TYPE_SIGNAL
57156283SrwatsonAC_FUNC_STAT
58156283SrwatsonAC_FUNC_STRFTIME
59156283SrwatsonAC_CHECK_FUNCS([bzero ftruncate gettimeofday inet_ntoa memset strchr strerror strrchr strstr strtol strtoul])
60156283Srwatson
61156283Srwatson# sys/queue.h exists on most systems, but its capabilities vary a great deal.
62156283Srwatson# test for LIST_FIRST, which appears to not exist in all of them, and is
63156283Srwatson# necessary for OpenBSM.
64156283SrwatsonAC_TRY_LINK([
65156283Srwatson	#include <sys/queue.h>
66156283Srwatson], [
67156283Srwatson	struct foo {
68156283Srwatson		LIST_ENTRY(foo) foo_entries;
69156283Srwatson	};
70156283Srwatson	LIST_HEAD(, foo) foo_list;
71156283Srwatson	struct foo *foo;
72156283Srwatson
73156283Srwatson	foo = LIST_FIRST(&foo_list);
74156283Srwatson], [
75156283SrwatsonAC_DEFINE(HAVE_FULL_QUEUE_H,, Define if queue.h includes LIST_FIRST)
76156283Srwatson])
77156283Srwatson
78156283Srwatson# Systems may not define key audit system calls, in which case libbsm cannot
79156283Srwatson# depend on them or it will generate link-time or run-time errors.  Test for
80156283Srwatson# just one.
81156283SrwatsonAC_TRY_LINK([
82156283Srwatson	#include <stdlib.h>
83156283Srwatson
84156283Srwatson	extern int auditon(int, void *, int);
85156283Srwatson], [
86156283Srwatson	int err;
87156283Srwatson
88156283Srwatson	err = auditon(0, NULL, 0);
89156283Srwatson], [
90156283SrwatsonAC_DEFINE(HAVE_AUDIT_SYSCALLS,, Define if audit system calls present)
91156283Srwatsonhave_audit_syscalls=true
92156283Srwatson], [
93156283Srwatsonhave_audit_syscalls=false
94156283Srwatson])
95156283SrwatsonAM_CONDITIONAL(HAVE_AUDIT_SYSCALLS, $have_audit_syscalls)
96156283Srwatson
97156283SrwatsonAC_CONFIG_FILES([Makefile
98156283Srwatson                 bin/Makefile
99156283Srwatson                 bin/audit/Makefile
100156283Srwatson                 bin/auditd/Makefile
101159248Srwatson                 bin/auditfilterd/Makefile
102156283Srwatson                 bin/auditreduce/Makefile
103156283Srwatson                 bin/praudit/Makefile
104156283Srwatson                 bsm/Makefile
105156283Srwatson                 libbsm/Makefile
106159248Srwatson                 modules/Makefile
107159248Srwatson                 modules/auditfilter_noop/Makefile
108156283Srwatson                 man/Makefile
109159248Srwatson                 test/Makefile
110159248Srwatson                 test/bsm/Makefile
111156283Srwatson                 tools/Makefile])
112156283Srwatson
113156283SrwatsonAC_OUTPUT
114