configure.ac revision 156283
1156283Srwatson#                                               -*- Autoconf -*-
2156283Srwatson# Process this file with autoconf to produce a configure script.
3156283Srwatson
4156283SrwatsonAC_PREREQ(2.59)
5156283SrwatsonAC_INIT([OpenBSM], [1.0a5], [trustedbsd-audit@TrustesdBSD.org],[openbsm])
6156283SrwatsonAC_REVISION([$P4: //depot/projects/trustedbsd/openbsm/configure.ac#16 $])
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
19156283Srwatson# Checks for libraries.
20156283Srwatson# FIXME: Replace `main' with a function in `-lbsm':
21156283SrwatsonAC_CHECK_LIB([bsm], [main])
22156283Srwatson
23156283Srwatson# Checks for header files.
24156283SrwatsonAC_HEADER_STDC
25156283SrwatsonAC_HEADER_SYS_WAIT
26156283SrwatsonAC_CHECK_HEADERS([endian.h mach/mach.h machine/endian.h sys/endian.h])
27156283Srwatson
28156283Srwatson# Checks for typedefs, structures, and compiler characteristics.
29156283SrwatsonAC_C_CONST
30156283SrwatsonAC_TYPE_UID_T
31156283SrwatsonAC_TYPE_PID_T
32156283SrwatsonAC_TYPE_SIZE_T
33156283SrwatsonAC_CHECK_MEMBERS([struct stat.st_rdev])
34156283Srwatson
35156283SrwatsonAC_CHECK_MEMBER([struct ipc_perm.__key],
36156283Srwatson[AC_DEFINE(HAVE_IPC_PERM___KEY,, Define if ipc_perm.__key instead of key)],
37156283Srwatson[],[
38156283Srwatson#include <sys/types.h>
39156283Srwatson#include <sys/ipc.h>
40156283Srwatson])
41156283Srwatson
42156283SrwatsonAC_CHECK_MEMBER([struct ipc_perm.__seq],
43156283Srwatson[AC_DEFINE(HAVE_IPC_PERM___SEQ,, Define if ipc_perm.__seq instead of seq)],
44156283Srwatson[],[
45156283Srwatson#include <sys/types.h>
46156283Srwatson#include <sys/ipc.h>
47156283Srwatson])
48156283Srwatson
49156283SrwatsonAC_HEADER_TIME
50156283SrwatsonAC_STRUCT_TM
51156283Srwatson
52156283Srwatson# Checks for library functions.
53156283SrwatsonAC_FUNC_CHOWN
54156283SrwatsonAC_FUNC_FORK
55156283SrwatsonAC_FUNC_MALLOC
56156283SrwatsonAC_FUNC_MKTIME
57156283SrwatsonAC_TYPE_SIGNAL
58156283SrwatsonAC_FUNC_STAT
59156283SrwatsonAC_FUNC_STRFTIME
60156283SrwatsonAC_CHECK_FUNCS([bzero ftruncate gettimeofday inet_ntoa memset strchr strerror strrchr strstr strtol strtoul])
61156283Srwatson
62156283Srwatson# sys/queue.h exists on most systems, but its capabilities vary a great deal.
63156283Srwatson# test for LIST_FIRST, which appears to not exist in all of them, and is
64156283Srwatson# necessary for OpenBSM.
65156283SrwatsonAC_TRY_LINK([
66156283Srwatson	#include <sys/queue.h>
67156283Srwatson], [
68156283Srwatson	struct foo {
69156283Srwatson		LIST_ENTRY(foo) foo_entries;
70156283Srwatson	};
71156283Srwatson	LIST_HEAD(, foo) foo_list;
72156283Srwatson	struct foo *foo;
73156283Srwatson
74156283Srwatson	foo = LIST_FIRST(&foo_list);
75156283Srwatson], [
76156283SrwatsonAC_DEFINE(HAVE_FULL_QUEUE_H,, Define if queue.h includes LIST_FIRST)
77156283Srwatson])
78156283Srwatson
79156283Srwatson# Systems may not define key audit system calls, in which case libbsm cannot
80156283Srwatson# depend on them or it will generate link-time or run-time errors.  Test for
81156283Srwatson# just one.
82156283SrwatsonAC_TRY_LINK([
83156283Srwatson	#include <stdlib.h>
84156283Srwatson
85156283Srwatson	extern int auditon(int, void *, int);
86156283Srwatson], [
87156283Srwatson	int err;
88156283Srwatson
89156283Srwatson	err = auditon(0, NULL, 0);
90156283Srwatson], [
91156283SrwatsonAC_DEFINE(HAVE_AUDIT_SYSCALLS,, Define if audit system calls present)
92156283Srwatsonhave_audit_syscalls=true
93156283Srwatson], [
94156283Srwatsonhave_audit_syscalls=false
95156283Srwatson])
96156283SrwatsonAM_CONDITIONAL(HAVE_AUDIT_SYSCALLS, $have_audit_syscalls)
97156283Srwatson
98156283SrwatsonAC_CONFIG_FILES([Makefile
99156283Srwatson                 bin/Makefile
100156283Srwatson                 bin/audit/Makefile
101156283Srwatson                 bin/auditd/Makefile
102156283Srwatson                 bin/auditreduce/Makefile
103156283Srwatson                 bin/praudit/Makefile
104156283Srwatson                 bsm/Makefile
105156283Srwatson                 libbsm/Makefile
106156283Srwatson                 man/Makefile
107156283Srwatson                 tools/Makefile])
108156283Srwatson
109156283SrwatsonAC_OUTPUT
110