]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - contrib/openbsm/configure.ac
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.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.2-alpha3], [trustedbsd-audit@TrustesdBSD.org],[openbsm])
6 AC_REVISION([$P4: //depot/projects/trustedbsd/openbsm/configure.ac#66 $])
7 AC_CONFIG_MACRO_DIR([m4])
8 AC_CONFIG_SRCDIR([bin/auditreduce/auditreduce.c])
9 AC_CONFIG_AUX_DIR(config)
10 AC_CONFIG_MACRO_DIR([m4])
11 AC_CONFIG_HEADER([config/config.h])
12 AM_MAINTAINER_MODE
13
14 # --with-native-includes forces the use of the system bsm headers.
15 AC_ARG_WITH([native-includes],
16 [AS_HELP_STRING([--with-native-includes],
17 [Use the system native include files instead of those included with openbsm.])],
18 [
19 AC_DEFINE(USE_NATIVE_INCLUDES,, Define to use native include files)
20 use_native_includes=true
21 ],
22 [use_native_includes=false])
23 AM_CONDITIONAL(USE_NATIVE_INCLUDES, $use_native_includes)
24
25 AC_PATH_PROGS(MIG, mig)
26
27 # Checks for programs.
28 AC_PROG_CC
29 AC_PROG_INSTALL
30 AC_PROG_LEX
31 AC_PROG_LIBTOOL
32 AC_PROG_YACC
33
34 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
35
36 AC_SEARCH_LIBS(dlsym, dl)
37 AC_SEARCH_LIBS(pthread_create, pthread)
38 AC_SEARCH_LIBS(clock_gettime, rt)
39 AC_SEARCH_LIBS(SSL_connect, ssl)
40 AC_SEARCH_LIBS(humanize_number, util)
41 AC_SEARCH_LIBS(pidfile_open, util)
42
43 # Checks for header files.
44 AC_HEADER_STDC
45 AC_HEADER_SYS_WAIT
46 AC_CHECK_HEADERS([mach/mach.h stdint.h pthread_np.h printf.h])
47
48 AC_DEFINE([_GNU_SOURCE],,[Use extended API on platforms that require it])
49
50 # Checks for typedefs, structures, and compiler characteristics.
51 AC_C_CONST
52 AC_TYPE_UID_T
53 AC_TYPE_PID_T
54 AC_TYPE_SIZE_T
55 AC_CHECK_MEMBERS([struct stat.st_rdev])
56
57 AC_CHECK_MEMBER([struct ipc_perm.__key],
58 [AC_DEFINE(HAVE_IPC_PERM___KEY,, Define if ipc_perm.__key instead of key)],
59 [],[
60 #include <sys/types.h>
61 #include <sys/ipc.h>
62 ])
63
64 AC_CHECK_MEMBER([struct ipc_perm._key],
65 [AC_DEFINE(HAVE_IPC_PERM__KEY,, Define if ipc_perm._key instead of key)],
66 [],[
67 #include <sys/types.h>
68 #include <sys/ipc.h>
69 ])
70
71 AC_CHECK_MEMBER([struct ipc_perm.__seq],
72 [AC_DEFINE(HAVE_IPC_PERM___SEQ,, Define if ipc_perm.__seq instead of seq)],
73 [],[
74 #include <sys/types.h>
75 #include <sys/ipc.h>
76 ])
77
78 AC_CHECK_MEMBER([struct ipc_perm._seq],
79 [AC_DEFINE(HAVE_IPC_PERM__SEQ,, Define if ipc_perm._seq instead of seq)],
80 [],[
81 #include <sys/types.h>
82 #include <sys/ipc.h>
83 ])
84
85 AC_CHECK_MEMBER([struct sockaddr_storage.ss_len],
86 [AC_DEFINE(HAVE_SOCKADDR_STORAGE_SS_LEN,, Define if sockaddr_storage.ss_len field exists)],
87 [],[
88 #include <sys/types.h>
89 #include <sys/socket.h>
90 ])
91
92 AC_HEADER_TIME
93 AC_STRUCT_TM
94
95 # Checks for library functions.
96 AC_FUNC_CHOWN
97 AC_FUNC_FORK
98 AC_FUNC_MALLOC
99 AC_FUNC_MKTIME
100 AC_TYPE_SIGNAL
101 AC_FUNC_STAT
102 AC_FUNC_STRFTIME
103 AC_CHECK_FUNCS([arc4random arc4random_buf bzero cap_enter clock_gettime closefrom faccessat fdopendir fstatat ftruncate getresgid getresuid gettimeofday inet_ntoa jail kqueue memset openat pthread_cond_timedwait_relative_np pthread_condattr_setclock pthread_mutex_lock renameat setproctitle sigtimedwait strchr strerror strlcat strlcpy strndup strrchr strstr strtol strtoul unlinkat vis])
104
105 # sys/queue.h exists on most systems, but its capabilities vary a great deal.
106 # test for LIST_FIRST and TAILQ_FOREACH_SAFE, which appears to not exist in
107 # all of them, and are necessary for OpenBSM.
108 AC_TRY_LINK([
109         #include <sys/queue.h>
110 ], [
111
112         #ifndef LIST_FIRST
113         #error LIST_FIRST missing
114         #endif
115         #ifndef TAILQ_FOREACH_SAFE
116         #error TAILQ_FOREACH_SAFE
117         #endif
118 ], [
119 AC_DEFINE(HAVE_FULL_QUEUE_H,, Define if queue.h includes LIST_FIRST)
120 ])
121
122 # Systems may not define key audit system calls, in which case libbsm cannot
123 # depend on them or it will generate link-time or run-time errors.  Test for
124 # just one.
125 AC_TRY_LINK([
126         #include <stddef.h>
127
128         extern int auditon(int, void *, int);
129 ], [
130         int err;
131
132         err = auditon(0, NULL, 0);
133 ], [
134 AC_DEFINE(HAVE_AUDIT_SYSCALLS,, Define if audit system calls present)
135 have_audit_syscalls=true
136 ], [
137 have_audit_syscalls=false
138 ])
139 AM_CONDITIONAL(HAVE_AUDIT_SYSCALLS, $have_audit_syscalls)
140
141 #
142 # We rely on the BSD be32toh() and be32enc()-style endian macros to perform
143 # byte order conversions.  Availability of these varies considerably -- in
144 # general, a system might have neither, be32toh(), or be32toh() and be32enc().
145 # There is also variation in which headers are even present, and whether they
146 # are macros or functions.  Try to organise the world into some simpler cases.
147 # The following macros may be set at the end:
148 #
149 # USE_ENDIAN_H
150 # USE_SYS_ENDIAN_H
151 # USE_MACHINE_ENDIAN_H
152 # USE_COMPAT_ENDIAN_H
153 # USE_COMPAT_ENDIAN_ENC_H
154 #
155 # First, decide which system endian.h to use.
156 #
157 AC_CHECK_HEADERS([endian.h], [
158         have_endian_h=yes
159 ], [
160         have_endian_h=no
161 ])
162
163 AC_CHECK_HEADERS([sys/endian.h], [
164         have_sys_endian_h=yes
165 ], [
166         have_sys_endian_h=no
167 ])
168
169 AC_CHECK_HEADERS([machine/endian.h], [
170         have_machine_endian_h=yes
171 ], [
172         have_machine_endian_h=no
173 ])
174
175 if test $have_endian_h = yes; then
176         AC_DEFINE(USE_ENDIAN_H,, Define if endian.h should be included)
177 elif test $have_sys_endian_h = yes; then
178         AC_DEFINE(USE_SYS_ENDIAN_H,, Define if sys/endian.h should be included)
179 elif test $have_machine_endian_h = yes; then
180         AC_DEFINE(USE_MACHINE_ENDIAN_H,, Define if machine/endian.h should be included)
181 else
182         AC_MSG_ERROR([no endian.h])
183 fi
184
185 #
186 # Next, decide if we need to supplement with compat headers.
187 #
188 AC_TRY_LINK([
189         #ifdef USE_ENDIAN_H
190         #include <endian.h>
191         #endif
192         #ifdef USE_SYS_ENDIAN_H
193         #include <sys/endian.h>
194         #endif
195         #ifdef USE_MACHINE_ENDIAN_H
196         #include <machine/endian.h>
197         #endif
198 ], [
199         (void)be32toh(0);
200 ], [], [
201         AC_DEFINE(USE_COMPAT_ENDIAN_H,, Define if compat/endian.h is required)
202         AC_MSG_RESULT([using compat/endian.h])
203 ])
204
205 AC_TRY_LINK([
206         #ifdef USE_ENDIAN_H
207         #include <endian.h>
208         #endif
209         #ifdef USE_SYS_ENDIAN_H
210         #include <sys/endian.h>
211         #endif
212         #ifdef USE_MACHINE_ENDIAN_H
213         #include <machine/endian.h>
214         #endif
215         #ifdef USE_COMPAT_ENDIAN_H
216         #include "compat/endian.h"
217         #endif
218         #include <stdlib.h>
219 ], [
220         int i;
221
222         i = bswap16(0);
223         i = bswap32(0);
224         i = bswap64(0);
225         be32enc(NULL, 0);
226         i = htole64(0);
227         i = le64toh(0);
228 ], [], [
229         AC_DEFINE(USE_COMPAT_ENDIAN_ENC_H,, Define if compat/endian_enc.h is required)
230         AC_MSG_RESULT([using compat/endian_enc.h])
231 ])
232
233 # Check to see if Mach IPC is used for trigger messages.  If so, use Mach IPC
234 # instead of the default for sending trigger messages to the audit components.
235 AC_CHECK_FILE([/usr/include/mach/audit_triggers.defs], [
236 AC_DEFINE(USE_MACH_IPC,, Define if uses Mach IPC for Triggers messages)
237 use_mach_ipc=true
238 ], [
239 use_mach_ipc=false
240 ])
241 AM_CONDITIONAL(USE_MACH_IPC, $use_mach_ipc)
242
243 AC_CONFIG_FILES([Makefile
244                  bin/Makefile
245                  bin/audit/Makefile
246                  bin/auditd/Makefile
247                  bin/auditdistd/Makefile
248                  bin/auditfilterd/Makefile
249                  bin/auditreduce/Makefile
250                  bin/praudit/Makefile
251                  bsm/Makefile
252                  libauditd/Makefile
253                  libbsm/Makefile
254                  modules/Makefile
255                  modules/auditfilter_noop/Makefile
256                  man/Makefile
257                  sys/Makefile
258                  sys/bsm/Makefile
259                  test/Makefile
260                  test/bsm/Makefile
261                  tools/Makefile])
262
263 AC_OUTPUT