release 2.4.0
[m6w6/ext-http] / config9.m4
index 686b5ea286aaaca9349956f228a55c45eeef4457..02075136667636706976d8274c2af7eefe5099b0 100644 (file)
@@ -10,6 +10,8 @@ PHP_ARG_WITH([http-libcurl-dir], [],
 [  --with-http-libcurl-dir[=DIR]  HTTP: where to find libcurl], $PHP_HTTP, $PHP_HTTP)
 PHP_ARG_WITH([http-libevent-dir], [],
 [  --with-http-libevent-dir[=DIR] HTTP: where to find libevent], $PHP_HTTP_LIBCURL_DIR, "")
+PHP_ARG_WITH([http-libidn-dir], [],
+[  --with-http-libidn-dir=[=DIR]  HTTP: where to find libidn], $PHP_HTTP_LIBCURL_DIR, "")
 
 if test "$PHP_HTTP" != "no"; then
 
@@ -96,10 +98,41 @@ dnl ----
 dnl STDC
 dnl ----
        AC_TYPE_OFF_T
+       AC_TYPE_MBSTATE_T
        dnl getdomainname() is declared in netdb.h on some platforms: AIX, OSF
-       AC_CHECK_HEADERS([netdb.h unistd.h])
+       AC_CHECK_HEADERS([netdb.h unistd.h wchar.h wctype.h arpa/inet.h])
        PHP_CHECK_FUNC(gethostname, nsl)
        PHP_CHECK_FUNC(getdomainname, nsl)
+       PHP_CHECK_FUNC(mbrtowc)
+       PHP_CHECK_FUNC(mbtowc)
+       PHP_CHECK_FUNC(iswalnum)
+       PHP_CHECK_FUNC(inet_pton)
+
+dnl ----
+dnl IDN
+dnl ----
+
+       AC_MSG_CHECKING([for idna.h])
+       IDNA_DIR=
+       for i in "$PHP_HTTP_LIBIDN_DIR" "$IDN_DIR" /usr/local /usr /opt; do
+               if test -f "$i/include/idna.h"; then
+                       IDNA_DIR=$i
+                       break;
+               fi
+       done
+       if test "x$IDNA_DIR" = "x"; then
+               AC_MSG_RESULT([not found])
+               case $host_os in
+               darwin*)
+                       AC_CHECK_HEADERS(unicode/uidna.h)
+                       PHP_CHECK_FUNC(uidna_IDNToASCII, icucore);;
+               esac
+       else
+               AC_MSG_RESULT([found in $IDNA_DIR])
+               AC_DEFINE([PHP_HTTP_HAVE_IDN], [1], [Have libidn support])
+               PHP_ADD_INCLUDE($IDNA_DIR/include)
+               PHP_ADD_LIBRARY_WITH_PATH(idn, $IDNA_DIR/$PHP_LIBDIR, HTTP_SHARED_LIBADD)
+       fi
 
 dnl ----
 dnl ZLIB
@@ -174,6 +207,14 @@ dnl ----
                        if test `echo $CURL_VERSION | $SED -e 's/[[^0-9]]/ /g' | $AWK '{print $1*10000 + $2*100 + $3}'` -lt 71802; then
                                AC_MSG_ERROR([libcurl version greater or equal to 7.18.2 required])
                        fi
+                       
+                       AC_MSG_CHECKING([for HTTP2 support in libcurl])
+                       if $CURL_CONFIG --features | $EGREP -q HTTP2; then
+                               AC_MSG_RESULT([yes])
+                               AC_DEFINE([PHP_HTTP_HAVE_HTTP2], [1], [ ])
+                       else
+                               AC_MSG_RESULT([no])
+                       fi
                
                        dnl
                        dnl compile tests
@@ -182,11 +223,11 @@ dnl ----
                        save_INCLUDES="$INCLUDES"
                        INCLUDES=
                        save_LIBS="$LIBS"
-                       LIBS=
+                       LIBS=-lcurl
                        save_CFLAGS="$CFLAGS"
                        CFLAGS="$CFLAGS `$CURL_CONFIG --cflags`"
                        save_LDFLAGS="$LDFLAGS"
-                       LDFLAGS="$LDFLAGS `$CURL_CONFIG --libs` $ld_runpath_switch$CURL_DIR/$PHP_LIBDIR"
+                       LDFLAGS="$ld_runpath_switch$CURL_DIR/$PHP_LIBDIR"
                
                        AC_MSG_CHECKING([for SSL support in libcurl])
                        CURL_SSL=`$CURL_CONFIG --feature | $EGREP SSL`
@@ -268,6 +309,37 @@ dnl ----
                        ], [
                                AC_MSG_RESULT([no])
                        ])
+                       
+                       AC_MSG_CHECKING([whether CURLOPT_TLSAUTH_TYPE expects CURL_TLSAUTH_SRP or literal "SRP"])
+                       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);
+                               }
+                       ], [
+                               AC_MSG_RESULT([CURL_TLSAUTH_SRP])
+                               AC_DEFINE([PHP_HTTP_CURL_TLSAUTH_SRP], [CURL_TLSAUTH_SRP], [ ])
+                               AC_DEFINE([PHP_HTTP_CURL_TLSAUTH_DEF], [CURL_TLSAUTH_NONE], [ ])
+                       ], [
+                               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");
+                                       }
+                               ], [
+                                       AC_MSG_RESULT(["SRP"])
+                                       AC_DEFINE([PHP_HTTP_CURL_TLSAUTH_SRP], ["SRP"], [ ])
+                                       AC_DEFINE([PHP_HTTP_CURL_TLSAUTH_DEF], [""], [ ])
+                               ], [
+                                       AC_MSG_RESULT([neither])
+                               ], [
+                                       AC_MSG_RESULT([neither])
+                               ])                      
+                       ], [
+                               AC_MSG_RESULT([neither])
+                       ])
                
                        INCLUDES="$save_INCLUDES"
                        LIBS="$save_LIBS"
@@ -438,12 +510,6 @@ dnl ----
                fi
        ])
 
-dnl ----
-dnl JSON
-dnl ----
-       HTTP_HAVE_PHP_EXT([json])
-
-
 dnl ----
 dnl ICONV
 dnl ----
@@ -480,7 +546,6 @@ dnl ----
                php_http_options.c \
                php_http_params.c \
                php_http_querystring.c \
-               php_http_strlist.c \
                php_http_url.c \
                php_http_version.c \
        "
@@ -489,11 +554,10 @@ dnl ----
        dnl shared extension deps
        HTTP_SHARED_DEP([hash])
        HTTP_SHARED_DEP([iconv])
-       HTTP_SHARED_DEP([json])
        
        dnl extension deps
        PHP_ADD_EXTENSION_DEP([http], [raphf], true)
-       PHP_ADD_EXTENSION_DEP([http], [propo], true)
+       PHP_ADD_EXTENSION_DEP([http], [propro], true)
        
        PHP_SUBST([HTTP_SHARED_LIBADD])
 
@@ -532,8 +596,9 @@ dnl ----
                php_http_options.h \
                php_http_params.h \
                php_http_querystring.h \
-               php_http_strlist.h \
+               php_http_response_codes.h \
                php_http_url.h \
+               php_http_utf8.h \
                php_http_version.h \
        "
        PHP_INSTALL_HEADERS(ext/http, $PHP_HTTP_HEADERS)