diff --git a/CMakeLists.txt b/CMakeLists.txt index ca01c01..d54b30c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,7 @@ if (Iconv_FOUND) set(HAVE_ICONV 1) endif() +include(CheckIncludeFile) include(CheckSymbolExists) include(TestStrerrorR) if (WIN32) @@ -97,6 +98,7 @@ if (NOT WIN32) check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME) check_symbol_exists(usleep "unistd.h" HAVE_USLEEP) check_symbol_exists(nanosleep "time.h" HAVE_NANOSLEEP) + CHECK_INCLUDE_FILE("netinet/in.h" HAVE_NETINET_IN_H) endif() configure_file("${CMAKE_CURRENT_SOURCE_DIR}/utils_config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/utils_config.h") diff --git a/http_client.cpp b/http_client.cpp index 78ad978..6fb3b52 100644 --- a/http_client.cpp +++ b/http_client.cpp @@ -6,6 +6,10 @@ #include #if _WIN32 #include +#else +#if HAVE_NETINET_IN_H +#include +#endif #endif #include "cstr_util.h" diff --git a/utils_config.h.in b/utils_config.h.in index 25b207c..d5dc336 100644 --- a/utils_config.h.in +++ b/utils_config.h.in @@ -29,3 +29,4 @@ #cmakedefine HAVE_CLOCK_GETTIME @HAVE_CLOCK_GETTIME@ #cmakedefine HAVE_USLEEP @HAVE_USLEEP@ #cmakedefine HAVE_NANOSLEEP @HAVE_NANOSLEEP@ +#cmakedefine HAVE_NETINET_IN_H @HAVE_NETINET_IN_H@