Code

Merge branch 'st/python'
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Tue, 8 Dec 2009 10:26:37 +0000 (11:26 +0100)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Tue, 8 Dec 2009 10:26:37 +0000 (11:26 +0100)
Conflicts:
README
configure.in
src/owniptc/libiptc.c
src/types.db

1  2 
AUTHORS
README
configure.in
src/Makefile.am
src/configfile.c
src/plugin.c

diff --cc AUTHORS
Simple merge
diff --cc README
index 47499f1ff07998703c78093f89324664842ad2a5,70118ad1be008039ebce551745e422b0eb4a5e6c..e95bae62af26a252b2c01f1c45100570b3225004
--- 1/README
--- 2/README
+++ b/README
@@@ -552,10 -563,10 +570,14 @@@ Prerequisite
      The PostgreSQL C client library used by the `postgresql' plugin.
      <http://www.postgresql.org/>
  
+   * libpython (optional)
+     Used by the `python' plugin. Currently, only 2.3 ≦ Python < 3 is supported.
+     <http://www.python.org/>
 +  * librouteros (optional)
 +    Used by the `routeros' plugin to connect to a device running `RouterOS'.
 +    <http://verplant.org/librouteros/>
 +
    * 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 0b41015f94c98f38bae06568e618809fdc4e56de,6a520a6456f4c18fcd3e38bfd266c50525c5b586..232d45503d8f7a8cd8622e63c4a37ebfe19a6e23
@@@ -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
diff --cc src/Makefile.am
Simple merge
Simple merge
diff --cc src/plugin.c
Simple merge