[libvirt] [PATCHv2 4/6] build: make python optional at configure time

Eric Blake eblake at redhat.com
Tue May 17 23:36:08 UTC 2011


Regression introduced in commit 53cb23f4.

* configure.ac: Let --with-python default to check.
---

v2: no change from v1
v1: https://www.redhat.com/archives/libvir-list/2011-May/msg00412.html

 configure.ac |   29 ++++++++++++++++++++---------
 1 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index 8a3de4c..1a9fddd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1832,12 +1832,12 @@ dnl check for python
 dnl

 AC_ARG_WITH([python],
-  AC_HELP_STRING([--with-python], [Build python bindings @<:@default=yes@:>@]),[],[with_python=yes])
+  AC_HELP_STRING([--with-python],
+   [Build python bindings @<:@default=check@:>@]),[],[with_python=check])

 if test "$enable_shared:$with_python" = no:yes; then
-  AC_MSG_WARN([Disabling shared libraries is incompatible with building Python extensions.])
-  AC_MSG_WARN([Ignoring --with-python.])
-  with_python=no
+  AC_MSG_ERROR([Disabling shared libraries is incompatible with building
+    Python extensions.])
 fi

 PYTHON_VERSION=
@@ -1863,7 +1863,7 @@ if test "$with_python" != "no" ; then
         fi
     fi

-    if test "$with_python" = "yes" ; then
+    if test "$with_python" = "yes" || test "$with_python" = "check"; then
         AM_PATH_PYTHON(,, [:])

         if test "$PYTHON" != : ; then
@@ -1872,30 +1872,41 @@ if test "$with_python" != "no" ; then
             if test -x "$PYTHON_CONFIG"
             then
                 PYTHON_INCLUDES=`$PYTHON_CONFIG --includes`
+                with_python=yes
             else
                 if test -r $PYTHON_EXEC_PREFIX/include/python$PYTHON_VERSION/Python.h
                 then
                     PYTHON_INCLUDES=-I$PYTHON_EXEC_PREFIX/include/python$PYTHON_VERSION
+                    with_python=yes
                 else
                     if test -r $prefix/include/python$PYTHON_VERSION/Python.h
                     then
                         PYTHON_INCLUDES=-I$prefix/include/python$PYTHON_VERSION
+                        with_python=yes
                     else
                         if test -r /usr/include/python$PYTHON_VERSION/Python.h
                         then
                             PYTHON_INCLUDES=-I/usr/include/python$PYTHON_VERSION
+                            with_python=yes
+                        elif test "$with_python" = "yes"; then
+                            AC_MSG_ERROR([You must install python-devel to
+                            build Python bindings])
                         else
-                            AC_MSG_ERROR([You must install python-devel to build Python bindings])
+                            AC_MSG_WARN([Could not find python-devel, disabling
+                            bindings])
+                            with_python=no
                         fi
                     fi
                 fi
             fi
-        else
+        elif test "$with_python" = "yes"; then
             AC_MSG_ERROR([You must install python to build Python bindings])
+        else
+            AC_MSG_WARN([Could not find python, disabling bindings])
+            with_python=no
         fi
     else
-        AC_MSG_NOTICE([Could not find python in $with_python, disabling bindings])
-        with_python=no
+        AC_MSG_ERROR([Could not find python in $with_python])
     fi
 fi
 AM_CONDITIONAL([WITH_PYTHON], [test "$with_python" = "yes"])
-- 
1.7.4.4




More information about the libvir-list mailing list