- correct package name
[m6w6/ext-http] / config.m4
1 dnl config.m4 for pecl/http
2 dnl $Id$
3
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
16 if test "$PHP_HTTP" != "no"; then
17
18 dnl -------
19 dnl NETDB.H
20 dnl -------
21 AC_MSG_CHECKING(for netdb.h)
22 if test -r /usr/include/netdb.h -o -r /usr/local/include/netdb.h; then
23 AC_DEFINE(HAVE_NETDB_H, 1, [Have netdb.h])
24 AC_MSG_RESULT(found in default path)
25 else
26 AC_MSG_RESULT(not found in default path)
27 fi
28
29 dnl ----
30 dnl CURL
31 dnl ----
32 if test "$PHP_HTTP_CURL_REQUESTS" != "no"; then
33
34 AC_MSG_CHECKING([for curl/curl.h])
35 CURL_DIR=
36 for i in "$PHP_HTTP_CURL_REQUESTS" /usr/local /usr /opt; do
37 if test -r "$i/include/curl/curl.h"; then
38 CURL_DIR=$i
39 break
40 fi
41 done
42 if test -z "$CURL_DIR"; then
43 AC_MSG_RESULT([not found])
44 AC_MSG_ERROR([could not find curl/curl.h])
45 else
46 AC_MSG_RESULT([found in $CURL_DIR])
47 fi
48
49 AC_MSG_CHECKING([for curl-config])
50 CURL_CONFIG=
51 for i in "$CURL_DIR/bin/curl-config" "$CURL_DIR/curl-config" `which curl-config`; do
52 if test -x "$i"; then
53 CURL_CONFIG=$i
54 break
55 fi
56 done
57 if test -z "$CURL_CONFIG"; then
58 AC_MSG_RESULT([not found])
59 AC_MSG_ERROR([could not find curl-config])
60 else
61 AC_MSG_RESULT([found: $CURL_CONFIG])
62 fi
63
64 CURL_SSL=`$CURL_CONFIG --features | $EGREP SSL`
65 if test "$CURL_SSL" == "SSL"; then
66 AC_DEFINE([HTTP_HAVE_SSL], [1], [ ])
67 fi
68 AC_CHECK_HEADERS([openssl/crypto.h])
69
70 CURL_LIBS=`$CURL_CONFIG --libs`
71
72 PHP_ADD_INCLUDE($CURL_DIR/include)
73 PHP_ADD_LIBRARY_WITH_PATH(curl, $CURL_DIR/$PHP_LIBDIR, HTTP_SHARED_LIBADD)
74 PHP_EVAL_LIBLINE($CURL_LIBS, HTTP_SHARED_LIBADD)
75 AC_DEFINE([HTTP_HAVE_CURL], [1], [Have cURL support])
76
77 PHP_CHECK_LIBRARY(curl, curl_multi_strerror,
78 [AC_DEFINE([HAVE_CURL_MULTI_STRERROR], [1], [ ])], [ ],
79 [$CURL_LIBS -L$CURL_DIR/$PHP_LIBDIR]
80 )
81 PHP_CHECK_LIBRARY(curl, curl_easy_strerror,
82 [AC_DEFINE([HAVE_CURL_EASY_STRERROR], [1], [ ])], [ ],
83 [$CURL_LIBS -L$CURL_DIR/$PHP_LIBDIR]
84 )
85 PHP_CHECK_LIBRARY(curl, curl_easy_reset,
86 [AC_DEFINE([HAVE_CURL_EASY_RESET], [1], [ ])], [ ],
87 [$CURL_LIBS -L$CURL_DIR/$PHP_LIBDIR]
88 )
89 fi
90
91 dnl ----
92 dnl MHASH
93 dnl ----
94 if test "$PHP_HTTP_MHASH_ETAGS" != "no"; then
95
96 AC_MSG_CHECKING([for mhash.h])
97 MHASH_DIR=
98 for i in "$PHP_HTTP_MHASH_ETAGS" /usr/local /usr /opt; do
99 if test -f "$i/include/mhash.h"; then
100 MHASH_DIR=$i
101 break
102 fi
103 done
104 if test -z "$MHASH_DIR"; then
105 AC_MSG_RESULT([not found])
106 AC_MSG_ERROR([could not find mhash.h])
107 else
108 AC_MSG_RESULT([found in $MHASH_DIR])
109 fi
110
111 PHP_ADD_INCLUDE($MHASH_DIR/include)
112 PHP_ADD_LIBRARY_WITH_PATH(mhash, $MHASH_DIR/$PHP_LIBDIR, HTTP_SHARED_LIBADD)
113 AC_DEFINE([HTTP_HAVE_MHASH], [1], [Have mhash support])
114 fi
115
116 dnl ----
117 dnl MAGIC
118 dnl ----
119 if test "$PHP_HTTP_MAGIC_MIME" != "no"; then
120
121 AC_MSG_CHECKING([for magic.h])
122 MAGIC_DIR=
123 for i in "$PHP_HTTP_MAGIC_MIME" /usr/local /usr /opt; do
124 if test -f "$i/include/magic.h"; then
125 MAGIC_DIR=$i
126 break
127 fi
128 done
129 if test -z "$MAGIC_DIR"; then
130 AC_MSG_RESULT([not found])
131 AC_MSG_ERROR([could not find magic.h])
132 else
133 AC_MSG_RESULT([found in $MAGIC_DIR])
134 fi
135
136 PHP_ADD_INCLUDE($MAGIC_DIR/include)
137 PHP_ADD_LIBRARY_WITH_PATH(magic, $MAGIC_DIR/$PHP_LIBDIR, HTTP_SHARED_LIBADD)
138 AC_DEFINE([HTTP_HAVE_MAGIC], [1], [Have magic mime support])
139 fi
140
141 dnl ----
142 dnl DONE
143 dnl ----
144 PHP_HTTP_SOURCES="missing.c http.c http_functions.c phpstr/phpstr.c \
145 http_util_object.c http_message_object.c http_request_object.c http_request_pool_api.c \
146 http_response_object.c http_exception_object.c http_requestpool_object.c \
147 http_api.c http_cache_api.c http_request_api.c http_date_api.c \
148 http_headers_api.c http_message_api.c http_send_api.c http_url_api.c \
149 http_info_api.c http_request_method_api.c"
150 PHP_NEW_EXTENSION([http], $PHP_HTTP_SOURCES, [$ext_shared])
151 PHP_ADD_BUILD_DIR($ext_builddir/phpstr, 1)
152 PHP_SUBST([HTTP_SHARED_LIBADD])
153
154 HTTP_HEADER_FILES="php_http_std_defs.h php_http.h php_http_api.h php_http_cache_api.h \
155 php_http_date_api.h php_http_headers_api.h php_http_info_api.h php_http_message_api.h \
156 php_http_request_api.h php_http_request_method_api.h php_http_send_api.h php_http_url_api.h"
157 PHP_SUBST([HTTP_HEADER_FILES])
158
159 ifdef([PHP_INSTALL_HEADERS],
160 [
161 PHP_INSTALL_HEADERS(ext/http, $HTTP_HEADER_FILES)
162 PHP_INSTALL_HEADERS(ext/http/phpstr, [phpstr/phpstr.h])
163 ], [
164 PHP_ADD_MAKEFILE_FRAGMENT
165 ])
166
167 AC_DEFINE([HAVE_HTTP], [1], [Have extended HTTP support])
168 fi