- made low-lewel request pool object api more intuitive
[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 PHP_ARG_WITH([mhash], [for mhash support],
9 [ --with-mhash[=DIR] Include mhash support])
10
11 if test "$PHP_HTTP" != "no"; then
12
13 dnl -------
14 dnl NETDB.H
15 dnl -------
16
17 AC_MSG_CHECKING(for netdb.h)
18 if test -r /usr/include/netdb.h -o -r /usr/local/include/netdb.h; then
19 AC_DEFINE(HAVE_NETDB_H, 1, [Have netdb.h])
20 AC_MSG_RESULT(found in default path)
21 else
22 AC_MSG_RESULT(not found in default path)
23 fi
24
25 dnl ----
26 dnl CURL
27 dnl ----
28 if test "$PHP_CURL" != "no"; then
29 if test -r $PHP_CURL/include/curl/easy.h; then
30 CURL_DIR=$PHP_CURL
31 else
32 AC_MSG_CHECKING(for CURL in default path)
33 for i in /usr/local /usr; do
34 if test -r $i/include/curl/easy.h; then
35 CURL_DIR=$i
36 AC_MSG_RESULT(found in $i)
37 break
38 fi
39 done
40 fi
41
42 if test -z "$CURL_DIR"; then
43 AC_MSG_RESULT(not found)
44 AC_MSG_ERROR(Please reinstall the libcurl distribution -
45 easy.h should be in <curl-dir>/include/curl/)
46 fi
47
48 CURL_CONFIG="curl-config"
49
50 if ${CURL_DIR}/bin/curl-config --libs > /dev/null 2>&1; then
51 CURL_CONFIG=${CURL_DIR}/bin/curl-config
52 else
53 if ${CURL_DIR}/curl-config --libs > /dev/null 2>&1; then
54 CURL_CONFIG=${CURL_DIR}/curl-config
55 fi
56 fi
57
58 PHP_ADD_INCLUDE($CURL_DIR/include)
59 PHP_EVAL_LIBLINE($CURL_LIBS, CURL_SHARED_LIBADD)
60 PHP_ADD_LIBRARY_WITH_PATH(curl, $CURL_DIR/lib, HTTP_SHARED_LIBADD)
61
62 PHP_CHECK_LIBRARY(curl,curl_easy_init,
63 [
64 AC_DEFINE(HTTP_HAVE_CURL,1,[Have CURL easy support])
65 ],[
66 AC_MSG_ERROR(There is something wrong with libcurl. Please check config.log for more information.)
67 ],[
68 $CURL_LIBS -L$CURL_DIR/lib
69 ])
70
71 fi
72
73 dnl ----
74 dnl MHASH
75 dnl ----
76
77 if test "$PHP_MHASH" != "no"; then
78 for i in $PHP_MHASH /usr/local /usr /opt/mhash; do
79 test -f $i/include/mhash.h && MHASH_DIR=$i && break
80 done
81
82 if test -z "$MHASH_DIR"; then
83 AC_MSG_ERROR(Please reinstall libmhash - cannot find mhash.h)
84 fi
85
86 PHP_ADD_INCLUDE($MHASH_DIR/include)
87 PHP_ADD_LIBRARY_WITH_PATH(mhash, $MHASH_DIR/lib, MHASH_SHARED_LIBADD)
88 AC_DEFINE(HAVE_LIBMHASH,1,[HAve mhash support])
89 fi
90
91 dnl ----
92 dnl DONE
93 dnl ----
94 PHP_HTTP_SOURCES="missing.c http.c http_functions.c phpstr/phpstr.c \
95 http_util_object.c http_message_object.c http_request_object.c http_request_pool_api.c \
96 http_response_object.c http_exception_object.c http_requestpool_object.c \
97 http_api.c http_cache_api.c http_request_api.c http_date_api.c \
98 http_headers_api.c http_message_api.c http_send_api.c http_url_api.c \
99 http_info_api.c"
100 PHP_NEW_EXTENSION([http], $PHP_HTTP_SOURCES, [$ext_shared])
101 PHP_ADD_BUILD_DIR($ext_builddir/phpstr, 1)
102 PHP_SUBST([HTTP_SHARED_LIBADD])
103 PHP_ADD_MAKEFILE_FRAGMENT
104 AC_DEFINE([HAVE_HTTP], [1], [Have extended HTTP support])
105
106 dnl ---
107 dnl odd warnings
108 dnl ---
109 dnl CFLAGS=" -g -O2 -W -Wchar-subscripts -Wformat=2 -Wno-format-y2k -Wimplicit -Wmissing-braces -Wunused-variable -Wbad-function-cast -Wpointer-arith -Wsign-compare -Winline"
110 dnl PHP_SUBST([CFLAGS])
111
112 fi