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 /configure.ac | |
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 'configure.ac')
-rw-r--r-- | configure.ac | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index cdf977ee..95d47b9a 100644 --- a/configure.ac +++ b/configure.ac @@ -49,6 +49,14 @@ AC_HELP_STRING([--enable-gcov],[Enable gcov code coverage (requires GCC)]), *) AC_MSG_ERROR([bad value ${enableval} for --enable-gcov]) ;; esac]) +AC_ARG_ENABLE(python, +AC_HELP_STRING([--enable-python],[Build Python bindings]), +[case "${enableval}" in + yes) enable_python="yes" ;; + no) enable_python="no" ;; + *) AC_MSG_ERROR([bad value ${enableval} for --enable-python]) ;; +esac], enable_python="auto") + # # Checks for programs. # @@ -244,6 +252,43 @@ AC_SUBST(CCLD_FOR_BUILD) HOST_CC="$CC_FOR_BUILD" AC_SUBST(HOST_CC) +# Detect if we can build Python bindings +# (needs Python, Python headers, and Pyrex) +if test x$enable_python = xno; then + have_python=no +else + AC_MSG_NOTICE([Checking to see if we can build Python bindings]) + have_python=no + AM_PATH_PYTHON(2.4) + + 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 + + AM_CHECK_PYTHON_HEADERS(have_python_headers=yes,have_python_headers=no) + + if test x$have_pyrex = xyes -a x$have_python_headers = xyes ; then + have_python=yes + fi + fi + + if test x$have_python = xno ; then + if test x$enable_python = xyes ; then + AC_MSG_ERROR([Building Python explicitly requested, but can't build Python bindings because either Pyrex, Python headers or a suitable Python version was not found]) + else + AC_MSG_WARN([Couldn't find either Pyrex, the Python headers or a suitable version of Python, not building Python bindings]) + fi + fi +fi + +AM_CONDITIONAL(HAVE_PYTHON, test x$have_python = xyes) AC_CONFIG_FILES([Makefile po/Makefile.in |