If --with-python is passed explicitly, configure should break if it can not
find a usable Python or lxml library.  The error message should be explicit
about the configuration problem.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=80005

Tested:
- $ ./configure --with-python
  checking for python... /usr/bin/python
  checking for python lxml module... no
  configure: error: *** either python or python-lxml module not found

- $ ./configure
  checking for python... /usr/bin/python
  checking for python lxml module... no
  configure: WARNING: *** python support requires python-lxml module installed
  ...
          Python:                  no
          Python Headers:          no
---
 configure.ac | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index df6600839ea2..6071f02a81fb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -210,8 +210,11 @@ AC_CHECK_SIZEOF(rlim_t,,[
 # 
------------------------------------------------------------------------------
 # we use python to build the man page index, and for systemd-python
 have_python=no
+# Whether either one of --with-python or --without-python was specified.
+python_explicitly_requested=no
 AC_ARG_WITH([python],
-        [AS_HELP_STRING([--without-python], [Disable building the man page 
index and systemd-python (default: test)])])
+        [AS_HELP_STRING([--without-python], [Disable building the man page 
index and systemd-python (default: test)])],
+        [python_explicitly_requested=yes])
 
 have_lxml=no
 AS_IF([test "x$with_python" != "xno"], [
@@ -220,8 +223,13 @@ AS_IF([test "x$with_python" != "xno"], [
                 AC_MSG_CHECKING([for python lxml module])
                 AS_IF(["$PYTHON" -c 'import lxml' 2>/dev/null], 
[have_lxml=yes])
                 AC_MSG_RESULT([$have_lxml])
-                AS_IF([test "x$have_lxml" = "xyes"], [have_python=yes],
-                      [AC_MSG_WARN([*** python support requires python-lxml 
module installed])])
+                AS_IF([test "x$have_lxml" = "xyes"], [have_python=yes], [
+                       if test "x$python_explicitly_requested" = x"yes"; then
+                                AC_MSG_ERROR([*** either python or python-lxml 
module not found])
+                       else
+                                AC_MSG_WARN([*** python support requires 
python-lxml module installed])
+                       fi
+                ])
         ])
 ])
 AM_CONDITIONAL([HAVE_PYTHON], [test "x$have_python" = "xyes"])
-- 
1.9.3

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to