configure.ac revision 191273
1156283Srwatson# -*- Autoconf -*- 2156283Srwatson# Process this file with autoconf to produce a configure script. 3156283Srwatson 4156283SrwatsonAC_PREREQ(2.59) 5191273SrwatsonAC_INIT([OpenBSM], [1.1], [trustedbsd-audit@TrustesdBSD.org],[openbsm]) 6191273SrwatsonAC_REVISION([$P4: //depot/projects/trustedbsd/openbsm/configure.ac#52 $]) 7156283SrwatsonAC_CONFIG_SRCDIR([bin/auditreduce/auditreduce.c]) 8156283SrwatsonAC_CONFIG_AUX_DIR(config) 9156283SrwatsonAC_CONFIG_HEADER([config/config.h]) 10156283SrwatsonAM_MAINTAINER_MODE 11156283Srwatson 12185573Srwatson# --with-native-includes forces the use of the system bsm headers. 13185573SrwatsonAC_ARG_WITH([native-includes], 14185573Srwatson[AS_HELP_STRING([--with-native-includes], 15185573Srwatson[Use the system native include files instead of those included with openbsm.])], 16185573Srwatson[ 17185573SrwatsonAC_DEFINE(USE_NATIVE_INCLUDES,, Define to use native include files) 18185573Srwatsonuse_native_includes=true 19185573Srwatson], 20185573Srwatson[use_native_includes=false]) 21185573SrwatsonAM_CONDITIONAL(USE_NATIVE_INCLUDES, $use_native_includes) 22185573Srwatson 23185573SrwatsonAC_PATH_PROGS(MIG, mig) 24185573Srwatson 25156283Srwatson# Checks for programs. 26156283SrwatsonAC_PROG_CC 27156283SrwatsonAC_PROG_INSTALL 28156283SrwatsonAC_PROG_LIBTOOL 29156283Srwatson 30156283SrwatsonAM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION) 31156283Srwatson 32159248SrwatsonAC_SEARCH_LIBS(dlsym, dl) 33159248SrwatsonAC_SEARCH_LIBS(clock_gettime, rt) 34156283Srwatson 35156283Srwatson# Checks for header files. 36156283SrwatsonAC_HEADER_STDC 37156283SrwatsonAC_HEADER_SYS_WAIT 38186647SrwatsonAC_CHECK_HEADERS([endian.h mach/mach.h machine/endian.h sys/endian.h stdint.h]) 39156283Srwatson 40191273SrwatsonAC_DEFINE([_GNU_SOURCE],,[Use extended API on platforms that require it]) 41191273Srwatson 42156283Srwatson# Checks for typedefs, structures, and compiler characteristics. 43156283SrwatsonAC_C_CONST 44156283SrwatsonAC_TYPE_UID_T 45156283SrwatsonAC_TYPE_PID_T 46156283SrwatsonAC_TYPE_SIZE_T 47156283SrwatsonAC_CHECK_MEMBERS([struct stat.st_rdev]) 48156283Srwatson 49156283SrwatsonAC_CHECK_MEMBER([struct ipc_perm.__key], 50156283Srwatson[AC_DEFINE(HAVE_IPC_PERM___KEY,, Define if ipc_perm.__key instead of key)], 51156283Srwatson[],[ 52156283Srwatson#include <sys/types.h> 53156283Srwatson#include <sys/ipc.h> 54156283Srwatson]) 55156283Srwatson 56185573SrwatsonAC_CHECK_MEMBER([struct ipc_perm._key], 57185573Srwatson[AC_DEFINE(HAVE_IPC_PERM__KEY,, Define if ipc_perm._key instead of key)], 58185573Srwatson[],[ 59185573Srwatson#include <sys/types.h> 60185573Srwatson#include <sys/ipc.h> 61185573Srwatson]) 62185573Srwatson 63156283SrwatsonAC_CHECK_MEMBER([struct ipc_perm.__seq], 64156283Srwatson[AC_DEFINE(HAVE_IPC_PERM___SEQ,, Define if ipc_perm.__seq instead of seq)], 65156283Srwatson[],[ 66156283Srwatson#include <sys/types.h> 67156283Srwatson#include <sys/ipc.h> 68156283Srwatson]) 69156283Srwatson 70185573SrwatsonAC_CHECK_MEMBER([struct ipc_perm._seq], 71185573Srwatson[AC_DEFINE(HAVE_IPC_PERM__SEQ,, Define if ipc_perm._seq instead of seq)], 72185573Srwatson[],[ 73185573Srwatson#include <sys/types.h> 74185573Srwatson#include <sys/ipc.h> 75185573Srwatson]) 76185573Srwatson 77156283SrwatsonAC_HEADER_TIME 78156283SrwatsonAC_STRUCT_TM 79156283Srwatson 80156283Srwatson# Checks for library functions. 81156283SrwatsonAC_FUNC_CHOWN 82156283SrwatsonAC_FUNC_FORK 83156283SrwatsonAC_FUNC_MALLOC 84156283SrwatsonAC_FUNC_MKTIME 85156283SrwatsonAC_TYPE_SIGNAL 86156283SrwatsonAC_FUNC_STAT 87156283SrwatsonAC_FUNC_STRFTIME 88186647SrwatsonAC_CHECK_FUNCS([bzero clock_gettime ftruncate gettimeofday inet_ntoa memset strchr strerror strlcat strlcpy strrchr strstr strtol strtoul pthread_mutex_lock]) 89156283Srwatson 90156283Srwatson# sys/queue.h exists on most systems, but its capabilities vary a great deal. 91159985Srwatson# test for LIST_FIRST and TAILQ_FOREACH_SAFE, which appears to not exist in 92159985Srwatson# all of them, and are necessary for OpenBSM. 93156283SrwatsonAC_TRY_LINK([ 94156283Srwatson #include <sys/queue.h> 95156283Srwatson], [ 96156283Srwatson 97159985Srwatson #ifndef LIST_FIRST 98159985Srwatson #error LIST_FIRST missing 99159985Srwatson #endif 100159985Srwatson #ifndef TAILQ_FOREACH_SAFE 101159985Srwatson #error TAILQ_FOREACH_SAFE 102159985Srwatson #endif 103156283Srwatson], [ 104156283SrwatsonAC_DEFINE(HAVE_FULL_QUEUE_H,, Define if queue.h includes LIST_FIRST) 105156283Srwatson]) 106156283Srwatson 107156283Srwatson# Systems may not define key audit system calls, in which case libbsm cannot 108156283Srwatson# depend on them or it will generate link-time or run-time errors. Test for 109156283Srwatson# just one. 110156283SrwatsonAC_TRY_LINK([ 111186647Srwatson #include <stddef.h> 112156283Srwatson 113156283Srwatson extern int auditon(int, void *, int); 114156283Srwatson], [ 115156283Srwatson int err; 116156283Srwatson 117156283Srwatson err = auditon(0, NULL, 0); 118156283Srwatson], [ 119156283SrwatsonAC_DEFINE(HAVE_AUDIT_SYSCALLS,, Define if audit system calls present) 120156283Srwatsonhave_audit_syscalls=true 121156283Srwatson], [ 122156283Srwatsonhave_audit_syscalls=false 123156283Srwatson]) 124156283SrwatsonAM_CONDITIONAL(HAVE_AUDIT_SYSCALLS, $have_audit_syscalls) 125156283Srwatson 126186647Srwatson# 127186647Srwatson# There are a wide variety of endian macros and functions in the wild; we try 128186647Srwatson# to use the native support if it defines be32enc(), but otherwise have to 129186647Srwatson# use our own. 130186647Srwatson# 131186647SrwatsonAC_TRY_LINK([ 132186647Srwatson #include <sys/endian.h> 133186647Srwatson #include <stdlib.h> 134186647Srwatson], [ 135186647Srwatson be32enc(NULL, 1); 136186647Srwatson], [ 137186647SrwatsonAC_DEFINE(HAVE_BE32ENC,, Define if be32enc is present) 138186647Srwatson]) 139186647Srwatson 140185573Srwatson# Check to see if Mach IPC is used for trigger messages. If so, use Mach IPC 141185573Srwatson# instead of the default for sending trigger messages to the audit components. 142185573SrwatsonAC_CHECK_FILE([/usr/include/mach/audit_triggers.defs], [ 143185573SrwatsonAC_DEFINE(USE_MACH_IPC,, Define if uses Mach IPC for Triggers messages) 144185573Srwatsonuse_mach_ipc=true 145185573Srwatson], [ 146185573Srwatsonuse_mach_ipc=false 147185573Srwatson]) 148185573SrwatsonAM_CONDITIONAL(USE_MACH_IPC, $use_mach_ipc) 149185573Srwatson 150156283SrwatsonAC_CONFIG_FILES([Makefile 151156283Srwatson bin/Makefile 152156283Srwatson bin/audit/Makefile 153156283Srwatson bin/auditd/Makefile 154159248Srwatson bin/auditfilterd/Makefile 155156283Srwatson bin/auditreduce/Makefile 156156283Srwatson bin/praudit/Makefile 157156283Srwatson bsm/Makefile 158186647Srwatson libauditd/Makefile 159156283Srwatson libbsm/Makefile 160159248Srwatson modules/Makefile 161159248Srwatson modules/auditfilter_noop/Makefile 162156283Srwatson man/Makefile 163185573Srwatson sys/Makefile 164185573Srwatson sys/bsm/Makefile 165159248Srwatson test/Makefile 166159248Srwatson test/bsm/Makefile 167156283Srwatson tools/Makefile]) 168156283Srwatson 169156283SrwatsonAC_OUTPUT 170