From c5cbb318c5bc9c5bf0d5decb7c05b44853180cc0 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 16 Dec 2010 14:58:05 -0500 Subject: [PATCH 1/5] Ignore strerror_r since CMake isn't threaded --- Utilities/cmcurl/CMakeLists.txt | 43 --------------------------------- 1 file changed, 43 deletions(-) diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index 0f98e5a41..454d2d13d 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -521,42 +521,6 @@ MACRO(CURL_INTERNAL_TEST CURL_TEST) ENDIF("${CURL_TEST}" MATCHES "^${CURL_TEST}$") ENDMACRO(CURL_INTERNAL_TEST) -MACRO(CURL_INTERNAL_TEST_RUN CURL_TEST) - IF("${CURL_TEST}_COMPILE" MATCHES "^${CURL_TEST}_COMPILE$") - SET(MACRO_CHECK_FUNCTION_DEFINITIONS - "-D${CURL_TEST} ${CMAKE_REQUIRED_FLAGS}") - IF(CMAKE_REQUIRED_LIBRARIES) - SET(CURL_TEST_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - ENDIF(CMAKE_REQUIRED_LIBRARIES) - - MESSAGE(STATUS "Performing Curl Test ${CURL_TEST}") - TRY_RUN(${CURL_TEST} ${CURL_TEST}_COMPILE - ${CMAKE_BINARY_DIR} - ${LIBCURL_SOURCE_DIR}/CMake/CurlTests.c - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} - "${CURL_TEST_ADD_LIBRARIES}" - OUTPUT_VARIABLE OUTPUT) - IF(${CURL_TEST}_COMPILE AND NOT ${CURL_TEST}) - SET(${CURL_TEST} 1 CACHE INTERNAL "Curl test ${FUNCTION}") - MESSAGE(STATUS "Performing Curl Test ${CURL_TEST} - Success") - ELSE(${CURL_TEST}_COMPILE AND NOT ${CURL_TEST}) - MESSAGE(STATUS "Performing Curl Test ${CURL_TEST} - Failed") - SET(${CURL_TEST} "" CACHE INTERNAL "Curl test ${FUNCTION}") - FILE(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log" - "Performing Curl Test ${CURL_TEST} failed with the following output:\n" - "${OUTPUT}") - IF(${CURL_TEST}_COMPILE) - FILE(APPEND - "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log" - "There was a running problem of this test\n") - ENDIF(${CURL_TEST}_COMPILE) - FILE(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log" - "\n\n") - ENDIF(${CURL_TEST}_COMPILE AND NOT ${CURL_TEST}) - ENDIF("${CURL_TEST}_COMPILE" MATCHES "^${CURL_TEST}_COMPILE$") -ENDMACRO(CURL_INTERNAL_TEST_RUN) - # Do curl specific tests #OPTION(CURL_HAVE_DISABLED_NONBLOCKING "Disable non-blocking socket detection" OFF) SET(CURL_NONBLOCKING_TESTS) @@ -599,13 +563,6 @@ IF(HAVE_FILE_OFFSET_BITS) SET(_FILE_OFFSET_BITS 64) ENDIF(HAVE_FILE_OFFSET_BITS) -FOREACH(CURL_TEST - HAVE_GLIBC_STRERROR_R - HAVE_POSIX_STRERROR_R - ) - CURL_INTERNAL_TEST_RUN(${CURL_TEST}) -ENDFOREACH(CURL_TEST) - # Check for reentrant FOREACH(CURL_TEST HAVE_GETHOSTBYADDR_R_5 From 8d3689072394e6410c766eac9a8b0cae598f6500 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 16 Dec 2010 14:59:05 -0500 Subject: [PATCH 2/5] Use _POLL_EMUL_H_ instead of HAVE_POLL_FINE Headers define _POLL_EMUL_H_ if they are not in the kernel, so a try_run check for them is not necessary. --- Utilities/cmcurl/CMake/OtherTests.cmake | 8 -------- Utilities/cmcurl/config.h.in | 3 --- Utilities/cmcurl/select.c | 6 +++--- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/Utilities/cmcurl/CMake/OtherTests.cmake b/Utilities/cmcurl/CMake/OtherTests.cmake index ea1613d37..7d2c66fa1 100644 --- a/Utilities/cmcurl/CMake/OtherTests.cmake +++ b/Utilities/cmcurl/CMake/OtherTests.cmake @@ -193,14 +193,6 @@ SET(EXTRA_DEFINES "${EXTRA_DEFINES}\n${headers_hack}\n#define __unused5") CURL_CHECK_C_SOURCE_COMPILES("struct timeval ts;\nts.tv_sec = 0;\nts.tv_usec = 0" HAVE_STRUCT_TIMEVAL) -INCLUDE(CurlCheckCSourceRuns) -SET(EXTRA_DEFINES) -SET(HEADER_INCLUDES) -IF(HAVE_SYS_POLL_H) - SET(HEADER_INCLUDES "sys/poll.h") -ENDIF(HAVE_SYS_POLL_H) -CURL_CHECK_C_SOURCE_RUNS("return poll((void *)0, 0, 10 /*ms*/)" HAVE_POLL_FINE) - SET(HAVE_SIG_ATOMIC_T 1) SET(EXTRA_DEFINES) SET(HEADER_INCLUDES) diff --git a/Utilities/cmcurl/config.h.in b/Utilities/cmcurl/config.h.in index e3efdc142..72a1cd4e5 100644 --- a/Utilities/cmcurl/config.h.in +++ b/Utilities/cmcurl/config.h.in @@ -348,9 +348,6 @@ /* Define to 1 if you have the `poll' function. */ #cmakedefine HAVE_POLL ${HAVE_POLL} -/* If you have a fine poll */ -#cmakedefine HAVE_POLL_FINE ${HAVE_POLL_FINE} - /* we have a POSIX-style strerror_r() */ #cmakedefine HAVE_POSIX_STRERROR_R ${HAVE_POSIX_STRERROR_R} diff --git a/Utilities/cmcurl/select.c b/Utilities/cmcurl/select.c index d3967ed1e..3656edd1f 100644 --- a/Utilities/cmcurl/select.c +++ b/Utilities/cmcurl/select.c @@ -78,7 +78,7 @@ */ int Curl_select(curl_socket_t readfd, curl_socket_t writefd, int timeout_ms) { -#if defined(HAVE_POLL_FINE) || defined(CURL_HAVE_WSAPOLL) +#if !defined(_POLL_EMUL_H_) || defined(CURL_HAVE_WSAPOLL) struct pollfd pfd[2]; int num; int r; @@ -96,7 +96,7 @@ int Curl_select(curl_socket_t readfd, curl_socket_t writefd, int timeout_ms) num++; } -#ifdef HAVE_POLL_FINE +#ifndef _POLL_EMUL_H_ do { r = poll(pfd, num, timeout_ms); } while((r == -1) && (errno == EINTR)); @@ -220,7 +220,7 @@ int Curl_select(curl_socket_t readfd, curl_socket_t writefd, int timeout_ms) int Curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms) { int r; -#ifdef HAVE_POLL_FINE +#ifndef _POLL_EMUL_H_ do { r = poll(ufds, nfds, timeout_ms); } while((r == -1) && (errno == EINTR)); From 44fca8b51af2e198d2d2cc6a2ad5f18838f9d235 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 17 Dec 2010 11:18:04 -0500 Subject: [PATCH 3/5] Check for poll when looking for _POLL_EMUL_H_ --- Utilities/cmcurl/select.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Utilities/cmcurl/select.c b/Utilities/cmcurl/select.c index 3656edd1f..2bec8cbd2 100644 --- a/Utilities/cmcurl/select.c +++ b/Utilities/cmcurl/select.c @@ -78,7 +78,7 @@ */ int Curl_select(curl_socket_t readfd, curl_socket_t writefd, int timeout_ms) { -#if !defined(_POLL_EMUL_H_) || defined(CURL_HAVE_WSAPOLL) +#if (defined(HAVE_POLL) && !defined(_POLL_EMUL_H_)) || defined(CURL_HAVE_WSAPOLL) struct pollfd pfd[2]; int num; int r; @@ -96,7 +96,7 @@ int Curl_select(curl_socket_t readfd, curl_socket_t writefd, int timeout_ms) num++; } -#ifndef _POLL_EMUL_H_ +#if defined(HAVE_POLL) && !defined(_POLL_EMUL_H_) do { r = poll(pfd, num, timeout_ms); } while((r == -1) && (errno == EINTR)); From 8a61950e4223c551a291cb0cc25a7a0232b2690a Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 17 Dec 2010 11:31:15 -0500 Subject: [PATCH 4/5] Toss out strerror_r macros --- Utilities/cmcurl/config.h.in | 9 --------- 1 file changed, 9 deletions(-) diff --git a/Utilities/cmcurl/config.h.in b/Utilities/cmcurl/config.h.in index 72a1cd4e5..6e74935a3 100644 --- a/Utilities/cmcurl/config.h.in +++ b/Utilities/cmcurl/config.h.in @@ -171,9 +171,6 @@ /* Define to 1 if you have the `gettimeofday' function. */ #cmakedefine HAVE_GETTIMEOFDAY ${HAVE_GETTIMEOFDAY} -/* we have a glibc-style strerror_r() */ -#cmakedefine HAVE_GLIBC_STRERROR_R ${HAVE_GLIBC_STRERROR_R} - /* Define to 1 if you have the `gmtime_r' function. */ #cmakedefine HAVE_GMTIME_R ${HAVE_GMTIME_R} @@ -348,9 +345,6 @@ /* Define to 1 if you have the `poll' function. */ #cmakedefine HAVE_POLL ${HAVE_POLL} -/* we have a POSIX-style strerror_r() */ -#cmakedefine HAVE_POSIX_STRERROR_R ${HAVE_POSIX_STRERROR_R} - /* Define to 1 if you have the header file. */ #cmakedefine HAVE_PROCESS_H ${HAVE_PROCESS_H} @@ -441,9 +435,6 @@ /* Define to 1 if you have the `strdup' function. */ #cmakedefine HAVE_STRDUP ${HAVE_STRDUP} -/* Define to 1 if you have the `strerror_r' function. */ -#cmakedefine HAVE_STRERROR_R ${HAVE_STRERROR_R} - /* Define to 1 if you have the `stricmp' function. */ #cmakedefine HAVE_STRICMP ${HAVE_STRICMP} From 7e0b0014664d7db64ab13a31d0624e5d61b4227c Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Fri, 17 Dec 2010 11:41:30 -0500 Subject: [PATCH 5/5] Fix missed _POLL_EMUL_H_ and HAVE_POLL combo --- Utilities/cmcurl/select.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utilities/cmcurl/select.c b/Utilities/cmcurl/select.c index 2bec8cbd2..51adbcf37 100644 --- a/Utilities/cmcurl/select.c +++ b/Utilities/cmcurl/select.c @@ -220,7 +220,7 @@ int Curl_select(curl_socket_t readfd, curl_socket_t writefd, int timeout_ms) int Curl_poll(struct pollfd ufds[], unsigned int nfds, int timeout_ms) { int r; -#ifndef _POLL_EMUL_H_ +#if defined(HAVE_POLL) && !defined(_POLL_EMUL_H_) do { r = poll(ufds, nfds, timeout_ms); } while((r == -1) && (errno == EINTR));