[libxml2] updated configure.in for python3



commit b8e3f80da742404bffbec2a56c0a91b829132b6f
Author: Daniel Veillard <veillard redhat com>
Date:   Thu Mar 28 09:46:20 2013 +0800

    updated configure.in for python3

 configure.in |   43 +++++++++++++++++++++++--------------------
 1 files changed, 23 insertions(+), 20 deletions(-)
---
diff --git a/configure.in b/configure.in
index 73fe70e..f5e62bc 100644
--- a/configure.in
+++ b/configure.in
@@ -766,7 +766,7 @@ if test "$with_python" != "no" ; then
                 if test -x "$PYTHON"
                 then
                     echo Found python in environment PYTHON=$PYTHON
-                    with_python=`$PYTHON -c "import sys; print sys.exec_prefix"`
+                    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
@@ -775,50 +775,53 @@ if test "$with_python" != "no" ; then
     fi
     if test "$PYTHON" != ""
     then
-        PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[[0:3]]"`
+        PYTHON_VERSION=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_version())"`
+       PYTHON_INCLUDES=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_inc())"`
+# does not work as it produce a /usr/lib/python path instead of/usr/lib64/python
+#
+#      PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_lib())"`
        echo Found Python version $PYTHON_VERSION
     fi
-    if test "$PYTHON_VERSION" != ""
+    if test "$PYTHON_VERSION" != "" -a "$PYTHON_INCLUDES" = ""
     then
-       if test -r $with_python/include/python$PYTHON_VERSION/Python.h -a \
-          -d $with_python/lib/python$PYTHON_VERSION/site-packages
+       if test -r $with_python/include/python$PYTHON_VERSION/Python.h
        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
-                   if test -r $with_python/include/Python.h -a \
-                      -d $with_python/lib/site-packages
+                   if test -r $with_python/include/Python.h
                    then
                        PYTHON_INCLUDES=$with_python/include
-                       PYTHON_SITE_PACKAGES=$with_python/lib/site-packages
                    else
                        echo could not find python$PYTHON_VERSION/Python.h or $with_python/include/Python.h
                    fi
                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
-       PYTHON_LIBS=`python$PYTHON_VERSION-config --ldflags`
     fi
-    if test "$with_python" != ""
+    if test "$PYTHON_VERSION" != "" -a "$PYTHON_SITE_PACKAGES" = ""
     then
-        pythondir='$(PYTHON_SITE_PACKAGES)'
-    else
-        pythondir='$(libdir)/python$(PYTHON_VERSION)/site-packages'
+       if test -d $libdir/python$PYTHON_VERSION/site-packages
+       then
+           PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
+       else
+           if test -d $with_python/lib/site-packages
+           then
+               PYTHON_SITE_PACKAGES=$with_python/lib/site-packages
+           else
+               PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; 
print(sysconfig.get_python_lib())"`
+           fi
+       fi
     fi
+    pythondir='$(PYTHON_SITE_PACKAGES)'
+    PYTHON_LIBS=`python$PYTHON_VERSION-config --ldflags`
 else
     PYTHON=
 fi


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]