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