Since Python 3.8 --embed flag needs to be provided to python-config to embed python.
Reference: https://bugs.python.org/issue36721
This was partially addressed in #3170 but only fixed building and not linking with python.
if test $? -ne 0; then
with_libpython="no"
fi
if test $? -ne 0; then
with_libpython="no"
fi
- LIBPYTHON_LDFLAGS="`${PYTHON_CONFIG} --ldflags`"
+ LIBPYTHON_LDFLAGS="`${PYTHON_CONFIG} --ldflags --embed`" || LIBPYTHON_LDFLAGS="`${PYTHON_CONFIG} --ldflags`"
if test $? -ne 0; then
with_libpython="no"
fi
if test $? -ne 0; then
with_libpython="no"
fi