Add check for cython and substitute python and cython in Makefile.am

This commit is contained in:
Tatsuhiro Tsujikawa 2013-12-16 21:46:50 +09:00
parent ff2eb0de81
commit 9d630901fa
2 changed files with 16 additions and 4 deletions

View File

@ -73,6 +73,9 @@ AC_ARG_WITH([libxml2],
[disable support for libxml2])],
[], [with_libxml2=yes])
dnl Define variables
AC_ARG_VAR([CYTHON], [the Cython executable])
dnl Checks for programs
AC_PROG_CC
AC_PROG_CXX
@ -82,6 +85,7 @@ AC_PROG_MAKE_SET
AM_PROG_CC_C_O
PKG_PROG_PKG_CONFIG([0.20])
AM_PATH_PYTHON([2.6],, [:])
AC_CHECK_PROGS([CYTHON], [cython.py cython])
AX_CXX_COMPILE_STDCXX_11([noext], [optional])
@ -354,4 +358,6 @@ AC_MSG_NOTICE([summary of build options:
Examples: ${enable_examples}
Hdtest: ${enable_hdtest}
Failmalloc: ${request_failmalloc}
Python: ${PYTHON} ${PYTHON_VERSION}
Cython: ${CYTHON}
])

View File

@ -25,12 +25,18 @@ EXTRA_DIST = README.rst cnghttp2.pxd nghttp2.pyx setup.py
PYSETUP_INCLUDE_DIRS=$(top_srcdir)/lib/includes:$(top_srcdir)/lib
PYSETUP_LIBDIRS=$(top_builddir)/lib/.libs
CYTHON = @CYTHON@
PYTHON = @PYTHON@
.PHONY: help build_ext
help:
@echo "Please use \`make <target>\` where <target> is one of"
@echo " build_ext to build Python @PYTHON_VERSION@ nghttp2 extension"
nghttp2.c: nghttp2.pyx cnghttp2.pxd
cython nghttp2.pyx
.PHONY: build_ext
$(CYTHON) nghttp2.pyx
build_ext: nghttp2.c
python setup.py build_ext --include-dirs=$(PYSETUP_INCLUDE_DIRS) \
$(PYTHON) setup.py build_ext --include-dirs=$(PYSETUP_INCLUDE_DIRS) \
--library-dirs=$(PYSETUP_LIBDIRS)