]> arthur.barton.de Git - bup.git/blobdiff - config/configure
Prefer python 3, and mention intent to drop python 2 support
[bup.git] / config / configure
index afdfa3880ccb9aead3dd001b1e754bb4e16c74e0..6ef05315feaaa0dc349bbf28a1c34d38736672de 100755 (executable)
@@ -66,20 +66,28 @@ expr "$MAKE_VERSION" '>=' '3.81' || AC_FAIL "ERROR: $MAKE must be >= version 3.8
 AC_SUB bup_make "$MAKE"
 
 bup_python="$(type -p "$PYTHON")"
-test -z "$bup_python" && bup_python="$(bup_find_prog python2.7 '')"
-test -z "$bup_python" && bup_python="$(bup_find_prog python2.6 '')"
-test -z "$bup_python" && bup_python="$(bup_find_prog python2 '')"
 test -z "$bup_python" && bup_python="$(bup_find_prog python3.8 '')"
 test -z "$bup_python" && bup_python="$(bup_find_prog python3.7 '')"
 test -z "$bup_python" && bup_python="$(bup_find_prog python3.6 '')"
 test -z "$bup_python" && bup_python="$(bup_find_prog python3 '')"
+test -z "$bup_python" && bup_python="$(bup_find_prog python2.7 '')"
+test -z "$bup_python" && bup_python="$(bup_find_prog python2.6 '')"
+test -z "$bup_python" && bup_python="$(bup_find_prog python2 '')"
 test -z "$bup_python" && bup_python="$(bup_find_prog python '')"
 if test -z "$bup_python"; then
     AC_FAIL "ERROR: unable to find python"
 else
     AC_SUB bup_python "$bup_python"
-    AC_SUB bup_python_majver \
-           "$("$bup_python" -c 'import sys; print(sys.version_info[0])')"
+    bup_python_majver=$("$bup_python" -c 'import sys; print(sys.version_info[0])')
+    bup_python_minver=$("$bup_python" -c 'import sys; print(sys.version_info[1])')
+    AC_SUB bup_python_majver "$bup_python_majver"
+fi
+
+# May not be correct yet, i.e. actual requirement may be higher.
+if test "$bup_python_majver" -gt 2 -a "$bup_python_minver" -lt 3; then
+    # utime follow_symlinks >= 3.3
+    bup_version_str=$("$bup_python" --version 2>&1)
+    AC_FAIL "ERROR: found $bup_version_str (must be >= 3.3 if >= 3)"
 fi
 
 bup_git="$(bup_find_prog git '')"
@@ -101,13 +109,16 @@ AC_CHECK_HEADERS sys/mman.h
 AC_CHECK_HEADERS linux/fs.h
 AC_CHECK_HEADERS sys/ioctl.h
 
-# On GNU/kFreeBSD utimensat is defined in GNU libc, but won't work.
-if [ -z "$OS_GNU_KFREEBSD" ]; then
-    AC_CHECK_FUNCS utimensat
+if test "$bup_python_majver" -gt 2; then
+    AC_DEFINE BUP_USE_PYTHON_UTIME 1
+else # Python 2
+    # On GNU/kFreeBSD utimensat is defined in GNU libc, but won't work.
+    if [ -z "$OS_GNU_KFREEBSD" ]; then
+        AC_CHECK_FUNCS utimensat
+    fi
+    AC_CHECK_FUNCS utimes
+    AC_CHECK_FUNCS lutimes
 fi
-AC_CHECK_FUNCS utimes
-AC_CHECK_FUNCS lutimes
-
 
 builtin_mul_overflow_code="
 #include <stddef.h>