changeset 29:6d75691c5c07 task

Modified build configuration in the hope that it will be more stable.
author David Grundberg <individ@acc.umu.se>
date Mon, 04 May 2009 19:38:17 +0200
parents c9c8ae243701
children 28e77b24209d
files Jamfile.in Makefile.am README configure.ac m4/ac_python_devel.m4 m4/ax_boost_python.m4 m4/ax_octave.m4 m4/ax_python.m4 m4/ax_python_devel.m4 setup.py.in
diffstat 10 files changed, 598 insertions(+), 547 deletions(-) [+]
line wrap: on
line diff
--- a/Jamfile.in	Mon May 04 17:57:19 2009 +0200
+++ b/Jamfile.in	Mon May 04 19:38:17 2009 +0200
@@ -6,8 +6,8 @@
 	<library>@JAM_LIBOCTAVE@
 	<library>@JAM_LIBCRUFT@
 	<library>@JAM_LIBOCTINTERP@
-	<include>@PYTHON_INCLUDE_DIR@
-	<include>@PYTAVE_OCTAVE_INCLUDE_PATH@
+#	<include>@PYTHON_INCLUDE_DIR@
+	<include>@OCTAVE_INCLUDEDIR@
 	<include>@abs_srcdir@
 	<include>@abs_builddir@
 	<define>"HAVE_CONFIG_H"
--- a/Makefile.am	Mon May 04 17:57:19 2009 +0200
+++ b/Makefile.am	Mon May 04 19:38:17 2009 +0200
@@ -4,11 +4,11 @@
 package/__init__.py package/pytave.py
 EXTRA_libdir = @PYTAVE_MODULE_INSTALL_PATH@
 
-_pytave_la_CPPFLAGS = -I@PYTAVE_OCTAVE_INCLUDE_PATH@ -I@PYTHON_INCLUDE_DIR@
+_pytave_la_CPPFLAGS = @OCTAVE_CPPFLAGS@ @PYTHON_CPPFLAGS@
 
 # Having -module in LDFLAGS lets us use a non-standard library name 
 # (e.g. _pytave instead of libpytave)
-_pytave_la_LDFLAGS = -module -L@PYTAVE_OCTAVE_RPATH@ -loctinterp -loctave  \
+_pytave_la_LDFLAGS = -module -L@OCTAVE_LIBRARYDIR@ -loctinterp -loctave  \
 -lcruft -l@BOOST_PYTHON_LIB@ -R @PYTAVE_OCTAVE_RPATH@
 
 _pytave_la_SOURCES = octave_to_python.cc pytave.cc python_to_octave.cc \
--- a/README	Mon May 04 17:57:19 2009 +0200
+++ b/README	Mon May 04 19:38:17 2009 +0200
@@ -9,9 +9,7 @@
 systems. Autoconf's VPATH is supported on all build systems.
 
     Use the configure script to set up Octave and Boost::Python
-paths. Run `./configure --help' for more info. There are two custom
-arguments that control building of pytave, `--with-octave' and
-`--with-boost-python'.
+paths. Run `./configure --help' for more info.
 
 Dependencies
 ============
--- a/configure.ac	Mon May 04 17:57:19 2009 +0200
+++ b/configure.ac	Mon May 04 19:38:17 2009 +0200
@@ -17,105 +17,35 @@
 
 AC_PRESERVE_HELP_ORDER
 
-# Look for Octave package
-AC_MSG_CHECKING([for Octave package])
-AC_ARG_WITH([octave],
-            [AS_HELP_STRING([--with-octave],
-                            [Optionally set Octave package to use.
-                            @<:@default=check@:>@])],
-            [with_octave=$withval],
-            [with_octave=check])
-AS_IF([test "x$with_octave" == xno],
-[
-   AC_MSG_FAILURE([--without-octave was given but Octave required])
-], [])
-
-AS_IF([test "x$with_octave" == xyes],
-[
-   with_octave=check
-], [])
-
-AS_IF([test "x$with_octave" == xcheck],
-[
-   AC_PATH_TOOL(octaveconfig, octave-config, [eepnotfound])
-],
-[
-   AC_PATH_TOOL(octaveconfig, octave-config, [eepnotfound], $with_octave/bin)
-])
+pytave_libs_ok=
 
-AS_IF([test "x$octaveconfig" == "xeepnotfound"],
-[
-   AC_MSG_WARN([Could not find octave-config.])
-],
-[
-   PYTAVE_OCTAVE_RPATH=`$octaveconfig -p OCTLIBDIR`
-   PYTAVE_OCTAVE_INCLUDE_PATH=`$octaveconfig -p OCTINCLUDEDIR`
-   AC_MSG_RESULT([  results of the Octave check:])
-   AC_MSG_RESULT([    octave-config: $octaveconfig])
-   AC_MSG_RESULT([    Library:       $PYTAVE_OCTAVE_RPATH])
-   AC_MSG_RESULT([    Include Dir:   $PYTAVE_OCTAVE_INCLUDE_PATH])
-
-   # Try to compile and link against Octave libraries.
-   old_flags="$LDFLAGS"
-   LDFLAGS="-L$PYTAVE_OCTAVE_RPATH $LDFLAGS"
-
-   old_cxx="$CPPFLAGS"
-   CPPFLAGS="-I$PYTAVE_OCTAVE_INCLUDE_PATH $CXXFLAGS"
-
-   old_libs="$LIBS"
-   LIBS="-loctave -lcruft -loctinterp $LIBS"
-
-   AC_CACHE_CHECK([whether linking to Octave library works], [pytave_cv_lib_octave],
-   [
-      pytave_cv_lib_octave=no
-      AC_LANG_ASSERT(C++)
-      AC_LINK_IFELSE(
-         AC_LANG_PROGRAM(
-            [[#include <octave/oct.h>
-              #include <octave/Matrix.h> ]],
-            [[MatrixType()]]),
-         [pytave_cv_lib_octave=yes],
-         [pytave_cv_lib_octave=no])
-   ])
-
-
-   LDFLAGS="$old_flags"
-   LIBS="$old_libs"
-   CPPFLAGS="$old_cpp"
-
-
-])
+AX_OCTAVE([], [AC_MSG_WARN([OK])], [pytave_libs_ok=no])
+AX_PYTHON_DEVEL([], [AC_MSG_WARN([OK])], [pytave_libs_ok=no])
 
 # Look for boost::python
-AX_PYTHON()
-old_libs="$LIBS"
-AS_IF([test "x$PYTHON_LIB" != "x"],[
-LIBS="-l$PYTHON_LIB $LIBS"
-],[])
-AX_BOOST_PYTHON()
-LIBS="$old_libs"
+pytave_old_libs="$LIBS"
+pytave_old_ldflags="$LDFLAGS"
+pytave_old_cppflags="$CPPFLAGS"
+LIBS="$LIBS $PYTHON_LIBS"
+LDFLAGS="$LDFLAGS $PYTHON_LDFLAGS"
+CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS"
 
-# Now check the two vital libs, if they have problems, halt.
-pytave_fatal_errors=no
+AX_BOOST_PYTHON([AC_MSG_WARN([OK])], [pytave_libs_ok=no])
 
-AS_IF(test "x$pytave_cv_lib_octave" != "xyes",
+LIBS="$pytave_old_libs"
+LDFLAGS="$pytave_old_ldflags"
+CPPFLAGS="$pytave_old_cppflags"
+
+# Now check the libs, if they have problems, halt.
+AS_IF(test -n "$pytave_libs_ok",
 [
-   AC_MSG_WARN([Linking to Octave failed.])
-   pytave_fatal_errors=yes
-], [])
+   AC_MSG_ERROR([
+========================================================================
+One or more library dependencies could not be resolved.
 
-AS_IF(test "x$BOOST_PYTHON_LIB" == "x",
-[
-   AC_MSG_WARN([Cannot find Boost::Python lib.])
-   pytave_fatal_errors=yes
-], [])
-
-
-AS_IF(test "x$pytave_fatal_errors" == "xyes",
-[
-   AC_MSG_ERROR([Configuration failed. Halt.])
-], [])
-
+Configuration failed. Halt.
+========================================================================])
+])
 
 # Do some more initializations
 
@@ -148,16 +78,16 @@
 ])
 
 # Substitutes for the Makefile/Jamfile
