From 5f54e164c99581862c0f30147440f8ab4c644714 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 25 Jul 2011 10:58:32 +1000 Subject: [PATCH] Only use the sockoptfunction if the version of curl is recent enough. --- configure.ac | 1 + util.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/configure.ac b/configure.ac index 249caa86..cb2a4dfe 100644 --- a/configure.ac +++ b/configure.ac @@ -125,6 +125,7 @@ AM_CONDITIONAL([HAS_YASM], [test x$has_yasm = xtrue]) PKG_PROG_PKG_CONFIG() LIBCURL_CHECK_CONFIG(, 7.10.1, , [AC_MSG_ERROR([Missing required libcurl dev >= 7.10.1])]) +LIBCURL_CHECK_CONFIG(, 7.15.6, [AC_DEFINE([CURL_HAS_SOCKOPT], [1], [Defined if version of curl supports sockopts.])],) dnl CCAN wants to know a lot of vars. # All the configuration checks. Regrettably, the __attribute__ checks will diff --git a/util.c b/util.c index 8b647aeb..ed33befb 100644 --- a/util.c +++ b/util.c @@ -343,8 +343,10 @@ json_t *json_rpc_call(CURL *curl, const char *url, curl_easy_setopt(curl, CURLOPT_USERPWD, userpass); curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); } +#ifdef CURL_HAS_SOCKOPT if (longpoll) curl_easy_setopt(curl, CURLOPT_SOCKOPTFUNCTION, json_rpc_call_sockopt_cb); +#endif curl_easy_setopt(curl, CURLOPT_POST, 1); if (opt_protocol)