diff --git a/ac_ctypes.m4 b/ac_ctypes.m4
index f1109ff..282010d 100644
--- a/ac_ctypes.m4
+++ b/ac_ctypes.m4
@@ -5,7 +5,7 @@
 AC_DEFUN([CHECK_CTYPES], [
 	desired_version=$1
 
-	found_version=`python -c "import ctypes;print ctypes.__version__"`
+	found_version=`${PYTHON} -c "import ctypes;print ctypes.__version__"`
 	CHECK_DESIRED_VERSION([ctypes], $desired_version, $found_version)
 ])
 
diff --git a/ac_numarray.m4 b/ac_numarray.m4
index a37d9a9..6fad4b0 100644
--- a/ac_numarray.m4
+++ b/ac_numarray.m4
@@ -5,7 +5,7 @@
 AC_DEFUN([CHECK_NUMARRAY], [
 	desired_version=$1
 
-	found_version=`python -c "from numarray import numinclude; print numinclude.version"`
+	found_version=`${PYTHON} -c "from numarray import numinclude; print numinclude.version"`
 	CHECK_DESIRED_VERSION([numarray], $desired_version, $found_version)
 ])
 
diff --git a/ac_numeric.m4 b/ac_numeric.m4
index 4666a42..6f48989 100644
--- a/ac_numeric.m4
+++ b/ac_numeric.m4
@@ -5,7 +5,7 @@
 AC_DEFUN([CHECK_NUMERIC], [
 	desired_version=$1
 
-	found_version=`python -c "from numeric_version import version; print version"`
+	found_version=`${PYTHON} -c "from numeric_version import version; print version"`
 	CHECK_DESIRED_VERSION([Numeric], $desired_version, $found_version)
 ])
 
diff --git a/ac_numpy.m4 b/ac_numpy.m4
index 77cf52e..4bdc93d 100644
--- a/ac_numpy.m4
+++ b/ac_numpy.m4
@@ -5,7 +5,7 @@
 AC_DEFUN([CHECK_NUMPY], [
 	desired_version=$1
 
-	found_version=`python -c "from numpy import version; print version.version"`
+	found_version=`${PYTHON} -c "from numpy import version; print version.version"`
 	CHECK_DESIRED_VERSION([NumPy], $desired_version, $found_version)
 ])
 
diff --git a/ac_pil.m4 b/ac_pil.m4
index 7fbedb7..236b991 100644
--- a/ac_pil.m4
+++ b/ac_pil.m4
@@ -5,7 +5,7 @@
 AC_DEFUN([CHECK_PIL], [
 	desired_version=$1
 
-	found_version=`python -c "from PIL import Image; print Image.VERSION"`
+	found_version=`${PYTHON} -c "from PIL import Image; print Image.VERSION"`
 	CHECK_DESIRED_VERSION([PIL], $desired_version, $found_version)
 ])
 
diff --git a/ac_pyopengl.m4 b/ac_pyopengl.m4
index 6a618e8..13778c1 100644
--- a/ac_pyopengl.m4
+++ b/ac_pyopengl.m4
@@ -5,7 +5,7 @@
 AC_DEFUN([CHECK_PYOPENGL], [
 	desired_version=$1
 
-	found_version=`python -c "import OpenGL;print OpenGL.__version__"`
+	found_version=`${PYTHON} -c "import OpenGL;print OpenGL.__version__"`
 	CHECK_DESIRED_VERSION([PyOpenGL], $desired_version, $found_version)
 ])
 
diff --git a/ac_pyqt.m4 b/ac_pyqt.m4
index b48a9af..0e8f680 100644
--- a/ac_pyqt.m4
+++ b/ac_pyqt.m4
@@ -5,7 +5,7 @@
 AC_DEFUN([CHECK_PYQT], [
 	desired_version=$1
 
-	found_version=`python -c "from PyQt4 import pyqtconfig; config = pyqtconfig.Configuration(); print config.pyqt_version_str"`
+	found_version=`${PYTHON} -c "from PyQt4 import pyqtconfig; config = pyqtconfig.Configuration(); print config.pyqt_version_str"`
 	CHECK_DESIRED_VERSION([PyQt], $found_version, $found_version)
 ])
 
