if test -z "$PYTHON" ; then
AC_MSG_WARN([Python not found])
else
- AC_CHECK_PROGS(PYREX, pyrexc)
-
- if test -z "$PYREX" ; then
- have_pyrex=no
- else
- have_pyrex=yes
- fi
+ AC_MSG_CHECKING([for Pyrex >= 0.9.3])
+ PYREX_CHECK_VERSION(0.9.3, [AC_MSG_RESULT(yes)
+ have_pyrex=yes],
+ [AC_MSG_RESULT(no)
+ have_pyrex=no])
AM_CHECK_PYTHON_HEADERS(have_python_headers=yes,have_python_headers=no)
EXTRA_DIST += m4/stdint_h.m4
EXTRA_DIST += m4/uintmax_t.m4
EXTRA_DIST += m4/pythonhead.m4
+EXTRA_DIST += m4/pyrex.m4
--- /dev/null
+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])])
+
EXTRA_DIST += $(PYBINDING_DEPS)
yasm_python.c: $(srcdir)/tools/python-yasm/yasm.pyx $(PYBINDING_DEPS)
- $(PYREX) -o $@ `test -f tools/python-yasm/yasm.pyx || echo '$(srcdir)/'`tools/python-yasm/yasm.pyx
+ $(PYTHON) -c "from Pyrex.Compiler.Main import main; main(command_line=1)" \
+ -o $@ `test -f tools/python-yasm/yasm.pyx || echo '$(srcdir)/'`tools/python-yasm/yasm.pyx
CLEANFILES += yasm_python.c