This commit is contained in:
2024-05-21 19:23:06 +08:00
parent f4f4446a0a
commit 33106b9fbd
3 changed files with 7 additions and 0 deletions

View File

@@ -40,6 +40,7 @@ if (Iconv_FOUND)
set(HAVE_ICONV 1) set(HAVE_ICONV 1)
endif() endif()
include(CheckIncludeFile)
include(CheckSymbolExists) include(CheckSymbolExists)
include(TestStrerrorR) include(TestStrerrorR)
if (WIN32) if (WIN32)
@@ -97,6 +98,7 @@ if (NOT WIN32)
check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME) check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME)
check_symbol_exists(usleep "unistd.h" HAVE_USLEEP) check_symbol_exists(usleep "unistd.h" HAVE_USLEEP)
check_symbol_exists(nanosleep "time.h" HAVE_NANOSLEEP) check_symbol_exists(nanosleep "time.h" HAVE_NANOSLEEP)
CHECK_INCLUDE_FILE("netinet/in.h" HAVE_NETINET_IN_H)
endif() endif()
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/utils_config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/utils_config.h") configure_file("${CMAKE_CURRENT_SOURCE_DIR}/utils_config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/utils_config.h")

View File

@@ -6,6 +6,10 @@
#include <fcntl.h> #include <fcntl.h>
#if _WIN32 #if _WIN32
#include <Windows.h> #include <Windows.h>
#else
#if HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#endif #endif
#include "cstr_util.h" #include "cstr_util.h"

View File

@@ -29,3 +29,4 @@
#cmakedefine HAVE_CLOCK_GETTIME @HAVE_CLOCK_GETTIME@ #cmakedefine HAVE_CLOCK_GETTIME @HAVE_CLOCK_GETTIME@
#cmakedefine HAVE_USLEEP @HAVE_USLEEP@ #cmakedefine HAVE_USLEEP @HAVE_USLEEP@
#cmakedefine HAVE_NANOSLEEP @HAVE_NANOSLEEP@ #cmakedefine HAVE_NANOSLEEP @HAVE_NANOSLEEP@
#cmakedefine HAVE_NETINET_IN_H @HAVE_NETINET_IN_H@