diff --git a/bootstrap b/bootstrap
index 0e750f4..35e9aea 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1,6 +1,7 @@
 #!/bin/sh
 
 cat ./ac_utils.m4 > ./acinclude.m4
+cat ./ac_pkg.m4 >> ./acinclude.m4
 cat ./ac_freezepython.m4 >> ./acinclude.m4
 cat ./ac_qt4.m4 >> ./acinclude.m4
 cat ./ac_pyqt.m4 >> ./acinclude.m4
@@ -14,7 +15,6 @@ cat ./ac_cppunit.m4 >> ./acinclude.m4
 
 aclocal
 autoheader
-libtoolize --force
+command -v libtoolize && libtoolize --force || glibtoolize --force
 automake --foreign --add-missing --copy
 autoconf
-
diff --git a/cad/src/Makefile b/cad/src/Makefile
index 3ac4cc9..1ac58bc 100755
--- a/cad/src/Makefile
+++ b/cad/src/Makefile
@@ -1,12 +1,13 @@
 # Copyright 2004-2007 Nanorex, Inc.  See LICENSE file for details.
 
-# $Id$
+# $Id: Makefile 13362 2008-07-09 06:47:32Z ericmessick $
 
 UNAME := $(shell uname)
 # dotted python version (2.3, 2.4)
+# can be overriden when launching make for choosing correct python interpreter
 PYDVER := $(shell python -c "import sys; print sys.version[:3]")
 # un-dotted python version (23, 24)
-PYVER := $(shell python -c "import sys; print sys.version[0]+sys.version[2]")
+PYVER := $(shell python$(PYDVER) -c "import sys; print sys.version[0]+sys.version[2]")
 
 SHARED=atombase.lib samevals.lib
 
@@ -26,14 +27,23 @@ SHARED_LIBRARIES = $(SHARED:.lib=.dll)
 else
 #---------------------------------------- Start Unix/Mac stuff
 UNAME_A=$$(uname -a)
+UNAME_R=$$(uname -r)
 CC=gcc
 PYREXTARGET=atombase.so
 STDC99=-std=c99
 ifeq ($(strip $(UNAME)),Darwin)
 #---------------------------------------- Mac
-CFLAGS=-I/System/Library/Frameworks/Python.framework/Versions/$(PYDVER)/lib/python$(PYDVER)/config \
+# frameworks for 10.6
+CFLAGS=-DMACOSX -I/System/Library/Frameworks/OpenGL.framework/Headers
+ifneq ($(findstring "10.6", $(UNAME_R)), '')
+CFLAGS+=-I/System/Library/Frameworks/Python.framework/Versions/$(PYDVER)/lib/python$(PYDVER)/config \
    -I/System/Library/Frameworks/Python.framework/Versions/$(PYDVER)/include/python$(PYDVER)/ \
-   -DMACOSX -I/System/Library/Frameworks/OpenGL.framework/Headers
+   -I/System/Library/Frameworks/Python.framework/Versions/$(PYDVER)/Headers
+else
+CFLAGS+=-I/Library/Frameworks/Python.framework/Versions/$(PYDVER)/lib/python$(PYDVER)/config \
+   -I/Library/Frameworks/Python.framework/Versions/$(PYDVER)/include/python$(PYDVER)/ \
+   -I/Library/Frameworks/Python.framework/Versions/$(PYDVER)/Headers
+endif
 LDFLAGS=-Wl,-F. -framework Python
 LDFLAGS+=-L/usr/lib -lm
 ## LDFLAGS+=-L/usr/X11R6/lib -lGL
