Blob Blame History Raw
commit af29047480cacafaed697cb2a1fb24c5143078a8
Author: John Dennis <jdennis@redhat.com>
Date:   Sat Jul 7 10:59:32 2018 -0400

    Configure should search for versioned Python interpreter.
    
    Following the guidelines in Python PEP 394 with regards to the python
    command on UNIX like systems preference should be given to explicitly
    versioned command interpreter as opposed to unversioned and that an
    unversioned python command should (but might not) refer to
    Python2. Also in some environments unversioned Python interpreters
    (e.g. /usr/bin/python) do not even exist, onlyh their explicitly
    versioned variants are (e.g. /usr/bin/python2 and /usr/bin/python3).
    
    Therefore the AC_CHECK_PROGS directive in configure.ac should not rely
    exclusively on an unversioned Python interpreter as it does not,
    rather it should search in priority order. First for python3, then for
    an unversionsed python because some distributions have already moved
    the default unversioned python to python3, and then finally search for
    python2. In the scenario where unversioned python is still pointing to
    python2 it's equivalent to selecting the last prority option of
    python2, but if unversioned python is pointing to python3 you get
    instead. The net result is always preferring python3 but gracefully
    falling back to python2 not matter how the environment exports it's
    Python.
    
    If AC_CHECK_PROGS for python does not check for the versioned variants
    the build fails in environments that only have versioned variants with
    this error:
    
    configure: error: Python must be installed to compile lasso
    
    License: MIT
    Signed-off-by: John Dennis <jdennis@redhat.com>

diff --git a/configure.ac b/configure.ac
index 898468e6..74766972 100644
--- a/configure.ac
+++ b/configure.ac
@@ -131,7 +131,7 @@ dnl AC_CHECK_PROGS(JAR, fastjar jar)
 AC_CHECK_PROGS(PERL, perl)
 AC_CHECK_PROGS(PHP5, php5 php)
 AC_CHECK_PROGS(PHP5_CONFIG, php-config5 php-config)
-AC_CHECK_PROGS(PYTHON, python)
+AC_CHECK_PROGS(PYTHON, python3 python python2)
 AC_CHECK_PROGS(SWIG, swig)
 
 dnl Make sure we have an ANSI compiler