From e9c43537a564d5735fb53608be37227bf1bfe770 Mon Sep 17 00:00:00 2001 From: Marshall Ward Date: Wed, 5 Jul 2023 14:09:46 -0400 Subject: [PATCH] Autoconf: Find Python, even if PYTHON is empty The autoconf Python interpreter search was slightly modified to search for Python even if $PYTHON is set to an empty string. This is done by unsetting PYTHON if it is set but empty, then following the usual macro. This was required since `export PYTHON` in a Makefile will create the `PYTHON` variable but will assign it no value (i.e. empty string). This causes issues in some build environments. The backup `configure~` script was also added to the developer `ac-clean` cleanup rule. --- ac/Makefile.in | 1 + ac/configure.ac | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/ac/Makefile.in b/ac/Makefile.in index 43262027e6..64a60e70d1 100644 --- a/ac/Makefile.in +++ b/ac/Makefile.in @@ -56,3 +56,4 @@ ac-clean: distclean rm -f @srcdir@/ac/aclocal.m4 rm -rf @srcdir@/ac/autom4te.cache rm -f @srcdir@/ac/configure + rm -f @srcdir@/ac/configure~ diff --git a/ac/configure.ac b/ac/configure.ac index 7ea1870816..9d87240506 100644 --- a/ac/configure.ac +++ b/ac/configure.ac @@ -238,8 +238,13 @@ AC_COMPILE_IFELSE( # Python interpreter test +# Declare the Python interpreter variable AC_ARG_VAR([PYTHON], [Python interpreter command]) +# If PYTHON is set to an empty string, then unset it +AS_VAR_IF([PYTHON], [], [AS_UNSET([PYTHON])], []) + +# Now attempt to find a Python interpreter if PYTHON is unset AS_VAR_SET_IF([PYTHON], [ AC_PATH_PROGS([PYTHON], ["$PYTHON"], [none]) ], [