configure: Fix Python configure checks to work with all Python versions between 2.7 and 3.3

This commit is contained in:
Sebastian Dröge 2013-09-30 12:30:43 +02:00
parent 11d1e09f99
commit cbc99d041a

View file

@ -43,9 +43,9 @@ AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
[AC_REQUIRE([AM_PATH_PYTHON]) [AC_REQUIRE([AM_PATH_PYTHON])
AC_MSG_CHECKING(for headers required to compile python extensions) AC_MSG_CHECKING(for headers required to compile python extensions)
dnl deduce PYTHON_INCLUDES dnl deduce PYTHON_INCLUDES
py_prefix=`$PYTHON -c "import sys; print sys.prefix"` py_prefix=`$PYTHON -c "import sys; print(sys.prefix)"`
py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"` py_exec_prefix=`$PYTHON -c "import sys; print(sys.exec_prefix)"`
if $PYTHON-config --help 2>/dev/null; then if $PYTHON-config --help 1>/dev/null 2>/dev/null; then
PYTHON_INCLUDES=`$PYTHON-config --includes 2>/dev/null` PYTHON_INCLUDES=`$PYTHON-config --includes 2>/dev/null`
else else
PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}" PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}"
@ -73,9 +73,9 @@ AC_DEFUN([AM_CHECK_PYTHON_LIBS],
AC_MSG_CHECKING(for libraries required to embed python) AC_MSG_CHECKING(for libraries required to embed python)
dnl deduce PYTHON_LIBS dnl deduce PYTHON_LIBS
if $PYTHON-config --help 2>/dev/null; then if $PYTHON-config --help 1>/dev/null 2>/dev/null; then
PYTHON_LIBS=`$PYTHON-config --ldflags 2>/dev/null` PYTHON_LIBS=`$PYTHON-config --ldflags 2>/dev/null`
PYTHON_LIB=`$PYTHON -c "import distutils.sysconfig as s; print s.get_python_lib(standard_lib=1)"` PYTHON_LIB=`$PYTHON -c "import distutils.sysconfig as s; print(s.get_python_lib(standard_lib=1))"`
if echo "$host_os" | grep darwin >/dev/null 2>&1; then if echo "$host_os" | grep darwin >/dev/null 2>&1; then
dnl OSX is a pain. Python as shipped by apple installs libpython in /usr/lib dnl OSX is a pain. Python as shipped by apple installs libpython in /usr/lib
dnl so we hardcode that. Other systems can use --with-libpython-dir to dnl so we hardcode that. Other systems can use --with-libpython-dir to