diff options
author | Peter Johnson <peter@tortall.net> | 2006-04-04 06:07:32 +0000 |
---|---|---|
committer | Peter Johnson <peter@tortall.net> | 2006-04-04 06:07:32 +0000 |
commit | a5d91fba6a8f20465f6a8884207f98b241d993fe (patch) | |
tree | 2d61f5677f6f57e717b4c4e5a46b6613f559fd0f /m4 | |
parent | 2e851878e49c8e40b952c8b32e88aaaa4c3eb022 (diff) | |
download | yasm-a5d91fba6a8f20465f6a8884207f98b241d993fe.tar.gz |
Hook Python module into the build (even though it's pretty incomplete),
enabled with --enable-python (defaults to auto-detect).
Thanks to some magic in python-yasm/Makefile.inc and setup.py, this actually
plays nicely with automake distcheck.
* m4/pythonhead.m4: Script to find Python.h.
* m4/Makefile.inc: Include it in distfiles.
* configure.ac: Add --enable-python option and Python and Pyrex detection.
* tools/Makefile.inc: Pull tools/python-yasm/Makefile.inc into build.
* python-yasm/Makefile.inc: Add automake build magic for extension.
* setup.py: Likewise.
svn path=/trunk/yasm/; revision=1456
Diffstat (limited to 'm4')
-rw-r--r-- | m4/Makefile.inc | 1 | ||||
-rw-r--r-- | m4/pythonhead.m4 | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/m4/Makefile.inc b/m4/Makefile.inc index 6cd21522..3df185a9 100644 --- a/m4/Makefile.inc +++ b/m4/Makefile.inc @@ -26,3 +26,4 @@ EXTRA_DIST += m4/longlong.m4 EXTRA_DIST += m4/progtest.m4 EXTRA_DIST += m4/stdint_h.m4 EXTRA_DIST += m4/uintmax_t.m4 +EXTRA_DIST += m4/pythonhead.m4 diff --git a/m4/pythonhead.m4 b/m4/pythonhead.m4 new file mode 100644 index 00000000..1e0f2b63 --- /dev/null +++ b/m4/pythonhead.m4 @@ -0,0 +1,24 @@ +dnl a macro to check for ability to create python extensions +dnl AM_CHECK_PYTHON_HEADERS([ACTION-IF-POSSIBLE], [ACTION-IF-NOT-POSSIBLE]) +dnl function also defines PYTHON_INCLUDES +AC_DEFUN([AM_CHECK_PYTHON_HEADERS], +[AC_REQUIRE([AM_PATH_PYTHON]) +AC_MSG_CHECKING(for headers required to compile python extensions) +dnl deduce PYTHON_INCLUDES +py_prefix=`$PYTHON -c "import sys; print sys.prefix"` +py_exec_prefix=`$PYTHON -c "import sys; print sys.exec_prefix"` +PYTHON_INCLUDES="-I${py_prefix}/include/python${PYTHON_VERSION}" +if test "$py_prefix" != "$py_exec_prefix"; then + PYTHON_INCLUDES="$PYTHON_INCLUDES -I${py_exec_prefix}/include/python${PYTHON_VERSION}" +fi +AC_SUBST(PYTHON_INCLUDES) +dnl check if the headers exist: +save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $PYTHON_INCLUDES" +AC_TRY_CPP([#include <Python.h>],dnl +[AC_MSG_RESULT(found) +$1],dnl +[AC_MSG_RESULT(not found) +$2]) +CPPFLAGS="$save_CPPFLAGS" +]) |