autoconf prefers Python 3 over 2

The configure script now looks for Python 3.6 or newer, then falls back
to Python 2. All Makefile default to Python 3 if Python 3 is available.

See: pagure.io/freeipa/issue/7131
Signed-off-by: Christian Heimes <cheimes@redhat.com>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
Christian Heimes 2018-02-22 15:02:56 +01:00
parent fd9ede5296
commit fa94ef0412

View File

@ -100,27 +100,28 @@ PKG_CHECK_MODULES([CRYPTO], [libcrypto])
dnl ---------------------------------------------------------------------------
dnl - Check for Python
dnl ---------------------------------------------------------------------------
AC_MSG_NOTICE([Checking for Python])
have_python=no
AM_PATH_PYTHON(2.7)
if test "x$PYTHON" = "x" ; then
AC_MSG_ERROR([Python not found])
fi
dnl ---------------------------------------------------------------------------
dnl - Check for Python 2/3 for devcheck
dnl ---------------------------------------------------------------------------
AC_MSG_NOTICE([Checking for Python 3])
AC_PATH_PROG(PYTHON3, python3)
AC_SUBST([PYTHON3])
AM_CONDITIONAL([WITH_PYTHON3], [test "x${PYTHON3}" != "x"])
AC_MSG_NOTICE([Checking for Python 2])
AC_PATH_PROG(PYTHON2, python2)
AC_SUBST([PYTHON2])
AM_CONDITIONAL([WITH_PYTHON2], [test "x${PYTHON2}" != "x"])
AC_PATH_PROG(PYTHON3, python3)
AC_SUBST([PYTHON3])
AM_CONDITIONAL([WITH_PYTHON3], [test "x${PYTHON3}" != "x"])
if test \( "x${PYTHON3}" = "x" -o "x${PYTHON}" != "x" \); then
dnl Python 3 is not available *or* user has set PYTHON variable.
dnl Accept Python >= 2.7 as default Python. We also accept any Python 3
dnl version from PYTHON environment variable.
AM_PATH_PYTHON(2.7)
elif test "x${PYTHON3}" != "x"; then
dnl Found Python 3, but no user override. Use Python >= 3.6 as default.
AM_PATH_PYTHON(3.6)
fi
dnl ---------------------------------------------------------------------------
dnl - Check for cmocka unit test framework http://cmocka.cryptomilk.org/
@ -590,7 +591,9 @@ echo "
source code location: ${srcdir}
compiler: ${CC}
cflags: ${CFLAGS}
Python: ${PYTHON}
Default Python: ${PYTHON} (${PYTHON_VERSION})
Python 2: ${PYTHON2}
Python 3: ${PYTHON3}
pylint: ${PYLINT}
jslint: ${JSLINT}
LDAP libs: ${LDAP_LIBS}