X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=config%2Flyxinclude.m4;h=1480fe188a918fd6502fae4560eb5e6c704f0d71;hb=55a3dd7b346d29a52ba305a4558e9e380ef50f47;hp=db31d5dd59adc0e56cd956ff1296c12dbb56847d;hpb=cf4ddb2ed5e71a4b70b9fc86ea4d573cb075b0cb;p=lyx.git diff --git a/config/lyxinclude.m4 b/config/lyxinclude.m4 index db31d5dd59..1480fe188a 100644 --- a/config/lyxinclude.m4 +++ b/config/lyxinclude.m4 @@ -644,3 +644,24 @@ AC_DEFUN([LYX_SET_VERSION_INFO], AC_SUBST(LYX_DIR_VER,"$lyx_dir_ver") AC_SUBST(LYX_USERDIR_VER,"$lyx_userdir_ver") ]) + +# AM_PYTHON_CHECK_VERSION(PROG, VERSION, [ACTION-IF-TRUE], [ACTION-IF-FALSE]) +# --------------------------------------------------------------------------- +# Copied from autoconf 2.68, added a check that python version is < 3.0 +# Run ACTION-IF-TRUE if the Python interpreter PROG has version >= VERSION. +# Run ACTION-IF-FALSE otherwise. +# This test uses sys.hexversion instead of the string equivalent (first +# word of sys.version), in order to cope with versions such as 2.2c1. +# This supports Python 2.0 or higher. (2.0 was released on October 16, 2000). +AC_DEFUN([AM_PYTHON_CHECK_VERSION], + [prog="import sys +# split strings by '.' and convert to numeric. Append some zeros +# because we need at least 4 digits for the hex conversion. +# map returns an iterator in Python 3.0 and a list in 2.x +minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]] +minverhex = 0 +maxverhex = 50331648 # = 3.0.0.0 +# xrange is not present in Python 3.0 and range returns an iterator +for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]] +sys.exit(sys.hexversion < minverhex or sys.hexversion >= maxverhex)" + AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])])