fix tests for master
[m6w6/ext-http] / config9.m4
1 dnl config.m4 for pecl/http
2 dnl $Id: config9.m4 242664 2007-09-18 19:13:37Z mike $
3 dnl vim: noet ts=4 sw=4
4
5 PHP_ARG_WITH([http], [whether to enable extended HTTP support],
6 [ --with-http Enable extended HTTP support])
7 PHP_ARG_WITH([http-zlib-dir], [],
8 [ --with-http-zlib-dir[=DIR] HTTP: where to find zlib], $PHP_HTTP, $PHP_HTTP)
9 PHP_ARG_WITH([http-libcurl-dir], [],
10 [ --with-http-libcurl-dir[=DIR] HTTP: where to find libcurl], $PHP_HTTP, $PHP_HTTP)
11 PHP_ARG_WITH([http-libevent-dir], [],
12 [ --with-http-libevent-dir[=DIR] HTTP: where to find libevent], $PHP_HTTP_LIBCURL_DIR, "")
13 PHP_ARG_WITH([http-libidn-dir], [],
14 [ --with-http-libidn-dir[=DIR] HTTP: where to find libidn], $PHP_HTTP_LIBCURL_DIR, "")
15
16 if test "$PHP_HTTP" != "no"; then
17
18 HTTP_HAVE_A_REQUEST_LIB=false
19
20 ifdef([AC_PROG_EGREP], [
21 AC_PROG_EGREP
22 ], [
23 AC_CHECK_PROG(EGREP, egrep, egrep)
24 ])
25 ifdef([AC_PROG_SED], [
26 AC_PROG_SED
27 ], [
28 ifdef([LT_AC_PROG_SED], [
29 LT_AC_PROG_SED
30 ], [
31 AC_CHECK_PROG(SED, sed, sed)
32 ])
33 ])
34
35 AC_PROG_CPP
36
37 if test "$PHP_HTTP_SHARED_DEPS" != "no"; then
38 AC_DEFINE([PHP_HTTP_SHARED_DEPS], [1], [ ])
39 else
40 AC_DEFINE([PHP_HTTP_SHARED_DEPS], [0], [ ])
41 fi
42
43 dnl
44 dnl HTTP_SHARED_DEP(name[, code-if-yes[, code-if-not]])
45 dnl
46 AC_DEFUN([HTTP_SHARED_DEP], [
47 extname=$1
48 haveext=$[PHP_HTTP_HAVE_EXT_]translit($1,a-z_-,A-Z__)
49
50 AC_MSG_CHECKING([whether to add a dependency on ext/$extname])
51 if test "$PHP_HTTP_SHARED_DEPS" = "no"; then
52 AC_MSG_RESULT([no])
53 $3
54 elif test "$haveext"; then
55 AC_MSG_RESULT([yes])
56 AC_DEFINE([PHP_HTTP_HAVE_EXT_]translit($1,a-z_-,A-Z__), [1], [ ])
57 ifdef([PHP_ADD_EXTENSION_DEP], [
58 PHP_ADD_EXTENSION_DEP([http], $1, true)
59 ])
60 $2
61 else
62 AC_MSG_RESULT([no])
63 $3
64 fi
65 ])
66
67 dnl
68 dnl HTTP_HAVE_PHP_EXT(name[, code-if-yes[, code-if-not]])
69 dnl
70 AC_DEFUN([HTTP_HAVE_PHP_EXT], [
71 extname=$1
72 haveext=$[PHP_]translit($1,a-z_-,A-Z__)
73 AC_MSG_CHECKING([for ext/$extname support])
74 if test -x "$PHP_EXECUTABLE"; then
75 grepext=`$PHP_EXECUTABLE -m | $EGREP ^$extname\$`
76 if test "$grepext" = "$extname"; then
77 [PHP_HTTP_HAVE_EXT_]translit($1,a-z_-,A-Z__)=1
78 AC_MSG_RESULT([yes])
79 $2
80 else
81 [PHP_HTTP_HAVE_EXT_]translit($1,a-z_-,A-Z__)=
82 AC_MSG_RESULT([no])
83 $3
84 fi
85 elif test "$haveext" != "no" && test "x$haveext" != "x"; then
86 [PHP_HTTP_HAVE_EXT_]translit($1,a-z_-,A-Z__)=1
87 AC_MSG_RESULT([yes])
88 $2
89 else
90 [PHP_HTTP_HAVE_EXT_]translit($1,a-z_-,A-Z__)=
91 AC_MSG_RESULT([no])
92 $3
93 fi
94 ])
95
96 dnl
97 dnl HTTP_CURL_SSL_LIB_CHECK(ssllib[, code-if-yes[, code-if-not])
98 dnl
99 AC_DEFUN([HTTP_CURL_SSL_LIB_CHECK], [
100 AC_MSG_CHECKING([for $1 support in libcurl])
101 AC_TRY_RUN([
102 #include <curl/curl.h>
103 int main(int argc, char *argv[]) {
104 curl_version_info_data *data = curl_version_info(CURLVERSION_NOW);
105 if (data && data->ssl_version && *data->ssl_version) {
106 const char *ptr = data->ssl_version;
107 while(*ptr == ' ') ++ptr;
108 return strncasecmp(ptr, "$1", sizeof("$1")-1);
109 }
110 return 1;
111 }
112 ], [
113 AC_MSG_RESULT([yes])
114 $2
115 ], [
116 AC_MSG_RESULT([no])
117 $3
118 ], [
119 AC_MSG_RESULT([no])
120 $3
121 ])
122 ])
123
124
125 dnl ----
126 dnl STDC
127 dnl ----
128 AC_TYPE_OFF_T
129 AC_TYPE_MBSTATE_T
130 dnl getdomainname() is declared in netdb.h on some platforms: AIX, OSF
131 AC_CHECK_HEADERS([netdb.h unistd.h wchar.h wctype.h arpa/inet.h])
132 PHP_CHECK_FUNC(gethostname, nsl)
133 PHP_CHECK_FUNC(getdomainname, nsl)
134 PHP_CHECK_FUNC(mbrtowc)
135 PHP_CHECK_FUNC(mbtowc)
136 PHP_CHECK_FUNC(iswalnum)
137 PHP_CHECK_FUNC(inet_pton)
138
139 dnl ----
140 dnl IDN
141 dnl ----
142
143 AC_MSG_CHECKING([for idna.h])
144 IDNA_DIR=
145 for i in "$PHP_HTTP_LIBIDN_DIR" "$IDN_DIR" /usr/local /usr /opt; do
146 if test -f "$i/include/idna.h"; then
147 IDNA_DIR=$i
148 break;
149 fi
150 done
151 if test "x$IDNA_DIR" != "x"; then
152 AC_MSG_RESULT([found in $IDNA_DIR])
153 AC_DEFINE([PHP_HTTP_HAVE_IDN], [1], [Have libidn support])
154 PHP_ADD_INCLUDE($IDNA_DIR/include)
155 PHP_ADD_LIBRARY_WITH_PATH(idn, $IDNA_DIR/$PHP_LIBDIR, HTTP_SHARED_LIBADD)
156 AC_MSG_CHECKING([for libidn version])
157 IDNA_VER=$(pkg-config --version libidn 2>/dev/null || echo unknown)
158 AC_MSG_RESULT([$IDNA_VER])
159 AC_DEFINE_UNQUOTED([PHP_HTTP_LIBIDN_VERSION], "$IDNA_VER", [ ])
160 else
161 AC_MSG_RESULT([not found])
162 AC_MSG_CHECKING([for idn2.h])
163 IDNA_DIR=
164 for i in "$PHP_HTTP_LIBIDN_DIR" "$IDN_DIR" /usr/local /usr /opt; do
165 if test -f "$i/include/idn2.h"; then
166 IDNA_DIR=$i
167 break;
168 fi
169 done
170 if test "x$IDNA_DIR" != "x"; then
171 AC_MSG_RESULT([found in $IDNA_DIR])
172 AC_DEFINE([PHP_HTTP_HAVE_IDN2], [1], [Have libidn2 support])
173 PHP_ADD_INCLUDE($IDNA_DIR/include)
174 PHP_ADD_LIBRARY_WITH_PATH(idn2, $IDNA_DIR/$PHP_LIBDIR, HTTP_SHARED_LIBADD)
175 AC_MSG_CHECKING([for libidn2 version])
176 IDNA_VER=`$EGREP "define IDN2_VERSION " $IDNA_DIR/include/idn2.h | $SED -e's/^.*VERSION //g' -e 's/[[^0-9\.]]//g'`
177 AC_MSG_RESULT([$IDNA_VER])
178 AC_DEFINE_UNQUOTED([PHP_HTTP_LIBIDN2_VERSION], "$IDNA_VER", [ ])
179 else
180 AC_MSG_RESULT([not found])
181 AC_CHECK_HEADERS([unicode/uidna.h])
182 case $host_os in
183 darwin*)
184 PHP_CHECK_FUNC(uidna_IDNToASCII, icucore);;
185 *)
186 AC_PATH_PROG(ICU_CONFIG, icu-config, no, [$PATH:/usr/local/bin])
187 if test ! -x "$ICU_CONFIG"; then
188 ICU_CONFIG="icu-config"
189 fi
190 AC_MSG_CHECKING([for uidna_IDNToASCII])
191 if ! test -x "$ICU_CONFIG"; then
192 ICU_CONFIG=icu-config
193 fi
194 if $ICU_CONFIG --exists 2>/dev/null >&2; then
195 save_LIBS=$LIBS
196 LIBS=$($ICU_CONFIG --ldflags)
197 AC_TRY_RUN([
198 #include <unicode/uidna.h>
199 int main(int argc, char *argv[]) {
200 return uidna_IDNToASCII(0, 0, 0, 0, 0, 0, 0);
201 }
202 ], [
203 AC_MSG_RESULT([yes])
204 AC_DEFINE([HAVE_UIDNA_IDNTOASCII], [1], [ ])
205 LIBS=$save_LIBS
206 PHP_EVAL_LIBLINE(`$ICU_CONFIG --ldflags`, HTTP_SHARED_LIBADD)
207 ], [
208 LIBS=$save_LIBS
209 AC_MSG_RESULT([no])
210 ])
211 fi
212 ;;
213 esac
214 fi
215 fi
216
217 dnl ----
218 dnl ZLIB
219 dnl ----
220 AC_MSG_CHECKING([for zlib.h])
221 ZLIB_DIR=
222 for i in "$PHP_HTTP_ZLIB_DIR" "$PHP_ZLIB_DIR" "$PHP_ZLIB" /usr/local /usr /opt; do
223 if test -f "$i/include/zlib.h"; then
224 ZLIB_DIR=$i
225 break;
226 fi
227 done
228 if test "x$ZLIB_DIR" = "x"; then
229 AC_MSG_RESULT([not found])
230 AC_MSG_ERROR([could not find zlib.h])
231 else
232 AC_MSG_RESULT([found in $ZLIB_DIR])
233 AC_MSG_CHECKING([for zlib version >= 1.2.0.4])
234 ZLIB_VERSION=`$EGREP "define ZLIB_VERSION" $ZLIB_DIR/include/zlib.h | $SED -e 's/[[^0-9\.]]//g'`
235 AC_MSG_RESULT([$ZLIB_VERSION])
236 if test `echo $ZLIB_VERSION | $SED -e 's/[[^0-9]]/ /g' | $AWK '{print $1*1000000 + $2*10000 + $3*100 + $4}'` -lt 1020004; then
237 AC_MSG_ERROR([zlib version greater or equal to 1.2.0.4 required])
238 else
239 PHP_ADD_INCLUDE($ZLIB_DIR/include)
240 PHP_ADD_LIBRARY_WITH_PATH(z, $ZLIB_DIR/$PHP_LIBDIR, HTTP_SHARED_LIBADD)
241 fi
242 fi
243
244 dnl ----
245 dnl CURL
246 dnl ----
247
248 if test "$PHP_HTTP_LIBCURL_DIR" = "no"; then
249 AC_DEFINE([PHP_HTTP_HAVE_CURL], [0], [ ])
250 else
251 AC_MSG_CHECKING([for curl/curl.h])
252 CURL_DIR=
253 for i in "$PHP_HTTP_LIBCURL_DIR" /usr/local /usr /opt; do
254 if test -f "$i/include/curl/curl.h"; then
255 CURL_DIR=$i
256 break
257 fi
258 done
259 if test "x$CURL_DIR" = "x"; then
260 AC_MSG_RESULT([not found])
261 else
262 AC_MSG_RESULT([found in $CURL_DIR])
263
264 AC_MSG_CHECKING([for curl-config])
265 CURL_CONFIG=
266 for i in "$CURL_DIR/bin/curl-config" "$CURL_DIR/curl-config" `which curl-config`; do
267 if test -x "$i"; then
268 CURL_CONFIG=$i
269 break
270 fi
271 done
272 if test "x$CURL_CONFIG" = "x"; then
273 AC_MSG_RESULT([not found])
274 AC_MSG_ERROR([could not find curl-config])
275 else
276 AC_MSG_RESULT([found: $CURL_CONFIG])
277 fi
278
279 dnl RHEL6: 7.19.7
280 dnl SUSE11: 7.19.7
281 dnl Debian wheezy: 7.26.0
282 dnl Debian sqeeze: 7.21.0
283 dnl Debian ancient 7.18.2
284 AC_MSG_CHECKING([for curl version >= 7.18.2])
285 CURL_VERSION=`$CURL_CONFIG --version | $SED -e 's/[[^0-9\.]]//g'`
286 AC_MSG_RESULT([$CURL_VERSION])
287 if test `echo $CURL_VERSION | $SED -e 's/[[^0-9]]/ /g' | $AWK '{print $1*10000 + $2*100 + $3}'` -lt 71802; then
288 AC_MSG_ERROR([libcurl version greater or equal to 7.18.2 required])
289 fi
290
291 AC_MSG_CHECKING([for HTTP2 support in libcurl])
292 if $CURL_CONFIG --features | $EGREP -q HTTP2; then
293 AC_MSG_RESULT([yes])
294 AC_DEFINE([PHP_HTTP_HAVE_HTTP2], [1], [ ])
295 else
296 AC_MSG_RESULT([no])
297 fi
298
299 dnl
300 dnl compile tests
301 dnl
302
303 save_INCLUDES="$INCLUDES"
304 INCLUDES=
305 save_LIBS="$LIBS"
306 LIBS=-lcurl
307 save_CFLAGS="$CFLAGS"
308 CFLAGS="$CFLAGS `$CURL_CONFIG --cflags`"
309 save_LDFLAGS="$LDFLAGS"
310 LDFLAGS="$ld_runpath_switch$CURL_DIR/$PHP_LIBDIR"
311
312 AC_MSG_CHECKING([for SSL support in libcurl])
313 CURL_SSL=`$CURL_CONFIG --feature | $EGREP SSL`
314 CURL_SSL_LIBS=""
315 if test "$CURL_SSL" = "SSL"; then
316 AC_MSG_RESULT([yes])
317 AC_DEFINE([PHP_HTTP_HAVE_SSL], [1], [ ])
318
319 HTTP_CURL_SSL_LIB_CHECK(OpenSSL, [
320 AC_CHECK_HEADER([openssl/ssl.h], [
321 AC_CHECK_HEADER([openssl/crypto.h], [
322 AC_DEFINE([PHP_HTTP_HAVE_OPENSSL], [1], [ ])
323 CURL_SSL_LIBS="ssl crypto"
324 ])
325 ])
326 ])
327 HTTP_CURL_SSL_LIB_CHECK(GnuTLS, [
328 AC_CHECK_HEADER([gnutls.h], [
329 AC_CHECK_HEADER([gcrypt.h], [
330 AC_DEFINE([PHP_HTTP_HAVE_GNUTLS], [1], [ ])
331 CURL_SSL_LIBS="gnutls gcrypt"
332 ])
333 ])
334 ])
335 HTTP_CURL_SSL_LIB_CHECK(NSS, [
336 AC_DEFINE([PHP_HTTP_HAVE_NSS], [1], [ ])
337 ])
338 HTTP_CURL_SSL_LIB_CHECK(SecureTransport, [
339 AC_DEFINE([PHP_HTTP_HAVE_DARWINSSL], [1], [ ])
340 ])
341 HTTP_CURL_SSL_LIB_CHECK(GSKit, [
342 AC_DEFINE([PHP_HTTP_HAVE_GSKIT], [1], [ ])
343 ])
344 else
345 dnl no CURL_SSL
346 AC_MSG_RESULT([no])
347 fi
348
349 AC_MSG_CHECKING([for ares support in libcurl])
350 AC_TRY_RUN([
351 #include <curl/curl.h>
352 int main(int argc, char *argv[]) {
353 curl_version_info_data *data = curl_version_info(CURLVERSION_NOW);
354 if (data && data->ares && data->ares_num0) {
355 return 0;
356 }
357 return 1;
358 }
359 ], [
360 AC_MSG_RESULT([yes])
361 AC_DEFINE([PHP_HTTP_HAVE_ARES], [1], [ ])
362 ], [
363 AC_MSG_RESULT([no])
364 ], [
365 AC_MSG_RESULT([no])
366 ])
367
368 AC_MSG_CHECKING([whether CURLOPT_TLSAUTH_TYPE expects CURL_TLSAUTH_SRP or literal "SRP"])
369 AC_TRY_RUN([
370 #include <curl/curl.h>
371 int main(int argc, char *argv[]) {
372 CURL *ch = curl_easy_init();
373 return curl_easy_setopt(ch, CURLOPT_TLSAUTH_TYPE, CURL_TLSAUTH_SRP);
374 }
375 ], [
376 AC_MSG_RESULT([CURL_TLSAUTH_SRP])
377 AC_DEFINE([PHP_HTTP_CURL_TLSAUTH_SRP], [CURL_TLSAUTH_SRP], [ ])
378 AC_DEFINE([PHP_HTTP_CURL_TLSAUTH_DEF], [CURL_TLSAUTH_NONE], [ ])
379 ], [
380 AC_TRY_RUN([
381 #include <curl/curl.h>
382 int main(int argc, char *argv[]) {
383 CURL *ch = curl_easy_init();
384 return curl_easy_setopt(ch, CURLOPT_TLSAUTH_TYPE, "SRP");
385 }
386 ], [
387 AC_MSG_RESULT(["SRP"])
388 AC_DEFINE([PHP_HTTP_CURL_TLSAUTH_SRP], ["SRP"], [ ])
389 AC_DEFINE([PHP_HTTP_CURL_TLSAUTH_DEF], [""], [ ])
390 ], [
391 AC_MSG_RESULT([neither])
392 ], [
393 AC_MSG_RESULT([neither])
394 ])
395 ], [
396 AC_MSG_RESULT([neither])
397 ])
398
399 INCLUDES="$save_INCLUDES"
400 LIBS="$save_LIBS"
401 CFLAGS="$save_CFLAGS"
402 LDFLAGS="$save_LDFLAGS"
403
404 if test -n "$CURL_SSL_LIBS"; then
405 for CURL_SSL_LIB in $CURL_SSL_LIBS; do
406 PHP_ADD_LIBRARY_WITH_PATH([$CURL_SSL_LIB], $CURL_DIR/$PHP_LIBDIR, PHP_HTTP_SHARED_LIBADD)
407 done
408 fi
409
410 dnl end compile tests
411
412 AC_MSG_CHECKING([for default SSL CA info/path])
413 CURL_CA_PATH=
414 CURL_CA_INFO=
415 CURL_CONFIG_CA=$($CURL_CONFIG --ca)
416 if test -z "$CURL_CONFIG_CA"; then
417 CURL_CONFIG_CA=$($CURL_CONFIG --configure | $EGREP -o -- "--with-ca@<:@^'@:>@*" | $SED 's/.*=//')
418 fi
419 for i in \
420 "$CURL_CONFIG_CA" \
421 /etc/ssl/certs \
422 /etc/ssl/certs/ca-bundle.crt \
423 /etc/ssl/certs/ca-certificates.crt \
424 /etc/pki/tls/certs/ca-bundle.crt \
425 /etc/pki/tls/certs/ca-bundle.trust.crt \
426 /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem \
427 /System/Library/OpenSSL
428 do
429 if test -z "$CURL_CA_PATH" && test -d "$i"; then
430 # check if it's actually a hashed directory
431 if ls "$i"/@<:@0-9a-f@:>@@<:@0-9a-f@:>@@<:@0-9a-f@:>@@<:@0-9a-f@:>@@<:@0-9a-f@:>@@<:@0-9a-f@:>@@<:@0-9a-f@:>@@<:@0-9a-f@:>@.0 >/dev/null 2>&1; then
432 CURL_CA_PATH="$i"
433 fi
434 elif test -z "$CURL_CA_INFO" && test -f "$i"; then
435 CURL_CA_INFO="$i"
436 fi
437 done
438 if test -n "$CURL_CA_PATH" && test -n "$CURL_CA_INFO"; then
439 AC_MSG_RESULT([path:$CURL_CA_PATH, info:$CURL_CA_INFO])
440 AC_DEFINE_UNQUOTED([PHP_HTTP_CURL_CAPATH], ["$CURL_CA_PATH"], [path to default SSL CA path])
441 AC_DEFINE_UNQUOTED([PHP_HTTP_CURL_CAINFO], ["$CURL_CA_INFO"], [path to default SSL CA info])
442 elif test -n "$CURL_CA_INFO"; then
443 AC_MSG_RESULT([info:$CURL_CA_INFO])
444 AC_DEFINE_UNQUOTED([PHP_HTTP_CURL_CAINFO], ["$CURL_CA_INFO"], [path to default SSL CA info])
445 elif test -n "$CURL_CA_PATH"; then
446 AC_MSG_RESULT([path:$CURL_CA_PATH])
447 AC_DEFINE_UNQUOTED([PHP_HTTP_CURL_CAPATH], ["$CURL_CA_PATH"], [path to default SSL CA path])
448 else
449 AC_MSG_RESULT([none])
450 fi
451
452 PHP_ADD_INCLUDE($CURL_DIR/include)
453 PHP_ADD_LIBRARY_WITH_PATH(curl, $CURL_DIR/$PHP_LIBDIR, HTTP_SHARED_LIBADD)
454 PHP_EVAL_LIBLINE(`$CURL_CONFIG --libs`, HTTP_SHARED_LIBADD)
455 AC_DEFINE([PHP_HTTP_HAVE_CURL], [1], [Have libcurl support])
456 HTTP_HAVE_A_REQUEST_LIB=true
457 fi
458 fi
459
460 dnl ----
461 dnl EVENT
462 dnl ----
463
464 if test "$PHP_HTTP_LIBEVENT_DIR" = "no"; then
465 AC_DEFINE([PHP_HTTP_HAVE_EVENT], [0], [ ])
466 else
467 AC_MSG_CHECKING([for event2/event.h])
468 EVENT_DIR=
469 for i in "$PHP_HTTP_LIBEVENT_DIR" /usr/local /usr /opt; do
470 if test -f "$i/include/event.h"; then
471 EVENT_DIR=$i
472 break
473 fi
474 done
475 if test "x$EVENT_DIR" = "x"; then
476 AC_MSG_RESULT([not found])
477 AC_MSG_WARN([continuing without libevent support])
478 AC_DEFINE([PHP_HTTP_HAVE_EVENT], [0], [ ])
479 else
480 AC_MSG_RESULT([found in $EVENT_DIR])
481
482 AC_MSG_CHECKING([for libevent version, roughly])
483
484 if test -f "$EVENT_DIR/include/event2/event.h"; then
485 EVENT_VER="`$AWK '/_EVENT_VERSION/ {gsub(/\"/,\"\",$3); print $3}' < $EVENT_DIR/include/event2/event-config.h`"
486 AC_DEFINE([PHP_HTTP_HAVE_EVENT2], [1], [ ])
487 else
488 AC_DEFINE([PHP_HTTP_HAVE_EVENT2], [0], [ ])
489 if test -f "$EVENT_DIR/include/evhttp.h" && test -f "$EVENT_DIR/include/evdns.h"; then
490 if test -f "$EVENT_DIR/include/evrpc.h"; then
491 EVENT_VER="1.4 or greater"
492 else
493 EVENT_VER="1.2 or greater"
494 fi
495 else
496 EVENT_VER="1.1b or lower"
497 fi
498 fi
499 AC_DEFINE_UNQUOTED([PHP_HTTP_EVENT_VERSION], ["$EVENT_VER"], [ ])
500 AC_MSG_RESULT([$EVENT_VER])
501
502 PHP_ADD_INCLUDE($EVENT_DIR/include)
503 PHP_ADD_LIBRARY_WITH_PATH(event, $EVENT_DIR/$PHP_LIBDIR, HTTP_SHARED_LIBADD)
504 AC_DEFINE([PHP_HTTP_HAVE_EVENT], [1], [Have libevent support for cURL])
505 fi
506 fi
507
508 dnl ----
509 dnl RAPHF
510 dnl ----
511 HTTP_HAVE_PHP_EXT([raphf], [
512 AC_MSG_CHECKING([for php_raphf.h])
513 HTTP_EXT_RAPHF_INCDIR=
514 for i in `echo $INCLUDES | $SED -e's/-I//g'` $abs_srcdir ../raphf; do
515 if test -d $i; then
516 if test -f $i/php_raphf.h; then
517 HTTP_EXT_RAPHF_INCDIR=$i
518 break
519 elif test -f $i/ext/raphf/php_raphf.h; then
520 HTTP_EXT_RAPHF_INCDIR=$i/ext/raphf
521 break
522 fi
523 fi
524 done
525 if test "x$HTTP_EXT_RAPHF_INCDIR" = "x"; then
526 AC_MSG_ERROR([not found])
527 else
528 AC_MSG_RESULT([$HTTP_EXT_RAPHF_INCDIR])
529 AC_DEFINE([PHP_HTTP_HAVE_PHP_RAPHF_H], [1], [Have ext/raphf support])
530 PHP_ADD_INCLUDE([$HTTP_EXT_RAPHF_INCDIR])
531 fi
532 ], [
533 AC_MSG_ERROR([Please install pecl/raphf and activate extension=raphf.$SHLIB_DL_SUFFIX_NAME in your php.ini])
534 ])
535
536 dnl ----
537 dnl PROPRO
538 dnl ----
539 HTTP_HAVE_PHP_EXT([propro], [
540 AC_MSG_CHECKING([for php_propro.h])
541 HTTP_EXT_PROPRO_INCDIR=
542 for i in `echo $INCLUDES | $SED -e's/-I//g'` $abs_srcdir ../propro; do
543 if test -d $i; then
544 if test -f $i/php_propro.h; then
545 HTTP_EXT_PROPRO_INCDIR=$i
546 break
547 elif test -f $i/ext/propro/php_propro.h; then
548 HTTP_EXT_PROPRO_INCDIR=$i/ext/propro
549 break
550 fi
551 fi
552 done
553 if test "x$HTTP_EXT_PROPRO_INCDIR" = "x"; then
554 AC_MSG_ERROR([not found])
555 else
556 AC_MSG_RESULT([$HTTP_EXT_PROPRO_INCDIR])
557 AC_DEFINE([PHP_HTTP_HAVE_PHP_PROPRO_H], [1], [Have ext/propro support])
558 PHP_ADD_INCLUDE([$HTTP_EXT_PROPRO_INCDIR])
559 fi
560 ], [
561 AC_MSG_ERROR([Please install pecl/propro and activate extension=propro.$SHLIB_DL_SUFFIX_NAME in your php.ini])
562 ])
563
564 PHP_ARG_WITH([http-shared-deps], [whether to depend on extensions which have been built shared],
565 [ --without-http-shared-deps HTTP: do not depend on extensions like hash
566 and iconv (when they are built shared)], $PHP_HTTP, $PHP_HTTP)
567 dnl ----
568 dnl HASH
569 dnl ----
570 HTTP_HAVE_PHP_EXT([hash], [
571 AC_MSG_CHECKING([for php_hash.h])
572 HTTP_EXT_HASH_INCDIR=
573 for i in `echo $INCLUDES | $SED -e's/-I//g'` $abs_srcdir ../hash; do
574 if test -d $i; then
575 if test -f $i/php_hash.h; then
576 HTTP_EXT_HASH_INCDIR=$i
577 break
578 elif test -f $i/ext/hash/php_hash.h; then
579 HTTP_EXT_HASH_INCDIR=$i/ext/hash
580 break
581 fi
582 fi
583 done
584 if test "x$HTTP_EXT_HASH_INCDIR" = "x"; then
585 AC_MSG_RESULT([not found])
586 else
587 AC_MSG_RESULT([$HTTP_EXT_HASH_INCDIR])
588 AC_DEFINE([PHP_HTTP_HAVE_PHP_HASH_H], [1], [Have ext/hash support])
589 PHP_ADD_INCLUDE([$HTTP_EXT_HASH_INCDIR])
590 fi
591 ])
592
593 dnl ----
594 dnl ICONV
595 dnl ----
596 HTTP_HAVE_PHP_EXT([iconv])
597
598 dnl ----
599 dnl DONE
600 dnl ----
601
602 PHP_SUBST([HTTP_SHARED_LIBADD])
603
604 PHP_HTTP_SRCDIR=PHP_EXT_SRCDIR(http)
605 PHP_HTTP_BUILDDIR=PHP_EXT_BUILDDIR(http)
606
607 PHP_ADD_INCLUDE($PHP_HTTP_SRCDIR/src)
608 PHP_ADD_BUILD_DIR($PHP_HTTP_BUILDDIR/src)
609
610 PHP_HTTP_HEADERS=`(cd $PHP_HTTP_SRCDIR/src && echo *.h)`
611 PHP_HTTP_SOURCES=`(cd $PHP_HTTP_SRCDIR && echo src/*.c)`
612
613 PHP_NEW_EXTENSION(http, $PHP_HTTP_SOURCES, $ext_shared)
614 PHP_INSTALL_HEADERS(ext/http, php_http.h $PHP_HTTP_HEADERS)
615
616 HTTP_SHARED_DEP([hash])
617 HTTP_SHARED_DEP([iconv])
618 PHP_ADD_EXTENSION_DEP([http], [raphf], true)
619 PHP_ADD_EXTENSION_DEP([http], [propro], true)
620
621 PHP_SUBST(PHP_HTTP_HEADERS)
622 PHP_SUBST(PHP_HTTP_SOURCES)
623
624 PHP_SUBST(PHP_HTTP_SRCDIR)
625 PHP_SUBST(PHP_HTTP_BUILDDIR)
626
627 PHP_ADD_MAKEFILE_FRAGMENT
628
629 AC_DEFINE([HAVE_HTTP], [1], [Have extended HTTP support])
630 if $HTTP_HAVE_A_REQUEST_LIB; then
631 AC_DEFINE([PHP_HTTP_HAVE_CLIENT], [1], [Have HTTP client support])
632 fi
633 fi