From 477c4de95b33883b1370cd94069805e5914ea29e Mon Sep 17 00:00:00 2001 From: Greg Sjaardema Date: Wed, 2 Jun 2021 12:54:05 -0600 Subject: [PATCH 1/3] Clean up curl symbol tests * Set `CMAKE_REQUIRED_INCLUDES` to include the path found for `curl.h`. The `CHECK_C_SOURCE_COMPILES` function uses this and not the `INCLUDE_DIRECTORIES` * Make the test for version 7.66 or later match the same test in `configure.ac` * If the version is 7.66 or later, then we can skip the tests for the curl symbols which were all added in versions prior to 7.66. * If the version is earlier than 7.66, then continue to perform the tests. --- CMakeLists.txt | 100 ++++++++++++++++++++++++++++--------------------- 1 file changed, 57 insertions(+), 43 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d999a1458..a58313884 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -858,57 +858,71 @@ ELSE() SET(FOUND_CURL FALSE) ENDIF() -# Check to see if CURLOPT_USERNAME is defined. -# It is present starting version 7.19.1. -CHECK_C_SOURCE_COMPILES(" -#include -int main() {int x = CURLOPT_USERNAME;}" HAVE_CURLOPT_USERNAME) - -# Check to see if CURLOPT_PASSWORD is defined. -# It is present starting version 7.19.1. -CHECK_C_SOURCE_COMPILES(" -#include -int main() {int x = CURLOPT_PASSWORD;}" HAVE_CURLOPT_PASSWORD) - -# Check to see if CURLOPT_KEYPASSWD is defined. -# It is present starting version 7.16.4. -CHECK_C_SOURCE_COMPILES(" -#include -int main() {int x = CURLOPT_KEYPASSWD;}" HAVE_CURLOPT_KEYPASSWD) - -# Check to see if CURLINFO_RESPONSE_CODE is defined. -# It showed up in curl 7.10.7. -CHECK_C_SOURCE_COMPILES(" -#include -int main() {int x = CURLINFO_RESPONSE_CODE;}" HAVE_CURLINFO_RESPONSE_CODE) - -# Check to see if CURLINFO_HTTP_CONNECTCODE is defined. -# It showed up in curl 7.10.7. -CHECK_C_SOURCE_COMPILES(" -#include -int main() {int x = CURLINFO_HTTP_CONNECTCODE;}" HAVE_CURLINFO_HTTP_CONNECTCODE) - -# Check to see if CURLOPT_BUFFERSIZE is defined. -# It is present starting version 7.59 -CHECK_C_SOURCE_COMPILES(" -#include -int main() {int x = CURLOPT_BUFFERSIZE;}" HAVE_CURLOPT_BUFFERSIZE) - -# Check to see if CURLOPT_TCP_KEEPALIVE is defined. -# It is present starting version 7.25 -CHECK_C_SOURCE_COMPILES(" -#include -int main() {int x = CURLOPT_TCP_KEEPALIVE;}" HAVE_CURLOPT_KEEPALIVE) - +set (CMAKE_REQUIRED_INCLUDES ${CURL_INCLUDE_DIRS}) # Check to see if we have libcurl 7.66 or later CHECK_C_SOURCE_COMPILES(" #include int main() { -#if (LIBCURL_VERSION_MAJOR*1000 + LIBCURL_VERSION_MINOR < 7066) +#if LIBCURL_VERSION_NUM < 0x074200 choke me; #endif }" HAVE_LIBCURL_766) +IF (HAVE_LIBCURL_766) + # If libcurl version is >= 7.66, then can skip tests + # for these symbols which were added in an earlier version + set(HAVE_CURLOPT_USERNAME TRUE) + set(HAVE_CURLOPT_PASSWORD TRUE) + set(HAVE_CURLOPT_KEYPASSWD TRUE) + set(HAVE_CURLINFO_RESPONSE_CODE TRUE) + set(HAVE_CURLINFO_HTTP_CONNECTCODE TRUE) + set(HAVE_CURLOPT_BUFFERSIZE TRUE) + set(HAVE_CURLOPT_KEEPALIVE TRUE) + MESSAGE("-- Skipping CURL tests: ${HAVE_LIBCURL_766}") +ELSE() + # Check to see if CURLOPT_USERNAME is defined. + # It is present starting version 7.19.1. + CHECK_C_SOURCE_COMPILES(" + #include + int main() {int x = CURLOPT_USERNAME;}" HAVE_CURLOPT_USERNAME) + + # Check to see if CURLOPT_PASSWORD is defined. + # It is present starting version 7.19.1. + CHECK_C_SOURCE_COMPILES(" + #include + int main() {int x = CURLOPT_PASSWORD;}" HAVE_CURLOPT_PASSWORD) + + # Check to see if CURLOPT_KEYPASSWD is defined. + # It is present starting version 7.16.4. + CHECK_C_SOURCE_COMPILES(" + #include + int main() {int x = CURLOPT_KEYPASSWD;}" HAVE_CURLOPT_KEYPASSWD) + + # Check to see if CURLINFO_RESPONSE_CODE is defined. + # It showed up in curl 7.10.7. + CHECK_C_SOURCE_COMPILES(" + #include + int main() {int x = CURLINFO_RESPONSE_CODE;}" HAVE_CURLINFO_RESPONSE_CODE) + + # Check to see if CURLINFO_HTTP_CONNECTCODE is defined. + # It showed up in curl 7.10.7. + CHECK_C_SOURCE_COMPILES(" + #include + int main() {int x = CURLINFO_HTTP_CONNECTCODE;}" HAVE_CURLINFO_HTTP_CONNECTCODE) + + # Check to see if CURLOPT_BUFFERSIZE is defined. + # It is present starting version 7.59 + CHECK_C_SOURCE_COMPILES(" + #include + int main() {int x = CURLOPT_BUFFERSIZE;}" HAVE_CURLOPT_BUFFERSIZE) + + # Check to see if CURLOPT_TCP_KEEPALIVE is defined. + # It is present starting version 7.25 + CHECK_C_SOURCE_COMPILES(" + #include + int main() {int x = CURLOPT_TCP_KEEPALIVE;}" HAVE_CURLOPT_KEEPALIVE) +ENDIF() + IF(ENABLE_DAP) SET(USE_DAP ON CACHE BOOL "") SET(ENABLE_DAP2 ON CACHE BOOL "") From 31f0c80adec5c59e8d21cfc407d430f2d7337f13 Mon Sep 17 00:00:00 2001 From: Greg Sjaardema Date: Wed, 2 Jun 2021 12:55:36 -0600 Subject: [PATCH 2/3] Remove a debug print --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a58313884..78ccde7e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -878,7 +878,6 @@ IF (HAVE_LIBCURL_766) set(HAVE_CURLINFO_HTTP_CONNECTCODE TRUE) set(HAVE_CURLOPT_BUFFERSIZE TRUE) set(HAVE_CURLOPT_KEEPALIVE TRUE) - MESSAGE("-- Skipping CURL tests: ${HAVE_LIBCURL_766}") ELSE() # Check to see if CURLOPT_USERNAME is defined. # It is present starting version 7.19.1. From 4a18f6b54ea06513774ce426bab3b7770bcda092 Mon Sep 17 00:00:00 2001 From: Greg Sjaardema Date: Wed, 2 Jun 2021 12:55:50 -0600 Subject: [PATCH 3/3] Remove a debug print