26a5e918cd7c0e9e98abd753889f51b1e1afe9a5
[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 CTYPE
13 dnl -----
14 if test -r /usr/include/ctype.h -o -r /usr/local/include/ctype.h ; then
15 AC_DEFINE([HAVE_CTYPE], [1], [Have ctype support])
16 fi
17
18 dnl ----
19 dnl CURL
20 dnl ----
21 if test "$PHP_CURL" != "no"; then
22 if test -r $PHP_CURL/include/curl/easy.h; then
23 CURL_DIR=$PHP_CURL
24 else
25 AC_MSG_CHECKING(for CURL in default path)
26 for i in /usr/local /usr; do
27 if test -r $i/include/curl/easy.h; then
28 CURL_DIR=$i
29 AC_MSG_RESULT(found in $i)
30 break
31 fi
32 done
33 fi
34
35 if test -z "$CURL_DIR"; then
36 AC_MSG_RESULT(not found)
37 AC_MSG_ERROR(Please reinstall the libcurl distribution -
38 easy.h should be in <curl-dir>/include/curl/)
39 fi
40
41 CURL_CONFIG="curl-config"
42
43 if ${CURL_DIR}/bin/curl-config --libs print > /dev/null 2>&1; then
44 CURL_CONFIG=${CURL_DIR}/bin/curl-config
45 else
46 if ${CURL_DIR}/curl-config --libs print > /dev/null 2>&1; then
47 CURL_CONFIG=${CURL_DIR}/curl-config
48 fi
49 fi
50
51 PHP_ADD_INCLUDE($CURL_DIR/include)
52 PHP_EVAL_LIBLINE($CURL_LIBS, CURL_SHARED_LIBADD)
53 PHP_ADD_LIBRARY_WITH_PATH(curl, $CURL_DIR/lib, HTTP_SHARED_LIBADD)
54
55 PHP_CHECK_LIBRARY(curl,curl_easy_init,
56 [
57 AC_DEFINE(HAVE_CURL,1,[Have CURL easy support])
58 ],[
59 AC_MSG_ERROR(There is something wrong with libcurl. Please check config.log for more information.)
60 ],[
61 $CURL_LIBS -L$CURL_DIR/lib
62 ])
63
64 PHP_CHECK_LIBRARY(curl,curl_version_info,
65 [
66 AC_DEFINE(HAVE_CURL_VERSION_INFO,1,[ ])
67 ],[],[
68 $CURL_LIBS -L$CURL_DIR/lib
69 ])
70 fi
71
72 dnl ----
73 dnl DONE
74 dnl ----
75 PHP_NEW_EXTENSION([http], [http.c http_api.c], [$ext_shared])
76 PHP_SUBST([HTTP_SHARED_LIBADD])
77 AC_DEFINE([HAVE_HTTP], [1], [Have extended HTTP support])
78 fi