From f6868a5e031b6fad37563b097762186bd6db2287 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Sun, 1 Nov 2020 11:24:31 +0100 Subject: [PATCH] context: properly check for sys/resource.h Instead of hardcoding where sys/resource.h is available, check for it using cmake. --- CMakeLists.txt | 1 + cmake/lws_config_private.h.in | 3 +++ lib/core/context.c | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 42abee885..a97fd1add 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -562,6 +562,7 @@ CHECK_INCLUDE_FILE(sys/capability.h LWS_HAVE_SYS_CAPABILITY_H) CHECK_INCLUDE_FILE(malloc.h LWS_HAVE_MALLOC_H) CHECK_INCLUDE_FILE(pthread.h LWS_HAVE_PTHREAD_H) CHECK_INCLUDE_FILE(inttypes.h LWS_HAVE_INTTYPES_H) +CHECK_INCLUDE_FILE(sys/resource.h LWS_HAVE_SYS_RESOURCE_H) if (WIN32 OR MSVC) CHECK_C_SOURCE_COMPILES("#include diff --git a/cmake/lws_config_private.h.in b/cmake/lws_config_private.h.in index 51c72fcde..7f61e4fcd 100644 --- a/cmake/lws_config_private.h.in +++ b/cmake/lws_config_private.h.in @@ -48,6 +48,9 @@ /* Define to 1 if you have the header file. */ #cmakedefine LWS_HAVE_SYS_PRCTL_H +/* Define to 1 if you have the header file. */ +#cmakedefine LWS_HAVE_SYS_RESOURCE_H + /* Define to 1 if you have the header file. */ #cmakedefine LWS_HAVE_SYS_SOCKET_H diff --git a/lib/core/context.c b/lib/core/context.c index 996d8b63d..33f563be3 100644 --- a/lib/core/context.c +++ b/lib/core/context.c @@ -30,7 +30,7 @@ static const char *library_version = LWS_LIBRARY_VERSION; -#if defined(__linux__) || defined(__FreeBSD__) || defined(__illumos__) +#if defined(LWS_HAVE_SYS_RESOURCE_H) /* for setrlimit */ #include #endif