@@ -57,7 +67,7 @@ LDSHARED=gcc -shared
 #---------------------------------------- End of Unix
 endif
 SHARED_LIBRARIES = $(SHARED:.lib=.so)
-PYREXC=$(shell python -c "import platform_dependent.PlatformDependent; print platform_dependent.PlatformDependent.find_pyrexc()")
+PYREXC=$(shell python$(PYDVER) -c "import platform_dependent.PlatformDependent; print platform_dependent.PlatformDependent.find_pyrexc()")
 CFLAGS+=-fno-strict-aliasing -DNDEBUG -g -Wall -Wmissing-prototypes \
   -Wstrict-prototypes -fPIC
 # These CFLAGS and LDFLAGS are not used by distutils. If asked to
@@ -89,7 +99,6 @@ doc:
 
 cleanpyc:
 	find . -name \*.pyc -delete
-	find . -name \*.pyo -delete
 
 pyclean: cleanpyc
 	rm -f $(PYFILES0) *~
@@ -104,7 +113,7 @@ clean: cleanpyc
 pyrex: $(PYREXTARGET)
 
 abt: $(PYREXTARGET) atombasetests.py
-	python atombasetests.py
+	python$(PYDVER) atombasetests.py
 
 atombase.c: atombasehelp.c atombase.pyx
 	$(PYREXC) atombase.pyx
diff --git a/configure.ac b/configure.ac
index 9910509..c41ab7c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,7 +18,9 @@ AC_CONFIG_HEADER([config.h])
 
 # Checks for programs.
 AM_PATH_PYTHON([2.3])
-AC_SUBST(PYTHON_BASE, "$(echo ${PYTHON} | sed "s%/bin/python%%")")
+if test -z "${PYTHON_BASE}"; then
+	AC_SUBST(PYTHON_BASE, "$(echo ${PYTHON} | sed "s%/bin/python%%")")
+fi
 AC_PATH_PROG(PYREXC, pyrexc)
 AC_PROG_CXX
 AC_PROG_CC
@@ -26,6 +28,8 @@ AC_PROG_LIBTOOL
 AC_PROG_INSTALL
 AC_PROG_LN_S
 
+#TEST_CHECK_DESIRED_VERSION
+
 #
 # Check strictness option
 #
@@ -69,14 +73,15 @@ AM_CONDITIONAL([ENABLE_CPPUNIT_TESTS], [test "$enable_cppunit_tests" = "yes"])
 # Checks for libraries.
 #
 CHECK_FREEZEPYTHON([3.0.3])
-CHECK_QT([4.2.3])
-CHECK_PYQT([4.2])
 CHECK_NUMARRAY([1.5.2])
 CHECK_NUMERIC([23.8])
 CHECK_NUMPY([1.0.2])
 CHECK_CTYPES([1.0.2])
 CHECK_PYOPENGL([3.0.0a6])
 CHECK_PIL([1.1.6])
+CHECK_QT([4.2.3])
+CHECK_PYQT([4.2])
+CHECK_PYQT([4.2.1])
 
 #   CppUnit Tests (CppUnit)
 if test "$enable_cppunit_tests" = "yes"; then
diff --git a/packaging/MacOSX/SV_AB_Makefile b/packaging/MacOSX/SV_AB_Makefile
index 3964120..1ac58bc 100755
--- a/packaging/MacOSX/SV_AB_Makefile
+++ b/packaging/MacOSX/SV_AB_Makefile
@@ -4,9 +4,10 @@
 
 UNAME := $(shell uname)
 # dotted python version (2.3, 2.4)
+# can be overriden when launching make for choosing correct python interpreter
 PYDVER := $(shell python -c "import sys; print sys.version[:3]")
 # un-dotted python version (23, 24)
-PYVER := $(shell python -c "import sys; print sys.version[0]+sys.version[2]")
+PYVER := $(shell python$(PYDVER) -c "import sys; print sys.version[0]+sys.version[2]")
 
 SHARED=atombase.lib samevals.lib
 
