readelf: report ARM program and section header types
[freebsd-src.git] / contrib / openbsm / configure.ac
blob19762e4517e75862141eac0aeb880dd8f9ae37d1
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
4 AC_PREREQ(2.59)
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])
11 AM_MAINTAINER_MODE
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.
27 AC_PROG_CC
28 AC_PROG_INSTALL
29 AC_PROG_LEX
30 AC_PROG_LIBTOOL
31 AC_PROG_LN_S
32 AC_PROG_YACC
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.
44 AC_HEADER_STDC
45 AC_HEADER_SYS_WAIT
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.
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])
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>
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>
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>
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>
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>
92 AC_HEADER_TIME
93 AC_STRUCT_TM
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])
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 ], [
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)
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>
128         extern int auditon(int, void *, int);
129 ], [
130         int err;
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
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:
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
155 # First, decide which system endian.h to use.
157 AC_CHECK_HEADERS([endian.h], [
158         have_endian_h=yes
159 ], [
160         have_endian_h=no
163 AC_CHECK_HEADERS([sys/endian.h], [
164         have_sys_endian_h=yes
165 ], [
166         have_sys_endian_h=no
169 AC_CHECK_HEADERS([machine/endian.h], [
170         have_machine_endian_h=yes
171 ], [
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)
181 else
182         AC_MSG_ERROR([no endian.h])
186 # Next, decide if we need to supplement with compat headers.
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])
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;
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])
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
241 AM_CONDITIONAL(USE_MACH_IPC, $use_mach_ipc)
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])
263 AC_OUTPUT