- improve config.m4
[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], [wheter 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
13 if test "$PHP_HTTP" != "no"; then
14
15 dnl -------
16 dnl NETDB.H
17 dnl -------
18 AC_MSG_CHECKING(for netdb.h)
19 if test -r /usr/include/netdb.h -o -r /usr/local/include/netdb.h; then
20 AC_DEFINE(HAVE_NETDB_H, 1, [Have netdb.h])
21 AC_MSG_RESULT(found in default path)
22 else
23 AC_MSG_RESULT(not found in default path)
24 fi
25
26 dnl ----
27 dnl CURL
28 dnl ----
29 if test "$PHP_HTTP_CURL_REQUESTS" != "no"; then
30
31 AC_MSG_CHECKING([for curl/curl.h])
32 CURL_DIR=
33 for i in "$PHP_HTTP_CURL_REQUESTS" /usr/local /usr /opt; do
34 if test -r "$i/include/curl/curl.h"; then
35 CURL_DIR=$i
36 break
37 fi
38 done
39 if test -z "$CURL_DIR"; then
40 AC_MSG_RESULT([not found])
41 AC_MSG_ERROR([could not find curl/curl.h])
42 else
43 AC_MSG_RESULT([found in $CURL_DIR])
44 fi
45
46 AC_MSG_CHECKING([for curl-config])
47 CURL_CONFIG=
48 for i in "$CURL_DIR/bin/curl-config" "$CURL_DIR/curl-config" `which curl-config`; do
49 if test -x "$i"; then
50 CURL_CONFIG=$i
51 break
52 fi
53 done
54 if test -z "$CURL_CONFIG"; then
55 AC_MSG_RESULT([not found])
56 AC_MSG_ERROR([could not find curl-config])
57 else
58 AC_MSG_RESULT([found: $CURL_CONFIG])
59 fi
60
61 PHP_ADD_INCLUDE($CURL_DIR/include)
62 PHP_ADD_LIBRARY_WITH_PATH(curl, $CURL_DIR/$PHP_LIBDIR, HTTP_SHARED_LIBADD)
63 PHP_EVAL_LIBLINE(`$CURL_CONFIG --libs`, HTTP_SHARED_LIBADD)
64 AC_DEFINE([HTTP_HAVE_CURL], [1], [Have cURL support])
65
66 PHP_CHECK_LIBRARY(curl, curl_multi_strerror,
67 [AC_DEFINE([HAVE_CURL_MULTI_STRERROR], [1], [ ])], [ ],
68 [$CURL_LIBS -L$CURL_DIR/$PHP_LIBDIR]
69 )
70 fi
71
72 dnl ----
73 dnl MHASH
74 dnl ----
75 if test "$PHP_HTTP_MHASH_ETAGS" != "no"; then
76
77 AC_MSG_CHECKING([for mhash.h])
78 MHASH_DIR=
79 for i in "$PHP_HTTP_MHASH_ETAGS" /usr/local /usr /opt; do
80 if test -f "$i/include/mhash.h"; then
81 MHASH_DIR=$i
82 break
83 fi
84 done
85 if test -z "$MHASH_DIR"; then
86 AC_MSG_RESULT([not found])
87 AC_MSG_ERROR([could not find mhash.h])
88 else
89 AC_MSG_RESULT([found in $MHASH_DIR])
90 fi
91
92 PHP_ADD_INCLUDE($MHASH_DIR/include)
93 PHP_ADD_LIBRARY_WITH_PATH(mhash, $MHASH_DIR/$PHP_LIBDIR, HTTP_SHARED_LIBADD)
94 AC_DEFINE([HAVE_LIBMHASH], [1], [Have mhash support])
95 fi
96
97 dnl ----
98 dnl DONE
99 dnl ----
100 PHP_HTTP_SOURCES="missing.c http.c http_functions.c phpstr/phpstr.c \
101 http_util_object.c http_message_object.c http_request_object.c http_request_pool_api.c \
102 http_response_object.c http_exception_object.c http_requestpool_object.c \
103 http_api.c http_cache_api.c http_request_api.c http_date_api.c \
104 http_headers_api.c http_message_api.c http_send_api.c http_url_api.c \
105 http_info_api.c"
106 PHP_NEW_EXTENSION([http], $PHP_HTTP_SOURCES, [$ext_shared])
107 PHP_ADD_BUILD_DIR($ext_builddir/phpstr, 1)
108 PHP_SUBST([HTTP_SHARED_LIBADD])
109 PHP_ADD_MAKEFILE_FRAGMENT
110 AC_DEFINE([HAVE_HTTP], [1], [Have extended HTTP support])
111
112 dnl ---
113 dnl odd warnings
114 dnl ---
115 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"
116 dnl PHP_SUBST([CFLAGS])
117
118 fi