]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: sync HAVE_SIGNAL detection with autotools
authorViktor Szakats <commit@vsz.me>
Fri, 14 Oct 2022 18:06:30 +0000 (18:06 +0000)
committerViktor Szakats <commit@vsz.me>
Fri, 14 Oct 2022 18:06:30 +0000 (18:06 +0000)
`HAVE_SIGNAL` means the availability of the `signal()` function in
autotools, while in CMake it meant the availability of that function
_and_ the symbol `SIGALRM`.

The latter is not available on Windows, but the function is, which means
on Windows, autotools did define `HAVE_SIGNAL`, but CMake did not,
introducing a slight difference into the binaries.

This patch syncs CMake behaviour with autotools to look for the function
only.

The logic came with the initial commit adding CMake support to curl, so
the commit history doesn't reveal the reason behind it. In any case,
it's best to check the existence of `SIGALRM` directly in the source
before use. For now, curl builds fine with `HAVE_SIGNAL` enabled and
`SIGALRM` missing.

Follow-up to 68fa9bf3f5d7b4fcbb57619f70cb4aabb79a51f6

Closes #9725

CMake/Platforms/WindowsCache.cmake
CMakeLists.txt

index d6dc5a0fa8289699771039d0fbec7d786efb8da2..a9930f0b2a758e6be2c3f89d1a2dcedd57bd2d7d 100644 (file)
@@ -71,8 +71,7 @@ if(NOT UNIX)
     set(HAVE_RAND_EGD 0)
     set(HAVE_GMTIME_R 0)
     set(HAVE_GETHOSTBYNAME_R 0)
-    set(HAVE_SIGNAL_FUNC 1)
-    set(HAVE_SIGNAL_MACRO 0)
+    set(HAVE_SIGNAL 1)
 
     set(HAVE_GETHOSTBYNAME_R_3 0)
     set(HAVE_GETHOSTBYNAME_R_3_REENTRANT 0)
index 70ef457cf4df3da2c683dac6a68ef9c18c914aaa..e1704e34ac9fcdd036f75d082530de9b68b94d93 100644 (file)
@@ -1039,11 +1039,7 @@ check_symbol_exists(gmtime_r      "${CURL_INCLUDES}" HAVE_GMTIME_R)
 
 check_symbol_exists(gethostbyname_r "${CURL_INCLUDES}" HAVE_GETHOSTBYNAME_R)
 
-check_symbol_exists(signal        "${CURL_INCLUDES}" HAVE_SIGNAL_FUNC)
-check_symbol_exists(SIGALRM       "${CURL_INCLUDES}" HAVE_SIGNAL_MACRO)
-if(HAVE_SIGNAL_FUNC AND HAVE_SIGNAL_MACRO)
-  set(HAVE_SIGNAL 1)
-endif()
+check_symbol_exists(signal         "${CURL_INCLUDES}" HAVE_SIGNAL)
 check_symbol_exists(strtoll        "${CURL_INCLUDES}" HAVE_STRTOLL)
 check_symbol_exists(_strtoi64      "${CURL_INCLUDES}" HAVE__STRTOI64)
 check_symbol_exists(strerror_r     "${CURL_INCLUDES}" HAVE_STRERROR_R)