2 # Process this file with autoconf to produce a configure script.
5 AC_INIT([OpenBSM], [1.2-alpha4], [trustedbsd-audit@TrustedBSD.org],[openbsm])
6 AC_CONFIG_MACRO_DIR([m4])
7 AC_CONFIG_SRCDIR([bin/auditreduce/auditreduce.c])
8 AC_CONFIG_AUX_DIR(config)
9 AC_CONFIG_MACRO_DIR([m4])
10 AC_CONFIG_HEADER([config/config.h])
13 # --with-native-includes forces the use of the system bsm headers.
14 AC_ARG_WITH([native-includes],
15 [AS_HELP_STRING([--with-native-includes],
16 [Use the system native include files instead of those included with openbsm.])],
18 AC_DEFINE(USE_NATIVE_INCLUDES,, Define to use native include files)
19 use_native_includes=true
21 [use_native_includes=false])
22 AM_CONDITIONAL(USE_NATIVE_INCLUDES, $use_native_includes)
24 AC_PATH_PROGS(MIG, mig)
26 # Checks for programs.
34 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
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)
43 # Checks for header files.
46 AC_CHECK_HEADERS([mach/mach.h stdint.h pthread_np.h printf.h])
48 AC_DEFINE([_GNU_SOURCE],,[Use extended API on platforms that require it])
50 # Checks for typedefs, structures, and compiler characteristics.
55 AC_CHECK_MEMBERS([struct stat.st_rdev])
57 AC_CHECK_MEMBER([struct ipc_perm.__key],
58 [AC_DEFINE(HAVE_IPC_PERM___KEY,, Define if ipc_perm.__key instead of key)],
60 #include <sys/types.h>
64 AC_CHECK_MEMBER([struct ipc_perm._key],
65 [AC_DEFINE(HAVE_IPC_PERM__KEY,, Define if ipc_perm._key instead of key)],
67 #include <sys/types.h>
71 AC_CHECK_MEMBER([struct ipc_perm.__seq],
72 [AC_DEFINE(HAVE_IPC_PERM___SEQ,, Define if ipc_perm.__seq instead of seq)],
74 #include <sys/types.h>
78 AC_CHECK_MEMBER([struct ipc_perm._seq],
79 [AC_DEFINE(HAVE_IPC_PERM__SEQ,, Define if ipc_perm._seq instead of seq)],
81 #include <sys/types.h>
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)],
88 #include <sys/types.h>
89 #include <sys/socket.h>
95 # Checks for library functions.
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])
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.
109 #include <sys/queue.h>
113 #error LIST_FIRST missing
115 #ifndef TAILQ_FOREACH_SAFE
116 #error TAILQ_FOREACH_SAFE
119 AC_DEFINE(HAVE_FULL_QUEUE_H,, Define if queue.h includes LIST_FIRST)
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
128 extern int auditon(int, void *, int);
132 err = auditon(0, NULL, 0);
134 AC_DEFINE(HAVE_AUDIT_SYSCALLS,, Define if audit system calls present)
135 have_audit_syscalls=true
137 have_audit_syscalls=false
139 AM_CONDITIONAL(HAVE_AUDIT_SYSCALLS, $have_audit_syscalls)
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:
151 # USE_MACHINE_ENDIAN_H
152 # USE_COMPAT_ENDIAN_H
153 # USE_COMPAT_ENDIAN_ENC_H
155 # First, decide which system endian.h to use.
157 AC_CHECK_HEADERS([endian.h], [
163 AC_CHECK_HEADERS([sys/endian.h], [
164 have_sys_endian_h=yes
169 AC_CHECK_HEADERS([machine/endian.h], [
170 have_machine_endian_h=yes
172 have_machine_endian_h=no
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)
182 AC_MSG_ERROR([no endian.h])
186 # Next, decide if we need to supplement with compat headers.
192 #ifdef USE_SYS_ENDIAN_H
193 #include <sys/endian.h>
195 #ifdef USE_MACHINE_ENDIAN_H
196 #include <machine/endian.h>
201 AC_DEFINE(USE_COMPAT_ENDIAN_H,, Define if compat/endian.h is required)
202 AC_MSG_RESULT([using compat/endian.h])
209 #ifdef USE_SYS_ENDIAN_H
210 #include <sys/endian.h>
212 #ifdef USE_MACHINE_ENDIAN_H
213 #include <machine/endian.h>
215 #ifdef USE_COMPAT_ENDIAN_H
216 #include "compat/endian.h"
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])
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)
241 AM_CONDITIONAL(USE_MACH_IPC, $use_mach_ipc)
243 AC_CONFIG_FILES([Makefile
247 bin/auditdistd/Makefile
248 bin/auditfilterd/Makefile
249 bin/auditreduce/Makefile
255 modules/auditfilter_noop/Makefile