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