prepare v4.2.5
[m6w6/ext-http] / autoconf / pecl / libcurl.m4
index 22b24c6194663ae97b6cc1bed9d1fe75524c3bec..fd0e711ec05b8b920510e068929a893ed7bf8d9b 100644 (file)
@@ -7,7 +7,7 @@ dnl
 AC_DEFUN([PECL_HAVE_LIBCURL_FEATURE], [dnl
        AC_REQUIRE([PECL_PROG_EGREP])dnl
        AC_CACHE_CHECK([for $1 feature in libcurl], PECL_CACHE_VAR([HAVE_LIBCURL_FEATURE_$1]), [
-               if $CURL_CONFIG --feature | $EGREP -q $1; then
+               if $CURL_CONFIG --feature | $EGREP -qi $1; then
                        PECL_CACHE_VAR([HAVE_LIBCURL_FEATURE_$1])=yes
                else
                        PECL_CACHE_VAR([HAVE_LIBCURL_FEATURE_$1])=no
@@ -47,6 +47,7 @@ AC_DEFUN([PECL_HAVE_LIBCURL_SSLLIB], [
        if test -z "$PECL_VAR([LIBCURL_SSLLIB])"; then
                AC_CACHE_CHECK([for $1 providing SSL in libcurl], PECL_CACHE_VAR([HAVE_LIBCURL_$1]), [
                        AC_TRY_RUN([
+                               #include <strings.h>
                                #include <curl/curl.h>
                                int main(int argc, char *argv[]) {
                                        curl_version_info_data *data = curl_version_info(CURLVERSION_NOW);
@@ -87,7 +88,7 @@ AC_DEFUN([PECL_HAVE_LIBCURL_SSL], [dnl
        AC_REQUIRE([PECL_HAVE_LIBCURL_CA])dnl
        PECL_HAVE_LIBCURL_FEATURE([SSL], [
                PECL_HAVE_LIBCURL_SSLLIB([OpenSSL], [openssl/ssl.h openssl/crypto.h], [ssl crypto])
-               PECL_HAVE_LIBCURL_SSLLIB([GnuTLS], [gnutls.h gcrypt.h], [gnutls gcrypt])
+               PECL_HAVE_LIBCURL_SSLLIB([GnuTLS], [gnutls/gnutls.h gcrypt.h], [gnutls gcrypt])
                PECL_HAVE_LIBCURL_SSLLIB([NSS])
                PECL_HAVE_LIBCURL_SSLLIB([SecureTransport])
                PECL_HAVE_LIBCURL_SSLLIB([GSKit])
@@ -125,40 +126,66 @@ AC_DEFUN([PECL_HAVE_LIBCURL_SSL], [dnl
                        ;;
                esac
 
-               PECL_HAVE_CONST([curl/curl.h], [CURLOPT_TLSAUTH_TYPE], int, [
-                       AC_CACHE_CHECK([whether CURLOPT_TLSAUTH_TYPE expects CURL_TLSAUTH_SRP], PECL_CACHE_VAR([LIBCURL_TLSAUTH_SRP]), [
-                               PECL_CACHE_VAR([LIBCURL_TLSAUTH_SRP])=
+               PECL_HAVE_CONST([curl/curl.h], [CURL_VERSION_TLSAUTH_SRP], int, [
+                       AC_CACHE_CHECK([for CURLOPT_TLSAUTH_TYPE SRP support], PECL_CACHE_VAR([LIBCURL_TLSAUTH_SRP]), [
+                               PECL_CACHE_VAR([LIBCURL_TLSAUTH_SRP])=no
                                AC_TRY_RUN([
                                        #include <curl/curl.h>
                                        int main(int argc, char *argv[]) {
-                                               CURL *ch = curl_easy_init();
-                                               return curl_easy_setopt(ch, CURLOPT_TLSAUTH_TYPE, CURL_TLSAUTH_SRP);
+                                               int has_feature = curl_version_info(CURLVERSION_NOW)->features & CURL_VERSION_TLSAUTH_SRP;
+                                               int set_failure = curl_easy_setopt(curl_easy_init(), CURLOPT_TLSAUTH_TYPE, "SRP");
+                                               return !has_feature || set_failure;
                                        }
                                ], [
                                        PECL_CACHE_VAR([LIBCURL_TLSAUTH_SRP])=yes
+                               ])
+                       ])
+                       if test "$PECL_CACHE_VAR([LIBCURL_TLSAUTH_SRP])" = "yes"; then
+                               PECL_DEFINE([HAVE_LIBCURL_TLSAUTH_TYPE])
+                       fi
+               ])
+
+               PECL_HAVE_CONST([curl/curl.h], [CURL_LOCK_DATA_SSL_SESSION], int, [
+                       AC_CACHE_CHECK([whether curl_share accepts CURL_LOCK_DATA_SSL_SESSION], PECL_CACHE_VAR([LIBCURL_SHARE_SSL]), [
+                               PECL_CACHE_VAR([LIBCURL_SHARE_SSL])=
+                               AC_TRY_RUN([
+                                       #include <curl/curl.h>
+                                       int main(int argc, char *argv[]) {
+                                               CURLSH *ch = curl_share_init();
+                                               return curl_share_setopt(ch, CURLSHOPT_SHARE, CURL_LOCK_DATA_SSL_SESSION);
+                                       }
+                               ], [
+                                       PECL_CACHE_VAR([LIBCURL_SHARE_SSL])=yes
                                ], [
+                                       PECL_CACHE_VAR([LIBCURL_SHARE_SSL])=no
+                               ])
+                       ])
+                       if test "$PECL_CACHE_VAR([LIBCURL_SHARE_SSL])" = yes; then
+                               PECL_DEFINE([HAVE_LIBCURL_SHARE_SSL], [1])
+                       fi
+               ])
+
+               if test "$PECL_VAR([LIBCURL_SSLLIB])" == "OpenSSL"; then
+                       PECL_HAVE_CONST([curl/curl.h], [CURLOPT_TLS13_CIPHERS], int, [
+                               AC_CACHE_CHECK([whether curl_easy_setopt accepts CURLOPT_TLS13_CIPHERS], PECL_CACHE_VAR([LIBCURL_TLS13_CIPHERS]), [
+                                       PECL_CACHE_VAR([LIBCURL_TLS13_CIPHERS])=
                                        AC_TRY_RUN([
                                                #include <curl/curl.h>
                                                int main(int argc, char *argv[]) {
                                                        CURL *ch = curl_easy_init();
-                                                       return curl_easy_setopt(ch, CURLOPT_TLSAUTH_TYPE, "SRP");
+                                                       return curl_easy_setopt(ch, CURLSHOPT_TLS13_CIPHERS, "");
                                                }
                                        ], [
-                                               PECL_CACHE_VAR([LIBCURL_TLSAUTH_SRP])=no
+                                               PECL_CACHE_VAR([LIBCURL_TLS13_CIPHERS])=yes
+                                       ], [
+                                               PECL_CACHE_VAR([LIBCURL_TLS13_CIPHERS])=no
                                        ])
                                ])
-                       ])
-                       if test -n "$PECL_CACHE_VAR([LIBCURL_TLSAUTH_SRP])"; then
-                               PECL_DEFINE([HAVE_LIBCURL_TLSAUTH_TYPE])
-                               if $PECL_CACHE_VAR([LIBCURL_TLSAUTH_SRP]); then
-                                       PECL_DEFINE([LIBCURL_TLSAUTH_SRP], [CURL_TLSAUTH_SRP])
-                                       PECL_DEFINE([LIBCURL_TLSAUTH_DEF], [CURL_TLSAUTH_NONE])
-                               else
-                                       PECL_DEFINE([LIBCURL_TLSAUTH_SRP], ["SRP"])
-                                       PECL_DEFINE([LIBCURL_TLSAUTH_DEF], [""])
+                               if test "$PECL_CACHE_VAR([LIBCURL_TLS13_CIPHERS])" = yes; then
+                                       PECL_DEFINE([HAVE_LIBCURL_TLS13_CIPHERS], [1])
                                fi
-                       fi
-               ])
+                       ])
+               fi
        ])
 ])
 dnl
@@ -224,4 +251,4 @@ AC_DEFUN([PECL_CHECK_LIBCURL], [dnl
        ifelse([$2],,,[
                PECL_HAVE_VERSION([libcurl], [$2])
        ])
-])
\ No newline at end of file
+])