Only use the sockoptfunction if the version of curl is recent enough.
diff --git a/configure.ac b/configure.ac
index 249caa8..cb2a4df 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 8b647ae..ed33bef 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)