diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-09-20 15:01:15 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-09-20 15:01:15 +0000 |
commit | f657a09229f26ecfaa8165baf7d4eb90b497558d (patch) | |
tree | 7fcaf582091d99549cb28bccdfb7587f29d4168d | |
parent | 505b3bc855342942b9a8746968ac9e1f4170ba7d (diff) | |
download | libmicrohttpd-f657a09229f26ecfaa8165baf7d4eb90b497558d.tar.gz libmicrohttpd-f657a09229f26ecfaa8165baf7d4eb90b497558d.zip |
-update curl checks
-rw-r--r-- | m4/libcurl.m4 | 109 |
1 files changed, 60 insertions, 49 deletions
diff --git a/m4/libcurl.m4 b/m4/libcurl.m4 index a9bfa2e2..01a0575c 100644 --- a/m4/libcurl.m4 +++ b/m4/libcurl.m4 | |||
@@ -55,9 +55,13 @@ AC_DEFUN([LIBCURL_CHECK_CONFIG], | |||
55 | AH_TEMPLATE([LIBCURL_PROTOCOL_LDAP],[Defined if libcurl supports LDAP]) | 55 | AH_TEMPLATE([LIBCURL_PROTOCOL_LDAP],[Defined if libcurl supports LDAP]) |
56 | AH_TEMPLATE([LIBCURL_PROTOCOL_DICT],[Defined if libcurl supports DICT]) | 56 | AH_TEMPLATE([LIBCURL_PROTOCOL_DICT],[Defined if libcurl supports DICT]) |
57 | AH_TEMPLATE([LIBCURL_PROTOCOL_TFTP],[Defined if libcurl supports TFTP]) | 57 | AH_TEMPLATE([LIBCURL_PROTOCOL_TFTP],[Defined if libcurl supports TFTP]) |
58 | AH_TEMPLATE([LIBCURL_PROTOCOL_RTSP],[Defined if libcurl supports RTSP]) | ||
59 | AH_TEMPLATE([LIBCURL_PROTOCOL_POP3],[Defined if libcurl supports POP3]) | ||
60 | AH_TEMPLATE([LIBCURL_PROTOCOL_IMAP],[Defined if libcurl supports IMAP]) | ||
61 | AH_TEMPLATE([LIBCURL_PROTOCOL_SMTP],[Defined if libcurl supports SMTP]) | ||
58 | 62 | ||
59 | AC_ARG_WITH(libcurl, | 63 | AC_ARG_WITH(libcurl, |
60 | AC_HELP_STRING([--with-libcurl=DIR],[look for the curl library in DIR]), | 64 | AC_HELP_STRING([--with-libcurl=PREFIX],[look for the curl library in PREFIX/lib and headers in PREFIX/include]), |
61 | [_libcurl_with=$withval],[_libcurl_with=ifelse([$1],,[yes],[$1])]) | 65 | [_libcurl_with=$withval],[_libcurl_with=ifelse([$1],,[yes],[$1])]) |
62 | 66 | ||
63 | if test "$_libcurl_with" != "no" ; then | 67 | if test "$_libcurl_with" != "no" ; then |
@@ -71,32 +75,33 @@ AC_DEFUN([LIBCURL_CHECK_CONFIG], | |||
71 | if test -d "$_libcurl_with" ; then | 75 | if test -d "$_libcurl_with" ; then |
72 | LIBCURL_CPPFLAGS="-I$withval/include" | 76 | LIBCURL_CPPFLAGS="-I$withval/include" |
73 | _libcurl_ldflags="-L$withval/lib" | 77 | _libcurl_ldflags="-L$withval/lib" |
74 | AC_PATH_PROG([_libcurl_config],["$withval/bin/curl-config"]) | 78 | AC_PATH_PROG([_libcurl_config],[curl-config],[], |
79 | ["$withval/bin"]) | ||
75 | else | 80 | else |
76 | AC_PATH_PROG([_libcurl_config],[curl-config]) | 81 | AC_PATH_PROG([_libcurl_config],[curl-config],[],[$PATH]) |
77 | fi | 82 | fi |
78 | 83 | ||
79 | if test x$_libcurl_config != "x" ; then | 84 | if test x$_libcurl_config != "x" ; then |
80 | AC_CACHE_CHECK([for the version of libcurl], | 85 | AC_CACHE_CHECK([for the version of libcurl], |
81 | [libcurl_cv_lib_curl_version], | 86 | [libcurl_cv_lib_curl_version], |
82 | [libcurl_cv_lib_curl_version=`$_libcurl_config --version | $AWK '{print $[]2}'`]) | 87 | [libcurl_cv_lib_curl_version=`$_libcurl_config --version | $AWK '{print $[]2}'`]) |
83 | 88 | ||
84 | _libcurl_version=`echo $libcurl_cv_lib_curl_version | $_libcurl_version_parse` | 89 | _libcurl_version=`echo $libcurl_cv_lib_curl_version | $_libcurl_version_parse` |
85 | _libcurl_wanted=`echo ifelse([$2],,[0],[$2]) | $_libcurl_version_parse` | 90 | _libcurl_wanted=`echo ifelse([$2],,[0],[$2]) | $_libcurl_version_parse` |
86 | 91 | ||
87 | if test $_libcurl_wanted -gt 0 ; then | 92 | if test $_libcurl_wanted -gt 0 ; then |
88 | AC_CACHE_CHECK([for libcurl >= version $2], | 93 | AC_CACHE_CHECK([for libcurl >= version $2], |
89 | [libcurl_cv_lib_version_ok], | 94 | [libcurl_cv_lib_version_ok], |
90 | [ | 95 | [ |
91 | if test $_libcurl_version -ge $_libcurl_wanted ; then | 96 | if test $_libcurl_version -ge $_libcurl_wanted ; then |
92 | libcurl_cv_lib_version_ok=yes | 97 | libcurl_cv_lib_version_ok=yes |
93 | else | 98 | else |
94 | libcurl_cv_lib_version_ok=no | 99 | libcurl_cv_lib_version_ok=no |
95 | fi | 100 | fi |
96 | ]) | 101 | ]) |
97 | fi | 102 | fi |
98 | 103 | ||
99 | if test $_libcurl_wanted -eq 0 || test x$libcurl_cv_lib_version_ok = xyes ; then | 104 | if test $_libcurl_wanted -eq 0 || test x$libcurl_cv_lib_version_ok = xyes ; then |
100 | if test x"$LIBCURL_CPPFLAGS" = "x" ; then | 105 | if test x"$LIBCURL_CPPFLAGS" = "x" ; then |
101 | LIBCURL_CPPFLAGS=`$_libcurl_config --cflags` | 106 | LIBCURL_CPPFLAGS=`$_libcurl_config --cflags` |
102 | fi | 107 | fi |
@@ -104,8 +109,8 @@ AC_DEFUN([LIBCURL_CHECK_CONFIG], | |||
104 | LIBCURL=`$_libcurl_config --libs` | 109 | LIBCURL=`$_libcurl_config --libs` |
105 | 110 | ||
106 | # This is so silly, but Apple actually has a bug in their | 111 | # This is so silly, but Apple actually has a bug in their |
107 | # curl-config script. Fixed in Tiger, but there are still | 112 | # curl-config script. Fixed in Tiger, but there are still |
108 | # lots of Panther installs around. | 113 | # lots of Panther installs around. |
109 | case "${host}" in | 114 | case "${host}" in |
110 | powerpc-apple-darwin7*) | 115 | powerpc-apple-darwin7*) |
111 | LIBCURL=`echo $LIBCURL | sed -e 's|-arch i386||g'` | 116 | LIBCURL=`echo $LIBCURL | sed -e 's|-arch i386||g'` |
@@ -113,18 +118,18 @@ AC_DEFUN([LIBCURL_CHECK_CONFIG], | |||
113 | esac | 118 | esac |
114 | fi | 119 | fi |
115 | 120 | ||
116 | # All curl-config scripts support --feature | 121 | # All curl-config scripts support --feature |
117 | _libcurl_features=`$_libcurl_config --feature` | 122 | _libcurl_features=`$_libcurl_config --feature` |
118 | 123 | ||
119 | # Is it modern enough to have --protocols? (7.12.4) | 124 | # Is it modern enough to have --protocols? (7.12.4) |
120 | if test $_libcurl_version -ge 461828 ; then | 125 | if test $_libcurl_version -ge 461828 ; then |
121 | _libcurl_protocols=`$_libcurl_config --protocols` | 126 | _libcurl_protocols=`$_libcurl_config --protocols` |
122 | fi | 127 | fi |
123 | else | 128 | else |
124 | _libcurl_try_link=no | 129 | _libcurl_try_link=no |
125 | fi | 130 | fi |
126 | 131 | ||
127 | unset _libcurl_wanted | 132 | unset _libcurl_wanted |
128 | fi | 133 | fi |
129 | 134 | ||
130 | if test $_libcurl_try_link = yes ; then | 135 | if test $_libcurl_try_link = yes ; then |
@@ -141,7 +146,7 @@ AC_DEFUN([LIBCURL_CHECK_CONFIG], | |||
141 | _libcurl_save_libs=$LIBS | 146 | _libcurl_save_libs=$LIBS |
142 | LIBS="$LIBCURL $LIBS" | 147 | LIBS="$LIBCURL $LIBS" |
143 | 148 | ||
144 | AC_LINK_IFELSE(AC_LANG_PROGRAM([#include <curl/curl.h>],[ | 149 | AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <curl/curl.h>],[ |
145 | /* Try and use a few common options to force a failure if we are | 150 | /* Try and use a few common options to force a failure if we are |
146 | missing symbols or can't link. */ | 151 | missing symbols or can't link. */ |
147 | int x; | 152 | int x; |
@@ -152,7 +157,7 @@ x=CURLOPT_FILE; | |||
152 | x=CURLOPT_ERRORBUFFER; | 157 | x=CURLOPT_ERRORBUFFER; |
153 | x=CURLOPT_STDERR; | 158 | x=CURLOPT_STDERR; |
154 | x=CURLOPT_VERBOSE; | 159 | x=CURLOPT_VERBOSE; |
155 | ]),libcurl_cv_lib_curl_usable=yes,libcurl_cv_lib_curl_usable=no) | 160 | ])],libcurl_cv_lib_curl_usable=yes,libcurl_cv_lib_curl_usable=no) |
156 | 161 | ||
157 | CPPFLAGS=$_libcurl_save_cppflags | 162 | CPPFLAGS=$_libcurl_save_cppflags |
158 | LIBS=$_libcurl_save_libs | 163 | LIBS=$_libcurl_save_libs |
@@ -162,8 +167,8 @@ x=CURLOPT_VERBOSE; | |||
162 | 167 | ||
163 | if test $libcurl_cv_lib_curl_usable = yes ; then | 168 | if test $libcurl_cv_lib_curl_usable = yes ; then |
164 | 169 | ||
165 | # Does curl_free() exist in this version of libcurl? | 170 | # Does curl_free() exist in this version of libcurl? |
166 | # If not, fake it with free() | 171 | # If not, fake it with free() |
167 | 172 | ||
168 | _libcurl_save_cppflags=$CPPFLAGS | 173 | _libcurl_save_cppflags=$CPPFLAGS |
169 | CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS" | 174 | CPPFLAGS="$CPPFLAGS $LIBCURL_CPPFLAGS" |
@@ -171,8 +176,8 @@ x=CURLOPT_VERBOSE; | |||
171 | LIBS="$LIBS $LIBCURL" | 176 | LIBS="$LIBS $LIBCURL" |
172 | 177 | ||
173 | AC_CHECK_FUNC(curl_free,, | 178 | AC_CHECK_FUNC(curl_free,, |
174 | AC_DEFINE(curl_free,free, | 179 | AC_DEFINE(curl_free,free, |
175 | [Define curl_free() as free() if our version of curl lacks curl_free.])) | 180 | [Define curl_free() as free() if our version of curl lacks curl_free.])) |
176 | 181 | ||
177 | CPPFLAGS=$_libcurl_save_cppflags | 182 | CPPFLAGS=$_libcurl_save_cppflags |
178 | LIBS=$_libcurl_save_libs | 183 | LIBS=$_libcurl_save_libs |
@@ -185,34 +190,40 @@ x=CURLOPT_VERBOSE; | |||
185 | AC_SUBST(LIBCURL) | 190 | AC_SUBST(LIBCURL) |
186 | 191 | ||
187 | for _libcurl_feature in $_libcurl_features ; do | 192 | for _libcurl_feature in $_libcurl_features ; do |
188 | AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_feature_$_libcurl_feature),[1]) | 193 | AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_feature_$_libcurl_feature),[1]) |
189 | eval AS_TR_SH(libcurl_feature_$_libcurl_feature)=yes | 194 | eval AS_TR_SH(libcurl_feature_$_libcurl_feature)=yes |
190 | done | 195 | done |
191 | 196 | ||
192 | if test "x$_libcurl_protocols" = "x" ; then | 197 | if test "x$_libcurl_protocols" = "x" ; then |
198 | |||
199 | # We don't have --protocols, so just assume that all | ||
200 | # protocols are available | ||
201 | _libcurl_protocols="HTTP FTP FILE TELNET LDAP DICT TFTP" | ||
193 | 202 | ||
194 | # We don't have --protocols, so just assume that all | 203 | if test x$libcurl_feature_SSL = xyes ; then |
195 | # protocols are available | 204 | _libcurl_protocols="$_libcurl_protocols HTTPS" |
196 | _libcurl_protocols="HTTP FTP FILE TELNET LDAP DICT" | ||
197 | 205 | ||
198 | if test x$libcurl_feature_SSL = xyes ; then | 206 | # FTPS wasn't standards-compliant until version |
199 | _libcurl_protocols="$_libcurl_protocols HTTPS" | 207 | # 7.11.0 (0x070b00 == 461568) |
208 | if test $_libcurl_version -ge 461568; then | ||
209 | _libcurl_protocols="$_libcurl_protocols FTPS" | ||
210 | fi | ||
211 | fi | ||
200 | 212 | ||
201 | # FTPS wasn't standards-compliant until version | 213 | # RTSP, IMAP, POP3 and SMTP were added in |
202 | # 7.11.0 | 214 | # 7.20.0 (0x071400 == 463872) |
203 | if test $_libcurl_version -ge 461568; then | 215 | if test $_libcurl_version -ge 463872; then |
204 | _libcurl_protocols="$_libcurl_protocols FTPS" | 216 | _libcurl_protocols="$_libcurl_protocols RTSP IMAP POP3 SMTP" |
205 | fi | 217 | fi |
206 | fi | 218 | fi |
207 | fi | ||
208 | 219 | ||
209 | for _libcurl_protocol in $_libcurl_protocols ; do | 220 | for _libcurl_protocol in $_libcurl_protocols ; do |
210 | AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_protocol_$_libcurl_protocol),[1]) | 221 | AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_protocol_$_libcurl_protocol),[1]) |
211 | eval AS_TR_SH(libcurl_protocol_$_libcurl_protocol)=yes | 222 | eval AS_TR_SH(libcurl_protocol_$_libcurl_protocol)=yes |
212 | done | 223 | done |
213 | else | 224 | else |
214 | unset LIBCURL | 225 | unset LIBCURL |
215 | unset LIBCURL_CPPFLAGS | 226 | unset LIBCURL_CPPFLAGS |
216 | fi | 227 | fi |
217 | fi | 228 | fi |
218 | 229 | ||