1dnl 2dnl $Id$ 3dnl 4 5PHP_ARG_WITH(curl, for cURL support, 6[ --with-curl[=DIR] Include cURL support]) 7 8if test "$PHP_CURL" != "no"; then 9 if test -r $PHP_CURL/include/curl/easy.h; then 10 CURL_DIR=$PHP_CURL 11 else 12 AC_MSG_CHECKING(for cURL in default path) 13 for i in /usr/local /usr; do 14 if test -r $i/include/curl/easy.h; then 15 CURL_DIR=$i 16 AC_MSG_RESULT(found in $i) 17 break 18 fi 19 done 20 if test -z "$CURL_DIR"; then 21 AC_MSG_RESULT(not found) 22 if which dpkg-architecture>/dev/null; then 23 AC_MSG_CHECKING(for cURL in multiarch path) 24 CURL_MULTIARCH_INCLUDE=/usr/include/$(dpkg-architecture -qDEB_HOST_MULTIARCH) 25 if test -r $CURL_MULTIARCH_INCLUDE/curl/easy.h; then 26 CURL_DIR=/usr 27 AC_MSG_RESULT(found in $CURL_MULTIARCH_INCLUDE) 28 else 29 AC_MSG_RESULT(not found) 30 fi 31 fi 32 fi 33 fi 34 35 if test -z "$CURL_DIR"; then 36 AC_MSG_ERROR(Could not find cURL, please reinstall the libcurl distribution -dnl 37 easy.h should be in <curl-dir>/include/curl/) 38 fi 39 40 CURL_CONFIG="curl-config" 41 AC_MSG_CHECKING(for cURL 7.10.5 or greater) 42 43 if ${CURL_DIR}/bin/curl-config --libs > /dev/null 2>&1; then 44 CURL_CONFIG=${CURL_DIR}/bin/curl-config 45 else 46 if ${CURL_DIR}/curl-config --libs > /dev/null 2>&1; then 47 CURL_CONFIG=${CURL_DIR}/curl-config 48 fi 49 fi 50 51 curl_version_full=`$CURL_CONFIG --version` 52 curl_version=`echo ${curl_version_full} | sed -e 's/libcurl //' | $AWK 'BEGIN { FS = "."; } { printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'` 53 if test "$curl_version" -ge 7010005; then 54 AC_MSG_RESULT($curl_version_full) 55 CURL_LIBS=`$CURL_CONFIG --libs` 56 else 57 AC_MSG_ERROR(cURL version 7.10.5 or later is required to compile php with cURL support) 58 fi 59 60 if test -z "$CURL_MULTIARCH_INCLUDE"; then 61 PHP_ADD_INCLUDE($CURL_DIR/include) 62 else 63 PHP_ADD_INCLUDE($CURL_MULTIARCH_INCLUDE) 64 fi 65 PHP_EVAL_LIBLINE($CURL_LIBS, CURL_SHARED_LIBADD) 66 PHP_ADD_LIBRARY_WITH_PATH(curl, $CURL_DIR/$PHP_LIBDIR, CURL_SHARED_LIBADD) 67 68 AC_MSG_CHECKING([for SSL support in libcurl]) 69 CURL_SSL=`$CURL_CONFIG --feature | $EGREP SSL` 70 if test "$CURL_SSL" = "SSL"; then 71 AC_MSG_RESULT([yes]) 72 AC_DEFINE([HAVE_CURL_SSL], [1], [Have cURL with SSL support]) 73 74 save_CFLAGS="$CFLAGS" 75 CFLAGS="`$CURL_CONFIG --cflags`" 76 save_LDFLAGS="$LDFLAGS" 77 LDFLAGS="`$CURL_CONFIG --libs`" 78 79 AC_PROG_CPP 80 AC_MSG_CHECKING([for openssl support in libcurl]) 81 AC_TRY_RUN([ 82#include <curl/curl.h> 83 84int main(int argc, char *argv[]) 85{ 86 curl_version_info_data *data = curl_version_info(CURLVERSION_NOW); 87 88 if (data && data->ssl_version && *data->ssl_version) { 89 const char *ptr = data->ssl_version; 90 91 while(*ptr == ' ') ++ptr; 92 return strncasecmp(ptr, "OpenSSL", sizeof("OpenSSL")-1); 93 } 94 return 1; 95} 96 ],[ 97 AC_MSG_RESULT([yes]) 98 AC_CHECK_HEADERS([openssl/crypto.h], [ 99 AC_DEFINE([HAVE_CURL_OPENSSL], [1], [Have cURL with OpenSSL support]) 100 ]) 101 ], [ 102 AC_MSG_RESULT([no]) 103 ], [ 104 AC_MSG_RESULT([no]) 105 ]) 106 107 AC_MSG_CHECKING([for gnutls support in libcurl]) 108 AC_TRY_RUN([ 109#include <curl/curl.h> 110 111int main(int argc, char *argv[]) 112{ 113 curl_version_info_data *data = curl_version_info(CURLVERSION_NOW); 114 115 if (data && data->ssl_version && *data->ssl_version) { 116 const char *ptr = data->ssl_version; 117 118 while(*ptr == ' ') ++ptr; 119 return strncasecmp(ptr, "GnuTLS", sizeof("GnuTLS")-1); 120 } 121 return 1; 122} 123], [ 124 AC_MSG_RESULT([yes]) 125 AC_CHECK_HEADER([gcrypt.h], [ 126 AC_DEFINE([HAVE_CURL_GNUTLS], [1], [Have cURL with GnuTLS support]) 127 ]) 128 ], [ 129 AC_MSG_RESULT([no]) 130 ], [ 131 AC_MSG_RESULT([no]) 132 ]) 133 134 CFLAGS="$save_CFLAGS" 135 LDFLAGS="$save_LDFLAGS" 136 else 137 AC_MSG_RESULT([no]) 138 fi 139 140 PHP_CHECK_LIBRARY(curl,curl_easy_perform, 141 [ 142 AC_DEFINE(HAVE_CURL,1,[ ]) 143 ],[ 144 AC_MSG_ERROR(There is something wrong. Please check config.log for more information.) 145 ],[ 146 $CURL_LIBS -L$CURL_DIR/$PHP_LIBDIR 147 ]) 148 149 PHP_CHECK_LIBRARY(curl,curl_easy_strerror, 150 [ 151 AC_DEFINE(HAVE_CURL_EASY_STRERROR,1,[ ]) 152 ],[],[ 153 $CURL_LIBS -L$CURL_DIR/$PHP_LIBDIR 154 ]) 155 156 PHP_CHECK_LIBRARY(curl,curl_multi_strerror, 157 [ 158 AC_DEFINE(HAVE_CURL_MULTI_STRERROR,1,[ ]) 159 ],[],[ 160 $CURL_LIBS -L$CURL_DIR/$PHP_LIBDIR 161 ]) 162 163 PHP_NEW_EXTENSION(curl, interface.c multi.c share.c curl_file.c, $ext_shared) 164 PHP_SUBST(CURL_SHARED_LIBADD) 165fi 166