diff --git a/CMakeLists.txt b/CMakeLists.txt
index a09929a..aa6cc14 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -51,7 +51,9 @@ IF (WITH_POSTGRESQL)
   SET (POSTGRESQL_PREFIX "" CACHE PATH "Path to POSTGRESQL base directory")
 ENDIF (WITH_POSTGRESQL)
 
-SET (WITH_INTERNAL_QWTPOLAR TRUE CACHE BOOL "Use internal built of QwtPolar")
+SET (WITH_INTERNAL_QWTPOLAR TRUE CACHE BOOL "Use internal build of QwtPolar")
+
+SET (WITH_INTERNAL_SPATIALINDEX TRUE CACHE BOOL "Use internal build of Spatialindex")
 
 SET (WITH_SPATIALITE TRUE CACHE BOOL "Determines whether SPATIALITE support should be built")
 
@@ -136,6 +138,11 @@ FIND_PACKAGE(Expat)    # GPS importer plugin
 FIND_PACKAGE(GSL)      # Georeferencer
 FIND_PACKAGE(GEOS)
 FIND_PACKAGE(GDAL)
+
+IF (NOT WITH_INTERNAL_SPATIALINDEX)
+  FIND_PACKAGE(Spatialindex REQUIRED)
+ENDIF(NOT WITH_INTERNAL_SPATIALINDEX)
+
 FIND_PACKAGE(Qwt REQUIRED)
 IF (NOT WITH_INTERNAL_QWTPOLAR)
   FIND_PACKAGE(QwtPolar REQUIRED)
diff --git a/COPYING b/COPYING
index 6f9932a..f5e2b54 100644
--- a/COPYING
+++ b/COPYING
@@ -2,7 +2,7 @@
 		       Version 2, June 1991
 
  Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+     51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  Everyone is permitted to copy and distribute verbatim copies
  of this license document, but changing it is not allowed.
 
@@ -318,7 +318,7 @@ the "copyright" line and a pointer to where the full notice is found.
 
     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
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
 
 Also add information on how to contact you by electronic and paper mail.
