1dnl a macro to check for the installed Pyrex version; note PYTHON needs to 2dnl be set before this function is called. 3dnl PYREX_CHECK_VERSION([MIN-VERSION], [ACTION-IF-TRUE], [ACTION-IF-FALSE]) 4AC_DEFUN([PYREX_CHECK_VERSION], 5 [prog="import sys 6from Pyrex.Compiler.Version import version 7# split strings by '.' and convert to numeric. Append some zeros 8# because we need at least 4 digits for the hex conversion. 9pyrexver = map(int, version.rstrip('abcdefghijklmnopqrstuvwxyz').split('.')) + [[0, 0, 0]] 10pyrexverhex = 0 11for i in xrange(0, 4): pyrexverhex = (pyrexverhex << 8) + pyrexver[[i]] 12minver = map(int, '$1'.split('.')) + [[0, 0, 0]] 13minverhex = 0 14for i in xrange(0, 4): minverhex = (minverhex << 8) + minver[[i]] 15sys.exit(pyrexverhex < minverhex)" 16 AS_IF([AM_RUN_LOG([$PYTHON -c "$prog"])], [$2], [$3])]) 17 18