Annotation of embedaddon/php/ext/curl/config.m4, revision 1.1

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>