@@ -26,14 +27,23 @@ SHARED_LIBRARIES = $(SHARED:.lib=.dll)
 else
 #---------------------------------------- Start Unix/Mac stuff
 UNAME_A=$$(uname -a)
+UNAME_R=$$(uname -r)
 CC=gcc
 PYREXTARGET=atombase.so
 STDC99=-std=c99
 ifeq ($(strip $(UNAME)),Darwin)
 #---------------------------------------- Mac
-CFLAGS=-I/Library/Frameworks/Python.framework/Versions/$(PYDVER)/lib/python$(PYDVER)/config \
+# frameworks for 10.6
+CFLAGS=-DMACOSX -I/System/Library/Frameworks/OpenGL.framework/Headers
+ifneq ($(findstring "10.6", $(UNAME_R)), '')
+CFLAGS+=-I/System/Library/Frameworks/Python.framework/Versions/$(PYDVER)/lib/python$(PYDVER)/config \
+   -I/System/Library/Frameworks/Python.framework/Versions/$(PYDVER)/include/python$(PYDVER)/ \
+   -I/System/Library/Frameworks/Python.framework/Versions/$(PYDVER)/Headers
+else
+CFLAGS+=-I/Library/Frameworks/Python.framework/Versions/$(PYDVER)/lib/python$(PYDVER)/config \
    -I/Library/Frameworks/Python.framework/Versions/$(PYDVER)/include/python$(PYDVER)/ \
-   -DMACOSX -I/System/Library/Frameworks/OpenGL.framework/Headers
+   -I/Library/Frameworks/Python.framework/Versions/$(PYDVER)/Headers
+endif
 LDFLAGS=-Wl,-F. -framework Python
 LDFLAGS+=-L/usr/lib -lm
 ## LDFLAGS+=-L/usr/X11R6/lib -lGL
@@ -57,7 +67,7 @@ LDSHARED=gcc -shared
 #---------------------------------------- End of Unix
 endif
 SHARED_LIBRARIES = $(SHARED:.lib=.so)
-PYREXC=$(shell python -c "import platform_dependent.PlatformDependent; print platform_dependent.PlatformDependent.find_pyrexc()")
+PYREXC=$(shell python$(PYDVER) -c "import platform_dependent.PlatformDependent; print platform_dependent.PlatformDependent.find_pyrexc()")
 CFLAGS+=-fno-strict-aliasing -DNDEBUG -g -Wall -Wmissing-prototypes \
   -Wstrict-prototypes -fPIC
 # These CFLAGS and LDFLAGS are not used by distutils. If asked to
@@ -103,7 +113,7 @@ clean: cleanpyc
 pyrex: $(PYREXTARGET)
 
 abt: $(PYREXTARGET) atombasetests.py
-	python atombasetests.py
+	python$(PYDVER) atombasetests.py
 
 atombase.c: atombasehelp.c atombase.pyx
 	$(PYREXC) atombase.pyx
diff --git a/pkg-conf-osx106/QtCore.pc b/pkg-conf-osx106/QtCore.pc
new file mode 100644
index 0000000..6a64a80
--- /dev/null
+++ b/pkg-conf-osx106/QtCore.pc
@@ -0,0 +1,12 @@
+package=QtCore
+prefix=/Library/Frameworks/${package}.framework
+exec_prefix=${prefix}
+libdir=${exec_prefix}
+includedir=${prefix}/Headers
+
+Name: QtCore
+Description: QtCore
+Version: 4.7.0
+
+Libs: -L${libdir} ${libdir}/${package}
+Cflags: -I${includedir}
diff --git a/pkg-conf-osx106/QtGui.pc b/pkg-conf-osx106/QtGui.pc
new file mode 100644
index 0000000..3ac8df1
--- /dev/null
+++ b/pkg-conf-osx106/QtGui.pc
@@ -0,0 +1,12 @@
+package=QtGui
+prefix=/Library/Frameworks/${package}.framework
+exec_prefix=${prefix}
+libdir=${exec_prefix}
+includedir=${prefix}/Headers
+
+Name: QtGui
+Description: QtGui
+Version: 4.7.0
+
+Libs: -L${libdir} ${libdir}/${package}
+Cflags: -I${includedir}
diff --git a/sim/src/Makefile.am b/sim/src/Makefile.am
index b293d91..e2e0153 100644
--- a/sim/src/Makefile.am
+++ b/sim/src/Makefile.am
@@ -1,6 +1,6 @@
 
 INCLUDES = -I@PYTHON_BASE@/include/python${PYTHON_VERSION}
