diff --git a/configure.ac b/configure.ac index 89790bf0055e0d729676f901f149d7df58f84648..0254785aba3d16691106512c006f02a0f3423514 100644 --- a/configure.ac +++ b/configure.ac @@ -18,6 +18,18 @@ AC_CHECK_PROGS([DOXYGEN], [doxygen]) if test -z "$DOXYGEN"; then AC_MSG_WARN([Doxygen not found - continuing without Doxygen support]) fi +AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"]) + +AM_PATH_PYTHON([3.3],, [:]) +AM_CONDITIONAL([HAVE_PYTHON], [test -n "$PYTHON"]) + +if test -n "$PYTHON"; then + AC_CHECK_PROGS([CYTHON], [cython]) + if test -z "$CYTHON"; + then AC_MSG_WARN([Cython not found - continuing without cython support]) + fi +fi +AM_CONDITIONAL([USE_CYTHON], [test -n "$CYTHON"]) case "${host_os}" in "") @@ -64,8 +76,11 @@ PKG_CHECK_MODULES([GNUTLS], [gnutls >= 3.1]) AC_ARG_ENABLE([tools], AS_HELP_STRING([--disable-tools],[Disable tools (CLI DHT node)]),,build_tools=yes) AM_CONDITIONAL(ENABLE_TOOLS, test x$build_tools == xyes) -AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"]) AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([doc/Doxyfile doc/Makefile])]) +AM_COND_IF([USE_CYTHON], [AC_CONFIG_FILES([tools/python/Makefile])]) -AC_CONFIG_FILES([Makefile src/Makefile tools/Makefile opendht.pc]) +AC_CONFIG_FILES([Makefile + src/Makefile + tools/Makefile + opendht.pc]) AC_OUTPUT diff --git a/tools/Makefile.am b/tools/Makefile.am index 81233c7c4ea71b17488cf66b4fb7a77a3c2acf70..31f77f09c91c2e4ee82fe573617358ad86b632f9 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -1,3 +1,7 @@ +if USE_CYTHON +SUBDIRS = python +endif + libexec_PROGRAMS = dhtnode dhtchat AM_CPPFLAGS = -I../include diff --git a/tools/python/Makefile.am b/tools/python/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..c0a07e5341974f090a9e70408e3df4b9899ddb5b --- /dev/null +++ b/tools/python/Makefile.am @@ -0,0 +1,13 @@ +if USE_CYTHON + +pybuild.stamp: + LDFLAGS="-L$(top_srcdir)/src/.libs" $(PYTHON) setup.py build_ext --inplace + echo stamp > pybuild.stamp + +CLEANFILES = pybuild.stamp + +all-local: pybuild.stamp +clean-local: + rm -rf $(builddir)/build $(builddir)/*.so + +endif \ No newline at end of file diff --git a/tools/python/setup.py b/tools/python/setup.py index d3845fbd71a82ab4229f6bcce9a4a6f243eb00a0..82f8ede3ed269fce6ca58f4133360ec35a1e4f9e 100644 --- a/tools/python/setup.py +++ b/tools/python/setup.py @@ -20,12 +20,14 @@ from distutils.core import setup, Extension from Cython.Build import cythonize +from Cython.Distutils import build_ext setup(name="opendht", version="0.1", description="Cython generated wrapper for opendht", author="Guillaume Roguez", license="GPLv3", + cmdclass = { 'build_ext' : build_ext }, ext_modules = cythonize(Extension( "opendht", ["opendht.pyx"],