mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 18:21:39 +01:00
https://docs.python.org/3.8/whatsnew/3.8.html#debug-build-uses-the-same-abi-as-release-build > To embed Python into an application, a new --embed option must be > passed to python3-config --libs --embed to get -lpython3.8 (link the > application to libpython). To support both 3.8 and older, try > python3-config --libs --embed first and fallback to python3-config > --libs (without --embed) if the previous command fails. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Acked-by: Wei Liu <wl@xen.org> [ wei: rerun autogen.sh ]
46 lines
2.0 KiB
Plaintext
46 lines
2.0 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 distutils.sysconfig; \
|
|
print("-I" + distutils.sysconfig.get_config_var("INCLUDEPY"))'`"
|
|
CPPFLAGS="$CPPFLAGS `$PYTHON -c 'import distutils.sysconfig; \
|
|
print(distutils.sysconfig.get_config_var("CFLAGS"))'`"
|
|
LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
|
|
print("-L" + distutils.sysconfig.get_python_lib(plat_specific=1,\
|
|
standard_lib=1) + "/config")'`"
|
|
LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
|
|
print(distutils.sysconfig.get_config_var("LINKFORSHARED"))'`"
|
|
LDFLAGS="$LDFLAGS `$PYTHON -c 'import distutils.sysconfig; \
|
|
print(distutils.sysconfig.get_config_var("LDFLAGS"))'`"
|
|
LIBS="$LIBS `$PYTHON -c 'import distutils.sysconfig; \
|
|
print(distutils.sysconfig.get_config_var("LIBS"))'`"
|
|
LIBS="$LIBS `$PYTHON -c 'import distutils.sysconfig; \
|
|
print(distutils.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
|
|
])
|