1 dnl config.m4 for pecl/http
4 PHP_ARG_ENABLE([http], [whether to enable extended HTTP support],
5 [ --enable-http Enable extended HTTP support])
6 PHP_ARG_WITH([http-curl-requests], [whether to enable cURL HTTP requests],
7 [ --with-http-curl-requests[=CURLDIR]
8 With cURL HTTP request support])
9 PHP_ARG_WITH([http-mhash-etags], [whether to enable mhash ETag generator],
10 [ --with-http-mhash-etags[=MHASHDIR]
11 With mhash ETag generator support])
12 PHP_ARG_WITH([http-magic-mime], [whether to enable response content type guessing],
13 [ --with-http-magic-mime[=MAGICDIR]
14 With magic mime response content type guessing])
15 PHP_ARG_WITH([http-zlib-compression], [whether to enable support for gzencoded/deflated message bodies],
16 [ --with-http-zlib-compression[=ZLIBDIR]
17 With zlib gzdecode and inflate support])
19 if test "$PHP_HTTP" != "no"; then
24 AC_MSG_CHECKING(for netdb.h)
25 if test -r /usr/include/netdb.h -o -r /usr/local/include/netdb.h; then
26 AC_DEFINE(HAVE_NETDB_H, 1, [Have netdb.h])
27 AC_MSG_RESULT(found in default path)
29 AC_MSG_RESULT(not found in default path)
35 AC_MSG_CHECKING([for zlib.h])
37 for i in "$PHP_HTTP_ZLIB_COMPRESSION" "$PHP_ZLIB_DIR" "$PHP_ZLIB" /user/local /usr /opt; do
38 if test -r "$i/include/zlib.h"; then
43 if test -z "$ZLIB_DIR"; then
44 AC_MSG_RESULT([not found])
45 AC_MSG_WARN([gzip support not enabled; zlib.h not found])
47 AC_MSG_RESULT([found in $ZLIB_DIR])
48 PHP_ADD_INCLUDE($ZLIB_DIR/include)
49 PHP_ADD_LIBRARY_WITH_PATH(z, $ZLIB_DIR/$PHP_LIBDIR, HTTP_SHARED_LIBADD)
50 AC_DEFINE([HTTP_HAVE_ZLIB], [1], [Have zlib support])
56 if test "$PHP_HTTP_CURL_REQUESTS" != "no"; then
58 AC_MSG_CHECKING([for curl/curl.h])
60 for i in "$PHP_HTTP_CURL_REQUESTS" /usr/local /usr /opt; do
61 if test -r "$i/include/curl/curl.h"; then
66 if test -z "$CURL_DIR"; then
67 AC_MSG_RESULT([not found])
68 AC_MSG_ERROR([could not find curl/curl.h])
70 AC_MSG_RESULT([found in $CURL_DIR])
73 AC_MSG_CHECKING([for curl-config])
75 for i in "$CURL_DIR/bin/curl-config" "$CURL_DIR/curl-config" `which curl-config`; do
81 if test -z "$CURL_CONFIG"; then
82 AC_MSG_RESULT([not found])
83 AC_MSG_ERROR([could not find curl-config])
85 AC_MSG_RESULT([found: $CURL_CONFIG])
88 CURL_SSL=`$CURL_CONFIG --features | $EGREP SSL`
89 if test "$CURL_SSL" == "SSL"; then
90 AC_DEFINE([HTTP_HAVE_SSL], [1], [ ])
92 AC_CHECK_HEADERS([openssl/crypto.h])
94 CURL_LIBS=`$CURL_CONFIG --libs`
96 PHP_ADD_INCLUDE($CURL_DIR/include)
97 PHP_ADD_LIBRARY_WITH_PATH(curl, $CURL_DIR/$PHP_LIBDIR, HTTP_SHARED_LIBADD)
98 PHP_EVAL_LIBLINE($CURL_LIBS, HTTP_SHARED_LIBADD)
99 AC_DEFINE([HTTP_HAVE_CURL], [1], [Have cURL support])
101 PHP_CHECK_LIBRARY(curl, curl_multi_strerror,
102 [AC_DEFINE([HAVE_CURL_MULTI_STRERROR], [1], [ ])], [ ],
103 [$CURL_LIBS -L$CURL_DIR/$PHP_LIBDIR]
105 PHP_CHECK_LIBRARY(curl, curl_easy_strerror,
106 [AC_DEFINE([HAVE_CURL_EASY_STRERROR], [1], [ ])], [ ],
107 [$CURL_LIBS -L$CURL_DIR/$PHP_LIBDIR]
109 PHP_CHECK_LIBRARY(curl, curl_easy_reset,
110 [AC_DEFINE([HAVE_CURL_EASY_RESET], [1], [ ])], [ ],
111 [$CURL_LIBS -L$CURL_DIR/$PHP_LIBDIR]
118 if test "$PHP_HTTP_MHASH_ETAGS" != "no"; then
120 AC_MSG_CHECKING([for mhash.h])
122 for i in "$PHP_HTTP_MHASH_ETAGS" /usr/local /usr /opt; do
123 if test -f "$i/include/mhash.h"; then
128 if test -z "$MHASH_DIR"; then
129 AC_MSG_RESULT([not found])
130 AC_MSG_ERROR([could not find mhash.h])
132 AC_MSG_RESULT([found in $MHASH_DIR])
135 PHP_ADD_INCLUDE($MHASH_DIR/include)
136 PHP_ADD_LIBRARY_WITH_PATH(mhash, $MHASH_DIR/$PHP_LIBDIR, HTTP_SHARED_LIBADD)
137 AC_DEFINE([HTTP_HAVE_MHASH], [1], [Have mhash support])
143 if test "$PHP_HTTP_MAGIC_MIME" != "no"; then
145 AC_MSG_CHECKING([for magic.h])
147 for i in "$PHP_HTTP_MAGIC_MIME" /usr/local /usr /opt; do
148 if test -f "$i/include/magic.h"; then
153 if test -z "$MAGIC_DIR"; then
154 AC_MSG_RESULT([not found])
155 AC_MSG_ERROR([could not find magic.h])
157 AC_MSG_RESULT([found in $MAGIC_DIR])
160 PHP_ADD_INCLUDE($MAGIC_DIR/include)
161 PHP_ADD_LIBRARY_WITH_PATH(magic, $MAGIC_DIR/$PHP_LIBDIR, HTTP_SHARED_LIBADD)
162 AC_DEFINE([HTTP_HAVE_MAGIC], [1], [Have magic mime support])
168 PHP_HTTP_SOURCES="missing.c http.c http_functions.c phpstr/phpstr.c \
169 http_util_object.c http_message_object.c http_request_object.c http_request_pool_api.c \
170 http_response_object.c http_exception_object.c http_requestpool_object.c \
171 http_api.c http_cache_api.c http_request_api.c http_date_api.c \
172 http_headers_api.c http_message_api.c http_send_api.c http_url_api.c \
173 http_info_api.c http_request_method_api.c http_encoding_api.c"
174 PHP_NEW_EXTENSION([http], $PHP_HTTP_SOURCES, [$ext_shared])
175 PHP_ADD_BUILD_DIR($ext_builddir/phpstr, 1)
176 PHP_SUBST([HTTP_SHARED_LIBADD])
178 HTTP_HEADER_FILES="php_http_std_defs.h php_http.h php_http_api.h php_http_cache_api.h \
179 php_http_date_api.h php_http_headers_api.h php_http_info_api.h php_http_message_api.h \
180 php_http_request_api.h php_http_request_method_api.h php_http_send_api.h php_http_url_api.h \
181 php_http_encodig_api.h"
182 PHP_SUBST([HTTP_HEADER_FILES])
184 ifdef([PHP_INSTALL_HEADERS],
186 PHP_INSTALL_HEADERS(ext/http, $HTTP_HEADER_FILES)
187 PHP_INSTALL_HEADERS(ext/http/phpstr, [phpstr/phpstr.h])
189 PHP_ADD_MAKEFILE_FRAGMENT
192 AC_DEFINE([HAVE_HTTP], [1], [Have extended HTTP support])