From: Arran Cudbard-Bell Date: Wed, 23 Dec 2020 22:22:22 +0000 (-0800) Subject: Pass --embed only if python3-config supports it X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b0fa36030adda1d4ed415ef1b41f05316d8dec6a;p=thirdparty%2Ffreeradius-server.git Pass --embed only if python3-config supports it --- diff --git a/src/modules/rlm_python/configure b/src/modules/rlm_python/configure index 09dbd93009d..93a531e3025 100755 --- a/src/modules/rlm_python/configure +++ b/src/modules/rlm_python/configure @@ -2776,7 +2776,13 @@ test -n "$PYTHON_CONFIG_BIN" || PYTHON_CONFIG_BIN="not-found" old_CFLAGS="$CFLAGS" unset CFLAGS - python_cflags=`${PYTHON_CONFIG_BIN} --cflags --embed` + if ${PYTHON_CONFIG_BIN} --help 2>&1 | grep '\-\-embed'; then + PYTHON_CONFIG_EMBED="--embed" + else + PYTHON_CONFIG_EMBED="" + fi + + python_cflags=`${PYTHON_CONFIG_BIN} --cflags ${PYTHON_CONFIG_EMBED}` { $as_echo "$as_me:${as_lineno-$LINENO}: ${PYTHON_CONFIG_BIN}'s cflags were \"${python_cflags}\"" >&5 $as_echo "$as_me: ${PYTHON_CONFIG_BIN}'s cflags were \"${python_cflags}\"" >&6;} @@ -2795,7 +2801,7 @@ $as_echo "$as_me: ${PYTHON_CONFIG_BIN}'s cflags were \"${python_cflags}\"" >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: Sanitized cflags were \"${mod_cflags}\"" >&5 $as_echo "$as_me: Sanitized cflags were \"${mod_cflags}\"" >&6;} - python_ldflags=`${PYTHON_CONFIG_BIN} --ldflags --embed` + python_ldflags=`${PYTHON_CONFIG_BIN} --ldflags ${PYTHON_CONFIG_EMBED}` { $as_echo "$as_me:${as_lineno-$LINENO}: ${PYTHON_CONFIG_BIN}'s ldflags were \"$python_ldflags}\"" >&5 $as_echo "$as_me: ${PYTHON_CONFIG_BIN}'s ldflags were \"$python_ldflags}\"" >&6;} diff --git a/src/modules/rlm_python/configure.ac b/src/modules/rlm_python/configure.ac index e502cb7bb63..a1c8a3cf1aa 100644 --- a/src/modules/rlm_python/configure.ac +++ b/src/modules/rlm_python/configure.ac @@ -37,7 +37,18 @@ if test x$with_[]modname != xno; then old_CFLAGS="$CFLAGS" unset CFLAGS - python_cflags=`${PYTHON_CONFIG_BIN} --cflags --embed` + dnl # + dnl # Not all python3-config versions have --embed. If doesn't + dnl # the utility throws an error, and if it does, it omits the + dnl # linker argument to link to Python. + dnl # + if ${PYTHON_CONFIG_BIN} --help 2>&1 | grep '\-\-embed'; then + PYTHON_CONFIG_EMBED="--embed" + else + PYTHON_CONFIG_EMBED="" + fi + + python_cflags=`${PYTHON_CONFIG_BIN} --cflags ${PYTHON_CONFIG_EMBED}` AC_MSG_NOTICE([${PYTHON_CONFIG_BIN}'s cflags were \"${python_cflags}\"]) dnl # Convert -I to -isystem to get rid of warnings about issues in Python headers @@ -66,7 +77,7 @@ if test x$with_[]modname != xno; then '` AC_MSG_NOTICE([Sanitized cflags were \"${mod_cflags}\"]) - python_ldflags=`${PYTHON_CONFIG_BIN} --ldflags --embed` + python_ldflags=`${PYTHON_CONFIG_BIN} --ldflags ${PYTHON_CONFIG_EMBED}` AC_MSG_NOTICE([${PYTHON_CONFIG_BIN}'s ldflags were \"$python_ldflags}\"]) dnl # Strip -Wl,-O1... Is -O even a valid linker flag??