Home | History | Annotate | Download | only in m4
      1 dnl a macro to check for the installed Pyrex version; note PYTHON needs to
      2 dnl be set before this function is called.
      3 dnl  PYREX_CHECK_VERSION([MIN-VERSION], [ACTION-IF-TRUE], [ACTION-IF-FALSE])
      4 AC_DEFUN([PYREX_CHECK_VERSION],
      5  [prog="import sys
      6 from 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.
      9 pyrexver = map(int, version.rstrip('abcdefghijklmnopqrstuvwxyz').split('.')) + [[0, 0, 0]]
     10 pyrexverhex = 0
     11 for i in xrange(0, 4): pyrexverhex = (pyrexverhex << 8) + pyrexver[[i]]
     12 minver = map(int, '$1'.split('.')) + [[0, 0, 0]]
     13 minverhex = 0
     14 for i in xrange(0, 4): minverhex = (minverhex << 8) + minver[[i]]
     15 sys.exit(pyrexverhex < minverhex)"
     16   AS_IF([AM_RUN_LOG([$PYTHON -c "$prog"])], [$2], [$3])])
     17 
     18