-AC_SUBST(PYTAVE_OCTAVE_INCLUDE_PATH)
+#AC_SUBST(OCTAVE_INCLUDEDIR)
+#AC_SUBST(OCTAVE_LIBRARYDIR)
+PYTAVE_OCTAVE_RPATH="$OCTAVE_LIBRARYDIR"
 AC_SUBST(PYTAVE_OCTAVE_RPATH)
 AC_SUBST(PYTAVE_MODULE_INSTALL_PATH)
 
 # Substitutes for the Jamfile. XXX: Replace lib*.so with OS independent name.
-AC_SUBST(JAM_LIBOCTAVE, $PYTAVE_OCTAVE_RPATH/liboctave.so)
-AC_SUBST(JAM_LIBCRUFT, $PYTAVE_OCTAVE_RPATH/libcruft.so)
-AC_SUBST(JAM_LIBOCTINTERP, $PYTAVE_OCTAVE_RPATH/liboctinterp.so)
+AC_SUBST(JAM_LIBOCTAVE, $OCTAVE_LIBRARYDIR/liboctave.so)
+AC_SUBST(JAM_LIBCRUFT, $OCTAVE_LIBRARYDIR/libcruft.so)
+AC_SUBST(JAM_LIBOCTINTERP, $OCTAVE_LIBRARYDIR/liboctinterp.so)
 
