Code

configure.in: Check the flags reported by Python.
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Tue, 8 Dec 2009 13:36:43 +0000 (14:36 +0100)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Tue, 8 Dec 2009 13:36:43 +0000 (14:36 +0100)
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.

configure.in

index ea1e40e2b0a1012ef97570fc07ffa393db187632..b02f004f61b0264ba33a8c5c2eace7425ee363b3 100644 (file)
@@ -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"