-CFLAGS = $(shell python distutils_compile_options.py compiler_so)
+AM_CFLAGS = $(shell python distutils_compile_options.py compiler_so)
 
 ne1bindir = $(bindir)/NanoEngineer-$(PACKAGE_VERSION).app/bin
 ne1bin_LTLIBRARIES = sim.la
diff --git a/sim/src/bend.py b/sim/src/bend.py
index 1e4d28a..deac3a7 100755
--- a/sim/src/bend.py
+++ b/sim/src/bend.py
@@ -10,7 +10,7 @@ from math import sqrt
 findBondNamePattern = re.compile(r"^(\S+)\s+(.*)$")
 bondNamePattern = re.compile(r"(.*)([-=+@#])(.*)([-=+@#])(.*)$")
 parameterPattern = re.compile(r"^([^=]+)\s*\=\s*(\S+)\s*(.*)")
-idPattern = re.compile(r"(\$Id\:.*\$)")
+idPattern = re.compile(r"(\$Id.*\$)")
 commentPattern = re.compile("#")
 leadingWhitespacePattern = re.compile(r"^\s*")
 trailingWhitespacePattern = re.compile(r"\s*$")
diff --git a/sim/src/distutils_compile_options.py b/sim/src/distutils_compile_options.py
index 65b6f17..c6f6a58 100755
--- a/sim/src/distutils_compile_options.py
+++ b/sim/src/distutils_compile_options.py
@@ -1,5 +1,6 @@
 # Copyright 2006 Nanorex, Inc.  See LICENSE file for details. 
 import sys
+import re
 import distutils.sysconfig
 import distutils.ccompiler
 
@@ -18,6 +19,8 @@ if len(sys.argv) < 2:
 else:
     for arg in sys.argv[1:]:
         cmd = getattr(mcc, arg)
-        if cmd.startswith("gcc ") or cmd.startswith("g++ "):
-            cmd = cmd[4:]
+        cmd = re.sub(r'(gcc|g\+\+)(-[0-9\.]+)? (.+)', r'\3', cmd)
+        cmd = re.sub(r' -arch [a-z0-9_-]+', r'', cmd)
+        #if cmd.startswith("gcc ") or cmd.startswith("g++ "):
+        #    cmd = cmd[4:]
         print cmd
diff --git a/sim/src/stretch.py b/sim/src/stretch.py
index f6132fa..b7d265f 100755
--- a/sim/src/stretch.py
+++ b/sim/src/stretch.py
@@ -10,7 +10,7 @@ from math import sqrt
 findBondNamePattern = re.compile(r"^(\S+)\s+(.*)$")
 bondNamePattern = re.compile(r"(.*)([-=+@#])(.*)$")
 parameterPattern = re.compile(r"^([^=]+)\s*\=\s*(\S+)\s*(.*)")
-idPattern = re.compile(r"(\$Id\:.*\$)")
+idPattern = re.compile(r"(\$Id.*\$)")
 commentPattern = re.compile("#")
 leadingWhitespacePattern = re.compile(r"^\s*")
 trailingWhitespacePattern = re.compile(r"\s*$")
