Index: configure.ac
===================================================================
--- configure.ac	(revision 912a6fdd405aaa827ff1d2909e029377d0d1e36d)
+++ configure.ac	(revision 1ca493a2a14891b2ec1781234b51cb32c684826b)
@@ -36,8 +36,13 @@
   # Python (for boost::python)
   AM_PATH_PYTHON([2.2])
-  AX_PYTHON
   AC_DEFINE(HAVE_PYTHON,1, ["Build python module and scripts."])
 ])
+python_version_major=`echo $PYTHON_VERSION | sed -e "s#\([0-9]\)\..*#\1#"`
 AM_CONDITIONAL([CONDPYTHON], [test x"$enable_python" != x"no"])
+AS_IF([test x"$python_version_major" = x"2"],[
+        AC_DEFINE(HAVE_PYTHON2, 1, ["using python version 2"])
+],[test x"$python_version_major" = x"3"],[
+        AC_DEFINE(HAVE_PYTHON3, 1, ["using python version 3"])
+])
 AC_SUBST(HAVE_PYTHON)
 
Index: ax_python.m4
===================================================================
--- m4/ax_python.m4	(revision 912a6fdd405aaa827ff1d2909e029377d0d1e36d)
+++ 	(revision )
@@ -1,105 +1,0 @@
-# ===========================================================================
-#         http://www.gnu.org/software/autoconf-archive/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.7 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.
-#
-# LICENSE
-#
-#   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 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.
-#
-#  Modifications:
-#	2011-09-20: (Frederik Heber)
-#		added tailing to last of locate to prevent multiple hits
-#
-# 2011-11-11 (Frederik Heber)
-#   added support for python2.7
-#
-
-#serial 10
-
-AC_DEFUN([AX_PYTHON],
-[AC_MSG_CHECKING(for python build information)
-AC_MSG_RESULT([])
-for python in python2.7 python2.6 python2.5 python2.4 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,, | tail -n 1`]],
-   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
Index: m4/boost.m4
===================================================================
--- m4/boost.m4	(revision 912a6fdd405aaa827ff1d2909e029377d0d1e36d)
+++ m4/boost.m4	(revision 1ca493a2a14891b2ec1781234b51cb32c684826b)
@@ -1122,4 +1122,5 @@
 _BOOST_PYTHON_CONFIG([LDFLAGS],   [ldflags])
 _BOOST_PYTHON_CONFIG([LIBS],      [libs])
+AC_SUBST([BOOST_PYTHON_LIB], [$BOOST_PYTHON_LIBS])
 m4_pattern_allow([^BOOST_PYTHON_MODULE$])dnl
 BOOST_FIND_LIBS([python], [python python3], [$1],
Index: python/Makefile.am
===================================================================
--- python/Makefile.am	(revision 912a6fdd405aaa827ff1d2909e029377d0d1e36d)
+++ python/Makefile.am	(revision 1ca493a2a14891b2ec1781234b51cb32c684826b)
@@ -18,12 +18,17 @@
 	../src/Actions/GlobalListOfActions.hpp \
 	../src/Actions/ActionHistory.hpp
-pyMoleCuilder_la_CPPFLAGS = $(AM_CPPFLAGS) ${BOOST_CPPFLAGS} ${CodePatterns_CFLAGS} $(JobMarket_CFLAGS) -I$(PYTHON_INCLUDE_DIR)
-pyMoleCuilder_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info $(MOLECUILDER_SO_VERSION) -shared $(BOOST_PYTHON_LDFLAGS) 
+pyMoleCuilder_la_CPPFLAGS = \
+	$(AM_CPPFLAGS) \
+	${BOOST_CPPFLAGS} \
+	${CodePatterns_CFLAGS} \
+	$(JobMarket_CFLAGS) \
+	$(BOOST_PYTHON_CPPFLAGS)
+pyMoleCuilder_la_LDFLAGS = $(AM_LDFLAGS) -module -version-info $(MOLECUILDER_SO_VERSION) -shared $(BOOST_PYTHON_LDFLAGS) $(BOOST_PYTHON_LDFLAGS)
 pyMoleCuilder_la_LIBADD = \
 	$(top_builddir)/src/libMolecuilderUI.la
 pyMoleCuilder_la_LIBADD += \
 	$(BOOST_PYTHON_LIBS) \
-	${CodePatterns_LIBS} \
-	-l$(PYTHON_LIB)
+	$(BOOST_PYTHON_LIB) \
+	${CodePatterns_LIBS}
 endif
 
Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(revision 912a6fdd405aaa827ff1d2909e029377d0d1e36d)
+++ src/Makefile.am	(revision 1ca493a2a14891b2ec1781234b51cb32c684826b)
@@ -323,10 +323,10 @@
 	Actions/Action_impl_python.hpp \
 	Actions/GlobalListOfActions.hpp
-molecuilder_CPPFLAGS += -I$(PYTHON_INCLUDE_DIR)
+molecuilder_CPPFLAGS += $(BOOST_PYTHON_CPPFLAGS)
 molecuilder_LDFLAGS += $(BOOST_PYTHON_LDFLAGS) 
 molecuilder_LDADD += \
 	$(BOOST_PYTHON_LIBS) \
-	${CodePatterns_LIBS} \
-	-l$(PYTHON_LIB)
+	$(BOOST_PYTHON_LIB) \
+	${CodePatterns_LIBS}
 endif
 
@@ -363,10 +363,10 @@
 	Actions/Action_impl_python.hpp \
 	Actions/GlobalListOfActions.hpp
-molecuildergui_CPPFLAGS += -I$(PYTHON_INCLUDE_DIR)
+molecuildergui_CPPFLAGS += $(BOOST_PYTHON_CPPFLAGS)
 molecuildergui_LDFLAGS += $(BOOST_PYTHON_LDFLAGS) 
 molecuildergui_LDADD += \
 	$(BOOST_PYTHON_LIBS) \
-	${CodePatterns_LIBS} \
-	-l$(PYTHON_LIB)
+	$(BOOST_PYTHON_LIB) \
+	${CodePatterns_LIBS}
 endif
 
Index: src/Python/Makefile.am
===================================================================
--- src/Python/Makefile.am	(revision 912a6fdd405aaa827ff1d2909e029377d0d1e36d)
+++ src/Python/Makefile.am	(revision 1ca493a2a14891b2ec1781234b51cb32c684826b)
@@ -19,10 +19,10 @@
 noinst_LTLIBRARIES += libMolecuilderPython.la
 libMolecuilderPython_la_includedir = $(includedir)/MoleCuilder/
-libMolecuilderPython_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(PYTHON_INCLUDE_DIR)
+libMolecuilderPython_la_CPPFLAGS = $(AM_CPPFLAGS) $(BOOST_PYTHON_CPPFLAGS)
 libMolecuilderPython_la_LDFLAGS = $(AM_LDFLAGS) $(BOOST_PYTHON_LDFLAGS) 
 libMolecuilderPython_la_LIBADD = \
 	$(BOOST_PYTHON_LIBS) \
-	${CodePatterns_LIBS} \
-	-l$(PYTHON_LIB)
+	$(BOOST_PYTHON_LIB) \
+	${CodePatterns_LIBS}
 
 nobase_libMolecuilderPython_la_include_HEADERS = ${PYTHONHEADER}
Index: src/Python/PythonScripting.cpp
===================================================================
--- src/Python/PythonScripting.cpp	(revision 912a6fdd405aaa827ff1d2909e029377d0d1e36d)
+++ src/Python/PythonScripting.cpp	(revision 1ca493a2a14891b2ec1781234b51cb32c684826b)
@@ -54,5 +54,9 @@
 {
   try {
+#ifdef HAVE_PYTHON2
     PyImport_AppendInittab( "pyMoleCuilder", &initpyMoleCuilder );
+#else
+    PyImport_AppendInittab( "pyMoleCuilder", &PyInit_pyMoleCuilder );
+#endif
 
     Py_Initialize();
@@ -66,7 +70,7 @@
     main_namespace["pyMoleCuilder"] = molecuilder_module;
 
-    std::string enveloped_script("print \"BEGIN of "+python_scripttitle+":\"\n");
+    std::string enveloped_script("print(\"BEGIN of "+python_scripttitle+":\")\n");
     enveloped_script += python_string+std::string("\n");
-    enveloped_script += std::string("print \"END of "+python_scripttitle+":\"\n");
+    enveloped_script += std::string("print(\"END of "+python_scripttitle+":\")\n");
 
     boost::python::handle<> ignored(( PyRun_String( enveloped_script.c_str(),
