Skip to content

Commit 9dbcb91

Browse files
authored
Refactor check for libcurl linkage with OpenSSL < 1.1 (php#14319)
- One excessive AC_MSG_RESULT removed - AC_RUN_IFELSE wrapped in AC_CACHE_CHECK for easier cross-compiling edge cases - Check wrapped in the thread safety condition since this is relevant only when ZTS is enabled
1 parent d1f14a4 commit 9dbcb91

File tree

1 file changed

+19
-23
lines changed

1 file changed

+19
-23
lines changed

ext/curl/config.m4

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,27 @@ if test "$PHP_CURL" != "no"; then
1111
PHP_EVAL_INCLINE($CURL_CFLAGS)
1212

1313
AC_MSG_CHECKING([for SSL support in libcurl])
14-
case "$CURL_FEATURES" in
15-
*SSL*)
14+
AS_CASE([$CURL_FEATURES],
15+
[*SSL*], [
1616
CURL_SSL=yes
1717
AC_MSG_RESULT([yes])
18-
;;
19-
*)
18+
],
19+
[*], [
2020
CURL_SSL=no
2121
AC_MSG_RESULT([no])
22-
;;
23-
esac
22+
])
2423

25-
if test "$CURL_SSL" = yes; then
24+
AS_IF([test "$PHP_THREAD_SAFETY" = yes && test "$CURL_SSL" = yes], [
2625
save_LDFLAGS="$LDFLAGS"
2726
LDFLAGS="$LDFLAGS $CURL_LIBS"
2827
29-
AC_MSG_CHECKING([for libcurl linked against old openssl])
30-
AC_RUN_IFELSE([AC_LANG_SOURCE([[
28+
AC_CACHE_CHECK([for libcurl linked against old OpenSSL < 1.1],
29+
[php_cv_lib_curl_ssl],
30+
[AC_RUN_IFELSE([AC_LANG_PROGRAM([
3131
#include <stdio.h>
3232
#include <strings.h>
3333
#include <curl/curl.h>
34-
35-
int main(int argc, char *argv[])
36-
{
34+
], [
3735
curl_version_info_data *data = curl_version_info(CURLVERSION_NOW);
3836
3937
if (data && data->ssl_version && *data->ssl_version) {
@@ -62,21 +60,19 @@ int main(int argc, char *argv[])
6260
}
6361
/* No SSL support */
6462
return 1;
65-
}
66-
]])],[
67-
AC_MSG_RESULT([yes])
63+
])],
64+
[php_cv_lib_curl_ssl=yes],
65+
[php_cv_lib_curl_ssl=no],
66+
[php_cv_lib_curl_ssl=no])])
67+
68+
AS_VAR_IF([php_cv_lib_curl_ssl], [yes], [
6869
AC_DEFINE([HAVE_CURL_OLD_OPENSSL], [1], [Have cURL with old OpenSSL])
69-
PHP_SETUP_OPENSSL(CURL_SHARED_LIBADD,[AC_CHECK_HEADERS([openssl/crypto.h])],[])
70-
], [
71-
AC_MSG_RESULT([no])
72-
], [
73-
AC_MSG_RESULT([no])
70+
PHP_SETUP_OPENSSL([CURL_SHARED_LIBADD],
71+
[AC_CHECK_HEADERS([openssl/crypto.h])])
7472
])
7573
7674
LDFLAGS="$save_LDFLAGS"
77-
else
78-
AC_MSG_RESULT([no])
79-
fi
75+
])
8076

8177
PHP_CHECK_LIBRARY(curl,curl_easy_perform,
8278
[

0 commit comments

Comments
 (0)