diff --git a/configure.in b/configure.in index 68947dd8bf..8d21207d40 100644 --- a/configure.in +++ b/configure.in @@ -1464,75 +1464,71 @@ AC_ARG_WITH([python], PYTHON_VERSION= PYTHON_INCLUDES= -PYTHON_SITE_PACKAGES= -PYTHON_TESTS= pythondir= if test "$with_python" != "no" ; then if test -x "$with_python/bin/python" then - echo Found python in $with_python/bin/python + AC_MSG_NOTICE(Found python in $with_python/bin/python) PYTHON="$with_python/bin/python" + with_python=yes else - if test -x "$with_python" - then - echo Found python in $with_python - PYTHON="$with_python" - else - if test -x "$PYTHON" - then - echo Found python in environment PYTHON=$PYTHON - with_python=`$PYTHON -c "import sys; print sys.exec_prefix"` - else - AC_PATH_PROG([PYTHON], [python python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0 python1.6 python1.5]) - fi - fi + if test -x "$with_python" + then + AC_MSG_NOTICE(Found python in $with_python) + PYTHON="$with_python" + with_python=yes + else + if test -x "$PYTHON" + then + AC_MSG_NOTICE(Found python in environment PYTHON=$PYTHON) + with_python=yes + fi + fi fi - if test "$PYTHON" != "" - then - PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"` - echo Found Python version $PYTHON_VERSION - fi - if test "$PYTHON_VERSION" != "" - then - if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \ - -d $with_python/lib/python$PYTHON_VERSION/site-packages - then - PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION - PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages - else - if test -r $prefix/include/python$PYTHON_VERSION/Python.h - then - PYTHON_INCLUDES=$prefix/include/python$PYTHON_VERSION - PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages - else - if test -r /usr/include/python$PYTHON_VERSION/Python.h - then - PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION - PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages - else - echo could not find python$PYTHON_VERSION/Python.h - fi - fi - if test ! -d "$PYTHON_SITE_PACKAGES" - then - PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print sysconfig.get_python_lib()"` - fi - fi - fi - if test "$with_python" != "yes" - then - pythondir='$(PYTHON_SITE_PACKAGES)' + + if test "$with_python" == "yes" ; then + AM_PATH_PYTHON(,, [:]) + + if test "$PYTHON" != : ; then + PYTHON_CONFIG="$PYTHON-config" + + if test -x "$PYTHON_CONFIG" + then + PYTHON_INCLUDES=`$PYTHON_CONFIG --includes` + else + if test -r $PYTHON_EXEC_PREFIX/include/python$PYTHON_VERSION/Python.h + then + PYTHON_INCLUDES=-I$PYTHON_EXEC_PREFIX/include/python$PYTHON_VERSION + else + if test -r $prefix/include/python$PYTHON_VERSION/Python.h + then + PYTHON_INCLUDES=-I$prefix/include/python$PYTHON_VERSION + else + if test -r /usr/include/python$PYTHON_VERSION/Python.h + 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 + fi + fi + fi + fi + else + AC_MSG_NOTICE([Could not find python interpreter, disabling bindings]) + with_python=no + fi else - pythondir='$(libdir)/python$(PYTHON_VERSION)/site-packages' + AC_MSG_NOTICE([Could not find python in $with_python, disabling bindings]) + with_python=no fi -else - PYTHON= fi -AM_CONDITIONAL([WITH_PYTHON], test "$PYTHON_INCLUDES" != "") -AC_SUBST([pythondir]) +AM_CONDITIONAL([WITH_PYTHON], [test "$with_python" = "yes"]) AC_SUBST([PYTHON_VERSION]) AC_SUBST([PYTHON_INCLUDES]) -AC_SUBST([PYTHON_SITE_PACKAGES]) +AC_SUBST([pythondir]) + + AC_MSG_CHECKING([whether this host is running a Xen kernel]) RUNNING_XEN= diff --git a/python/Makefile.am b/python/Makefile.am index cda655981e..736631e4a2 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -4,7 +4,7 @@ SUBDIRS= . tests INCLUDES = \ $(WARN_CFLAGS) \ - -I$(PYTHON_INCLUDES) \ + $(PYTHON_INCLUDES) \ -I$(top_srcdir)/include \ -I$(top_builddir)/include \ -I$(top_builddir)/$(subdir)