mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-20 17:55:49 +00:00
build: fix detection of python for autotools
The goal of this code is to detect python, but prefer python3 while
also allowing the user to override the path.
That did not work in all cases, due to what seems like a bug in
AM_PATH_PYTHON(). AM_PATH_PYTHON() is documented to ignore failure
if [action-if-not-found] is given. So one might assume that:
AM_PATH_PYTHON([3], [], [PYTHON=])
if test -z "$PYTHON"; then
AM_PATH_PYTHON([], [], [PYTHON=python])
fi
first tries to look for v3, and if that fails search for any python
interpreter. That did not work however with:
$ ./configure PYTHON=/usr/bin/python2
...
checking pkg-config is at least version 0.9.0... yes
checking whether /usr/bin/python2 version is >= 3... no
configure: error: Python interpreter is too old
because the first AM_PATH_PYTHON() is fatal.
Work around that.
Fixes: 54a1cfa973
('build: prefer python3 over python2 in autotools's configure script')
This commit is contained in:
parent
5a20d96f36
commit
91bf576a43
10
configure.ac
10
configure.ac
|
@ -1229,9 +1229,13 @@ else
|
|||
fi
|
||||
AC_SUBST(NM_LOG_COMPILER, 'LOG_COMPILER = "$(top_srcdir)/tools/run-nm-test.sh" --called-from-make "$(abs_top_builddir)" "$(LIBTOOL)" "$(with_valgrind)" "'"$with_valgrind_suppressions"'" --launch-dbus=auto')
|
||||
|
||||
AM_PATH_PYTHON([3], [], [PYTHON=])
|
||||
if test -z "$PYTHON"; then
|
||||
AM_PATH_PYTHON([], [], [PYTHON=python])
|
||||
if test -n "$PYTHON" ; then
|
||||
AM_PATH_PYTHON([], [], [])
|
||||
else
|
||||
AM_PATH_PYTHON([3], [], [PYTHON=])
|
||||
if test -z "$PYTHON"; then
|
||||
AM_PATH_PYTHON([], [], [])
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(PYTHON, [$PYTHON])
|
||||
AC_DEFINE_UNQUOTED(TEST_NM_PYTHON, "$PYTHON", [Define python path for test binary])
|
||||
|
|
Loading…
Reference in a new issue