Source
30
30
#
31
31
# For the sake of sanity, this macro assumes that any libcurl that is
32
32
# found is after version 7.7.2, the first version that included the
33
33
# curl-config script. Note that it is very important for people
34
34
# packaging binary versions of libcurl to include this script!
35
35
# Without curl-config, we can only guess what protocols are available,
36
36
# or use curl_version_info to figure it out at runtime.
37
37
38
38
AC_DEFUN([LIBCURL_CHECK_CONFIG],
39
39
[
40
-
AH_TEMPLATE([LIBCURL_FEATURE_SSL],[Defined if libcurl supports SSL])
41
-
AH_TEMPLATE([LIBCURL_FEATURE_KRB4],[Defined if libcurl supports KRB4])
42
-
AH_TEMPLATE([LIBCURL_FEATURE_IPV6],[Defined if libcurl supports IPv6])
43
-
AH_TEMPLATE([LIBCURL_FEATURE_LIBZ],[Defined if libcurl supports libz])
44
-
AH_TEMPLATE([LIBCURL_FEATURE_ASYNCHDNS],[Defined if libcurl supports AsynchDNS])
45
-
AH_TEMPLATE([LIBCURL_FEATURE_IDN],[Defined if libcurl supports IDN])
46
-
AH_TEMPLATE([LIBCURL_FEATURE_SSPI],[Defined if libcurl supports SSPI])
47
-
AH_TEMPLATE([LIBCURL_FEATURE_NTLM],[Defined if libcurl supports NTLM])
48
-
49
-
AH_TEMPLATE([LIBCURL_PROTOCOL_HTTP],[Defined if libcurl supports HTTP])
50
-
AH_TEMPLATE([LIBCURL_PROTOCOL_HTTPS],[Defined if libcurl supports HTTPS])
51
-
AH_TEMPLATE([LIBCURL_PROTOCOL_FTP],[Defined if libcurl supports FTP])
52
-
AH_TEMPLATE([LIBCURL_PROTOCOL_FTPS],[Defined if libcurl supports FTPS])
53
-
AH_TEMPLATE([LIBCURL_PROTOCOL_FILE],[Defined if libcurl supports FILE])
54
-
AH_TEMPLATE([LIBCURL_PROTOCOL_TELNET],[Defined if libcurl supports TELNET])
55
-
AH_TEMPLATE([LIBCURL_PROTOCOL_LDAP],[Defined if libcurl supports LDAP])
56
-
AH_TEMPLATE([LIBCURL_PROTOCOL_DICT],[Defined if libcurl supports DICT])
57
-
AH_TEMPLATE([LIBCURL_PROTOCOL_TFTP],[Defined if libcurl supports TFTP])
58
-
59
40
_libcurl_config="no"
60
41
61
42
AC_ARG_WITH(libcurl,
62
43
[
63
44
If you want to use cURL library:
64
45
AS_HELP_STRING([--with-libcurl@<:@=DIR@:>@],[use cURL package @<:@default=no@:>@, optionally specify path to curl-config])],
65
46
[
66
47
if test "x$withval" = "xno"; then
67
48
want_curl="no"
68
49
elif test "x$withval" = "xyes"; then
211
192
# This is so silly, but Apple actually has a bug in their
212
193
# curl-config script. Fixed in Tiger, but there are still
213
194
# lots of Panther installs around.
214
195
case "${host}" in
215
196
powerpc-apple-darwin7*)
216
197
LIBCURL_LIBS=`echo $LIBCURL_LIBS | sed -e 's|-arch i386||g'`
217
198
;;
218
199
esac
219
200
fi # "x$LIBCURL_LIBS" = "x"
220
201
221
-
# All curl-config scripts support --feature
222
-
_libcurl_features=`$_libcurl_config --feature`
223
-
224
-
# Is it modern enough to have --protocols? (7.12.4)
225
-
if test $_libcurl_version -ge 461828; then
226
-
_libcurl_protocols=`$_libcurl_config --protocols`
227
-
fi
228
-
229
202
_libcurl_try_link=yes
230
203
fi # $_libcurl_wanted -eq 0 || "x$libcurl_cv_lib_version_ok" = "xyes"
231
204
232
205
unset _libcurl_wanted
233
206
fi # -x "$_libcurl_config"
234
207
235
208
if test "x$_libcurl_try_link" = "xyes"; then
236
209
# we didn't find curl-config, so let's see if the user-supplied
237
210
# link line (or failing that, "-lcurl") is enough.
238
211
278
251
])
279
252
280
253
if test "x$libcurl_cv_lib_curl_usable" = "xno"; then
281
254
link_mode="dynamic"
282
255
if test "x$enable_static" = "xyes"; then
283
256
link_mode="static"
284
257
fi
285
258
AC_MSG_ERROR([libcurl is not available for ${link_mode} linking])
286
259
fi
287
260
288
-
# Does curl_free() exist in this version of libcurl?
289
-
# If not, fake it with free()
290
-
291
261
_save_curl_libs="${LIBS}"
292
262
_save_curl_ldflags="${LDFLAGS}"
293
263
_save_curl_cflags="${CFLAGS}"
294
264
LIBS="${LIBS} ${LIBCURL_LIBS}"
295
265
LDFLAGS="${LDFLAGS} ${LIBCURL_LDFLAGS}"
296
266
CFLAGS="${CFLAGS} ${LIBCURL_CFLAGS}"
297
267
298
-
AC_CHECK_FUNC(curl_free,,
299
-
AC_DEFINE(curl_free,free,
300
-
[Define curl_free() as free() if our version of curl lacks curl_free.]))
301
-
302
-
AC_CHECK_FUNC(curl_easy_escape,
303
-
AC_DEFINE(HAVE_FUNCTION_CURL_EASY_ESCAPE,1,
304
-
[Define to 1 if function 'curl_easy_escape' exists.]))
305
-
306
268
LIBS="${_save_curl_libs}"
307
269
LDFLAGS="${_save_curl_ldflags}"
308
270
CFLAGS="${_save_curl_cflags}"
309
271
unset _save_curl_libs
310
272
unset _save_curl_ldflags
311
273
unset _save_curl_cflags
312
274
313
275
AC_DEFINE(HAVE_LIBCURL,1,
314
276
[Define to 1 if you have a functional curl library.])
315
277
AC_SUBST(LIBCURL_CFLAGS)
316
278
AC_SUBST(LIBCURL_LDFLAGS)
317
279
AC_SUBST(LIBCURL_LIBS)
318
280
found_curl="yes"
319
-
320
-
for _libcurl_feature in $_libcurl_features ; do
321
-
AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_feature_$_libcurl_feature),[1])
322
-
eval AS_TR_SH(libcurl_feature_$_libcurl_feature)=yes
323
-
done
324
-
325
-
if test "x$_libcurl_protocols" = "x"; then
326
-
# We don't have --protocols, so just assume that all
327
-
# protocols are available
328
-
_libcurl_protocols="HTTP FTP FILE TELNET LDAP DICT"
329
-
330
-
if test "x$libcurl_feature_SSL" = "xyes"; then
331
-
_libcurl_protocols="$_libcurl_protocols HTTPS"
332
-
333
-
# FTPS wasn't standards-compliant until version
334
-
# 7.11.0
335
-
if test $_libcurl_version -ge 461568; then
336
-
_libcurl_protocols="$_libcurl_protocols FTPS"
337
-
fi
338
-
fi
339
-
fi
340
-
341
-
for _libcurl_protocol in $_libcurl_protocols ; do
342
-
AC_DEFINE_UNQUOTED(AS_TR_CPP(libcurl_protocol_$_libcurl_protocol),[1])
343
-
eval AS_TR_SH(libcurl_protocol_$_libcurl_protocol)=yes
344
-
done
345
281
else
346
282
unset LIBCURL_LIBS
347
283
unset LIBCURL_CFLAGS
348
284
fi # "x$_libcurl_try_link" = "xyes"
349
285
350
286
unset _libcurl_try_link
351
287
unset _libcurl_version_parse
352
288
unset _libcurl_config
353
-
unset _libcurl_feature
354
-
unset _libcurl_features
355
-
unset _libcurl_protocol
356
-
unset _libcurl_protocols
357
289
unset _libcurl_version
358
290
unset _libcurl_libs
359
291
fi # "x$want_curl" != "xno"
360
292
361
293
if test "x$want_curl" = "xno" || test "x$libcurl_cv_lib_curl_usable" != "xyes"; then
362
294
# This is the IF-NO path
363
295
ifelse([$4],,:,[$4])
364
296
else
365
297
# This is the IF-YES path
366
298
ifelse([$3],,:,[$3])