From: daryder Date: Thu, 3 Apr 2014 19:17:53 +0000 (-0400) Subject: Added libjson-c / ceph configuration X-Git-Tag: collectd-5.5.0~80^2~28 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=75291e58bfdcdf5a8f9b7f97e3c55f8e04b74078;p=collectd.git Added libjson-c / ceph configuration --- diff --git a/configure.ac b/configure.ac index f1c7b8ab..8c05fd48 100644 --- a/configure.ac +++ b/configure.ac @@ -2057,6 +2057,125 @@ then fi # }}} +# --with-libjson-c {{{ +with_json_c_cppflags="" +with_json_c_ldflags="" +with_json_c_libs="" +AC_ARG_WITH(libjson-c, [AS_HELP_STRING([--with-libjson-c@<:@=PREFIX@:>@], [Path to libjson-c.])], +[ + if test "x$withval" = "xno" + then + with_libjson_c="no" + else if test "x$withval" = "xyes" + then + with_libjson_c="pkgconfig" + else + with_libjson_c="yes" + with_json_c_cppflags="-I$withval/include" + with_json_c_ldflags="-L$withval/lib -Wl,-rpath -Wl,$withval/lib" + with_json_c_libs="-ljson-c" + fi; fi +], +[ + if test "x$ac_system" = "xLinux" + then + with_libjson_c="pkgconfig" + else + with_libjson_c="no (Linux only)" + fi +]) + +if test "x$with_libjson_c" = "xpkgconfig" && test "x$PKG_CONFIG" = "x" +then + with_libjson_c="no (Don't have pkg-config)" +fi + +if test "x$with_libjson_c" = "xpkgconfig" +then + $PKG_CONFIG --exists --print-errors 'json-c' 2>/dev/null + if test $? -ne 0 + then + with_libjson_c="no (pkg-config doesn't know json-c)" + fi +fi + +if test "x$with_libjson_c" = "xpkgconfig" +then + with_json_c_cppflags="`$PKG_CONFIG --cflags 'json-c'`" + if test $? -ne 0 + then + with_libjson_c="no ($PKG_CONFIG failed)" + fi + with_json_c_ldflags="`$PKG_CONFIG --libs-only-L 'json-c'`" + if test $? -ne 0 + then + with_libjson_c="no ($PKG_CONFIG failed)" + fi + if test "x${with_json_c_ldflags:0:2}" = "x-L" + then + json_lib_path=`echo "${with_json_c_ldflags:2}" | sed 's/ *$//'` + json_lib_path=`find "$json_lib_path" -name libjson-c.so -exec 'dirname' '{}' ';' | head -n 1` + if test "x$json_lib_path" != "x" + then + with_json_c_ldflags="-L$json_lib_path -Wl,-rpath -Wl,$json_lib_path" + else + with_libjson_c="no (coudn't find libjson-c.so)" + fi + fi + with_json_c_libs="`$PKG_CONFIG --libs-only-l 'json-c'`" + if test $? -ne 0 + then + with_libjson_c="no ($PKG_CONFIG failed)" + fi +fi + +if test "x$with_libjson_c" = "xpkgconfig" +then + with_libjson_c="yes" +fi + +SAVE_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $with_json_c_cppflags" + +# check for json headers +if test "x$with_libjson_c" = "xyes" +then + AC_CHECK_HEADERS(json-c/json.h json-c/json_c_version.h json-c/json_inttypes.h, + [with_libjson_c="yes"], + [with_libjson_c="no (Json-c headers not found)"]) +fi + +if test "x$with_libjson_c" = "xyes" +then + SAVE_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $with_json_c_ldflags" + + SAVE_LIBS="$LIBS" + LIBS="$LIBS $with_json_c_libs" + + AC_CHECK_LIB(json-c, + [json_c_version], + [with_libjson_c="yes"], + [with_libjson_c="no (libjson-c library not found)"]) + + LDFLAGS="$SAVE_LDFLAGS" + LIBS="$SAVE_LIBS" +fi + +CPPFLAGS="$SAVE_CPPFLAGS" + +if test "x$with_libjson_c" = "xyes" +then + BUILD_WITH_LIBJSON_C_CPPFLAGS="$with_json_c_cppflags" + BUILD_WITH_LIBJSON_C_LDFLAGS="$with_json_c_ldflags" + BUILD_WITH_LIBJSON_C_LIBS="$with_json_c_libs" + AC_SUBST(BUILD_WITH_LIBJSON_C_CPPFLAGS) + AC_SUBST(BUILD_WITH_LIBJSON_C_LDFLAGS) + AC_SUBST(BUILD_WITH_LIBJSON_C_LIBS) +fi +AM_CONDITIONAL(BUILD_WITH_LIBJSON_C, test "x$with_libjson_c" = "xyes") +# }}} + # --with-java {{{ with_java_home="$JAVA_HOME" with_java_vmtype="client" @@ -4788,6 +4907,7 @@ dependency_error="no" plugin_ascent="no" plugin_battery="no" plugin_bind="no" +plugin_ceph="no" plugin_cgroups="no" plugin_conntrack="no" plugin_contextswitch="no" @@ -4959,6 +5079,11 @@ then plugin_curl_xml="yes" fi +if test "x$with_libjson_c" = "xyes" +then + plugin_ceph="yes" +fi + if test "x$have_processor_info" = "xyes" then plugin_cpu="yes" @@ -5116,6 +5241,7 @@ AC_PLUGIN([aquaero], [$with_libaquaero5], [Aquaero's hardware sensors]) AC_PLUGIN([ascent], [$plugin_ascent], [AscentEmu player statistics]) AC_PLUGIN([battery], [$plugin_battery], [Battery statistics]) AC_PLUGIN([bind], [$plugin_bind], [ISC Bind nameserver statistics]) +AC_PLUGIN([ceph], [$with_libjson_c], [Ceph daemon statistics]) AC_PLUGIN([conntrack], [$plugin_conntrack], [nf_conntrack statistics]) AC_PLUGIN([contextswitch], [$plugin_contextswitch], [context switch statistics]) AC_PLUGIN([cpufreq], [$plugin_cpufreq], [CPU frequency statistics]) @@ -5394,6 +5520,11 @@ then with_perl_bindings="yes ($PERL_BINDINGS_OPTIONS)" fi +if test "x$with_libjson_c" != "xyes" +then + enable_ceph="no (needs libjson-c)" +fi + cat <