Skip to content

Commit 091b385

Browse files
committed
Refactor check for curl linkage with old OpenSSL
This condition is so rare that is not relevant anymore neither it should complicate cross compiling scenarios.
1 parent 3b874ce commit 091b385

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

cmake/cmake/toolchains/template.cmake

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,14 +65,6 @@ set(PHP_SAPI_FPM_HAS_PTRACE_EXITCODE 0)
6565
# (/proc/<pid>/<mem-or-as>)
6666
set(PROC_MEM_FILE mem)
6767

68-
################################################################################
69-
# ext/curl
70-
################################################################################
71-
72-
# Set the exit code for the check whether the curl library is linked with
73-
# OpenSSL 1.1 or earlier.
74-
set(HAVE_CURL_OLD_OPENSSL_EXITCODE 4)
75-
7668
################################################################################
7769
# ext/gd
7870
################################################################################

cmake/ext/curl/CMakeLists.txt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,14 @@ target_link_libraries(php_ext_curl PRIVATE CURL::libcurl)
9595
# Check whether to link against OpenSSL to have crypto locking callbacks when
9696
# thread safety is enabled. If libcurl is linked against OpenSSL 1.1 or newer,
9797
# linking isn't needed anymore.
98-
if(PHP_THREAD_SAFETY AND CURL_SSL_FOUND)
98+
if(
99+
PHP_THREAD_SAFETY
100+
AND CURL_SSL_FOUND
101+
AND (
102+
NOT CMAKE_CROSSCOMPILING
103+
OR (CMAKE_CROSSCOMPILING AND CMAKE_CROSSCOMPILING_EMULATOR)
104+
)
105+
)
99106
message(CHECK_START "Checking if libcurl is linked against old OpenSSL < 1.1")
100107

101108
cmake_push_check_state(RESET)
@@ -145,12 +152,13 @@ if(PHP_THREAD_SAFETY AND CURL_SSL_FOUND)
145152
/* No SSL support */
146153
return 1;
147154
}
148-
]] HAVE_CURL_OLD_OPENSSL)
155+
]] PHP_EXT_CURL_HAS_CURL_OLD_OPENSSL)
149156
cmake_pop_check_state()
150157

151-
if(NOT HAVE_CURL_OLD_OPENSSL)
158+
if(NOT PHP_EXT_CURL_HAS_CURL_OLD_OPENSSL)
152159
message(CHECK_FAIL "no")
153160
else()
161+
set(HAVE_CURL_OLD_OPENSSL TRUE)
154162
message(CHECK_PASS "yes")
155163
find_package(OpenSSL ${PHP_OPENSSL_MIN_VERSION})
156164
set_package_properties(

0 commit comments

Comments
 (0)