m4macros: Windows may have a versioned directory for headers.

Cf !84. We don't want to just replace the old path without versionned
python, because I assume it has been set for a reason. So there may be
machines with a versionned python path, others without. Let's test both
on Windows.
This commit is contained in:
Jehan 2019-08-06 16:22:32 +02:00
parent 4d74452444
commit 61c11b04c1
1 changed files with 8 additions and 7 deletions

View File

@ -222,18 +222,19 @@ dnl function also defines PYTHON_INCLUDES
AC_DEFUN([AM_CHECK_PYTHON_HEADERS],
[AC_REQUIRE([AM_PATH_PYTHON3])
AC_MSG_CHECKING(for headers required to compile python extensions)
dnl Win32 doesn't have a versioned directory for headers
if test "$PYTHON_PLATFORM" != "win32"; then
py_versiondir="/python${PYTHON_VERSION}"
else
py_versiondir=
fi
dnl deduce PYTHON_INCLUDES
py_prefix=`$PYTHON -c "import sys; print(sys.prefix)"`
py_exec_prefix=`$PYTHON -c "import sys; print(sys.exec_prefix)"`
PYTHON_INCLUDES=`$PKG_CONFIG --cflags-only-I python-${PYTHON_VERSION}`
if test "$py_prefix" != "$py_exec_prefix"; then
PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include${py_versiondir}"
py_versiondir="${py_exec_prefix}/include/python${PYTHON_VERSION}"
dnl Win32 doesn't always have a versioned directory for headers
if test "$PYTHON_PLATFORM" = "win32"; then
if test -d "${py_versiondir}" ; then
py_versiondir=${py_exec_prefix}/include
fi
fi
PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_versiondir}"
fi
AC_SUBST(PYTHON_INCLUDES)
dnl check if the headers exist: