tests: Do not build test_swrap_unit with LFS support
[socket_wrapper.git] / ConfigureChecks.cmake
index 2c78b83f168dabde65f1c1b20dc7c03bc0ff0b31..daaee2b53a09a6bcfff525917a8db275067a2e6f 100644 (file)
@@ -48,8 +48,10 @@ check_include_file(sys/filio.h HAVE_SYS_FILIO_H)
 check_include_file(sys/signalfd.h HAVE_SYS_SIGNALFD_H)
 check_include_file(sys/eventfd.h HAVE_SYS_EVENTFD_H)
 check_include_file(sys/timerfd.h HAVE_SYS_TIMERFD_H)
+check_include_file(sys/syscall.h HAVE_SYS_SYSCALL_H)
 check_include_file(gnu/lib-names.h HAVE_GNU_LIB_NAMES_H)
 check_include_file(rpc/rpc.h HAVE_RPC_RPC_H)
+check_include_file(syscall.h HAVE_SYSCALL_H)
 
 # SYMBOLS
 set(CMAKE_REQUIRED_FLAGS -D_GNU_SOURCE)
@@ -68,6 +70,7 @@ check_function_exists(timerfd_create HAVE_TIMERFD_CREATE)
 check_function_exists(bindresvport HAVE_BINDRESVPORT)
 check_function_exists(accept4 HAVE_ACCEPT4)
 check_function_exists(open64 HAVE_OPEN64)
+check_function_exists(openat64 HAVE_OPENAT64)
 check_function_exists(fopen64 HAVE_FOPEN64)
 check_function_exists(getprogname HAVE_GETPROGNAME)
 check_function_exists(getexecname HAVE_GETEXECNAME)
@@ -75,6 +78,10 @@ check_function_exists(pledge HAVE_PLEDGE)
 check_function_exists(_socket HAVE__SOCKET)
 check_function_exists(_close HAVE__CLOSE)
 check_function_exists(__close_nocancel HAVE___CLOSE_NOCANCEL)
+check_function_exists(recvmmsg HAVE_RECVMMSG)
+check_function_exists(sendmmsg HAVE_SENDMMSG)
+check_function_exists(syscall HAVE_SYSCALL)
+check_function_exists(fcntl64 HAVE_FCNTL64)
 
 if (UNIX)
     find_library(DLFCN_LIBRARY dl)
@@ -147,6 +154,44 @@ if (HAVE_EVENTFD)
         HAVE_EVENTFD_UNSIGNED_INT)
 endif (HAVE_EVENTFD)
 
+if (HAVE_SYSCALL)
+    set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
+
+    check_prototype_definition(syscall
+        "int syscall(int sysno, ...)"
+        "-1"
+        "unistd.h;sys/syscall.h"
+        HAVE_SYSCALL_INT)
+    set(CMAKE_REQUIRED_DEFINITIONS)
+endif (HAVE_SYSCALL)
+
+if (HAVE_RECVMMSG)
+    # Linux legacy glibc < 2.21
+    set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
+    check_prototype_definition(recvmmsg
+        "int recvmmsg(int __fd, struct mmsghdr *__vmessages, unsigned int __vlen, int __flags, const struct timespec *__tmo)"
+        "-1"
+        "sys/types.h;sys/socket.h"
+        HAVE_RECVMMSG_CONST_TIMEOUT)
+    set(CMAKE_REQUIRED_DEFINITIONS)
+
+    # FreeBSD
+    check_prototype_definition(recvmmsg
+        "ssize_t recvmmsg(int __fd, struct mmsghdr * __restrict __vmessages, size_t __vlen, int __flags, const struct timespec * __restrict __tmo)"
+        "-1"
+        "sys/types.h;sys/socket.h"
+        HAVE_RECVMMSG_SSIZE_T_CONST_TIMEOUT)
+endif (HAVE_RECVMMSG)
+
+if (HAVE_SENDMMSG)
+    # FreeBSD
+    check_prototype_definition(sendmmsg
+        "ssize_t sendmmsg(int __fd, struct mmsghdr * __restrict __vmessages, size_t __vlen, int __flags)"
+        "-1"
+        "sys/types.h;sys/socket.h"
+        HAVE_SENDMMSG_SSIZE_T)
+endif (HAVE_SENDMMSG)
+
 # IPV6
 check_c_source_compiles("
     #include <stdlib.h>