diff --git a/configure.in b/configure.in
index 2997011..2fa533d 100644
--- a/configure.in
+++ b/configure.in
@@ -118,6 +118,13 @@ AC_DEFINE_UNQUOTED([ISO_CODES_PREFIX],["`$PKG_CONFIG --variable=prefix iso-codes
 # Get the CFLAGS and LIBS for python's embedding API:
 AM_CHECK_PYTHON_HEADERS(,[AC_MSG_ERROR(could not find Python headers)])
 
+BOOST_PYTHON_LIBS="-lboost_python-gcc43-mt-1_38"
+AC_SUBST([BOOST_PYTHON_LIBS])
+
+#These don't work. pyconfig.h can't be found when using python.hpp.
+#AX_PYTHON()
+#AX_BOOST_PYTHON()
+
 # We don't have this on mingw, for example
 AC_CHECK_FUNCS(strptime)
 
diff --git a/glom/Makefile.am b/glom/Makefile.am
index cb2c39b..ad21664 100644
--- a/glom/Makefile.am
+++ b/glom/Makefile.am
@@ -11,11 +11,11 @@ glom_examples_dir_alternative = $(datadir)/doc/glom/examples/
 glom_icon_dir = $(datadir)/icons/hicolor/48x48/apps
 
 bin_PROGRAMS = glom
-noinst_PROGRAMS = test_pyembed
+noinst_PROGRAMS = test_pyembed test_pyembed_boost
 
 # We define GLOM_GLADEDIR so that we can get the installed .glade file at runtime.
 # We define PREFIX, SYSCONFDIR, LIBDIR, and DATADIR for the GNOME_PROGRAM_STANDARD_PROPERTIES macro.
-AM_CPPFLAGS = -I@top_srcdir@/ $(GLOM_CFLAGS) $(PYTHON_INCLUDES) \
+AM_CPPFLAGS = -I@top_srcdir@/ $(GLOM_CFLAGS) $(BOOST_PYTHON_LIBS) $(PYTHON_INCLUDES) \
 			$(MAEMO_LAUNCHER_CFLAGS) \
            -DGLOM_GLADEDIR=\""$(gladedir)/"\" \
            -DLOCALEDIR=\""$(datadir)/locale"\" \
@@ -90,7 +90,7 @@ glom_LDADD += navigation/libnavigation.a \
 
 glom_LDADD += python_embed/libpython_embed.a \
               $(top_builddir)/glom/libglom/libglom.la \
-              $(GLOM_LIBS) $(PYTHON_LDFLAGS) $(MAEMO_LAUNCHER_LIBS)
+              $(GLOM_LIBS) $(BOOST_PYTHON_LIBS) $(PYTHON_LDFLAGS) $(MAEMO_LAUNCHER_LIBS) 
 
 if !WIN32
 glom_LDADD += -lutil
@@ -112,6 +112,9 @@ glom_LDADD += -lgettextpo
 test_pyembed_SOURCES = test_pyembed.cc
 test_pyembed_LDADD = $(GLOM_LIBS) $(PYTHON_LDFLAGS)
 
+test_pyembed_boost_SOURCES = test_pyembed_boost.cc
+test_pyembed_boost_LDADD = $(GLOM_LIBS) $(BOOST_PYTHON_LIBS) $(PYTHON_LDFLAGS)
+
 if !WIN32
 test_pyembed_LDADD += -lutil
 endif
diff --git a/glom/main.cc b/glom/main.cc
index f50c757..9fb53b6 100644
--- a/glom/main.cc
+++ b/glom/main.cc
@@ -21,7 +21,8 @@
 #include "config.h" //For VERSION.
 
 //We use Python for calculated fields.
-#include <Python.h> //Include it before anything else to avoid "_POSIX_C_SOURCE redefined".
+//#include <Python.h> //Include it before anything else to avoid "_POSIX_C_SOURCE redefined".
+#include <boost/python.hpp>
 
 //#include <gnome.h>
 #include <gtkmm/main.h>
diff --git a/glom/python_embed/glom_python.cc b/glom/python_embed/glom_python.cc
index ffe4a10..e094658 100644
--- a/glom/python_embed/glom_python.cc
+++ b/glom/python_embed/glom_python.cc
@@ -22,12 +22,10 @@
 #include <glom/libglom/python_embed/py_glom_record.h>
 #include <glom/libglom/python_embed/pygdavalue_conversions.h>
 
-#define NO_IMPORT_PYGTK //To avoid a multiple definition in pygtk.
-#include <pygtk/pygtk.h> //For the PyGObject and PyGBoxed struct definitions.
-
-#include <Python.h>
-#include <compile.h> /* for the PyCodeObject */
-#include <eval.h> /* for PyEval_EvalCode */
+//#include <Python.h>
+//#include <compile.h> /* for the PyCodeObject */
+//#include <eval.h> /* for PyEval_EvalCode */
+#include <boost/python.hpp>
 
 #include "glom_python.h"
 #include <glom/libglom/data_structure/glomconversions.h>
@@ -40,7 +38,7 @@
 namespace Glom
 {
 
-std::list<Glib::ustring> ustring_tokenize(const Glib::ustring& msg, const Glib::ustring& separators, int maxParts)
+static std::list<Glib::ustring> ustring_tokenize(const Glib::ustring& msg, const Glib::ustring& separators, int maxParts)
 {
   std::list<Glib::ustring> result;
   Glib::ustring str = msg;
@@ -64,33 +62,36 @@ std::list<Glib::ustring> ustring_tokenize(const Glib::ustring& msg, const Glib::
 }
 
 // Use this for errors not (directly) caused by the user
-void HandlePythonError()
+static void HandlePythonError()
 {
   if(PyErr_Occurred())
     PyErr_Print();
 }
 
 // Show python coding errors of the user
-void ShowTrace()
+static void ShowTrace()
 {
   // Python equivilant:
   // import traceback, sys
   // return "".join(traceback.format_exception(sys.exc_type,
   //    sys.exc_value, sys.exc_traceback))
 
-  PyObject *type, *value, *traceback;
-
+  PyObject* type = 0;
+  PyObject* value = 0;
+  PyObject* traceback = 0;
   PyErr_Fetch(&type, &value, &traceback);
   
   if(!traceback)
   {
     std::cerr << "traceback = 0" << std::endl;
+    return;
   }
 
   PyObject *tracebackModule = PyImport_ImportModule((char*)"traceback");
   gchar* chrRetval = 0;
   if(tracebackModule != NULL)
   {
+      //TODO: What is the boost::python equivalent of PyObject_CallMethod()?
       PyObject* tbList = PyObject_CallMethod(
           tracebackModule,
           (char*)"format_exception",
@@ -101,18 +102,17 @@ void ShowTrace()
       
       if(!tbList)
       {
-        std::cerr << "format_exception failed" << std::endl;
+        std::cerr << "Glom: format_exception failed" << std::endl;
         return;
       }
 
-      PyObject* emptyString = PyString_FromString("");
-      PyObject* strRetval = PyObject_CallMethod(emptyString, (char*)"join",
+      boost::python::str emptyString("");
+      PyObject* strRetval = PyObject_CallMethod(emptyString.ptr(), (char*)"join",
             (char*)"O", tbList);
       if(strRetval)
         chrRetval = g_strdup(PyString_AsString(strRetval));
     
       Py_DECREF(tbList);
-      Py_DECREF(emptyString);
       Py_DECREF(strRetval);
       Py_DECREF(tracebackModule);
     }
@@ -172,9 +172,8 @@ Gnome::Gda::Value glom_evaluate_python_function_implementation(Field::glom_field
   func_def = "def " + func_name + "(record):\n  import glom\n  import gda\n" + func_def;
   //We did this in main(): Py_Initialize();
 
-  PyObject* pMain = PyImport_AddModule((char*)"__main__");
-  PyObject* pDict = PyModule_GetDict(pMain);
-
+  boost::python::object pMain = boost::python::import("__main__");
+  boost::python::dict pDict = boost::python::extract<boost::python::dict>( pMain.attr("__dict__") ); //TODO: Does boost::python have an equivalent for PyModule_GetDict()?
 
   //Allow the function to import from our script library:
   if(pDocument)
@@ -186,6 +185,7 @@ Gnome::Gda::Value glom_evaluate_python_function_implementation(Field::glom_field
       const Glib::ustring script = pDocument->get_library_module(name);
       if(!name.empty() && !script.empty())
       {
+        //TODO: Is there a boost::python equivalent for Py_CompileString()?
         PyObject* objectCompiled = Py_CompileString(script.c_str(), name.c_str() /* "filename", for debugging info */,  Py_file_input /* "start token" for multiple lines of code. */); //Returns a reference.
   
         if(!objectCompiled)
@@ -204,100 +204,142 @@ Gnome::Gda::Value glom_evaluate_python_function_implementation(Field::glom_field
   }
 
 
-  PyObject* module_glom = PyImport_ImportModule((char*)"glom");
+  boost::python::object module_glom = boost::python::import("glom");
   if(!module_glom)
   {
     g_warning("Could not import python glom module.");
     return valueResult; // don't crash
   }
 
-  PyObject* module_glom_dict = PyModule_GetDict(module_glom);
+  boost::python::dict module_glom_dict = boost::python::extract<boost::python::dict>( module_glom.attr("__dict__") ); //TODO: Does boost::python have an equivalent for PyModule_GetDict()?
   //This seems to be different to PyGlomRecord_GetPyType() - we can PyObject_Call() this one to instantiate it.
-  PyObject* pyTypeGlomRecord = PyDict_GetItemString(module_glom_dict, (char*)"Record"); //TODO: Unref this?
-  if(!pyTypeGlomRecord || !PyType_Check(pyTypeGlomRecord))
+  boost::python::object pyTypeGlomRecord = module_glom_dict.get("Record");
+  if(!pyTypeGlomRecord)
   {
     g_warning("Could not get glom.Record from glom_module.");
     return valueResult; // don't crash
   }
 
 
-  PyObject* module_gda = PyImport_ImportModule((char*)"gda");
+  boost::python::object module_gda = boost::python::import("gda");
   if(!module_gda)
   {
     g_warning("Could not import python gda module.");
     return valueResult;
   }
 
-  // Gda.Value does not exist anymore in pygda-3.0
-#if 0
-  PyObject* module_gda_dict = PyModule_GetDict(module_gda);
-  PyObject* pyTypeGdaValue = PyDict_GetItemString(module_gda_dict, "Value"); //TODO: Unref this?
-  if(!pyTypeGdaValue || !PyType_Check(pyTypeGdaValue))
-    g_warning("Could not get gda.Value from gda_module.");
-#endif
-
+  boost::python::str func_def_str(func_def.c_str());
 
   //Create the function definition:
-  PyObject* pyValue = PyRun_String(func_def.c_str(), Py_file_input, pDict, pDict);
-  if(pyValue)
+  try
+  {
+    //TODO: What exception can this actually throw?
+    boost::python::exec(func_def_str, pDict, pDict);
+  }
+  catch(const std::runtime_error& ex)
+  {
+    std::cerr << "Glom: Exception caught from boost::python::exec(func_def): runtime_error:" << ex.what() << std::endl;
+    ShowTrace();
+    return valueResult;
+  }
+  catch(const boost::python::error_already_set& ex)
   {
-    Py_DECREF(pyValue);
-    pyValue = 0;
+    std::cerr << "Glom: Exception caught from boost::python::exec(func_def): error_already_set: func_def=" << std::endl << func_def << std::endl;
+    ShowTrace();
+    return valueResult;
   }
-  else
+  catch(...)
   {
+    std::cerr << "Glom: Unknown exception caught from boost::python::exec(func_def)." << std::endl;
     ShowTrace();
+    return valueResult;
   }
 
   //Call the function:
   {
-    PyObject* pFunc = PyDict_GetItemString(pDict, func_name.c_str()); //The result is borrowed, so should not be dereferenced.
+    boost::python::object pFunc = pDict.get(func_name.c_str()); //The result is borrowed, so should not be dereferenced.
     if(!pFunc)
     {
       HandlePythonError();
     }
 
+    /* TODO: 
     if(!PyCallable_Check(pFunc))
     {
       HandlePythonError();
       g_warning("pFunc is not callable.");
       return valueResult;
     }
+    */
 
     //The function's parameter:
   
-    //PyObject* pParam = PyString_FromString("test value"); //This test did not need the extra ref.
+    boost::python::tuple new_args;
+    boost::python::object pParam = pyTypeGlomRecord(new_args); //TODO: PyGlomRecord_GetPyType()?
+    //PyObject* new_args = PyTuple_New(0);
+    //This works: PyGlomRecord* pParam = (PyGlomRecord*)PyObject_Call((PyObject*)pyTypeGlomRecord.ptr(), new_args, 0);
 
-    PyObject* new_args = PyTuple_New(0);
-    PyGlomRecord* pParam = (PyGlomRecord*)PyObject_Call((PyObject*)pyTypeGlomRecord, new_args, 0);
-    //PyGlomRecord* pParam = (PyGlomRecord*)PyObject_Call((PyObject*)PyGlomRecord_GetPyType(), new_args, 0);
-    Py_DECREF(new_args);
-    if(pParam)
+    if(!pParam)
     {
-      Py_INCREF(pParam); //TODO: As I understand it, PyObject_New() should return a new reference, so this should not be necessary.
+      std::cerr << "Failed to instantiate an instance of TypeGlomRecord." << std::endl;
+      return valueResult;
+    }
+    else
+    {
+ std::cout << "DEBUG 0c" << std::endl;
+
 
       //Fill the record's details:
-      PyGlomRecord_SetFields(pParam, field_values, pDocument, table_name, opened_connection);
+      PyGlomRecord_SetFields((PyGlomRecord*)(pParam.ptr()), field_values, pDocument, table_name, opened_connection);
+
+ std::cout << "DEBUG 0d" << std::endl;
+
+      boost::python::tuple pArgs = boost::python::make_tuple(0, pParam);
+
+ std::cout << "DEBUG 0e" << std::endl;
 
-      PyObject* pArgs = PyTuple_New(1);
-      PyTuple_SetItem(pArgs, 0, (PyObject*)pParam); //The pParam reference is taken by PyTuple_SetItem().
 
       //Call the function with this parameter:
-      PyObject* pyResult = PyObject_CallObject(pFunc, pArgs);
-      Py_DECREF(pArgs);
+      boost::python::object pyResult;
+      try
+      {
+        //TODO: What exception can this actually throw?
+        pyResult = boost::python::call<boost::python::object>(pFunc.ptr(), pArgs);
+      }
+      catch(const std::runtime_error& ex)
+      {
+        std::cerr << "Glom: Exception caught from boost::python::call(): runtime_error:" << ex.what() << std::endl;
+        ShowTrace();
+        return valueResult;
+      }
+      catch(const boost::python::error_already_set& ex)
+      {
+        std::cerr << "Glom: Exception caught from boost::python::call(): error_already_set, with func_name=" << std::endl << func_name << std::endl;
+        ShowTrace();
+        return valueResult;
+      }
+      catch(...)
+      {
+        std::cerr << "Glom: Unknown exception caught from boost::python::call()." << std::endl;
+        ShowTrace();
+        return valueResult;
+      }
 
       if(!pyResult)
       {
         g_warning("pyResult was null");
         HandlePythonError();
+        return valueResult;
       }
-      else
+
       {
         //Deal with the various possible return types:
         bool object_is_gda_value = false;
 
-        GValue value = { 0 };
-        const int test = pygda_value_from_pyobject(&value, pyResult);
+        GValue value = { 0, };
+        std::cout << "DEBUG 1" << std::endl;
+        const int test = pygda_value_from_pyobject(&value, pyResult.ptr());
+        std::cout << "DEBUG 1" << std::endl;
 
         if(test == 0) //-1 means error.
           object_is_gda_value = true;
@@ -317,9 +359,8 @@ Gnome::Gda::Value glom_evaluate_python_function_implementation(Field::glom_field
 
           //For instance, if one of the fields was empty, then the calculation might want to return an empty value,
           //instead of returning 0.
-          if(pyResult == Py_None) //Direct comparison is possible and recommended, because there is only one pyNone object.
+          if(pyResult.ptr() == Py_None) //Direct comparison is possible and recommended, because there is only one pyNone object.
           {
- 
             //The result should be an appropriate empty value for this field type:
             valueResult = Conversions::get_empty_value(result_type);
             //std::cout << "DEBUG: glom_evaluate_python_function_implementation(): empty value Gda type=" << g_type_name(valueResult.get_value_type()) << std::endl;
@@ -330,26 +371,28 @@ Gnome::Gda::Value glom_evaluate_python_function_implementation(Field::glom_field
             //(though I don't think this code is ever reached. murrayc)
 
             //Treat this as a string or something that can be converted to a string:
-            PyObject* pyObjectResult = PyObject_Str(pyResult);
-            if(PyString_Check(pyObjectResult))
+            const char* pchResult = 0;
+            try
+            {
+              pchResult = boost::python::extract<const char*>(pyResult);
+            }
+            catch(const boost::python::error_already_set& ex)
             {
-              const char* pchResult = PyString_AsString(pyObjectResult);
-              if(pchResult)
-              {
-                bool success = false;
-                valueResult = Conversions::parse_value(result_type, pchResult, success, true /* iso_format */);
-                std::cout << "DEBUG: glom_evaluate_python_function_implementation(): parsed value Gda type=" << g_type_name(valueResult.get_value_type()) << std::endl;
- 
-              }
-              else
-                HandlePythonError();
+              std::cerr << "Glom: Exception caught from boost::python::extract() while converting result to a const char*." << std::endl << func_name << std::endl;
+              ShowTrace();
+              return valueResult;
+            }
+
+            if(pchResult)
+            {
+              bool success = false;
+              valueResult = Conversions::parse_value(result_type, pchResult, success, true /* iso_format */);
+              std::cout << "DEBUG: glom_evaluate_python_function_implementation(): parsed value Gda type=" << g_type_name(valueResult.get_value_type()) << std::endl;
             }
             else
               HandlePythonError();
           }
         }
-
-        Py_DECREF(pyResult);
       }
     }
   }
diff --git a/glom/python_embed/python_module/Makefile.am b/glom/python_embed/python_module/Makefile.am
index fc7a2f8..322616c 100644
--- a/glom/python_embed/python_module/Makefile.am
+++ b/glom/python_embed/python_module/Makefile.am
@@ -10,7 +10,7 @@ pyexec_LTLIBRARIES = glom.la
 glom_la_LDFLAGS = $(common_ldflags) -export-symbols-regex initglom
 
 glom_la_LIBADD = $(top_builddir)/glom/libglom/libglom.la \
-                 $(GLOM_LIBS) $(PYTHON_LDFLAGS)
+                 $(GLOM_LIBS) $(BOOST_PYTHON_LIB) $(PYTHON_LDFLAGS)
 
 if !WIN32
 glom_la_LIBADD += -lutil
diff --git a/glom/test_pyembed_boost.cc b/glom/test_pyembed_boost.cc
index d161eb1..d9bb108 100644
--- a/glom/test_pyembed_boost.cc
+++ b/glom/test_pyembed_boost.cc
@@ -1,5 +1,4 @@
-#include <Python.h>
-#include <glib.h> //For g_warning().
+#include <boost/python.hpp>
 #include <glibmm/ustring.h>
 #include <iostream>
 #include <list>
@@ -47,54 +46,86 @@ void evaluate_function_implementation(const Glib::ustring& func_impl)
   
   Py_Initialize();
 
-  PyObject* pMain = PyImport_AddModule((gchar*)"__main__");
-  PyObject* pDict = PyModule_GetDict(pMain);
+  std::cout << "debug1" << std::endl;
 
+  boost::python::object pMain = boost::python::import("__main__");
+  boost::python::dict pDict = boost::python::extract<boost::python::dict>( pMain.attr("__dict__") );
+
+  std::cout << "debug2" << std::endl;
   //Create the function definition:
-  PyObject* pyValue = PyRun_String(func_def.c_str(), Py_file_input, pDict, pDict);
-  if(pyValue)
+  try
+  {
+     boost::python::exec(func_def.c_str(), pDict, pDict);
+  }
+  catch(const std::runtime_error& ex)
+  {
+    std::cerr << "Exception caught from boost::python::exec(func_def): runtime_error:" << ex.what() << std::endl;
+  }
+  catch(const boost::python::error_already_set& ex)
+  {
+    std::cerr << "Exception caught from boost::python::exec(func_def): error_already_set: func_def=" << std::endl << func_def << std::endl;
+  }
+  catch(...)
   {
-    Py_DECREF(pyValue);
-    pyValue = 0;
+    std::cerr << "Unknown exception caught from boost::python::exec(func_def)." << std::endl;
   }
 
+  std::cout << "debug3" << std::endl;
+
   //Call the function:
   {
     Glib::ustring call_func = "glom_calc_field_value()";
-    PyObject* pyValue = PyRun_String(call_func.c_str(), Py_eval_input, pDict, pDict);
+    boost::python::object pyValue;
+ std::cout << "debug4" << std::endl;
+
+    try
+    {
+      pyValue = boost::python::eval(call_func.c_str(), pDict, pDict);
+    }
+    catch(const std::runtime_error& ex)
+    {
+      std::cerr << "Exception caught from boost::python::eval(func): runtime_error:" << ex.what() << std::endl;
+    }
+    catch(const boost::python::error_already_set& ex)
+    {
+      std::cerr << "Exception caught from boost::python::eval(func): error_already_set: call_func=" << std::endl << call_func << std::endl;
+    }
+    catch(...)
+    {
+      std::cerr << "Unknown exception caught from boost::python::eval(func)." << std::endl;
+    }
+
+ std::cout << "debug5" << std::endl;
+
     if(!pyValue)
     {
-      g_warning("pyValue was null");
+      std::cerr << "boost::python::eval(func) failed with call_func=" << std::endl << call_func << std::endl;
       PyErr_Print();
     }
     else
     {
-      PyObject* pyStringObject = PyObject_Str(pyValue);
-      if(pyStringObject)
+ std::cout << "debug5.1" << std::endl;
+
+      try
       {
-        if(PyString_Check(pyStringObject))
-        {
-          const char* pchResult = PyString_AsString(pyStringObject);
-          if(pchResult)
-            g_warning("result is %s", pchResult);
-          else
-            g_warning("pchResult is null");
-        }
-        else
-          g_warning("PyString_Check returned false");
+        int result = boost::python::extract<int>(pyValue);
+        std::cout << "result=" << result << std::endl;
+      }
+      catch(const boost::python::error_already_set& ex)
+      {
+        std::cerr << "The result could not be converted to int." << std::endl;
       }
-      else
-        g_warning("pyStringObject is null");
 
-      Py_DECREF(pyValue);
     }
   }
 
+ std::cout << "debuga1" << std::endl;
+
   Py_FlushLine();
   PyErr_Clear();
 
 
-  Py_Finalize();
+  //Py_Finalize();
 
 }
 
diff --git a/macros/Makefile.am b/macros/Makefile.am
index 09b4618..683047a 100644
--- a/macros/Makefile.am
+++ b/macros/Makefile.am
@@ -1,3 +1,2 @@
-EXTRA_DIST = macros.m4
-
+EXTRA_DIST = dk-warn.m4 macros.m4
 
diff --git a/macros/ax_boost_python.m4 b/macros/ax_boost_python.m4
index 2a3884d..55aed81 100644
--- a/macros/ax_boost_python.m4
+++ b/macros/ax_boost_python.m4
@@ -1,6 +1,4 @@
-# ===========================================================================
-#            http://autoconf-archive.cryp.to/ax_boost_python.html
-# ===========================================================================
+##### http://autoconf-archive.cryp.to/ax_boost_python.html
 #
 # SYNOPSIS
 #
@@ -8,83 +6,93 @@
 #
 # DESCRIPTION
 #
-#   This macro checks to see if the Boost.Python library is installed. It
-#   also attempts to guess the currect library name using several attempts.
-#   It tries to build the library name using a user supplied name or suffix
-#   and then just the raw library.
+#   This macro checks to see if the Boost.Python library is installed.
+#   It also attempts to guess the currect library name using several
+#   attempts. It tries to build the library name using a user supplied
+#   name or suffix and then just the raw library.
 #
 #   If the library is found, HAVE_BOOST_PYTHON is defined and
 #   BOOST_PYTHON_LIB is set to the name of the library.
 #
-#   This macro calls AC_SUBST(BOOST_PYTHON_LIB).
+#   This macro calls AC_SUBST(BOOST_PYTHON_LIBS).
 #
-#   In order to ensure that the Python headers are specified on the include
-#   path, this macro requires AX_PYTHON to be called.
+#   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
+#   2007-07-29
 #
 # COPYLEFT
 #
-#   Copyright (c) 2008 Michael Tindal
+#   Copyright (c) 2005 Michael Tindal <mtindal@paradoxpoint.com>
+#   Copyright © 2007 Carl Fürstenberg <azatoth@gmail.com>
 #
-#   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 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.
+#   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, write to the Free Software
+#   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+#   02111-1307, USA.
+#
+#   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_BOOST_PYTHON],
 [AC_REQUIRE([AX_PYTHON])dnl
-AC_CACHE_CHECK(whether the Boost::Python library is available,
-ac_cv_boost_python,
-[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;
- BOOST_PYTHON_MODULE(test) { throw "Boost::Python test."; }]],
- 			   [[return 0;]]),
-  			   ac_cv_boost_python=yes, ac_cv_boost_python=no)
- AC_LANG_RESTORE
- CPPFLAGS=$CPPFLAGS_SAVE
+ax_python_lib=boost_python
+AC_ARG_WITH([boost-python],AS_HELP_STRING([--with-boost-python],[specify the boost python library to use]),
+	[ax_python_lib=$withval],
+	[for suffix in mt st gcc-mt gcc gcc41-mt gcc41 gcc42-mt gcc42; do
+		ax_python_lib_extra="$ax_python_lib_extra $ax_python_lib-$suffix";
+	done;
+	ax_python_lib="$ax_python_lib $ax_python_lib_extra"]
+)
+
+AS_VAR_PUSHDEF([ax_Search], [ax_cv_search])dnl
+AC_CACHE_CHECK([for Usable Boost::Python library], [ax_Search],
+[AC_LANG_PUSH([C++])
+ax_cv_search_save_CXXFLAGS=$CXXFLAGS
+CXXFLAGS="-I$PYTHON_INCLUDE_DIR $CXXFLAGS"
+ax_cv_search_save_LIBS=$LIBS
+for ax_current_lib in $ax_python_lib; do
+	ax_res=-l$ax_current_lib
+	LIBS="-l$ax_current_lib -l$PYTHON_LIB $ax_cv_search_save_LIBS"
+	AC_LINK_IFELSE([#include <boost/python/module.hpp>
+		using namespace boost::python;
+		BOOST_PYTHON_MODULE(test) { throw "Boost::Python test."; }
+		int main() {return 0;}],
+		[AS_VAR_SET([ax_Search], [$ax_res])])
+		AS_VAR_SET_IF([ax_Search], [break])dnl
+done
+AS_VAR_SET_IF([ax_Search], , [AS_VAR_SET([ax_Search], [no])])
+LIBS=$ax_cv_search_save_LIBS
+AC_LANG_POP([C++])])
+ax_res=AS_VAR_GET([ax_Search])
+AS_IF([test "$ax_res" != "no"],
+	[BOOST_PYTHON_LIBS="$ax_res"
+	AC_SUBST(BOOST_PYTHON_LIBS)
+	AC_DEFINE([HAVE_BOOST_PYTHON],,[define if the Boost::Python library is available])],
+	[AS_WARN([No suitable Boost::Python library found])])dnl
+AS_VAR_POPDEF([ax_Search])dnl
 ])
-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
-    AC_CHECK_LIB($ax_lib, exit, [BOOST_PYTHON_LIB=$ax_lib break])
-  done
-  AC_SUBST(BOOST_PYTHON_LIB)
-fi
-])dnl
diff --git a/macros/ax_python.m4 b/macros/ax_python.m4
index 54433e4..ffb7e78 100644
--- a/macros/ax_python.m4
+++ b/macros/ax_python.m4
@@ -1,6 +1,4 @@
-# ===========================================================================
-#               http://autoconf-archive.cryp.to/ax_python.html
-# ===========================================================================
+##### http://autoconf-archive.cryp.to/ax_python.html
 #
 # SYNOPSIS
 #
@@ -10,9 +8,9 @@
 #
 #   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 recurses through several python versions (from 2.1 to 2.4 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
@@ -23,37 +21,41 @@
 #
 # LAST MODIFICATION
 #
-#   2008-04-12
+#   2007-07-29
 #
 # COPYLEFT
 #
-#   Copyright (c) 2008 Michael Tindal
+#   Copyright (c) 2004 Michael Tindal <mtindal@paradoxpoint.com>
 #
-#   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 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.
+#   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, write to the Free Software
+#   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+#   02111-1307, USA.
+#
+#   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)
diff --git a/macros/boost.m4 b/macros/boost.m4
index 4a6e29c..6de82d4 100644
--- a/macros/boost.m4
+++ b/macros/boost.m4
@@ -491,6 +491,18 @@ AC_DEFUN([BOOST_PROGRAM_OPTIONS],
 ])# BOOST_PROGRAM_OPTIONS
 
 
+# BOOST_PYTHON([PREFERRED-RT-OPT])
+# -------------------------------
+# Look for Boost.Python.  For the documentation of PREFERRED-RT-OPT, see the
+# documentation of BOOST_FIND_LIB above.
+AC_DEFUN([BOOST_PYTHON],
+[BOOST_FIND_LIB([python], [$1],
+                [boost/python.hpp],
+                [boost::python::extract]]
+)
+])# BOOST_PYTHON
+
+
 # BOOST_REF()
 # -----------
 # Look for Boost.Ref
