[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Better python detection
I got this patch from our python maintainer who also told me it can
safely be included upstream, so please consider.
--- configure.in
+++ configure.in
@@ -280,8 +280,8 @@
else
AC_MSG_CHECKING(Python version)
changequote(<<, >>)dnl
- PY_VERSION=`$pythonpath -c 'import sys; print sys.version[:3]'`
- PY_PATH=`$pythonpath -c 'import sys ; print sys.path[1][5:]'`
+ PY_VERSION=`$pythonpath -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_version()'`
+ PY_PATH=`$pythonpath -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_lib(standard_lib=1)'`
$pythonpath -c "import sys; map(int,sys.version[:3].split('.')) >= [2,2] or sys.exit(1)"
changequote([, ])dnl
AC_MSG_RESULT($PY_VERSION)
@@ -289,9 +289,10 @@
AC_MSG_CHECKING(Python compile flags)
PY_PREFIX=`$pythonpath -c 'import sys; print sys.prefix'`
PY_EXEC_PREFIX=`$pythonpath -c 'import sys; print sys.exec_prefix'`
- if test -f $PY_PREFIX/include/python$PY_VERSION/Python.h; then
- PY_LIBS="-L$PY_EXEC_PREFIX/$PY_PATH/config -lpython$PY_VERSION -lpthread -lutil"
- PY_CFLAGS="-I$PY_PREFIX/include/python$PY_VERSION"
+ PY_INCLUDE=`$pythonpath -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_inc()'`
+ if test -f $PY_INCLUDE/Python.h; then
+ PY_LIBS="-L$PY_PATH/config -lpython$PY_VERSION -lpthread -lutil"
+ PY_CFLAGS="-I$PY_INCLUDE"
AC_MSG_RESULT(ok)
else
python=no
--
Mads Martin Joergensen, http://mmj.dk
"Why make things difficult, when it is possible to make them cryptic
and totally illogical, with just a little bit more effort?"
-- A. P. J.
--
XChat-discuss: mailing list for XChat users
Archive: http://mail.nl.linux.org/xchat-discuss/