tags 523030 + patch
tags 523031 + patch
thanks

'${prefix}' and '${exec_prefix}' are passed unexpanded to get_python_lib()), and
the macro then defaults to the hardcoded alternative case. The patch passes the
real path names to get_python_lib(), and only for the case, where the prefix
argument was specified on the command line (the case for a missing prefix
argument is handled inside the get_python_lib() function).

tested the macro with python versions 2.0 up to trunk, and the 3.0 and 3.1 
branches.

  Matthias
--- m4/python.m4.orig   2009-04-10 16:39:16.000000000 +0200
+++ m4/python.m4        2009-04-12 15:21:41.000000000 +0200
@@ -117,7 +117,13 @@
   dnl doesn't work.
   AC_CACHE_CHECK([for $am_display_PYTHON script directory],
     [am_cv_python_pythondir],
-    [am_cv_python_pythondir=`$PYTHON -c "from distutils import sysconfig; 
print sysconfig.get_python_lib(0,0,prefix='$PYTHON_PREFIX')" 2>/dev/null ||
+    [if test "x$prefix" = xNONE
+     then
+       py_prefix_arg=
+     else
+       py_prefix_arg=",prefix='$prefix'"
+     fi
+     am_cv_python_pythondir=`$PYTHON -c "from distutils import sysconfig; 
print sysconfig.get_python_lib(0,0$py_prefix_arg)" -n -q install $py_prefix_arg 
2>/dev/null ||
      echo "$PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages"`])
   AC_SUBST([pythondir], [$am_cv_python_pythondir])
 
@@ -134,8 +140,14 @@
   dnl doesn't work.
   AC_CACHE_CHECK([for $am_display_PYTHON extension module directory],
     [am_cv_python_pyexecdir],
-    [am_cv_python_pyexecdir=`$PYTHON -c "from distutils import sysconfig; 
print sysconfig.get_python_lib(1,0,prefix='$PYTHON_EXEC_PREFIX')" 2>/dev/null ||
-     echo "${PYTHON_EXEC_PREFIX}/lib/python${PYTHON_VERSION}/site-packages"`])
+    [if test "x$exec_prefix" = xNONE
+     then
+       py_exec_prefix_arg=$py_prefix_arg
+     else
+       py_exec_prefix_arg=",prefix='$exec_prefix'"
+     fi
+     am_cv_python_pyexecdir=`$PYTHON -c "from distutils import sysconfig; 
print sysconfig.get_python_lib(1,0$py_exec_prefix_arg)" -n -q install 
$py_exec_prefix_arg 2>/dev/null ||
+     echo "$PYTHON_EXEC_PREFIX/lib/python$PYTHON_VERSION/site-packages"`])
   AC_SUBST([pyexecdir], [$am_cv_python_pyexecdir])
 
   dnl pkgpyexecdir -- $(pyexecdir)/$(PACKAGE)

Reply via email to