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