diff --git a/cmake/FindSpatialindex.cmake b/cmake/FindSpatialindex.cmake
new file mode 100644
index 0000000..8018426
--- /dev/null
+++ b/cmake/FindSpatialindex.cmake
@@ -0,0 +1,41 @@
+# Find Spatialindex
+# ~~~~~~~~
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+#
+# Once run this will define: 
+# 
+# SPATIALINDEX_FOUND       = system has Spatialindex lib
+# SPATIALINDEX_LIBRARY     = full path to the Spatialindex library
+# SPATIALINDEX_INCLUDE_DIR = where to find headers 
+#
+
+
+FIND_PATH(SPATIALINDEX_INCLUDE_DIR NAMES SpatialIndex.h PATHS
+  /usr/include
+  /usr/local/include
+  "$ENV{LIB_DIR}/include" 
+  "$ENV{INCLUDE}" 
+  PATH_SUFFIXES spatialindex
+  )
+
+FIND_LIBRARY(SPATIALINDEX_LIBRARY NAMES spatialindex PATHS 
+  /usr/lib
+  /usr/local/lib
+  "$ENV{LIB_DIR}/lib" 
+  "$ENV{LIB}/lib" 
+  )
+
+IF (SPATIALINDEX_INCLUDE_DIR AND SPATIALINDEX_LIBRARY)
+  SET(SPATIALINDEX_FOUND TRUE)
+ENDIF (SPATIALINDEX_INCLUDE_DIR AND SPATIALINDEX_LIBRARY)
+
+IF (SPATIALINDEX_FOUND)
+  IF (NOT SPATIALINDEX_FIND_QUIETLY)
+    MESSAGE(STATUS "Found Spatialindex: ${SPATIALINDEX_LIBRARY}")
+  ENDIF (NOT SPATIALINDEX_FIND_QUIETLY)
+ELSE (SPATIALINDEX_FOUND)
+  IF (SPATIALINDEX_FIND_REQUIRED)
+    MESSAGE(FATAL_ERROR "Could not find Spatialindex")
+  ENDIF (SPATIALINDEX_FIND_REQUIRED)
+ENDIF (SPATIALINDEX_FOUND)
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 9b05bd6..ab43c55 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -388,7 +388,6 @@ INCLUDE_DIRECTORIES(
   raster
   renderer
   symbology
-  spatialindex/include
   symbology-ng
   gps/qextserialport
   ${PROJ_INCLUDE_DIR}
@@ -396,6 +395,12 @@ INCLUDE_DIRECTORIES(
   ${GDAL_INCLUDE_DIR}
 )
 
+IF (NOT WITH_INTERNAL_SPATIALINDEX)
+  INCLUDE_DIRECTORIES(${SPATIALINDEX_INCLUDE_DIR})
+ELSE (NOT WITH_INTERNAL_SPATIALINDEX)
+  INCLUDE_DIRECTORIES(spatialindex/include)
+ENDIF (NOT WITH_INTERNAL_SPATIALINDEX)
+
 IF (NOT WITH_INTERNAL_SPATIALITE)
   INCLUDE_DIRECTORIES(${SQLITE3_INCLUDE_DIR})
 ENDIF (NOT WITH_INTERNAL_SPATIALITE)
@@ -418,25 +423,27 @@ ENDIF (WIN32)
 #############################################################
 # spatial indexing library
 
-# add path prefix to every specified file
-MACRO(PATH_PREFIX OUTPUT PREFIX)
-  FOREACH(F ${ARGN})
-    SET(${OUTPUT} ${${OUTPUT}} ${PREFIX}/${F})
-  ENDFOREACH(F)
-ENDMACRO(PATH_PREFIX)
-
-# tools library
-PATH_PREFIX(TOOLS_SRC tools   ExternalSort.cc ExternalSort.h TemporaryFile.cc Tools.cc)
-PATH_PREFIX(GEOM_SRC geometry LineSegment.cc Point.cc Region.cc)
-
-# spatial index library
-PATH_PREFIX(SPINDEX_SRC spatialindex SpatialIndexImpl.cc)
-PATH_PREFIX(STMAN_SRC storagemanager Buffer.cc DiskStorageManager.cc MemoryStorageManager.cc RandomEvictionsBuffer.cc)
-PATH_PREFIX(RTREE_SRC rtree BulkLoader.cc Index.cc Leaf.cc Node.cc RTree.cc Statistics.cc)
-
-SET(SPINDEX_SRC ${TOOLS_SRC} ${GEOM_SRC} ${SPINDEX_SRC} ${STMAN_SRC} ${RTREE_SRC})
-
-PATH_PREFIX(INDEX_SRC spatialindex ${SPINDEX_SRC})
+IF (WITH_INTERNAL_SPATIALINDEX)
+  # add path prefix to every specified file
+  MACRO(PATH_PREFIX OUTPUT PREFIX)
+    FOREACH(F ${ARGN})
+      SET(${OUTPUT} ${${OUTPUT}} ${PREFIX}/${F})
+    ENDFOREACH(F)
+  ENDMACRO(PATH_PREFIX)
+  
+  # tools library
+  PATH_PREFIX(TOOLS_SRC tools   ExternalSort.cc ExternalSort.h TemporaryFile.cc Tools.cc)
+  PATH_PREFIX(GEOM_SRC geometry LineSegment.cc Point.cc Region.cc)
+  
+  # spatial index library
+  PATH_PREFIX(SPINDEX_SRC spatialindex SpatialIndexImpl.cc)
+  PATH_PREFIX(STMAN_SRC storagemanager Buffer.cc DiskStorageManager.cc MemoryStorageManager.cc RandomEvictionsBuffer.cc)
+  PATH_PREFIX(RTREE_SRC rtree BulkLoader.cc Index.cc Leaf.cc Node.cc RTree.cc Statistics.cc)
+  
+  SET(SPINDEX_SRC ${TOOLS_SRC} ${GEOM_SRC} ${SPINDEX_SRC} ${STMAN_SRC} ${RTREE_SRC})
+  
+  PATH_PREFIX(INDEX_SRC spatialindex ${SPINDEX_SRC})
+ENDIF (WITH_INTERNAL_SPATIALINDEX)
 
 #############################################################
 # qgis_core library
@@ -491,6 +498,11 @@ ELSE (WITH_INTERNAL_SPATIALITE)
   TARGET_LINK_LIBRARIES(qgis_core ${SQLITE3_LIBRARY})
 ENDIF (WITH_INTERNAL_SPATIALITE)
 
+IF (NOT WITH_INTERNAL_SPATIALINDEX)
+  TARGET_LINK_LIBRARIES(qgis_core ${SPATIALINDEX_LIBRARY})
+ENDIF (NOT WITH_INTERNAL_SPATIALINDEX)
+
+
 IF (APPLE)
   SET_TARGET_PROPERTIES(qgis_core PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE )
 ENDIF (APPLE)
diff --git a/src/core/spatialindex/qgsspatialindex.cpp b/src/core/spatialindex/qgsspatialindex.cpp
index ad3a74b..dedbad9 100644
--- a/src/core/spatialindex/qgsspatialindex.cpp
+++ b/src/core/spatialindex/qgsspatialindex.cpp
@@ -79,17 +79,17 @@ QgsSpatialIndex:: ~QgsSpatialIndex()
   delete mStorageManager;
 }
 