-# Substitute in these files
-AC_OUTPUT([Makefile Jamfile setup.py])
-# Copy project-root.jam to VPATH too
-AC_OUTPUT([project-root.jam])
+# Substitute in these files, copy project-root.jam to VPATH too
+AC_OUTPUT([Makefile Jamfile setup.py project-root.jam])
--- a/m4/ac_python_devel.m4	Mon May 04 17:57:19 2009 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,320 +0,0 @@
-# ===========================================================================
-#         http://www.nongnu.org/autoconf-archive/ac_python_devel.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-#   AC_PYTHON_DEVEL([version])
-#
-# DESCRIPTION
-#
-#   Note: Defines as a precious variable "PYTHON_VERSION". Don't override it
-#   in your configure.ac.
-#
-#   This macro checks for Python and tries to get the include path to
-#   'Python.h'. It provides the $(PYTHON_CPPFLAGS) and $(PYTHON_LDFLAGS)
-#   output variables. It also exports $(PYTHON_EXTRA_LIBS) and
-#   $(PYTHON_EXTRA_LDFLAGS) for embedding Python in your code.
-#
-#   You can search for some particular version of Python by passing a
-#   parameter to this macro, for example ">= '2.3.1'", or "== '2.4'". Please
-#   note that you *have* to pass also an operator along with the version to
-#   match, and pay special attention to the single quotes surrounding the
-#   version number. Don't use "PYTHON_VERSION" for this: that environment
-#   variable is declared as precious and thus reserved for the end-user.
-#
-#   This macro should work for all versions of Python >= 2.1.0. As an end
-#   user, you can disable the check for the python version by setting the
-#   PYTHON_NOVERSIONCHECK environment variable to something else than the
-#   empty string.
-#
-#   If you need to use this macro for an older Python version, please
-#   contact the authors. We're always open for feedback.
-#
-# LICENSE
-#
-#   Copyright (c) 2009 Sebastian Huber <sebastian-huber@web.de>
-#   Copyright (c) 2009 Alan W. Irwin <irwin@beluga.phys.uvic.ca>
-#   Copyright (c) 2009 Rafael Laboissiere <rafael@laboissiere.net>
-#   Copyright (c) 2009 Andrew Collier <colliera@ukzn.ac.za>
-#   Copyright (c) 2009 Matteo Settenvini <matteo@member.fsf.org>
-#   Copyright (c) 2009 Horst Knorr <hk_classes@knoda.org>
-#
-#   This program is free software: you can redistribute it and/or modify it
-#   under the terms of the GNU General Public License as published by the
-#   Free Software Foundation, either version 3 of the License, or (at your
-#   option) any later version.
-#
-#   This program is distributed in the hope that it will be useful, but
-#   WITHOUT ANY WARRANTY; without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
-#   Public License for more details.
-#
-#   You should have received a copy of the GNU General Public License along
-#   with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-#   As a special exception, the respective Autoconf Macro's copyright owner
-#   gives unlimited permission to copy, distribute and modify the configure
-#   scripts that are the output of Autoconf when processing the Macro. You
-#   need not follow the terms of the GNU General Public License when using
-#   or distributing such scripts, even though portions of the text of the
-#   Macro appear in them. The GNU General Public License (GPL) does govern
-#   all other use of the material that constitutes the Autoconf Macro.
-#
-#   This special exception to the GPL applies to versions of the Autoconf
-#   Macro released by the Autoconf Archive. When you make and distribute a
-#   modified version of the Autoconf Macro, you may extend this special
-#   exception to the GPL to apply to your modified version as well.
-
-AC_DEFUN([AC_PYTHON_DEVEL],[
-	#
-	# Allow the use of a (user set) custom python version
-	#
-	AC_ARG_VAR([PYTHON_VERSION],[The installed Python
-		version to use, for example '2.3'. This string
-		will be appended to the Python interpreter
-		canonical name.])
-
-	AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]])
-	if test -z "$PYTHON"; then
-	   AC_MSG_ERROR([Cannot find python$PYTHON_VERSION in your system path])
-	   PYTHON_VERSION=""
-	fi
-
-	#
-	# Check for a version of Python >= 2.1.0
-	#
-	AC_MSG_CHECKING([for a version of Python >= '2.1.0'])
-	ac_supports_python_ver=`$PYTHON -c "import sys; \
-		ver = sys.version.split ()[[0]]; \
-		print (ver >= '2.1.0')"`
-	if test "$ac_supports_python_ver" != "True"; then
-		if test -z "$PYTHON_NOVERSIONCHECK"; then
-			AC_MSG_RESULT([no])
-			AC_MSG_FAILURE([
-This version of the AC@&t@_PYTHON_DEVEL macro
-doesn't work properly with versions of Python before
-2.1.0. You may need to re-run configure, setting the
-variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG,
-PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand.
-Moreover, to disable this check, set PYTHON_NOVERSIONCHECK
-to something else than an empty string.
-])
-		else
-			AC_MSG_RESULT([skip at user request])
-		fi
-	else
-		AC_MSG_RESULT([yes])
-	fi
-
-	#
-	# if the macro parameter ``version'' is set, honour it
-	#
-	if test -n "$1"; then
-		AC_MSG_CHECKING([for a version of Python $1])
-		ac_supports_python_ver=`$PYTHON -c "import sys; \
-			ver = sys.version.split ()[[0]]; \
-			print (ver $1)"`
-		if test "$ac_supports_python_ver" = "True"; then
-	   	   AC_MSG_RESULT([yes])
-		else
-			AC_MSG_RESULT([no])
-			AC_MSG_ERROR([this package requires Python $1.
-If you have it installed, but it isn't the default Python
-interpreter in your system path, please pass the PYTHON_VERSION
-variable to configure. See ``configure --help'' for reference.
-])
-			PYTHON_VERSION=""
-		fi
-	fi
-
-	#
-	# Check if you have distutils, else fail
-	#
-	AC_MSG_CHECKING([for the distutils Python package])
-	ac_distutils_result=`$PYTHON -c "import distutils" 2>&1`
-	if test -z "$ac_distutils_result"; then
-		AC_MSG_RESULT([yes])
-	else
-		AC_MSG_RESULT([no])
-		AC_MSG_ERROR([cannot import Python module "distutils".
-Please check your Python installation. The error was:
-$ac_distutils_result])
-		PYTHON_VERSION=""
-	fi
-
-	#
-	# Check for Python include path
-	#
-	AC_MSG_CHECKING([for Python include path])
-	if test -z "$PYTHON_CPPFLAGS"; then
-		python_path=`$PYTHON -c "import distutils.sysconfig; \
-           		print (distutils.sysconfig.get_python_inc ());"`
-		if test -n "${python_path}"; then
-		   	python_path="-I$python_path"
-		fi
-		PYTHON_CPPFLAGS=$python_path
-	fi
-	AC_MSG_RESULT([$PYTHON_CPPFLAGS])
-	AC_SUBST([PYTHON_CPPFLAGS])
-
-	#
-	# Check for Python library path
-	#
-	AC_MSG_CHECKING([for Python library path])
-	if test -z "$PYTHON_LDFLAGS"; then
-		# (makes two attempts to ensure we've got a version number
-		# from the interpreter)
-		ac_python_version=`cat<<EOD | $PYTHON -
-
-# join all versioning strings, on some systems
-# major/minor numbers could be in different list elements
-from distutils.sysconfig import *
-ret = ''
-for e in get_config_vars ('VERSION'):
-	if (e != None):
-		ret += e
-print (ret)
-EOD`
-
-		if test -z "$ac_python_version"; then
-			if test -n "$PYTHON_VERSION"; then
-				ac_python_version=$PYTHON_VERSION
-			else
-				ac_python_version=`$PYTHON -c "import sys; \
-					print (sys.version[[:3]])"`
-			fi
-		fi
-
-		# Make the versioning information available to the compiler
-		AC_DEFINE_UNQUOTED([HAVE_PYTHON], ["$ac_python_version"],
-                                   [If available, contains the Python version number currently in use.])
-
-		# First, the library directory:
-		ac_python_libdir=`cat<<EOD | $PYTHON -
-
-# There should be only one
-import distutils.sysconfig
-for e in distutils.sysconfig.get_config_vars ('LIBDIR'):
-	if e != None:
-		print (e)
-		break
-EOD`
-
-		# Before checking for libpythonX.Y, we need to know
-		# the extension the OS we're on uses for libraries
-		# (we take the first one, if there's more than one fix me!):
-		ac_python_soext=`$PYTHON -c \
-		  "import distutils.sysconfig; \
-		  print (distutils.sysconfig.get_config_vars('SO')[[0]])"`
-
-		# Now, for the library:
-		ac_python_soname=`$PYTHON -c \
-		  "import distutils.sysconfig; \
-		  print (distutils.sysconfig.get_config_vars('LDLIBRARY')[[0]])"`
-
-		# Strip away extension from the end to canonicalize its name:
-		ac_python_library=`echo "$ac_python_soname" | sed "s/${ac_python_soext}$//"`
-
-		# This small piece shamelessly adapted from PostgreSQL python macro;
-		# credits goes to momjian, I think. I'd like to put the right name
-		# in the credits, if someone can point me in the right direction... ?
-		#
-		if test -n "$ac_python_libdir" -a -n "$ac_python_library" \
-			-a x"$ac_python_library" != x"$ac_python_soname"
-		then
-			# use the official shared library
-			ac_python_library=`echo "$ac_python_library" | sed "s/^lib//"`
-			PYTHON_LDFLAGS="-L$ac_python_libdir -l$ac_python_library"
-		else
-			# old way: use libpython from python_configdir
-			ac_python_libdir=`$PYTHON -c \
-			  "from distutils.sysconfig import get_python_lib as f; \
-			  import os; \
-			  print (os.path.join(f(plat_specific=1, standard_lib=1), 'config'));"`
-			PYTHON_LDFLAGS="-L$ac_python_libdir -lpython$ac_python_version"
-		fi
-
-		if test -z "PYTHON_LDFLAGS"; then
-			AC_MSG_ERROR([
-  Cannot determine location of your Python DSO. Please check it was installed with
-  dynamic libraries enabled, or try setting PYTHON_LDFLAGS by hand.
-			])
-		fi
-	fi
-	AC_MSG_RESULT([$PYTHON_LDFLAGS])
-	AC_SUBST([PYTHON_LDFLAGS])
-
-	#
-	# Check for site packages
-	#
-	AC_MSG_CHECKING([for Python site-packages path])
-	if test -z "$PYTHON_SITE_PKG"; then
-		PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \
-		        print (distutils.sysconfig.get_python_lib(0,0));"`
-	fi
-	AC_MSG_RESULT([$PYTHON_SITE_PKG])
-	AC_SUBST([PYTHON_SITE_PKG])
-
-	#
-	# libraries which must be linked in when embedding
-	#
-	AC_MSG_CHECKING(python extra libraries)
-	if test -z "$PYTHON_EXTRA_LIBS"; then
-	   PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
-                conf = distutils.sysconfig.get_config_var; \
-                print (conf('LOCALMODLIBS') + ' ' + conf('LIBS'))"`
-	fi
-	AC_MSG_RESULT([$PYTHON_EXTRA_LIBS])
-	AC_SUBST(PYTHON_EXTRA_LIBS)
-
-	#
-	# linking flags needed when embedding
-	#
-	AC_MSG_CHECKING(python extra linking flags)
-	if test -z "$PYTHON_EXTRA_LDFLAGS"; then
-		PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \
-			conf = distutils.sysconfig.get_config_var; \
-			print (conf('LINKFORSHARED'))"`
-	fi
-	AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS])
-	AC_SUBST(PYTHON_EXTRA_LDFLAGS)
-
-	#
-	# final check to see if everything compiles alright
-	#
-	AC_MSG_CHECKING([consistency of all components of python development environment])
-	# save current global flags
-	LIBS="$ac_save_LIBS $PYTHON_LDFLAGS $PYTHON_EXTRA_LDFLAGS $PYTHON_EXTRA_LIBS"
-	CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS"
-	AC_LANG_PUSH([C])
-	AC_LINK_IFELSE([
-		AC_LANG_PROGRAM([[#include <Python.h>]],
-				[[Py_Initialize();]])
-		],[pythonexists=yes],[pythonexists=no])
-	AC_LANG_POP([C])
-	# turn back to default flags
-	CPPFLAGS="$ac_save_CPPFLAGS"
-	LIBS="$ac_save_LIBS"
-
-	AC_MSG_RESULT([$pythonexists])
-
-        if test ! "x$pythonexists" = "xyes"; then
-	   AC_MSG_FAILURE([
-  Could not link test program to Python. Maybe the main Python library has been
-  installed in some non-standard library path. If so, pass it to configure,
-  via the LDFLAGS environment variable.
-  Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"
-  ============================================================================
-   ERROR!
-   You probably have to install the development version of the Python package
-   for your distribution.  The exact name of this package varies among them.
-  ============================================================================
-	   ])
-	  PYTHON_VERSION=""
-	fi
-
-	#
-	# all done!
-	#
-])
--- a/m4/ax_boost_python.m4	Mon May 04 17:57:19 2009 +0200
+++ b/m4/ax_boost_python.m4	Mon May 04 19:38:17 2009 +0200
@@ -4,7 +4,7 @@
 #
 # SYNOPSIS
 #
