Browse Source

Only use the sockoptfunction if the version of curl is recent enough.

Con Kolivas 14 years ago
parent
commit
5f54e164c9
2 changed files with 3 additions and 0 deletions
  1. 1 0
      configure.ac
  2. 2 0
      util.c

+ 1 - 0
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

+ 2 - 0
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)