summaryrefslogtreecommitdiff
path: root/m4/cython.m4
diff options
context:
space:
mode:
authorPeter Johnson <peter@tortall.net>2010-01-01 20:55:07 +0000
committerPeter Johnson <peter@tortall.net>2010-01-01 20:55:07 +0000
commitfcb228f18cd5c1286e79ff3d0e7b6a299df76fc6 (patch)
treea8eb6cbea4eed2c57ccaefea85e7772a722115ae /m4/cython.m4
parentf608f67ad258a7802a674809f2e5472c7651aef9 (diff)
downloadyasm-fcb228f18cd5c1286e79ff3d0e7b6a299df76fc6.tar.gz
Use Cython instead of Pyrex.
svn path=/trunk/yasm/; revision=2256
Diffstat (limited to 'm4/cython.m4')
-rw-r--r--m4/cython.m417
1 files changed, 17 insertions, 0 deletions
diff --git a/m4/cython.m4 b/m4/cython.m4
new file mode 100644
index 00000000..352df3d6
--- /dev/null
+++ b/m4/cython.m4
@@ -0,0 +1,17 @@
+dnl a macro to check for the installed Cython version; note PYTHON needs to
+dnl be set before this function is called.
+dnl CYTHON_CHECK_VERSION([MIN-VERSION], [ACTION-IF-TRUE], [ACTION-IF-FALSE])
+AC_DEFUN([CYTHON_CHECK_VERSION],
+ [prog="import sys
+from Cython.Compiler.Version import version
+# split strings by '.' and convert to numeric. Append some zeros
+# because we need at least 4 digits for the hex conversion.
+ver = map(int, version.rstrip('abcdefghijklmnopqrstuvwxyz').split('.')) + [[0, 0, 0]]
+verhex = 0
+for i in xrange(0, 4): verhex = (verhex << 8) + ver[[i]]
+minver = map(int, '$1'.split('.')) + [[0, 0, 0]]
+minverhex = 0
+for i in xrange(0, 4): minverhex = (minverhex << 8) + minver[[i]]
+sys.exit(verhex < minverhex)"
+ AS_IF([AM_RUN_LOG([$PYTHON -c "$prog"])], [$2], [$3])])
+