[libvirt] [PATCH] build: Fix problem of building Python bindings

If one specify "--with-python=yes" but no python-devel package is installed, we ignore it with just a notice message, which doesn't give clear guide to user. --- configure.ac | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 190bf40..758c893 100644 --- a/configure.ac +++ b/configure.ac @@ -1917,15 +1917,13 @@ if test "$with_python" != "no" ; then then PYTHON_INCLUDES=-I/usr/include/python$PYTHON_VERSION else - AC_MSG_NOTICE([Could not find python$PYTHON_VERSION/Python.h, disabling bindings]) - with_python=no + AC_MSG_ERROR([You must install python-devel to build Python bindings]) fi fi fi fi else - AC_MSG_NOTICE([Could not find python interpreter, disabling bindings]) - with_python=no + AC_MSG_ERROR([You must install python to build Python bindings]) fi else AC_MSG_NOTICE([Could not find python in $with_python, disabling bindings]) -- 1.7.4

On Wed, Apr 27, 2011 at 11:46:33AM +0800, Osier Yang wrote:
If one specify "--with-python=yes" but no python-devel package is installed, we ignore it with just a notice message, which doesn't give clear guide to user. --- configure.ac | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac index 190bf40..758c893 100644 --- a/configure.ac +++ b/configure.ac @@ -1917,15 +1917,13 @@ if test "$with_python" != "no" ; then then PYTHON_INCLUDES=-I/usr/include/python$PYTHON_VERSION else - AC_MSG_NOTICE([Could not find python$PYTHON_VERSION/Python.h, disabling bindings]) - with_python=no + AC_MSG_ERROR([You must install python-devel to build Python bindings]) fi fi fi fi else - AC_MSG_NOTICE([Could not find python interpreter, disabling bindings]) - with_python=no + AC_MSG_ERROR([You must install python to build Python bindings]) fi else AC_MSG_NOTICE([Could not find python in $with_python, disabling bindings])
Hum ... the message may be a bit less "generaic" but probably more useful, okay ACK, Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

于 2011年04月27日 14:59, Daniel Veillard 写道:
On Wed, Apr 27, 2011 at 11:46:33AM +0800, Osier Yang wrote:
If one specify "--with-python=yes" but no python-devel package is installed, we ignore it with just a notice message, which doesn't give clear guide to user. --- configure.ac | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac index 190bf40..758c893 100644 --- a/configure.ac +++ b/configure.ac @@ -1917,15 +1917,13 @@ if test "$with_python" != "no" ; then then PYTHON_INCLUDES=-I/usr/include/python$PYTHON_VERSION else - AC_MSG_NOTICE([Could not find python$PYTHON_VERSION/Python.h, disabling bindings]) - with_python=no + AC_MSG_ERROR([You must install python-devel to build Python bindings]) fi fi fi fi else - AC_MSG_NOTICE([Could not find python interpreter, disabling bindings]) - with_python=no + AC_MSG_ERROR([You must install python to build Python bindings]) fi else AC_MSG_NOTICE([Could not find python in $with_python, disabling bindings])
Hum ... the message may be a bit less "generaic" but probably more useful, okay
ACK,
Daniel
Thanks, applied Osier

On 04/26/2011 09:46 PM, Osier Yang wrote:
If one specify "--with-python=yes" but no python-devel package is installed, we ignore it with just a notice message, which doesn't give clear guide to user. --- configure.ac | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/configure.ac b/configure.ac index 190bf40..758c893 100644 --- a/configure.ac +++ b/configure.ac @@ -1917,15 +1917,13 @@ if test "$with_python" != "no" ; then then PYTHON_INCLUDES=-I/usr/include/python$PYTHON_VERSION else - AC_MSG_NOTICE([Could not find python$PYTHON_VERSION/Python.h, disabling bindings]) - with_python=no + AC_MSG_ERROR([You must install python-devel to build Python bindings])
Hmm, this patch isn't quite right. I tested on an Ubuntu system where I don't have the devel package installed for python, and to my surprise, ./configure now fails, where it used to succeed without building any python bindings: configure: error: You must install python-devel to build Python bindings In reality, we want the default to be --with-python=check, which gracefully switches to --with-python=no if python is not present, and only issue the AC_MSG_ERROR on an explicit --with-python=yes without python bindings. I ran out of time to look at this today, but think it needs to be fixed before 0.9.1. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

Regression introduced in commit 53cb23f4. * configure.ac: Let --with-python default to check. --- configure.ac | 29 ++++++++++++++++++++--------- 1 files changed, 20 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index dcec371..1fdcf27 100644 --- a/configure.ac +++ b/configure.ac @@ -1820,12 +1820,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= @@ -1851,7 +1851,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 @@ -1860,30 +1860,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
participants (3)
-
Daniel Veillard
-
Eric Blake
-
Osier Yang