- MHASH_APINO is a number
[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 CURL_LIBS=`$CURL_CONFIG --libs`
62
63 PHP_ADD_INCLUDE($CURL_DIR/include)
64 PHP_ADD_LIBRARY_WITH_PATH(curl, $CURL_DIR/$PHP_LIBDIR, HTTP_SHARED_LIBADD)
65 PHP_EVAL_LIBLINE($CURL_LIBS, HTTP_SHARED_LIBADD)
66 AC_DEFINE([HTTP_HAVE_CURL], [1], [Have cURL support])
67
68 PHP_CHECK_LIBRARY(curl, curl_multi_strerror,
69 [AC_DEFINE([HAVE_CURL_MULTI_STRERROR], [1], [ ])], [ ],
70 [$CURL_LIBS -L$CURL_DIR/$PHP_LIBDIR]
71 )
72 PHP_CHECK_LIBRARY(curl, curl_easy_strerror,
73 [AC_DEFINE([HAVE_CURL_EASY_STRERROR], [1], [ ])], [ ],
74 [$CURL_LIBS -L$CURL_DIR/$PHP_LIBDIR]
75 )
76 fi
77
78 dnl ----
79 dnl MHASH
80 dnl ----
81 if test "$PHP_HTTP_MHASH_ETAGS" != "no"; then
82
83 AC_MSG_CHECKING([for mhash.h])
84 MHASH_DIR=
85 for i in "$PHP_HTTP_MHASH_ETAGS" /usr/local /usr /opt; do
86 if test -f "$i/include/mhash.h"; then
87 MHASH_DIR=$i
88 break
89 fi
90 done
91 if test -z "$MHASH_DIR"; then
92 AC_MSG_RESULT([not found])
93 AC_MSG_ERROR([could not find mhash.h])
94 else
95 AC_MSG_RESULT([found in $MHASH_DIR])
96 fi
97
98 PHP_ADD_INCLUDE($MHASH_DIR/include)
99 PHP_ADD_LIBRARY_WITH_PATH(mhash, $MHASH_DIR/$PHP_LIBDIR, HTTP_SHARED_LIBADD)
100 AC_DEFINE([HTTP_HAVE_MHASH], [1], [Have mhash support])
101 fi
102
103 dnl ----
104 dnl DONE
105 dnl ----
106 PHP_HTTP_SOURCES="missing.c http.c http_functions.c phpstr/phpstr.c \
107 http_util_object.c http_message_object.c http_request_object.c http_request_pool_api.c \
108 http_response_object.c http_exception_object.c http_requestpool_object.c \
109 http_api.c http_cache_api.c http_request_api.c http_date_api.c \
110 http_headers_api.c http_message_api.c http_send_api.c http_url_api.c \
111 http_info_api.c http_request_method_api.c"
112 PHP_NEW_EXTENSION([http], $PHP_HTTP_SOURCES, [$ext_shared])
113 PHP_ADD_BUILD_DIR($ext_builddir/phpstr, 1)
114 PHP_SUBST([HTTP_SHARED_LIBADD])
115 PHP_ADD_MAKEFILE_FRAGMENT
116 AC_DEFINE([HAVE_HTTP], [1], [Have extended HTTP support])
117
118 dnl ---
119 dnl odd warnings
120 dnl ---
121 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"
122 dnl PHP_SUBST([CFLAGS])
123
124 fi