diff --git a/configure b/configure index ff47a59df..9b44e3d6b 100755 --- a/configure +++ b/configure @@ -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; } diff --git a/configure.ac b/configure.ac index 12979a153..008f7b5cc 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) ])