Use the --embed when running "python3-config --ldflags" if supported.

Newer versions of python3-config only include libpython in the
output when the --embed is used.  Otherwise, "python3-config --libs"
and "python3-config --ldflags" only list the libraries python is
dependent on and not the python library itself.
This commit is contained in:
Todd C. Miller
2020-05-03 12:56:26 -06:00
parent aba4915b83
commit a212ee64e3
2 changed files with 14 additions and 2 deletions

8
configure vendored
View File

@@ -19465,9 +19465,15 @@ fi
if test -z "$PYTHON_LIBS"; then :
# Newer versions of python3-config need --embed to include libpython
if $PYTHON_CONFIG 2>&1 | grep embed >/dev/null; then
PY_EMBED=--embed
else
PY_EMBED=
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking python linker flags" >&5
$as_echo_n "checking python linker flags... " >&6; }
PYTHON_LIBS=`$PYTHON_CONFIG --ldflags`
PYTHON_LIBS=`$PYTHON_CONFIG --ldflags $PY_EMBED`
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_LIBS" >&5
$as_echo "$PYTHON_LIBS" >&6; }

View File

@@ -2600,8 +2600,14 @@ if test ${USE_PYTHON-'no'} = "yes"; then
])
AS_IF([test -z "$PYTHON_LIBS"], [
# Newer versions of python3-config need --embed to include libpython
if $PYTHON_CONFIG 2>&1 | grep embed >/dev/null; then
PY_EMBED=--embed
else
PY_EMBED=
fi
AC_MSG_CHECKING([python linker flags])
PYTHON_LIBS=`$PYTHON_CONFIG --ldflags`
PYTHON_LIBS=`$PYTHON_CONFIG --ldflags $PY_EMBED`
AC_MSG_RESULT([$PYTHON_LIBS])
])