1# 2# Copyright (C) Mellanox Technologies Ltd. 2001-2014. ALL RIGHTS RESERVED. 3# Copyright (C) UT-Battelle, LLC. 2014-2015. ALL RIGHTS RESERVED. 4# See file LICENSE for terms. 5# 6 7 8AC_FUNC_ALLOCA 9 10 11# 12# SystemV shared memory 13# 14#IPC_INFO 15AC_CHECK_LIB([rt], [shm_open], [], AC_MSG_ERROR([librt not found])) 16AC_CHECK_LIB([rt], [timer_create], [], AC_MSG_ERROR([librt not found])) 17 18 19# 20# Extended string functions 21# 22AC_CHECK_HEADERS([libgen.h]) 23AC_CHECK_DECLS([asprintf, basename, fmemopen], [], 24 AC_MSG_ERROR([GNU string extensions not found]), 25 [#define _GNU_SOURCE 1 26 #include <string.h> 27 #include <stdio.h> 28 #ifdef HAVE_LIBGEN_H 29 #include <libgen.h> 30 #endif 31 ]) 32 33 34# 35# CPU-sets 36# 37AC_CHECK_HEADERS([sys/cpuset.h]) 38AC_CHECK_DECLS([CPU_ZERO, CPU_ISSET], [], 39 AC_MSG_ERROR([CPU_ZERO/CPU_ISSET not found]), 40 [#define _GNU_SOURCE 1 41 #include <sys/types.h> 42 #include <sched.h> 43 #ifdef HAVE_SYS_CPUSET_H 44 #include <sys/cpuset.h> 45 #endif 46 ]) 47AC_CHECK_TYPES([cpu_set_t, cpuset_t], [], [], 48 [#define _GNU_SOURCE 1 49 #include <sys/types.h> 50 #include <sched.h> 51 #ifdef HAVE_SYS_CPUSET_H 52 #include <sys/cpuset.h> 53 #endif]) 54 55 56# 57# Type for sighandler 58# 59AC_CHECK_TYPES([sighandler_t, __sighandler_t], [], [], 60 [#define _GNU_SOURCE 1 61 #include <signal.h>]) 62 63 64# 65# pthread 66# 67AC_CHECK_HEADERS([pthread_np.h]) 68AC_SEARCH_LIBS(pthread_create, pthread) 69AC_SEARCH_LIBS(pthread_atfork, pthread) 70 71 72# 73# Misc. Linux-specific functions 74# 75AC_CHECK_FUNCS([clearenv]) 76AC_CHECK_FUNCS([malloc_trim]) 77AC_CHECK_FUNCS([memalign]) 78AC_CHECK_FUNCS([posix_memalign]) 79AC_CHECK_FUNCS([mremap]) 80AC_CHECK_FUNCS([sched_setaffinity sched_getaffinity]) 81AC_CHECK_FUNCS([cpuset_setaffinity cpuset_getaffinity]) 82 83 84# 85# Route file descriptor signal to specific thread 86# 87AC_CHECK_DECLS([F_SETOWN_EX], [], [], [#define _GNU_SOURCE 1 88#include <fcntl.h>]) 89 90 91# 92# Ethtool definitions 93# 94AC_CHECK_DECLS([ethtool_cmd_speed, SPEED_UNKNOWN], [], [], 95 [#include <linux/ethtool.h>]) 96 97 98# 99# PowerPC query for TB frequency 100# 101AC_CHECK_DECLS([__ppc_get_timebase_freq], [], [], [#include <sys/platform/ppc.h>]) 102AC_CHECK_HEADERS([sys/platform/ppc.h]) 103 104 105# 106# Google Testing framework 107# 108GTEST_LIB_CHECK([1.5.0], [true], [true]) 109 110 111# 112# Valgrind support 113# 114AC_ARG_WITH([valgrind], 115 AC_HELP_STRING([--with-valgrind], 116 [Enable Valgrind annotations (small runtime overhead, default NO)]), 117 [], 118 [with_valgrind=no] 119) 120AS_IF([test "x$with_valgrind" = xno], 121 [AC_DEFINE([NVALGRIND], 1, [Define to 1 to disable Valgrind annotations.])], 122 [AS_IF([test ! -d $with_valgrind], 123 [AC_MSG_NOTICE([Valgrind path was not defined, guessing ...]) 124 with_valgrind=/usr], [:]) 125 AC_CHECK_HEADER([$with_valgrind/include/valgrind/memcheck.h], [], 126 [AC_MSG_ERROR([Valgrind memcheck support requested, but <valgrind/memcheck.h> not found, install valgrind-devel rpm.])]) 127 CPPFLAGS="$CPPFLAGS -I$with_valgrind/include" 128 ] 129) 130 131 132# 133# NUMA support 134# 135AC_ARG_ENABLE([numa], 136 AC_HELP_STRING([--disable-numa], [Disable NUMA support]), 137 [ 138 AC_MSG_NOTICE([NUMA support is disabled]) 139 ], 140 [ 141 AC_DEFUN([NUMA_W1], [not found. Please reconfigure with --disable-numa. ]) 142 AC_DEFUN([NUMA_W2], [Warning: this may have negative impact on library performance. It is better to install]) 143 AC_CHECK_HEADERS([numa.h numaif.h], [], 144 [AC_MSG_ERROR([NUMA headers NUMA_W1 NUMA_W2 libnuma-devel package])]) 145 AC_CHECK_LIB(numa, mbind, 146 [AC_SUBST(NUMA_LIBS, [-lnuma])], 147 [AC_MSG_ERROR([NUMA library NUMA_W1 NUMA_W2 libnuma package])]) 148 AC_DEFINE([HAVE_NUMA], 1, [Define to 1 to enable NUMA support]) 149 AC_CHECK_TYPES([struct bitmask], [], [], [[#include <numa.h>]]) 150 ] 151) 152 153 154# 155# Malloc hooks 156# 157AC_MSG_CHECKING([malloc hooks]) 158SAVE_CFLAGS=$CFLAGS 159CFLAGS="$CFLAGS $CFLAGS_NO_DEPRECATED" 160CHECK_CROSS_COMP([AC_LANG_SOURCE([#include <malloc.h> 161 static int rc = 1; 162 void *ptr; 163 void *myhook(size_t size, const void *caller) { 164 rc = 0; 165 return NULL; 166 } 167 int main(int argc, char** argv) { 168 __malloc_hook = myhook; 169 ptr = malloc(1); 170 return rc; 171 }])], 172 [AC_MSG_RESULT([yes]) 173 AC_DEFINE([HAVE_MALLOC_HOOK], 1, [malloc hooks support])], 174 [AC_MSG_RESULT([no]) 175 AC_MSG_WARN([malloc hooks are not supported])] 176 ) 177CFLAGS=$SAVE_CFLAGS 178 179 180# 181# Check for capability.h header (usually comes from libcap-devel package) and 182# make sure it defines the types we need 183# 184AC_CHECK_HEADERS([sys/capability.h], 185 [AC_CHECK_TYPES([cap_user_header_t, cap_user_data_t], [], 186 [AC_DEFINE([HAVE_SYS_CAPABILITY_H], [0], [Linux capability API support])], 187 [[#include <sys/capability.h>]])] 188 ) 189 190# 191# Check for PR_SET_PTRACER 192# 193AC_CHECK_DECLS([PR_SET_PTRACER], [], [], [#include <sys/prctl.h>]) 194 195 196# 197# ipv6 s6_addr32/__u6_addr32 shortcuts for in6_addr 198# ip header structure layout name 199# 200AC_CHECK_MEMBER(struct in6_addr.s6_addr32, 201 [AC_DEFINE([HAVE_IN6_ADDR_S6_ADDR32], [1], 202 [struct in6_addr has s6_addr32 member])], 203 [], 204 [#include <netinet/in.h>]) 205AC_CHECK_MEMBER(struct in6_addr.__u6_addr.__u6_addr32, 206 [AC_DEFINE([HAVE_IN6_ADDR_U6_ADDR32], [1], 207 [struct in6_addr is BSD-style])], 208 [], 209 [#include <netinet/in.h>]) 210AC_CHECK_MEMBER(struct iphdr.daddr.s_addr, 211 [AC_DEFINE([HAVE_IPHDR_DADDR], [1], 212 [struct iphdr has daddr member])], 213 [], 214 [#include <linux/ip.h>]) 215AC_CHECK_MEMBER(struct ip.ip_dst.s_addr, 216 [AC_DEFINE([HAVE_IP_IP_DST], [1], 217 [struct ip has ip_dst member])], 218 [], 219 [#include <sys/types.h> 220 #include <netinet/in.h> 221 #include <netinet/ip.h>]) 222 223 224# 225# struct sigevent reporting thread id 226# 227AC_CHECK_MEMBER(struct sigevent._sigev_un._tid, 228 [AC_DEFINE([HAVE_SIGEVENT_SIGEV_UN_TID], [1], 229 [struct sigevent has _sigev_un._tid])], 230 [], 231 [#include <signal.h>]) 232AC_CHECK_MEMBER(struct sigevent.sigev_notify_thread_id, 233 [AC_DEFINE([HAVE_SIGEVENT_SIGEV_NOTIFY_THREAD_ID], [1], 234 [struct sigevent has sigev_notify_thread_id])], 235 [], 236 [#include <signal.h>]) 237 238 239# 240# sa_restorer is something that only Linux has 241# 242AC_CHECK_MEMBER(struct sigaction.sa_restorer, 243 [AC_DEFINE([HAVE_SIGACTION_SA_RESTORER], [1], 244 [struct sigaction has sa_restorer member])], 245 [], 246 [#include <signal.h>]) 247 248 249# 250# epoll vs. kqueue 251# 252AC_CHECK_HEADERS([sys/epoll.h]) 253AC_CHECK_HEADERS([sys/eventfd.h]) 254AC_CHECK_HEADERS([sys/event.h]) 255 256 257# 258# FreeBSD-specific threading functions 259# 260AC_CHECK_HEADERS([sys/thr.h]) 261 262 263# 264# malloc headers are Linux-specific 265# 266AC_CHECK_HEADERS([malloc.h]) 267AC_CHECK_HEADERS([malloc_np.h]) 268 269 270# 271# endianess 272# 273AC_CHECK_HEADERS([endian.h, sys/endian.h]) 274 275 276# 277# Linux-only headers 278# 279AC_CHECK_HEADERS([linux/mman.h]) 280AC_CHECK_HEADERS([linux/ip.h]) 281AC_CHECK_HEADERS([linux/futex.h]) 282 283 284# 285# Networking headers 286# 287AC_CHECK_HEADERS([net/ethernet.h], [], [], 288 [#include <sys/types.h>]) 289AC_CHECK_HEADERS([netinet/ip.h], [], [], 290 [#include <sys/types.h> 291 #include <netinet/in.h>]) 292