Skip to content

Commit 6aa9cfa

Browse files
committed
cmake: disable poll for macOS
Mirrors the autotools behavior introduced with curl-7_50_3-83-ga34c7ce. Fixes curl#1089
1 parent 4564636 commit 6aa9cfa

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

CMake/OtherTests.cmake

+14-11
Original file line numberDiff line numberDiff line change
@@ -179,17 +179,20 @@ int main(void) {
179179

180180

181181
include(CheckCSourceRuns)
182-
set(CMAKE_REQUIRED_FLAGS)
183-
if(HAVE_SYS_POLL_H)
184-
set(CMAKE_REQUIRED_FLAGS "-DHAVE_SYS_POLL_H")
185-
endif(HAVE_SYS_POLL_H)
186-
check_c_source_runs("
187-
#ifdef HAVE_SYS_POLL_H
188-
# include <sys/poll.h>
189-
#endif
190-
int main(void) {
191-
return poll((void *)0, 0, 10 /*ms*/);
192-
}" HAVE_POLL_FINE)
182+
# See HAVE_POLL in CMakeLists.txt for why poll is disabled on macOS
183+
if(NOT APPLE)
184+
set(CMAKE_REQUIRED_FLAGS)
185+
if(HAVE_SYS_POLL_H)
186+
set(CMAKE_REQUIRED_FLAGS "-DHAVE_SYS_POLL_H")
187+
endif(HAVE_SYS_POLL_H)
188+
check_c_source_runs("
189+
#ifdef HAVE_SYS_POLL_H
190+
# include <sys/poll.h>
191+
#endif
192+
int main(void) {
193+
return poll((void *)0, 0, 10 /*ms*/);
194+
}" HAVE_POLL_FINE)
195+
endif()
193196

194197
set(HAVE_SIG_ATOMIC_T 1)
195198
set(CMAKE_REQUIRED_FLAGS)

CMakeLists.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,11 @@ endif()
742742

743743
check_symbol_exists(basename "${CURL_INCLUDES}" HAVE_BASENAME)
744744
check_symbol_exists(socket "${CURL_INCLUDES}" HAVE_SOCKET)
745-
check_symbol_exists(poll "${CURL_INCLUDES}" HAVE_POLL)
745+
# poll on macOS is unreliable, it first did not exist, then was broken until
746+
# fixed in 10.9 only to break again in 10.12.
747+
if(NOT APPLE)
748+
check_symbol_exists(poll "${CURL_INCLUDES}" HAVE_POLL)
749+
endif()
746750
check_symbol_exists(select "${CURL_INCLUDES}" HAVE_SELECT)
747751
check_symbol_exists(strdup "${CURL_INCLUDES}" HAVE_STRDUP)
748752
check_symbol_exists(strstr "${CURL_INCLUDES}" HAVE_STRSTR)

0 commit comments

Comments
 (0)