From: Sebastian Harl Date: Mon, 30 May 2016 21:10:08 +0000 (+0200) Subject: configure / curl stats: Check for CURLINFO_APPCONNECT_TIME. X-Git-Tag: collectd-5.6.0~220^2~4 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=d76b962d383e2944fe390594ced38521ac04c846;p=collectd.git configure / curl stats: Check for CURLINFO_APPCONNECT_TIME. It's available since cURL 7.19 but RHEL5 ships an older version. --- diff --git a/configure.ac b/configure.ac index 145f3936..4437aeef 100644 --- a/configure.ac +++ b/configure.ac @@ -1948,6 +1948,36 @@ then fi if test "x$with_libcurl" = "xyes" then + SAVE_CPPFLAGS="$CPPFLAGS" + SAVE_LDFLAGS="$LDFLAGS" + CPPFLAGS="$CPPFLAGS $with_curl_cflags" + LDFLAGS="$LDFLAGS $curl_curl_libs" + AC_CACHE_CHECK([for CURLINFO_APPCONNECT_TIME], + [c_cv_have_curlinfo_appconnect_time], + AC_LINK_IFELSE([AC_LANG_PROGRAM( +[[[ +#include +]]], +[[[ +int val = CURLINFO_APPCONNECT_TIME; +return val; +]]] + )], + [c_cv_have_curlinfo_appconnect_time="yes"], + [c_cv_have_curlinfo_appconnect_time="no"] + ) + ) + CPPFLAGS="$SAVE_CPPFLAGS" + LDFLAGS="$SAVE_LDFLAGS" +fi +AM_CONDITIONAL(BUILD_WITH_LIBCURL, test "x$with_libcurl" = "xyes") +if test "x$c_cv_have_curlinfo_appconnect_time" = "xyes" +then + AC_DEFINE(HAVE_CURLINFO_APPCONNECT_TIME, 1, [Define if curl.h defines CURLINFO_APPCONNECT_TIME.]) +fi + +if test "x$with_libcurl" = "xyes" +then BUILD_WITH_LIBCURL_CFLAGS="$with_curl_cflags" BUILD_WITH_LIBCURL_LIBS="$with_curl_libs" AC_SUBST(BUILD_WITH_LIBCURL_CFLAGS) diff --git a/src/utils_curl_stats.c b/src/utils_curl_stats.c index 5a37083a..b242a239 100644 --- a/src/utils_curl_stats.c +++ b/src/utils_curl_stats.c @@ -136,7 +136,9 @@ static struct { SPEC (redirect_time, "RedirectTime", dispatch_gauge, "duration", CURLINFO_REDIRECT_TIME), SPEC (redirect_count, "RedirectCount", dispatch_size, "count", CURLINFO_REDIRECT_COUNT), SPEC (num_connects, "NumConnects", dispatch_size, "count", CURLINFO_NUM_CONNECTS), +#ifdef HAVE_CURLINFO_APPCONNECT_TIME SPEC (appconnect_time, "AppconnectTime", dispatch_gauge, "duration", CURLINFO_APPCONNECT_TIME), +#endif #undef SPEC };