From: Florian Forster Date: Tue, 8 Dec 2009 10:26:37 +0000 (+0100) Subject: Merge branch 'st/python' X-Git-Tag: collectd-4.9.0~35 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=f9d51dc8fabe44f3cd17499713d63b518f0e1853;p=collectd.git Merge branch 'st/python' Conflicts: README configure.in src/owniptc/libiptc.c src/types.db --- f9d51dc8fabe44f3cd17499713d63b518f0e1853 diff --cc README index 47499f1f,70118ad1..e95bae62 --- a/README +++ b/README @@@ -552,10 -563,10 +570,14 @@@ Prerequisite The PostgreSQL C client library used by the `postgresql' plugin. + * libpython (optional) + Used by the `python' plugin. Currently, only 2.3 ≦ Python < 3 is supported. + + + * librouteros (optional) + Used by the `routeros' plugin to connect to a device running `RouterOS'. + + * librrd (optional) Used by the `rrdtool' and `rrdcached' plugins. The latter requires RRDtool client support which was added after version 1.3 of RRDtool. Versions 1.0, diff --cc configure.in index 0b41015f,6a520a64..232d4550 --- a/configure.in +++ b/configure.in @@@ -2653,63 -2655,102 +2655,159 @@@ AC_DEFINE_UNQUOTED(HAVE_LIBPTHREAD, [$c AM_CONDITIONAL(BUILD_WITH_LIBPTHREAD, test "x$with_libpthread" = "xyes") # }}} + # --with-python {{{ + with_python_prog="" + with_python_path="$PATH" + AC_ARG_WITH(python, [AS_HELP_STRING([--with-python@<:@=PREFIX@:>@], [Path to the python interpreter.])], + [ + if test "x$withval" = "xyes" || test "x$withval" = "xno" + then + with_python="$withval" + else if test -x "$withval" + then + with_python_prog="$withval" + with_python_path="`dirname \"$withval\"`$PATH_SEPARATOR$with_python_path" + with_python="yes" + else if test -d "$withval" + then + with_python_path="$withval$PATH_SEPARATOR$with_python_path" + with_python="yes" + else + AC_MSG_WARN([Argument not recognized: $withval]) + fi; fi; fi + ], [with_python="yes"]) + + SAVE_PATH="$PATH" + PATH="$with_python_path" + + if test "x$with_python" = "xyes" && test "x$with_python_prog" = "x" + then + AC_MSG_CHECKING([for python]) + with_python_prog="`which python 2>/dev/null`" + if test "x$with_python_prog" = "x" + then + AC_MSG_RESULT([not found]) + with_python="no (interpreter not found)" + else + AC_MSG_RESULT([$with_python_prog]) + fi + fi + + PATH="$SAVE_PATH" + + if test "x$with_python" = "xyes" + then + AC_MSG_CHECKING([for Python CPPFLAGS]) + python_include_path=`echo "import distutils.sysconfig;print distutils.sysconfig.get_python_inc()" | "$with_python_prog" 2>/dev/null` + python_config_status=$? + + if test "$python_config_status" -ne 0 || test "x$python_include_path" = "x" + then + AC_MSG_RESULT([failed with status $python_config_status]) + with_python="no" + else + AC_MSG_RESULT([$python_include_path]) + fi + fi + + if test "x$with_python" = "xyes" + then + AC_MSG_CHECKING([for Python LDFLAGS]) + python_library_path=`echo "import distutils.sysconfig;print distutils.sysconfig.get_config_vars(\"LIBDIR\").__getitem__(0)" | "$with_python_prog" 2>&1` + python_config_status=$? + + if test "$python_config_status" -ne 0 || test "x$python_library_path" = "x" + then + AC_MSG_RESULT([failed with status $python_config_status]) + with_python="no" + else + AC_MSG_RESULT([$python_library_path]) + fi + fi + + if test "x$with_python" = "xyes" + then + AC_MSG_CHECKING([for Python LIBS]) + python_library_flags=`echo "import distutils.sysconfig;print distutils.sysconfig.get_config_vars(\"BLDLIBRARY\").__getitem__(0)" | "$with_python_prog" 2>&1` + python_config_status=$? + + if test "$python_config_status" -ne 0 || test "x$python_library_flags" = "x" + then + AC_MSG_RESULT([failed with status $python_config_status]) + with_python="no" + else + AC_MSG_RESULT([$python_library_flags]) + fi + fi + + if test "x$with_python" = "xyes" + then + BUILD_WITH_PYTHON_CPPFLAGS="-I$python_include_path" + BUILD_WITH_PYTHON_LDFLAGS="-L$python_library_path" + BUILD_WITH_PYTHON_LIBS="$python_library_flags" + AC_SUBST(BUILD_WITH_PYTHON_CPPFLAGS) + AC_SUBST(BUILD_WITH_PYTHON_LDFLAGS) + AC_SUBST(BUILD_WITH_PYTHON_LIBS) + fi + # }}} --with-python + +# --with-librouteros {{{ +AC_ARG_WITH(librouteros, [AS_HELP_STRING([--with-librouteros@<:@=PREFIX@:>@], [Path to librouteros.])], +[ + if test "x$withval" = "xyes" + then + with_librouteros="yes" + else if test "x$withval" = "xno" + then + with_librouteros="no" + else + with_librouteros="yes" + LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS -I$withval/include" + LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS -L$withval/lib" + fi; fi +], +[with_librouteros="yes"]) + +SAVE_CPPFLAGS="$CPPFLAGS" +SAVE_LDFLAGS="$LDFLAGS" + +CPPFLAGS="$CPPFLAGS $LIBROUTEROS_CPPFLAGS" +LDFLAGS="$LDFLAGS $LIBROUTEROS_LDFLAGS" + +if test "x$with_librouteros" = "xyes" +then + if test "x$LIBROUTEROS_CPPFLAGS" != "x" + then + AC_MSG_NOTICE([librouteros CPPFLAGS: $LIBROUTEROS_CPPFLAGS]) + fi + AC_CHECK_HEADERS(routeros_api.h, + [with_librouteros="yes"], + [with_librouteros="no ('routeros_api.h' not found)"]) +fi +if test "x$with_librouteros" = "xyes" +then + if test "x$LIBROUTEROS_LDFLAGS" != "x" + then + AC_MSG_NOTICE([librouteros LDFLAGS: $LIBROUTEROS_LDFLAGS]) + fi + AC_CHECK_LIB(routeros, ros_interface, + [with_librouteros="yes"], + [with_librouteros="no (symbol 'ros_interface' not found)"]) +fi + +CPPFLAGS="$SAVE_CPPFLAGS" +LDFLAGS="$SAVE_LDFLAGS" + +if test "x$with_librouteros" = "xyes" +then + BUILD_WITH_LIBROUTEROS_CPPFLAGS="$LIBROUTEROS_CPPFLAGS" + BUILD_WITH_LIBROUTEROS_LDFLAGS="$LIBROUTEROS_LDFLAGS" + AC_SUBST(BUILD_WITH_LIBROUTEROS_CPPFLAGS) + AC_SUBST(BUILD_WITH_LIBROUTEROS_LDFLAGS) +fi +AM_CONDITIONAL(BUILD_WITH_LIBROUTEROS, test "x$with_librouteros" = "xyes") +# }}} + # --with-librrd {{{ # AC_ARG_WITH (package, help-string, [action-if-given], [action-if-not-given]) librrd_cflags="" @@@ -3955,7 -3992,7 +4053,8 @@@ AC_PLUGIN([postgresql], [$with_libpq] AC_PLUGIN([powerdns], [yes], [PowerDNS statistics]) AC_PLUGIN([processes], [$plugin_processes], [Process statistics]) AC_PLUGIN([protocols], [$plugin_protocols], [Protocol (IP, TCP, ...) statistics]) + AC_PLUGIN([python], [$with_python], [Embed a Python interpreter]) +AC_PLUGIN([routeros], [$with_librouteros], [RouterOS plugin]) AC_PLUGIN([rrdcached], [$librrd_rrdc_update], [RRDTool output plugin]) AC_PLUGIN([rrdtool], [$with_librrd], [RRDTool output plugin]) AC_PLUGIN([sensors], [$with_libsensors], [lm_sensors statistics]) @@@ -4262,7 -4297,7 +4362,8 @@@ Configuration powerdns . . . . . . $enable_powerdns processes . . . . . . $enable_processes protocols . . . . . . $enable_protocols + python . . . . . . . $enable_python + routeros . . . . . . $enable_routeros rrdcached . . . . . . $enable_rrdcached rrdtool . . . . . . . $enable_rrdtool sensors . . . . . . . $enable_sensors