mirror of
https://github.com/moparisthebest/curl
synced 2025-02-28 09:21:50 -05:00
cmake: updated check for HAVE_POLL_FINE to match autotools
This commit is contained in:
parent
26d7f0094a
commit
99c2e7e554
@ -177,20 +177,48 @@ int main(void) {
|
|||||||
return 0;
|
return 0;
|
||||||
}" HAVE_STRUCT_TIMEVAL)
|
}" HAVE_STRUCT_TIMEVAL)
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
|
||||||
include(CheckCSourceRuns)
|
# if not cross-compilation...
|
||||||
# See HAVE_POLL in CMakeLists.txt for why poll is disabled on macOS
|
include(CheckCSourceRuns)
|
||||||
if(NOT APPLE)
|
set(CMAKE_REQUIRED_FLAGS "")
|
||||||
set(CMAKE_REQUIRED_FLAGS)
|
|
||||||
if(HAVE_SYS_POLL_H)
|
if(HAVE_SYS_POLL_H)
|
||||||
set(CMAKE_REQUIRED_FLAGS "-DHAVE_SYS_POLL_H")
|
set(CMAKE_REQUIRED_FLAGS "-DHAVE_SYS_POLL_H")
|
||||||
|
elseif(HAVE_POLL_H)
|
||||||
|
set(CMAKE_REQUIRED_FLAGS "-DHAVE_POLL_H")
|
||||||
endif()
|
endif()
|
||||||
check_c_source_runs("
|
check_c_source_runs("
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
#ifdef HAVE_SYS_POLL_H
|
#ifdef HAVE_SYS_POLL_H
|
||||||
# include <sys/poll.h>
|
# include <sys/poll.h>
|
||||||
|
#elif HAVE_POLL_H
|
||||||
|
# include <poll.h>
|
||||||
#endif
|
#endif
|
||||||
int main(void) {
|
|
||||||
return poll((void *)0, 0, 10 /*ms*/);
|
int main(void)
|
||||||
|
{
|
||||||
|
if(0 != poll(0, 0, 10)) {
|
||||||
|
return 1; /* fail */
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* detect the 10.12 poll() breakage */
|
||||||
|
struct timeval before, after;
|
||||||
|
int rc;
|
||||||
|
size_t us;
|
||||||
|
|
||||||
|
gettimeofday(&before, NULL);
|
||||||
|
rc = poll(NULL, 0, 500);
|
||||||
|
gettimeofday(&after, NULL);
|
||||||
|
|
||||||
|
us = (after.tv_sec - before.tv_sec) * 1000000 +
|
||||||
|
(after.tv_usec - before.tv_usec);
|
||||||
|
|
||||||
|
if(us < 400000) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}" HAVE_POLL_FINE)
|
}" HAVE_POLL_FINE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
# | (__| |_| | _ <| |___
|
# | (__| |_| | _ <| |___
|
||||||
# \___|\___/|_| \_\_____|
|
# \___|\___/|_| \_\_____|
|
||||||
#
|
#
|
||||||
# Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
|
# Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
#
|
#
|
||||||
# This software is licensed as described in the file COPYING, which
|
# This software is licensed as described in the file COPYING, which
|
||||||
# you should have received as part of this distribution. The terms
|
# you should have received as part of this distribution. The terms
|
||||||
@ -70,7 +70,6 @@ message(STATUS "curl version=[${CURL_VERSION}]")
|
|||||||
set(OPERATING_SYSTEM "${CMAKE_SYSTEM_NAME}")
|
set(OPERATING_SYSTEM "${CMAKE_SYSTEM_NAME}")
|
||||||
set(OS "\"${CMAKE_SYSTEM_NAME}\"")
|
set(OS "\"${CMAKE_SYSTEM_NAME}\"")
|
||||||
|
|
||||||
include_directories(${PROJECT_BINARY_DIR}/include/curl)
|
|
||||||
include_directories(${CURL_SOURCE_DIR}/include)
|
include_directories(${CURL_SOURCE_DIR}/include)
|
||||||
|
|
||||||
option(CURL_WERROR "Turn compiler warnings into errors" OFF)
|
option(CURL_WERROR "Turn compiler warnings into errors" OFF)
|
||||||
@ -828,12 +827,8 @@ endif()
|
|||||||
|
|
||||||
check_symbol_exists(basename "${CURL_INCLUDES}" HAVE_BASENAME)
|
check_symbol_exists(basename "${CURL_INCLUDES}" HAVE_BASENAME)
|
||||||
check_symbol_exists(socket "${CURL_INCLUDES}" HAVE_SOCKET)
|
check_symbol_exists(socket "${CURL_INCLUDES}" HAVE_SOCKET)
|
||||||
# poll on macOS is unreliable, it first did not exist, then was broken until
|
|
||||||
# fixed in 10.9 only to break again in 10.12.
|
|
||||||
if(NOT APPLE)
|
|
||||||
check_symbol_exists(poll "${CURL_INCLUDES}" HAVE_POLL)
|
|
||||||
endif()
|
|
||||||
check_symbol_exists(select "${CURL_INCLUDES}" HAVE_SELECT)
|
check_symbol_exists(select "${CURL_INCLUDES}" HAVE_SELECT)
|
||||||
|
check_symbol_exists(poll "${CURL_INCLUDES}" HAVE_POLL)
|
||||||
check_symbol_exists(strdup "${CURL_INCLUDES}" HAVE_STRDUP)
|
check_symbol_exists(strdup "${CURL_INCLUDES}" HAVE_STRDUP)
|
||||||
check_symbol_exists(strstr "${CURL_INCLUDES}" HAVE_STRSTR)
|
check_symbol_exists(strstr "${CURL_INCLUDES}" HAVE_STRSTR)
|
||||||
check_symbol_exists(strtok_r "${CURL_INCLUDES}" HAVE_STRTOK_R)
|
check_symbol_exists(strtok_r "${CURL_INCLUDES}" HAVE_STRTOK_R)
|
||||||
|
@ -384,9 +384,6 @@ problems may have been fixed or changed somewhat since this was written!
|
|||||||
|
|
||||||
- no nghttp2 check
|
- no nghttp2 check
|
||||||
|
|
||||||
- no check for what variadic macros that are supported. See
|
|
||||||
https://github.com/curl/curl/pull/3452
|
|
||||||
|
|
||||||
- unusable tool_hugehelp.c with MinGW, see
|
- unusable tool_hugehelp.c with MinGW, see
|
||||||
https://github.com/curl/curl/issues/3125
|
https://github.com/curl/curl/issues/3125
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user