Files
xen/m4/python_devel.m4
T
Marek Marczykowski-Górecki 2a353c048c tools: Don't use distutils in configure or Makefile
Python distutils is deprecated and is going to be removed in Python
3.12.  distutils.sysconfig is available as the sysconfig module in
stdlib since Python 2.7 and Python 3.2, so use that directly.

Update the README to reflect that we now depend on Python 2.7.

Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Signed-off-by: Javi Merino <javi.merino@cloud.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
[Regen ./configure]
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
2023-09-20 20:53:58 +01:00

46 lines
1.8 KiB
Plaintext

AC_DEFUN([AX_CHECK_PYTHON_DEVEL], [
ac_previous_cppflags=$CPPFLAGS
ac_previous_ldflags=$LDFLAGS
ac_previous_libs=$LIBS
AC_PATH_PROG([pyconfig], [$PYTHON-config], [no])
AS_IF([test x"$pyconfig" = x"no"], [
dnl For those that don't have python-config
CPPFLAGS="$CFLAGS `$PYTHON -c 'import sysconfig; \
print("-I" + sysconfig.get_config_var("INCLUDEPY"))'`"
CPPFLAGS="$CPPFLAGS `$PYTHON -c 'import sysconfig; \
print(sysconfig.get_config_var("CFLAGS"))'`"
LDFLAGS="$LDFLAGS `$PYTHON -c 'import sysconfig; \
print("-L" + sysconfig.get_python_lib(plat_specific=1,\
standard_lib=1) + "/config")'`"
LDFLAGS="$LDFLAGS `$PYTHON -c 'import sysconfig; \
print(sysconfig.get_config_var("LINKFORSHARED"))'`"
LDFLAGS="$LDFLAGS `$PYTHON -c 'import sysconfig; \
print(sysconfig.get_config_var("LDFLAGS"))'`"
LIBS="$LIBS `$PYTHON -c 'import sysconfig; \
print(sysconfig.get_config_var("LIBS"))'`"
LIBS="$LIBS `$PYTHON -c 'import sysconfig; \
print(sysconfig.get_config_var("SYSLIBS"))'`"
], [
dnl If python-config is found use it
CPPFLAGS="$CFLAGS `$PYTHON-config --cflags`"
dnl We need to use --embed with python 3.8 but not with earlier version so
dnl check if it is recognized.
python_devel_embed=""
if $PYTHON-config --embed >/dev/null 2>/dev/null; then
python_devel_embed="--embed"
fi
LDFLAGS="$LDFLAGS `$PYTHON-config --ldflags $python_devel_embed`"
LIBS="$LIBS `$PYTHON-config --libs $python_devel_embed`"
unset python_devel_embed
])
AC_CHECK_HEADER([Python.h], [],
[AC_MSG_ERROR([Unable to find Python development headers])],)
AC_CHECK_FUNC([PyArg_ParseTuple], [],
[AC_MSG_ERROR([Unable to find a suitable python development library])])
CPPFLAGS=$ac_previous_cppflags
LDFLAGS=$ac_previous_ldflags
LIBS=$ac_previous_libs
])