summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorPeter Johnson <peter@tortall.net>2006-04-04 07:51:42 +0000
committerPeter Johnson <peter@tortall.net>2006-04-04 07:51:42 +0000
commitb22db3f5cac96015a29449a968b1fcdb48d1fe93 (patch)
tree76135d19c11f008de67639156ca4e28f9cf232fe /m4
parenta5d91fba6a8f20465f6a8884207f98b241d993fe (diff)
downloadyasm-b22db3f5cac96015a29449a968b1fcdb48d1fe93.tar.gz
Be much smarter at checking for and running Pyrex. Pyrex is a Python module
and the "pyrexc" command is just a wrapper, so instead of looking for "pyrexc" look for the module instead. * pyrex.m4: New macro to check Pyrex version. * m4/Makefile.inc: Add to dist. * configure.ac: Use macro to check for Pyrex >= 0.9.3. * python-yasm/Makefile.inc: Run Python directly instead of pyrexc wrapper. svn path=/trunk/yasm/; revision=1457
Diffstat (limited to 'm4')
-rw-r--r--m4/Makefile.inc1
-rw-r--r--m4/pyrex.m414
2 files changed, 15 insertions, 0 deletions
diff --git a/m4/Makefile.inc b/m4/Makefile.inc
index 3df185a9..4dac7a1c 100644
--- a/m4/Makefile.inc
+++ b/m4/Makefile.inc
@@ -27,3 +27,4 @@ EXTRA_DIST += m4/progtest.m4
EXTRA_DIST += m4/stdint_h.m4
EXTRA_DIST += m4/uintmax_t.m4
EXTRA_DIST += m4/pythonhead.m4
+EXTRA_DIST += m4/pyrex.m4
diff --git a/m4/pyrex.m4 b/m4/pyrex.m4
new file mode 100644
index 00000000..b6e5bd66
--- /dev/null
+++ b/m4/pyrex.m4
@@ -0,0 +1,14 @@
+AC_DEFUN([PYREX_CHECK_VERSION],
+ [prog="import sys
+from Pyrex.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.
+pyrexver = map(int, version.split('.')) + [[0, 0, 0]]
+pyrexverhex = 0
+for i in xrange(0, 4): pyrexverhex = (pyrexverhex << 8) + pyrexver[[i]]
+minver = map(int, '$1'.split('.')) + [[0, 0, 0]]
+minverhex = 0
+for i in xrange(0, 4): minverhex = (minverhex << 8) + minver[[i]]
+sys.exit(pyrexverhex < minverhex)"
+ AS_IF([AM_RUN_LOG([$PYTHON -c "$prog"])], [$2], [$3])])
+