Skip to content

Commit

Permalink
Autoconf: Find Python, even if PYTHON is empty
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
marshallward authored and adcroft committed Jul 7, 2023
1 parent d44c228 commit 620d933
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions ac/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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~
5 changes: 5 additions & 0 deletions ac/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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])
], [
Expand Down

0 comments on commit 620d933

Please sign in to comment.