summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2013-09-14 17:24:24 -0400
committerFrédéric Péters <fpeters@entrouvert.com>2013-12-05 17:24:25 +0100
commit624d20244b2323d7969480a3376b3f1c43eb90df (patch)
treed48119da3d8f98969bc19ace28a56b9623906c7e
parentc8058668037110e35285913ab2f8c25741867cb9 (diff)
downloadlasso-624d20244b2323d7969480a3376b3f1c43eb90df.tar.gz
lasso-624d20244b2323d7969480a3376b3f1c43eb90df.tar.xz
lasso-624d20244b2323d7969480a3376b3f1c43eb90df.zip
Better python detection in configure.ac
License: MIT Signed-off-by: Simo Sorce <simo@redhat.com>
-rw-r--r--configure.ac18
1 files changed, 7 insertions, 11 deletions
diff --git a/configure.ac b/configure.ac
index a088547c..c04cd94a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -362,7 +362,7 @@ fi
dnl need to change quotes to allow square brackets
changequote(<<, >>)dnl
-PYTHON_VERSION=`$PYTHON -c 'import sys; print sys.version[:3]' 2>/dev/null`
+PYTHON_VERSION=`$PYTHON -c 'from distutils import sysconfig ; print sysconfig.get_config_var("VERSION")'`
changequote([, ])dnl
test "x$PYTHON" != "x" || AC_MSG_ERROR(Python must be installed to compile lasso)
@@ -370,21 +370,17 @@ test "x$PYTHON" != "x" || AC_MSG_ERROR(Python must be installed to compile lasso
AC_MSG_CHECKING(for Python development files)
dnl Check if we were be able to extract a good version number.
if test "X$PYTHON_VERSION" != "X"; then
- PY_PREFIX=`$PYTHON -c 'import sys ; print sys.prefix'`
- PY_EXEC_PREFIX=`$PYTHON -c 'import sys ; print sys.exec_prefix'`
changequote(<<, >>)dnl
- PY_VERSION=`$PYTHON -c 'import sys ; print sys.version[0:3]'`
+ PYTHON_INC=`$PYTHON -c 'from distutils import sysconfig ; print sysconfig.get_python_inc()'`
+ PYTHON_LIB=`$PYTHON -c 'from distutils import sysconfig ; print sysconfig.get_python_lib(1)'`
changequote([, ])dnl
- PYTHON_H=$PY_PREFIX/include/python$PY_VERSION/Python.h
- LIBPYTHON_SO=$PY_PREFIX/lib/libpython$PY_VERSION.so
+ PYTHON_H=$PYTHON_INC/Python.h
if test -f $PYTHON_H; then
- dnl Not useful unless we make a test on the python version.
- PYTHON="python$PY_VERSION"
- PY_CFLAGS="-I$PY_PREFIX/include/python$PY_VERSION"
- PY_MAKEFILE="$PY_EXEC_PREFIX/lib/python$PY_VERSION/config/Makefile"
+ PY_CFLAGS="-I$PYTHON_INC"
+ PY_MAKEFILE=`$PYTHON -c 'from distutils import sysconfig ; print sysconfig.get_makefile_filename()'`
PY_OTHER_LIBS=`$SED -n -e 's/^LIBS=\(.*\)/\1/p' $PY_MAKEFILE`
PY_EXTRA_LIBS="$PY_LOCALMODLIBS $PY_BASEMODLIBS $PY_OTHER_LIBS"
- PY_SITE_PACKAGES="\${prefix}/lib/python$PY_VERSION/site-packages"
+ PY_SITE_PACKAGES="$PYTHON_LIB"
AC_SUBST(PYTHON)
AC_SUBST(PY_LIB_LOC)
AC_SUBST(PY_CFLAGS)