From: Florian Forster Date: Tue, 8 Dec 2009 13:36:43 +0000 (+0100) Subject: configure.in: Check the flags reported by Python. X-Git-Tag: collectd-4.9.0~30 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=68362bd8046679278d0711c24c1c19c03f3a46a4;p=collectd.git configure.in: Check the flags reported by Python. On several platforms, we have observed bogus information provided by Python. Double check those flags and only enable the Python plugin if it is *really* possible to build anything with the library. --- diff --git a/configure.in b/configure.in index ea1e40e2..b02f004f 100644 --- a/configure.in +++ b/configure.in @@ -2678,6 +2678,10 @@ AC_ARG_WITH(python, [AS_HELP_STRING([--with-python@<:@=PREFIX@:>@], [Path to the ], [with_python="yes"]) SAVE_PATH="$PATH" +SAVE_CPPFLAGS="$CPPFLAGS" +SAVE_LDFLAGS="$LDFLAGS" +SAVE_LIBS="$LIBS" + PATH="$with_python_path" if test "x$with_python" = "xyes" && test "x$with_python_prog" = "x" @@ -2693,8 +2697,6 @@ then fi fi -PATH="$SAVE_PATH" - if test "x$with_python" = "xyes" then AC_MSG_CHECKING([for Python CPPFLAGS]) @@ -2710,6 +2712,14 @@ then fi fi +if test "x$with_python" = "xyes" +then + CPPFLAGS="-I$python_include_path $CPPFLAGS" + AC_CHECK_HEADERS(Python.h, + [with_python="yes"], + [with_python="no ('Python.h' not found)"]) +fi + if test "x$with_python" = "xyes" then AC_MSG_CHECKING([for Python LDFLAGS]) @@ -2740,6 +2750,21 @@ then fi fi +if test "x$with_python" = "xyes" +then + LDFLAGS="-L$python_library_path $LDFLAGS" + LIBS="$python_library_flags $LIBS" + + AC_CHECK_FUNC(PyObject_CallFunction, + [with_python="yes"], + [with_python="no (Symbol 'PyObject_CallFunction' not found)"]) +fi + +PATH="$SAVE_PATH" +CPPFLAGS="$SAVE_CPPFLAGS" +LDFLAGS="$SAVE_LDFLAGS" +LIBS="$SAVE_LIBS" + if test "x$with_python" = "xyes" then BUILD_WITH_PYTHON_CPPFLAGS="-I$python_include_path"