- fix libcurls used SSL library detection
authorMichael Wallner <mike@php.net>
Wed, 16 May 2007 21:03:18 +0000 (21:03 +0000)
committerMichael Wallner <mike@php.net>
Wed, 16 May 2007 21:03:18 +0000 (21:03 +0000)
# as of libcurl v7.16.2, curl-config doesn't longer list static deps

config9.m4

index bebb5a70c22836640bc2f526cb32bd9ba9b9748e..49ca9e4a2fc7f3fdf2198e879504a2404d873ffd 100644 (file)
@@ -178,39 +178,69 @@ dnl ----
                        AC_MSG_ERROR([libcurl version greater or equal to 7.12.3 required])
                fi
                
-               CURL_LIBS=`$CURL_CONFIG --libs`
-               
                AC_MSG_CHECKING([for SSL support in libcurl])
                CURL_SSL=`$CURL_CONFIG --feature | $EGREP SSL`
                if test "$CURL_SSL" = "SSL"; then
                        AC_MSG_RESULT([yes])
                        AC_DEFINE([HTTP_HAVE_SSL], [1], [ ])
                        
-                       AC_MSG_CHECKING([for SSL library used])
-                       CURL_SSL_FLAVOUR=
-                       for i in $CURL_LIBS; do
-                               case $i in
-                                       -lssl* | -lyassl*)
-                                               CURL_SSL_FLAVOUR="openssl"
-                                               AC_MSG_RESULT([openssl])
-                                               AC_DEFINE([HTTP_HAVE_OPENSSL], [1], [ ])
-                                               AC_CHECK_HEADERS([openssl/crypto.h])
-                                               break
-                                       ;;
-                                       -lgnutls*)
-                                               CURL_SSL_FLAVOUR="gnutls"
-                                               AC_MSG_RESULT([gnutls])
-                                               AC_DEFINE([HTTP_HAVE_GNUTLS], [1], [ ])
-                                               AC_CHECK_HEADERS([gcrypt.h])
-                                               break
-                                       ;;
-                               esac
-                       done
-                       if test -z "$CURL_SSL_FLAVOUR"; then
-                               AC_MSG_RESULT([unknown!])
-                               AC_MSG_WARN([Could not determine the type of SSL library used!])
-                               AC_MSG_WARN([Building will fail in ZTS mode!])
-                       fi
+                       save_CFLAGS="$CFLAGS"
+                       CFLAGS="`$CURL_CONFIG --cflags`"
+                       save_LDFLAGS="$LDFALGS"
+                       LDFLAGS="`$CURL_CONFIG --libs` -Wl,--rpath -Wl,$CURL_DIR/$PHP_LIBDIR"
+                       
+                       AC_CHECK_HEADER([openssl/crypto.h], [
+                               AC_MSG_CHECKING([for openssl support in libcurl])
+                               AC_TRY_RUN([
+                                       #include <curl/curl.h>
+                                       int main(int argc, char *argv[]) {
+                                               curl_version_info_data *data = curl_version_info(CURLVERSION_NOW);
+                                               if (data) {
+                                                       if (data->ssl_version && *data->ssl_version) {
+                                                               const char *ptr = data->ssl_version;
+                                                               while(*ptr == ' ') ++ptr;
+                                                               return strncasecmp(ptr, "OpenSSL", sizeof("OpenSSL")-1);
+                                                       }
+                                               }
+                                               return 1;
+                                       }
+                               ],[
+                                       AC_MSG_RESULT([yes])
+                                       AC_DEFINE([HTTP_HAVE_OPENSSL], [1], [ ])
+                               ], [
+                                       AC_MSG_RESULT([no])
+                               ], [
+                                       AC_MSG_RESULT([no])
+                               ])
+                       ])
+                       
+                       AC_CHECK_HEADER([gcrypt.h], [
+                               AC_MSG_CHECKING([for gnutls support in libcurl])
+                               AC_TRY_RUN([
+                                       #include <curl/curl.h>
+                                       int main(int argc, char *argv[]) {
+                                               curl_version_info_data *data = curl_version_info(CURLVERSION_NOW);
+                                               if (data) {
+                                                       if (data->ssl_version && *data->ssl_version) {
+                                                               const char *ptr = data->ssl_version;
+                                                               while(*ptr == ' ') ++ptr;
+                                                               return strncasecmp(ptr, "GnuTLS", sizeof("GnuTLS")-1);
+                                                       }
+                                               }
+                                               return 1;
+                                       }
+                               ], [
+                                       AC_MSG_RESULT([yes])
+                                       AC_DEFINE([HTTP_HAVE_GNUTLS], [1], [ ])
+                               ], [
+                                       AC_MSG_RESULT([no])
+                               ], [
+                                       AC_MSG_RESULT([no])
+                               ])
+                       ])
+                       
+                       CFLAGS="$save_CFLAGS"
+                       LDFLAGS="$save_LDFLAGS"
                else
                        AC_MSG_RESULT([no])
                fi