-Tools::Geometry::Region QgsSpatialIndex::rectToRegion( QgsRectangle rect )
+Region QgsSpatialIndex::rectToRegion( QgsRectangle rect )
 {
   double pt1[2], pt2[2];
   pt1[0] = rect.xMinimum();
   pt1[1] = rect.yMinimum();
   pt2[0] = rect.xMaximum();
   pt2[1] = rect.yMaximum();
-  return Tools::Geometry::Region( pt1, pt2, 2 );
+  return Region( pt1, pt2, 2 );
 }
 
-bool QgsSpatialIndex::featureInfo( QgsFeature& f, Tools::Geometry::Region& r, QgsFeatureId &id )
+bool QgsSpatialIndex::featureInfo( QgsFeature& f, Region& r, QgsFeatureId &id )
 {
   QgsGeometry *g = f.geometry();
   if ( !g )
@@ -102,7 +102,7 @@ bool QgsSpatialIndex::featureInfo( QgsFeature& f, Tools::Geometry::Region& r, Qg
 
 bool QgsSpatialIndex::insertFeature( QgsFeature& f )
 {
-  Tools::Geometry::Region r;
+  Region r;
   QgsFeatureId id;
   if ( !featureInfo( f, r, id ) )
     return false;
@@ -132,7 +132,7 @@ bool QgsSpatialIndex::insertFeature( QgsFeature& f )
 
 bool QgsSpatialIndex::deleteFeature( QgsFeature& f )
 {
-  Tools::Geometry::Region r;
+  Region r;
   QgsFeatureId id;
   if ( !featureInfo( f, r, id ) )
     return false;
@@ -146,7 +146,7 @@ QList<QgsFeatureId> QgsSpatialIndex::intersects( QgsRectangle rect )
   QList<QgsFeatureId> list;
   QgisVisitor visitor( list );
 
-  Tools::Geometry::Region r = rectToRegion( rect );
+  Region r = rectToRegion( rect );
 
   mRTree->intersectsWithQuery( r, visitor );
 
@@ -161,7 +161,7 @@ QList<QgsFeatureId> QgsSpatialIndex::nearestNeighbor( QgsPoint point, int neighb
   double pt[2];
   pt[0] = point.x();
   pt[1] = point.y();
-  Tools::Geometry::Point p( pt, 2 );
+  Point p( pt, 2 );
 
   mRTree->nearestNeighborQuery( neighbors, p, visitor );
 
diff --git a/src/core/spatialindex/qgsspatialindex.h b/src/core/spatialindex/qgsspatialindex.h
index 8422d3d..68cf75a 100644
--- a/src/core/spatialindex/qgsspatialindex.h
+++ b/src/core/spatialindex/qgsspatialindex.h
@@ -21,6 +21,8 @@ namespace SpatialIndex
 {
   class IStorageManager;
   class ISpatialIndex;
+  class Region;
+  class Point;
 
   namespace StorageManager
   {
@@ -28,14 +30,6 @@ namespace SpatialIndex
   }
 }
 
-namespace Tools
-{
-  namespace Geometry
-  {
-    class Region;
-  }
-}
-
 class QgsFeature;
 class QgsRectangle;
 class QgsPoint;
@@ -84,9 +78,9 @@ class CORE_EXPORT QgsSpatialIndex
 
   protected:
 
-    Tools::Geometry::Region rectToRegion( QgsRectangle rect );
+    SpatialIndex::Region rectToRegion( QgsRectangle rect );
 
-    bool featureInfo( QgsFeature& f, Tools::Geometry::Region& r, QgsFeatureId &id );
+    bool featureInfo( QgsFeature& f, SpatialIndex::Region& r, QgsFeatureId &id );
 
 
   private:
