Index: Makefile.am
===================================================================
--- Makefile.am	(revision be90f17d330ec04dde01f9ed6bf79fd8a8b809ce)
+++ Makefile.am	(revision b9907cd8232949bfc6e9d327b29d286a12d485d5)
@@ -1,4 +1,4 @@
 ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = src doc tests
+SUBDIRS = src src/unittests doc tests 
 
 EXTRA_DIST = autogen.sh
Index: configure.ac
===================================================================
--- configure.ac	(revision be90f17d330ec04dde01f9ed6bf79fd8a8b809ce)
+++ configure.ac	(revision b9907cd8232949bfc6e9d327b29d286a12d485d5)
@@ -14,4 +14,5 @@
 AC_PROG_CXX
 AC_PROG_CC
+AC_PROG_RANLIB
 AC_PROG_INSTALL
 AC_CHECK_PROG([LATEX],[latex],[latex],[:])
Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(revision be90f17d330ec04dde01f9ed6bf79fd8a8b809ce)
+++ src/Makefile.am	(revision b9907cd8232949bfc6e9d327b29d286a12d485d5)
@@ -1,13 +1,18 @@
-SUBDIRS = unittests
+SOURCE = atom.cpp bond.cpp boundary.cpp config.cpp          element.cpp ellipsoid.cpp helpers.cpp leastsquaremin.cpp linkedcell.cpp memoryusageobserver.cpp molecules.cpp moleculelist.cpp parser.cpp periodentafel.cpp                tesselation.cpp tesselationhelpers.cpp vector.cpp verbose.cpp
+HEADER = atom.hpp bond.hpp boundary.hpp config.hpp defs.hpp element.hpp ellipsoid.hpp helpers.hpp leastsquaremin.hpp linkedcell.hpp memoryusageobserver.hpp molecules.hpp                  parser.hpp periodentafel.hpp stackclass.hpp tesselation.hpp tesselationhelpers.hpp vector.hpp verbose.hpp
 
-SOURCE = atom.cpp bond.cpp boundary.cpp config.cpp element.cpp ellipsoid.cpp helpers.cpp leastsquaremin.cpp linkedcell.cpp moleculelist.cpp molecules.cpp parser.cpp periodentafel.cpp tesselation.cpp tesselationhelpers.cpp vector.cpp verbose.cpp
-HEADER = atom.hpp bond.hpp boundary.hpp config.hpp defs.hpp element.hpp ellipsoid.hpp helpers.hpp leastsquaremin.hpp linkedcell.hpp memoryallocator.hpp memoryusageobserver.cpp memoryusageobserver.hpp molecules.hpp parser.hpp periodentafel.hpp stackclass.hpp tesselation.hpp tesselationhelpers.hpp vector.hpp verbose.hpp
+INCLUDES = -I$(top_srcdir)/src/unittests
 
+noinst_LIBRARIES = libmolecuilder.a
 bin_PROGRAMS = molecuilder joiner analyzer
 molecuilderdir = ${bindir}
+libmolecuilder_a_SOURCES = ${SOURCE} ${HEADER}
 molecuilder_DATA = elements.db valence.db orbitals.db Hbonddistance.db Hbondangle.db
-molecuilder_SOURCES =  ${SOURCE} builder.cpp  ${HEADER}
-joiner_SOURCES = joiner.cpp datacreator.cpp element.cpp helpers.cpp memoryallocator.hpp memoryusageobserver.cpp memoryusageobserver.hpp periodentafel.cpp parser.cpp verbose.cpp datacreator.hpp helpers.hpp parser.hpp periodentafel.hpp 
-analyzer_SOURCES = analyzer.cpp datacreator.cpp element.cpp helpers.cpp memoryallocator.hpp memoryusageobserver.cpp memoryusageobserver.hpp periodentafel.cpp parser.cpp verbose.cpp helpers.hpp periodentafel.hpp parser.hpp datacreator.hpp 
+molecuilder_SOURCES = builder.cpp
+molecuilder_LDADD = libmolecuilder.a
+joiner_SOURCES = joiner.cpp datacreator.cpp parser.cpp datacreator.hpp helpers.hpp parser.hpp periodentafel.hpp
+joiner_LDADD = libmolecuilder.a 
+analyzer_SOURCES = analyzer.cpp datacreator.cpp parser.cpp helpers.hpp periodentafel.hpp parser.hpp datacreator.hpp 
+analyzer_LDADD = libmolecuilder.a 
 
-EXTRA_DIST = ${molecuilder_DATA}
+#EXTRA_DIST = ${molecuilder_DATA}
Index: src/unittests/Makefile.am
===================================================================
--- src/unittests/Makefile.am	(revision be90f17d330ec04dde01f9ed6bf79fd8a8b809ce)
+++ src/unittests/Makefile.am	(revision b9907cd8232949bfc6e9d327b29d286a12d485d5)
@@ -1,15 +1,21 @@
+INCLUDES = -I$(top_srcdir)/src
+
 noinst_PROGRAMS =  MemoryAllocatorUnitTest MemoryUsageObserverUnitTest VectorUnitTest
 
 TESTS = VectorUnitTest MemoryUsageObserverUnitTest MemoryAllocatorUnitTest 
 check_PROGRAMS = $(TESTS)
+
 VectorUnitTest_SOURCES = defs.hpp helpers.hpp leastsquaremin.hpp memoryallocator.hpp memoryusageobserver.hpp vectorunittest.cpp vectorunittest.hpp vector.hpp verbose.hpp 
 VectorUnitTest_CXXFLAGS = $(CPPUNIT_CFLAGS)
 VectorUnitTest_LDFLAGS = $(CPPUNIT_LIBS) -ldl
+VectorUnitTest_LDADD = ../libmolecuilder.a
 
 MemoryAllocatorUnitTest_SOURCES = defs.hpp helpers.hpp memoryallocatorunittest.cpp memoryallocatorunittest.hpp memoryallocator.hpp memoryusageobserver.hpp verbose.hpp 
 MemoryAllocatorUnitTest_CXXFLAGS = $(CPPUNIT_CFLAGS) -I..
 MemoryAllocatorUnitTest_LDFLAGS = $(CPPUNIT_LIBS) -ldl
+MemoryAllocatorUnitTest_LDADD = ../libmolecuilder.a
 
 MemoryUsageObserverUnitTest_SOURCES = defs.hpp helpers.hpp memoryusageobserverunittest.cpp memoryusageobserverunittest.hpp memoryusageobserver.hpp verbose.hpp 
 MemoryUsageObserverUnitTest_CXXFLAGS = $(CPPUNIT_CFLAGS)
 MemoryUsageObserverUnitTest_LDFLAGS = $(CPPUNIT_LIBS) -ldl
+MemoryUsageObserverUnitTest_LDADD = ../libmolecuilder.a
