? build ? pylash/.cvsignore Index: acinclude.m4 =================================================================== RCS file: /sources/lash/lash/acinclude.m4,v retrieving revision 1.1 diff -u -r1.1 acinclude.m4 --- acinclude.m4 9 Apr 2007 01:16:52 -0000 1.1 +++ acinclude.m4 9 Apr 2007 03:07:57 -0000 @@ -57,3 +57,28 @@ fi AC_SUBST([SWIG_LIB]) ]) + +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 ],dnl +[AC_MSG_RESULT(found) +$1],dnl +[AC_MSG_RESULT(not found) +$2]) +CPPFLAGS="$save_CPPFLAGS" +]) Index: configure.ac =================================================================== RCS file: /sources/lash/lash/configure.ac,v retrieving revision 1.19 diff -u -r1.19 configure.ac --- configure.ac 9 Apr 2007 02:38:53 -0000 1.19 +++ configure.ac 9 Apr 2007 03:07:57 -0000 @@ -155,17 +155,27 @@ ### pylash ### ################ -AM_PATH_PYTHON(2.3,python_found=yes,python_found=no) - build_pylash=no -if test x$python_found == xyes; then - AC_PROG_SWIG(1.3.31) - if test "$SWIG_LIB" ; then - build_pylash=yes +AC_ARG_ENABLE(pylash, [AS_HELP_STRING(--disable-pylash, [Force disable pylash building [default=no]])], [ build_pylash="disabled" ]) + +if test x$build_pylash != xdisabled; then + AM_PATH_PYTHON(2.3, python_found=yes, python_found=no) + + if test x$python_found == xyes; then + AM_CHECK_PYTHON_HEADERS(, python_found=no) + + if test x$python_found == xyes; then + AC_PROG_SWIG(1.3.31) + if test "$SWIG_LIB" ; then + build_pylash=yes + fi + fi fi fi +AM_CONDITIONAL(BUILD_PYLASH, test x$build_pylash = xyes) + ###################### ### --enable-debug ### ###################### Index: pylash/Makefile.am =================================================================== RCS file: /sources/lash/lash/pylash/Makefile.am,v retrieving revision 1.1 diff -u -r1.1 Makefile.am --- pylash/Makefile.am 9 Apr 2007 01:16:13 -0000 1.1 +++ pylash/Makefile.am 9 Apr 2007 03:07:57 -0000 @@ -19,6 +19,8 @@ pkgpyexecdir = $(pythondir) +if BUILD_PYLASH + pkgpyexec_LTLIBRARIES = _lash.la INCLUDES = $(PYTHON_INCLUDES) @@ -35,3 +37,4 @@ lash_wrap.c lash.py: lash.i lash.h $(SWIG) -o lash_wrap.c -I$(top_srcdir) -python $(top_srcdir)/$(subdir)/lash.i +endif