-#   AX_BOOST_PYTHON
+#   AX_BOOST_PYTHON([ACTION_IF_FOUND], [ACTION_IF_NOT_FOUND])
 #
 # DESCRIPTION
 #
@@ -18,15 +18,13 @@
 #
 #   This macro calls AC_SUBST(BOOST_PYTHON_LIB).
 #
-#   In order to ensure that the Python headers are specified on the include
-#   path, this macro requires AX_PYTHON to be called.
-#
 # LAST MODIFICATION
 #
-#   2008-04-12
+#   2009-04-04
 #
 # COPYLEFT
 #
+#   Copyright (c) 2009 David Grundberg
 #   Copyright (c) 2008 Michael Tindal
 #
 #   This program is free software; you can redistribute it and/or modify it
@@ -55,16 +53,14 @@
 #   distribute a modified version of the Autoconf Macro, you may extend this
 #   special exception to the GPL to apply to your modified version as well.
 
-AC_DEFUN([AX_BOOST_PYTHON],
-[AC_REQUIRE([AX_PYTHON])dnl
-AC_CACHE_CHECK(whether the Boost::Python library is available,
+AC_DEFUN([AX_BOOST_PYTHON], [
+AC_CACHE_CHECK([[whether the Boost::Python library is available]],
 ac_cv_boost_python,
-[AC_LANG_SAVE
+[
+ BOOST_PYTHON_LIB=
+ AC_LANG_SAVE
  AC_LANG_CPLUSPLUS
  CPPFLAGS_SAVE=$CPPFLAGS
- if test x$PYTHON_INCLUDE_DIR != x; then
-   CPPFLAGS=-I$PYTHON_INCLUDE_DIR $CPPFLAGS
- fi
  AC_COMPILE_IFELSE(AC_LANG_PROGRAM([[
  #include <boost/python/module.hpp>
  using namespace boost::python;
@@ -76,15 +72,24 @@
 ])
 if test "$ac_cv_boost_python" = "yes"; then
   AC_DEFINE(HAVE_BOOST_PYTHON,,[define if the Boost::Python library is available])
-  ax_python_lib=boost_python
-  AC_ARG_WITH([boost-python],AS_HELP_STRING([--with-boost-python],[specify the boost python library or suffix to use]),
-  [if test "x$with_boost_python" != "xno"; then
-     ax_python_lib=$with_boost_python
-     ax_boost_python_lib=boost_python-$with_boost_python
-   fi])
-  for ax_lib in $ax_python_lib $ax_boost_python_lib boost_python; do
+  ax_boost_python_lib=boost_python
+  AS_IF([test -n "$PYTHON_VERSION"], [
+     # Read ax_python_devel for info about the PYTHON_VERSION variable
+     ax_boost_python_lib=boost_python$PYTHON_VERSION
+  ])
+  AC_ARG_WITH([boost-python],AS_HELP_STRING([--with-boost-python],[specify the boost python library or suffix to use]), [
+    AS_IF([test "x$with_boost_python" != "xno"], [
+       ax_boost_python_lib=$with_boost_python
+    ])
+  ])
+  for ax_lib in $ax_boost_python_lib boost_python; do
     AC_CHECK_LIB($ax_lib, exit, [BOOST_PYTHON_LIB=$ax_lib break])
   done
   AC_SUBST(BOOST_PYTHON_LIB)
 fi
+
+if  test -n "$BOOST_PYTHON_LIB" ; then
+   m4_ifvaln([$1],[$1],[:])dnl
+   m4_ifvaln([$2],[else $2])dnl
+ fi
 ])dnl
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m4/ax_octave.m4	Mon May 04 19:38:17 2009 +0200
@@ -0,0 +1,199 @@
+# ===========================================================================
+#
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_OCTAVE([OCTAVE_CONFIG], [ACTION_IF_FOUND], [ACTION_IF_NOT_FOUND])
+#
+# DESCRIPTION
+#
+#   This macro does a Octave development environment check.
+#
+#   It accepts one optional argument, OCTAVE_CONFIG.  This is the full
+#   path the the octave-config used to find out the environment.
+#
+#   If OCTAVE_CONFIG is not set, or empty, a octave-config executable
+#   is searched for using AC_PATH_TOOL.  If the executable is not
+#   found, or does not return results, the Octave interpreter will be
+#   used instead.
+#
+#   As a final check, a simple test program is compiled and linked
+#   against the found Octave installation.  If the check is
+#   successful, ACTION_IF_FOUND is executed, otherwise
+#   ACTION_IF_NOT_FOUND.
+#
+#   AX_OCTAVE substitutes OCTAVE_CPPFLAGS, OCTAVE_LDFLAGS and
+#   OCTAVE_LIBS, along with the optional OCTAVE_LIBRARYDIR and
+#   OCTAVE_INCLUDEDIR.
+#
+#   Typical usage:
+#
+#	AX_OCTAVE([], [], [
+#		AC_MSG_ERROR([[Octave required but not available]])
+#		])
+#	LIBS="$LIBS $OCTAVE_LIBS"
+#	CPPFLAGS="$CPPFLAGS $OCTAVE_CPPFLAGS"
+#	LDFLAGS="$LDFLAGS $OCTAVE_LDFLAGS"
+#
+# LAST MODIFICATION
+#
+#   2009-05-04
+#
+# COPYING
+#
+#   Copyright (c) 2009 David Grundberg
+#
+#   This program is free software; you can redistribute it and/or modify it
+#   under the terms of the GNU General Public License as published by the
+#   Free Software Foundation; either version 2 of the License, or (at your
+#   option) any later version.
+#
+#   This program is distributed in the hope that it will be useful, but
+#   WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+#   Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+#   As a special exception, the respective Autoconf Macro's copyright owner
+#   gives unlimited permission to copy, distribute and modify the configure
+#   scripts that are the output of Autoconf when processing the Macro. You
+#   need not follow the terms of the GNU General Public License when using
+#   or distributing such scripts, even though portions of the text of the
+#   Macro appear in them. The GNU General Public License (GPL) does govern
+#   all other use of the material that constitutes the Autoconf Macro.
+#
+#   This special exception to the GPL applies to versions of the Autoconf
+#   Macro released by the Autoconf Macro Archive. When you make and
+#   distribute a modified version of the Autoconf Macro, you may extend this
+#   special exception to the GPL to apply to your modified version as well.
+
+AC_DEFUN([AX_OCTAVE],[
+	# These are the variables AX_OCTAVE uses
+	OCTAVE_LDFLAGS=
+	OCTAVE_LIBS=
+	OCTAVE_CPPFLAGS=
+	OCTAVE_INCLUDEDIR=
+	OCTAVE_LIBRARYDIR=
+	ax_octave_config="$1"
+	ax_octave_ok=
+
+	AC_MSG_CHECKING([for octave-config filename])
+	AS_IF([test -z "$ax_octave_config"], [
+		AC_MSG_RESULT([determined from path])
+		AC_PATH_TOOL([ax_octave_config], [octave-config], [])
+		AS_IF([test -z "$ax_octave_config"], [
+			AC_MSG_WARN([Could not find octave-config.])
+		], [])
+	], [
+		AC_MSG_RESULT([specified $ax_octave_config])
+	])
+
+	AS_IF([test -n "$ax_octave_config"], [
+		AC_MSG_CHECKING([for Octave library path])
+		OCTAVE_LIBRARYDIR=`$ax_octave_config -p OCTLIBDIR`
+		AC_MSG_RESULT([$OCTAVE_LIBRARYDIR])
+
+		AC_MSG_CHECKING([for Octave include path])
+		OCTAVE_INCLUDEDIR=`$ax_octave_config -p OCTINCLUDEDIR`
+		AC_MSG_RESULT([$OCTAVE_INCLUDEDIR])
+	])
+
+	AS_IF([[test -z "$OCTAVE_LIBRARYDIR" -o -z "$OCTAVE_INCLUDEDIR"]], [
+		AC_MSG_WARN([[
+========================================================================
+Octave library or include path not found using octave-config, trying
+Octave interpreter.
+
+This could be a sign that the Octave development package is missing.
+========================================================================]])
+
+		OCTAVE_LIBRARYDIR=
+		OCTAVE_INCLUDEDIR=
+
+		AC_MSG_NOTICE([[checking for Octave interpreter]])
+		AC_PATH_TOOL([ax_octave_interpreter], [octave], [])
+		AS_IF([test -z "$ax_octave_interpreter"], [
+			AC_MSG_WARN([Could not find Octave interpreter.])
+		], [
+			AC_MSG_CHECKING([for Octave library path (alt)])
+			OCTAVE_LIBRARYDIR=`$ax_octave_interpreter -q --eval "printf(octave_config_info.octlibdir)"`
+			AC_MSG_RESULT([$OCTAVE_LIBRARYDIR])
+
+			AC_MSG_CHECKING([for Octave include path (alt)])
+			OCTAVE_INCLUDEDIR=`$ax_octave_interpreter -q --eval "printf(octave_config_info.octincludedir)"`
+			AC_MSG_RESULT([$OCTAVE_INCLUDEDIR])
+		])
+
+		AS_IF([[test -z "$OCTAVE_LIBRARYDIR" -o -z "$OCTAVE_INCLUDEDIR"]], [
+			ax_octave_ok=no
+		])
+	])
+
+	AS_IF([test -z "$ax_octave_ok"], [
+		OCTAVE_LDFLAGS="-L$OCTAVE_LIBRARYDIR"
+		OCTAVE_LIBS="-loctave -lcruft -loctinterp"
+		OCTAVE_CPPFLAGS="-I$OCTAVE_INCLUDEDIR"
+
+		AC_CACHE_CHECK([whether linking to Octave library works], [ax_octave_cv_lib_octave],
+		[
+			ax_octave_cv_lib_octave=no
+
+			AC_LANG_PUSH([C++])
+
+			ax_octave_old_ldflags="$LDFLAGS"
+			ax_octave_old_cppflags="$CPPFLAGS"
+			ax_octave_old_libs="$LIBS"
+			LDFLAGS="$OCTAVE_LDFLAGS $LDFLAGS"
+			CPPFLAGS="$OCTAVE_CPPFLAGS $CPPFLAGS"
+			LIBS="$OCTAVE_LIBS $LIBS"
+
+			AC_LANG_ASSERT(C++)
+			AC_LINK_IFELSE(
+			AC_LANG_PROGRAM(
+				[[#include <octave/oct.h>
+				#include <octave/Matrix.h> ]],
+				[[MatrixType()]]),
+				[ax_octave_cv_lib_octave=yes],
+				[ax_octave_cv_lib_octave=no])
+			LDFLAGS="$ax_octave_old_ldflags"
+			CPPFLAGS="$ax_octave_old_cppflags"
+			LIBS="$ax_octave_old_libs"
+
+			AC_LANG_POP([C++])
+		])
+		AS_IF([test "x$ax_octave_cv_lib_octave" != "xyes"], [
+			ax_octave_ok=no
+		])
+	])
+
+	AS_IF([test -n "$ax_octave_ok"], [
+		OCTAVE_LDFLAGS=
+		OCTAVE_LIBS=
+		OCTAVE_CPPFLAGS=
+		OCTAVE_INCLUDEDIR=
+		OCTAVE_LIBRARYDIR=
+
+		AC_MSG_WARN([[
+========================================================================
+Can not link with Octave.
+
+Make sure the Octave development package is installed.
+========================================================================]])
+	])
+
+	AC_SUBST([OCTAVE_LDFLAGS])
+	AC_SUBST([OCTAVE_CPPFLAGS])
+	AC_SUBST([OCTAVE_LIBS])
+	AC_SUBST([OCTAVE_INCLUDEDIR])
+	AC_SUBST([OCTAVE_LIBRARYDIR])
+
+	# Execute ACTION_IF_FOUND or ACTION_IF_NOT_FOUND
+	if test -z "$ax_octave_ok" ; then
+		m4_ifvaln([$2],[$2],[:])dnl
+		m4_ifvaln([$3],[else $3])dnl
+	fi
+
+])
--- a/m4/ax_python.m4	Mon May 04 17:57:19 2009 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-# ===========================================================================
-#               http://autoconf-archive.cryp.to/ax_python.html
-# ===========================================================================
-#
-# SYNOPSIS
-#
-#   AX_PYTHON
-#
-# DESCRIPTION
-#
-#   This macro does a complete Python development environment check.
-#
-#   It recurses through several python versions (from 2.1 to 2.5 in this
-#   version), looking for an executable. When it finds an executable, it
-#   looks to find the header files and library.
-#
-#   It sets PYTHON_BIN to the name of the python executable,
-#   PYTHON_INCLUDE_DIR to the directory holding the header files, and
-#   PYTHON_LIB to the name of the Python library.
-#
-#   This macro calls AC_SUBST on PYTHON_BIN (via AC_CHECK_PROG),
-#   PYTHON_INCLUDE_DIR and PYTHON_LIB.
-#
-# LAST MODIFICATION
-#
-#   2008-04-12
-#
-# COPYLEFT
-#
-#   Copyright (c) 2008 Michael Tindal
-#
-#   This program is free software; you can redistribute it and/or modify it
-#   under the terms of the GNU General Public License as published by the
-#   Free Software Foundation; either version 2 of the License, or (at your
-#   option) any later version.
-#
-#   This program is distributed in the hope that it will be useful, but
-#   WITHOUT ANY WARRANTY; without even the implied warranty of
-#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
-#   Public License for more details.
-#
-#   You should have received a copy of the GNU General Public License along
-#   with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-#   As a special exception, the respective Autoconf Macro's copyright owner
-#   gives unlimited permission to copy, distribute and modify the configure
-#   scripts that are the output of Autoconf when processing the Macro. You
-#   need not follow the terms of the GNU General Public License when using
-#   or distributing such scripts, even though portions of the text of the
-#   Macro appear in them. The GNU General Public License (GPL) does govern
-#   all other use of the material that constitutes the Autoconf Macro.
-#
-#   This special exception to the GPL applies to versions of the Autoconf
-#   Macro released by the Autoconf Macro Archive. When you make and
-#   distribute a modified version of the Autoconf Macro, you may extend this
-#   special exception to the GPL to apply to your modified version as well.
-
-AC_DEFUN([AX_PYTHON],
-[AC_MSG_CHECKING(for python build information)
-AC_MSG_RESULT([])
-for python in python2.4 python2.5 python2.3 python2.2 python2.1 python; do
-AC_CHECK_PROGS(PYTHON_BIN, [$python])
-ax_python_bin=$PYTHON_BIN
-if test "x$ax_python_bin" != "x"; then
-   AC_CHECK_LIB($ax_python_bin, main, ax_python_lib=$ax_python_bin, ax_python_lib=no)
-   AC_CHECK_HEADER([$ax_python_bin/Python.h],
-   [[ax_python_header=`locate "$ax_python_bin/Python.h" | sed -e s,/Python.h,,`]],
-   ax_python_header=no)
-   if test "$ax_python_lib" != no; then
-     if test "$ax_python_header" != no; then
-       break;
-     fi
-   fi
-fi
-done
-if test x$ax_python_bin = x; then
-   ax_python_bin=no
-fi
-if test x$ax_python_header = x; then
-   ax_python_header=no
-fi
-if test x$ax_python_lib = x; then
-   ax_python_lib=no
-fi
-
-AC_MSG_RESULT([  results of the Python check:])
-AC_MSG_RESULT([    Binary:      $ax_python_bin])
-AC_MSG_RESULT([    Library:     $ax_python_lib])
-AC_MSG_RESULT([    Include Dir: $ax_python_header])
-
-if test x$ax_python_header != xno; then
-  PYTHON_INCLUDE_DIR=$ax_python_header
-  AC_SUBST(PYTHON_INCLUDE_DIR)
-fi
-if test x$ax_python_lib != xno; then
-  PYTHON_LIB=$ax_python_lib
-  AC_SUBST(PYTHON_LIB)
-fi
-])dnl
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/m4/ax_python_devel.m4	Mon May 04 19:38:17 2009 +0200
@@ -0,0 +1,338 @@
+# ===========================================================================
+#
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_PYTHON_DEVEL([version], [ACTION_IF_FOUND], [ACTION_IF_NOT_FOUND])
+#
+# DESCRIPTION
+#
+#   Note: Defines as a precious variable "PYTHON_VERSION". Don't override it
+#   in your configure.ac.
+#
+#   This macro checks for Python and tries to get the include path to
+#   'Python.h'. It provides the $(PYTHON_CPPFLAGS), $(PYTHON_LIBS) and
+#   $(PYTHON_LDFLAGS) output variables. It also exports
+#   $(PYTHON_EXTRA_LIBS) and $(PYTHON_EXTRA_LDFLAGS) for embedding
+#   Python in your code.
+#
+#   You can search for some particular version of Python by passing a
+#   parameter to this macro, for example ">= '2.3.1'", or "== '2.4'". Please
+#   note that you *have* to pass also an operator along with the version to
+#   match, and pay special attention to the single quotes surrounding the
+#   version number. Don't use "PYTHON_VERSION" for this: that environment
+#   variable is declared as precious and thus reserved for the end-user.
+#
+#   This macro should work for all versions of Python >= 2.1.0. As an end
+#   user, you can disable the check for the python version by setting the
+#   PYTHON_NOVERSIONCHECK environment variable to something else than the
+#   empty string.
+#
+#   As a final check, a simple test program is compiled and linked
+#   against the found Python installation.  If the check is
+#   successful, ACTION_IF_FOUND is executed, otherwise
+#   ACTION_IF_NOT_FOUND.
+#
+# LICENSE
+#
+#   Copyright (c) 2009 David Grundberg
+# Derived from http://www.nongnu.org/autoconf-archive/ac_python_devel.html
+#   Copyright (c) 2009 Sebastian Huber <sebastian-huber@web.de>
+#   Copyright (c) 2009 Alan W. Irwin <irwin@beluga.phys.uvic.ca>
+#   Copyright (c) 2009 Rafael Laboissiere <rafael@laboissiere.net>
+#   Copyright (c) 2009 Andrew Collier <colliera@ukzn.ac.za>
+#   Copyright (c) 2009 Matteo Settenvini <matteo@member.fsf.org>
+#   Copyright (c) 2009 Horst Knorr <hk_classes@knoda.org>
+#
+#   This program is free software: you can redistribute it and/or modify it
+#   under the terms of the GNU General Public License as published by the
+#   Free Software Foundation, either version 3 of the License, or (at your
+#   option) any later version.
+#
+#   This program is distributed in the hope that it will be useful, but
+#   WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+#   Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+#   As a special exception, the respective Autoconf Macro's copyright owner
+#   gives unlimited permission to copy, distribute and modify the configure
+#   scripts that are the output of Autoconf when processing the Macro. You
+#   need not follow the terms of the GNU General Public License when using
+#   or distributing such scripts, even though portions of the text of the
+#   Macro appear in them. The GNU General Public License (GPL) does govern
+#   all other use of the material that constitutes the Autoconf Macro.
+#
+#   This special exception to the GPL applies to versions of the Autoconf
+#   Macro released by the Autoconf Archive. When you make and distribute a
+#   modified version of the Autoconf Macro, you may extend this special
+#   exception to the GPL to apply to your modified version as well.
+
+AC_DEFUN([AX_PYTHON_DEVEL],[
+	#
+	# Allow the use of a (user set) custom python version
+	#
+	AC_ARG_VAR([PYTHON_VERSION],[The installed Python
+		version to use, for example '2.3'. This string
+		will be appended to the Python interpreter
+		canonical name.])
+
+	AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]])
+	if test -z "$PYTHON"; then
+	   AC_MSG_ERROR([Cannot find python$PYTHON_VERSION in your system path])
+	   PYTHON_VERSION=""
+	fi
+
+	#
+	# Check for a version of Python >= 2.1.0
+	#
+	AC_MSG_CHECKING([for a version of Python >= '2.1.0'])
+	ac_supports_python_ver=`$PYTHON -c "import sys; \
+		ver = sys.version.split ()[[0]]; \
+		print (ver >= '2.1.0')"`
+	if test "$ac_supports_python_ver" != "True"; then
+		if test -z "$PYTHON_NOVERSIONCHECK"; then
+			AC_MSG_RESULT([no])
+			AC_MSG_FAILURE([
+This version of the AC@&t@_PYTHON_DEVEL macro doesn't work properly
+with versions of Python before 2.1.0. You may need to re-run
+configure, setting the variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS,
+PYTHON_LIBS, PYTHON_SITE_PKG, PYTHON_EXTRA_LIBS and
+PYTHON_EXTRA_LDFLAGS by hand.  Moreover, to disable this check, set
+PYTHON_NOVERSIONCHECK to something else than an empty string.
+])
+		else
+			AC_MSG_RESULT([skip at user request])
+		fi
+	else
+		AC_MSG_RESULT([yes])
+	fi
+
+	#
+	# if the macro parameter ``version'' is set, honour it
+	#
+	if test -n "$1"; then
+		AC_MSG_CHECKING([for a version of Python $1])
+		ac_supports_python_ver=`$PYTHON -c "import sys; \
+			ver = sys.version.split ()[[0]]; \
+			print (ver $1)"`
+		if test "$ac_supports_python_ver" = "True"; then
+	   	   AC_MSG_RESULT([yes])
+		else
+			AC_MSG_RESULT([no])
+			AC_MSG_ERROR([this package requires Python $1.
+If you have it installed, but it isn't the default Python
+interpreter in your system path, please pass the PYTHON_VERSION
+variable to configure. See ``configure --help'' for reference.
+])
+			PYTHON_VERSION=""
+		fi
+	fi
+
+	#
+	# Check if you have distutils, else fail
+	#
+	AC_MSG_CHECKING([for the distutils Python package])
+	ac_distutils_result=`$PYTHON -c "import distutils" 2>&1`
+	if test -z "$ac_distutils_result"; then
+		AC_MSG_RESULT([yes])
+	else
+		AC_MSG_RESULT([no])
+		AC_MSG_ERROR([cannot import Python module "distutils".
+Please check your Python installation. The error was:
+$ac_distutils_result])
+		PYTHON_VERSION=""
+	fi
+
+	#
+	# Check for Python include path
+	#
+	AC_MSG_CHECKING([for Python include path])
+	if test -z "$PYTHON_CPPFLAGS"; then
+		python_path=`$PYTHON -c "import distutils.sysconfig; \
+           		print (distutils.sysconfig.get_python_inc ());"`
+		if test -n "${python_path}"; then
+		   	python_path="-I$python_path"
+		fi
+		PYTHON_CPPFLAGS=$python_path
+	fi
+	AC_MSG_RESULT([$PYTHON_CPPFLAGS])
+	AC_SUBST([PYTHON_CPPFLAGS])
+
+	#
+	# Check for Python library path
+	#
+	AC_MSG_CHECKING([for Python library path])
+	if test -z "$PYTHON_LDFLAGS"; then
+		# (makes two attempts to ensure we've got a version number
+		# from the interpreter)
+		ac_python_version=`cat<<EOD | $PYTHON -
+
+# join all versioning strings, on some systems
+# major/minor numbers could be in different list elements
+from distutils.sysconfig import *
+ret = ''
+for e in get_config_vars ('VERSION'):
+	if (e != None):
+		ret += e
+print (ret)
+EOD`
+
+		if test -z "$ac_python_version"; then
+			if test -n "$PYTHON_VERSION"; then
+				ac_python_version=$PYTHON_VERSION
+			else
+				ac_python_version=`$PYTHON -c "import sys; \
+					print (sys.version[[:3]])"`
+			fi
+		fi
+
+		# Make the versioning information available to the compiler
+		AC_DEFINE_UNQUOTED([HAVE_PYTHON], ["$ac_python_version"],
+                                   [If available, contains the Python version number currently in use.])
+
+		# First, the library directory:
+		ac_python_libdir=`cat<<EOD | $PYTHON -
+
+# There should be only one
+import distutils.sysconfig
+for e in distutils.sysconfig.get_config_vars ('LIBDIR'):
+	if e != None:
+		print (e)
+		break
+EOD`
+
+		# Before checking for libpythonX.Y, we need to know
+		# the extension the OS we're on uses for libraries
+		# (we take the first one, if there's more than one fix me!):
+		ac_python_soext=`$PYTHON -c \
+		  "import distutils.sysconfig; \
+		  print (distutils.sysconfig.get_config_vars('SO')[[0]])"`
+
+		# Now, for the library:
+		ac_python_soname=`$PYTHON -c \
+		  "import distutils.sysconfig; \
+		  print (distutils.sysconfig.get_config_vars('LDLIBRARY')[[0]])"`
+
+		# Strip away extension from the end to canonicalize its name:
+		ac_python_library=`echo "$ac_python_soname" | sed "s/${ac_python_soext}$//"`
+
+		# This small piece shamelessly adapted from PostgreSQL python macro;
+		# credits goes to momjian, I think. I'd like to put the right name
+		# in the credits, if someone can point me in the right direction... ?
+		#
+		if test -n "$ac_python_libdir" -a -n "$ac_python_library" \
+			-a x"$ac_python_library" != x"$ac_python_soname"
+		then
+			# use the official shared library
+			ac_python_library=`echo "$ac_python_library" | sed "s/^lib//"`
+			PYTHON_LDFLAGS="-L$ac_python_libdir"
+			PYTHON_LIBS="-l$ac_python_library"
+		else
+			# old way: use libpython from python_configdir
+			ac_python_libdir=`$PYTHON -c \
+			  "from distutils.sysconfig import get_python_lib as f; \
+			  import os; \
+			  print (os.path.join(f(plat_specific=1, standard_lib=1), 'config'));"`
+			PYTHON_LDFLAGS="-L$ac_python_libdir"
+			PYTHON_LIBS="-lpython$ac_python_version"
+		fi
+
+		PYTHON_LIBDIR=$ac_python_libdir
+
+		if test -z "$PYTHON_LDFLAGS" -o -z "$PYTHON_LIBS"; then
+			AC_MSG_WARN([
+Cannot determine location of your Python DSO. Please check it was
+installed with dynamic libraries enabled, or try setting
+PYTHON_LDFLAGS and PYTHON_LIBS by hand.
+			])
+		fi
+	fi
+	AC_MSG_RESULT([$PYTHON_LDFLAGS $PYTHON_LIBS])
+	AC_SUBST([PYTHON_LDFLAGS])
+	AC_SUBST([PYTHON_LIBS])
+	AC_SUBST([PYTHON_LIBDIR])
+
+	#
+	# Check for site packages
+	#
+	AC_MSG_CHECKING([for Python site-packages path])
+	if test -z "$PYTHON_SITE_PKG"; then
+		PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \
+		        print (distutils.sysconfig.get_python_lib(0,0));"`
+	fi
+	AC_MSG_RESULT([$PYTHON_SITE_PKG])
+	AC_SUBST([PYTHON_SITE_PKG])
+
+	#
+	# libraries which must be linked in when embedding
+	#
+	AC_MSG_CHECKING(python extra libraries)
+	if test -z "$PYTHON_EXTRA_LIBS"; then
+	   PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \
+                conf = distutils.sysconfig.get_config_var; \
+                print (conf('LOCALMODLIBS') + ' ' + conf('LIBS'))"`
+	fi
+	AC_MSG_RESULT([$PYTHON_EXTRA_LIBS])
+	AC_SUBST(PYTHON_EXTRA_LIBS)
+
+	#
+	# linking flags needed when embedding
+	#
+	AC_MSG_CHECKING(python extra linking flags)
+	if test -z "$PYTHON_EXTRA_LDFLAGS"; then
+		PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \
+			conf = distutils.sysconfig.get_config_var; \
+			print (conf('LINKFORSHARED'))"`
+	fi
+	AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS])
+	AC_SUBST(PYTHON_EXTRA_LDFLAGS)
+
+	#
+	# final check to see if everything compiles alright
+	#
+	AC_MSG_CHECKING([consistency of all components of python development environment])
+	# save current global flags
+	LDFLAGS="$ac_save_LDFLAGS $PYTHON_LDFLAGS $PYTHON_EXTRA_LDFLAGS $PYTHON_EXTRA_LIBS"
+	LIBS="$ac_save_LIBS $PYTHON_LIBS"
+	CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS"
+	AC_LANG_PUSH([C])
+	AC_LINK_IFELSE([
+		AC_LANG_PROGRAM([[#include <Python.h>]],
+				[[Py_Initialize();]])
+		],[pythonexists=yes],[pythonexists=no])
+	AC_LANG_POP([C])
+	# turn back to default flags
+	CPPFLAGS="$ac_save_CPPFLAGS"
+	LDFLAGS="$ac_save_LDFLAGS"
+	LIBS="$ac_save_LIBS"
+
+	AC_MSG_RESULT([$pythonexists])
+
+        if test ! "x$pythonexists" = "xyes"; then
+	   AC_MSG_WARN([
+========================================================================
+Could not link test program to Python. Maybe the main Python library
+has been installed in some non-standard library path. If so, pass it
+to configure, via the LDFLAGS environment variable.
+
+Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib"
+
+ERROR!
+You probably have to install the development version of the Python
+package for your distribution.  The exact name of this package varies
+among them.
+========================================================================])
+	  PYTHON_VERSION=""
+	  # Execute ACTION_IF_NOT_FOUND or ACTION_IF_FOUND
+	  m4_ifvaln([$3],[$3],[:])dnl
+	  m4_ifvaln([$2],[else $2])dnl
+	fi
+
+	#
+	# all done!
+	#
+])
--- a/setup.py.in	Mon May 04 17:57:19 2009 +0200
+++ b/setup.py.in	Mon May 04 19:38:17 2009 +0200
@@ -31,9 +31,9 @@
          
          # TODO: Check whether paths work on Windows or not.
          # The file separator might be wrong. (Must be / in setup.cfg)
-         include_dirs = ['@PYTAVE_OCTAVE_INCLUDE_PATH@', '@abs_builddir@', '@srcdir@'], # Python always included.
+         include_dirs = ['@OCTAVE_INCLUDEDIR@', '@abs_builddir@', '@srcdir@'], # Python always included.
          define_macros = [('HAVE_CONFIG_H', '1')],
-         library_dirs = ['@PYTAVE_OCTAVE_RPATH@'],
+         library_dirs = ['@OCTAVE_LIBRARYDIR@'],
          runtime_library_dirs = ['@PYTAVE_OCTAVE_RPATH@'],
          libraries = ['octinterp', 'octave', 'cruft', '@BOOST_PYTHON_LIB@']
       )