mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-03-02 12:00:35 +01: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')
(cherry picked from commit 91bf576a43)
(cherry picked from commit 58a24f4f66)
This commit is contained in:
parent
16e5b307a3
commit
7cb48c4608
1 changed files with 7 additions and 3 deletions
10
configure.ac
10
configure.ac
|
|
@ -1216,9 +1216,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…
Add table
Reference in a new issue