1# -*- Autoconf -*- 2# Process this file with autoconf to produce a configure script. 3 4AC_PREREQ(2.59) 5AC_INIT([OpenBSM], [1.2-alpha5], [trustedbsd-audit@TrustedBSD.org],[openbsm]) 6AC_CONFIG_MACRO_DIR([m4]) 7AC_CONFIG_SRCDIR([bin/auditreduce/auditreduce.c]) 8AC_CONFIG_AUX_DIR(config) 9AC_CONFIG_MACRO_DIR([m4]) 10AC_CONFIG_HEADER([config/config.h]) 11AM_MAINTAINER_MODE 12 13# --with-native-includes forces the use of the system bsm headers. 14AC_ARG_WITH([native-includes], 15[AS_HELP_STRING([--with-native-includes], 16[Use the system native include files instead of those included with openbsm.])], 17[ 18AC_DEFINE(USE_NATIVE_INCLUDES,, Define to use native include files) 19use_native_includes=true 20], 21[use_native_includes=false]) 22AM_CONDITIONAL(USE_NATIVE_INCLUDES, $use_native_includes) 23 24AC_PATH_PROGS(MIG, mig) 25 26# Checks for programs. 27AC_PROG_CC 28AC_PROG_INSTALL 29AC_PROG_LEX 30AC_PROG_LIBTOOL 31AC_PROG_LN_S 32AC_PROG_YACC 33 34AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION) 35 36AC_SEARCH_LIBS(dlsym, dl) 37AC_SEARCH_LIBS(pthread_create, pthread) 38AC_SEARCH_LIBS(clock_gettime, rt) 39AC_SEARCH_LIBS(SSL_connect, ssl) 40AC_SEARCH_LIBS(humanize_number, util) 41AC_SEARCH_LIBS(pidfile_open, util) 42 43# Checks for header files. 44AC_HEADER_STDC 45AC_HEADER_SYS_WAIT 46AC_CHECK_HEADERS([mach/mach.h stdint.h pthread_np.h printf.h]) 47 48AC_DEFINE([_GNU_SOURCE],,[Use extended API on platforms that require it]) 49 50# Checks for typedefs, structures, and compiler characteristics. 51AC_C_CONST 52AC_TYPE_UID_T 53AC_TYPE_PID_T 54AC_TYPE_SIZE_T 55AC_CHECK_MEMBERS([struct stat.st_rdev]) 56 57AC_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 64AC_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 71AC_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 78AC_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 85AC_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 92AC_HEADER_TIME 93AC_STRUCT_TM 94 95# Checks for library functions. 96AC_FUNC_CHOWN 97AC_FUNC_FORK 98AC_FUNC_MALLOC 99AC_FUNC_MKTIME 100AC_TYPE_SIGNAL 101AC_FUNC_STAT 102AC_FUNC_STRFTIME 103AC_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. 108AC_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], [ 119AC_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. 125AC_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], [ 134AC_DEFINE(HAVE_AUDIT_SYSCALLS,, Define if audit system calls present) 135have_audit_syscalls=true 136], [ 137have_audit_syscalls=false 138]) 139AM_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# 157AC_CHECK_HEADERS([endian.h], [ 158 have_endian_h=yes 159], [ 160 have_endian_h=no 161]) 162 163AC_CHECK_HEADERS([sys/endian.h], [ 164 have_sys_endian_h=yes 165], [ 166 have_sys_endian_h=no 167]) 168 169AC_CHECK_HEADERS([machine/endian.h], [ 170 have_machine_endian_h=yes 171], [ 172 have_machine_endian_h=no 173]) 174 175if test $have_endian_h = yes; then 176 AC_DEFINE(USE_ENDIAN_H,, Define if endian.h should be included) 177elif test $have_sys_endian_h = yes; then 178 AC_DEFINE(USE_SYS_ENDIAN_H,, Define if sys/endian.h should be included) 179elif test $have_machine_endian_h = yes; then 180 AC_DEFINE(USE_MACHINE_ENDIAN_H,, Define if machine/endian.h should be included) 181else 182 AC_MSG_ERROR([no endian.h]) 183fi 184 185# 186# Next, decide if we need to supplement with compat headers. 187# 188AC_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 205AC_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. 235AC_CHECK_FILE([/usr/include/mach/audit_triggers.defs], [ 236AC_DEFINE(USE_MACH_IPC,, Define if uses Mach IPC for Triggers messages) 237use_mach_ipc=true 238], [ 239use_mach_ipc=false 240]) 241AM_CONDITIONAL(USE_MACH_IPC, $use_mach_ipc) 242 243AC_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 263AC_OUTPUT 264