]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Pass --embed only if python3-config supports it
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 23 Dec 2020 22:22:22 +0000 (14:22 -0800)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 23 Dec 2020 22:22:22 +0000 (14:22 -0800)
src/modules/rlm_python/configure
src/modules/rlm_python/configure.ac

index 09dbd93009deb3cb5ad579c256b323a940dd21fe..93a531e30257b7d65d5b7b12ce5154d50b164125 100755 (executable)
@@ -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;}
 
index e502cb7bb6322816f3ed8a75c6e94c59fc50b863..a1c8a3cf1aa0fa81ed042484c1813cf81354d0a5 100644 (file)
@@ -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??