Merge topic 'dev/fix-cmcurl-try_run'

7e0b001 Fix missed _POLL_EMUL_H_ and HAVE_POLL combo
8a61950 Toss out strerror_r macros
44fca8b Check for poll when looking for _POLL_EMUL_H_
8d36890 Use _POLL_EMUL_H_ instead of HAVE_POLL_FINE
c5cbb31 Ignore strerror_r since CMake isn't threaded
This commit is contained in:
Brad King 2010-12-21 13:59:47 -05:00 committed by CMake Topic Stage
commit 5615ecf311
4 changed files with 3 additions and 66 deletions

View File

@ -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)

View File

@ -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

View File

@ -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,12 +345,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}
/* Define to 1 if you have the <process.h> header file. */
#cmakedefine HAVE_PROCESS_H ${HAVE_PROCESS_H}
@ -444,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}

View File

@ -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(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++;
}
#ifdef HAVE_POLL_FINE
#if defined(HAVE_POLL) && !defined(_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
#if defined(HAVE_POLL) && !defined(_POLL_EMUL_H_)
do {
r = poll(ufds, nfds, timeout_ms);
} while((r == -1) && (errno == EINTR));