- a header may have an array of values
[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([curl], [for CURL support],
7 [ --with-curl[=DIR] Include CURL support])
8
9 if test "$PHP_HTTP" != "no"; then
10
11 dnl -------
12 dnl NETDB.H
13 dnl -------
14
15 AC_MSG_CHECKING(for netdb.h)
16 if test -r /usr/include/netdb.h -o -r /usr/local/include/netdb.h; then
17 AC_DEFINE(HAVE_NETDB_H, 1, [Have netdb.h])
18 AC_MSG_RESULT(found in default path)
19 else
20 AC_MSG_RESULT(not found in default path)
21 fi
22
23 dnl ----
24 dnl CURL
25 dnl ----
26 if test "$PHP_CURL" != "no"; then
27 if test -r $PHP_CURL/include/curl/easy.h; then
28 CURL_DIR=$PHP_CURL
29 else
30 AC_MSG_CHECKING(for CURL in default path)
31 for i in /usr/local /usr; do
32 if test -r $i/include/curl/easy.h; then
33 CURL_DIR=$i
34 AC_MSG_RESULT(found in $i)
35 break
36 fi
37 done
38 fi
39
40 if test -z "$CURL_DIR"; then
41 AC_MSG_RESULT(not found)
42 AC_MSG_ERROR(Please reinstall the libcurl distribution -
43 easy.h should be in <curl-dir>/include/curl/)
44 fi
45
46 CURL_CONFIG="curl-config"
47
48 if ${CURL_DIR}/bin/curl-config --libs > /dev/null 2>&1; then
49 CURL_CONFIG=${CURL_DIR}/bin/curl-config
50 else
51 if ${CURL_DIR}/curl-config --libs > /dev/null 2>&1; then
52 CURL_CONFIG=${CURL_DIR}/curl-config
53 fi
54 fi
55
56 PHP_ADD_INCLUDE($CURL_DIR/include)
57 PHP_EVAL_LIBLINE($CURL_LIBS, CURL_SHARED_LIBADD)
58 PHP_ADD_LIBRARY_WITH_PATH(curl, $CURL_DIR/lib, HTTP_SHARED_LIBADD)
59
60 PHP_CHECK_LIBRARY(curl,curl_easy_init,
61 [
62 AC_DEFINE(HTTP_HAVE_CURL,1,[Have CURL easy support])
63 ],[
64 AC_MSG_ERROR(There is something wrong with libcurl. Please check config.log for more information.)
65 ],[
66 $CURL_LIBS -L$CURL_DIR/lib
67 ])
68
69 fi
70
71 dnl ----
72 dnl DONE
73 dnl ----
74 PHP_HTTP_SOURCES="http.c http_functions.c http_methods.c phpstr/phpstr.c \
75 http_api.c http_auth_api.c http_cache_api.c http_curl_api.c http_date_api.c \
76 http_headers_api.c http_message_api.c http_send_api.c http_url_api.c"
77 PHP_NEW_EXTENSION([http], $PHP_HTTP_SOURCES, [$ext_shared])
78 PHP_SUBST([HTTP_SHARED_LIBADD])
79 AC_DEFINE([HAVE_HTTP], [1], [Have extended HTTP support])
80 fi