From 75808206b916d1df5d22b3fd9295c9fca01a680f Mon Sep 17 00:00:00 2001
From: Martin Gels <gels@astron.nl>
Date: Fri, 6 Mar 2009 08:03:38 +0000
Subject: [PATCH] bug 1005: Added cmake dir.

---
 .gitattributes                                |  60 ++
 cmake/modules/CMakeASM-BGPInformation.cmake   |   5 +
 .../CMakeDetermineASM-BGPCompiler.cmake       |   6 +
 cmake/modules/CMakeLists.txt                  |  49 ++
 cmake/modules/CMakeSettings.cmake             | 154 +++++
 cmake/modules/CMakeTestASM-BGPCompiler.cmake  |   9 +
 cmake/modules/FindBacktrace.cmake             | 173 +++++
 cmake/modules/FindBlitz.cmake                 |  95 +++
 cmake/modules/FindBoost.cmake                 | 635 ++++++++++++++++++
 cmake/modules/FindCASA.cmake                  | 557 +++++++++++++++
 cmake/modules/FindCASACORE.cmake              | 291 ++++++++
 cmake/modules/FindCFITSIO.cmake               | 135 ++++
 cmake/modules/FindCPGPLOT.cmake               |  79 +++
 cmake/modules/FindDAL.cmake                   |  90 +++
 cmake/modules/FindFFTW3.cmake                 |  86 +++
 cmake/modules/FindG2C.cmake                   | 117 ++++
 cmake/modules/FindGIF.cmake                   |  88 +++
 cmake/modules/FindGLIB.cmake                  | 123 ++++
 cmake/modules/FindGSL.cmake                   | 109 +++
 cmake/modules/FindGTK.cmake                   | 141 ++++
 cmake/modules/FindGlish.cmake                 | 176 +++++
 cmake/modules/FindGlobus.cmake                |  79 +++
 cmake/modules/FindHDF5.cmake                  | 153 +++++
 cmake/modules/FindLAPACK.cmake                | 106 +++
 cmake/modules/FindLibxml2.cmake               |  88 +++
 cmake/modules/FindLog4CPlus.cmake             |  91 +++
 cmake/modules/FindMPI.cmake                   | 308 +++++++++
 cmake/modules/FindMPICC.cmake                 | 316 +++++++++
 cmake/modules/FindMatlab.cmake                |  89 +++
 cmake/modules/FindMySQL.cmake                 | 102 +++
 cmake/modules/FindNumarray.cmake              | 103 +++
 cmake/modules/FindNumeric.cmake               | 104 +++
 cmake/modules/FindPGPLOT.cmake                | 128 ++++
 cmake/modules/FindPLplot.cmake                | 109 +++
 cmake/modules/FindPNG.cmake                   |  88 +++
 cmake/modules/FindPOPT.cmake                  |  77 +++
 cmake/modules/FindPostgreSQL.cmake            | 163 +++++
 cmake/modules/FindPyGTK.cmake                 | 114 ++++
 cmake/modules/FindPython.cmake                | 171 +++++
 cmake/modules/FindROOT.cmake                  | 140 ++++
 cmake/modules/FindRuby.cmake                  |  97 +++
 cmake/modules/FindSHMEM.cmake                 |  92 +++
 cmake/modules/FindSWIG.cmake                  |  96 +++
 cmake/modules/FindStarTools.cmake             | 103 +++
 cmake/modules/FindTCL.cmake                   |  88 +++
 cmake/modules/FindTK.cmake                    |  88 +++
 cmake/modules/FindWCS.cmake                   |  88 +++
 cmake/modules/FindXaw.cmake                   |  88 +++
 cmake/modules/FindXm.cmake                    |  90 +++
 cmake/modules/InstallROOT.cmake               | 201 ++++++
 cmake/modules/LOFARTest.cmake                 |  28 +
 cmake/modules/LofarGeneral.cmake              | 107 +++
 cmake/modules/MakePackageVersion.cmake        | 156 +++++
 cmake/modules/Package__Version.cc.in          |  35 +
 cmake/modules/Package__Version.h.in           |  41 ++
 cmake/modules/README.txt                      | 142 ++++
 cmake/modules/SettingsPLplot.cmake            |  94 +++
 cmake/modules/UpdateCASACORE.cmake            |  96 +++
 cmake/modules/changes.txt                     |  75 +++
 cmake/modules/gelsm.FindBoost.cmake           | 229 +++++++
 cmake/modules/gelsm.FindCASACORE.cmake        | 458 +++++++++++++
 cmake/modules/gelsm.lofar_config.h.in         |   1 +
 cmake/modules/lofar_config.h.in               |   1 +
 cmake/modules/makefile                        |   7 +
 cmake/modules/template_FindXX.cmake           |  89 +++
 cmake/variants/variants                       |  43 ++
 cmake/variants/variants.bgfen0                |  55 ++
 cmake/variants/variants.liifen                |  12 +
 68 files changed, 8407 insertions(+)
 create mode 100644 cmake/modules/CMakeASM-BGPInformation.cmake
 create mode 100644 cmake/modules/CMakeDetermineASM-BGPCompiler.cmake
 create mode 100644 cmake/modules/CMakeLists.txt
 create mode 100644 cmake/modules/CMakeSettings.cmake
 create mode 100644 cmake/modules/CMakeTestASM-BGPCompiler.cmake
 create mode 100644 cmake/modules/FindBacktrace.cmake
 create mode 100644 cmake/modules/FindBlitz.cmake
 create mode 100644 cmake/modules/FindBoost.cmake
 create mode 100644 cmake/modules/FindCASA.cmake
 create mode 100644 cmake/modules/FindCASACORE.cmake
 create mode 100644 cmake/modules/FindCFITSIO.cmake
 create mode 100644 cmake/modules/FindCPGPLOT.cmake
 create mode 100644 cmake/modules/FindDAL.cmake
 create mode 100644 cmake/modules/FindFFTW3.cmake
 create mode 100644 cmake/modules/FindG2C.cmake
 create mode 100644 cmake/modules/FindGIF.cmake
 create mode 100644 cmake/modules/FindGLIB.cmake
 create mode 100644 cmake/modules/FindGSL.cmake
 create mode 100644 cmake/modules/FindGTK.cmake
 create mode 100644 cmake/modules/FindGlish.cmake
 create mode 100644 cmake/modules/FindGlobus.cmake
 create mode 100644 cmake/modules/FindHDF5.cmake
 create mode 100644 cmake/modules/FindLAPACK.cmake
 create mode 100644 cmake/modules/FindLibxml2.cmake
 create mode 100644 cmake/modules/FindLog4CPlus.cmake
 create mode 100644 cmake/modules/FindMPI.cmake
 create mode 100644 cmake/modules/FindMPICC.cmake
 create mode 100644 cmake/modules/FindMatlab.cmake
 create mode 100644 cmake/modules/FindMySQL.cmake
 create mode 100644 cmake/modules/FindNumarray.cmake
 create mode 100644 cmake/modules/FindNumeric.cmake
 create mode 100644 cmake/modules/FindPGPLOT.cmake
 create mode 100644 cmake/modules/FindPLplot.cmake
 create mode 100644 cmake/modules/FindPNG.cmake
 create mode 100644 cmake/modules/FindPOPT.cmake
 create mode 100644 cmake/modules/FindPostgreSQL.cmake
 create mode 100644 cmake/modules/FindPyGTK.cmake
 create mode 100644 cmake/modules/FindPython.cmake
 create mode 100644 cmake/modules/FindROOT.cmake
 create mode 100644 cmake/modules/FindRuby.cmake
 create mode 100644 cmake/modules/FindSHMEM.cmake
 create mode 100644 cmake/modules/FindSWIG.cmake
 create mode 100644 cmake/modules/FindStarTools.cmake
 create mode 100644 cmake/modules/FindTCL.cmake
 create mode 100644 cmake/modules/FindTK.cmake
 create mode 100644 cmake/modules/FindWCS.cmake
 create mode 100644 cmake/modules/FindXaw.cmake
 create mode 100644 cmake/modules/FindXm.cmake
 create mode 100644 cmake/modules/InstallROOT.cmake
 create mode 100644 cmake/modules/LOFARTest.cmake
 create mode 100644 cmake/modules/LofarGeneral.cmake
 create mode 100644 cmake/modules/MakePackageVersion.cmake
 create mode 100644 cmake/modules/Package__Version.cc.in
 create mode 100644 cmake/modules/Package__Version.h.in
 create mode 100644 cmake/modules/README.txt
 create mode 100644 cmake/modules/SettingsPLplot.cmake
 create mode 100644 cmake/modules/UpdateCASACORE.cmake
 create mode 100644 cmake/modules/changes.txt
 create mode 100644 cmake/modules/gelsm.FindBoost.cmake
 create mode 100644 cmake/modules/gelsm.FindCASACORE.cmake
 create mode 100644 cmake/modules/gelsm.lofar_config.h.in
 create mode 100644 cmake/modules/lofar_config.h.in
 create mode 100644 cmake/modules/makefile
 create mode 100644 cmake/modules/template_FindXX.cmake
 create mode 100644 cmake/variants/variants
 create mode 100644 cmake/variants/variants.bgfen0
 create mode 100644 cmake/variants/variants.liifen

diff --git a/.gitattributes b/.gitattributes
index ccd72e494a4..9cb94ef2b4c 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1258,6 +1258,66 @@ autoconf_share/variants.bgfen -text
 autoconf_share/variants.bgfen0 -text
 autoconf_share/variants.frontend-4 -text
 autoconf_share/variants.lioffen -text
+cmake/modules/CMakeASM-BGPInformation.cmake -text
+cmake/modules/CMakeDetermineASM-BGPCompiler.cmake -text
+cmake/modules/CMakeSettings.cmake -text
+cmake/modules/CMakeTestASM-BGPCompiler.cmake -text
+cmake/modules/FindBacktrace.cmake -text
+cmake/modules/FindBlitz.cmake -text
+cmake/modules/FindBoost.cmake -text
+cmake/modules/FindCASA.cmake -text
+cmake/modules/FindCASACORE.cmake -text
+cmake/modules/FindCFITSIO.cmake -text
+cmake/modules/FindCPGPLOT.cmake -text
+cmake/modules/FindDAL.cmake -text
+cmake/modules/FindFFTW3.cmake -text
+cmake/modules/FindG2C.cmake -text
+cmake/modules/FindGIF.cmake -text
+cmake/modules/FindGLIB.cmake -text
+cmake/modules/FindGSL.cmake -text
+cmake/modules/FindGTK.cmake -text
+cmake/modules/FindGlish.cmake -text
+cmake/modules/FindGlobus.cmake -text
+cmake/modules/FindHDF5.cmake -text
+cmake/modules/FindLAPACK.cmake -text
+cmake/modules/FindLibxml2.cmake -text
+cmake/modules/FindLog4CPlus.cmake -text
+cmake/modules/FindMPI.cmake -text
+cmake/modules/FindMPICC.cmake -text
+cmake/modules/FindMatlab.cmake -text
+cmake/modules/FindMySQL.cmake -text
+cmake/modules/FindNumarray.cmake -text
+cmake/modules/FindNumeric.cmake -text
+cmake/modules/FindPGPLOT.cmake -text
+cmake/modules/FindPLplot.cmake -text
+cmake/modules/FindPNG.cmake -text
+cmake/modules/FindPOPT.cmake -text
+cmake/modules/FindPostgreSQL.cmake -text
+cmake/modules/FindPyGTK.cmake -text
+cmake/modules/FindPython.cmake -text
+cmake/modules/FindROOT.cmake -text
+cmake/modules/FindRuby.cmake -text
+cmake/modules/FindSHMEM.cmake -text
+cmake/modules/FindSWIG.cmake -text
+cmake/modules/FindStarTools.cmake -text
+cmake/modules/FindTCL.cmake -text
+cmake/modules/FindTK.cmake -text
+cmake/modules/FindWCS.cmake -text
+cmake/modules/FindXaw.cmake -text
+cmake/modules/FindXm.cmake -text
+cmake/modules/InstallROOT.cmake -text
+cmake/modules/LOFARTest.cmake -text
+cmake/modules/LofarGeneral.cmake -text
+cmake/modules/MakePackageVersion.cmake -text
+cmake/modules/SettingsPLplot.cmake -text
+cmake/modules/UpdateCASACORE.cmake -text
+cmake/modules/gelsm.FindBoost.cmake -text
+cmake/modules/gelsm.FindCASACORE.cmake -text
+cmake/modules/makefile -text
+cmake/modules/template_FindXX.cmake -text
+cmake/variants/variants -text
+cmake/variants/variants.bgfen0 -text
+cmake/variants/variants.liifen -text
 doc/UML/CPA-Packages-Model.mdl -text
 doc/papers/2008/IEEE-SIG/LBA_calibrated.png -text
 doc/papers/2008/IEEE-SIG/LBA_observed.png -text
diff --git a/cmake/modules/CMakeASM-BGPInformation.cmake b/cmake/modules/CMakeASM-BGPInformation.cmake
new file mode 100644
index 00000000000..1c507d9f785
--- /dev/null
+++ b/cmake/modules/CMakeASM-BGPInformation.cmake
@@ -0,0 +1,5 @@
+SET(ASM_DIALECT "-BGP")
+SET(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS s;S;asm)
+SET(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> ${CCASFLAGS} -c  -o <OBJECT> <SOURCE>")
+INCLUDE(CMakeASMInformation)
+SET(ASM_DIALECT)
diff --git a/cmake/modules/CMakeDetermineASM-BGPCompiler.cmake b/cmake/modules/CMakeDetermineASM-BGPCompiler.cmake
new file mode 100644
index 00000000000..56e33d1d82a
--- /dev/null
+++ b/cmake/modules/CMakeDetermineASM-BGPCompiler.cmake
@@ -0,0 +1,6 @@
+# determine the compiler to use for ASM using BGP syntax
+
+SET(ASM_DIALECT "-BGP")
+SET(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ${CCAS})
+INCLUDE(CMakeDetermineASMCompiler)
+SET(ASM_DIALECT)
diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
new file mode 100644
index 00000000000..dddcc9ae9ac
--- /dev/null
+++ b/cmake/modules/CMakeLists.txt
@@ -0,0 +1,49 @@
+##------------------------------------------------------------------------------
+## $Id::                                                                       $
+##------------------------------------------------------------------------------
+
+## Project name
+project (CMake)
+
+## Required CMake version
+cmake_minimum_required (VERSION 2.4)
+
+include (./CMakeSettings.cmake)
+
+## ==============================================================================
+##
+##  Test the CMake scripts to find external packages and libraries
+##
+## ==============================================================================
+
+## Assemble the list of scripts to test
+
+file (GLOB cmake_scripts Find*.cmake)
+
+## Test file for the various CMake find scripts.
+
+message (STATUS "Testing CMake find scripts ... ")
+
+message (${CMake_SOURCE_DIR})
+
+foreach (script ${cmake_scripts})
+  string (REGEX REPLACE "${CMake_SOURCE_DIR}/" "" name ${script})
+  message ("------------------------------------------------------------")
+  message (STATUS "Testing ${name} ...")
+  include (${script})
+endforeach (script)
+
+message ("------------------------------------------------------------")
+message (STATUS "Testing completed")
+message ("------------------------------------------------------------")
+
+## ==============================================================================
+##
+##  Test macros
+##
+## ==============================================================================
+
+include (MakePackageVersion)
+
+make_package_version (./../../src/CR-Tools/implement/Data TRUE TRUE)
+make_package_version (./../../src/CR-Tools/implement/IO FALSE FALSE)
diff --git a/cmake/modules/CMakeSettings.cmake b/cmake/modules/CMakeSettings.cmake
new file mode 100644
index 00000000000..e1bbf78dd80
--- /dev/null
+++ b/cmake/modules/CMakeSettings.cmake
@@ -0,0 +1,154 @@
+
+## -----------------------------------------------------------------------------
+## $Id:: CMakeLists.txt 1475 2008-04-23 11:49:15Z baehren                      $
+## -----------------------------------------------------------------------------
+
+## Variables used through the configuration environment:
+##
+##  LOFAR_ROOT              -- Root of the LOFAR directory tree.
+##  LOFAR_CMAKE_CONFIG      -- 
+##  LOFAR_LIB_LOCATIONS     -- 
+##  LOFAR_INCLUDE_LOCATIONS -- 
+##  LOFAR_INSTALL_PREFIX    -- Prefix marking the location at which the finished
+##                           software components will be installed
+##  LOFAR_VARIANTS_FILE     -- Variants file containing host-specific overrides
+##                           to the common configuration settings/presets.
+##
+
+## --------------------------------------------------------------------------
+## Several "Auto-tools variables" needed for backward compatibility
+## --------------------------------------------------------------------------
+set(srcdir "${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL "srcdir")
+message (STATUS "srcdir                 = ${srcdir}")
+
+if (NOT LOFAR_CMAKE_CONFIG)
+
+  ## First pass: if LOFAR_ROOT is still undefined we need to define it, since this
+  ##             is the common starting point for all directory references below
+
+  if (NOT LOFAR_ROOT)
+    message (STATUS "[LOFAR CMake] LOFAR_ROOT undefined; trying to locate it...")
+    ## try to find the root directory based on the location of the release
+    ## directory
+    find_path (LOFAR_INSTALL_PREFIX release/release_area.txt
+      $ENV{LOFARSOFT}
+      ..
+      ../..
+      NO_DEFAULT_PATH
+      )
+    ## convert the relative path to an absolute one
+    get_filename_component (LOFAR_ROOT ${LOFAR_INSTALL_PREFIX} ABSOLUTE)
+  endif (NOT LOFAR_ROOT)
+
+  ## Second pass: check once more if LOFAR_ROOT is defined
+  
+  if (LOFAR_ROOT)
+    ## This addition to the module path needs to go into the cache,
+    ## because otherwise it will be gone at the next time CMake is run
+    set (CMAKE_MODULE_PATH ${LOFAR_ROOT}/cmake/modules
+      CACHE
+      PATH 
+      "LOFAR cmake modules"
+      FORCE)
+    ## installation location
+    set (LOFAR_INSTALL_PREFIX ${LOFAR_ROOT}/release
+      CACHE
+      PATH
+      "LOFAR default install area"
+      FORCE
+      )
+    set (CMAKE_INSTALL_PREFIX ${LOFAR_ROOT}/release
+      CACHE
+      PATH
+      "CMake installation area"
+      FORCE
+      )
+    ## header files
+    include_directories (${LOFAR_ROOT}/release/include
+      CACHE
+      PATH
+      "LOFAR include area"
+      FORCE
+      )
+      
+    ## --------------------------------------------------------------------------
+    ## Several "Auto-tools variables" needed for backward compatibility
+    ## --------------------------------------------------------------------------
+    set(lofar_top_srcdir "${LOFAR_ROOT}" CACHE INTERNAL "lofar_top_srcdir")
+    set(lofar_sharedir "${lofar_top_srcdir}/autoconf_share" CACHE INTERNAL "lofar_sharedir")
+    set(prefix "${CMAKE_INSTALL_PREFIX}" CACHE INTERNAL "prefix")
+    
+    ## Feedback 
+    message (STATUS "[LOFAR CMake configuration]")
+    message (STATUS "LOFAR_ROOT             = ${LOFAR_ROOT}")
+    message (STATUS "LOFAR_INSTALL_PREFIX   = ${LOFAR_INSTALL_PREFIX}")
+    message (STATUS "CMAKE_INSTALL_PREFIX   = ${CMAKE_INSTALL_PREFIX}")
+    message (STATUS "lofar_top_srcdir       = ${lofar_top_srcdir}")
+    message (STATUS "lofar_sharedir         = ${lofar_sharedir}")
+    message (STATUS "prefix                 = ${prefix}")
+     
+  else (LOFAR_ROOT)
+    message (SEND_ERROR "LOFAR_ROOT is undefined!")
+  endif (LOFAR_ROOT)
+  
+  ## ---------------------------------------------------------------------------
+  ## locations in which to look for applications/binaries
+  
+  set (bin_locations
+    ${LOFAR_INSTALL_PREFIX}/bin
+    /usr/bin
+    /usr/local/bin
+    /sw/bin
+    CACHE
+    PATH
+    "Extra directories to look for executable files"
+    FORCE
+    )
+  
+  ## ----------------------------------------------------------------------------
+  ## locations in which to look for header files
+  
+  set (include_locations
+    ${LOFAR_INSTALL_PREFIX}/include
+    /opt/include
+    /opt/local/include
+    /sw/include
+    /usr/include
+    /usr/local/include
+    /usr/X11R6/include
+    /opt/aips++/local/include
+    /opt/casa/local/include    
+    CACHE
+    PATH
+    "Directories to look for include files"
+    FORCE
+    )
+  
+  ## ----------------------------------------------------------------------------
+  ## locations in which to look for libraries
+  
+  set (lib_locations
+    ${LOFAR_INSTALL_PREFIX}/lib
+    /opt/lib
+    /opt/local/lib
+    /sw/lib
+    /usr/lib
+    /usr/lib64
+    /usr/local/lib
+    /usr/local/lib64
+    /usr/X11R6/lib
+    /opt/aips++/local/lib
+    /Developer/SDKs/MacOSX10.4u.sdk/usr/lib
+    CACHE
+    PATH
+    "Directories to look for libraries"
+    FORCE
+    )
+ 
+  ## ----------------------------------------------------------------------------
+  ## Configuration flag
+  
+  set (LOFAR_CMAKE_CONFIG TRUE CACHE BOOL "LOFAR CMake configuration flag" FORCE)
+  mark_as_advanced(LOFAR_CMAKE_CONFIG)
+
+endif (NOT LOFAR_CMAKE_CONFIG)
diff --git a/cmake/modules/CMakeTestASM-BGPCompiler.cmake b/cmake/modules/CMakeTestASM-BGPCompiler.cmake
new file mode 100644
index 00000000000..fb53a8390ad
--- /dev/null
+++ b/cmake/modules/CMakeTestASM-BGPCompiler.cmake
@@ -0,0 +1,9 @@
+
+# This file is used by EnableLanguage in cmGlobalGenerator to
+# determine that that selected ASM-ATT compiler can actually compile
+# and link the most basic of programs.   If not, a fatal error
+# is set and cmake stops processing commands and will not generate
+# any makefiles or projects.
+SET(ASM_DIALECT "-BGP")
+INCLUDE(CMakeTestASMCompiler)
+SET(ASM_DIALECT)
diff --git a/cmake/modules/FindBacktrace.cmake b/cmake/modules/FindBacktrace.cmake
new file mode 100644
index 00000000000..221d300b648
--- /dev/null
+++ b/cmake/modules/FindBacktrace.cmake
@@ -0,0 +1,173 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: IO.h 393 2007-06-13 10:49:08Z gels                                  $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Martin Gels (gels@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# Check for the presence of BACKTRACE (BACKTRACE).
+#
+# The following variables are set when BACKTRACE is found:
+#  Backtrace_FOUND      = Set to true, if all components of BACKTRACE have been found.
+#  BACKTRACE_INCLUDES   = Include path for the header files of BACKTRACE
+#  BACKTRACE_LIBRARIES  = Link these to use BACKTRACE
+#  BACKTRACE_LFGLAS     = Linker flags (optional)
+# The following variables provide more detais information on the components:
+#  HAVE_DEMANGLE_H
+#  HAVE_EXECINFO_H
+#  HAVE_BFD_H
+
+## -----------------------------------------------------------------------------
+## Search locations & macros
+
+include (CMakeSettings)
+include (CheckFunctionExists)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+set (BACKTRACE_INCLUDES "")
+set (BACKTRACE_LIBRARIES "")
+
+find_path (HAVE_DEMANGLE_H demangle.h
+  PATHS ${include_locations}
+  NO_DEFAULT_PATH
+  )
+
+find_path (HAVE_EXECINFO_H execinfo.h
+  PATHS ${include_locations}
+  NO_DEFAULT_PATH
+  )
+
+find_path (HAVE_BFD_H bfd.h
+  PATHS ${include_locations}
+  NO_DEFAULT_PATH
+  )
+
+## logic for combination of header files and libraries
+
+if (HAVE_DEMANGLE_H)
+  list (APPEND BACKTRACE_INCLUDES ${HAVE_DEMANGLE_H})
+endif (HAVE_DEMANGLE_H)
+
+if (HAVE_EXECINFO_H)
+  ## append location of header file
+  list (APPEND BACKTRACE_INCLUDES ${HAVE_EXECINFO_H})
+
+  ## search for related libraries
+  find_library (HAVE_LIBIBERTY iberty
+    PATHS ${lib_locations}
+    NO_DEFAULT_PATH
+  )
+  if (HAVE_LIBIBERTY)
+    list (APPEND CMAKE_REQUIRED_LIBRARIES ${HAVE_LIBIBERTY})
+  endif (HAVE_LIBIBERTY)
+  
+  find_library (HAVE_LIBZ z
+    PATHS ${lib_locations}
+    NO_DEFAULT_PATH
+  )
+  if (HAVE_LIBZ)
+    list (APPEND CMAKE_REQUIRED_LIBRARIES ${HAVE_LIBZ})
+  endif (HAVE_LIBZ)
+
+  find_library (HAVE_LIBBFD bfd
+    PATHS ${lib_locations}
+    NO_DEFAULT_PATH
+  )
+  if (HAVE_LIBBFD)
+    list (APPEND CMAKE_REQUIRED_LIBRARIES ${HAVE_LIBBFD})
+  endif (HAVE_LIBBFD)
+
+  if (HAVE_BFD_H)
+    ## append location of header file
+    list (APPEND BACKTRACE_INCLUDES ${HAVE_BFD_H})
+    ## check if functions exist in library
+    if (HAVE_LIBBFD)
+      list (APPEND BACKTRACE_LIBRARIES ${HAVE_LIBBFD})
+      check_function_exists (bfd_init HAVE_BFD_INIT)
+      if (NOT HAVE_BFD_INIT)
+	message (STATUS "Warning: bfd_init not found, please install the GNU binutils!")
+      else(NOT HAVE_BFD_INIT)
+        add_definitions (-DHAVE_BFD)
+      endif(NOT HAVE_BFD_INIT)
+      
+      check_function_exists (cplus_demangle HAVE_CPLUS_DEMANGLE)
+      if (HAVE_CPLUS_DEMANGLE)
+	add_definitions (-DHAVE_CPLUS_DEMANGLE)
+      else (HAVE_CPLUS_DEMANGLE)
+	message (STATUS "Warning: cplus_demangle not found, please install the GNU binutils!")
+      endif(HAVE_CPLUS_DEMANGLE)
+    endif (HAVE_LIBBFD)
+  endif (HAVE_BFD_H)
+
+  ## check if functions exist in header
+  check_function_exists (backtrace HAVE_BACKTRACEFUNC)
+  if (NOT HAVE_BACKTRACEFUNC)
+    message (STATUS "Warning: backtrace not found in glibc!") 
+  endif (NOT HAVE_BACKTRACEFUNC)
+  
+  ## check if functions exist in library
+  if (HAVE_LIBIBERTY)
+    list (APPEND BACKTRACE_LIBRARIES ${HAVE_LIBIBERTY})
+    check_function_exists (xexit HAVE_XEXIT)
+  endif (HAVE_LIBIBERTY)
+  if (HAVE_LIBZ)
+    list (APPEND BACKTRACE_LIBRARIES ${HAVE_LIBZ})
+    check_function_exists (inflate HAVE_INFLATE)
+  endif (HAVE_LIBZ)
+else (HAVE_EXECINFO_H)
+  message (SEND_ERROR "execinfo.h not found, please install glibc-devel!")
+endif (HAVE_EXECINFO_H)
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+if (BACKTRACE_INCLUDES AND BACKTRACE_LIBRARIES)
+  set (Backtrace_FOUND TRUE)
+else (BACKTRACE_INCLUDES AND BACKTRACE_LIBRARIES)
+  set (Backtrace_FOUND FALSE)
+  if (NOT BACKTRACE_FIND_QUIETLY)
+    if (NOT BACKTRACE_INCLUDES)
+      message (STATUS "Unable to find BACKTRACE header files!")
+    endif (NOT BACKTRACE_INCLUDES)
+    if (NOT BACKTRACE_LIBRARIES)
+      message (STATUS "Unable to find BACKTRACE library files!")
+    endif (NOT BACKTRACE_LIBRARIES)
+  endif (NOT BACKTRACE_FIND_QUIETLY)
+endif (BACKTRACE_INCLUDES AND BACKTRACE_LIBRARIES)
+
+if (Backtrace_FOUND)
+  if (NOT BACKTRACE_FIND_QUIETLY)
+    message (STATUS "Found components for BACKTRACE")
+    message (STATUS "BACKTRACE_INCLUDES  = ${BACKTRACE_INCLUDES}")
+    message (STATUS "BACKTRACE_LIBRARIES = ${BACKTRACE_LIBRARIES}")
+  endif (NOT BACKTRACE_FIND_QUIETLY)
+else (Backtrace_FOUND)
+  if (BACKTRACE_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find BACKTRACE!")
+  endif (BACKTRACE_FIND_REQUIRED)
+endif (Backtrace_FOUND)
+
+## -----------------------------------------------------------------------------
+## Mark advanced variables
+
+mark_as_advanced (
+  BACKTRACE_INCLUDES
+  BACKTRACE_LIBRARIES
+  )
diff --git a/cmake/modules/FindBlitz.cmake b/cmake/modules/FindBlitz.cmake
new file mode 100644
index 00000000000..9d4799a0e2b
--- /dev/null
+++ b/cmake/modules/FindBlitz.cmake
@@ -0,0 +1,95 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: FindBlitz.cmake 1643 2008-06-14 10:19:20Z baehren                   $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of the Blitz++ library
+#
+# The following variables are set when Blitz++ is found:
+#  HAVE_BLITZ      = True when both Blitz++ header and include files are 
+#                    found; if any of them is missing, HAVE_BLITZ=false
+#  BLITZ_INCLUDES  = the path to where the Blitz++ include files are.
+#  BLITZ_LIBRARIES = Link these to use Blitz++
+
+#SET (BLITZ_VERSION "1_33_1")
+
+## -----------------------------------------------------------------------------
+## Search locations
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the header files; the include statement in the code should be e.g.
+##   #include <blitz/array.h>
+## in order to ease differentiation from where the various header files are
+## included.
+
+FIND_PATH (BLITZ_INCLUDES blitz.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES blitz
+  )
+
+IF (BLITZ_INCLUDES)
+  STRING (REGEX REPLACE include/blitz include BLITZ_INCLUDES ${BLITZ_INCLUDES})
+ENDIF (BLITZ_INCLUDES)
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+FIND_LIBRARY (BLITZ_LIBRARIES blitz
+  PATHS ${lib_locations}
+  )
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+IF (BLITZ_INCLUDES AND BLITZ_LIBRARIES)
+  SET (HAVE_BLITZ TRUE)
+ELSE (BLITZ_INCLUDES AND BLITZ_LIBRARIES)
+  SET (HAVE_BLITZ FALSE)
+  IF (NOT BLITZ_FIND_QUIETLY)
+    IF (NOT BLITZ_INCLUDES)
+      MESSAGE (STATUS "Unable to find Blitz header files!")
+    ENDIF (NOT BLITZ_INCLUDES)
+    IF (NOT BLITZ_LIBRARIES)
+      MESSAGE (STATUS "Unable to find Blitz library files!")
+    ENDIF (NOT BLITZ_LIBRARIES)
+  ENDIF (NOT BLITZ_FIND_QUIETLY)
+ENDIF (BLITZ_INCLUDES AND BLITZ_LIBRARIES)
+
+IF (HAVE_BLITZ)
+  IF (NOT BLITZ_FIND_QUIETLY)
+    MESSAGE (STATUS "Found components for Blitz")
+    MESSAGE (STATUS "BLITZ_INCLUDES  = ${BLITZ_INCLUDES}")
+    MESSAGE (STATUS "BLITZ_LIBRARIES = ${BLITZ_LIBRARIES}")
+  ENDIF (NOT BLITZ_FIND_QUIETLY)
+ELSE (HAVE_BLITZ)
+  IF (BLITZ_FIND_REQUIRED)
+    MESSAGE (FATAL_ERROR "Could not find Blitz!")
+  ENDIF (BLITZ_FIND_REQUIRED)
+ENDIF (HAVE_BLITZ)
+
+## ------------------------------------------------------------------------------
+## Mark as advanced ...
+
+mark_as_advanced (
+  BLITZ_INCLUDES
+  BLITZ_LIBRARIES
+  )
diff --git a/cmake/modules/FindBoost.cmake b/cmake/modules/FindBoost.cmake
new file mode 100644
index 00000000000..448707cddeb
--- /dev/null
+++ b/cmake/modules/FindBoost.cmake
@@ -0,0 +1,635 @@
+# - Try to find Boost include dirs and libraries
+# Usage of this module as follows:
+#
+#     SET(Boost_USE_STATIC_LIBS ON)
+#     SET(Boost_USE_MULTITHREAD OFF)
+#     FIND_PACKAGE( Boost 1.34.1 COMPONENTS date_time filesystem iostreams ... )
+#
+# The Boost_ADDITIONAL_VERSIONS variable can be used to specify a list of
+# boost version numbers that should be taken into account when searching
+# for the libraries. Unfortunately boost puts the version number into the
+# actual filename for the libraries, so this might be needed in the future
+# when new Boost versions are released.
+#
+# Currently this module searches for the following version numbers:
+# 1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1, 1.35, 1.35.0, 1.35.1, 1.36, 
+# 1.36.0, 1.36.1
+#
+# The components list needs to be the actual names of boost libraries, that is
+# the part of the actual library files that differ on different libraries. So
+# its "date_time" for "libboost_date_time...". Anything else will result in
+# errors
+#
+# You can provide a minimum version number that should be used. If you provide this 
+# version number and specify the REQUIRED attribute, this module will fail if it
+# can't find the specified or a later version. If you specify a version number this is
+# automatically put into the considered list of version numbers and thus doesn't need
+# to be specified in the Boost_ADDITIONAL_VERSIONS variable
+#
+# Variables used by this module, they can change the default behaviour and need to be set
+# before calling find_package:
+#  Boost_USE_MULTITHREAD         Can be set to OFF to use the non-multithreaded
+#                                boost libraries. Defaults to ON.
+#  Boost_USE_STATIC_LIBS         Can be set to ON to force the use of the static
+#                                boost libraries. Defaults to OFF.
+#  Boost_ADDITIONAL_VERSIONS     A list of version numbers to use for searching
+#                                the boost include directory. The default list
+#                                of version numbers is:
+#                                1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1, 
+#                                1.35, 1.35.0, 1.35.1, 1.36, 1.36.0, 1.36.1
+#                                If you want to look for an older or newer
+#                                version set this variable to a list of
+#                                strings, where each string contains a number, i.e.
+#                                SET(Boost_ADDITIONAL_VERSIONS "0.99.0" "1.35.0")
+#  BOOST_ROOT or BOOSTROOT       Preferred installation prefix for searching for Boost,
+#                                set this if the module has problems finding the proper Boost installation
+#  BOOST_INCLUDEDIR              Set this to the include directory of Boost, if the
+#                                module has problems finding the proper Boost installation
+#  BOOST_LIBRARYDIR              Set this to the lib directory of Boost, if the
+#                                module has problems finding the proper Boost installation
+#
+#  The last three variables are available also as environment variables
+#
+#
+# Variables defined by this module:
+#
+#  Boost_FOUND                          System has Boost, this means the include dir was found,
+#                                       as well as all the libraries specified in the COMPONENTS list
+#  Boost_INCLUDE_DIRS                   Boost include directories, not cached
+#  Boost_INCLUDE_DIR                    This is almost the same as above, but this one is cached and may be
+#                                       modified by advanced users
+#  Boost_LIBRARIES                      Link these to use the Boost libraries that you specified, not cached
+#  Boost_LIBRARY_DIRS                   The path to where the Boost library files are.
+#  Boost_VERSION                        The version number of the boost libraries that have been found,
+#                                       same as in version.hpp from Boost
+#  Boost_LIB_VERSION                    The version number in filename form as its appended to the library filenames
+#  Boost_MAJOR_VERSION                  major version number of boost
+#  Boost_MINOR_VERSION                  minor version number of boost
+#  Boost_SUBMINOR_VERSION               subminor version number of boost
+#  Boost_LIB_DIAGNOSTIC_DEFINITIONS     Only set on windows. Can be used with add_definitions 
+#                                       to print diagnostic information about the automatic 
+#                                       linking done on windows.
+
+# For each component you list the following variables are set.
+# ATTENTION: The component names need to be in lower case, just as the boost
+# library names however the cmake variables use upper case for the component
+# part. So you'd get Boost_SERIALIZATION_FOUND for example.
+#
+#  Boost_${COMPONENT}_FOUND             True IF the Boost library "component" was found.
+#  Boost_${COMPONENT}_LIBRARY           The absolute path of the Boost library "component".
+#  Boost_${COMPONENT}_LIBRARY_DEBUG     The absolute path of the debug version of the
+#                                       Boost library "component".
+#  Boost_${COMPONENT}_LIBRARY_RELEASE   The absolute path of the release version of the
+#                                       Boost library "component"
+#
+#  Copyright (c) 2006-2008 Andreas Schneider <mail@cynapses.org>
+#  Copyright (c) 2007      Wengo
+#  Copyright (c) 2007      Mike Jackson
+#  Copyright (c) 2008      Andreas Pakulat <apaku@gmx.de>
+#
+#  Redistribution AND use is allowed according to the terms of the New
+#  BSD license.
+#  For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+#
+OPTION(Boost_USE_MULTITHREADED 
+  "Use the multithreaded versions of the Boost libraries" ON)
+
+if (Boost_FIND_VERSION_EXACT)
+  if (Boost_FIND_VERSION_PATCH)
+    set( _boost_TEST_VERSIONS 
+      "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}.${Boost_FIND_VERSION_PATCH}")
+  else (Boost_FIND_VERSION_PATCH)
+    set( _boost_TEST_VERSIONS 
+      "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}.0"
+      "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
+  endif (Boost_FIND_VERSION_PATCH)
+else (Boost_FIND_VERSION_EXACT)
+  set( _boost_TEST_VERSIONS ${Boost_ADDITIONAL_VERSIONS} 
+    "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0" 
+    "1.34" "1.33.1" "1.33.0" "1.33" )
+endif (Boost_FIND_VERSION_EXACT)
+
+# The reason that we failed to find Boost. This will be set to a
+# user-friendly message when we fail to find some necessary piece of
+# Boost.
+set(Boost_ERROR_REASON)
+
+############################################
+#
+# Check the existence of the libraries.
+#
+############################################
+# This macro was taken directly from the FindQt4.cmake file that is included
+# with the CMake distribution. This is NOT my work. All work was done by the
+# original authors of the FindQt4.cmake file. Only minor modifications were
+# made to remove references to Qt and make this file more generally applicable
+#########################################################################
+
+MACRO (_Boost_ADJUST_LIB_VARS basename)
+  IF (Boost_INCLUDE_DIR )
+    IF (Boost_${basename}_LIBRARY_DEBUG AND Boost_${basename}_LIBRARY_RELEASE)
+      # if the generator supports configuration types then set
+      # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value
+      IF (CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
+        SET(Boost_${basename}_LIBRARY optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG})
+      ELSE(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
+        # if there are no configuration types and CMAKE_BUILD_TYPE has no value
+        # then just use the release libraries
+        SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} )
+      ENDIF(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE)
+      SET(Boost_${basename}_LIBRARIES optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG})
+    ENDIF (Boost_${basename}_LIBRARY_DEBUG AND Boost_${basename}_LIBRARY_RELEASE)
+
+    # if only the release version was found, set the debug variable also to the release version
+    IF (Boost_${basename}_LIBRARY_RELEASE AND NOT Boost_${basename}_LIBRARY_DEBUG)
+      SET(Boost_${basename}_LIBRARY_DEBUG ${Boost_${basename}_LIBRARY_RELEASE})
+      SET(Boost_${basename}_LIBRARY       ${Boost_${basename}_LIBRARY_RELEASE})
+      SET(Boost_${basename}_LIBRARIES     ${Boost_${basename}_LIBRARY_RELEASE})
+    ENDIF (Boost_${basename}_LIBRARY_RELEASE AND NOT Boost_${basename}_LIBRARY_DEBUG)
+
+    # if only the debug version was found, set the release variable also to the debug version
+    IF (Boost_${basename}_LIBRARY_DEBUG AND NOT Boost_${basename}_LIBRARY_RELEASE)
+      SET(Boost_${basename}_LIBRARY_RELEASE ${Boost_${basename}_LIBRARY_DEBUG})
+      SET(Boost_${basename}_LIBRARY         ${Boost_${basename}_LIBRARY_DEBUG})
+      SET(Boost_${basename}_LIBRARIES       ${Boost_${basename}_LIBRARY_DEBUG})
+    ENDIF (Boost_${basename}_LIBRARY_DEBUG AND NOT Boost_${basename}_LIBRARY_RELEASE)
+    
+    IF (Boost_${basename}_LIBRARY)
+      SET(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY} CACHE FILEPATH "The Boost ${basename} library")
+      GET_FILENAME_COMPONENT(Boost_LIBRARY_DIRS "${Boost_${basename}_LIBRARY}" PATH)
+      SET(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIRS} CACHE FILEPATH "Boost library directory")
+      SET(Boost_${basename}_FOUND ON CACHE INTERNAL "Whether the Boost ${basename} library found")
+    ENDIF (Boost_${basename}_LIBRARY)
+
+  ENDIF (Boost_INCLUDE_DIR )
+  # Make variables changeble to the advanced user
+  MARK_AS_ADVANCED(
+      Boost_${basename}_LIBRARY
+      Boost_${basename}_LIBRARY_RELEASE
+      Boost_${basename}_LIBRARY_DEBUG
+  )
+ENDMACRO (_Boost_ADJUST_LIB_VARS)
+
+#-------------------------------------------------------------------------------
+
+
+SET( _boost_IN_CACHE TRUE)
+IF(Boost_INCLUDE_DIR)
+  FOREACH(COMPONENT ${Boost_FIND_COMPONENTS})
+    STRING(TOUPPER ${COMPONENT} COMPONENT)
+    IF(NOT Boost_${COMPONENT}_FOUND)
+      SET( _boost_IN_CACHE FALSE)
+    ENDIF(NOT Boost_${COMPONENT}_FOUND)
+  ENDFOREACH(COMPONENT)
+ELSE(Boost_INCLUDE_DIR)
+  SET( _boost_IN_CACHE FALSE)
+ENDIF(Boost_INCLUDE_DIR)
+
+IF (_boost_IN_CACHE)
+  # in cache already
+  SET(Boost_FOUND TRUE)
+  FOREACH(COMPONENT ${Boost_FIND_COMPONENTS})
+    STRING(TOUPPER ${COMPONENT} COMPONENT)
+    _Boost_ADJUST_LIB_VARS( ${COMPONENT} )
+    SET(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${COMPONENT}_LIBRARY})
+  ENDFOREACH(COMPONENT)
+  SET(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR})
+  IF(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0")
+    MATH(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000")
+    MATH(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000")
+    MATH(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100")
+  ENDIF(Boost_VERSION AND NOT "${Boost_VERSION}" STREQUAL "0")
+ELSE (_boost_IN_CACHE)
+  # Need to search for boost
+
+  IF(WIN32)
+    # In windows, automatic linking is performed, so you do not have
+    # to specify the libraries.  If you are linking to a dynamic
+    # runtime, then you can choose to link to either a static or a
+    # dynamic Boost library, the default is to do a static link.  You
+    # can alter this for a specific library "whatever" by defining
+    # BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be
+    # linked dynamically.  Alternatively you can force all Boost
+    # libraries to dynamic link by defining BOOST_ALL_DYN_LINK.
+  
+    # This feature can be disabled for Boost library "whatever" by
+    # defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining
+    # BOOST_ALL_NO_LIB.
+  
+    # If you want to observe which libraries are being linked against
+    # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking
+    # code to emit a #pragma message each time a library is selected
+    # for linking.
+    SET(Boost_LIB_DIAGNOSTIC_DEFINITIONS 
+      "-DBOOST_LIB_DIAGNOSTIC" CACHE STRING "Boost diagnostic define")
+  ENDIF(WIN32)
+
+  SET(_boost_INCLUDE_SEARCH_DIRS
+    C:/boost/include
+    "C:/boost"
+    "$ENV{ProgramFiles}/boost/boost_${Boost_FIND_VERSION_MAJOR}_${Boost_FIND_VERSION_MINOR}_${Boost_FIND_VERSION_PATCH}"
+    "$ENV{ProgramFiles}/Boost"
+    /sw/local/include
+  )
+
+  SET(_boost_LIBRARIES_SEARCH_DIRS
+    C:/boost/lib
+    "C:/boost"
+    "$ENV{ProgramFiles}/boost/boost_${Boost_FIND_VERSION_MAJOR}_${Boost_FIND_VERSION_MINOR}_${Boost_FIND_VERSION_PATCH}/lib"
+    "$ENV{ProgramFiles}/Boost"
+    /sw/local/lib
+  )
+
+  # If BOOST_ROOT was defined in the environment, use it.
+  if (NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "")
+    set(BOOST_ROOT $ENV{BOOST_ROOT})
+  endif(NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "")
+
+  # If BOOSTROOT was defined in the environment, use it.
+  if (NOT BOOST_ROOT AND NOT $ENV{BOOSTROOT} STREQUAL "")
+    set(BOOST_ROOT $ENV{BOOSTROOT})
+  endif(NOT BOOST_ROOT AND NOT $ENV{BOOSTROOT} STREQUAL "")
+
+  # If BOOST_INCLUDEDIR was defined in the environment, use it.
+  IF( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" )
+    set(BOOST_INCLUDEDIR $ENV{BOOST_INCLUDEDIR})
+  ENDIF( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" )
+
+  # If BOOST_LIBRARYDIR was defined in the environment, use it.
+  IF( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" )
+    set(BOOST_LIBRARYDIR $ENV{BOOST_LIBRARYDIR})
+  ENDIF( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" )
+
+  IF( BOOST_ROOT )
+    file(TO_CMAKE_PATH ${BOOST_ROOT} BOOST_ROOT)
+    SET(_boost_INCLUDE_SEARCH_DIRS 
+      ${BOOST_ROOT}/include 
+      ${BOOST_ROOT}
+      ${_boost_INCLUDE_SEARCH_DIRS})
+    SET(_boost_LIBRARIES_SEARCH_DIRS 
+      ${BOOST_ROOT}/lib 
+      ${BOOST_ROOT}/stage/lib 
+      ${_boost_LIBRARIES_SEARCH_DIRS})
+  ENDIF( BOOST_ROOT )
+
+  IF( BOOST_INCLUDEDIR )
+    file(TO_CMAKE_PATH ${BOOST_INCLUDEDIR} BOOST_INCLUDEDIR)
+    SET(_boost_INCLUDE_SEARCH_DIRS 
+      ${BOOST_INCLUDEDIR} ${_boost_INCLUDE_SEARCH_DIRS})
+  ENDIF( BOOST_INCLUDEDIR )
+
+  IF( BOOST_LIBRARYDIR )
+    file(TO_CMAKE_PATH ${BOOST_LIBRARYDIR} BOOST_LIBRARYDIR)
+    SET(_boost_LIBRARIES_SEARCH_DIRS 
+      ${BOOST_LIBRARYDIR} ${_boost_LIBRARIES_SEARCH_DIRS})
+  ENDIF( BOOST_LIBRARYDIR )
+
+  # Try to find Boost by stepping backwards through the Boost versions
+  # we know about.
+  FOREACH(_boost_VER ${_boost_TEST_VERSIONS})
+    IF( NOT Boost_INCLUDE_DIR )
+      # Add in a path suffix, based on the required version, ideally
+      # we could read this from version.hpp, but for that to work we'd
+      # need to know the include dir already
+      if (WIN32 AND NOT CYGWIN)
+        set(_boost_PATH_SUFFIX boost_${_boost_VER})
+      else (WIN32 AND NOT CYGWIN)
+        set(_boost_PATH_SUFFIX boost-${_boost_VER})
+      endif (WIN32 AND NOT CYGWIN)
+
+      IF(_boost_PATH_SUFFIX MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")
+          STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3" 
+            _boost_PATH_SUFFIX ${_boost_PATH_SUFFIX})
+      ELSEIF(_boost_PATH_SUFFIX MATCHES "[0-9]+\\.[0-9]+")
+          STRING(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2" 
+            _boost_PATH_SUFFIX ${_boost_PATH_SUFFIX})
+      ENDIF(_boost_PATH_SUFFIX MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")
+
+      FIND_PATH(Boost_INCLUDE_DIR
+          NAMES         boost/config.hpp
+          HINTS         ${_boost_INCLUDE_SEARCH_DIRS}
+          PATH_SUFFIXES ${_boost_PATH_SUFFIX}
+      )
+
+    ENDIF( NOT Boost_INCLUDE_DIR )
+  ENDFOREACH(_boost_VER)
+
+  IF(Boost_INCLUDE_DIR)
+    # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp
+    # Read the whole file:
+    #
+    SET(BOOST_VERSION 0)
+    SET(BOOST_LIB_VERSION "")
+    FILE(READ "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS)
+  
+    STRING(REGEX REPLACE ".*#define BOOST_VERSION ([0-9]+).*" "\\1" Boost_VERSION "${_boost_VERSION_HPP_CONTENTS}")
+    STRING(REGEX REPLACE ".*#define BOOST_LIB_VERSION \"([0-9_]+)\".*" "\\1" Boost_LIB_VERSION "${_boost_VERSION_HPP_CONTENTS}")
+  
+    SET(Boost_LIB_VERSION ${Boost_LIB_VERSION} CACHE INTERNAL "The library version string for boost libraries")
+    SET(Boost_VERSION ${Boost_VERSION} CACHE INTERNAL "The version number for boost libraries")
+    
+    IF(NOT "${Boost_VERSION}" STREQUAL "0")
+      MATH(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000")
+      MATH(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000")
+      MATH(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100")
+
+      set(Boost_ERROR_REASON
+          "${Boost_ERROR_REASON}Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}")
+    ENDIF(NOT "${Boost_VERSION}" STREQUAL "0")
+  ELSE(Boost_INCLUDE_DIR)
+    set(Boost_ERROR_REASON
+      "${Boost_ERROR_REASON}Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers.")
+  ENDIF(Boost_INCLUDE_DIR)
+
+  # Setting some more suffixes for the library
+  SET (Boost_LIB_PREFIX "")
+  IF ( WIN32 AND Boost_USE_STATIC_LIBS )
+    SET (Boost_LIB_PREFIX "lib")
+  ENDIF ( WIN32 AND Boost_USE_STATIC_LIBS )
+  SET (_boost_COMPILER "-gcc")
+  IF (MSVC90)
+    SET (_boost_COMPILER "-vc90")
+  ELSEIF (MSVC80)
+    SET (_boost_COMPILER "-vc80")
+  ELSEIF (MSVC71)
+    SET (_boost_COMPILER "-vc71")
+  ENDIF(MSVC90)
+  IF (MINGW)
+    EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
+      ARGS -dumpversion
+      OUTPUT_VARIABLE _boost_COMPILER_VERSION
+      )
+    STRING(REGEX REPLACE "([0-9])\\.([0-9])\\.[0-9]" "\\1\\2"
+      _boost_COMPILER_VERSION ${_boost_COMPILER_VERSION})
+    SET (_boost_COMPILER "-mgw${_boost_COMPILER_VERSION}")
+  ENDIF(MINGW)
+  IF (UNIX)
+    IF (NOT CMAKE_COMPILER_IS_GNUCC)
+      # We assume that we have the Intel compiler.
+      SET (_boost_COMPILER "-il")
+    ELSE (NOT CMAKE_COMPILER_IS_GNUCC)
+      # Determine which version of GCC we have.
+      EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
+        ARGS -dumpversion
+        OUTPUT_VARIABLE _boost_COMPILER_VERSION
+        )
+      STRING(REGEX REPLACE "([0-9])\\.([0-9])\\.[0-9]" "\\1\\2"
+        _boost_COMPILER_VERSION ${_boost_COMPILER_VERSION})
+      IF(APPLE)
+        IF(Boost_MINOR_VERSION)
+          IF(${Boost_MINOR_VERSION} GREATER 35)
+            # In Boost 1.36.0 and newer, the mangled compiler name used
+            # on Mac OS X/Darwin is "xgcc".
+            SET(_boost_COMPILER "-xgcc${_boost_COMPILER_VERSION}")
+          ELSE(${Boost_MINOR_VERSION} GREATER 35)
+            # In Boost <= 1.35.0, there is no mangled compiler name for
+            # the Mac OS X/Darwin version of GCC.
+            SET(_boost_COMPILER "")
+          ENDIF(${Boost_MINOR_VERSION} GREATER 35)
+        ELSE(Boost_MINOR_VERSION)
+          # We don't know the Boost version, so assume it's
+          # pre-1.36.0.
+          SET(_boost_COMPILER "")
+        ENDIF(Boost_MINOR_VERSION)
+      ELSE()
+        SET (_boost_COMPILER "-gcc${_boost_COMPILER_VERSION}")
+      ENDIF()
+    ENDIF (NOT CMAKE_COMPILER_IS_GNUCC)
+  ENDIF(UNIX)
+
+  SET (_boost_MULTITHREADED "-mt")
+
+  IF( NOT Boost_USE_MULTITHREADED )
+    SET (_boost_MULTITHREADED "")
+  ENDIF( NOT Boost_USE_MULTITHREADED )
+
+  SET( _boost_STATIC_TAG "")
+  IF (WIN32)
+    IF(MSVC)
+      SET (_boost_ABI_TAG "g")
+    ENDIF(MSVC)
+    IF( Boost_USE_STATIC_LIBS )
+      SET( _boost_STATIC_TAG "-s")
+    ENDIF( Boost_USE_STATIC_LIBS )
+  ENDIF(WIN32)
+  SET (_boost_ABI_TAG "${_boost_ABI_TAG}d")
+
+  # ------------------------------------------------------------------------
+  #  Begin finding boost libraries
+  # ------------------------------------------------------------------------
+  FOREACH(COMPONENT ${Boost_FIND_COMPONENTS})
+    STRING(TOUPPER ${COMPONENT} UPPERCOMPONENT)
+    SET( Boost_${UPPERCOMPONENT}_LIBRARY "Boost_${UPPERCOMPONENT}_LIBRARY-NOTFOUND" )
+    SET( Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE-NOTFOUND" )
+    SET( Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG-NOTFOUND")
+
+    # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
+    IF( Boost_USE_STATIC_LIBS )
+      SET( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
+      IF(WIN32)
+        SET(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
+      ELSE(WIN32)
+        SET(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
+      ENDIF(WIN32)
+    ENDIF( Boost_USE_STATIC_LIBS )
+
+    FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE
+        NAMES  ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}-${Boost_LIB_VERSION}
+               ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_STATIC_TAG}-${Boost_LIB_VERSION}
+               ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}
+               ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG}
+               ${Boost_LIB_PREFIX}boost_${COMPONENT}
+        HINTS  ${_boost_LIBRARIES_SEARCH_DIRS}
+    )
+
+    FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG
+        NAMES  ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}-${_boost_ABI_TAG}-${Boost_LIB_VERSION}
+               ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG}-${Boost_LIB_VERSION}
+               ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}-${_boost_ABI_TAG}
+               ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_STATIC_TAG}${_boost_ABI_TAG}
+               ${Boost_LIB_PREFIX}boost_${COMPONENT}-${_boost_ABI_TAG}
+        HINTS  ${_boost_LIBRARIES_SEARCH_DIRS}
+    )
+
+    _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT})
+    IF( Boost_USE_STATIC_LIBS )
+      SET(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
+    ENDIF( Boost_USE_STATIC_LIBS )
+  ENDFOREACH(COMPONENT)
+  # ------------------------------------------------------------------------
+  #  End finding boost libraries
+  # ------------------------------------------------------------------------
+
+  SET(Boost_INCLUDE_DIRS
+    ${Boost_INCLUDE_DIR}
+  )
+
+  SET(Boost_FOUND FALSE)
+  IF(Boost_INCLUDE_DIR)
+    SET( Boost_FOUND TRUE )
+
+    # Check the version of Boost against the requested version.
+    if (Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR)
+      message(SEND_ERROR "When requesting a specific version of Boost, you must provide at least the major and minor version numbers, e.g., 1.34")
+    endif (Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR)
+    if(Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" )
+      set( Boost_FOUND FALSE )
+      set(_Boost_VERSION_AGE "old")
+    elseif(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" )
+      if(Boost_MINOR_VERSION LESS "${Boost_FIND_VERSION_MINOR}" )
+        set( Boost_FOUND FALSE )
+        set(_Boost_VERSION_AGE "old")
+      elseif(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" )
+        if( Boost_FIND_VERSION_PATCH AND Boost_SUBMINOR_VERSION LESS "${Boost_FIND_VERSION_PATCH}" )
+          set( Boost_FOUND FALSE )
+          set(_Boost_VERSION_AGE "old")
+        endif( Boost_FIND_VERSION_PATCH AND Boost_SUBMINOR_VERSION LESS "${Boost_FIND_VERSION_PATCH}" )
+      endif( Boost_MINOR_VERSION LESS "${Boost_FIND_VERSION_MINOR}" )
+    endif( Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" )
+
+    if (Boost_FOUND AND Boost_FIND_VERSION_EXACT)
+      # If the user requested an exact version of Boost, check
+      # that. We already know that the Boost version we have is >= the
+      # requested version.
+      set(_Boost_VERSION_AGE "new")
+
+      # If the user didn't specify a patchlevel, it's 0.
+      if (NOT Boost_FIND_VERSION_PATCH)
+        set(Boost_FIND_VERSION_PATCH 0)
+      endif (NOT Boost_FIND_VERSION_PATCH)
+      
+      # We'll set Boost_FOUND true again if we have an exact version match.
+      set(Boost_FOUND FALSE)
+      if(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" )
+        if(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" )
+          if(Boost_SUBMINOR_VERSION EQUAL "${Boost_FIND_VERSION_PATCH}" )
+            set( Boost_FOUND TRUE )
+          endif(Boost_SUBMINOR_VERSION EQUAL "${Boost_FIND_VERSION_PATCH}" )
+        endif( Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" )
+      endif( Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" )
+    endif (Boost_FOUND AND Boost_FIND_VERSION_EXACT)
+
+    if(NOT Boost_FOUND)
+      # State that we found a version of Boost that is too new or too old.
+      set(Boost_ERROR_REASON
+        "${Boost_ERROR_REASON}\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
+      if (Boost_FIND_VERSION_PATCH)
+        set(Boost_ERROR_REASON 
+          "${Boost_ERROR_REASON}.${Boost_FIND_VERSION_PATCH}")
+      endif (Boost_FIND_VERSION_PATCH)
+      if (NOT Boost_FIND_VERSION_EXACT)
+        set(Boost_ERROR_REASON "${Boost_ERROR_REASON} (or newer)")
+      endif (NOT Boost_FIND_VERSION_EXACT)
+      set(Boost_ERROR_REASON "${Boost_ERROR_REASON}.")
+    endif (NOT Boost_FOUND)
+
+    if (Boost_FOUND)
+      set(_boost_CHECKED_COMPONENT FALSE)
+      set(_Boost_MISSING_COMPONENTS)
+      foreach(COMPONENT ${Boost_FIND_COMPONENTS})
+        string(TOUPPER ${COMPONENT} COMPONENT)
+        set(_boost_CHECKED_COMPONENT TRUE)
+        if(NOT Boost_${COMPONENT}_FOUND)
+          string(TOLOWER ${COMPONENT} COMPONENT)
+          list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT})
+          set( Boost_FOUND FALSE)
+        endif(NOT Boost_${COMPONENT}_FOUND)
+      endforeach(COMPONENT)
+    endif (Boost_FOUND)
+
+    if (_Boost_MISSING_COMPONENTS)
+      # We were unable to find some libraries, so generate a sensible
+      # error message that lists the libraries we were unable to find.
+      set(Boost_ERROR_REASON
+        "${Boost_ERROR_REASON}\nThe following Boost libraries could not be found:\n")
+      foreach(COMPONENT ${_Boost_MISSING_COMPONENTS})
+        set(Boost_ERROR_REASON
+          "${Boost_ERROR_REASON}        boost_${COMPONENT}\n")
+      endforeach(COMPONENT)
+
+      list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED)
+      list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS)
+      if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
+        set(Boost_ERROR_REASON
+          "${Boost_ERROR_REASON}No Boost libraries were found. You may need to set Boost_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.")
+      else (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
+        set(Boost_ERROR_REASON
+          "${Boost_ERROR_REASON}Some (but not all) of the required Boost libraries were found. You may need to install these additional Boost libraries. Alternatively, set Boost_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.")
+      endif (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
+    endif (_Boost_MISSING_COMPONENTS)
+
+    IF( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT )
+      # Compatibility Code for backwards compatibility with CMake
+      # 2.4's FindBoost module.
+
+      # Look for the boost library path.
+      # Note that the user may not have installed any libraries
+      # so it is quite possible the Boost_LIBRARY_PATH may not exist.
+      SET(_boost_LIB_DIR ${Boost_INCLUDE_DIR})
+    
+      IF("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+")
+        GET_FILENAME_COMPONENT(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
+      ENDIF ("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+")
+    
+      IF("${_boost_LIB_DIR}" MATCHES "/include$")
+        # Strip off the trailing "/include" in the path.
+        GET_FILENAME_COMPONENT(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
+      ENDIF("${_boost_LIB_DIR}" MATCHES "/include$")
+    
+      IF(EXISTS "${_boost_LIB_DIR}/lib")
+        SET (_boost_LIB_DIR ${_boost_LIB_DIR}/lib)
+      ELSE(EXISTS "${_boost_LIB_DIR}/lib")
+        IF(EXISTS "${_boost_LIB_DIR}/stage/lib")
+          SET(_boost_LIB_DIR ${_boost_LIB_DIR}/stage/lib)
+        ELSE(EXISTS "${_boost_LIB_DIR}/stage/lib")
+          SET(_boost_LIB_DIR "")
+        ENDIF(EXISTS "${_boost_LIB_DIR}/stage/lib")
+      ENDIF(EXISTS "${_boost_LIB_DIR}/lib")
+    
+      IF(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}")
+        SET(Boost_LIBRARY_DIRS ${_boost_LIB_DIR} CACHE FILEPATH "Boost library directory")
+      ENDIF(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}")
+
+    ENDIF( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT )
+
+  ELSE(Boost_INCLUDE_DIR)
+    SET( Boost_FOUND FALSE)
+  ENDIF(Boost_INCLUDE_DIR)
+
+  IF (Boost_FOUND)
+      IF (NOT Boost_FIND_QUIETLY)
+        MESSAGE(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
+      ENDIF(NOT Boost_FIND_QUIETLY)
+      IF (NOT Boost_FIND_QUIETLY)
+        MESSAGE(STATUS "Found the following Boost libraries:")
+      ENDIF(NOT Boost_FIND_QUIETLY)
+      FOREACH ( COMPONENT  ${Boost_FIND_COMPONENTS} )
+        STRING( TOUPPER ${COMPONENT} UPPERCOMPONENT )
+        IF ( Boost_${UPPERCOMPONENT}_FOUND )
+          IF (NOT Boost_FIND_QUIETLY)
+            MESSAGE (STATUS "  ${COMPONENT}")
+          ENDIF(NOT Boost_FIND_QUIETLY)
+          SET(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${UPPERCOMPONENT}_LIBRARY})
+        ENDIF ( Boost_${UPPERCOMPONENT}_FOUND )
+      ENDFOREACH(COMPONENT)
+  ELSE (Boost_FOUND)
+      IF (Boost_FIND_REQUIRED)
+        message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}")
+      ENDIF(Boost_FIND_REQUIRED)
+  ENDIF(Boost_FOUND)
+
+  # Under Windows, automatic linking is performed, so no need to specify the libraries.
+  IF (WIN32)
+    IF (NOT MINGW)
+      SET(Boost_LIBRARIES "")
+    ENDIF (NOT MINGW)
+  ENDIF(WIN32)
+
+  # show the Boost_INCLUDE_DIRS AND Boost_LIBRARIES variables only in the advanced view
+  MARK_AS_ADVANCED(Boost_INCLUDE_DIR
+      Boost_INCLUDE_DIRS
+      Boost_LIBRARY_DIRS
+      Boost_USE_MULTITHREADED
+  )
+ENDIF(_boost_IN_CACHE)
+
diff --git a/cmake/modules/FindCASA.cmake b/cmake/modules/FindCASA.cmake
new file mode 100644
index 00000000000..00f9303025b
--- /dev/null
+++ b/cmake/modules/FindCASA.cmake
@@ -0,0 +1,557 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: FindCASA.cmake 1643 2008-06-14 10:19:20Z baehren                    $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+## -----------------------------------------------------------------------------
+## - Check for the AIPS++/CASA library
+##
+## Variables assigned:
+##  HAVE_CASA
+##  CASA_BASEDIR   = Base directory of the CASA installation (aka AIPSROOT)
+##  HAVE_AIPS_H    = aips.h header file located
+##  HAVE_GLISH_H   = glish.h header file located
+##  CASA_INCLUDES  = Path to the CASA header files
+##  CASA_LIBRARIES = libraries of the CASA modules
+##
+## __TODO__
+##
+##  * Use AIPSPATH environment variable to detect path to working AIPS++/CASA
+##    installation
+##
+
+## -----------------------------------------------------------------------------
+## Search locations
+
+include (./CMakeSettings)
+
+set (casa_locations
+  ## most Linux systems
+  /aips++
+  /casa
+  /opt/aips++/stable
+  /opt/aips++/current
+  /opt/aips++
+  /opt/casa
+  /opt/casa/stable
+  /opt/casa/current
+  ## LOFAR development
+  /app/aips++/Stable
+  )
+
+if (APPLE)
+  list (APPEND casa_locations /sw/share/aips++ /sw/share/casa)
+endif (APPLE)
+
+## -----------------------------------------------------------------------------
+## Required external packages
+
+set (GLISH_FIND_QUIETLY TRUE)
+
+## libg2c
+
+if (NOT HAVE_G2C)
+  include (FindG2C)
+endif (NOT HAVE_G2C)
+
+## Glish
+
+if (NOT HAVE_GLISH)
+  include (FindGlish)
+endif (NOT HAVE_GLISH)
+
+## Feedback
+
+message (STATUS "G2C_INCLUDES    = ${G2C_INCLUDES}")
+message (STATUS "G2C_LIBRARIES   = ${G2C_LIBRARIES}")
+message (STATUS "GLISH_INCLUDES  = ${GLISH_INCLUDES}")
+message (STATUS "GLISH_LIBRARIES = ${GLISH_LIBRARIES}")
+
+## -----------------------------------------------------------------------------
+## Check for the header files first, as from this we can derive a number of 
+## fundamental CASA variables (such as e.g. the root directory of the
+## installation). The main point to keep in mind here is, that parts of the
+## final installation will reside in architecture-dependent directories - the
+## setup of the code directory however is generic, so once we have located it
+## we can go from there.
+
+## Find "aips.h", which is included by all other files
+
+find_path (CASA_INCLUDES aips.h
+  PATHS ${include_locations} ${casa_locations}
+  PATH_SUFFIXES casa code/include/casa
+  )
+
+if (CASA_INCLUDES)
+  set (HAVE_AIPS_H true)
+  string (REGEX REPLACE include/casa include CASA_INCLUDES ${CASA_INCLUDES})
+  string (REGEX REPLACE /code/include "" CASA_BASEDIR ${CASA_INCLUDES})
+endif (CASA_INCLUDES)
+
+## Once we have detected the header files - and therewith the path to the root
+## of the CASA installation, we need to locate the library files to get the 
+## library directory
+
+find_path (AIPSLIBD version.o casa
+  PATHS ${CASA_BASEDIR}
+  PATH_SUFFIXES darwin/lib linux/lib linux_gnu/lib
+  )
+
+## -----------------------------------------------------------------------------
+## The is a number of packages, which are distrubuted along with CASA, so once
+## we have been able to discover the location of the CASA base directory, we
+## can set the paths to these additional packages
+
+## [1] Glish
+
+if (HAVE_GLISH)
+  list (APPEND CASA_INCLUDES ${GLISH_INCLUDES})
+else (HAVE_GLISH)
+  message (SEND_ERROR "[FindCASA] No configuration settings for Glish available!")
+endif (HAVE_GLISH)
+
+## [2] WCSLIB -- library for the dealing with world coordinate systems
+
+find_library (libwcs
+  wcs
+  PATHS ${CASA_BASEDIR}
+  PATH_SUFFIXES
+  darwin/lib
+  linux_gnu/lib
+  )
+
+find_path (wcslib_includes
+  wcs.h
+  PATHS ${CASA_BASEDIR}/code/casa
+  PATH_SUFFIXES wcslib
+  )
+
+if (wcslib_includes)
+  string (REGEX REPLACE wcslib "" wcslib_includes ${wcslib_includes})
+  list (APPEND CASA_INCLUDES ${wcslib_includes})
+endif (wcslib_includes)
+
+## -----------------------------------------------------------------------------
+## Preparation: get additional information about the system
+
+if (UNIX)
+  set (AIPS_ARCH "LINUX")
+  set (AIPS_ENDIAN "LITTLE")
+  IF (APPLE)
+    ## definition passed to the compiler
+    SET (AIPS_DARWIN 1)
+    ## AIPS architecture -- as used for the compiler
+    SET (AIPS_ARCH "DARWIN")
+    ## AIPS architecture -- AIPSARCH system variable
+    SET (AIPSARCH "darwin")
+    ## check the processor type
+    IF (${CMAKE_OSX_ARCHITECTURES} MATCHES "ppc")
+      SET (AIPS_ENDIAN "BIG")
+    ENDIF (${CMAKE_OSX_ARCHITECTURES} MATCHES "ppc")
+  endif (APPLE)
+endif (UNIX)
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+string (REGEX REPLACE /lib "" AIPSARCH ${AIPSLIBD})
+
+## which libraries do we have to find?
+
+set (casa_libs
+  calibration
+  casa
+  components
+  coordinates
+  fits
+  graphics
+  images
+  lattices
+  measures
+  ms
+  msfits
+  msvis
+  scimath
+  scimath_f
+  tables
+  tasking
+  )
+
+foreach (casa_lib ${casa_libs})
+  find_library (CASA_lib${casa_lib} ${casa_lib}
+    PATHS ${lib_locations} ${AIPSLIBD}
+    )
+endforeach (casa_lib)
+
+## -----------------------------------------------------------------------------
+## Due to fact, that the individual modules of the CASA libraries are
+## interdependent, we need to take this into account when setting up the linker
+## instructions. The reference for the dependences listed here is the
+## corresponding table listed in the 'makedefs'
+##
+##  LINKcasa        := casa
+##  LINKscimath     := scimath casa
+##  LINKtables      := tables casa
+##  LINKmeasures    := measures tables scimath casa
+##  LINKfits        := fits measures tables scimath casa
+##  LINKlattices    := lattices tables scimath casa
+##  LINKcoordinates := coordinates fits measures tables scimath casa
+##  LINKcomponents  := components coordinates fits measures tables scimath casa
+##  LINKimages      := images components coordinates lattices fits measures
+##                      tables scimath casa
+##  LINKms          := ms measures tables scimath casa
+##  LINKmsfits      := msfits ms fits measures tables scimath casa
+##  LINKmsvis       := msvis ms measures tables scimath casa
+##  LINKcalibration := calibration msvis ms measures tables scimath casa
+##  LINKionosphere  := ionosphere measures tables scimath casa
+##  LINKflagging    := flagging msvis ms lattices measures tables scimath casa
+##  LINKdish        := dish ms fits coordinates lattices measures tables scimath
+##                      casa
+##  LINKsimulators  := simulators ms measures tables scimath casa
+##  LINKsynthesis   := synthesis calibration msvis ms images components
+##                      coordinates lattices fits measures tables scimath casa
+##  LINKgraphics    := graphics casa
+##  LINKtasking     := tasking graphics msvis ms images components coordinates
+##                      lattices fits measures tables scimath casa
+##
+##  Starting off with the original table by subsequent substitution we get
+##
+##   LINKcasa        := casa
+##   LINKscimath     := scimath LINKcasa
+##   LINKtables      := tables LINKcasa
+##   LINKmeasures    := measures tables LINKscimath
+##   LINKfits        := fits LINKmeasures
+##   LINKlattices    := lattices tables LINKscimath
+##   LINKcoordinates := coordinates LINKfits
+##   LINKcomponents  := components LINKcoordinates
+##   TMPcomponents   := components coordinates lattices LINKfits
+##   LINKimages      := images TMPcomponents
+##   LINKms          := ms LINKmeasures
+##   LINKmsfits      := msfits ms LINKfits
+##   LINKmsvis       := msvis LINKms
+##   TMPmsvis        := msvis ms images
+##   LINKcalibration := calibration LINKmsvis
+##   LINKionosphere  := ionosphere LINKmeasures
+##   LINKflagging    := flagging msvis ms lattices LINKmeasures
+##   LINKdish        := dish ms fits coordinates lattices LINKmeasures
+##   LINKsimulators  := simulators LINKms
+##   LINKsynthesis   := synthesis calibration TMPmsvis TMPcomponents
+##   LINKgraphics    := graphics LINKcasa
+##   LINKtasking     := tasking graphics TMPmsvis TMPcomponents
+##
+
+## string together the correct order of the libraries as passed to the linker
+
+## -- libcasa
+if (CASA_libcasa)
+  set (LINKcasa
+    ${CASA_libcasa}
+    CACHE STRING "LINKcasa")
+  ## -- libtables
+  if (CASA_libtables)
+    set (LINKtables
+      ${CASA_libtables} ${LINKcasa}
+      CACHE STRING "LINKtables")
+  endif (CASA_libtables)
+  ## -- libscimath
+  if (G2C_LIBRARIES AND CASA_libscimath AND CASA_libscimath_f)
+    set (LINKscimath
+      ${CASA_libscimath} ${CASA_libscimath_f} ${LINKcasa} ${G2C_LIBRARIES}
+      CACHE STRING "LINKscimath")
+  else (G2C_LIBRARIES AND CASA_libscimath AND CASA_libscimath_f)
+    message (SEND_ERROR "[FindCASA] Missing g2c library required for libscimath!")
+  endif (G2C_LIBRARIES AND CASA_libscimath AND CASA_libscimath_f)
+  ## -- libmeasures
+  if (CASA_libmeasures AND CASA_libtables AND LINKscimath)
+    set (LINKmeasures
+      ${CASA_libmeasures} ${CASA_libtables} ${LINKscimath}
+      CACHE STRING "LINKmeasures")
+  endif (CASA_libmeasures AND CASA_libtables AND LINKscimath)
+  ## -- libfits
+  if (CASA_libfits AND LINKmeasures AND libwcs)
+    set (LINKfits
+      ${CASA_libfits} ${LINKmeasures} ${libwcs}
+      CACHE STRING "LINKfits")
+  else (CASA_libfits AND LINKmeasures AND libwcs)
+    message (SEND_ERROR "[FindCASA] Missing WCS library required for libfits!")
+  endif (CASA_libfits AND LINKmeasures AND libwcs)
+  ## -- liblattices
+  if (CASA_liblattices AND CASA_libtables AND LINKscimath)
+    set (LINKlattices
+      ${CASA_liblattices} ${CASA_libtables} ${LINKscimath}
+      CACHE STRING "LINKlattices")
+  endif (CASA_liblattices AND CASA_libtables AND LINKscimath)
+  ## -- libcoordinates
+  if (CASA_libcoordinates AND LINKfits)
+    set (LINKcoordinates
+      ${CASA_libcoordinates} ${LINKfits}
+      CACHE STRING "LINKcoordinates")
+  endif (CASA_libcoordinates AND LINKfits)
+  ## -- libcomponents
+  if (CASA_libcomponents AND LINKcoordinates)
+    set (LINKcomponents
+      ${CASA_libcomponents} ${LINKcoordinates}
+      CACHE STRING "LINKcomponents")
+    if (CASA_liblattices AND LINKfits)
+      set (TMPcomponents 
+	${CASA_libcomponents} ${CASA_libcoordinates} ${CASA_liblattices} ${LINKfits}
+	CACHE STRING "TMPcomponents")
+    endif (CASA_liblattices AND LINKfits)
+  endif (CASA_libcomponents AND LINKcoordinates)
+  ## -- libimages
+  if (CASA_libimages AND TMPcomponents)
+    set (LINKimages
+      ${CASA_libimages} ${TMPcomponents}
+      CACHE STRING "LINKimages")
+  endif (CASA_libimages AND TMPcomponents)
+  ## -- libms
+  if (CASA_libms AND LINKmeasures)
+    set (LINKms
+      ${CASA_libms} ${LINKmeasures}
+      CACHE STRING "LINKms")
+  endif (CASA_libms AND LINKmeasures)
+  ## -- libmsfits
+  if (CASA_libmsfits AND CASA_libms AND LINKfits)
+    set (LINKmsfits
+      ${CASA_libmsfits} ${CASA_libms} ${LINKfits}
+      CACHE STRING "LINKmsfits")
+  endif (CASA_libmsfits AND CASA_libms AND LINKfits)
+  ## -- libmsvis
+  if (CASA_libmsvis AND LINKms)
+    set (LINKmsvis
+      ${CASA_libmsvis} ${LINKms}
+      CACHE STRING "LINKmsvis")
+    if (LINKimages)
+      set (TMPmsvis
+	${CASA_libmsvis} ${CASA_libms} ${CASA_libimages}
+	CACHE STRING "TMPmsvis")
+    endif (LINKimages)
+  endif (CASA_libmsvis AND LINKms)
+  ## -- libcalibration
+  if (CASA_libcalibration AND LINKmsvis)
+    set (LINKcalibration
+      ${CASA_libcalibration} ${LINKmsvis}
+      CACHE STRING "LINKcalibration")
+  endif (CASA_libcalibration AND LINKmsvis)
+  ## -- libionosphere
+  if (CASA_libionosphere AND LINKmeasures)
+    set (LINKionosphere
+      ${CASA_libionosphere} ${LINKmeasures}
+      CACHE STRING "LINKionosphere")
+  endif (CASA_libionosphere AND LINKmeasures)
+  ## -- libflagging
+  if (CASA_libflagging AND CASA_libmsvis AND CASA_libms AND CASA_liblattices)
+    set (LINKflagging
+      ${CASA_libflagging} ${CASA_libmsvis} ${CASA_libms} ${CASA_liblattices}
+      ${LINKmeasures}
+      CACHE STRING "LINKflagging")
+  endif (CASA_libflagging AND CASA_libmsvis AND CASA_libms AND CASA_liblattices)
+  ## -- libdish
+  set (LINKdish
+    ${CASA_libdish} ${CASA_libms} ${CASA_libfits} ${CASA_libcoordinates} ${CASA_liblattices}
+    ${LINKmeasures}
+    CACHE STRING "LINKdish")
+  ## -- libsimulators
+  if (CASA_libsimulators AND LINKms)
+    set (LINKsimulators
+      ${CASA_libsimulators} ${LINKms}
+      CACHE STRING "LINKsimulators")
+  endif (CASA_libsimulators AND LINKms)
+  ## -- libsynthesis
+  if (CASA_libsynthesis AND CASA_libcalibration AND TMPmsvis AND TMPcomponents)
+    set (LINKsynthesis
+      ${CASA_libsynthesis} ${CASA_libcalibration} ${TMPmsvis} ${TMPcomponents}
+      CACHE STRING "LINKsynthesis")
+  endif (CASA_libsynthesis AND CASA_libcalibration AND TMPmsvis AND TMPcomponents)
+  ## -- libgraphics
+  if (CASA_libgraphics AND LINKcasa)
+    set (LINKgraphics
+      ${CASA_libgraphics} ${LINKcasa}
+      CACHE STRING "LINKgraphics")
+  endif (CASA_libgraphics AND LINKcasa)
+  ## -- libtasking
+  if (CASA_libtasking AND CASA_libgraphics AND TMPmsvis)
+    set (LINKtasking
+      ${CASA_libtasking} ${CASA_libgraphics} ${CASA_libmsvis} ${CASA_libms} ${CASA_libimages}
+      ${TMPcomponents} 
+      CACHE STRING "LINKtasking")
+  endif (CASA_libtasking AND CASA_libgraphics AND TMPmsvis)
+endif (CASA_libcasa)
+
+
+## -----------------------------------------------------------------------------
+## Depending on the set of located package libraries the instruction towards the
+## linker is put together
+
+if (CASA_libcasa)
+  set (CASA_LIBRARIES ${LINKcasa})
+  if (CASA_libscimath AND CASA_libscimath_f)
+    set (CASA_LIBRARIES ${LINKscimath})
+  endif (CASA_libscimath AND CASA_libscimath_f)
+  if (CASA_libtables)
+    set (CASA_LIBRARIES ${LINKtables})
+  endif (CASA_libtables)
+  if (CASA_libgraphics)
+    set (CASA_LIBRARIES ${LINKgraphics})
+  endif (CASA_libgraphics)
+  if (CASA_libscimath AND CASA_libtables)
+    if (CASA_libmeasures)
+      set (CASA_LIBRARIES ${LINKmeasures})
+      if (MS_LIBRARY)
+	set (CASA_LIBRARIES ${LINKms})
+      endif (MS_LIBRARY)
+      if (CASA_libfits)
+	set (CASA_LIBRARIES ${LINKfits})
+	if (CASA_libcoordinates)
+	  set (CASA_LIBRARIES ${LINKcoordinates})
+	  if (CASA_libcomponents)
+	    set (CASA_LIBRARIES ${LINKcomponents})
+	    if (CASA_libimages)
+	      set (CASA_LIBRARIES ${LINKimages})
+	      ##
+	      if (CASA_libtasking)
+		set (CASA_LIBRARIES ${LINKtasking} ${GLISH_LIBRARIES})
+	      endif (CASA_libtasking)
+	      ##
+	    endif (CASA_libimages)
+	  endif (CASA_libcomponents)
+	endif (CASA_libcoordinates)
+      endif (CASA_libfits)
+    endif (CASA_libmeasures)
+  endif (CASA_libscimath AND CASA_libtables)
+endif (CASA_libcasa)
+
+## -----------------------------------------------------------------------------
+## If detection successful, register package as found
+
+if (CASA_INCLUDES AND CASA_LIBRARIES)
+  set (HAVE_CASA TRUE)
+  string (REGEX REPLACE lib/libcasa.a lib CASA_LIBRARIES_DIR ${CASA_libcasa})
+else (CASA_INCLUDES AND CASA_LIBRARIES)
+  set (HAVE_CASA FALSE)
+  if (NOT CASA_FIND_QUIETLY)
+    if (NOT CASA_INCLUDES)
+      message (STATUS "Unable to find CASA header files!")
+    endif (NOT CASA_INCLUDES)
+    if (NOT CASA_LIBRARIES)
+      message (STATUS "Unable to find CASA library files!")
+    endif (NOT CASA_LIBRARIES)
+  endif (NOT CASA_FIND_QUIETLY)
+endif (CASA_INCLUDES AND CASA_LIBRARIES)
+
+## ------------------------------------------------------------------------------
+## Final assembly of the provided variables and flags; once this is done, we
+## provide some extended feedback.
+
+if (HAVE_CASA)
+  add_definitions (
+    -DAIPS_${AIPS_ARCH}
+    -DNATIVE_EXCP
+    -DAIPS_STDLIB
+    -DAIPS_AUTO_STL
+    -DAIPS_NO_LEA_MALLOC
+    -D_GLIBCPP_DEPRECATED
+    -DSIGNBIT 
+    -DAIPS_NO_TEMPLATE_SRC
+  )
+  ##
+  ## Platform test Big/Little Endian ------------------------------------
+  ##
+  if (CMAKE_SYSTEM_PROCESSOR MATCHES "powerpc")
+    message (STATUS "System is big endian.")
+    add_definitions (-DAIPS_BIG_ENDIAN)
+    set (CMAKE_SYSTEM_BIG_ENDIAN 1)
+  elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "powerpc")
+    message (STATUS "System is little endian.")
+    add_definitions (-DAIPS_LITTLE_ENDIAN)
+    set (CMAKE_SYSTEM_BIG_ENDIAN 0)
+  endif (CMAKE_SYSTEM_PROCESSOR MATCHES "powerpc")
+  ##
+  ## Platform test 32/64 bit ------------------------------
+  ##
+  set (CMAKE_SYSTEM_64BIT 0)
+  if (NOT CMAKE_SYSTEM_PROCESSOR MATCHES i386)
+    if (NOT CMAKE_SYSTEM_PROCESSOR MATCHES i686)
+      if (NOT CMAKE_SYSTEM_PROCESSOR MATCHES powerpc)
+        set (CMAKE_SYSTEM_64BIT 1)
+        add_definitions (-DAIPS_64B)
+      endif (NOT CMAKE_SYSTEM_PROCESSOR MATCHES powerpc)
+    endif (NOT CMAKE_SYSTEM_PROCESSOR MATCHES i686)
+  endif (NOT CMAKE_SYSTEM_PROCESSOR MATCHES i386)
+  ##
+  ## Flags for C++ compiler and Linker --------------------
+  ## 
+  set (CASA_CXX_FLAGS "-fPIC -pipe -Wall -Wno-non-template-friend -Woverloaded-virtual -Wno-comment -fexceptions -Wcast-align")
+  set (CASA_CXX_LFLAGS "${CASA_LIBRARIES_DIR}/version.o ${CASA_LIBRARIES}")
+  if (NOT CASA_FIND_QUIETLY)
+    message (STATUS "Found components for CASA.")
+    message (STATUS "AIPSARCH ........... : ${AIPS_ARCH}")
+    message (STATUS "CASA_BASEDIR ....... : ${CASA_BASEDIR}")
+    message (STATUS "CASA_LIBRARIES_DIR . : ${CASA_LIBRARIES_DIR}")
+    message (STATUS "CASA_LIBRARIES ..... : ${CASA_LIBRARIES}")
+    message (STATUS "CASA header files .. : ${CASA_INCLUDES}")
+    message (STATUS "CASA compile command : ${CASA_CXX_FLAGS}")
+    message (STATUS "CASA linker command  : ${CASA_CXX_LFLAGS}")
+  endif (NOT CASA_FIND_QUIETLY)
+  set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CASA_CXX_FLAGS}")
+else (HAVE_CASA)
+  if (CASA_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find CASA")
+  endif (CASA_FIND_REQUIRED)
+endif (HAVE_CASA)
+
+## ------------------------------------------------------------------------------
+## Mark as advanced: clean up not to include all the temporary variables into
+## configuration settings
+
+mark_as_advanced (
+  CASA_libcasa
+  CASA_libcoordinates
+  CASA_libimages
+  CASA_libmeasures
+  CASA_libscimath
+  CASA_libscimath_f
+  CASA_libtables
+  CASA_libcalibration
+  CASA_libcomponents
+  CASA_libfits
+  CASA_libgraphics
+  CASA_liblattices
+  CASA_libms
+  CASA_libmsfits
+  CASA_libmsvis
+  CASA_libtasking
+  LINKcasa
+  LINKscimath
+  LINKgraphics
+  LINKmeasures
+  LINKms
+  LINKfits
+  LINKcalibration
+  LINKcomponents
+  LINKcoordinates
+  LINKdish
+  LINKimages
+  LINKlattices
+  LINKmsfits
+  LINKmsvis
+  LINKtables
+  LINKtasking
+  )
diff --git a/cmake/modules/FindCASACORE.cmake b/cmake/modules/FindCASACORE.cmake
new file mode 100644
index 00000000000..ab792d625e8
--- /dev/null
+++ b/cmake/modules/FindCASACORE.cmake
@@ -0,0 +1,291 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: IO.h 393 2007-06-13 10:49:08Z baehren                               $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+## -----------------------------------------------------------------------------
+## Check for the casacore distribution
+##
+## Variables assigned:
+##  CASACORE_FOUND         = Do we have both headers and libraries of casacore?
+##  CASACORE_INCLUDES      = Path to the casacore header files
+##  CASACORE_LIBRARIES     = Libraries of the casacore modules
+##  CASACORE_COMPILE_FLAGS = 
+##  CASACORE_PATH          = 
+##
+## -----------------------------------------------------------------------------
+
+## -----------------------------------------------------------------------------
+## Library components to search for
+
+set (casacore_modules
+  casa
+  tables
+  scimath_f
+  scimath
+  measures
+  ms
+  )
+
+set (casacore_headers
+  casa/Arrays.h
+  tables/Tables.h
+  mirlib/miriad.h
+  scimath/Fitting.h
+  measures/Measures.h
+  fits/FITS.h
+  coordinates/Coordinates.h
+  components/ComponentModels.h
+  lattices/Lattices.h
+  ms/MeasurementSets.h
+  images/Images.h
+  msfits/MSFits.h
+  msvis/MSVis.h
+  )
+
+## -----------------------------------------------------------------------------
+## Search locations
+
+include (CMakeSettings)
+
+list (APPEND include_locations
+  ${USG_ROOT}/release/include
+  ${USG_ROOT}/external/casacore
+  /usr/include
+  /usr/local/include
+  /sw/share/casacore
+  /sw/include
+  /app/usg/release/include
+  /app/aips++/casacore_64/include/casacore
+  ${CASACORE_PATH}/include/casacore
+)
+
+list (APPEND lib_locations
+  /opt/casacore/lib
+  /app/usg/release/lib
+  /app/aips++/casacore_64/lib
+  ${CASACORE_PATH}/lib
+)
+
+## -----------------------------------------------------------------------------
+## Check for system header files
+
+if (NOT CASACORE_FIND_QUIETLY)
+  message (STATUS "[FindCASACORE] Check for system header files ...")
+endif (NOT CASACORE_FIND_QUIETLY)
+
+find_path (HAVE_ASSERT_H  assert.h  PATHS ${include_locations} )
+find_path (HAVE_CTYPE_H   ctype.h   PATHS ${include_locations} )
+find_path (HAVE_FCNTL_H   fcntl.h   PATHS ${include_locations} )
+find_path (HAVE_STDLIB_H  stdlib.h  PATHS ${include_locations} )
+find_path (HAVE_STDIO_H   stdio.h   PATHS ${include_locations} )
+find_path (HAVE_STRING_H  string.h  PATHS ${include_locations} )
+find_path (HAVE_UNISTD_H  unistd.h  PATHS ${include_locations} )
+
+## -----------------------------------------------------------------------------
+## Required external packages
+
+find_library (HAVE_LIBM         m          PATHS ${lib_locations} )
+find_library (HAVE_LIBG2C       g2c        PATHS ${lib_locations} )
+find_library (HAVE_LIBF2C       f2c        PATHS ${lib_locations} )
+find_library (HAVE_LIBGFORTRAN  gfortran   PATHS ${lib_locations} )
+
+## -----------------------------------------------------------------------------
+## Check for the header files.
+##
+## Depending on whether the header files are part of a complete casacore
+## installation or have remained at their original location in the source
+## directories, we need to check for different variants to the include paths.
+
+if (NOT CASACORE_FIND_QUIETLY)
+  message (STATUS "[FindCASACORE] Check for the header files ...")
+endif (NOT CASACORE_FIND_QUIETLY)
+
+set (CASACORE_INCLUDES "")
+
+foreach (CASACORE_HEADER ${casacore_headers})
+  ## search for the header file of a given module
+  find_path (header_path ${CASACORE_HEADER}
+    PATHS ${include_locations}
+    PATH_SUFFIXES casacore
+    NO_DEFAULT_PATH
+    )
+  ## if the header file was found, add its path to the include path
+  if (header_path)
+    get_filename_component (tmp ${header_path} ABSOLUTE)
+    list (APPEND CASACORE_INCLUDES ${tmp})
+  else (header_path)
+    message (MESSAGE "[casacore] Unable to locate ${CASACORE_HEADER}")
+  endif (header_path)
+endforeach (CASACORE_HEADER)
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+if (NOT CASACORE_FIND_QUIETLY)
+  message (STATUS "[FindCASACORE] Check for the library ...")
+endif (NOT CASACORE_FIND_QUIETLY)
+
+## Dependency of the packages in casacore
+
+# casa        : --
+# tables      : casa
+# mirlib      : casa
+# scimath     : casa
+# measures    : tables scimath
+# fits        : measures
+# coordinates : fits
+# components  : coordinates
+# lattices    : tables scimath
+# ms          : measures
+# images      : components mirlib
+# msfits      : ms fits
+# msvis       : ms
+
+## Locate the libraries themselves; keep in mind that the libraries follow
+## the naming convention libcasa_<module>, e.g. libcasa_images.a
+
+foreach (casacore_lib ${casacore_modules})
+  ## search for the library
+  if (${casacore_lib} MATCHES "mirlib")
+    find_library (CASACORE_lib${casacore_lib} mir
+      PATHS ${lib_locations}
+      NO_DEFAULT_PATH
+      )
+  else (${casacore_lib} MATCHES "mirlib")
+    find_library (CASACORE_lib${casacore_lib} casa_${casacore_lib}
+      PATHS ${lib_locations}
+      NO_DEFAULT_PATH
+      )
+  endif (${casacore_lib} MATCHES "mirlib")
+  ## if we have found the library, add it to the list
+  if (CASACORE_lib${casacore_lib})
+    list (APPEND CASACORE_LIBRARIES ${CASACORE_lib${casacore_lib}})
+  endif (CASACORE_lib${casacore_lib})
+endforeach (casacore_lib)
+
+## Once we are done, rearrange the order of the libraries in the list
+
+if (CASACORE_LIBRARIES)
+  list (REVERSE CASACORE_LIBRARIES)
+endif (CASACORE_LIBRARIES)
+
+## -----------------------------------------------------------------------------
+## Check for symbols within individual libraries
+
+
+
+## -----------------------------------------------------------------------------
+## If detection successful, register package as found
+
+if (CASACORE_INCLUDES AND CASACORE_LIBRARIES)
+  set (CASACORE_FOUND TRUE)
+else (CASACORE_INCLUDES AND CASACORE_LIBRARIES)
+  set (CASACORE_FOUND FALSE)
+  if (NOT CASACORE_FIND_QUIETLY)
+    if (NOT CASACORE_INCLUDES)
+      message (STATUS "Unable to find CASACORE header files!")
+    endif (NOT CASACORE_INCLUDES)
+    if (NOT CASACORE_LIBRARIES)
+      message (STATUS "Unable to find CASACORE library files!")
+    endif (NOT CASACORE_LIBRARIES)
+  endif (NOT CASACORE_FIND_QUIETLY)
+endif (CASACORE_INCLUDES AND CASACORE_LIBRARIES)
+
+IF (CASACORE_FOUND)
+  IF (NOT CASACORE_FIND_QUIETLY)
+    MESSAGE (STATUS "Found components for CASACORE")
+    MESSAGE (STATUS "CASACORE_LIBRARIES = ${CASACORE_LIBRARIES}")
+    MESSAGE (STATUS "CASACORE_INCLUDES  = ${CASACORE_INCLUDES}")
+  ENDIF (NOT CASACORE_FIND_QUIETLY)
+ENDIF (CASACORE_FOUND)
+
+## ------------------------------------------------------------------------------
+## Final assembly of the provided variables and flags; once this is done, we
+## provide some extended feedback.
+
+## --- Compiler settings -------------------------
+
+IF (UNIX)
+  add_definitions (
+    -DAIPS_STDLIB
+    -DAIPS_AUTO_STL
+    )
+  set (CASACORE_COMPILE_FLAGS "-DAIPS_STDLIB -DAIPS_AUTO_STL -DAIPS_NO_LEA_MALLOC")
+  IF (APPLE)
+    set (CASACORE_COMPILE_FLAGS "${CASACORE_COMPILE_FLAGS} -DAIPS_DARWIN")
+  else (APPLE)
+    set (CASACORE_COMPILE_FLAGS "${CASACORE_COMPILE_FLAGS} -DAIPS_LINUX")
+  endif (APPLE)
+  ##
+  ## Platform test Big/Little Endian ------------------------------------
+  ##
+  if (CMAKE_SYSTEM_PROCESSOR MATCHES "powerpc")
+    add_definitions (-DAIPS_BIG_ENDIAN)
+    set (CMAKE_SYSTEM_BIG_ENDIAN 1)
+    set (CASACORE_COMPILE_FLAGS "${CASACORE_COMPILE_FLAGS} -DAIPS_BIG_ENDIAN")
+  else (CMAKE_SYSTEM_PROCESSOR MATCHES "powerpc")
+    add_definitions (-DAIPS_LITTLE_ENDIAN)
+    set (CMAKE_SYSTEM_BIG_ENDIAN 0)
+  endif (CMAKE_SYSTEM_PROCESSOR MATCHES "powerpc")
+  #  TEST_BIG_ENDIAN (CMAKE_SYSTEM_BIG_ENDIAN)
+  #  if (CMAKE_SYSTEM_BIG_ENDIAN)
+  #    message (STATUS "System is big endian.")
+  #    add_definitions (-DAIPS_BIG_ENDIAN)
+  #  elseif (CMAKE_SYSTEM_BIG_ENDIAN)
+  #    message (STATUS "System is little endian.")
+  #    add_definitions (-DAIPS_LITTLE_ENDIAN)
+  #  endif (CMAKE_SYSTEM_BIG_ENDIAN)
+  ##
+  ## Platform test 32/64 bit ------------------------------
+  ##
+  set (CMAKE_SYSTEM_64BIT 0)
+  if (NOT CMAKE_SYSTEM_PROCESSOR MATCHES i386)
+    if (NOT CMAKE_SYSTEM_PROCESSOR MATCHES i686)
+      if (NOT CMAKE_SYSTEM_PROCESSOR MATCHES powerpc)
+        set (CMAKE_SYSTEM_64BIT 1)
+        add_definitions (-DAIPS_64B)
+      endif (NOT CMAKE_SYSTEM_PROCESSOR MATCHES powerpc)
+    endif (NOT CMAKE_SYSTEM_PROCESSOR MATCHES i686)
+  endif (NOT CMAKE_SYSTEM_PROCESSOR MATCHES i386)
+  if (APPLE)
+    if (NOT CMAKE_SYSTEM_PROCESSOR MATCHES powerpc)
+      set (CMAKE_SYSTEM_64BIT 1)
+      add_definitions (-DAIPS_64B)
+    endif (NOT CMAKE_SYSTEM_PROCESSOR MATCHES powerpc)
+  endif (APPLE)
+ENDIF (UNIX)
+
+## ------------------------------------------------------------------------------
+## Compatibility settings (should be removed at some point)
+
+set (CASA_INCLUDES "")
+set (CASA_INCLUDES ${CASACORE_INCLUDES})
+
+set (CASA_LIBRARIES "")
+set (CASA_LIBRARIES ${CASACORE_LIBRARIES})
+
+## ------------------------------------------------------------------------------
+## Variables only to be displayed in advanced mode
+
+mark_as_advanced (
+  casacore_modules
+  casacore_headers
+  )
diff --git a/cmake/modules/FindCFITSIO.cmake b/cmake/modules/FindCFITSIO.cmake
new file mode 100644
index 00000000000..52826d944b4
--- /dev/null
+++ b/cmake/modules/FindCFITSIO.cmake
@@ -0,0 +1,135 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: FindCFITSIO.cmake 1643 2008-06-14 10:19:20Z baehren                 $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of the CFITSIO library
+#
+#  HAVE_CFITSIO      = Do we have CFITSIO?
+#  CFITSIO_LIBRARIES = Set of libraries required for linking against CFITSIO
+#  CFITSIO_INCLUDES  = Directory where to find fitsio.h
+
+## -----------------------------------------------------------------------------
+## Search locations
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+set (CFITSIO_INCLUDES "")
+
+FIND_PATH (HAVE_FITSIO_H fitsio.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES cfitsio
+  NO_DEFAULT_PATH
+  )
+
+if (HAVE_FITSIO_H)
+  list (APPEND CFITSIO_INCLUDES ${HAVE_FITSIO_H})
+endif (HAVE_FITSIO_H)
+
+## -----------------------------------------------------------------------------
+## Check for the parts of the library
+
+## [1] core library
+
+FIND_LIBRARY (CFITSIO_libcfitsio
+  NAMES cfitsio
+  PATHS ${lib_locations}
+  PATH_SUFFIXES cfitsio
+  NO_DEFAULT_PATH
+)
+
+if (CFITSIO_libcfitsio)
+  set (CFITSIO_LIBRARIES ${CFITSIO_libcfitsio})
+endif (CFITSIO_libcfitsio)
+
+## [2] math library
+
+FIND_LIBRARY (CFITSIO_libm
+  NAMES m
+  PATHS ${lib_locations}
+  NO_DEFAULT_PATH
+)
+
+if (CFITSIO_libm)
+  list (APPEND CFITSIO_LIBRARIES ${CFITSIO_libm})
+else (CFITSIO_libm)
+  message (STATUS "Unable to find libm.")
+endif (CFITSIO_libm)
+
+## [3] file access
+
+FIND_LIBRARY (CFITSIO_libnsl
+  NAMES nsl
+  PATHS ${lib_locations}
+  NO_DEFAULT_PATH
+  )
+
+if (CFITSIO_libnsl)
+  list (APPEND CFITSIO_LIBRARIES ${CFITSIO_libnsl})
+else (CFITSIO_libnsl)
+  message (STATUS "Unable to find libnsl.")
+endif (CFITSIO_libnsl)
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+IF (CFITSIO_INCLUDES AND CFITSIO_LIBRARIES)
+  SET (HAVE_CFITSIO TRUE)
+ELSE (CFITSIO_INCLUDES AND CFITSIO_LIBRARIES)
+  IF (NOT CFITSIO_FIND_QUIETLY)
+    IF (NOT CFITSIO_INCLUDES)
+      MESSAGE (STATUS "Unable to find CFITSIO header files!")
+    ENDIF (NOT CFITSIO_INCLUDES)
+    IF (NOT CFITSIO_LIBRARIES)
+      MESSAGE (STATUS "Unable to find CFITSIO library files!")
+    ENDIF (NOT CFITSIO_LIBRARIES)
+  ENDIF (NOT CFITSIO_FIND_QUIETLY)
+ENDIF (CFITSIO_INCLUDES AND CFITSIO_LIBRARIES)
+
+IF (HAVE_CFITSIO)
+  IF (NOT CFITSIO_FIND_QUIETLY)
+    MESSAGE (STATUS "Found components for CFITSIO")
+    MESSAGE (STATUS "CFITSIO_LIBRARIES = ${CFITSIO_LIBRARIES}")
+    MESSAGE (STATUS "CFITSIO_INCLUDES  = ${CFITSIO_INCLUDES}")
+  ENDIF (NOT CFITSIO_FIND_QUIETLY)
+ELSE (HAVE_CFITSIO)
+  IF (CFITSIO_FIND_REQUIRED)
+    MESSAGE (FATAL_ERROR "Could not find CFITSIO!")
+  ENDIF (CFITSIO_FIND_REQUIRED)
+ENDIF (HAVE_CFITSIO)
+
+## ------------------------------------------------------------------------------
+## Mark as advanced ...
+
+MARK_AS_ADVANCED (
+  CFITSIO_libcfitsio
+  CFITSIO_libm
+  CFITSIO_INCLUDES
+  CFITSIO_LIBRARIES
+  )
+
+if (CFITSIO_libnsl)
+  mark_as_advanced (
+    CFITSIO_libnsl
+    )
+endif (CFITSIO_libnsl)
diff --git a/cmake/modules/FindCPGPLOT.cmake b/cmake/modules/FindCPGPLOT.cmake
new file mode 100644
index 00000000000..3073d1bd01a
--- /dev/null
+++ b/cmake/modules/FindCPGPLOT.cmake
@@ -0,0 +1,79 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: FindCPGPLOT.cmake 1643 2008-06-14 10:19:20Z baehren                 $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of the CPGPLOT library
+#
+# Defines the following variables:
+#  CPGPLOT_LIBRARY     -- Path to cpgplot.{a,so}
+#  CPGPLOT_INCLUDE_DIR -- Directory containing the CPGPLOT header files
+
+## -----------------------------------------------------------------------------
+## Search locations
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+FIND_LIBRARY (CPGPLOT_LIBRARY
+  NAMES cpgplot
+  PATHS ${lib_locations}
+  PATH_SUFFIXES pgplot
+)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+FIND_PATH (CPGPLOT_INCLUDE_DIR
+	cpgplot.h
+	PATHS ${include_locations}
+	PATH_SUFFIXES include/pgplot lib/pgplot
+)
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+IF (CPGPLOT_INCLUDE_DIR AND CPGPLOT_LIBRARY)
+	SET (CPGPLOT_FOUND TRUE)
+ELSE (CPGPLOT_INCLUDE_DIR AND CPGPLOT_LIBRARY)
+	IF (NOT CPGPLOT_FIND_QUIETLY)
+		IF (NOT CPGPLOT_INCLUDE_DIR)
+			MESSAGE (STATUS "Unable to find CPGPLOT header files!")
+		ENDIF (NOT CPGPLOT_INCLUDE_DIR)
+		IF (NOT CPGPLOT_LIBRARY)
+			MESSAGE (STATUS "Unable to find CPGPLOT library files!")
+		ENDIF (NOT CPGPLOT_LIBRARY)
+	ENDIF (NOT CPGPLOT_FIND_QUIETLY)
+ENDIF (CPGPLOT_INCLUDE_DIR AND CPGPLOT_LIBRARY)
+
+
+IF (CPGPLOT_FOUND)
+	IF (NOT CPGPLOT_FIND_QUIETLY)
+		MESSAGE (STATUS "Found components for CPGPLOT")
+		MESSAGE (STATUS "CPGPLOT_LIBRARY     = ${CPGPLOT_LIBRARY}")
+		MESSAGE (STATUS "CPGPLOT_INCLUDE_DIR = ${CPGPLOT_INCLUDE_DIR}")
+	ENDIF (NOT CPGPLOT_FIND_QUIETLY)
+ELSE (CPGPLOT_FOUND)
+	IF (CPGPLOT_FIND_REQUIRED)
+		MESSAGE (FATAL_ERROR "Could not find CPGPLOT!")
+	ENDIF (CPGPLOT_FIND_REQUIRED)
+ENDIF (CPGPLOT_FOUND)
diff --git a/cmake/modules/FindDAL.cmake b/cmake/modules/FindDAL.cmake
new file mode 100644
index 00000000000..22847e53d7d
--- /dev/null
+++ b/cmake/modules/FindDAL.cmake
@@ -0,0 +1,90 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: IO.h 393 2007-06-13 10:49:08Z baehren                               $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# Check for the presence of Data Access Library (DAL).
+#
+# The following variables are set when DAL is found:
+#  HAVE_DAL       = Set to true, if all components of DAL have been found.
+#  DAL_INCLUDES   = Include path for the header files of DAL
+#  DAL_LIBRARIES  = Link these to use DAL
+#  DAL_LFGLAS     = Linker flags (optional)
+
+## -----------------------------------------------------------------------------
+## Search locations
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+find_path (DAL_INCLUDES dal.h dalData.h dalFilter.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES dal
+  NO_DEFAULT_PATH
+  )
+
+get_filename_component (DAL_INCLUDES ${DAL_INCLUDES} ABSOLUTE)
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+find_library (DAL_LIBRARIES dal
+  PATHS ${lib_locations}
+  NO_DEFAULT_PATH
+  )
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+if (DAL_INCLUDES AND DAL_LIBRARIES)
+  set (HAVE_DAL TRUE)
+else (DAL_INCLUDES AND DAL_LIBRARIES)
+  set (HAVE_DAL FALSE)
+  if (NOT DAL_FIND_QUIETLY)
+    if (NOT DAL_INCLUDES)
+      message (STATUS "Unable to find DAL header files!")
+    endif (NOT DAL_INCLUDES)
+    if (NOT DAL_LIBRARIES)
+      message (STATUS "Unable to find DAL library files!")
+    endif (NOT DAL_LIBRARIES)
+  endif (NOT DAL_FIND_QUIETLY)
+endif (DAL_INCLUDES AND DAL_LIBRARIES)
+
+if (HAVE_DAL)
+  if (NOT DAL_FIND_QUIETLY)
+    message (STATUS "Found components for DAL")
+    message (STATUS "DAL_INCLUDES  = ${DAL_INCLUDES}")
+    message (STATUS "DAL_LIBRARIES = ${DAL_LIBRARIES}")
+  endif (NOT DAL_FIND_QUIETLY)
+else (HAVE_DAL)
+  if (DAL_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find DAL!")
+  endif (DAL_FIND_REQUIRED)
+endif (HAVE_DAL)
+
+## -----------------------------------------------------------------------------
+## Mark advanced variables
+
+mark_as_advanced (
+  DAL_INCLUDES
+  DAL_LIBRARIES
+  )
diff --git a/cmake/modules/FindFFTW3.cmake b/cmake/modules/FindFFTW3.cmake
new file mode 100644
index 00000000000..f368ce16d85
--- /dev/null
+++ b/cmake/modules/FindFFTW3.cmake
@@ -0,0 +1,86 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: FindFFTW3.cmake 1643 2008-06-14 10:19:20Z baehren                   $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of FFTW3
+#
+# The following variables are set when FFTW3 is found:
+#  HAVE_FFTW3       = Set to true, if all components of FFTW3 have been found.
+#  FFTW3_INCLUDES   = Include path for the header files of FFTW3
+#  FFTW3_LIBRARIES  = Link these to use FFTW3
+
+## -----------------------------------------------------------------------------
+## Search locations
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+FIND_PATH (FFTW3_INCLUDES fftw3.h
+  PATHS
+  ${include_locations}
+  /opt/aips++/local/include
+  /var/chroot/meqtrees/usr/include/fftw3.h
+  /opt/aips++/local/lib
+  /var/chroot/meqtrees/usr/lib
+  )
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+FIND_LIBRARY (FFTW3_LIBRARIES fftw3 fftw
+  PATHS
+  ${lib_locations}
+  )
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+IF (FFTW3_INCLUDES AND FFTW3_LIBRARIES)
+  SET (HAVE_FFTW3 TRUE)
+ELSE (FFTW3_INCLUDES AND FFTW3_LIBRARIES)
+  SET (HAVE_FFTW3 FALSE)
+  IF (NOT FFTW3_FIND_QUIETLY)
+    IF (NOT FFTW3_INCLUDES)
+      MESSAGE (STATUS "Unable to find FFTW3 header files!")
+    ENDIF (NOT FFTW3_INCLUDES)
+    IF (NOT FFTW3_LIBRARIES)
+      MESSAGE (STATUS "Unable to find FFTW3 library files!")
+    ENDIF (NOT FFTW3_LIBRARIES)
+  ENDIF (NOT FFTW3_FIND_QUIETLY)
+ENDIF (FFTW3_INCLUDES AND FFTW3_LIBRARIES)
+
+IF (HAVE_FFTW3)
+  IF (NOT FFTW3_FIND_QUIETLY)
+    MESSAGE (STATUS "Found components for FFTW3")
+    MESSAGE (STATUS "FFTW3_INCLUDES  = ${FFTW3_INCLUDES}")
+    MESSAGE (STATUS "FFTW3_LIBRARIES = ${FFTW3_LIBRARIES}")
+  ENDIF (NOT FFTW3_FIND_QUIETLY)
+ELSE (HAVE_FFTW3)
+  IF (FFTW3_FIND_REQUIRED)
+    MESSAGE (FATAL_ERROR "Could not find FFTW3!")
+  ENDIF (FFTW3_FIND_REQUIRED)
+ENDIF (HAVE_FFTW3)
+
+## ------------------------------------------------------------------------------
+## Mark as advanced ...
+
diff --git a/cmake/modules/FindG2C.cmake b/cmake/modules/FindG2C.cmake
new file mode 100644
index 00000000000..a5686888f7f
--- /dev/null
+++ b/cmake/modules/FindG2C.cmake
@@ -0,0 +1,117 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: FindG2C.cmake 1643 2008-06-14 10:19:20Z baehren                     $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+## -----------------------------------------------------------------------------
+# - Check for the presence of G2C
+#
+# The following variables are set when G2C is found:
+#  HAVE_G2C       = Set to true, if all components of G2C have been found.
+#  G2C_INCLUDES   = Include path for the header files of G2C
+#  G2C_LIBRARIES  = Link these to use G2C
+## -----------------------------------------------------------------------------
+
+## -----------------------------------------------------------------------------
+## Search locations
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+find_path (G2C_INCLUDES g2c.h f2c.h
+  PATHS ${include_locations} /usr/lib/gcc /usr/lib/gcc-lib
+  PATH_SUFFIXES
+  i486-linux/3.3.5/include
+  i586-suse-linux/3.3.3/include
+  i586-suse-linux/3.3.4/include
+  i586-suse-linux/3.3.5/include
+  x86_64-redhat-linux/3.4.3/include
+  i386-redhat-linux/3.4.6/include
+  )
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+if (UNIX)
+  if (APPLE)
+    IF (${CMAKE_OSX_ARCHITECTURES} MATCHES "ppc")
+      list (APPEND lib_locations
+	/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/powerpc-apple-darwin8/4.0.0
+	/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/powerpc-apple-darwin8/4.0.1
+	)
+    ELSE (${CMAKE_OSX_ARCHITECTURES} MATCHES "ppc")
+      list (APPEND lib_locations
+	/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin8/4.0.0
+	/Developer/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin8/4.0.1
+	)
+    ENDIF (${CMAKE_OSX_ARCHITECTURES} MATCHES "ppc")
+  else (APPLE)
+    list (APPEND lib_locations
+      /usr/lib/gcc/i386-redhat-linux/3.4.6
+      /usr/lib/gcc/x86_64-redhat-linux/3.4.3/32
+      /usr/lib/gcc/x86_64-redhat-linux/3.4.3
+      )
+  endif (APPLE)
+endif (UNIX)
+
+find_library (G2C_LIBRARIES
+  NAMES gfortran f2c g2c gcc
+  PATHS ${lib_locations}
+  NO_DEFAULT_PATH
+  )
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+if (G2C_INCLUDES AND G2C_LIBRARIES)
+  set (HAVE_G2C TRUE)
+else (G2C_INCLUDES AND G2C_LIBRARIES)
+  set (HAVE_G2C FALSE)
+  if (NOT G2C_FIND_QUIETLY)
+    if (NOT G2C_INCLUDES)
+      message (STATUS "Unable to find G2C header files!")
+    endif (NOT G2C_INCLUDES)
+    if (NOT G2C_LIBRARIES)
+      message (STATUS "Unable to find G2C library files!")
+    endif (NOT G2C_LIBRARIES)
+  endif (NOT G2C_FIND_QUIETLY)
+endif (G2C_INCLUDES AND G2C_LIBRARIES)
+
+if (HAVE_G2C)
+  if (NOT G2C_FIND_QUIETLY)
+    message (STATUS "Found components for G2C")
+    message (STATUS "G2C_INCLUDES  = ${G2C_INCLUDES}")
+    message (STATUS "G2C_LIBRARIES = ${G2C_LIBRARIES}")
+  endif (NOT G2C_FIND_QUIETLY)
+else (HAVE_G2C)
+  if (G2C_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find G2C!")
+  endif (G2C_FIND_REQUIRED)
+endif (HAVE_G2C)
+
+## -----------------------------------------------------------------------------
+## Mark as advanced ...
+
+MARK_AS_ADVANCED (
+  G2C_INCLUDES
+  G2C_LIBRARIES
+  )
diff --git a/cmake/modules/FindGIF.cmake b/cmake/modules/FindGIF.cmake
new file mode 100644
index 00000000000..54afe92f6e5
--- /dev/null
+++ b/cmake/modules/FindGIF.cmake
@@ -0,0 +1,88 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: IO.h 393 2007-06-13 10:49:08Z baehren                               $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of GIF
+#
+# The following variables are set when GIF is found:
+#  HAVE_GIF       = Set to true, if all components of GIF have been found.
+#  GIF_INCLUDES   = Include path for the header files of GIF
+#  GIF_LIBRARIES  = Link these to use GIF
+#  GIF_LFGLAS     = Linker flags (optional)
+
+## -----------------------------------------------------------------------------
+## Search locations
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+find_path (GIF_INCLUDES gif.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES gif
+  NO_DEFAULT_PATH
+  )
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+find_library (GIF_LIBRARIES gif
+  PATHS ${lib_locations}
+  NO_DEFAULT_PATH
+  )
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+if (GIF_INCLUDES AND GIF_LIBRARIES)
+  set (HAVE_GIF TRUE)
+else (GIF_INCLUDES AND GIF_LIBRARIES)
+  set (HAVE_GIF FALSE)
+  if (NOT GIF_FIND_QUIETLY)
+    if (NOT GIF_INCLUDES)
+      message (STATUS "Unable to find GIF header files!")
+    endif (NOT GIF_INCLUDES)
+    if (NOT GIF_LIBRARIES)
+      message (STATUS "Unable to find GIF library files!")
+    endif (NOT GIF_LIBRARIES)
+  endif (NOT GIF_FIND_QUIETLY)
+endif (GIF_INCLUDES AND GIF_LIBRARIES)
+
+if (HAVE_GIF)
+  if (NOT GIF_FIND_QUIETLY)
+    message (STATUS "Found components for GIF")
+    message (STATUS "GIF_INCLUDES  = ${GIF_INCLUDES}")
+    message (STATUS "GIF_LIBRARIES = ${GIF_LIBRARIES}")
+  endif (NOT GIF_FIND_QUIETLY)
+else (HAVE_GIF)
+  if (GIF_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find GIF!")
+  endif (GIF_FIND_REQUIRED)
+endif (HAVE_GIF)
+
+## -----------------------------------------------------------------------------
+## Mark advanced variables
+
+mark_as_advanced (
+  GIF_INCLUDES
+  GIF_LIBRARIES
+  )
diff --git a/cmake/modules/FindGLIB.cmake b/cmake/modules/FindGLIB.cmake
new file mode 100644
index 00000000000..09d1b5c8d65
--- /dev/null
+++ b/cmake/modules/FindGLIB.cmake
@@ -0,0 +1,123 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: IO.h 393 2007-06-13 10:49:08Z baehren                               $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of GLIB
+#
+# The following variables are set when GLIB is found:
+#  HAVE_GLIB       = Set to true, if all components of GLIB have been found.
+#  GLIB_INCLUDES   = Include path for the header files of GLIB
+#  GLIB_LIBRARIES  = Link these to use GLIB
+#  GLIB_LFGLAS     = Linker flags (optional)
+
+## -----------------------------------------------------------------------------
+## Search locations
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+## [1] find the main header file
+
+find_path (GLIB_INCLUDES glib.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES
+  glib
+  glib/include
+  glib-2.0
+  glib-2.0/glib
+  glib-2.0/include
+  NO_DEFAULT_PATH
+  )
+
+## adjust the include path
+
+string (REGEX REPLACE "include/glib-2.0/glib" "include/glib-2.0" GLIB_INCLUDES ${GLIB_INCLUDES})
+
+## [2] further header files might be in a slightly different location
+
+find_path (glibconfig_h glibconfig.h
+  PATHS ${lib_locations}
+  PATH_SUFFIXES
+  glib
+  glib/include
+  glib-2.0
+  glib-2.0/glib
+  glib-2.0/include
+  NO_DEFAULT_PATH
+  )
+
+if (glibconfig_h)
+  message (STATUS "glibconfig.h = ${glibconfig_h}")
+  list (APPEND GLIB_INCLUDES ${glibconfig_h})
+endif (glibconfig_h)
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+find_library (GLIB_LIBRARIES glib
+  PATHS ${lib_locations}
+  PATH_SUFFIXES
+  glib
+  glib/lib
+  glib-2.0
+  glib-2.0/glib
+  glib-2.0/lib
+  NO_DEFAULT_PATH
+  )
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+if (GLIB_INCLUDES AND GLIB_LIBRARIES)
+  set (HAVE_GLIB TRUE)
+else (GLIB_INCLUDES AND GLIB_LIBRARIES)
+  set (HAVE_GLIB FALSE)
+  if (NOT GLIB_FIND_QUIETLY)
+    if (NOT GLIB_INCLUDES)
+      message (STATUS "Unable to find Glib header files!")
+    endif (NOT GLIB_INCLUDES)
+    if (NOT GLIB_LIBRARIES)
+      message (STATUS "Unable to find Glib library files!")
+    endif (NOT GLIB_LIBRARIES)
+  endif (NOT GLIB_FIND_QUIETLY)
+endif (GLIB_INCLUDES AND GLIB_LIBRARIES)
+
+if (HAVE_GLIB)
+  if (NOT GLIB_FIND_QUIETLY)
+    message (STATUS "Found components for Glib")
+    message (STATUS "GLIB_INCLUDES  = ${GLIB_INCLUDES}")
+    message (STATUS "GLIB_LIBRARIES = ${GLIB_LIBRARIES}")
+  endif (NOT GLIB_FIND_QUIETLY)
+else (HAVE_GLIB)
+  if (GLIB_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find GLIB!")
+  endif (GLIB_FIND_REQUIRED)
+endif (HAVE_GLIB)
+
+## -----------------------------------------------------------------------------
+## Mark advanced variables
+
+mark_as_advanced (
+  GLIB_INCLUDES
+  GLIB_LIBRARIES
+  )
diff --git a/cmake/modules/FindGSL.cmake b/cmake/modules/FindGSL.cmake
new file mode 100644
index 00000000000..2a894e2a09c
--- /dev/null
+++ b/cmake/modules/FindGSL.cmake
@@ -0,0 +1,109 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: FindGSL.cmake 1643 2008-06-14 10:19:20Z baehren                     $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of GSL
+#
+# The following variables are set when GSL is found:
+#  HAVE_GSL       = Set to true, if all components of GSL have been found.
+#  GSL_INCLUDES   = Include path for the header files of GSL
+#  GSL_LIBRARIES  = Link these to use GSL
+
+## -----------------------------------------------------------------------------
+## Search locations
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+find_path (GSL_INCLUDES gsl_version.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES gsl
+  NO_DEFAULT_PATH
+  )
+
+## adjust the include path to strip of the "gsl"
+string (REGEX REPLACE include/gsl include GSL_INCLUDES ${GSL_INCLUDES})
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+set (GSL_LIBRARIES "")
+
+## [1] libgsl
+
+find_library (libgsl gsl
+  PATHS ${lib_locations}
+  NO_DEFAULT_PATH
+  )
+
+if (libgsl)
+  list (APPEND GSL_LIBRARIES ${libgsl})
+endif (libgsl)
+
+## [2] libgslcblas
+
+find_library (libgslcblas gslcblas
+  PATHS ${lib_locations}
+  NO_DEFAULT_PATH
+  )
+
+if (libgslcblas)
+  list (APPEND GSL_LIBRARIES ${libgslcblas})
+endif (libgslcblas)
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+if (GSL_INCLUDES AND GSL_LIBRARIES)
+  set (HAVE_GSL TRUE)
+else (GSL_INCLUDES AND GSL_LIBRARIES)
+  set (HAVE_GSL FALSE)
+  if (NOT GSL_FIND_QUIETLY)
+    if (NOT GSL_INCLUDES)
+      message (STATUS "Unable to find GSL header files!")
+    endif (NOT GSL_INCLUDES)
+    if (NOT GSL_LIBRARIES)
+      message (STATUS "Unable to find GSL library files!")
+    endif (NOT GSL_LIBRARIES)
+  endif (NOT GSL_FIND_QUIETLY)
+endif (GSL_INCLUDES AND GSL_LIBRARIES)
+
+if (HAVE_GSL)
+  if (NOT GSL_FIND_QUIETLY)
+    message (STATUS "Found components for GSL")
+    message (STATUS "GSL_INCLUDES  = ${GSL_INCLUDES}")
+    message (STATUS "GSL_LIBRARIES = ${GSL_LIBRARIES}")
+  endif (NOT GSL_FIND_QUIETLY)
+else (HAVE_GSL)
+  if (GSL_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find GSL!")
+  endif (GSL_FIND_REQUIRED)
+endif (HAVE_GSL)
+
+## -----------------------------------------------------------------------------
+## Mark advanced variables
+
+mark_as_advanced (
+  GSL_INCLUDES
+  GSL_LIBRARIES
+  )
diff --git a/cmake/modules/FindGTK.cmake b/cmake/modules/FindGTK.cmake
new file mode 100644
index 00000000000..91b808e69f5
--- /dev/null
+++ b/cmake/modules/FindGTK.cmake
@@ -0,0 +1,141 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: IO.h 393 2007-06-13 10:49:08Z baehren                               $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of GTK
+#
+# The following variables are set when GTK is found:
+#  HAVE_GTK       = Set to true, if all components of GTK have been found.
+#  GTK_INCLUDES   = Include path for the header files of GTK
+#  GTK_LIBRARIES  = Link these to use GTK
+#  GTK_LFGLAS     = Linker flags (optional)
+
+## -----------------------------------------------------------------------------
+## Search locations
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+find_path (GTK_INCLUDES gtk.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES
+  gtk
+  gtk-2.0
+  gtk-2.0/gtk
+  NO_DEFAULT_PATH
+  )
+
+## adjust the include path
+
+string (REGEX REPLACE "include/gtk-2.0/gtk" "include/gtk-2.0" GTK_INCLUDES ${GTK_INCLUDES})
+
+## -----------------------------------------------------------------------------
+## Check for the library
+##
+## To get a list of libraries which need to be included into the linking stage,
+## run:
+##      pkg-config --cflags --libs gtk+-2.0
+##
+
+## [1] Locate the basic GTK library first
+
+find_library (GTK_LIBRARIES gtk gtk-2.0
+  PATHS ${lib_locations}
+  NO_DEFAULT_PATH
+  )
+
+## [2] Check for libgtk-x11
+
+find_library (libgtk_x11 gtk-x11 gtk-x11-2.0
+  PATHS ${lib_locations}
+  NO_DEFAULT_PATH
+  )
+
+if (libgtk_x11)
+  list (APPEND GTK_LIBRARIES ${libgtk_x11})
+endif (libgtk_x11)
+
+## [3] Check for libgdk-x11
+
+find_library (libgdk_x11 gdk-x11 gdk-x11-2.0
+  PATHS ${lib_locations}
+  NO_DEFAULT_PATH
+  )
+
+if (libgdk_x11)
+  list (APPEND GTK_LIBRARIES ${libgdk_x11})
+endif (libgdk_x11)
+
+## [4] Check for libatk
+
+find_library (libatk atk atk-1.0 atk-2.0
+  PATHS ${lib_locations}
+  NO_DEFAULT_PATH
+  )
+
+if (libatk)
+  list (APPEND GTK_LIBRARIES ${libatk})
+endif (libatk)
+
+## Once we are done, rearrange the order of the libraries in the list
+
+#if (GTK_LIBRARIES)
+#  list (REVERSE GTK_LIBRARIES)
+#endif (GTK_LIBRARIES)
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+if (GTK_INCLUDES AND GTK_LIBRARIES)
+  set (HAVE_GTK TRUE)
+else (GTK_INCLUDES AND GTK_LIBRARIES)
+  set (HAVE_GTK FALSE)
+  if (NOT GTK_FIND_QUIETLY)
+    if (NOT GTK_INCLUDES)
+      message (STATUS "Unable to find PyGtk header files!")
+    endif (NOT GTK_INCLUDES)
+    if (NOT GTK_LIBRARIES)
+      message (STATUS "Unable to find PyGtk library files!")
+    endif (NOT GTK_LIBRARIES)
+  endif (NOT GTK_FIND_QUIETLY)
+endif (GTK_INCLUDES AND GTK_LIBRARIES)
+
+if (HAVE_GTK)
+  if (NOT GTK_FIND_QUIETLY)
+    message (STATUS "Found components for PyGtk")
+    message (STATUS "GTK_INCLUDES  = ${GTK_INCLUDES}")
+    message (STATUS "GTK_LIBRARIES = ${GTK_LIBRARIES}")
+  endif (NOT GTK_FIND_QUIETLY)
+else (HAVE_GTK)
+  if (GTK_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find GTK!")
+  endif (GTK_FIND_REQUIRED)
+endif (HAVE_GTK)
+
+## -----------------------------------------------------------------------------
+## Mark advanced variables
+
+mark_as_advanced (
+  GTK_INCLUDES
+  GTK_LIBRARIES
+  )
diff --git a/cmake/modules/FindGlish.cmake b/cmake/modules/FindGlish.cmake
new file mode 100644
index 00000000000..4f3e0713796
--- /dev/null
+++ b/cmake/modules/FindGlish.cmake
@@ -0,0 +1,176 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: FindGlish.cmake 1643 2008-06-14 10:19:20Z baehren                   $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of Glish
+#
+# The following variables are set when Blitz++ is found:
+#  HAVE_GLISH      = Set to true, if all components of Glish have been found.
+#  GLISH_INCLUDES  = Include path for the header files of Glish
+#  GLISH_LIBRARIES = Link these to use Glish
+
+## -----------------------------------------------------------------------------
+## Search locations
+
+include (CMakeSettings)
+
+if (NOT casa_locations)
+  set (casa_locations
+    ## most Linux systems
+    /aips++
+    /casa
+    /opt/aips++/stable
+    /opt/aips++/current
+    /opt/aips++
+    /opt/casa
+    /opt/casa/stable
+    /opt/casa/current
+    ## Mac OS X (Fink)
+    /sw/share/aips++
+    /sw/share/casa
+    ## LOFAR development
+    /app/aips++/Stable
+    )
+endif (NOT casa_locations)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+## [1] Glish/glish.h
+
+find_path (GLISH_INCLUDES Glish/glish.h
+  PATHS ${casa_locations}
+  PATH_SUFFIXES code/aips/glish/include code/aips/glish/glish/include
+  )
+
+## [2] sos/sos.h
+
+find_path (sos_sos_h sos/sos.h
+  PATHS ${casa_locations}
+  PATH_SUFFIXES code/aips/glish/sos/include
+  )
+
+if (sos_sos_h)
+  list (APPEND GLISH_INCLUDES ${sos_sos_h})
+endif (sos_sos_h)
+
+## [2] Npd/npd.h
+
+find_path (npd_npd_h Npd/npd.h npd/npd.h
+  PATHS ${casa_locations}
+  PATH_SUFFIXES code/aips/glish/npd/include
+  )
+
+if (npd_npd_h)
+  list (APPEND GLISH_INCLUDES ${npd_npd_h})
+endif (npd_npd_h)
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+set (GLISH_LIBRARIES "")
+
+## [1] libglish
+
+find_library (libglish glish
+  PATHS ${casa_locations}
+  PATH_SUFFIXES linux/lib linux_gnu/lib
+  )
+
+if (libglish) 
+  list (APPEND GLISH_LIBRARIES ${libglish})
+endif (libglish)
+
+## [2] libsos
+
+find_library (libsos sos
+  PATHS ${casa_locations}
+  PATH_SUFFIXES linux/lib linux_gnu/lib
+  )
+
+if (libsos)
+  list (APPEND GLISH_LIBRARIES ${libsos})
+endif (libsos)
+
+## [3] libnpd
+
+find_library (libnpd npd
+  PATHS ${casa_locations}
+  PATH_SUFFIXES linux/lib linux_gnu/lib
+  )
+
+if (libnpd)
+  list (APPEND GLISH_LIBRARIES ${libnpd})
+endif (libnpd)
+
+## [4] libregx
+
+find_library (libregx regx
+  PATHS ${casa_locations}
+  PATH_SUFFIXES ${lib_locations}
+  )
+
+if (libregx)
+  list (APPEND GLISH_LIBRARIES ${libregx})
+endif (libregx)
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+SET (HAVE_GLISH FALSE)
+
+IF (GLISH_INCLUDES AND GLISH_LIBRARIES)
+  SET (HAVE_GLISH TRUE)
+ELSE (GLISH_INCLUDES AND GLISH_LIBRARIES)
+  SET (HAVE_GLISH FALSE)
+  IF (NOT GLISH_FIND_QUIETLY)
+    IF (NOT GLISH_INCLUDES)
+      MESSAGE (STATUS "Unable to find Glish header files!")
+    ENDIF (NOT GLISH_INCLUDES)
+    IF (NOT GLISH_LIBRARIES)
+      MESSAGE (STATUS "Unable to find Glish library files!")
+    ENDIF (NOT GLISH_LIBRARIES)
+  ENDIF (NOT GLISH_FIND_QUIETLY)
+ENDIF (GLISH_INCLUDES AND GLISH_LIBRARIES)
+
+IF (HAVE_GLISH)
+  IF (NOT GLISH_FIND_QUIETLY)
+    MESSAGE (STATUS "Found components for Glish")
+    MESSAGE (STATUS "GLISH_INCLUDES  = ${GLISH_INCLUDES}")
+    MESSAGE (STATUS "GLISH_LIBRARIES = ${GLISH_LIBRARIES}")
+  ENDIF (NOT GLISH_FIND_QUIETLY)
+ELSE (HAVE_GLISH)
+  IF (GLISH_FIND_REQUIRED)
+    MESSAGE (FATAL_ERROR "Could not find Glish!")
+  ENDIF (GLISH_FIND_REQUIRED)
+ENDIF (HAVE_GLISH)
+
+## -----------------------------------------------------------------------------
+## Mark as advanced ...
+
+mark_as_advanced (
+  HAVE_GLISH
+  GLISH_INCLUDES
+  GLISH_LIBRARIES
+  libglish
+  libsos
+  libnpd
+  )
diff --git a/cmake/modules/FindGlobus.cmake b/cmake/modules/FindGlobus.cmake
new file mode 100644
index 00000000000..644c17c3542
--- /dev/null
+++ b/cmake/modules/FindGlobus.cmake
@@ -0,0 +1,79 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: FindGlobus.cmake 1643 2008-06-14 10:19:20Z baehren                  $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of Globus
+#
+# The following variables are set when Globus is found:
+#  HAVE_Globus       = Set to true, if all components of Globus
+#                          have been found.
+#  Globus_INCLUDES   = Include path for the header files of Globus
+#  Globus_LIBRARIES  = Link these to use Globus
+
+## -----------------------------------------------------------------------------
+## Search locations
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+find_path (Globus_INCLUDES globus.h
+  PATHS ${include_locations}
+  )
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+find_library (Globus_LIBRARIES globus
+  PATHS ${lib_locations}
+  )
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+if (Globus_INCLUDES AND Globus_LIBRARIES)
+  set (HAVE_Globus TRUE)
+else (Globus_INCLUDES AND Globus_LIBRARIES)
+  if (NOT Globus_FIND_QUIETLY)
+    if (NOT Globus_INCLUDES)
+      message (STATUS "Unable to find Globus header files!")
+    endif (NOT Globus_INCLUDES)
+    if (NOT Globus_LIBRARIES)
+      message (STATUS "Unable to find Globus library files!")
+    endif (NOT Globus_LIBRARIES)
+  endif (NOT Globus_FIND_QUIETLY)
+endif (Globus_INCLUDES AND Globus_LIBRARIES)
+
+if (HAVE_Globus)
+  if (NOT Globus_FIND_QUIETLY)
+    message (STATUS "Found components for Globus")
+    message (STATUS "Globus_INCLUDES  = ${Globus_INCLUDES}")
+    message (STATUS "Globus_LIBRARIES = ${Globus_LIBRARIES}")
+  endif (NOT Globus_FIND_QUIETLY)
+else (HAVE_Globus)
+  if (Globus_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find Globus!")
+  endif (Globus_FIND_REQUIRED)
+endif (HAVE_Globus)
+
+## -----------------------------------------------------------------------------
+## Mark as advanced ...
diff --git a/cmake/modules/FindHDF5.cmake b/cmake/modules/FindHDF5.cmake
new file mode 100644
index 00000000000..72db8ddda32
--- /dev/null
+++ b/cmake/modules/FindHDF5.cmake
@@ -0,0 +1,153 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: FindHDF5.cmake 1653 2008-06-19 08:05:05Z baehren                    $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of HDF5
+#
+# The following variables are set when HDF5 is found:
+#  HAVE_HDF5            = Set to true, if all components of HDF5 have been found.
+#  HDF5_INCLUDES        = Include path for the header files of HDF5
+#  HDF5_LIBRARIES       = Link these to use HDF5
+#  HDF5_MAJOR_VERSION   = Major version of the HDF5 library
+#  HDF5_MINOR_VERSION   = Minor version of the HDF5 library
+#  HDF5_RELEASE_VERSION = Release version of the HDF5 library
+
+## -----------------------------------------------------------------------------
+## Search locations
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+find_path (HDF5_INCLUDES hdf5.h H5LT.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES hdf5
+  NO_DEFAULT_PATH
+  )
+
+## -----------------------------------------------------------------------------
+## Check for the library components
+
+## [1] Core library
+
+find_library (libhdf5
+  NAMES hdf5
+  PATHS ${lib_locations}
+  PATH_SUFFIXES hdf5
+  NO_DEFAULT_PATH
+)
+
+if (libhdf5)
+  set (HDF5_LIBRARIES ${libhdf5})
+endif (libhdf5)
+
+## [2] Additional libraries
+
+FIND_LIBRARY (libhdf5_hl
+  NAMES hdf5_hl
+  PATHS ${lib_locations}
+  PATH_SUFFIXES hdf5
+  NO_DEFAULT_PATH
+)
+
+if (libhdf5_hl)
+  list (APPEND HDF5_LIBRARIES ${libhdf5_hl})
+endif (libhdf5_hl)
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+if (HDF5_INCLUDES AND HDF5_LIBRARIES)
+  set (HAVE_HDF5 TRUE)
+else (HDF5_INCLUDES AND HDF5_LIBRARIES)
+  set (HAVE_HDF5 FALSE)
+  if (NOT HDF5_FIND_QUIETLY)
+    if (NOT HDF5_INCLUDES)
+      message (STATUS "Unable to find HDF5 header files!")
+    endif (NOT HDF5_INCLUDES)
+    if (NOT HDF5_LIBRARIES)
+      message (STATUS "Unable to find HDF5 library files!")
+    endif (NOT HDF5_LIBRARIES)
+  endif (NOT HDF5_FIND_QUIETLY)
+endif (HDF5_INCLUDES AND HDF5_LIBRARIES)
+
+## -----------------------------------------------------------------------------
+## Determine library version
+
+if (HAVE_HDF5)
+
+  list (APPEND CMAKE_REQUIRED_LIBRARIES ${HDF5_LIBRARIES})
+  
+  try_run (var_exit var_compiled
+    ${CMAKE_BINARY_DIR}
+    ${CMAKE_MODULE_PATH}/TestHDF5Version.cc
+    COMPILE_DEFINITIONS -I${HDF5_INCLUDES}
+    CMAKE_FLAGS -DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}
+    COMPILE_OUTPUT_VARIABLE var_compile
+    RUN_OUTPUT_VARIABLE var_run
+    )
+
+  ## process the output of the test program
+
+  string (REGEX MATCH "maj=.*:min" HDF5_MAJOR_VERSION ${var_run})
+  string (REGEX REPLACE "maj=" "" HDF5_MAJOR_VERSION ${HDF5_MAJOR_VERSION})
+  string (REGEX REPLACE ":min" "" HDF5_MAJOR_VERSION ${HDF5_MAJOR_VERSION})
+  
+  string (REGEX MATCH "min=.*:rel" HDF5_MINOR_VERSION ${var_run})
+  string (REGEX REPLACE "min=" "" HDF5_MINOR_VERSION ${HDF5_MINOR_VERSION})
+  string (REGEX REPLACE ":rel" "" HDF5_MINOR_VERSION ${HDF5_MINOR_VERSION})
+
+  string (REGEX MATCH "rel=.*:" HDF5_RELEASE_VERSION ${var_run})
+  string (REGEX REPLACE "rel=" "" HDF5_RELEASE_VERSION ${HDF5_RELEASE_VERSION})
+  string (REGEX REPLACE ":" "" HDF5_RELEASE_VERSION ${HDF5_RELEASE_VERSION})
+  
+endif (HAVE_HDF5)
+
+## -----------------------------------------------------------------------------
+## Feedback
+
+if (HAVE_HDF5)
+  if (NOT HDF5_FIND_QUIETLY)
+    message (STATUS "Found components for HDF5")
+    message (STATUS "HDF5_INCLUDES        = ${HDF5_INCLUDES}")
+    message (STATUS "HDF5_LIBRARIES       = ${HDF5_LIBRARIES}")
+    message (STATUS "HDF5_MAJOR_VERSION   = ${HDF5_MAJOR_VERSION}")
+    message (STATUS "HDF5_MINOR_VERSION   = ${HDF5_MINOR_VERSION}")
+    message (STATUS "HDF5_RELEASE_VERSION = ${HDF5_RELEASE_VERSION}")
+  endif (NOT HDF5_FIND_QUIETLY)
+else (HAVE_HDF5)
+  if (HDF5_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find HDF5!")
+  endif (HDF5_FIND_REQUIRED)
+endif (HAVE_HDF5)
+
+## -----------------------------------------------------------------------------
+## Mark as advanced ...
+
+mark_as_advanced (
+  HDF5_INCLUDES
+  HDF5_LIBRARIES
+  HDF5_MAJOR_VERSION
+  HDF5_MINOR_VERSION
+  libhdf5
+  libhdf5_hl
+)
diff --git a/cmake/modules/FindLAPACK.cmake b/cmake/modules/FindLAPACK.cmake
new file mode 100644
index 00000000000..c53560417e3
--- /dev/null
+++ b/cmake/modules/FindLAPACK.cmake
@@ -0,0 +1,106 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: FindLAPACK.cmake 1643 2008-06-14 10:19:20Z baehren                  $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+## -----------------------------------------------------------------------------
+## Check for the presence of LAPACK
+##
+## The following variables are set when LAPACK is found:
+##  HAVE_LAPACK     - Set to true, if all components of LAPACK have been found.
+##  LAPACK_LIBRARIES - Link these to use LAPACK
+##  LAPACK_INCLUDES  - Location of the LAPACK header files
+
+## -----------------------------------------------------------------------------
+## Search locations
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+find_path (LAPACK_INCLUDES clapack.h
+  PATHS
+  ${include_locations}
+  /Developer/SDKs/MacOSX10.4u.sdk/usr/include
+  /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/Headers
+)
+
+## -----------------------------------------------------------------------------
+## Check for the library files (-llapack -lblas -lcblas -latlas)
+
+set (libs
+  lapack
+  cblas
+  blas
+  atlas
+  )
+
+set (LAPACK_LIBRARIES "")
+
+foreach (lib ${libs})
+  ## try to locate the library
+  find_library (LAPACK_${lib} ${lib} ${lib}_LINUX
+    PATHS
+	${lib_locations}
+    /Developer/SDKs/MacOSX10.4u.sdk/usr/lib
+    PATH_SUFFIXES lapack
+    NO_DEFAULT_PATH
+    )
+  ## check if location was successful
+  if (LAPACK_${lib})
+    list (APPEND LAPACK_LIBRARIES ${LAPACK_${lib}})
+  endif (LAPACK_${lib})
+endforeach (lib)
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+IF (LAPACK_LIBRARIES)
+  SET (HAVE_LAPACK TRUE)
+ELSE (LAPACK_LIBRARIES)
+  IF (NOT LAPACK_FIND_QUIETLY)
+    IF (NOT LAPACK_LIBRARIES)
+      MESSAGE (STATUS "Unable to find LAPACK library files!")
+    ENDIF (NOT LAPACK_LIBRARIES)
+  ENDIF (NOT LAPACK_FIND_QUIETLY)
+ENDIF (LAPACK_LIBRARIES)
+
+IF (HAVE_LAPACK)
+  IF (NOT LAPACK_FIND_QUIETLY)
+    MESSAGE (STATUS "Found components for LAPACK")
+    MESSAGE (STATUS "LAPACK_INCLUDES  = ${LAPACK_INCLUDES}")
+    MESSAGE (STATUS "LAPACK_LIBRARIES = ${LAPACK_LIBRARIES}")
+  ENDIF (NOT LAPACK_FIND_QUIETLY)
+ELSE (HAVE_LAPACK)
+  IF (LAPACK_FIND_REQUIRED)
+    MESSAGE (FATAL_ERROR "Could not find LAPACK!")
+  ENDIF (LAPACK_FIND_REQUIRED)
+ENDIF (HAVE_LAPACK)
+
+## -----------------------------------------------------------------------------
+## Mark as advanced...
+
+MARK_AS_ADVANCED (
+  LAPACK_atlas
+  LAPACK_blas
+  LAPACK_cblas
+  LAPACK_lapack
+  )
diff --git a/cmake/modules/FindLibxml2.cmake b/cmake/modules/FindLibxml2.cmake
new file mode 100644
index 00000000000..0062aa8b388
--- /dev/null
+++ b/cmake/modules/FindLibxml2.cmake
@@ -0,0 +1,88 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: FindLibxml2.cmake 1643 2008-06-14 10:19:20Z baehren                 $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+#
+# this module look for libxml (http://www.xmlsoft.org) support
+# it will define the following values
+#
+# LIBXML2_INCLUDES  = where libxml/xpath.h can be found
+# LIBXML2_LIBRARIES      = the library to link against libxml2
+# FOUND_LIBXML2        = set to 1 if libxml2 is found
+#
+
+## -----------------------------------------------------------------------------
+## Search locations
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+FIND_PATH (LIBXML2_INCLUDES xpath.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES libxml libxml2
+  )
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+FIND_LIBRARY (LIBXML2_LIBRARIES xml2
+  PATHS ${lib_locations}
+  PATH_SUFFIXES libxml libxml2
+  )
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+IF (LIBXML2_INCLUDES AND LIBXML2_LIBRARIES)
+  SET (HAVE_LIBXML2 TRUE)
+ELSE (LIBXML2_INCLUDES AND LIBXML2_LIBRARIES)
+  SET (HAVE_LIBXML2 FALSE)
+  IF (NOT LIBXML2_FIND_QUIETLY)
+    IF (NOT LIBXML2_INCLUDES)
+      MESSAGE (STATUS "Unable to find LIBXML2 header files!")
+    ENDIF (NOT LIBXML2_INCLUDES)
+    IF (NOT LIBXML2_LIBRARIES)
+      MESSAGE (STATUS "Unable to find LIBXML2 library files!")
+    ENDIF (NOT LIBXML2_LIBRARIES)
+  ENDIF (NOT LIBXML2_FIND_QUIETLY)
+ENDIF (LIBXML2_INCLUDES AND LIBXML2_LIBRARIES)
+
+IF (HAVE_LIBXML2)
+  IF (NOT LIBXML2_FIND_QUIETLY)
+    MESSAGE (STATUS "Found components for LIBXML2")
+    MESSAGE (STATUS "LIBXML2_INCLUDES  = ${LIBXML2_INCLUDES}")
+    MESSAGE (STATUS "LIBXML2_LIBRARIES = ${LIBXML2_LIBRARIES}")
+  ENDIF (NOT LIBXML2_FIND_QUIETLY)
+ELSE (HAVE_LIBXML2)
+  IF (LIBXML2_FIND_REQUIRED)
+    MESSAGE (FATAL_ERROR "Could not find LIBXML2!")
+  ENDIF (LIBXML2_FIND_REQUIRED)
+ENDIF (HAVE_LIBXML2)
+
+## -----------------------------------------------------------------------------
+## Mark advanced variables
+
+mark_as_advanced (
+  LIBXML2_INCLUDES
+  LIBXML2_LIBRARIES
+  )
diff --git a/cmake/modules/FindLog4CPlus.cmake b/cmake/modules/FindLog4CPlus.cmake
new file mode 100644
index 00000000000..086918d46aa
--- /dev/null
+++ b/cmake/modules/FindLog4CPlus.cmake
@@ -0,0 +1,91 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: IO.h 393 2007-06-13 10:49:08Z gels                                  $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Martin Gels (gels@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# Check for the presence of log4CPlus (LOG4CPLUS).
+#
+# The following variables are set when LOG4CPLUS is found:
+#  Log4CPlus_FOUND      = Set to true, if all components of LOG4CPLUS have been found.
+#  LOG4CPLUS_INCLUDES   = Include path for the header files of LOG4CPLUS
+#  LOG4CPLUS_LIBRARIES  = Link these to use LOG4CPLUS
+#  LOG4CPLUS_LFGLAS     = Linker flags (optional)
+
+## -----------------------------------------------------------------------------
+## Search locations
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+find_path (LOG4CPLUS_INCLUDES log4cplus/logger.h
+  PATHS ${include_locations}
+  /usr/local/log4cplus/gnu/include
+  NO_DEFAULT_PATH
+  )
+
+get_filename_component (LOG4CPLUS_INCLUDES ${LOG4CPLUS_INCLUDES} ABSOLUTE)
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+find_library (LOG4CPLUS_LIBRARIES liblog4cplus.so
+  PATHS ${lib_locations}
+  /usr/local/log4cplus/gnu/lib64/
+  NO_DEFAULT_PATH
+  )
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+if (LOG4CPLUS_INCLUDES AND LOG4CPLUS_LIBRARIES)
+  set (Log4CPlus_FOUND TRUE)
+else (LOG4CPLUS_INCLUDES AND LOG4CPLUS_LIBRARIES)
+  set (Log4CPlus_FOUND FALSE)
+  if (NOT LOG4CPLUS_FIND_QUIETLY)
+    if (NOT LOG4CPLUS_INCLUDES)
+      message (STATUS "Unable to find LOG4CPLUS header files!")
+    endif (NOT LOG4CPLUS_INCLUDES)
+    if (NOT LOG4CPLUS_LIBRARIES)
+      message (STATUS "Unable to find LOG4CPLUS library files!")
+    endif (NOT LOG4CPLUS_LIBRARIES)
+  endif (NOT LOG4CPLUS_FIND_QUIETLY)
+endif (LOG4CPLUS_INCLUDES AND LOG4CPLUS_LIBRARIES)
+
+if (Log4CPlus_FOUND)
+  if (NOT LOG4CPLUS_FIND_QUIETLY)
+    message (STATUS "Found components for LOG4CPLUS")
+    message (STATUS "LOG4CPLUS_INCLUDES  = ${LOG4CPLUS_INCLUDES}")
+    message (STATUS "LOG4CPLUS_LIBRARIES = ${LOG4CPLUS_LIBRARIES}")
+  endif (NOT LOG4CPLUS_FIND_QUIETLY)
+else (Log4CPlus_FOUND)
+  if (LOG4CPLUS_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find LOG4CPLUS!")
+  endif (LOG4CPLUS_FIND_REQUIRED)
+endif (Log4CPlus_FOUND)
+
+## -----------------------------------------------------------------------------
+## Mark advanced variables
+
+mark_as_advanced (
+  LOG4CPLUS_INCLUDES
+  LOG4CPLUS_LIBRARIES
+  )
diff --git a/cmake/modules/FindMPI.cmake b/cmake/modules/FindMPI.cmake
new file mode 100644
index 00000000000..03e95ef7149
--- /dev/null
+++ b/cmake/modules/FindMPI.cmake
@@ -0,0 +1,308 @@
+# - Message Passing Interface (MPI) module.
+# 
+# The Message Passing Interface (MPI) is a library used to write
+# high-performance parallel applications that use message passing, and
+# is typically deployed on a cluster. MPI is a standard interface
+# (defined by the MPI forum) for which many implementations are
+# available. All of these implementations have somewhat different
+# compilation approaches (different include paths, libraries to link
+# against, etc.), and this module tries to smooth out those differences.
+#
+# This module will set the following variables:
+#   MPI_FOUND                  TRUE if we have found MPI
+#   MPI_COMPILE_FLAGS          Compilation flags for MPI programs
+#   MPI_INCLUDE_PATH           Include path(s) for MPI header
+#   MPI_LINK_FLAGS             Linking flags for MPI programs
+#   MPI_LIBRARY                First MPI library to link against (cached)
+#   MPI_EXTRA_LIBRARY          Extra MPI libraries to link against (cached)
+#   MPI_LIBRARIES              All libraries to link MPI programs against
+#   MPIEXEC                    Executable for running MPI programs
+#   MPIEXEC_NUMPROC_FLAG       Flag to pass to MPIEXEC before giving it the
+#                              number of processors to run on
+#   MPIEXEC_PREFLAGS           Flags to pass to MPIEXEC directly before the
+#                              executable to run.
+#   MPIEXEC_POSTFLAGS          Flags to pass to MPIEXEC after all other flags.
+#
+# This module will attempt to auto-detect these settings, first by
+# looking for a MPI compiler, which many MPI implementations provide
+# as a pass-through to the native compiler to simplify the compilation
+# of MPI programs. The MPI compiler is stored in the cache variable
+# MPI_COMPILER, and will attempt to look for commonly-named drivers
+# mpic++, mpicxx, mpiCC, or mpicc. If the compiler driver is found and
+# recognized, it will be used to set all of the module variables. To
+# skip this auto-detection, set MPI_LIBRARY and MPI_INCLUDE_PATH in
+# the CMake cache.
+#
+# If no compiler driver is found or the compiler driver is not
+# recognized, this module will then search for common include paths
+# and library names to try to detect MPI. 
+#
+# If CMake initially finds a different MPI than was intended, and you
+# want to use the MPI compiler auto-detection for a different MPI
+# implementation, set MPI_COMPILER to the MPI compiler driver you want
+# to use (e.g., mpicxx) and then set MPI_LIBRARY to the string
+# MPI_LIBRARY-NOTFOUND. When you re-configure, auto-detection of MPI
+# will run again with the newly-specified MPI_COMPILER.
+#
+# When using MPIEXEC to execute MPI applications, you should typically
+# use all of the MPIEXEC flags as follows:
+#   ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} PROCS ${MPIEXEC_PREFLAGS} EXECUTABLE
+#     ${MPIEXEC_POSTFLAGS} ARGS
+# where PROCS is the number of processors on which to execute the program,
+# EXECUTABLE is the MPI program, and ARGS are the arguments to pass to the 
+# MPI program.
+
+# Try to find the MPI driver program
+find_program(MPI_COMPILER 
+  NAMES mpic++ mpicxx mpiCC mpicc
+  DOC "MPI compiler. Used only to detect MPI compilation flags.")
+mark_as_advanced(MPI_COMPILER)
+
+find_program(MPIEXEC
+  NAMES mpiexec mpirun lamexec
+  DOC "Executable for running MPI programs.")
+
+set(MPIEXEC_NUMPROC_FLAG "-np" CACHE STRING "Flag used by MPI to specify the number of processes for MPIEXEC; the next option will be the number of processes.")
+set(MPIEXEC_PREFLAGS "" CACHE STRING "These flags will be directly before the executable that is being run by MPIEXEC.")
+set(MPIEXEC_POSTFLAGS "" CACHE STRING "These flags will come after all flags given to MPIEXEC.")
+set(MPIEXEC_MAX_NUMPROCS "2" CACHE STRING "Maximum number of processors available to run MPI applications.")
+mark_as_advanced(MPIEXEC MPIEXEC_NUMPROC_FLAG MPIEXEC_PREFLAGS 
+  MPIEXEC_POSTFLAGS MPIEXEC_MAX_NUMPROCS)
+
+if (MPI_INCLUDE_PATH AND MPI_LIBRARY)
+  # Do nothing: we already have MPI_INCLUDE_PATH and MPI_LIBRARY in
+  # the cache, and we don't want to override those settings.
+elseif (MPI_COMPILER)
+  # Check whether the -showme:compile option works. This indicates
+  # that we have either Open MPI or a newer version of LAM-MPI, and
+  # implies that -showme:link will also work.
+  exec_program(${MPI_COMPILER} 
+    ARGS -showme:compile 
+    OUTPUT_VARIABLE MPI_COMPILE_CMDLINE
+    RETURN_VALUE MPI_COMPILER_RETURN)
+
+  if (MPI_COMPILER_RETURN EQUAL 0)
+    # If we appear to have -showme:compile, then we should also have
+    # -showme:link. Try it.
+    exec_program(${MPI_COMPILER} 
+      ARGS -showme:link
+      OUTPUT_VARIABLE MPI_LINK_CMDLINE
+      RETURN_VALUE MPI_COMPILER_RETURN)
+
+    # Note that we probably have -showme:incdirs and -showme:libdirs
+    # as well.
+    set(MPI_COMPILER_MAY_HAVE_INCLIBDIRS TRUE)
+  endif (MPI_COMPILER_RETURN EQUAL 0)
+
+  if (MPI_COMPILER_RETURN EQUAL 0)
+    # Do nothing: we have our command lines now
+  else (MPI_COMPILER_RETURN EQUAL 0)
+    # Older versions of LAM-MPI have "-showme". Try it.
+    exec_program(${MPI_COMPILER} 
+      ARGS -showme
+      OUTPUT_VARIABLE MPI_COMPILE_CMDLINE
+      RETURN_VALUE MPI_COMPILER_RETURN)
+  endif (MPI_COMPILER_RETURN EQUAL 0)  
+
+  if (MPI_COMPILER_RETURN EQUAL 0)
+    # Do nothing: we have our command lines now
+  else (MPI_COMPILER_RETURN EQUAL 0)
+    # MPICH uses "-show". Try it.
+    exec_program(${MPI_COMPILER} 
+      ARGS -show
+      OUTPUT_VARIABLE MPI_COMPILE_CMDLINE
+      RETURN_VALUE MPI_COMPILER_RETURN)
+  endif (MPI_COMPILER_RETURN EQUAL 0)  
+
+  if (MPI_COMPILER_RETURN EQUAL 0)
+    # We have our command lines, but we might need to copy
+    # MPI_COMPILE_CMDLINE into MPI_LINK_CMDLINE, if the underlying
+    if (NOT MPI_LINK_CMDLINE)
+      SET(MPI_LINK_CMDLINE ${MPI_COMPILE_CMDLINE})
+    endif (NOT MPI_LINK_CMDLINE)
+  else (MPI_COMPILER_RETURN EQUAL 0)
+    message(STATUS "Unable to determine MPI from MPI driver ${MPI_COMPILER}")
+  endif (MPI_COMPILER_RETURN EQUAL 0)
+endif (MPI_INCLUDE_PATH AND MPI_LIBRARY)
+
+if (MPI_INCLUDE_PATH AND MPI_LIBRARY)
+  # Do nothing: we already have MPI_INCLUDE_PATH and MPI_LIBRARY in
+  # the cache, and we don't want to override those settings.
+elseif (MPI_COMPILE_CMDLINE)
+  # Extract compile flags from the compile command line.
+  string(REGEX MATCHALL "-D([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_FLAGS "${MPI_COMPILE_CMDLINE}")
+  set(MPI_COMPILE_FLAGS_WORK)
+  foreach(FLAG ${MPI_ALL_COMPILE_FLAGS})
+    if (MPI_COMPILE_FLAGS_WORK)
+      set(MPI_COMPILE_FLAGS_WORK "${MPI_COMPILE_FLAGS_WORK} ${FLAG}")
+    else(MPI_COMPILE_FLAGS_WORK)
+      set(MPI_COMPILE_FLAGS_WORK ${FLAG})
+    endif(MPI_COMPILE_FLAGS_WORK)
+  endforeach(FLAG)
+
+  # Extract include paths from compile command line
+  string(REGEX MATCHALL "-I([^\" ]+|\"[^\"]+\")" MPI_ALL_INCLUDE_PATHS "${MPI_COMPILE_CMDLINE}")
+  set(MPI_INCLUDE_PATH_WORK)
+  foreach(IPATH ${MPI_ALL_INCLUDE_PATHS})
+    string(REGEX REPLACE "^-I" "" IPATH ${IPATH})
+    string(REGEX REPLACE "//" "/" IPATH ${IPATH})
+    list(APPEND MPI_INCLUDE_PATH_WORK ${IPATH})
+  endforeach(IPATH)
+  
+  if (NOT MPI_INCLUDE_PATH_WORK)
+    if (MPI_COMPILER_MAY_HAVE_INCLIBDIRS)
+      # The compile command line didn't have any include paths on it,
+      # but we may have -showme:incdirs. Use it.
+      exec_program(${MPI_COMPILER} 
+        ARGS -showme:incdirs
+        OUTPUT_VARIABLE MPI_INCLUDE_PATH_WORK
+        RETURN_VALUE MPI_COMPILER_RETURN)
+      separate_arguments(MPI_INCLUDE_PATH_WORK)
+    endif (MPI_COMPILER_MAY_HAVE_INCLIBDIRS)
+  endif (NOT MPI_INCLUDE_PATH_WORK)
+
+  if (NOT MPI_INCLUDE_PATH_WORK)
+    # If all else fails, just search for mpi.h in the normal include
+    # paths.
+    find_path(MPI_INCLUDE_PATH mpi.h)
+    set(MPI_INCLUDE_PATH_WORK ${MPI_INCLUDE_PATH})
+  endif (NOT MPI_INCLUDE_PATH_WORK)
+
+  # Extract linker paths from the link command line
+  string(REGEX MATCHALL "-L([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_PATHS "${MPI_LINK_CMDLINE}")
+  set(MPI_LINK_PATH)
+  foreach(LPATH ${MPI_ALL_LINK_PATHS})
+    string(REGEX REPLACE "^-L" "" LPATH ${LPATH})
+    string(REGEX REPLACE "//" "/" LPATH ${LPATH})
+    list(APPEND MPI_LINK_PATH ${LPATH})
+  endforeach(LPATH)
+
+  if (NOT MPI_LINK_PATH)
+    if (MPI_COMPILER_MAY_HAVE_INCLIBDIRS)
+      # The compile command line didn't have any linking paths on it,
+      # but we may have -showme:libdirs. Use it.
+      exec_program(${MPI_COMPILER} 
+        ARGS -showme:libdirs
+        OUTPUT_VARIABLE MPI_LINK_PATH
+        RETURN_VALUE MPI_COMPILER_RETURN)
+      separate_arguments(MPI_LINK_PATH)
+    endif (MPI_COMPILER_MAY_HAVE_INCLIBDIRS)
+  endif (NOT MPI_LINK_PATH)
+
+  # Extract linker flags from the link command line
+  string(REGEX MATCHALL "-Wl,([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}")
+  set(MPI_LINK_FLAGS_WORK)
+  foreach(FLAG ${MPI_ALL_LINK_FLAGS})
+    if (MPI_LINK_FLAGS_WORK)
+      set(MPI_LINK_FLAGS_WORK "${MPI_LINK_FLAGS_WORK} ${FLAG}")
+    else(MPI_LINK_FLAGS_WORK)
+      set(MPI_LINK_FLAGS_WORK ${FLAG})
+    endif(MPI_LINK_FLAGS_WORK)
+  endforeach(FLAG)
+
+  # Extract the set of libraries to link against from the link command
+  # line
+  string(REGEX MATCHALL "-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}")
+
+  # Determine full path names for all of the libraries that one needs
+  # to link against in an MPI program
+  set(MPI_LIBRARIES)
+  foreach(LIB ${MPI_LIBNAMES})
+    string(REGEX REPLACE "^-l" "" LIB ${LIB})
+    set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
+    find_library(MPI_LIB ${LIB} HINTS ${MPI_LINK_PATH})
+    if (MPI_LIB)
+      list(APPEND MPI_LIBRARIES ${MPI_LIB})
+    else (MPI_LIB)
+      message(SEND_ERROR "Unable to find MPI library ${LIB}")
+    endif (MPI_LIB)
+  endforeach(LIB)
+  set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE INTERNAL "Scratch variable for MPI detection" FORCE)
+
+  # Chop MPI_LIBRARIES into the old-style MPI_LIBRARY and
+  # MPI_EXTRA_LIBRARY.
+  list(LENGTH MPI_LIBRARIES MPI_NUMLIBS)
+  list(LENGTH MPI_LIBNAMES MPI_NUMLIBS_EXPECTED)
+  if (MPI_NUMLIBS EQUAL MPI_NUMLIBS_EXPECTED)
+    list(GET MPI_LIBRARIES 0 MPI_LIBRARY_WORK)
+    set(MPI_LIBRARY ${MPI_LIBRARY_WORK} CACHE FILEPATH "MPI library to link against" FORCE)
+  else (MPI_NUMLIBS EQUAL MPI_NUMLIBS_EXPECTED)
+    set(MPI_LIBRARY "MPI_LIBRARY-NOTFOUND" CACHE FILEPATH "MPI library to link against" FORCE)
+  endif (MPI_NUMLIBS EQUAL MPI_NUMLIBS_EXPECTED)
+  if (MPI_NUMLIBS GREATER 1)
+    set(MPI_EXTRA_LIBRARY_WORK ${MPI_LIBRARIES})
+    list(REMOVE_AT MPI_EXTRA_LIBRARY_WORK 0)
+    set(MPI_EXTRA_LIBRARY ${MPI_EXTRA_LIBRARY_WORK} CACHE STRING "Extra MPI libraries to link against" FORCE)
+  else (MPI_NUMLIBS GREATER 1)
+    set(MPI_EXTRA_LIBRARY "MPI_EXTRA_LIBRARY-NOTFOUND" CACHE STRING "Extra MPI libraries to link against" FORCE)
+  endif (MPI_NUMLIBS GREATER 1)
+
+  # Set up all of the appropriate cache entries
+  set(MPI_COMPILE_FLAGS ${MPI_COMPILE_FLAGS_WORK} CACHE STRING "MPI compilation flags" FORCE)
+  set(MPI_INCLUDE_PATH ${MPI_INCLUDE_PATH_WORK} CACHE STRING "MPI include path" FORCE)
+  set(MPI_LINK_FLAGS ${MPI_LINK_FLAGS_WORK} CACHE STRING "MPI linking flags" FORCE)
+else (MPI_COMPILE_CMDLINE)
+  find_path(MPI_INCLUDE_PATH mpi.h 
+    /usr/local/include 
+    /usr/include 
+    /usr/include/mpi
+    /usr/local/mpi/include
+    "C:/Program Files/MPICH/SDK/Include" 
+    "$ENV{SystemDrive}/Program Files/MPICH2/include"
+    "$ENV{SystemDrive}/Program Files/Microsoft Compute Cluster Pack/Include"
+    )
+  
+  # Decide between 32-bit and 64-bit libraries for Microsoft's MPI
+  if (CMAKE_CL_64)
+    set(MS_MPI_ARCH_DIR amd64)
+  else (CMAKE_CL_64)
+    set(MS_MPI_ARCH_DIR i386)
+  endif (CMAKE_CL_64)
+  
+  find_library(MPI_LIBRARY 
+    NAMES mpi mpich msmpi
+    PATHS /usr/lib /usr/local/lib /usr/local/mpi/lib
+    "C:/Program Files/MPICH/SDK/Lib" 
+    "$ENV{SystemDrive}/Program Files/MPICH/SDK/Lib"
+    "$ENV{SystemDrive}/Program Files/Microsoft Compute Cluster Pack/Lib/${MS_MPI_ARCH_DIR}"
+    )
+  find_library(MPI_LIBRARY 
+    NAMES mpich2
+    PATHS
+    "$ENV{SystemDrive}/Program Files/MPICH2/Lib")
+
+  find_library(MPI_EXTRA_LIBRARY 
+    NAMES mpi++
+    PATHS /usr/lib /usr/local/lib /usr/local/mpi/lib
+    "C:/Program Files/MPICH/SDK/Lib" 
+    DOC "Extra MPI libraries to link against.")
+
+  set(MPI_COMPILE_FLAGS "" CACHE STRING "MPI compilation flags")
+  set(MPI_LINK_FLAGS "" CACHE STRING "MPI linking flags")
+endif (MPI_INCLUDE_PATH AND MPI_LIBRARY)
+
+# on BlueGene/L the MPI lib is named libmpich.rts.a, there also these additional libs are required
+if("${MPI_LIBRARY}" MATCHES "mpich.rts")
+   set(MPI_EXTRA_LIBRARY ${MPI_EXTRA_LIBRARY} msglayer.rts devices.rts rts.rts devices.rts)
+   set(MPI_LIBRARY ${MPI_LIBRARY}  msglayer.rts devices.rts rts.rts devices.rts)
+endif("${MPI_LIBRARY}" MATCHES "mpich.rts")
+
+# Set up extra variables to conform to 
+if (MPI_EXTRA_LIBRARY)
+  set(MPI_LIBRARIES ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARY})
+else (MPI_EXTRA_LIBRARY)
+  set(MPI_LIBRARIES ${MPI_LIBRARY})
+endif (MPI_EXTRA_LIBRARY)
+
+if (MPI_INCLUDE_PATH AND MPI_LIBRARY)
+  set(MPI_FOUND TRUE)
+else (MPI_INCLUDE_PATH AND MPI_LIBRARY)
+  set(MPI_FOUND FALSE)
+endif (MPI_INCLUDE_PATH AND MPI_LIBRARY)
+
+include(FindPackageHandleStandardArgs)
+# handle the QUIETLY and REQUIRED arguments 
+find_package_handle_standard_args(MPI DEFAULT_MSG MPI_LIBRARY MPI_INCLUDE_PATH)
+
+mark_as_advanced(MPI_INCLUDE_PATH MPI_COMPILE_FLAGS MPI_LINK_FLAGS MPI_LIBRARY 
+  MPI_EXTRA_LIBRARY)
diff --git a/cmake/modules/FindMPICC.cmake b/cmake/modules/FindMPICC.cmake
new file mode 100644
index 00000000000..8c5e4f751a9
--- /dev/null
+++ b/cmake/modules/FindMPICC.cmake
@@ -0,0 +1,316 @@
+# - Message Passing Interface (MPI) module.
+# 
+# The Message Passing Interface (MPI) is a library used to write
+# high-performance parallel applications that use message passing, and
+# is typically deployed on a cluster. MPI is a standard interface
+# (defined by the MPI forum) for which many implementations are
+# available. All of these implementations have somewhat different
+# compilation approaches (different include paths, libraries to link
+# against, etc.), and this module tries to smooth out those differences.
+#
+# This module will set the following variables:
+#   MPI_FOUND                  TRUE if we have found MPI
+#   MPI_COMPILE_FLAGS          Compilation flags for MPI programs
+#   MPI_INCLUDE_PATH           Include path(s) for MPI header
+#   MPI_LINK_FLAGS             Linking flags for MPI programs
+#   MPI_LIBRARY                First MPI library to link against (cached)
+#   MPI_EXTRA_LIBRARY          Extra MPI libraries to link against (cached)
+#   MPI_LIBRARIES              All libraries to link MPI programs against
+#   MPIEXEC                    Executable for running MPI programs
+#   MPIEXEC_NUMPROC_FLAG       Flag to pass to MPIEXEC before giving it the
+#                              number of processors to run on
+#   MPIEXEC_PREFLAGS           Flags to pass to MPIEXEC directly before the
+#                              executable to run.
+#   MPIEXEC_POSTFLAGS          Flags to pass to MPIEXEC after all other flags.
+#   MPIBIN                     Set path to mpibin if we have found MPIBIN
+#
+# This module will attempt to auto-detect these settings, first by
+# looking for a MPI compiler, which many MPI implementations provide
+# as a pass-through to the native compiler to simplify the compilation
+# of MPI programs. The MPI compiler is stored in the cache variable
+# MPI_COMPILER, and will attempt to look for commonly-named drivers
+# mpic++, mpicxx, mpiCC, or mpicc. If the compiler driver is found and
+# recognized, it will be used to set all of the module variables. To
+# skip this auto-detection, set MPI_LIBRARY and MPI_INCLUDE_PATH in
+# the CMake cache.
+#
+# If no compiler driver is found or the compiler driver is not
+# recognized, this module will then search for common include paths
+# and library names to try to detect MPI. 
+#
+# If CMake initially finds a different MPI than was intended, and you
+# want to use the MPI compiler auto-detection for a different MPI
+# implementation, set MPI_COMPILER to the MPI compiler driver you want
+# to use (e.g., mpicxx) and then set MPI_LIBRARY to the string
+# MPI_LIBRARY-NOTFOUND. When you re-configure, auto-detection of MPI
+# will run again with the newly-specified MPI_COMPILER.
+#
+# When using MPIEXEC to execute MPI applications, you should typically
+# use all of the MPIEXEC flags as follows:
+#   ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} PROCS ${MPIEXEC_PREFLAGS} EXECUTABLE
+#     ${MPIEXEC_POSTFLAGS} ARGS
+# where PROCS is the number of processors on which to execute the program,
+# EXECUTABLE is the MPI program, and ARGS are the arguments to pass to the 
+# MPI program.
+
+# Try to find the MPI driver program
+find_program(MPI_COMPILER 
+  NAMES mpiCC mpic++ mpicxx mpicc
+  PATHS /usr/local/ofed/mpi/gcc/openmpi-1.1.1-1/bin/
+  NO_SYSTEM_ENVIRONMENT_PATH
+  DOC "MPI compiler. Used only to detect MPI compilation flags.")
+mark_as_advanced(MPI_COMPILER)
+find_program(MPIEXEC
+  NAMES mpiexec mpirun lamexec
+  DOC "Executable for running MPI programs.")
+
+find_path(MPIBIN mpirun /usr/local/ofed/mpi/gcc/openmpi-1.1.1-1/bin/)
+mark_as_advanced(MPIBIN)
+
+set(MPIEXEC_NUMPROC_FLAG "-np" CACHE STRING "Flag used by MPI to specify the number of processes for MPIEXEC; the next option will be the number of processes.")
+set(MPIEXEC_PREFLAGS "" CACHE STRING "These flags will be directly before the executable that is being run by MPIEXEC.")
+set(MPIEXEC_POSTFLAGS "" CACHE STRING "These flags will come after all flags given to MPIEXEC.")
+set(MPIEXEC_MAX_NUMPROCS "2" CACHE STRING "Maximum number of processors available to run MPI applications.")
+mark_as_advanced(MPIEXEC MPIEXEC_NUMPROC_FLAG MPIEXEC_PREFLAGS 
+  MPIEXEC_POSTFLAGS MPIEXEC_MAX_NUMPROCS)
+if (MPI_INCLUDE_PATH AND MPI_LIBRARY)
+  # Do nothing: we already have MPI_INCLUDE_PATH and MPI_LIBRARY in
+  # the cache, and we don't want to override those settings.
+elseif (MPI_COMPILER)
+  # Check whether the -showme:compile option works. This indicates
+  # that we have either Open MPI or a newer version of LAM-MPI, and
+  # implies that -showme:link will also work.
+  exec_program(${MPI_COMPILER} 
+    ARGS -showme:compile 
+    OUTPUT_VARIABLE MPI_COMPILE_CMDLINE
+    RETURN_VALUE MPI_COMPILER_RETURN)
+
+  if (MPI_COMPILER_RETURN EQUAL 0)
+    # If we appear to have -showme:compile, then we should also have
+    # -showme:link. Try it.
+    exec_program(${MPI_COMPILER} 
+      ARGS -showme:link
+      OUTPUT_VARIABLE MPI_LINK_CMDLINE
+      RETURN_VALUE MPI_COMPILER_RETURN)
+
+    # Note that we probably have -showme:incdirs and -showme:libdirs
+    # as well.
+    set(MPI_COMPILER_MAY_HAVE_INCLIBDIRS TRUE)
+  endif (MPI_COMPILER_RETURN EQUAL 0)
+
+  if (MPI_COMPILER_RETURN EQUAL 0)
+    # Do nothing: we have our command lines now
+  else (MPI_COMPILER_RETURN EQUAL 0)
+    # Older versions of LAM-MPI have "-showme". Try it.
+    exec_program(${MPI_COMPILER} 
+      ARGS -showme
+      OUTPUT_VARIABLE MPI_COMPILE_CMDLINE
+      RETURN_VALUE MPI_COMPILER_RETURN)
+  endif (MPI_COMPILER_RETURN EQUAL 0)  
+
+  if (MPI_COMPILER_RETURN EQUAL 0)
+    # Do nothing: we have our command lines now
+  else (MPI_COMPILER_RETURN EQUAL 0)
+    # MPICH uses "-show". Try it.
+    exec_program(${MPI_COMPILER} 
+      ARGS -show
+      OUTPUT_VARIABLE MPI_COMPILE_CMDLINE
+      RETURN_VALUE MPI_COMPILER_RETURN)
+  endif (MPI_COMPILER_RETURN EQUAL 0)  
+
+  if (MPI_COMPILER_RETURN EQUAL 0)
+    # We have our command lines, but we might need to copy
+    # MPI_COMPILE_CMDLINE into MPI_LINK_CMDLINE, if the underlying
+    if (NOT MPI_LINK_CMDLINE)
+      SET(MPI_LINK_CMDLINE ${MPI_COMPILE_CMDLINE})
+    endif (NOT MPI_LINK_CMDLINE)
+  else (MPI_COMPILER_RETURN EQUAL 0)
+    message(STATUS "Unable to determine MPI from MPI driver ${MPI_COMPILER}")
+  endif (MPI_COMPILER_RETURN EQUAL 0)
+endif (MPI_INCLUDE_PATH AND MPI_LIBRARY)
+if (MPI_INCLUDE_PATH AND MPI_LIBRARY)
+  # Do nothing: we already have MPI_INCLUDE_PATH and MPI_LIBRARY in
+  # the cache, and we don't want to override those settings.
+elseif (MPI_COMPILE_CMDLINE)
+  # Extract compile flags from the compile command line.
+  string(REGEX MATCHALL "-D([^\" ]+|\"[^\"]+\")" MPI_ALL_COMPILE_FLAGS "${MPI_COMPILE_CMDLINE}")
+  set(MPI_COMPILE_FLAGS_WORK)
+  foreach(FLAG ${MPI_ALL_COMPILE_FLAGS})
+    if (MPI_COMPILE_FLAGS_WORK)
+      set(MPI_COMPILE_FLAGS_WORK "${MPI_COMPILE_FLAGS_WORK} ${FLAG}")
+    else(MPI_COMPILE_FLAGS_WORK)
+      set(MPI_COMPILE_FLAGS_WORK ${FLAG})
+    endif(MPI_COMPILE_FLAGS_WORK)
+  endforeach(FLAG)
+
+  # Extract include paths from compile command line
+  string(REGEX MATCHALL "-I([^\" ]+|\"[^\"]+\")" MPI_ALL_INCLUDE_PATHS "${MPI_COMPILE_CMDLINE}")
+  set(MPI_INCLUDE_PATH_WORK)
+  foreach(IPATH ${MPI_ALL_INCLUDE_PATHS})
+    string(REGEX REPLACE "^-I" "" IPATH ${IPATH})
+    string(REGEX REPLACE "//" "/" IPATH ${IPATH})
+    list(APPEND MPI_INCLUDE_PATH_WORK ${IPATH})
+  endforeach(IPATH)
+  
+  if (NOT MPI_INCLUDE_PATH_WORK)
+    if (MPI_COMPILER_MAY_HAVE_INCLIBDIRS)
+      # The compile command line didn't have any include paths on it,
+      # but we may have -showme:incdirs. Use it.
+      exec_program(${MPI_COMPILER} 
+        ARGS -showme:incdirs
+        OUTPUT_VARIABLE MPI_INCLUDE_PATH_WORK
+        RETURN_VALUE MPI_COMPILER_RETURN)
+      separate_arguments(MPI_INCLUDE_PATH_WORK)
+    endif (MPI_COMPILER_MAY_HAVE_INCLIBDIRS)
+  endif (NOT MPI_INCLUDE_PATH_WORK)
+
+  if (NOT MPI_INCLUDE_PATH_WORK)
+    # If all else fails, just search for mpi.h in the normal include
+    # paths.
+    find_path(MPI_INCLUDE_PATH mpi.h)
+    set(MPI_INCLUDE_PATH_WORK ${MPI_INCLUDE_PATH})
+  endif (NOT MPI_INCLUDE_PATH_WORK)
+
+  # Extract linker paths from the link command line
+  string(REGEX MATCHALL "-L([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_PATHS "${MPI_LINK_CMDLINE}")
+  set(MPI_LINK_PATH)
+  foreach(LPATH ${MPI_ALL_LINK_PATHS})
+    string(REGEX REPLACE "^-L" "" LPATH ${LPATH})
+    string(REGEX REPLACE "//" "/" LPATH ${LPATH})
+    list(APPEND MPI_LINK_PATH ${LPATH})
+  endforeach(LPATH)
+
+  if (NOT MPI_LINK_PATH)
+    if (MPI_COMPILER_MAY_HAVE_INCLIBDIRS)
+      # The compile command line didn't have any linking paths on it,
+      # but we may have -showme:libdirs. Use it.
+      exec_program(${MPI_COMPILER} 
+        ARGS -showme:libdirs
+        OUTPUT_VARIABLE MPI_LINK_PATH
+        RETURN_VALUE MPI_COMPILER_RETURN)
+      separate_arguments(MPI_LINK_PATH)
+    endif (MPI_COMPILER_MAY_HAVE_INCLIBDIRS)
+  endif (NOT MPI_LINK_PATH)
+
+  # Extract linker flags from the link command line
+  string(REGEX MATCHALL "-Wl,([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}")
+  set(MPI_LINK_FLAGS_WORK)
+  foreach(FLAG ${MPI_ALL_LINK_FLAGS})
+    if (MPI_LINK_FLAGS_WORK)
+      set(MPI_LINK_FLAGS_WORK "${MPI_LINK_FLAGS_WORK} ${FLAG}")
+    else(MPI_LINK_FLAGS_WORK)
+      set(MPI_LINK_FLAGS_WORK ${FLAG})
+    endif(MPI_LINK_FLAGS_WORK)
+  endforeach(FLAG)
+
+  # Extract the set of libraries to link against from the link command
+  # line
+  string(REGEX MATCHALL "-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}")
+
+  # Determine full path names for all of the libraries that one needs
+  # to link against in an MPI program
+  set(MPI_LIBRARIES)
+  foreach(LIB ${MPI_LIBNAMES})
+    string(REGEX REPLACE "^-l" "" LIB ${LIB})
+    set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE FILEPATH "Cleared" FORCE)
+    find_library(MPI_LIB ${LIB} PATHS ${MPI_LINK_PATH})
+    if (MPI_LIB)
+      list(APPEND MPI_LIBRARIES ${MPI_LIB})
+    else (MPI_LIB)
+##      status(ERROR "Unable to find MPI library ${LIB}")
+      message(STATUS "Unable to find MPI library ${LIB}")
+    endif (MPI_LIB)
+  endforeach(LIB)
+  set(MPI_LIB "MPI_LIB-NOTFOUND" CACHE INTERNAL "Scratch variable for MPI detection" FORCE)
+
+  # Chop MPI_LIBRARIES into the old-style MPI_LIBRARY and
+  # MPI_EXTRA_LIBRARY.
+  list(LENGTH MPI_LIBRARIES MPI_NUMLIBS)
+  if (MPI_NUMLIBS GREATER 0)
+    list(GET MPI_LIBRARIES 0 MPI_LIBRARY_WORK)
+    set(MPI_LIBRARY ${MPI_LIBRARY_WORK} CACHE FILEPATH "MPI library to link against" FORCE)
+  else (MPI_NUMLIBS GREATER 0)
+    set(MPI_LIBRARY "MPI_LIBRARY-NOTFOUND" CACHE STRING "MPI library to link against" FORCE)
+  endif (MPI_NUMLIBS GREATER 0)
+  if (MPI_NUMLIBS GREATER 1)
+    set(MPI_EXTRA_LIBRARY_WORK ${MPI_LIBRARIES})
+    list(REMOVE_AT MPI_EXTRA_LIBRARY_WORK 0)
+    set(MPI_EXTRA_LIBRARY ${MPI_EXTRA_LIBRARY_WORK} CACHE STRING "Extra MPI libraries to link against" FORCE)
+  else (MPI_NUMLIBS GREATER 1)
+    set(MPI_EXTRA_LIBRARY "MPI_EXTRA_LIBRARY-NOTFOUND" CACHE STRING "Extra MPI libraries to link against" FORCE)
+  endif (MPI_NUMLIBS GREATER 1)
+
+  # Set up all of the appropriate cache entries
+  set(MPI_COMPILE_FLAGS ${MPI_COMPILE_FLAGS_WORK} CACHE STRING "MPI compilation flags" FORCE)
+  set(MPI_INCLUDE_PATH ${MPI_INCLUDE_PATH_WORK} CACHE STRING "MPI include path" FORCE)
+  set(MPI_LINK_FLAGS ${MPI_LINK_FLAGS_WORK} CACHE STRING "MPI linking flags" FORCE)
+else (MPI_COMPILE_CMDLINE)
+  find_path(MPI_INCLUDE_PATH mpi.h 
+    /usr/local/ofed/mpi/gcc/openmpi-1.1.1-1/include/
+    /usr/local/include 
+    /usr/include 
+    /usr/include/mpi
+    /usr/local/mpi/include
+    "C:/Program Files/MPICH/SDK/Include" 
+    "$ENV{SystemDrive}/Program Files/MPICH2/include"
+    "$ENV{SystemDrive}/Program Files/Microsoft Compute Cluster Pack/Include"
+    )
+    
+  # Decide between 32-bit and 64-bit libraries for Microsoft's MPI
+  if (CMAKE_CL_64)
+    set(MS_MPI_ARCH_DIR amd64)
+  else (CMAKE_CL_64)
+    set(MS_MPI_ARCH_DIR i386)
+  endif (CMAKE_CL_64)
+  
+  find_library(MPI_LIBRARY 
+    NAMES mpiCC mpi mpich msmpi
+    PATHS /usr/local/ofed/mpi/gcc/openmpi-1.1.1-1/bin
+    /usr/lib /usr/local/lib /usr/local/mpi/lib
+    "C:/Program Files/MPICH/SDK/Lib" 
+    "$ENV{SystemDrive}/Program Files/MPICH/SDK/Lib"
+    "$ENV{SystemDrive}/Program Files/Microsoft Compute Cluster Pack/Lib/${MS_MPI_ARCH_DIR}"
+    )
+  find_library(MPI_LIBRARY 
+    NAMES mpich2
+    PATHS
+    "$ENV{SystemDrive}/Program Files/MPICH2/Lib")
+
+  find_library(MPI_EXTRA_LIBRARY 
+    NAMES mpi++
+    PATHS /usr/lib /usr/local/lib /usr/local/mpi/lib
+    "C:/Program Files/MPICH/SDK/Lib" 
+    DOC "Extra MPI libraries to link against.")
+
+  set(MPI_COMPILE_FLAGS "" CACHE STRING "MPI compilation flags")
+  set(MPI_LINK_FLAGS "" CACHE STRING "MPI linking flags")
+endif (MPI_INCLUDE_PATH AND MPI_LIBRARY)
+
+# on BlueGene/L the MPI lib is named libmpich.rts.a, there also these additional libs are required
+if("${MPI_LIBRARY}" MATCHES "mpich.rts")
+   set(MPI_EXTRA_LIBRARY ${MPI_EXTRA_LIBRARY} msglayer.rts devices.rts rts.rts devices.rts)
+   set(MPI_LIBRARY ${MPI_LIBRARY}  msglayer.rts devices.rts rts.rts devices.rts)
+endif("${MPI_LIBRARY}" MATCHES "mpich.rts")
+
+# Set up extra variables to conform to 
+if (MPI_EXTRA_LIBRARY)
+  set(MPI_LIBRARIES ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARY})
+else (MPI_EXTRA_LIBRARY)
+  set(MPI_LIBRARIES ${MPI_LIBRARY})
+endif (MPI_EXTRA_LIBRARY)
+
+if (MPI_INCLUDE_PATH AND MPI_LIBRARY)
+  set(MPI_FOUND TRUE)
+  set( CMAKE_CXX_COMPILER ${MPI_COMPILER} CACHE STRING "MPICC Compiler" FORCE )
+  include_directories (${MPI_INCLUDE_PATH})
+  add_definitions (-DHAVE_MPI)
+else (MPI_INCLUDE_PATH AND MPI_LIBRARY)
+  set(MPI_FOUND FALSE)
+endif (MPI_INCLUDE_PATH AND MPI_LIBRARY)
+
+include(FindPackageHandleStandardArgs)
+# handle the QUIETLY and REQUIRED arguments 
+find_package_handle_standard_args(MPI DEFAULT_MSG MPI_LIBRARY MPI_INCLUDE_PATH)
+
+mark_as_advanced(MPI_INCLUDE_PATH MPI_COMPILE_FLAGS MPI_LINK_FLAGS MPI_LIBRARY 
+  MPI_EXTRA_LIBRARY)
diff --git a/cmake/modules/FindMatlab.cmake b/cmake/modules/FindMatlab.cmake
new file mode 100644
index 00000000000..21283cbca1e
--- /dev/null
+++ b/cmake/modules/FindMatlab.cmake
@@ -0,0 +1,89 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: IO.h 393 2007-06-13 10:49:08Z baehren                               $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of Matlab
+#
+# The following variables are set when MATLAB is found:
+#  HAVE_MATLAB       = Set to true, if all components of MATLAB
+#                          have been found.
+#  MATLAB_INCLUDES   = Include path for the header files of MATLAB
+#  MATLAB_LIBRARIES  = Link these to use MATLAB
+#  MATLAB_LFGLAS     = Linker flags (optional)
+
+## -----------------------------------------------------------------------------
+## Search locations
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+find_path (MATLAB_INCLUDES mat.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES matlab
+  NO_DEFAULT_PATH
+  )
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+find_library (MATLAB_LIBRARIES matlab
+  PATHS ${lib_locations}
+  NO_DEFAULT_PATH
+  )
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+if (MATLAB_INCLUDES AND MATLAB_LIBRARIES)
+  set (HAVE_MATLAB TRUE)
+else (MATLAB_INCLUDES AND MATLAB_LIBRARIES)
+  set (HAVE_MATLAB FALSE)
+  if (NOT MATLAB_FIND_QUIETLY)
+    if (NOT MATLAB_INCLUDES)
+      message (STATUS "Unable to find Matlab header files!")
+    endif (NOT MATLAB_INCLUDES)
+    if (NOT MATLAB_LIBRARIES)
+      message (STATUS "Unable to find Matlab library files!")
+    endif (NOT MATLAB_LIBRARIES)
+  endif (NOT MATLAB_FIND_QUIETLY)
+endif (MATLAB_INCLUDES AND MATLAB_LIBRARIES)
+
+if (HAVE_MATLAB)
+  if (NOT MATLAB_FIND_QUIETLY)
+    message (STATUS "Found components for Matlab")
+    message (STATUS "MATLAB_INCLUDES  = ${MATLAB_INCLUDES}")
+    message (STATUS "MATLAB_LIBRARIES = ${MATLAB_LIBRARIES}")
+  endif (NOT MATLAB_FIND_QUIETLY)
+else (HAVE_MATLAB)
+  if (MATLAB_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find Matlab!")
+  endif (MATLAB_FIND_REQUIRED)
+endif (HAVE_MATLAB)
+
+## -----------------------------------------------------------------------------
+## Mark advanced variables
+
+mark_as_advanced (
+  MATLAB_INCLUDES
+  MATLAB_LIBRARIES
+  )
diff --git a/cmake/modules/FindMySQL.cmake b/cmake/modules/FindMySQL.cmake
new file mode 100644
index 00000000000..702319decc0
--- /dev/null
+++ b/cmake/modules/FindMySQL.cmake
@@ -0,0 +1,102 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: IO.h 393 2007-06-13 10:49:08Z baehren                               $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of MySQL
+#
+# The following variables are set when MySQL is found:
+#  HAVE_MYSQL       = Set to true, if all components of MySQL
+#                          have been found.
+#  MYSQL_INCLUDES   = Include path for the header files of MySQL
+#  MYSQL_LIBRARIES  = Link these to use MySQL
+#  MySQL_LFGLAS     = Linker flags (optional)
+
+## -----------------------------------------------------------------------------
+## Standard locations where to look for required components
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for system header files included from within the library
+
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+find_path (MYSQL_INCLUDES mysql/mysql.h mysql/mysql_version.h
+  PATHS ${include_locations}
+  NO_DEFAULT_PATH
+  )
+
+## -----------------------------------------------------------------------------
+## Check for the library components
+
+set (MYSQL_LIBRARIES "")
+
+## [1] libmysqlclient
+
+find_library (libmysqlclient mysqlclient
+  PATHS ${lib_locations}
+  PATH_SUFFIXES mysql
+  NO_DEFAULT_PATH
+  )
+
+if (libmysqlclient)
+  list (APPEND MYSQL_LIBRARIES ${libmysqlclient})
+endif (libmysqlclient)
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+if (MYSQL_INCLUDES AND MYSQL_LIBRARIES)
+  set (HAVE_MYSQL TRUE)
+else (MYSQL_INCLUDES AND MYSQL_LIBRARIES)
+  set (HAVE_MYSQL FALSE)
+  if (NOT MYSQL_FIND_QUIETLY)
+    if (NOT MYSQL_INCLUDES)
+      message (STATUS "Unable to find MySQL header files!")
+    endif (NOT MYSQL_INCLUDES)
+    if (NOT MYSQL_LIBRARIES)
+      message (STATUS "Unable to find MySQL library files!")
+    endif (NOT MYSQL_LIBRARIES)
+  endif (NOT MYSQL_FIND_QUIETLY)
+endif (MYSQL_INCLUDES AND MYSQL_LIBRARIES)
+
+if (HAVE_MYSQL)
+  if (NOT MYSQL_FIND_QUIETLY)
+    message (STATUS "Found components for MySQL")
+    message (STATUS "MYSQL_INCLUDES  = ${MYSQL_INCLUDES}")
+    message (STATUS "MYSQL_LIBRARIES = ${MYSQL_LIBRARIES}")
+  endif (NOT MYSQL_FIND_QUIETLY)
+else (HAVE_MYSQL)
+  if (MySQL_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find MySQL!")
+  endif (MySQL_FIND_REQUIRED)
+endif (HAVE_MYSQL)
+
+## -----------------------------------------------------------------------------
+## Mark advanced variables
+
+mark_as_advanced (
+  MYSQL_INCLUDES
+  MYSQL_LIBRARIES
+  libmysqlclient
+  )
diff --git a/cmake/modules/FindNumarray.cmake b/cmake/modules/FindNumarray.cmake
new file mode 100644
index 00000000000..1247df2f328
--- /dev/null
+++ b/cmake/modules/FindNumarray.cmake
@@ -0,0 +1,103 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: IO.h 393 2007-06-13 10:49:08Z baehren                               $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of Numarray
+#
+# The following variables are set when Numarray is found:
+#  HAVE_NUMARRAY       = Set to true, if all components of Numarray
+#                          have been found.
+#  NUMARRAY_INCLUDES   = Include path for the header files of Numarray
+#  NUMARRAY_LIBRARIES  = Link these to use Numarray
+#  NUMARRAY_LFGLAS     = Linker flags (optional)
+
+## -----------------------------------------------------------------------------
+## Search locations
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+find_path (NUMARRAY_INCLUDES numarray.h libnumarray.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES
+  python
+  python/numarray
+  python/numarray/Include/numarray/arrayobject.h
+  python/site-packages
+  python/site-packages/numpy
+  python/site-packages/numpy/numarray
+  NO_DEFAULT_PATH
+  )
+
+## most likely we need to adjust the path in order to support include via
+## something like <numarray/numarray.h>
+
+string (REGEX REPLACE "include/python/numarray" "include/python" NUMARRAY_INCLUDES ${NUMARRAY_INCLUDES})
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+find_library (NUMARRAY_LIBRARIES numarray
+  PATHS ${lib_locations}
+  PATH_SUFFIXES
+  python
+  python/numarray
+  NO_DEFAULT_PATH
+  )
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+if (NUMARRAY_INCLUDES AND NUMARRAY_LIBRARIES)
+  set (HAVE_NUMARRAY TRUE)
+else (NUMARRAY_INCLUDES AND NUMARRAY_LIBRARIES)
+  set (HAVE_NUMARRAY FALSE)
+  if (NOT NUMARRAY_FIND_QUIETLY)
+    if (NOT NUMARRAY_INCLUDES)
+      message (STATUS "Unable to find NUMARRAY header files!")
+    endif (NOT NUMARRAY_INCLUDES)
+    if (NOT NUMARRAY_LIBRARIES)
+      message (STATUS "Unable to find NUMARRAY library files!")
+    endif (NOT NUMARRAY_LIBRARIES)
+  endif (NOT NUMARRAY_FIND_QUIETLY)
+endif (NUMARRAY_INCLUDES AND NUMARRAY_LIBRARIES)
+
+if (HAVE_NUMARRAY)
+  if (NOT NUMARRAY_FIND_QUIETLY)
+    message (STATUS "Found components for NUMARRAY")
+    message (STATUS "NUMARRAY_INCLUDES  = ${NUMARRAY_INCLUDES}")
+    message (STATUS "NUMARRAY_LIBRARIES = ${NUMARRAY_LIBRARIES}")
+  endif (NOT NUMARRAY_FIND_QUIETLY)
+else (HAVE_NUMARRAY)
+  if (NUMARRAY_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find NUMARRAY!")
+  endif (NUMARRAY_FIND_REQUIRED)
+endif (HAVE_NUMARRAY)
+
+## -----------------------------------------------------------------------------
+## Mark advanced variables
+
+mark_as_advanced (
+  NUMARRAY_INCLUDES
+  NUMARRAY_LIBRARIES
+  )
diff --git a/cmake/modules/FindNumeric.cmake b/cmake/modules/FindNumeric.cmake
new file mode 100644
index 00000000000..f2cc61887ec
--- /dev/null
+++ b/cmake/modules/FindNumeric.cmake
@@ -0,0 +1,104 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: IO.h 393 2007-06-13 10:49:08Z baehren                               $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of Numeric
+#
+# The following variables are set when Numeric is found:
+#  HAVE_NUMERIC       = Set to true, if all components of Numeric
+#                          have been found.
+#  NUMERIC_INCLUDES   = Include path for the header files of Numeric
+#  NUMERIC_LIBRARIES  = Link these to use Numeric
+#  NUMERIC_LFGLAS     = Linker flags (optional)
+
+## -----------------------------------------------------------------------------
+## Search locations
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+find_path (NUMERIC_INCLUDES arrayobject.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES
+  python
+  python/numeric
+  python/Numeric
+  NO_DEFAULT_PATH
+  )
+
+## most likely we need to adjust the path in order to support include via
+## something like <numeric/numeric.h>
+
+string (REGEX REPLACE "include/python/numeric" "include/python" NUMERIC_INCLUDES ${NUMERIC_INCLUDES})
+
+string (REGEX REPLACE "include/python/Numeric" "include/python" NUMERIC_INCLUDES ${NUMERIC_INCLUDES})
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+find_library (NUMERIC_LIBRARIES _numpy
+  PATHS ${lib_locations}
+  PATH_SUFFIXES
+  python
+  python/numeric
+  python/Numeric
+  python/site-packages/Numeric
+  NO_DEFAULT_PATH
+  )
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+if (NUMERIC_INCLUDES AND NUMERIC_LIBRARIES)
+  set (HAVE_NUMERIC TRUE)
+else (NUMERIC_INCLUDES AND NUMERIC_LIBRARIES)
+  set (HAVE_NUMERIC FALSE)
+  if (NOT NUMERIC_FIND_QUIETLY)
+    if (NOT NUMERIC_INCLUDES)
+      message (STATUS "Unable to find NUMERIC header files!")
+    endif (NOT NUMERIC_INCLUDES)
+    if (NOT NUMERIC_LIBRARIES)
+      message (STATUS "Unable to find NUMERIC library files!")
+    endif (NOT NUMERIC_LIBRARIES)
+  endif (NOT NUMERIC_FIND_QUIETLY)
+endif (NUMERIC_INCLUDES AND NUMERIC_LIBRARIES)
+
+if (HAVE_NUMERIC)
+  if (NOT NUMERIC_FIND_QUIETLY)
+    message (STATUS "Found components for NUMERIC")
+    message (STATUS "NUMERIC_INCLUDES  = ${NUMERIC_INCLUDES}")
+    message (STATUS "NUMERIC_LIBRARIES = ${NUMERIC_LIBRARIES}")
+  endif (NOT NUMERIC_FIND_QUIETLY)
+else (HAVE_NUMERIC)
+  if (NUMERIC_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find NUMERIC!")
+  endif (NUMERIC_FIND_REQUIRED)
+endif (HAVE_NUMERIC)
+
+## -----------------------------------------------------------------------------
+## Mark advanced variables
+
+mark_as_advanced (
+  NUMERIC_INCLUDES
+  NUMERIC_LIBRARIES
+  )
diff --git a/cmake/modules/FindPGPLOT.cmake b/cmake/modules/FindPGPLOT.cmake
new file mode 100644
index 00000000000..8e79c629191
--- /dev/null
+++ b/cmake/modules/FindPGPLOT.cmake
@@ -0,0 +1,128 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: FindPGPLOT.cmake 1643 2008-06-14 10:19:20Z baehren                  $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of the PGPLOT library
+#
+# Defines the following variables:
+#  HAVE_PGPLOT       = 
+#  PGPLOT_INCLUDES   = Path to the PGPLOT header files
+#  PGPLOT_LIBRARIES  = Path to all parts of the PGPLOT library
+
+## -----------------------------------------------------------------------------
+## Standard locations where to look for required components
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+FIND_PATH (PGPLOT_INCLUDES cpgplot.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES pgplot
+  )
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+set (PGPLOT_LIBRARIES "")
+
+## [1] libpgplot
+
+find_library (libpgplot
+  NAMES pgplot
+  PATHS ${lib_locations}
+  PATH_SUFFIXES pgplot
+  NO_DEFAULT_PATH
+  )
+
+if (libpgplot)
+  list (APPEND PGPLOT_LIBRARIES ${libpgplot})
+else (libpgplot)
+  message (STATUS "Warning: Unable to locate libpgplot!")
+endif (libpgplot)
+
+## [2] libcpgplot
+
+find_library (libcpgplot
+  NAMES cpgplot
+  PATHS ${lib_locations}
+  PATH_SUFFIXES pgplot
+  NO_DEFAULT_PATH
+  )
+
+if (libcpgplot)
+  list (APPEND PGPLOT_LIBRARIES ${libcpgplot})
+else (libcpgplot)
+  message (STATUS "Warning: Unable to locate libcpgplot!")
+endif (libcpgplot)
+
+## [3] libXmPgplot
+
+find_library (libXmPgplot
+  NAMES XmPgplot
+  PATHS ${lib_locations}
+  PATH_SUFFIXES pgplot
+  NO_DEFAULT_PATH
+  )
+
+if (libXmPgplot)
+  list (APPEND PGPLOT_LIBRARIES ${libXmPgplot})
+else (libXmPgplot)
+  message (STATUS "Warning: Unable to locate libXmPgplot!")
+endif (libXmPgplot)
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+IF (PGPLOT_INCLUDES AND PGPLOT_LIBRARIES)
+  SET (HAVE_PGPLOT TRUE)
+ELSE (PGPLOT_INCLUDES AND PGPLOT_LIBRARIES)
+  SET (HAVE_PGPLOT FALSE)
+  IF (NOT PGPLOT_FIND_QUIETLY)
+    IF (NOT PGPLOT_INCLUDES)
+      MESSAGE (STATUS "Unable to find PGPLOT header files!")
+    ENDIF (NOT PGPLOT_INCLUDES)
+    IF (NOT PGPLOT_LIBRARIES)
+      MESSAGE (STATUS "Unable to find PGPLOT library files!")
+    ENDIF (NOT PGPLOT_LIBRARIES)
+  ENDIF (NOT PGPLOT_FIND_QUIETLY)
+ENDIF (PGPLOT_INCLUDES AND PGPLOT_LIBRARIES)
+
+if (HAVE_PGPLOT)
+  if (NOT PGPLOT_FIND_QUIETLY)
+    message (STATUS "Found components for PGPLOT")
+    message (STATUS "PGPLOT_INCLUDES  = ${PGPLOT_INCLUDES}")
+    message (STATUS "PGPLOT_LIBRARIES = ${PGPLOT_LIBRARIES}")
+  endif (NOT PGPLOT_FIND_QUIETLY)
+else (HAVE_PGPLOT)
+  if (PGPLOT_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find PGPLOT!")
+  endif (PGPLOT_FIND_REQUIRED)
+endif (HAVE_PGPLOT)
+
+## -----------------------------------------------------------------------------
+## Mark as advanced ...
+
+mark_as_advanced (
+  PGPLOT_INCLUDES
+  PGPLOT_LIBRARIES
+  )
diff --git a/cmake/modules/FindPLplot.cmake b/cmake/modules/FindPLplot.cmake
new file mode 100644
index 00000000000..fe5f5e29e60
--- /dev/null
+++ b/cmake/modules/FindPLplot.cmake
@@ -0,0 +1,109 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: IO.h 393 2007-06-13 10:49:08Z baehren                               $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of PLplot
+#
+# The following variables are set when PLPLOT is found:
+#  HAVE_PLPLOT       = Set to true, if all components of PLplot have been found.
+#  PLPLOT_INCLUDES   = Include path for the header files of PLplot
+#  PLPLOT_LIBRARIES  = Link these to use PLplot
+#  PLPLOT_LFLAGS     = Linker flags (optional)
+
+## -----------------------------------------------------------------------------
+## Standard locations where to look for required components
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+find_path (PLPLOT_INCLUDES plplot.h plplotcanvas.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES plplot
+  NO_DEFAULT_PATH
+  )
+
+if (PLPLOT_INCLUDES)
+  string (REGEX REPLACE "include/plplot" "include" PLPLOT_INCLUDES ${PLPLOT_INCLUDES})
+endif (PLPLOT_INCLUDES)
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+## [1] 
+
+find_library (PLPLOT_plplotd plplotd
+  PATHS ${lib_locations}
+  NO_DEFAULT_PATH
+  )
+
+if (PLPLOT_plplotd)
+  list (APPEND PLPLOT_LIBRARIES ${PLPLOT_plplotd})
+endif (PLPLOT_plplotd)
+
+## [2] 
+
+find_library (PLPLOT_plplotcxxd plplotcxxd
+  PATHS ${lib_locations}
+  NO_DEFAULT_PATH
+  )
+
+if (PLPLOT_plplotcxxd)
+  list (APPEND PLPLOT_LIBRARIES ${PLPLOT_plplotcxxd})
+endif (PLPLOT_plplotcxxd)
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+if (PLPLOT_INCLUDES AND PLPLOT_LIBRARIES)
+  set (HAVE_PLPLOT TRUE)
+else (PLPLOT_INCLUDES AND PLPLOT_LIBRARIES)
+  set (HAVE_PLPLOT FALSE)
+  if (NOT PLPLOT_FIND_QUIETLY)
+    if (NOT PLPLOT_INCLUDES)
+      message (STATUS "Unable to find PLPLOT header files!")
+    endif (NOT PLPLOT_INCLUDES)
+    if (NOT PLPLOT_LIBRARIES)
+      message (STATUS "Unable to find PLPLOT library files!")
+    endif (NOT PLPLOT_LIBRARIES)
+  endif (NOT PLPLOT_FIND_QUIETLY)
+endif (PLPLOT_INCLUDES AND PLPLOT_LIBRARIES)
+
+if (HAVE_PLPLOT)
+  if (NOT PLPLOT_FIND_QUIETLY)
+    message (STATUS "Found components for PLPLOT")
+    message (STATUS "PLPLOT_INCLUDES  = ${PLPLOT_INCLUDES}")
+    message (STATUS "PLPLOT_LIBRARIES = ${PLPLOT_LIBRARIES}")
+  endif (NOT PLPLOT_FIND_QUIETLY)
+else (HAVE_PLPLOT)
+  if (PLPLOT_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find PLPLOT!")
+  endif (PLPLOT_FIND_REQUIRED)
+endif (HAVE_PLPLOT)
+
+## -----------------------------------------------------------------------------
+## Mark advanced variables
+
+mark_as_advanced (
+  PLPLOT_INCLUDES
+  PLPLOT_LIBRARIES
+  )
diff --git a/cmake/modules/FindPNG.cmake b/cmake/modules/FindPNG.cmake
new file mode 100644
index 00000000000..0617f892b89
--- /dev/null
+++ b/cmake/modules/FindPNG.cmake
@@ -0,0 +1,88 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: IO.h 393 2007-06-13 10:49:08Z baehren                               $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of PNG
+#
+# The following variables are set when PNG is found:
+#  HAVE_PNG       = Set to true, if all components of PNG have been found.
+#  PNG_INCLUDES   = Include path for the header files of PNG
+#  PNG_LIBRARIES  = Link these to use PNG
+#  PNG_LFGLAS     = Linker flags (optional)
+
+## -----------------------------------------------------------------------------
+## Standard locations where to look for required components
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+find_path (PNG_INCLUDES png.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES png
+  NO_DEFAULT_PATH
+  )
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+find_library (PNG_LIBRARIES png
+  PATHS ${lib_locations}
+  NO_DEFAULT_PATH
+  )
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+if (PNG_INCLUDES AND PNG_LIBRARIES)
+  set (HAVE_PNG TRUE)
+else (PNG_INCLUDES AND PNG_LIBRARIES)
+  set (HAVE_PNG FALSE)
+  if (NOT PNG_FIND_QUIETLY)
+    if (NOT PNG_INCLUDES)
+      message (STATUS "Unable to find PNG header files!")
+    endif (NOT PNG_INCLUDES)
+    if (NOT PNG_LIBRARIES)
+      message (STATUS "Unable to find PNG library files!")
+    endif (NOT PNG_LIBRARIES)
+  endif (NOT PNG_FIND_QUIETLY)
+endif (PNG_INCLUDES AND PNG_LIBRARIES)
+
+if (HAVE_PNG)
+  if (NOT PNG_FIND_QUIETLY)
+    message (STATUS "Found components for PNG")
+    message (STATUS "PNG_INCLUDES  = ${PNG_INCLUDES}")
+    message (STATUS "PNG_LIBRARIES = ${PNG_LIBRARIES}")
+  endif (NOT PNG_FIND_QUIETLY)
+else (HAVE_PNG)
+  if (PNG_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find PNG!")
+  endif (PNG_FIND_REQUIRED)
+endif (HAVE_PNG)
+
+## -----------------------------------------------------------------------------
+## Mark advanced variables
+
+mark_as_advanced (
+  PNG_INCLUDES
+  PNG_LIBRARIES
+  )
diff --git a/cmake/modules/FindPOPT.cmake b/cmake/modules/FindPOPT.cmake
new file mode 100644
index 00000000000..df40634af5a
--- /dev/null
+++ b/cmake/modules/FindPOPT.cmake
@@ -0,0 +1,77 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: FindPOPT.cmake 1643 2008-06-14 10:19:20Z baehren                    $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of POPT
+#
+# The following variables are set when POPT is found:
+#  HAVE_POPT       = Set to true, if all components of POPT
+#                          have been found.
+#  POPT_INCLUDES = Include path for the header files of POPT
+#  POPT_LIBRARIES     = Link these to use POPT
+
+## -----------------------------------------------------------------------------
+## Standard locations where to look for required components
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+FIND_PATH (POPT_INCLUDES popt.h
+  PATHS ${include_locations}
+  )
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+FIND_LIBRARY (POPT_LIBRARIES popt
+  PATHS ${lib_locations}
+  )
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+IF (POPT_INCLUDES AND POPT_LIBRARIES)
+  SET (HAVE_POPT TRUE)
+ELSE (POPT_INCLUDES AND POPT_LIBRARIES)
+  SET (HAVE_POPT FALSE)
+  IF (NOT POPT_FIND_QUIETLY)
+    IF (NOT POPT_INCLUDES)
+      MESSAGE (STATUS "Unable to find POPT header files!")
+    ENDIF (NOT POPT_INCLUDES)
+    IF (NOT POPT_LIBRARIES)
+      MESSAGE (STATUS "Unable to find POPT library files!")
+    ENDIF (NOT POPT_LIBRARIES)
+  ENDIF (NOT POPT_FIND_QUIETLY)
+ENDIF (POPT_INCLUDES AND POPT_LIBRARIES)
+
+IF (HAVE_POPT)
+  IF (NOT POPT_FIND_QUIETLY)
+    MESSAGE (STATUS "Found components for POPT")
+    MESSAGE (STATUS "POPT_INCLUDES   = ${POPT_INCLUDES}")
+    MESSAGE (STATUS "POPT_LIBRARIES  = ${POPT_LIBRARIES}")
+  ENDIF (NOT POPT_FIND_QUIETLY)
+ELSE (HAVE_POPT)
+  IF (POPT_FIND_REQUIRED)
+    MESSAGE (FATAL_ERROR "Could not find POPT!")
+  ENDIF (POPT_FIND_REQUIRED)
+ENDIF (HAVE_POPT)
diff --git a/cmake/modules/FindPostgreSQL.cmake b/cmake/modules/FindPostgreSQL.cmake
new file mode 100644
index 00000000000..e7127c5759a
--- /dev/null
+++ b/cmake/modules/FindPostgreSQL.cmake
@@ -0,0 +1,163 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: IO.h 393 2007-06-13 10:49:08Z baehren                               $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of PostgreSQL
+#
+# The following variables are set when PostgreSQL is found:
+#  HAVE_PostgreSQL       = Set to true, if all components of PostgreSQL
+#                          have been found.
+#  POSTGRESQL_INCLUDES   = Include path for the header files of PostgreSQL
+#  POSTGRESQL_LIBRARIES  = Link these to use PostgreSQL
+#  PostgreSQL_LFGLAS     = Linker flags (optional)
+
+## -----------------------------------------------------------------------------
+## Standard locations where to look for required components
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for system header files included from within the library
+
+find_path (stdio_h stdio.h ${include_locations})
+find_path (stdlib_h stdlib.h ${include_locations})
+find_path (string_h string.h ${include_locations})
+find_path (stddef_h stddef.h ${include_locations})
+find_path (stdarg_h stdarg.h ${include_locations})
+find_path (strings_h strings.h ${include_locations})
+find_path (SupportDefs_h SupportDefs.h ${include_locations})
+
+if (strings_h)
+  add_definitions (-DHAVE_STRINGS_H=1)
+else (strings_h)
+  add_definitions (-DHAVE_STRINGS_H=0)
+endif (strings_h)
+
+if (SupportDefs_h)
+  add_definitions (-DHAVE_SUPPORTDEFS_H=1)
+else (SupportDefs_h)
+  add_definitions (-DHAVE_SUPPORTDEFS_H=0)
+endif (SupportDefs_h)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+find_path (PostgreSQL_INCLUDES postgres.h postgres_ext.h pgtypes_numeric.h libpq-fe.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES postgresql
+  NO_DEFAULT_PATH
+  )
+
+## -----------------------------------------------------------------------------
+## Check for the library components
+
+set (PostgreSQL_LIBRARIES "")
+
+## [1] libpq
+
+find_library (libpq pq
+  PATHS ${lib_locations}
+  PATH_SUFFIXES postgresql
+  NO_DEFAULT_PATH
+  )
+
+if (libpq)
+  list (APPEND PostgreSQL_LIBRARIES ${libpq})
+endif (libpq)
+
+## [2] libpgtypes
+
+find_library (libpgtypes pgtypes 
+  PATHS ${lib_locations}
+  PATH_SUFFIXES postgresql
+  NO_DEFAULT_PATH
+  )
+
+if (libpgtypes)
+  list (APPEND PostgreSQL_LIBRARIES ${libpgtypes})
+endif (libpgtypes)
+
+## [3] libecpg
+
+find_library (libecpg ecpg
+  PATHS ${lib_locations}
+  PATH_SUFFIXES postgresql
+  NO_DEFAULT_PATH
+  )
+
+if (libecpg)
+  list (APPEND PostgreSQL_LIBRARIES ${libecpg})
+endif (libecpg)
+
+## [4] libpgport
+
+find_library (libpgport pgport
+  PATHS ${lib_locations}
+  PATH_SUFFIXES postgresql
+  NO_DEFAULT_PATH
+  )
+
+if (libpgport)
+  list (APPEND PostgreSQL_LIBRARIES ${libpgport})
+endif (libpgport)
+
+## adjust the ordering of the libraries during linking
+
+if (PostgreSQL_LIBRARIES)
+  list (REVERSE PostgreSQL_LIBRARIES)
+endif (PostgreSQL_LIBRARIES)
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+if (PostgreSQL_INCLUDES AND PostgreSQL_LIBRARIES)
+  set (HAVE_PostgreSQL TRUE)
+else (PostgreSQL_INCLUDES AND PostgreSQL_LIBRARIES)
+  set (HAVE_PostgreSQL FALSE)
+  if (NOT PostgreSQL_FIND_QUIETLY)
+    if (NOT PostgreSQL_INCLUDES)
+      message (STATUS "Unable to find PostgreSQL header files!")
+    endif (NOT PostgreSQL_INCLUDES)
+    if (NOT PostgreSQL_LIBRARIES)
+      message (STATUS "Unable to find PostgreSQL library files!")
+    endif (NOT PostgreSQL_LIBRARIES)
+  endif (NOT PostgreSQL_FIND_QUIETLY)
+endif (PostgreSQL_INCLUDES AND PostgreSQL_LIBRARIES)
+
+if (HAVE_PostgreSQL)
+  if (NOT PostgreSQL_FIND_QUIETLY)
+    message (STATUS "Found components for PostgreSQL")
+    message (STATUS "PostgreSQL_INCLUDES  = ${PostgreSQL_INCLUDES}")
+    message (STATUS "PostgreSQL_LIBRARIES = ${PostgreSQL_LIBRARIES}")
+  endif (NOT PostgreSQL_FIND_QUIETLY)
+else (HAVE_PostgreSQL)
+  if (PostgreSQL_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find PostgreSQL!")
+  endif (PostgreSQL_FIND_REQUIRED)
+endif (HAVE_PostgreSQL)
+
+## -----------------------------------------------------------------------------
+## Mark advanced variables
+
+mark_as_advanced (
+  PostgreSQL_INCLUDES
+  PostgreSQL_LIBRARIES
+  )
diff --git a/cmake/modules/FindPyGTK.cmake b/cmake/modules/FindPyGTK.cmake
new file mode 100644
index 00000000000..6d23b51d74e
--- /dev/null
+++ b/cmake/modules/FindPyGTK.cmake
@@ -0,0 +1,114 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: IO.h 393 2007-06-13 10:49:08Z baehren                               $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of PYGTK [www.pygtk.org]
+#
+# The following variables are set when PYGTK is found:
+#  HAVE_PYGTK       = Set to true, if all components of PYGTK have been found.
+#  PYGTK_INCLUDES   = Include path for the header files of PYGTK
+#  PYGTK_LIBRARIES  = Link these to use PYGTK
+#  PYGTK_LFGLAS     = Linker flags (optional)
+
+## -----------------------------------------------------------------------------
+## Relevance for other Python modules
+
+# In your build environment, see if these directories show up with
+#
+#   > pkg-config --cflags-only-I pygtk-2.0
+#
+# That is what mpl uses to find your pygtk headers.  If not, set your
+# PKG_CONFIG_PATH environment variable accordingly, and make sure there
+# is a pygtk-2.0.pc file in that directory.  On my system it is in
+#
+#   /usr/lib/pkgconfig/pygtk-2.0.pc
+#
+# and yours will probably be /usr/local/lib/pkgconfig
+#
+# pygtk-2.0.pc
+
+## -----------------------------------------------------------------------------
+## Standard locations where to look for required components
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+find_path (PYGTK_INCLUDES pygtk.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES
+  pygtk
+  pygtk-2.0
+  pygtk-2.0/pygtk
+  NO_DEFAULT_PATH
+  )
+
+string (REGEX REPLACE "include/pygtk-2.0/pygtk" "include/pygtk-2.0" PYGTK_INCLUDES ${PYGTK_INCLUDES})
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+find_library (PYGTK_LIBRARIES pygtk
+  PATHS ${lib_locations}
+  PATH_SUFFIXES
+  pygtk
+  pygtk-2.0
+  pygtk-2.0/pygtk
+  NO_DEFAULT_PATH
+  )
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+if (PYGTK_INCLUDES AND PYGTK_LIBRARIES)
+  set (HAVE_PYGTK TRUE)
+else (PYGTK_INCLUDES AND PYGTK_LIBRARIES)
+  set (HAVE_PYGTK FALSE)
+  if (NOT PYGTK_FIND_QUIETLY)
+    if (NOT PYGTK_INCLUDES)
+      message (STATUS "Unable to find PyGtk header files!")
+    endif (NOT PYGTK_INCLUDES)
+    if (NOT PYGTK_LIBRARIES)
+      message (STATUS "Unable to find PyGtk library files!")
+    endif (NOT PYGTK_LIBRARIES)
+  endif (NOT PYGTK_FIND_QUIETLY)
+endif (PYGTK_INCLUDES AND PYGTK_LIBRARIES)
+
+if (HAVE_PYGTK)
+  if (NOT PYGTK_FIND_QUIETLY)
+    message (STATUS "Found components for PyGtk")
+    message (STATUS "PYGTK_INCLUDES  = ${PYGTK_INCLUDES}")
+    message (STATUS "PYGTK_LIBRARIES = ${PYGTK_LIBRARIES}")
+  endif (NOT PYGTK_FIND_QUIETLY)
+else (HAVE_PYGTK)
+  if (PYGTK_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find PYGTK!")
+  endif (PYGTK_FIND_REQUIRED)
+endif (HAVE_PYGTK)
+
+## -----------------------------------------------------------------------------
+## Mark advanced variables
+
+mark_as_advanced (
+  PYGTK_INCLUDES
+  PYGTK_LIBRARIES
+  )
diff --git a/cmake/modules/FindPython.cmake b/cmake/modules/FindPython.cmake
new file mode 100644
index 00000000000..54c1a155f56
--- /dev/null
+++ b/cmake/modules/FindPython.cmake
@@ -0,0 +1,171 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: IO.h 393 2007-06-13 10:49:08Z baehren                               $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of <PACKAGE>
+#
+# The following variables are set when PYTHON is found:
+#
+#  HAVE_PYTHON       = Set to true, if all components of PYTHON
+#                          have been found.
+#  PYTHON_EXECUTABLE = Location of the Python executable
+#  PYTHON_INCLUDES   = Include path for the header files of PYTHON
+#  PYTHON_LIBRARIES  = Link these to use PYTHON
+#  PYTHON_LFGLAS     = Linker flags (optional)
+#
+# Beside the core components of Python we also include a search for optional
+# packages which might be installed as well:
+#
+#  NUMPY_INCLUDES    = Include path for the header files of NUMPY package
+#  NUM_UTIL_INCLUDES = Include path for the header files of NUM_UTIL package
+#
+
+## -----------------------------------------------------------------------------
+## Standard locations where to look for required components
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+
+foreach (python_version 2.6 2.5 2.4 2.3)
+
+  ## Check for executable
+  
+  find_program (PYTHON_EXECUTABLE python${python_version}
+    PATHS ${bin_locations}
+    NO_DEFAULT_PATH
+    )
+  
+  ## Check for the PYTHON header files
+
+  find_path (PYTHON_INCLUDES Python.h
+    PATHS ${include_locations}
+    PATH_SUFFIXES python${python_version}
+    NO_DEFAULT_PATH
+    )
+
+  find_path (HAVE_PYCONFIG_H pyconfig.h
+    PATHS ${include_locations}
+    PATH_SUFFIXES python${python_version}
+    NO_DEFAULT_PATH
+    )
+
+  ## Check for the NUMPY header files
+
+  find_path (NUMPY_INCLUDES_tmp numpy/arrayobject.h
+    PATHS ${lib_locations} ${include_locations}
+    PATH_SUFFIXES
+    python
+    python${python_version}
+    python${python_version}/site-packages/numpy/core/include
+    NO_DEFAULT_PATH
+    )
+
+  if (NUMPY_INCLUDES_tmp)
+    get_filename_component (NUMPY_INCLUDES ${NUMPY_INCLUDES_tmp} ABSOLUTE)
+  endif (NUMPY_INCLUDES_tmp)
+
+  ## Check for the NUM_UTIL header files and libraries
+
+  find_path (NUM_UTIL_INCLUDES num_util/num_util.h
+    PATHS ${include_locations}
+    PATH_SUFFIXES
+    python
+    python${python_version}
+    NO_DEFAULT_PATH
+    )
+
+  find_library (NUM_UTIL_LIBRARIES num_util
+    PATHS ${lib_locations}
+    PATH_SUFFIXES
+    python
+    python${python_version}
+    NO_DEFAULT_PATH
+    )
+
+  ## Check for the library
+
+  find_library (PYTHON_LIBRARIES python${python_version}
+    PATHS ${lib_locations}
+    PATH_SUFFIXES . python${python_version}/config
+    NO_DEFAULT_PATH
+    )
+
+  # check if components have been found
+  if (NOT PYTHON_INCLUDES OR NOT PYTHON_LIBRARIES)
+    if (NOT PYTHON_FIND_QUIETLY)
+      message (STATUS "No consistent set of files found for Python ${python_version}")
+    endif (NOT PYTHON_FIND_QUIETLY)
+  endif (NOT PYTHON_INCLUDES OR NOT PYTHON_LIBRARIES)
+endforeach (python_version)
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+## Python itself
+
+if (PYTHON_INCLUDES AND PYTHON_LIBRARIES)
+  set (HAVE_PYTHON TRUE)
+else (PYTHON_INCLUDES AND PYTHON_LIBRARIES)
+  set (HAVE_PYTHON FALSE)
+  if (NOT PYTHON_FIND_QUIETLY)
+    if (NOT PYTHON_INCLUDES)
+      message (STATUS "Unable to find PYTHON header files!")
+    endif (NOT PYTHON_INCLUDES)
+    if (NOT PYTHON_LIBRARIES)
+      message (STATUS "Unable to find PYTHON library files!")
+    endif (NOT PYTHON_LIBRARIES)
+  endif (NOT PYTHON_FIND_QUIETLY)
+endif (PYTHON_INCLUDES AND PYTHON_LIBRARIES)
+
+## NumUtil
+
+if (NUM_UTIL_INCLUDES AND NUM_UTIL_LIBRARIES)
+  set (HAVE_NUM_UTIL TRUE)
+else (NUM_UTIL_INCLUDES AND NUM_UTIL_LIBRARIES) 
+  set (HAVE_NUM_UTIL FALSE)
+endif (NUM_UTIL_INCLUDES AND NUM_UTIL_LIBRARIES) 
+
+## Feedback
+
+if (HAVE_PYTHON)
+  if (NOT PYTHON_FIND_QUIETLY)
+    message (STATUS "Found components for PYTHON")
+    message (STATUS "PYTHON_EXECUTABLE  = ${PYTHON_EXECUTABLE}")
+    message (STATUS "PYTHON_INCLUDES    = ${PYTHON_INCLUDES}")
+    message (STATUS "PYTHON_LIBRARIES   = ${PYTHON_LIBRARIES}")
+    message (STATUS "NUMPY_INCLUDES     = ${NUMPY_INCLUDES}")
+    message (STATUS "NUM_UTIL_INCLUDES  = ${NUM_UTIL_INCLUDES}")
+    message (STATUS "NUM_UTIL_LIBRARIES = ${NUM_UTIL_LIBRARIES}")
+  endif (NOT PYTHON_FIND_QUIETLY)
+else (HAVE_PYTHON)
+  if (PYTHON_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find PYTHON!")
+  endif (PYTHON_FIND_REQUIRED)
+endif (HAVE_PYTHON)
+
+## -----------------------------------------------------------------------------
+## Mark advanced variables
+
+mark_as_advanced (
+  PYTHON_INCLUDES
+  PYTHON_LIBRARIES
+  )
diff --git a/cmake/modules/FindROOT.cmake b/cmake/modules/FindROOT.cmake
new file mode 100644
index 00000000000..4532651cf40
--- /dev/null
+++ b/cmake/modules/FindROOT.cmake
@@ -0,0 +1,140 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: FindROOT.cmake 1643 2008-06-14 10:19:20Z baehren                    $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of ROOT
+#
+# The following variables are set when ROOT is found:
+#  HAVE_ROOT       = Set to true, if all components of ROOT have been found.
+#  ROOT_INCLUDES   = Include path for the header files of ROOT
+#  ROOT_LIBRARIES  = Link these to use ROOT
+#  ROOT_LFLAGS     = Linker flags (optional)
+
+## -----------------------------------------------------------------------------
+## Search locations
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+find_path (ROOT_INCLUDES tCanvas.h TCint.h TObject.h
+  PATHS
+  ${include_locations}
+  /opt/root/include
+  /opt/auger/root-v5.18.00
+  $ENV{ROOTSYS}
+  PATH_SUFFIXES
+  root
+  root/include
+  include
+  NO_DEFAULT_PATH
+  )
+
+get_filename_component (ROOT_INCLUDES ${ROOT_INCLUDES} ABSOLUTE)
+
+## -----------------------------------------------------------------------------
+## Check for the libraries
+
+set (libs
+  ## output from 'root-config --glibs'
+  Core
+  Cint
+  RIO
+  Net
+  Hist
+  Graf
+  Graf3d
+  Gpad
+  Tree
+  Rint
+  Postscript
+  Matrix
+  Physics
+  MathCore
+  Thread
+  freetype
+  Gui
+  pthread
+  )
+
+foreach (lib ${libs})
+  ## try to locate the library
+  find_library (root${lib} ${lib}
+    PATHS
+    ${lib_locations}
+    /opt/root/lib
+    /opt/auger/root-v5.18.00
+    $ENV{ROOTSYS}
+    PATH_SUFFIXES
+    root
+    root/lib
+    lib
+    NO_DEFAULT_PATH
+    )
+  ## if the library could be located, it is added to the list
+  if (root${lib})
+    list (APPEND ROOT_LIBRARIES ${root${lib}})
+  endif (root${lib})
+endforeach (lib)
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+if (ROOT_INCLUDES AND ROOT_LIBRARIES)
+  set (HAVE_ROOT TRUE)
+else (ROOT_INCLUDES AND ROOT_LIBRARIES)
+  set (HAVE_ROOT FALSE)
+  if (NOT ROOT_FIND_QUIETLY)
+    if (NOT ROOT_INCLUDES)
+      message (STATUS "Unable to find ROOT header files!")
+    endif (NOT ROOT_INCLUDES)
+    if (NOT ROOT_LIBRARIES)
+      message (STATUS "Unable to find ROOT library files!")
+    endif (NOT ROOT_LIBRARIES)
+  endif (NOT ROOT_FIND_QUIETLY)
+endif (ROOT_INCLUDES AND ROOT_LIBRARIES)
+
+if (HAVE_ROOT)
+  if (NOT ROOT_FIND_QUIETLY)
+    message (STATUS "Found components for ROOT")
+    message (STATUS "ROOT_INCLUDES  = ${ROOT_INCLUDES}")
+    message (STATUS "ROOT_LIBRARIES = ${ROOT_LIBRARIES}")
+  endif (NOT ROOT_FIND_QUIETLY)
+else (HAVE_ROOT)
+  if (ROOT_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find ROOT!")
+  endif (ROOT_FIND_REQUIRED)
+endif (HAVE_ROOT)
+
+## ------------------------------------------------------------------------------
+## Mark as advanced ...
+
+mark_as_advanced (
+  ROOT_INCLUDES
+  ROOT_LIBRARIES
+  )
+
+foreach (lib ${libs})
+    if (root${lib})
+      mark_as_advanced (root${lib})
+  endif (root${lib})
+endforeach (lib)
diff --git a/cmake/modules/FindRuby.cmake b/cmake/modules/FindRuby.cmake
new file mode 100644
index 00000000000..cdb8105f901
--- /dev/null
+++ b/cmake/modules/FindRuby.cmake
@@ -0,0 +1,97 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: FindRuby.cmake 1643 2008-06-14 10:19:20Z baehren                    $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of Ruby
+#
+# The following variables are set when Ruby is found:
+#  HAVE_Ruby       = Set to true, if all components of Ruby
+#                          have been found.
+#  Ruby_INCLUDES   = Include path for the header files of Ruby
+#  Ruby_LIBRARIES  = Link these to use Ruby
+
+## -----------------------------------------------------------------------------
+## Search locations
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## System properties; library and header files may reside in an architecture-
+## dependent subdirectory
+
+if (UNIX)
+  if (APPLE)
+    if (${CMAKE_OSX_ARCHITECTURES} MATCHES "ppc")
+      set (ARCH "powerpc-darwin")
+    else (${CMAKE_OSX_ARCHITECTURES} MATCHES "ppc")
+      set (ARCH "intel-darwin")
+    endif (${CMAKE_OSX_ARCHITECTURES} MATCHES "ppc")
+  else (APPLE)
+    message (STATUS "General UNIX system detected.")
+  endif (APPLE)
+else (UNIX)
+  message (ERROR "No UNIX-like system!")
+endif (UNIX)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+find_path (Ruby_INCLUDES ruby.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES ruby/1.8/${ARCH} ruby/1.8/universal-darwin8.0
+  )
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+find_library (Ruby_LIBRARIES ruby
+  PATHS ${lib_locations}
+  PATH_SUFFIXES ruby/1.8 ruby/1.9
+  )
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+if (Ruby_INCLUDES AND Ruby_LIBRARIES)
+  set (HAVE_Ruby TRUE)
+else (Ruby_INCLUDES AND Ruby_LIBRARIES)
+  if (NOT Ruby_FIND_QUIETLY)
+    if (NOT Ruby_INCLUDES)
+      message (STATUS "Unable to find Ruby header files!")
+    endif (NOT Ruby_INCLUDES)
+    if (NOT Ruby_LIBRARIES)
+      message (STATUS "Unable to find Ruby library files!")
+    endif (NOT Ruby_LIBRARIES)
+  endif (NOT Ruby_FIND_QUIETLY)
+endif (Ruby_INCLUDES AND Ruby_LIBRARIES)
+
+if (HAVE_Ruby)
+  if (NOT Ruby_FIND_QUIETLY)
+    message (STATUS "Found components for Ruby")
+    message (STATUS "Ruby_INCLUDES  = ${Ruby_INCLUDES}")
+    message (STATUS "Ruby_LIBRARIES = ${Ruby_LIBRARIES}")
+  endif (NOT Ruby_FIND_QUIETLY)
+else (HAVE_Ruby)
+  if (Ruby_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find Ruby!")
+  endif (Ruby_FIND_REQUIRED)
+endif (HAVE_Ruby)
+
diff --git a/cmake/modules/FindSHMEM.cmake b/cmake/modules/FindSHMEM.cmake
new file mode 100644
index 00000000000..dea7a37d412
--- /dev/null
+++ b/cmake/modules/FindSHMEM.cmake
@@ -0,0 +1,92 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: IO.h 393 2007-06-13 10:49:08Z gels                                  $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Martin Gels (gels@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# Check for the presence of SHMEM (SHMEM).
+#
+# The following variables are set when SHMEM is found:
+#  SHMEM_FOUND      = Set to true, if all components of SHMEM have been found.
+#  SHMEM_INCLUDES   = Include path for the header files of SHMEM
+#  SHMEM_LIBRARIES  = Link these to use SHMEM
+#  SHMEM_LFGLAS     = Linker flags (optional)
+
+## -----------------------------------------------------------------------------
+## Search locations
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+find_path (SHMEM_INCLUDES LCS/Common/include/Common/shmem/dlmalloc.h
+  PATHS ${include_locations}
+  ${LOFAR_SOURCE_DIR}
+  NO_DEFAULT_PATH
+  )
+
+get_filename_component (SHMEM_INCLUDES ${SHMEM_INCLUDES} ABSOLUTE)
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+
+find_library (SHMEM_LIBRARIES libshmem.a
+  PATHS ${lib_locations}
+  ${LOFAR_SOURCE_DIR}/installed/${BUILD_VARIANT}/lib64/
+  NO_DEFAULT_PATH
+  )
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+if (SHMEM_INCLUDES AND SHMEM_LIBRARIES)
+  set (SHMEM_FOUND TRUE)
+else (SHMEM_INCLUDES AND SHMEM_LIBRARIES)
+  set (SHMEM_FOUND FALSE)
+  if (NOT SHMEM_FIND_QUIETLY)
+    if (NOT SHMEM_INCLUDES)
+      message (STATUS "Unable to find SHMEM header files!")
+    endif (NOT SHMEM_INCLUDES)
+    if (NOT SHMEM_LIBRARIES)
+      message (STATUS "Unable to find SHMEM library files!")
+    endif (NOT SHMEM_LIBRARIES)
+  endif (NOT SHMEM_FIND_QUIETLY)
+endif (SHMEM_INCLUDES AND SHMEM_LIBRARIES)
+
+if (SHMEM_FOUND)
+  if (NOT SHMEM_FIND_QUIETLY)
+    message (STATUS "Found components for SHMEM")
+    message (STATUS "SHMEM_INCLUDES  = ${SHMEM_INCLUDES}")
+    message (STATUS "SHMEM_LIBRARIES = ${SHMEM_LIBRARIES}")
+  endif (NOT SHMEM_FIND_QUIETLY)
+else (SHMEM_FOUND)
+  if (SHMEM_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find SHMEM!")
+  endif (SHMEM_FIND_REQUIRED)
+endif (SHMEM_FOUND)
+
+## -----------------------------------------------------------------------------
+## Mark advanced variables
+
+mark_as_advanced (
+  SHMEM_INCLUDES
+  SHMEM_LIBRARIES
+  )
diff --git a/cmake/modules/FindSWIG.cmake b/cmake/modules/FindSWIG.cmake
new file mode 100644
index 00000000000..3127978bc69
--- /dev/null
+++ b/cmake/modules/FindSWIG.cmake
@@ -0,0 +1,96 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: FindSWIG.cmake 1643 2008-06-14 10:19:20Z baehren                    $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of SWIG
+#
+# The following variables are set when SWIG is found:
+#  HAVE_SWIG       = Set to true, if all components of SWIG
+#                          have been found.
+#  SWIG_INCLUDES   = Include path for the header files of SWIG
+#  SWIG_LIBRARIES  = Link these to use SWIG
+#  SWIG_LFGLAS     = Linker flags (optional)
+
+## -----------------------------------------------------------------------------
+## Search locations
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Find executable
+
+find_program (SWIG_BIN swig
+  PATHS ${bin_locations}
+  )
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+#find_path (SWIG_INCLUDES <header file(s)>
+#  PATHS ${include_locations}
+#  PATH_SUFFIXES <optional path extension>
+#  NO_DEFAULT_PATH
+#  )
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+#find_library (SWIG_LIBRARIES <package name>
+#  PATHS ${lib_locations}
+#  NO_DEFAULT_PATH
+#  )
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+if (SWIG_INCLUDES AND SWIG_LIBRARIES)
+  set (HAVE_SWIG TRUE)
+else (SWIG_INCLUDES AND SWIG_LIBRARIES)
+  set (HAVE_SWIG FALSE)
+  if (NOT SWIG_FIND_QUIETLY)
+    if (NOT SWIG_INCLUDES)
+      message (STATUS "Unable to find SWIG header files!")
+    endif (NOT SWIG_INCLUDES)
+    if (NOT SWIG_LIBRARIES)
+      message (STATUS "Unable to find SWIG library files!")
+    endif (NOT SWIG_LIBRARIES)
+  endif (NOT SWIG_FIND_QUIETLY)
+endif (SWIG_INCLUDES AND SWIG_LIBRARIES)
+
+if (HAVE_SWIG)
+  if (NOT SWIG_FIND_QUIETLY)
+    message (STATUS "Found components for SWIG")
+    message (STATUS "SWIG_INCLUDES  = ${SWIG_INCLUDES}")
+    message (STATUS "SWIG_LIBRARIES = ${SWIG_LIBRARIES}")
+  endif (NOT SWIG_FIND_QUIETLY)
+else (HAVE_SWIG)
+  if (SWIG_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find SWIG!")
+  endif (SWIG_FIND_REQUIRED)
+endif (HAVE_SWIG)
+
+## -----------------------------------------------------------------------------
+## Mark advanced variables
+
+mark_as_advanced (
+  SWIG_INCLUDES
+  SWIG_LIBRARIES
+  )
diff --git a/cmake/modules/FindStarTools.cmake b/cmake/modules/FindStarTools.cmake
new file mode 100644
index 00000000000..539c9709eac
--- /dev/null
+++ b/cmake/modules/FindStarTools.cmake
@@ -0,0 +1,103 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: IO.h 393 2007-06-13 10:49:08Z baehren                               $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of STARTOOLS
+#
+# The following variables are set when STARTOOLS is found:
+#  HAVE_STARTOOLS       = Set to true, if all components of STARTOOLS
+#                          have been found.
+#  STARTOOLS_INCLUDES   = Include path for the header files of STARTOOLS
+#  STARTOOLS_LIBRARIES  = Link these to use STARTOOLS
+#  STARTOOLS_LFLAGS     = Linker flags (optional)
+
+## -----------------------------------------------------------------------------
+## Search locations
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+find_path (STARTOOLS_INCLUDES startools/util.hh startools/trigger.hh
+  PATHS ${include_locations}
+  NO_DEFAULT_PATH
+  )
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+set (STARTOOLS_LIBRARIES "")
+
+find_library (libstarutil starutil
+  PATHS ${lib_locations}
+  NO_DEFAULT_PATH
+  )
+
+if (libstarutil)
+  list (APPEND STARTOOLS_LIBRARIES ${libstarutil})
+endif (libstarutil)
+
+find_library (librecradio recradio
+  PATHS ${lib_locations}
+  NO_DEFAULT_PATH
+  )
+
+if (librecradio)
+  list (APPEND STARTOOLS_LIBRARIES ${librecradio})
+endif (librecradio)
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+if (STARTOOLS_INCLUDES AND STARTOOLS_LIBRARIES)
+  set (HAVE_STARTOOLS TRUE)
+else (STARTOOLS_INCLUDES AND STARTOOLS_LIBRARIES)
+  set (HAVE_STARTOOLS FALSE)
+  if (NOT STARTOOLS_FIND_QUIETLY)
+    if (NOT STARTOOLS_INCLUDES)
+      message (STATUS "Unable to find STARTOOLS header files!")
+    endif (NOT STARTOOLS_INCLUDES)
+    if (NOT STARTOOLS_LIBRARIES)
+      message (STATUS "Unable to find STARTOOLS library files!")
+    endif (NOT STARTOOLS_LIBRARIES)
+  endif (NOT STARTOOLS_FIND_QUIETLY)
+endif (STARTOOLS_INCLUDES AND STARTOOLS_LIBRARIES)
+
+if (HAVE_STARTOOLS)
+  if (NOT STARTOOLS_FIND_QUIETLY)
+    message (STATUS "Found components for STARTOOLS")
+    message (STATUS "STARTOOLS_INCLUDES  = ${STARTOOLS_INCLUDES}")
+    message (STATUS "STARTOOLS_LIBRARIES = ${STARTOOLS_LIBRARIES}")
+  endif (NOT STARTOOLS_FIND_QUIETLY)
+else (HAVE_STARTOOLS)
+  if (STARTOOLS_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find STARTOOLS!")
+  endif (STARTOOLS_FIND_REQUIRED)
+endif (HAVE_STARTOOLS)
+
+## -----------------------------------------------------------------------------
+## Mark advanced variables
+
+mark_as_advanced (
+  STARTOOLS_INCLUDES
+  STARTOOLS_LIBRARIES
+  )
diff --git a/cmake/modules/FindTCL.cmake b/cmake/modules/FindTCL.cmake
new file mode 100644
index 00000000000..e3d66efcbd7
--- /dev/null
+++ b/cmake/modules/FindTCL.cmake
@@ -0,0 +1,88 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: IO.h 393 2007-06-13 10:49:08Z baehren                               $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of TCL
+#
+# The following variables are set when TCL is found:
+#  HAVE_TCL       = Set to true, if all components of TCL have been found.
+#  TCL_INCLUDES   = Include path for the header files of TCL
+#  TCL_LIBRARIES  = Link these to use TCL
+#  TCL_LFGLAS     = Linker flags (optional)
+
+## -----------------------------------------------------------------------------
+## Standard locations where to look for required components
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+find_path (TCL_INCLUDES tcl.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES tcl tcl8.4 tcl8.3
+  NO_DEFAULT_PATH
+  )
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+find_library (TCL_LIBRARIES tcl tcl8.4 tcl8.3
+  PATHS ${lib_locations}
+  NO_DEFAULT_PATH
+  )
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+if (TCL_INCLUDES AND TCL_LIBRARIES)
+  set (HAVE_TCL TRUE)
+else (TCL_INCLUDES AND TCL_LIBRARIES)
+  set (HAVE_TCL FALSE)
+  if (NOT TCL_FIND_QUIETLY)
+    if (NOT TCL_INCLUDES)
+      message (STATUS "Unable to find TCL header files!")
+    endif (NOT TCL_INCLUDES)
+    if (NOT TCL_LIBRARIES)
+      message (STATUS "Unable to find TCL library files!")
+    endif (NOT TCL_LIBRARIES)
+  endif (NOT TCL_FIND_QUIETLY)
+endif (TCL_INCLUDES AND TCL_LIBRARIES)
+
+if (HAVE_TCL)
+  if (NOT TCL_FIND_QUIETLY)
+    message (STATUS "Found components for TCL")
+    message (STATUS "TCL_INCLUDES  = ${TCL_INCLUDES}")
+    message (STATUS "TCL_LIBRARIES = ${TCL_LIBRARIES}")
+  endif (NOT TCL_FIND_QUIETLY)
+else (HAVE_TCL)
+  if (TCL_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find TCL!")
+  endif (TCL_FIND_REQUIRED)
+endif (HAVE_TCL)
+
+## -----------------------------------------------------------------------------
+## Mark advanced variables
+
+mark_as_advanced (
+  TCL_INCLUDES
+  TCL_LIBRARIES
+  )
diff --git a/cmake/modules/FindTK.cmake b/cmake/modules/FindTK.cmake
new file mode 100644
index 00000000000..6f2640d2262
--- /dev/null
+++ b/cmake/modules/FindTK.cmake
@@ -0,0 +1,88 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: IO.h 393 2007-06-13 10:49:08Z baehren                               $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of TK
+#
+# The following variables are set when TK is found:
+#  HAVE_TK       = Set to true, if all components of TK have been found.
+#  TK_INCLUDES   = Include path for the header files of TK
+#  TK_LIBRARIES  = Link these to use TK
+#  TK_LFGLAS     = Linker flags (optional)
+
+## -----------------------------------------------------------------------------
+## Standard locations where to look for required components
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+find_path (TK_INCLUDES tk.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES tk tk8.4 tk8.3 tcl tcl8.4 tcl8.3
+  NO_DEFAULT_PATH
+  )
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+find_library (TK_LIBRARIES tk tk8.4 tk8.3
+  PATHS ${lib_locations}
+  NO_DEFAULT_PATH
+  )
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+if (TK_INCLUDES AND TK_LIBRARIES)
+  set (HAVE_TK TRUE)
+else (TK_INCLUDES AND TK_LIBRARIES)
+  set (HAVE_TK FALSE)
+  if (NOT TK_FIND_QUIETLY)
+    if (NOT TK_INCLUDES)
+      message (STATUS "Unable to find TK header files!")
+    endif (NOT TK_INCLUDES)
+    if (NOT TK_LIBRARIES)
+      message (STATUS "Unable to find TK library files!")
+    endif (NOT TK_LIBRARIES)
+  endif (NOT TK_FIND_QUIETLY)
+endif (TK_INCLUDES AND TK_LIBRARIES)
+
+if (HAVE_TK)
+  if (NOT TK_FIND_QUIETLY)
+    message (STATUS "Found components for TK")
+    message (STATUS "TK_INCLUDES  = ${TK_INCLUDES}")
+    message (STATUS "TK_LIBRARIES = ${TK_LIBRARIES}")
+  endif (NOT TK_FIND_QUIETLY)
+else (HAVE_TK)
+  if (TK_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find TK!")
+  endif (TK_FIND_REQUIRED)
+endif (HAVE_TK)
+
+## -----------------------------------------------------------------------------
+## Mark advanced variables
+
+mark_as_advanced (
+  TK_INCLUDES
+  TK_LIBRARIES
+  )
diff --git a/cmake/modules/FindWCS.cmake b/cmake/modules/FindWCS.cmake
new file mode 100644
index 00000000000..5a711e4ac8f
--- /dev/null
+++ b/cmake/modules/FindWCS.cmake
@@ -0,0 +1,88 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: FindWCS.cmake 1643 2008-06-14 10:19:20Z baehren                     $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of WCS
+#
+# The following variables are set when WCS is found:
+#  HAVE_WCSLIB       = Set to true, if all components of WCS have been found.
+#  WCSLIB_INCLUDES   = Include path for the header files of WCS
+#  WCSLIB_LIBRARIES  = Link these to use WCS
+
+## -----------------------------------------------------------------------------
+## Search locations
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+find_path (WCSLIB_INCLUDES wcs/wcs.h wcslib/wcs.h
+  PATHS ${include_locations}
+  NO_DEFAULT_PATH
+  )
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+find_library (WCSLIB_LIBRARIES wcs
+  PATHS ${lib_locations}
+  PATH_SUFFIXES wcs wcslib darwin/lib linux_gnu/lib stable/linux_gnu/lib
+  NO_DEFAULT_PATH
+  )
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+IF (WCSLIB_INCLUDES AND WCSLIB_LIBRARIES)
+  SET (HAVE_WCSLIB TRUE)
+ELSE (WCSLIB_INCLUDES AND WCSLIB_LIBRARIES)
+  SET (HAVE_WCSLIB FALSE)
+  IF (NOT WCSLIB_FIND_QUIETLY)
+    IF (NOT WCSLIB_INCLUDES)
+      MESSAGE (STATUS "Unable to find WCS header files!")
+    ENDIF (NOT WCSLIB_INCLUDES)
+    IF (NOT WCSLIB_LIBRARIES)
+      MESSAGE (STATUS "Unable to find WCS library files!")
+    ENDIF (NOT WCSLIB_LIBRARIES)
+  ENDIF (NOT WCSLIB_FIND_QUIETLY)
+ENDIF (WCSLIB_INCLUDES AND WCSLIB_LIBRARIES)
+
+IF (HAVE_WCSLIB)
+  IF (NOT WCSLIB_FIND_QUIETLY)
+    MESSAGE (STATUS "Found components for WCS")
+    MESSAGE (STATUS "WCSLIB_INCLUDES  = ${WCSLIB_INCLUDES}")
+    MESSAGE (STATUS "WCSLIB_LIBRARIES = ${WCSLIB_LIBRARIES}")
+  ENDIF (NOT WCSLIB_FIND_QUIETLY)
+ELSE (HAVE_WCSLIB)
+  IF (WCSLIB_FIND_REQUIRED)
+    MESSAGE (FATAL_ERROR "Could not find WCS!")
+  ENDIF (WCSLIB_FIND_REQUIRED)
+ENDIF (HAVE_WCSLIB)
+
+## ------------------------------------------------------------------------------
+## Mark as advanced ...
+
+mark_as_advanced (
+  HAVE_WCSLIB
+  WCSLIB_INCLUDES
+  WCSLIB_LIBRARIES
+  )
diff --git a/cmake/modules/FindXaw.cmake b/cmake/modules/FindXaw.cmake
new file mode 100644
index 00000000000..f58379ec569
--- /dev/null
+++ b/cmake/modules/FindXaw.cmake
@@ -0,0 +1,88 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: IO.h 393 2007-06-13 10:49:08Z baehren                               $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of XAW
+#
+# The following variables are set when XAW is found:
+#  HAVE_XAW       = Set to true, if all components of XAW have been found.
+#  XAW_INCLUDES   = Include path for the header files of XAW
+#  XAW_LIBRARIES  = Link these to use XAW
+#  XAW_LFGLAS     = Linker flags (optional)
+
+## -----------------------------------------------------------------------------
+## Search locations
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+find_path (XAW_INCLUDES XawInit.h XawImP.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES X11 X11/Xaw
+  NO_DEFAULT_PATH
+  )
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+find_library (XAW_LIBRARIES Xaw
+  PATHS ${lib_locations}
+  NO_DEFAULT_PATH
+  )
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+if (XAW_INCLUDES AND XAW_LIBRARIES)
+  set (HAVE_XAW TRUE)
+else (XAW_INCLUDES AND XAW_LIBRARIES)
+  set (HAVE_XAW FALSE)
+  if (NOT XAW_FIND_QUIETLY)
+    if (NOT XAW_INCLUDES)
+      message (STATUS "Unable to find XAW header files!")
+    endif (NOT XAW_INCLUDES)
+    if (NOT XAW_LIBRARIES)
+      message (STATUS "Unable to find XAW library files!")
+    endif (NOT XAW_LIBRARIES)
+  endif (NOT XAW_FIND_QUIETLY)
+endif (XAW_INCLUDES AND XAW_LIBRARIES)
+
+if (HAVE_XAW)
+  if (NOT XAW_FIND_QUIETLY)
+    message (STATUS "Found components for XAW")
+    message (STATUS "XAW_INCLUDES  = ${XAW_INCLUDES}")
+    message (STATUS "XAW_LIBRARIES = ${XAW_LIBRARIES}")
+  endif (NOT XAW_FIND_QUIETLY)
+else (HAVE_XAW)
+  if (XAW_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find XAW!")
+  endif (XAW_FIND_REQUIRED)
+endif (HAVE_XAW)
+
+## -----------------------------------------------------------------------------
+## Mark advanced variables
+
+mark_as_advanced (
+  XAW_INCLUDES
+  XAW_LIBRARIES
+  )
diff --git a/cmake/modules/FindXm.cmake b/cmake/modules/FindXm.cmake
new file mode 100644
index 00000000000..dc77827d12c
--- /dev/null
+++ b/cmake/modules/FindXm.cmake
@@ -0,0 +1,90 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: IO.h 393 2007-06-13 10:49:08Z baehren                               $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of XM
+#
+# The following variables are set when XM is found:
+#  HAVE_XM       = Set to true, if all components of XM have been found.
+#  XM_INCLUDES   = Include path for the header files of XM
+#  XM_LIBRARIES  = Link these to use XM
+#  XM_LFGLAS     = Linker flags (optional)
+
+## -----------------------------------------------------------------------------
+## Search locations
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+find_path (XM_INCLUDES Xm.h XmP.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES Xm X11 X11/Xm
+  NO_DEFAULT_PATH
+  )
+
+string (REGEX REPLACE "include/Xm" "include" XM_INCLUDES ${XM_INCLUDES})
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+find_library (XM_LIBRARIES Xm
+  PATHS ${lib_locations}
+  NO_DEFAULT_PATH
+  )
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+if (XM_INCLUDES AND XM_LIBRARIES)
+  set (HAVE_XM TRUE)
+else (XM_INCLUDES AND XM_LIBRARIES)
+  set (HAVE_XM FALSE)
+  if (NOT XM_FIND_QUIETLY)
+    if (NOT XM_INCLUDES)
+      message (STATUS "Unable to find XM header files!")
+    endif (NOT XM_INCLUDES)
+    if (NOT XM_LIBRARIES)
+      message (STATUS "Unable to find XM library files!")
+    endif (NOT XM_LIBRARIES)
+  endif (NOT XM_FIND_QUIETLY)
+endif (XM_INCLUDES AND XM_LIBRARIES)
+
+if (HAVE_XM)
+  if (NOT XM_FIND_QUIETLY)
+    message (STATUS "Found components for XM")
+    message (STATUS "XM_INCLUDES  = ${XM_INCLUDES}")
+    message (STATUS "XM_LIBRARIES = ${XM_LIBRARIES}")
+  endif (NOT XM_FIND_QUIETLY)
+else (HAVE_XM)
+  if (XM_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find XM!")
+  endif (XM_FIND_REQUIRED)
+endif (HAVE_XM)
+
+## -----------------------------------------------------------------------------
+## Mark advanced variables
+
+mark_as_advanced (
+  XM_INCLUDES
+  XM_LIBRARIES
+  )
diff --git a/cmake/modules/InstallROOT.cmake b/cmake/modules/InstallROOT.cmake
new file mode 100644
index 00000000000..e00af0afa11
--- /dev/null
+++ b/cmake/modules/InstallROOT.cmake
@@ -0,0 +1,201 @@
+##------------------------------------------------------------------------------
+## $Id:: CMakeLists.txt 494 2007-08-02 09:39:15Z baehren                       $
+##------------------------------------------------------------------------------
+
+## =============================================================================
+## CMake script to aid installation of the ROOT data analysis framework
+## =============================================================================
+
+## -----------------------------------------------------------------------------
+## Settings 
+
+## Location of the CMake scripts
+
+find_path (cmake_scripts FindROOT.cmake InstallROOT.cmake
+  PATHS
+  .
+  ..
+  ../..
+  PATH_SUFFIXES
+  devel_common/cmake
+)
+
+if (cmake_scripts)
+  message (STATUS "Found CMake script directory : ${cmake_scripts}")
+elseif (cmake_scripts)
+  message (FATAL_ERROR "Cannot find CMake script directory; unable to continue!")
+endif (cmake_scripts)
+
+## Locations in which to search
+
+set (bin_locations
+  /usr/bin
+  /usr/local/bin
+  /sw/bin
+  /opt
+)
+
+## URL : ftp://root.cern.ch/root/root_v5.16.00.source.tar.gz
+
+set (root_version_major 5)
+set (root_version_minor 16)
+set (root_version_patch 00)
+set (root_version "${root_version_major}.${root_version_minor}.${root_version_patch}")
+
+set (root_source_dir "root")
+set (root_source_file "root_v${root_version}.source.tar.gz")
+
+set (root_url "ftp://root.cern.ch/root/${root_source_file}")
+
+## -----------------------------------------------------------------------------
+## Locate required tools
+
+find_program (CURL_EXECUTABLE curl PATHS ${bin_locations})
+find_program (TAR_EXECUTABLE tar PATHS ${bin_locations})
+find_program (WGET_EXECUTABLE wget PATHS ${bin_locations})
+
+## -----------------------------------------------------------------------------
+## Feedback
+
+message (STATUS "ROOT source file ...... : ${root_source_file}")
+message (STATUS "ROOT source package URL : ${root_source_file}")
+message (STATUS "curl .................. : ${CURL_EXECUTABLE}")
+message (STATUS "tar ................... : ${TAR_EXECUTABLE}")
+message (STATUS "wget .................. : ${WGET_EXECUTABLE}")
+
+## =============================================================================
+##  Processing 
+## =============================================================================
+
+## -----------------------------------------------------------------------------
+## [1] Retrieve the source distribution; this will only be required if a source
+## tar-ball isn't there already
+
+## Is the source package there already?
+
+find_file (HAVE_ROOT_SOURCE ${root_source_file}
+  PATHS . .. /opt /tmp /Volumes/UNIX
+)
+
+## If the source package is not there yet, we try to fetch it
+
+if (NOT HAVE_ROOT_SOURCE)
+  message (STATUS "No source package found; try to fetch it now ...")
+  if (WGET_EXECUTABLE)
+    execute_process (
+      WORKING_DIRECTORY .
+      COMMAND ${WGET_EXECUTABLE} -c ${root_url}
+      TIMEOUT 300
+      ERROR_VARIABLE wget_cerr
+      OUTPUT_QUIET
+      )
+    if (wget_cerr)
+      message (STATUS "[wget] Unable to download source package!")
+      message (STATUS "${wget_cerr}")
+    endif (wget_cerr)
+  elseif (WGET_EXECUTABLE)
+    message (STATUS "Unable to use wget; trying to switch to curl.")
+    if (CURL_EXECUTABLE)
+    elseif (CURL_EXECUTABLE)
+    endif (CURL_EXECUTABLE)
+  endif (WGET_EXECUTABLE)
+endif (NOT HAVE_ROOT_SOURCE)
+
+## Once we have retrieved the source package, adjust the variable pointing to it
+
+find_file (HAVE_ROOT_SOURCE ${root_source_file} PATHS . ..)
+
+## -----------------------------------------------------------------------------
+## [2] Unpack the source package
+
+if (TAR_EXECUTABLE AND HAVE_ROOT_SOURCE)
+  message (STATUS "Unpacking source package ${HAVE_ROOT_SOURCE} ...")
+  execute_process (
+    WORKING_DIRECTORY .
+    COMMAND ${TAR_EXECUTABLE} -xvzf ${HAVE_ROOT_SOURCE}
+    TIMEOUT 120
+    ERROR_VARIABLE tar_cerr
+    OUTPUT_QUIET
+    )
+  if (tar_cerr)
+    message (STATUS "[tar] Error expanding the source package!")
+    message (STATUS ${tar_cerr})
+  endif (tar_cerr)
+endif (TAR_EXECUTABLE AND HAVE_ROOT_SOURCE)
+
+## -----------------------------------------------------------------------------
+## [3] Configure the source package
+
+## Determine installation
+
+find_path (root_prefix release_area.txt
+  PATHS
+  ../release
+  ../../release
+  NO_DEFAULT_PATH
+  )
+
+if (root_prefix)
+  message (STATUS "Installation area located for package wcslib.")
+  set (CMAKE_INSTALL_PREFIX ${root_prefix}) 
+endif (root_prefix)
+
+## Adjust the path to the source package directory previously created
+
+find_path (HAVE_ROOT_SOURCE_DIR configure LICENSE
+  PATHS . ./${root_source_dir} ../${root_source_dir}
+  )
+
+## Handle the various installation options for ROOT
+
+# enable/disable options, prefix with either --enable- or --disable-
+#   afs                AFS support, requires AFS libs and objects
+#   alien              AliEn support, requires libgapiUI from ALICE
+#   asimage            Image processing support, requires libAfterImage
+#   astiff             Include tiff support in image processing
+#   builtin-afterimage Built included libAfterImage, or use system libAfterImage
+#   builtin-freetype   Built included libfreetype, or use system libfreetype
+#   builtin-pcre       Built included libpcre, or use system libpcre
+#   builtin-zlib       Built included libz, or use system libz
+#   castor             CASTOR support, requires libshift from CASTOR >= 1.5.2
+#   cern               CERNLIB usage, build h2root and g2root
+#   chirp              Chirp support (Condor remote I/O), requires libchirp_client
+#   cint7              Build the *experimental* new Cint library
+#   cintex             Build the libCintex Reflex interface library
+#   clarens            Clarens RPC support, optionally used by PROOF
+#   dcache             dCache support, requires libdcap from DESY
+#   exceptions         Turn on compiler exception handling capability
+#   explicitlink       Explicitly link with all dependent libraries
+#   fftw3              Fast Fourier Transform support, requires libfftw3
+#   gdml               GDML writer and reader
+#   gfal               GFAL support, requires libgfal
+#   g4root             GEANT4 navigator based on TGeo, requires GEANT4 installed
+#   globus             Globus authentication support, requires Globus toolkit
+#   krb5               Kerberos5 support, requires Kerberos libs
+
+set (root_options "")
+
+include (${cmake_scripts}/FindFFTW3.cmake)
+
+if (HAVE_FFTW3)
+  set (root_options " -with-fftw3")
+endif (HAVE_FFTW3)
+
+if (HAVE_ROOT_SOURCE_DIR)
+  message (STATUS "Configuring source package for installation at ${root_prefix} ...")
+  execute_process (
+    WORKING_DIRECTORY ${HAVE_ROOT_SOURCE_DIR}
+    COMMAND ./configure --prefix=${CMAKE_INSTALL_PREFIX} ${root_options}
+    TIMEOUT 180
+    ERROR_VARIABLE configure_cerr
+    OUTPUT_QUIET
+    )
+  if (configure_cerr)
+    message (STATUS "[configure] Error while configuring source package!")
+    message (STATUS ${configure_cerr})
+  endif (configure_cerr)
+endif (HAVE_ROOT_SOURCE_DIR)
+
+## -----------------------------------------------------------------------------
+## [4] Build the package from source
+
diff --git a/cmake/modules/LOFARTest.cmake b/cmake/modules/LOFARTest.cmake
new file mode 100644
index 00000000000..e744b1359b1
--- /dev/null
+++ b/cmake/modules/LOFARTest.cmake
@@ -0,0 +1,28 @@
+#  $Id$
+#
+#  Copyright (C) 2008-2009
+#  ASTRON (Netherlands Foundation for Research in Astronomy)
+#  P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+#
+#  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, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+## ----------------------------------------------------------------------------
+## Configure the LOFAR test scripts in the current binary directory
+## ----------------------------------------------------------------------------
+
+include (${LOFAR_ROOT}/cmake/modules/CMakeSettings.cmake)
+
+configure_file(${LOFAR_ROOT}/autoconf_share/runctest.sh
+               ${CMAKE_CURRENT_BINARY_DIR}/runctest.sh)
diff --git a/cmake/modules/LofarGeneral.cmake b/cmake/modules/LofarGeneral.cmake
new file mode 100644
index 00000000000..3c89c325233
--- /dev/null
+++ b/cmake/modules/LofarGeneral.cmake
@@ -0,0 +1,107 @@
+## -----------------------------------------------------------------------------
+## Set verbose
+
+Set ( CMAKE_VERBOSE_MAKEFILE ON )
+
+## ------------------------------------------------------------------------------
+## Additional CMake modules
+
+include (CheckIncludeFiles)
+include (CheckLibraryExists)
+include (CheckCXXSourceCompiles)
+include (CheckTypeSize)
+include (CTest)
+enable_testing()
+
+## ------------------------------------------------------------------------------
+## Create lofar_config.h header
+
+set (LOFAR_config ${LOFAR_BINARY_DIR}/lofar_config.h)
+file (WRITE ${LOFAR_config} "/* lofar_config.h --  Generated by CMake. */\n\n")
+
+## ------------------------------------------------------------------------------
+## Create config header
+set (config ${LOFAR_ROOT}/cmake/modules/lofar_config.h.in)
+
+## ------------------------------------------------------------------------------
+## Create lofar_config.h content
+
+MACRO (CHECK_LOFAR_FUNCTION_NAME _FUNCTIONNAMEMACRO _RESULT)
+  SET(_LOFAR_FUNCTION_NAME "
+#include <stdio.h>
+
+int main()
+{
+  puts(${_FUNCTIONNAMEMACRO});
+  return 0;
+}
+")
+
+  CHECK_CXX_SOURCE_COMPILES("${_LOFAR_FUNCTION_NAME}" ${_RESULT})
+ENDMACRO (CHECK_LOFAR_FUNCTION_NAME)
+
+SET (AUTO_FUNCTION_NAME 1)
+SET (FUNCTIONNAMEMACRO "__PRETTY_FUNCTION__;__FUNCTION__")
+
+foreach (item ${FUNCTIONNAMEMACRO})
+  CHECK_LOFAR_FUNCTION_NAME("__FUNCTION__" RESULT)
+  if (RESULT)
+    file (WRITE ${config} "#cmakedefine AUTO_FUNCTION_NAME ${item}")
+    break()
+  endif (RESULT)
+endforeach (item ${FUNCTIONNAMEMACRO})
+
+if (NOT RESULT)
+  file (WRITE ${config} "#cmakedefine AUTO_FUNCTION_NAME <unknown>")
+endif (NOT RESULT)
+
+configure_file (${config}
+  ${LOFAR_BINARY_DIR}/tmp_lofar_config.h)
+
+file(READ ${LOFAR_BINARY_DIR}/tmp_lofar_config.h tmpLofarConfig)
+file(APPEND ${LOFAR_config} "${tmpLofarConfig}")
+
+add_definitions(-DHAVE_CONFIG_H)
+
+## ------------------------------------------------------------------------------
+## Check system libraries
+
+check_include_files (sys/socket.h  HAVE_SYS_SOCKET_H )
+check_include_files (sys/types.h   HAVE_SYS_TYPES_H  )
+check_include_files (unistd.h      HAVE_UNISTD_H     )
+check_include_files (stdarg.h      HAVE_STDARG_H     )
+check_include_files (time.h        HAVE_TIME_H       )
+check_include_files (stdio.h       HAVE_STDIO_H      )
+check_include_files (netinet/in.h  HAVE_NETINET_IN_H )
+
+if (HAVE_SYS_TYPES_H)
+  check_type_size ("uint" HAVE_UINT)
+  if (HAVE_UINT)
+    add_definitions (-DHAVE_UINT)
+  endif (HAVE_UINT)
+  ##
+  check_type_size ("long" HAVE_LONG)
+  if (HAVE_LONG)
+    add_definitions (-DHAVE_LONG)
+  endif (HAVE_LONG)
+  ##
+  check_type_size ("long long" HAVE_LONGLONG)
+  if (HAVE_LONGLONG)
+    add_definitions (-DHAVE_LONGLONG)
+  endif (HAVE_LONGLONG)
+  ##
+  check_type_size ("ushort" HAVE_USHORT)
+  if (HAVE_USHORT)
+    add_definitions (-DHAVE_USHORT)
+  endif (HAVE_USHORT)
+else (HAVE_SYS_TYPES_H)
+  message (STATUS "Unable to find sys/types.h")
+endif (HAVE_SYS_TYPES_H)
+
+## ------------------------------------------------------------------------------
+## Check for required tools
+
+find_program ( bison_bin bison )
+find_program ( flex_bin  flex  )
+find_program ( lex_bin   lex   )
+find_program ( yacc_bin  yacc  )
diff --git a/cmake/modules/MakePackageVersion.cmake b/cmake/modules/MakePackageVersion.cmake
new file mode 100644
index 00000000000..0016ef22ee7
--- /dev/null
+++ b/cmake/modules/MakePackageVersion.cmake
@@ -0,0 +1,156 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: IO.h 393 2007-06-13 10:49:08Z baehren                               $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+## ==============================================================================
+##
+## Macro definition: make_package_version
+##
+## -----------------
+##
+## Input parameters:
+##
+##  - MODULE_PATH       = Path to the module for which the package version
+##                        information is to be processed.
+##  - CREATE_VERSION_H  = Create file Package_Version.h
+##  - CREATE_VERSION_CC = Create file Package_Version.cc
+##
+## -----------------
+##
+## Pending issues:
+##
+##  - The package version files should not be written into the source tree, but
+##    rather into the location defined by PROJECT_BINARY_DIR
+##
+## ==============================================================================
+
+MACRO (make_package_version MODULE_PATH CREATE_VERSION_H CREATE_VERSION_CC)
+
+  ## -----------------------------------------------------------------
+  ## Retrieve SVN information
+
+  execute_process (
+    WORKING_DIRECTORY ${MODULE_PATH}
+    COMMAND svn info
+    TIMEOUT 300
+    RESULT_VARIABLE svn_info_result
+    OUTPUT_VARIABLE svn_info_output
+    ERROR_VARIABLE svn_info_error
+    )
+
+  ## -----------------------------------------------------------------
+  ## Extract the name of the module
+
+  string (REGEX REPLACE ".*/" "" MODULE_NAME ${MODULE_PATH})
+
+  ## -----------------------------------------------------------------
+  ## Parse the boolean parameters; since their values are handed over
+  ## as strings and not as booleans we should make sure they are
+  ## converted to the latter.
+  
+  if (${CREATE_VERSION_H} MATCHES "TRUE")
+    set (CREATE_VERSION_H TRUE)
+  else (${CREATE_VERSION_H} MATCHES "TRUE")
+    set (CREATE_VERSION_H FALSE)
+    if (${CREATE_VERSION_H} MATCHES "YES")
+      set (CREATE_VERSION_H TRUE)
+    else (${CREATE_VERSION_H} MATCHES "YES")
+      set (CREATE_VERSION_H FALSE)
+    endif (${CREATE_VERSION_H} MATCHES "YES")
+  endif (${CREATE_VERSION_H} MATCHES "TRUE")
+  
+  if (${CREATE_VERSION_CC} MATCHES "TRUE")
+    set (CREATE_VERSION_CC TRUE)
+  else (${CREATE_VERSION_CC} MATCHES "TRUE")
+    set (CREATE_VERSION_CC FALSE)
+    if (${CREATE_VERSION_CC} MATCHES "YES")
+      set (CREATE_VERSION_CC TRUE)
+    else (${CREATE_VERSION_CC} MATCHES "YES")
+      set (CREATE_VERSION_CC FALSE)
+    endif (${CREATE_VERSION_CC} MATCHES "YES")
+  endif (${CREATE_VERSION_CC} MATCHES "TRUE")
+  
+  ## -----------------------------------------------------------------
+  ## Extract the revision number
+
+  string (REGEX MATCH "Revision: .*Node" svn_info_revision ${svn_info_output})
+  string (REGEX REPLACE "\nNode" "" svn_info_revision ${svn_info_revision})
+  string (REGEX REPLACE "Revision: " "" svn_info_revision ${svn_info_revision})
+
+  ## -----------------------------------------------------------------
+  ## Extract author of last changes
+
+  string (REGEX MATCH "Author: .*Last Changed Rev" svn_info_author ${svn_info_output})
+  string (REGEX REPLACE "\nLast Changed Rev" "" svn_info_author ${svn_info_author})
+  string (REGEX REPLACE "Author: " "" svn_info_author ${svn_info_author})
+
+  ## -----------------------------------------------------------------
+  ## Extract the revision of the last changes
+
+  string (REGEX MATCH "Changed Rev: .*Last Changed Date" svn_info_rev ${svn_info_output})
+  string (REGEX REPLACE "\nLast Changed Date" "" svn_info_rev ${svn_info_rev})
+  string (REGEX REPLACE "Changed Rev: " "" svn_info_rev ${svn_info_rev})
+
+  ## -----------------------------------------------------------------
+  ## Create Package_Version.h
+
+  if (CREATE_VERSION_H)
+    # variables to be inserted into the configuration file
+    set (VERSION_H_NAME "${MODULE_PATH}/Package__Version.h")
+    string (TOUPPER "LOFAR_${MODULE_NAME}_PACKAGE__VERSION_H" VERSION_H_GUARD)
+    # create file
+    configure_file (
+      ${CMAKE_MODULE_PATH}/Package__Version.h.in
+      ${MODULE_PATH}/Package__Version.h
+      )
+  endif (CREATE_VERSION_H)
+  
+  ## -----------------------------------------------------------------
+  ## Create Package_Version.cc
+  
+  if (CREATE_VERSION_CC)
+    # create file
+    configure_file (
+      ${CMAKE_MODULE_PATH}/Package__Version.cc.in
+      ${MODULE_PATH}/Package__Version.cc
+      )
+  endif (CREATE_VERSION_CC)
+  
+  ## -----------------------------------------------------------------
+  ## Summary 
+
+  message (STATUS "[make_package_version]")
+  message (STATUS "MODULE_PATH         = ${MODULE_PATH}")
+  message (STATUS "MODULE_NAME         = ${MODULE_NAME}")
+  message (STATUS "CREATE_VERSION_H    = ${CREATE_VERSION_H}")
+  message (STATUS "CREATE_VERSION_CC   = ${CREATE_VERSION_CC}")
+
+  if (svn_info_result) 
+    message (STATUS "Result              = ${svn_info_result}")
+    message (STATUS "Output              = ${svn_info_output}")
+    message (STATUS "Error               = ${svn_info_error}")
+  else (svn_info_result) 
+    message (STATUS "Revision            = ${svn_info_revision}")
+    message (STATUS "Last Changed Author = ${svn_info_author}")
+    message (STATUS "Last Changed Rev    = ${svn_info_rev}")
+  endif (svn_info_result)
+  
+ENDMACRO (make_package_version)
\ No newline at end of file
diff --git a/cmake/modules/Package__Version.cc.in b/cmake/modules/Package__Version.cc.in
new file mode 100644
index 00000000000..075a0c6deb7
--- /dev/null
+++ b/cmake/modules/Package__Version.cc.in
@@ -0,0 +1,35 @@
+//# Get revision info; generated by cmake/MakePackageVersion
+
+//## pkg=${PROJECT_NAME}
+//## incpath=$incpath
+//## incdir=$incdir
+
+#include "Package__Version.h"
+#include <Common/Version.h>
+#include "FillPackage__VersionInc.h"
+
+namespace LOFAR {
+  Version ${PROJECT_NAME}Version::getInfo()
+  {
+    return Version ("${PROJECT_NAME}",
+		    getVersion(), getConfVersion(),
+		    getRevision(), getPackageRevision(),
+		    getNrChangedFiles(),
+		    getBuildTime(), getBuildUser(), getBuildMachine());
+  }
+
+  std::string ${PROJECT_NAME}Version::getVersion()
+    { return "$rvers"; }
+  std::string ${PROJECT_NAME}Version::getConfVersion()
+    { return "$cvers"; }
+  std::string ${PROJECT_NAME}Version::getRevision()
+    { return "${svn_info_revision}"; }
+  std::string ${PROJECT_NAME}Version::getPackageRevision()
+    { return "$lrev"; }
+  std::string ${pkg}Version::getNrChangedFiles()
+    { return "$nrch"; }
+}
+
+//# fillversion.h is generated in build area by lofar_internal.m4
+//# It contains function fillInfo
+#include "FillPackage__VersionFunc.h"
diff --git a/cmake/modules/Package__Version.h.in b/cmake/modules/Package__Version.h.in
new file mode 100644
index 00000000000..eb560a19d79
--- /dev/null
+++ b/cmake/modules/Package__Version.h.in
@@ -0,0 +1,41 @@
+//# Get revision info; generated by cmake/MakePackageVersion
+
+#ifndef ${VERSION_H_GUARD}
+#define ${VERSION_H_GUARD}
+
+#include <Common/Version.h>
+
+// Class to get the version (revision) of the package and the packages it uses.
+namespace LOFAR {
+
+  class ${PROJECT_NAME}Version {
+
+  public:
+    // Get the info for this package.
+    static Version getInfo();
+    
+    // Get the version number of the package (as given in repository).
+    static std::string getVersion();
+    // Get the svn version number of the package according to configure.in.
+    static std::string getConfVersion();
+    // Get the global revision number of the package.
+    static std::string getRevision();
+    // Get the local revision number of the package.
+    static std::string getPackageRevision();
+    // Get the number of files differing from repository.
+    // Usually this is blank, but it can tell the nr of changed files.
+    static std::string getNrChangedFiles();
+    // Get the date/time the package was built (in fact, configured).
+    static std::string getBuildTime();
+    // Get the name of the user who built the package.
+    static std::string getBuildUser();
+    // Get the machine the package was built on.
+    static std::string getBuildMachine();
+    
+    // Append the vector with the vinfo of this package and used packages.
+    static void fillInfo (int level,
+			  std::vector<Version::PkgInfo>& vec);
+  };
+}
+
+#endif
diff --git a/cmake/modules/README.txt b/cmake/modules/README.txt
new file mode 100644
index 00000000000..dc4d900f3bb
--- /dev/null
+++ b/cmake/modules/README.txt
@@ -0,0 +1,142 @@
+##------------------------------------------------------------------------
+## $Id::                                                                 $
+##------------------------------------------------------------------------
+
+===== Note to authors of FindXXX.cmake files =====
+
+We would like all FindXXX.cmake files to produce consistent variable names.
+
+Please use the following consistent variable names for general use.
+
+XXX_INCLUDE_DIRS        The final set of include directories listed in one variable for use by client code.  This should not be a cache entry.
+XXX_LIBRARIES          	The libraries to link against to use XXX. These should include full paths.  This should not be a cache entry.
+XXX_DEFINITIONS        	Definitions to use when compiling code that uses XXX. This really shouldn't include options such as (-DHAS_JPEG)that a client source-code file uses to decide whether to #include <jpeg.h>
+XXX_EXECUTABLE         	Where to find the XXX tool.
+XXX_YYY_EXECUTABLE     	Where to find the YYY tool that comes with XXX.
+XXX_LIBRARY_DIRS        Optionally, the final set of library directories listed in one variable for use by client code.  This should not be a cache entry.
+XXX_ROOT_DIR           	Where to find the base directory of XXX.
+XXX_VERSION_YY		Expect Version YY if true. Make sure at most one of these is ever true.
+XXX_WRAP_YY		If False, do not try to use the relevent CMake wrapping command.
+XXX_YY_FOUND           	If False, optional YY part of XXX sytem is not available.
+XXX_FOUND              	Set to false, or undefined, if we haven't found, or don't want to use XXX.
+
+You do not have to provide all of the above variables. You should provide XXX_FOUND under most circumstances. If XXX is a library, then  XXX_LIBRARIES, should also be defined, and XXX_INCLUDE_DIR should usually be defined (I guess libm.a might be an exception)
+
+The following names should not usually be used in CMakeLists.txt files, but they may be usefully modified in users' CMake Caches to control stuff.
+
+XXX_LIBRARY		Name of XXX Library. A User may set this and XXX_INCLUDE_DIR to ignore to force non-use of XXX.
+XXX_YY_LIBRARY		Name of YY library that is part of the XXX system. It may or may not be required to use XXX.
+XXX_INCLUDE_DIR        	Where to find xxx.h, etc.  (XXX_INCLUDE_PATH was considered bad because a path includes an actual filename.)
+XXX_YY_INCLUDE_DIR      Where to find xxx_yy.h, etc.
+
+For tidiness's sake, try to keep as many options as possible out of the cache, leaving at least one option which can be used to disable use of the module, or locate a not-found library (e.g. XXX_ROOT_DIR). For the same reason, mark most cache options as advanced.
+
+If you need other commands to do special things then it should still begin with XXX_. This gives a sort of namespace effect and keeps things tidy for the user. You should put comments describing all the exported settings, plus descriptions of any the users can use to control stuff.
+
+You really should also provide backwards compatibility any old settings that were actually in use. Make sure you comment them as deprecated, so that no-one starts using them.
+
+To correctly document a module, create a comment block at the top with # comments.  There are three types of comments that can be in the block:
+
+1. The brief description of the module, this is done by:
+# - a small description
+
+2. A paragraph of text.  This is done with all text that has a single
+space between the # and the text.  To create a new paragraph, just
+put a # with no text on the line.
+
+3. A verbatim line.  This is done with two spaces between the # and the text.
+
+For example:
+
+# - This is a cool module
+# This module does really cool stuff.
+# It can do even more than you think.
+# 
+# It even needs to paragraphs to tell you about it.
+# And it defines the following variables:
+#  VAR_COOL - this is greate isn't it?
+#  VAR_REALLY_COOL - cool right?
+#
+
+To have a .cmake file in this directory NOT show up in the
+modules documentation, you should start the file with a blank
+line.
+
+A FindXXX.cmake module will typically be loaded by the command
+
+  FIND_PACKAGE(XXX [QUIET] [REQUIRED [components...]])
+
+If the QUIET option is given to the command it will set the variable
+XXX_FIND_QUIETLY to true before loading the FindXXX.cmake module.  If
+this variable is set the module should not complain about not being
+able to find the package and should never issue a FATAL_ERROR.  If the
+REQUIRED option is given to the command it will set the variable
+XXX_FIND_REQUIRED to true before loading the FindXXX.cmake module.  If
+this variable is set the module should issue a FATAL_ERROR if the
+package cannot be found.  For each package-specific component, say
+YYY, listed after the REQUIRED option a variable XXX_FIND_REQUIRED_YYY
+to true.  The set of components listed will also be specified in a
+XXX_FIND_COMPONENTS variable.  This can be used by the FindXXX.cmake
+module to determine which sub-components of the package must be found.
+If neither the QUIET nor REQUIRED options are given then the
+FindXXX.cmake module should look for the package and complain without
+error if the module is not found.
+
+===== Example: FindCurses.cmake =====
+
+# - Find the curses include file and library
+#
+
+FIND_PATH(CURSES_INCLUDE_PATH 
+  curses.h
+  /usr/local/include 
+  /usr/include
+)
+
+FIND_LIBRARY(CURSES_LIBRARY 
+  NAMES curses ncurses
+  PATHS 
+    /usr/local/lib 
+    /usr/lib 
+    /lib
+)
+
+FIND_LIBRARY(CURSES_EXTRA_LIBRARY 
+  cur_colr
+  PATHS 
+    /usr/local/lib 
+    /usr/lib 
+    /lib
+)
+
+FIND_LIBRARY(FORM_LIBRARY 
+  form
+  PATHS 
+    /usr/local/lib 
+    /usr/lib 
+    /lib
+)
+
+# Need to provide the *_LIBRARIES
+SET(CURSES_LIBRARIES ${CURSES_LIBRARY})
+
+IF(CURSES_EXTRA_LIBRARY)
+  SET(CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_EXTRA_LIBRARY})
+ENDIF(CURSES_EXTRA_LIBRARY)
+
+IF(FORM_LIBRARY)
+  SET(CURSES_LIBRARIES ${CURSES_LIBRARIES} ${FORM_LIBRARY})
+ENDIF(FORM_LIBRARY)
+
+# Proper name is *_INCLUDE_DIR
+SET(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH})
+
+MARK_AS_ADVANCED(
+  CURSES_INCLUDE_PATH
+  CURSES_LIBRARY
+  CURSES_EXTRA_LIBRARY
+  FORM_LIBRARY
+  CURSES_LIBRARIES
+  CURSES_INCLUDE_DIR
+  )
+
diff --git a/cmake/modules/SettingsPLplot.cmake b/cmake/modules/SettingsPLplot.cmake
new file mode 100644
index 00000000000..1a3138d27e1
--- /dev/null
+++ b/cmake/modules/SettingsPLplot.cmake
@@ -0,0 +1,94 @@
+
+## -------------------------------------------------------------------
+## Search for external components
+
+find_path (plplot_cmake CMakeSettings.cmake
+  PATHS 
+  .
+  ./..
+  ./../..
+  ./../../..
+  PATH_SUFFIXES
+  devel_common/cmake
+  )
+
+if (plplot_cmake)
+  list (APPEND CMAKE_MODULE_PATH ${plplot_cmake})
+else (plplot_cmake)
+  message (FATAL_ERROR "Unable to locate additional CMake scripts!")
+endif (plplot_cmake)
+
+## Python.Numeric
+
+include (${plplot_cmake}/FindNumeric.cmake)
+
+if (NUMERIC_INCLUDES)
+  include_directories (${NUMERIC_INCLUDES})
+endif (NUMERIC_INCLUDES)
+
+## -------------------------------------------------------------------
+## Language bindings
+
+## building of dynamic libraries needs to be enabled to create Python
+## bindings; otherwise the Python bindings are disabled
+set (BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries?")
+
+set (ENABLE_f77 OFF CACHE BOOL "Enable bindings for Fortran 77?")
+set (ENABLE_f95 OFF CACHE BOOL "Enable bindings for Fortran 95?")
+set (ENABLE_gnome2 OFF CACHE BOOL "Enable bindings for GNOME2?")
+set (ENABLE_itcl OFF CACHE BOOL "Enable bindings for [incr Tcl]?")
+set (ENABLE_itk OFF CACHE BOOL "Enable bindings for [incr Tk]?")
+set (ENABLE_python ON CACHE BOOL "Enable bindings for Python?")
+set (ENABLE_java OFF CACHE BOOL "Enable bindings for Java?")
+set (ENABLE_pygcw OFF CACHE BOOL "Enable bindings for Python.gcw?")
+
+## -------------------------------------------------------------------
+## Device drivers
+
+set (ENABLE_DYNDRIVERS OFF CACHE BOOL "Enable dynamic drivers?")
+
+set (PLD_aqt OFF CACHE BOOL "Enable driver aqt")
+set (PLD_hp7470 OFF CACHE BOOL "Enable driver hp7470")
+set (PLD_hp7580 OFF CACHE BOOL "Enable driver hp7580")
+set (PLD_lj_hpgl OFF CACHE BOOL "Enable driver lj_hpgl")
+set (PLD_svg OFF CACHE BOOL "Enable driver svg")
+
+if (APPLE)
+  set (PLD_wxwidgets OFF CACHE BOOL "Enable driver wxwidgets")
+endif (APPLE)
+
+## -------------------------------------------------------------------
+## Testing
+
+set (BUILD_TEST ON CACHE BOOL "Build test programs?")
+
+## -------------------------------------------------------------------
+## Installation
+
+find_path (prefix release_area.txt
+  PATHS
+  ../release
+  ../../release
+  ../../../release
+  NO_DEFAULT_PATH
+  )
+
+if (prefix)
+  message (STATUS "Installation area located for package PLplot.")
+  get_filename_component (tmp ${prefix} ABSOLUTE)
+  set (CMAKE_INSTALL_PREFIX ${tmp} CACHE STRING "Installation prefix") 
+  ## Additional setting for Python bindings
+  set (PYTHON_INSTDIR "${prefix}/lib/python")
+endif (prefix)
+
+set (CMAKE_INSTALL_BINDIR "bin")
+set (CMAKE_INSTALL_DATADIR "share")
+set (CMAKE_INSTALL_EXEC_PREFIX "bin")
+set (CMAKE_INSTALL_INCLUDEDIR "include")
+set (CMAKE_INSTALL_INFODIR "share/info")
+set (CMAKE_INSTALL_LIBDIR "lib")
+set (CMAKE_INSTALL_MANDIR "share/man")
+
+if (UNIX)
+  set (CMAKE_FIND_LIBRARY_PREFIXES "lib")
+endif (UNIX)
diff --git a/cmake/modules/UpdateCASACORE.cmake b/cmake/modules/UpdateCASACORE.cmake
new file mode 100644
index 00000000000..faebc39befd
--- /dev/null
+++ b/cmake/modules/UpdateCASACORE.cmake
@@ -0,0 +1,96 @@
+##------------------------------------------------------------------------------
+## $Id:: CMakeLists.txt 489 2007-08-01 11:40:38Z baehren                       $
+##------------------------------------------------------------------------------
+
+## =============================================================================
+## Update 
+## =============================================================================
+
+set (bin_locations
+  /usr/bin
+  /usr/local/bin
+  /sw/bin
+  /opt
+)
+
+set (casacore_libs
+  casa
+  tables
+  mirlib
+  scimath
+  measures
+  fits
+  coordinates
+  components
+  lattices
+  ms
+  images
+  msfits
+  msvis
+)
+
+set (casacore_url "http://casacore.googlecode.com/svn/trunk")
+
+## =============================================================================
+##  
+##  CMake script to update the source code distribution of the "casacore"
+##  packages, as provided as part of the LOFAR user software, with the latest
+##  source code retrieved from the original code repository.
+## 
+## =============================================================================
+
+## -----------------------------------------------------------------------------
+## [1] Find the location of the casacore source code distribution, which is part
+## of the LOFAR User software; this is what we are going to update.
+ 
+find_path (AIPS_H aips_h aipsdef.h aipsenv.h
+  PATHS
+  ./casacore
+  ../casacore
+  ../../casacore
+  ./external/casacore
+  ../../external/casacore
+  PATH_SUFFIXES casa/casa
+)
+
+if (AIPS_H)
+  string (REGEX REPLACE casa/casa "" CASACORE_USG ${AIPS_H})
+  message (STATUS "Found USG distribution of casacore: ${CASACORE_USG}")
+elseif (AIPS_H)
+  message (FATAL_ERROR "Unable to find USG distribution of casacore!")
+endif (AIPS_H)
+
+## -----------------------------------------------------------------------------
+## [2] Check for the required system tools
+
+find_program (SVN_EXECUTABLE svn PATHS ${bin_locations})
+find_program (TAR_EXECUTABLE tar PATHS ${bin_locations})
+
+## -----------------------------------------------------------------------------
+## Collect CMake configuration files and Subversion tags into a tar-archive
+
+# tar -cvzf casacore.tgz `find casacore -name .svn` `find casacore -name CMakeLists.txt`
+
+if (TAR_EXECUTABLE)
+elseif (TAR_EXECUTABLE)
+  message (FATAL_ERROR "Unable to find tar executable on your system!")
+endif (TAR_EXECUTABLE)
+
+## -----------------------------------------------------------------------------
+## [3] Check out the lastest version of the original code base
+
+if (SVN_EXECUTABLE)
+  execute_process (
+    WORKING_DIRECTORY .
+    COMMAND ${SVN_EXECUTABLE} co ${casacore_url} casacore
+    TIMEOUT 300
+    ERROR_VARIABLE svn_cerr
+    OUTPUT_QUIET
+  )
+  if (svn_cerr)
+    message (STATUS "[svn] Unable to check out the code from the repository!")
+    message (STATUS "${svn_cerr}")
+  endif (svn_cerr)
+elseif (SVN_EXECUTABLE)
+  message (FATAL_ERROR "Unable to out the code from the repository without SVN!")
+endif (SVN_EXECUTABLE)
diff --git a/cmake/modules/changes.txt b/cmake/modules/changes.txt
new file mode 100644
index 00000000000..d2b54ac0c82
--- /dev/null
+++ b/cmake/modules/changes.txt
@@ -0,0 +1,75 @@
+Index: FindCASACORE.cmake
+===================================================================
+--- FindCASACORE.cmake	(revision 568)
++++ FindCASACORE.cmake	(revision 569)
+@@ -21,6 +21,8 @@
+ set (include_locations
+   /usr/include/casacore
+   /usr/local/include/casacore
++  /sw/share/casacore
++  /sw/share/casacore/stage/include
+   /sw/include/casacore
+   ./../casacore
+   ./../external/casacore
+@@ -59,6 +61,10 @@
+ ## -----------------------------------------------------------------------------
+ ## Check for system header files
+ 
++if (NOT CASACORE_FIND_QUIETLY)
++  message (STATUS "[FindCASACORE] Check for system header files ...")
++endif (NOT CASACORE_FIND_QUIETLY)
++
+ include (CheckIncludeFiles)
+ 
+ check_include_files (assert.h HAVE_ASSERT_H)
+@@ -92,13 +98,17 @@
+ ## installation or have remained at their original location in the source
+ ## directories, we need to check for different variants to the include paths.
+ 
++if (NOT CASACORE_FIND_QUIETLY)
++  message (STATUS "[FindCASACORE] Check for the header files ...")
++endif (NOT CASACORE_FIND_QUIETLY)
++
+ set (CASACORE_INCLUDES "")
+ 
+ ## [1] <casa/Arrays.h>
+ 
+ find_path (CASACORE_casa Arrays.h
+   PATHS ${include_locations}
+-  PATH_SUFFIXES casa/casa
++  PATH_SUFFIXES casa/casa casacore/casa
+ )
+ 
+ if (CASACORE_casa)
+@@ -264,6 +274,10 @@
+ ## -----------------------------------------------------------------------------
+ ## Check for the library
+ 
++if (NOT CASACORE_FIND_QUIETLY)
++  message (STATUS "[FindCASACORE] Check for the library ...")
++endif (NOT CASACORE_FIND_QUIETLY)
++
+ ## Dependency of the packages in casacore
+ 
+ # casa        : --
+@@ -288,10 +302,10 @@
+   ## search for the library
+   find_library (CASACORE_lib${casacore_lib} casa_${casacore_lib} ${casacore_lib}
+     PATHS ${lib_locations}
+-  )
++    )
+   ## if we have found the library, add it to the list
+   if (CASACORE_lib${casacore_lib})
+-	list (APPEND CASACORE_LIBRARIES ${CASACORE_lib${casacore_lib}})
++    list (APPEND CASACORE_LIBRARIES ${CASACORE_lib${casacore_lib}})
+   endif (CASACORE_lib${casacore_lib})
+ endforeach (casacore_lib)
+ 
+@@ -300,7 +314,6 @@
+ 
+ if (CASACORE_INCLUDES AND CASACORE_LIBRARIES)
+   set (HAVE_CASACORE TRUE)
+-#  string (REGEX REPLACE lib/libcasa.a lib CASACORE_LIBRARIES_DIR ${CASA_libcasa})
+ else (CASACORE_INCLUDES AND CASACORE_LIBRARIES)
+   if (NOT CASACORE_FIND_QUIETLY)
+     if (NOT CASACORE_INCLUDES)
diff --git a/cmake/modules/gelsm.FindBoost.cmake b/cmake/modules/gelsm.FindBoost.cmake
new file mode 100644
index 00000000000..59ac77b6937
--- /dev/null
+++ b/cmake/modules/gelsm.FindBoost.cmake
@@ -0,0 +1,229 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: FindBoost.cmake 1643 2008-06-14 10:19:20Z baehren                   $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of the Boost library
+#
+#  HAVE_BOOST      = do we have BOOST?
+#  BOOST_INCLUDES  = location of the include files
+#  BOOST_LIBRARIES = location of the libraries
+#
+
+include (CheckIncludeFiles)
+include (CheckTypeSize)
+
+## -----------------------------------------------------------------------------
+## Search locations
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the header files and the various module libraries
+
+set (BOOST_FIND_python_ONLY OFF)
+
+set (BOOST_FIND_date_time ON)
+set (BOOST_FIND_filesystem ON)
+set (BOOST_FIND_iostreams ON)
+set (BOOST_FIND_program_options ON)
+set (BOOST_FIND_python OFF)
+set (BOOST_FIND_regex ON)
+set (BOOST_FIND_serialization ON)
+set (BOOST_FIND_signals ON)
+set (BOOST_FIND_thread ON)
+set (BOOST_FIND_unit_test_framework OFF)
+set (BOOST_FIND_wave ON)
+
+if (BOOST_FIND_python_ONLY)
+  
+  if (NOT BOOST_FIND_QUIETLY)
+    message (STATUS "[FindBoost] Configuration for boost_python only.")
+  endif (NOT BOOST_FIND_QUIETLY)
+
+  set (BOOST_FIND_python ON)
+
+  set (BOOST_FIND_date_time OFF)
+  set (BOOST_FIND_filesystem OFF)
+  set (BOOST_FIND_iostreams OFF)
+  set (BOOST_FIND_program_options OFF)
+  set (BOOST_FIND_regex OFF)
+  set (BOOST_FIND_serialization OFF)
+  set (BOOST_FIND_signals OFF)
+  set (BOOST_FIND_thread OFF)
+  set (BOOST_FIND_unit_test_framework OFF)
+  set (BOOST_FIND_wave OFF)
+
+endif (BOOST_FIND_python_ONLY)
+
+if (BOOST_FIND_date_time)
+  list (APPEND boost_libraries boost_date_time)
+endif (BOOST_FIND_date_time)
+
+if (BOOST_FIND_filesystem)
+  list (APPEND boost_libraries boost_filesystem)
+endif (BOOST_FIND_filesystem)
+
+if (BOOST_FIND_iostreams)
+  list (APPEND boost_libraries boost_iostreams)
+endif (BOOST_FIND_iostreams)
+
+if (BOOST_FIND_program_options)
+  list (APPEND boost_libraries boost_program_options)
+endif (BOOST_FIND_program_options)
+
+if (BOOST_FIND_python)
+  list (APPEND boost_libraries boost_python)
+endif (BOOST_FIND_python)
+
+if (BOOST_FIND_regex)
+  list (APPEND boost_libraries boost_regex)
+endif (BOOST_FIND_regex)
+
+if (BOOST_FIND_serialization)
+  list (APPEND boost_libraries boost_serialization)
+endif (BOOST_FIND_serialization)
+
+if (BOOST_FIND_signals)
+  list (APPEND boost_libraries boost_signals)
+endif (BOOST_FIND_signals)
+
+if (BOOST_FIND_thread)
+  list (APPEND boost_libraries boost_thread)
+endif (BOOST_FIND_thread)
+
+if (BOOST_FIND_unit_test_framework)
+  list (APPEND boost_libraries boost_unit_test_framework)
+endif (BOOST_FIND_unit_test_framework)
+
+if (BOOST_FIND_wave)
+  list (APPEND boost_libraries boost_wave)
+endif (BOOST_FIND_wave)
+
+## initialize list of detected libraries
+
+set (BOOST_LIBRARIES "")
+
+foreach (boost_version 1_34_1 1_33_1)
+
+  ## Check for the header files ------------------
+
+  ## <boost/config.hpp>
+  find_path (BOOST_INCLUDES_tmp boost/config.hpp boost/python.hpp
+    PATHS ${include_locations}
+    PATH_SUFFIXES
+    boost-${boost_version}
+    boost
+    .
+    NO_DEFAULT_PATH
+    )
+
+  if (BOOST_INCLUDES_tmp)
+    get_filename_component (BOOST_INCLUDES ${BOOST_INCLUDES_tmp} ABSOLUTE)
+  endif (BOOST_INCLUDES_tmp)
+
+  ## Check for the module libraries --------------
+  
+  foreach (lib ${boost_libraries})
+    ## try to locate the library
+    find_library (BOOST_${lib} ${lib} ${lib}-gcc42-${boost_version} ${lib}-mt-${boost_version} ${lib}-gcc
+      PATHS ${lib_locations} /bgl/dist/lib
+      PATH_SUFFIXES boost boost-${boost_version}
+      NO_DEFAULT_PATH
+      )
+    ## check if location was successful
+    if (BOOST_${lib})
+      list (APPEND BOOST_LIBRARIES ${BOOST_${lib}})
+      set (continue_search 0)
+    endif (BOOST_${lib})
+  endforeach (lib)
+  
+endforeach (boost_version)
+
+## -----------------------------------------------------------------------------
+## Check for symbols in the library
+##
+## We need this additional step especially for Python binding, as some of the
+## required symbols might not be in place.
+##
+## _NOTE_ This does not yet properly as 
+##        "nm libboost_python-mt-1_34_1.dylib | grep _PyMem_Malloc"
+##        report the symbol to be present in the library.
+
+if (BOOST_boost_python)
+
+  ## load CMake module required for checking symbols within a library
+  include (CheckLibraryExists)
+
+  check_library_exists (${BOOST_boost_python} PyMem_Malloc "" BOOST__PyMem_Malloc)
+  check_library_exists (${BOOST_boost_python} PyModule_Type "" BOOST__PyModule_Type)
+  check_library_exists (${BOOST_boost_python} PyMethod_Type "" BOOST__PyMethod_Type)
+  check_library_exists (${BOOST_boost_python} PyErr_WarnEx "" BOOST__PyErr_WarnEx)
+
+endif (BOOST_boost_python)
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+IF (BOOST_INCLUDES AND BOOST_LIBRARIES)
+  SET (HAVE_BOOST TRUE)
+  include_directories (${BOOST_INCLUDES})
+  add_definitions (-DHAVE_BOOST)
+ELSE (BOOST_INCLUDES AND BOOST_LIBRARIES)
+  IF (NOT BOOST_FIND_QUIETLY)
+    IF (NOT BOOST_INCLUDES)
+      MESSAGE (STATUS "Unable to find Boost header files!")
+    ENDIF (NOT BOOST_INCLUDES)
+    IF (NOT BOOST_LIBRARIES)
+      MESSAGE (STATUS "Unable to find Boost library files!")
+    ENDIF (NOT BOOST_LIBRARIES)
+  ENDIF (NOT BOOST_FIND_QUIETLY)
+ENDIF (BOOST_INCLUDES AND BOOST_LIBRARIES)
+
+if (HAVE_BOOST)
+  if (NOT BOOST_FIND_QUIETLY)
+    message (STATUS "Found components for Boost")
+    ## list the components for which the search was enabled
+    message (STATUS "date_time ......... : ${BOOST_FIND_date_time}")
+    message (STATUS "filesystem ........ : ${BOOST_FIND_filesystem}")
+    message (STATUS "iostreams ......... : ${BOOST_FIND_iostreams}")
+    message (STATUS "program_options ... : ${BOOST_FIND_program_options}")
+    message (STATUS "python ............ : ${BOOST_FIND_python}")
+    message (STATUS "regex ............. : ${BOOST_FIND_regex}")
+    message (STATUS "signals ........... : ${BOOST_FIND_signals}")
+    message (STATUS "unit_test_framework : ${BOOST_FIND_unit_test_framework}")
+    message (STATUS "thread ............ : ${BOOST_FIND_thread}")
+    message (STATUS "wave .............. : ${BOOST_FIND_wave}")
+    ## show search results
+    message (STATUS "Boost library ..... : ${BOOST_LIBRARIES}")
+    message (STATUS "Boost headers ..... : ${BOOST_INCLUDES}")
+  endif (NOT BOOST_FIND_QUIETLY)
+else (HAVE_BOOST)
+  if (BOOST_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find Boost!")
+  endif (BOOST_FIND_REQUIRED)
+endif (HAVE_BOOST)
+
+## -----------------------------------------------------------------------------
+
+mark_as_advanced (
+  BOOST_INCLUDES
+  BOOST_LIBRARIES
+)
diff --git a/cmake/modules/gelsm.FindCASACORE.cmake b/cmake/modules/gelsm.FindCASACORE.cmake
new file mode 100644
index 00000000000..7a939d017bd
--- /dev/null
+++ b/cmake/modules/gelsm.FindCASACORE.cmake
@@ -0,0 +1,458 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: IO.h 393 2007-06-13 10:49:08Z baehren                               $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+## -----------------------------------------------------------------------------
+## Check for the casacore distribution
+##
+## Variables assigned:
+##  CASACORE_FOUND         = Do we have both headers and libraries of casacore?
+##  CASACORE_INCLUDES      = Path to the casacore header files
+##  CASACORE_LIBRARIES     = Libraries of the casacore modules
+##  CASACORE_COMPILE_FLAGS = 
+##  CASACORE_PATH          = 
+##
+
+## -----------------------------------------------------------------------------
+## Search locations
+
+include (CMakeSettings)
+
+list (APPEND include_locations
+  ${USG_ROOT}/external/casacore
+  /app/aips++/casacore_64/include/
+  /usr/include/casacore
+  /usr/local/include/casacore
+  /sw/share/casacore
+  /sw/include/casacore
+  /app/aips++/casacore_64/include/casacore
+  ${CASACORE_PATH}/include/casacore
+)
+
+list (APPEND lib_locations
+  /opt/casacore/lib
+  /app/aips++/casacore_64/lib/
+  /app/wcs_64/lib
+  /app/aips++/casacore_64/lib
+  ${CASACORE_PATH}/lib
+)
+
+set (casacore_modules
+  casa
+  tables
+  scimath_f
+  scimath
+  measures
+  ms
+  )
+
+## -----------------------------------------------------------------------------
+## Check for system header files
+
+if (NOT CASACORE_FIND_QUIETLY)
+  message (STATUS "[FindCASACORE] Check for system header files ...")
+endif (NOT CASACORE_FIND_QUIETLY)
+
+include (CheckIncludeFiles)
+
+check_include_files (assert.h HAVE_ASSERT_H)
+check_include_files (ctype.h HAVE_CTYPE_H)
+check_include_files (fcntl.h HAVE_FCNTL_H)
+check_include_files (stdlib.h HAVE_STDLIB_H)
+check_include_files (stdio.h HAVE_STDIO_H)
+check_include_files (string.h HAVE_STRING_H)
+check_include_files (unistd.h HAVE_UNISTD_H)
+
+## -----------------------------------------------------------------------------
+## Required external packages
+
+find_library (libcfitsio cfitsio PATHS ${lib_locations})
+find_library (libm m PATHS ${lib_locations})
+find_library (libg2c g2c f2c PATHS ${lib_locations})
+find_library (libwcs wcs PATHS ${lib_locations})
+
+if (NOT libwcs)
+  message (STATUS "Missing WCSLIB required for casacore!")
+endif (NOT libwcs)
+
+if (NOT libcfitsio)
+  message (STATUS "Missing CFITSIO required for casacore!")
+endif (NOT libcfitsio)
+
+## -----------------------------------------------------------------------------
+## Check for the header files.
+##
+## Depending on whether the header files are part of a complete casacore
+## installation or have remained at their original location in the source
+## directories, we need to check for different variants to the include paths.
+
+if (NOT CASACORE_FIND_QUIETLY)
+  message (STATUS "[FindCASACORE] Check for the header files ...")
+endif (NOT CASACORE_FIND_QUIETLY)
+
+set (CASACORE_INCLUDES "")
+
+## [1] <casa/Arrays.h>
+
+find_path (CASACORE_INCLUDES_casa casa/Arrays.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES casa
+  NO_DEFAULT_PATH
+)
+
+if (CASACORE_INCLUDES_casa)
+  get_filename_component (tmp ${CASACORE_INCLUDES_casa} ABSOLUTE)
+  list (APPEND CASACORE_INCLUDES ${tmp})
+else (CASACORE_INCLUDES_casa)
+  message (SEND_ERROR "[casacore] Unable to locate Array.h")
+endif (CASACORE_INCLUDES_casa)
+
+## [2] <tables/Tables.h>
+
+find_path (CASACORE_INCLUDES_tables tables/Tables.h tables/LogTables.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES tables
+  NO_DEFAULT_PATH
+)
+
+if (CASACORE_INCLUDES_tables)
+  get_filename_component (tmp ${CASACORE_INCLUDES_tables} ABSOLUTE)
+  list (APPEND CASACORE_INCLUDES ${tmp})
+elseif (CASACORE_INCLUDES_tables)
+  message (SEND_ERROR "[casacore] Unable to locate Tables.h")
+endif (CASACORE_INCLUDES_tables)
+
+## [3] <miriad.h>
+
+find_path (CASACORE_INCLUDES_mirlib miriad.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES mirlib
+  NO_DEFAULT_PATH
+)
+
+if (CASACORE_INCLUDES_mirlib)
+  get_filename_component (tmp ${CASACORE_INCLUDES_mirlib} ABSOLUTE)
+  list (APPEND CASACORE_INCLUDES ${tmp})
+elseif (CASACORE_INCLUDES_mirlib)
+  message (SEND_ERROR "[casacore] Unable to locate miriad.h")
+endif (CASACORE_INCLUDES_mirlib)
+
+## [4] <scimath/Fitting.h>
+
+find_path (CASACORE_INCLUDES_scimath scimath/Fitting.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES scimath
+  NO_DEFAULT_PATH
+)
+
+if (CASACORE_INCLUDES_scimath)
+  get_filename_component (tmp ${CASACORE_INCLUDES_scimath} ABSOLUTE)
+  list (APPEND CASACORE_INCLUDES ${tmp})
+elseif (CASACORE_INCLUDES_scimath)
+  message (SEND_ERROR "[casacore] Unable to locate Fitting.h")
+endif (CASACORE_INCLUDES_scimath)
+
+## [5] <measures/Measures.h>
+
+find_path (CASACORE_INCLUDES_measures measures/Measures.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES measures
+  NO_DEFAULT_PATH
+)
+
+if (CASACORE_INCLUDES_measures)
+  get_filename_component (tmp ${CASACORE_INCLUDES_measures} ABSOLUTE)
+  list (APPEND CASACORE_INCLUDES ${tmp})
+elseif (CASACORE_INCLUDES_measures)
+  message (SEND_ERROR "[casacore] Unable to locate Measures.h")
+endif (CASACORE_INCLUDES_measures)
+
+## [6] <fits/FITS.h>
+
+find_path (CASACORE_INCLUDES_fits fits/FITS.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES fits
+)
+
+if (CASACORE_INCLUDES_fits)
+  get_filename_component (tmp ${CASACORE_INCLUDES_fits} ABSOLUTE)
+  list (APPEND CASACORE_INCLUDES ${tmp})
+elseif (CASACORE_INCLUDES_fits)
+  message (SEND_ERROR "[casacore] Unable to locate FITS.h")
+endif (CASACORE_INCLUDES_fits)
+
+## [7] <coordinates/Coordinates.h>
+
+find_path (CASACORE_INCLUDES_coordinates coordinates/Coordinates.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES coordinates
+)
+
+if (CASACORE_INCLUDES_coordinates)
+  get_filename_component (tmp ${CASACORE_INCLUDES_coordinates} ABSOLUTE)
+  list (APPEND CASACORE_INCLUDES ${tmp})
+elseif (CASACORE_INCLUDES_coordinates)
+  message (SEND_ERROR "[casacore] Unable to locate Coordinates.h")
+endif (CASACORE_INCLUDES_coordinates)
+
+## [8] <components/ComponentModels.h>
+
+find_path (CASACORE_components ComponentModels.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES components/components
+)
+
+if (CASACORE_components)
+  get_filename_component (tmp ${CASACORE_components} ABSOLUTE)
+  string (REGEX REPLACE components/components components tmp ${tmp})
+  list (APPEND CASACORE_INCLUDES ${tmp})
+endif (CASACORE_components)
+
+## [9] <lattices/Lattices.h>
+
+find_path (CASACORE_lattices Lattices.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES lattices/lattices
+)
+
+if (CASACORE_lattices)
+  string (REGEX REPLACE lattices/lattices lattices tmp ${CASACORE_lattices})
+  get_filename_component (tmp ${tmp} ABSOLUTE)
+  list (APPEND CASACORE_INCLUDES ${tmp})
+endif (CASACORE_lattices)
+
+## [10] <ms/MeasurementSets.h>
+
+find_path (CASACORE_ms MeasurementSets.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES ms/ms
+)
+
+if (CASACORE_ms)
+  string (REGEX REPLACE ms/ms ms tmp ${CASACORE_ms})
+  get_filename_component (tmp ${tmp} ABSOLUTE)
+  list (APPEND CASACORE_INCLUDES ${tmp})
+endif (CASACORE_ms)
+
+## [11] <images/Images.h>
+
+find_path (CASACORE_images Images.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES images/images
+)
+
+if (CASACORE_images)
+  string (REGEX REPLACE images/images images tmp ${CASACORE_images})
+  get_filename_component (tmp ${tmp} ABSOLUTE)
+  list (APPEND CASACORE_INCLUDES ${tmp})
+endif (CASACORE_images)
+
+## [12] <msfits/MSFits.h>
+
+find_path (CASACORE_msfits MSFits.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES msfits/msfits
+)
+
+if (CASACORE_msfits)
+  string (REGEX REPLACE msfits/msfits msfits tmp ${CASACORE_msfits})
+  get_filename_component (tmp ${tmp} ABSOLUTE)
+  list (APPEND CASACORE_INCLUDES ${tmp})
+endif (CASACORE_msfits)
+
+## [13] <msvis/MSVis.h>
+
+find_path (CASACORE_msvis MSVis.h
+  PATHS ${include_locations}
+  PATH_SUFFIXES msvis/msvis
+)
+
+if (CASACORE_msvis)
+  string (REGEX REPLACE msvis/msvis msvis tmp ${CASACORE_msvis})
+  get_filename_component (tmp ${tmp} ABSOLUTE)
+  list (APPEND CASACORE_INCLUDES ${tmp})
+endif (CASACORE_msvis)
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+if (NOT CASACORE_FIND_QUIETLY)
+  message (STATUS "[FindCASACORE] Check for the library ...")
+endif (NOT CASACORE_FIND_QUIETLY)
+
+## Dependency of the packages in casacore
+
+# casa        : --
+# tables      : casa
+# mirlib      : casa
+# scimath     : casa
+# measures    : tables scimath
+# fits        : measures
+# coordinates : fits
+# components  : coordinates
+# lattices    : tables scimath
+# ms          : measures
+# images      : components mirlib
+# msfits      : ms fits
+# msvis       : ms
+
+## Locate the libraries themselves; keep in mind that the libraries follow
+## the naming convention libcasa_<module>, e.g. libcasa_images.a
+
+foreach (casacore_lib ${casacore_modules})
+  ## search for the library
+  if (${casacore_lib} MATCHES "mirlib")
+    find_library (CASACORE_lib${casacore_lib} mir
+      PATHS ${lib_locations}
+      NO_DEFAULT_PATH
+      )
+  else (${casacore_lib} MATCHES "mirlib")
+    find_library (CASACORE_lib${casacore_lib} casa_${casacore_lib}
+      PATHS ${lib_locations}
+      NO_DEFAULT_PATH
+      )
+  endif (${casacore_lib} MATCHES "mirlib")
+  ## if we have found the library, add it to the list
+  if (CASACORE_lib${casacore_lib})
+    list (APPEND CASACORE_LIBRARIES ${CASACORE_lib${casacore_lib}})
+  endif (CASACORE_lib${casacore_lib})
+endforeach (casacore_lib)
+
+## Once we are done, rearrange the order of the libraries in the list
+
+if (CASACORE_LIBRARIES)
+  list (REVERSE CASACORE_LIBRARIES)
+endif (CASACORE_LIBRARIES)
+
+## -----------------------------------------------------------------------------
+## If detection successful, register package as found
+
+if (CASACORE_INCLUDES AND CASACORE_LIBRARIES)
+  set (CASACORE_FOUND TRUE)
+  include_directories (${CASACORE_INCLUDES})
+  add_definitions (-DHAVE_AIPSPP)
+  set( CXX_COMPILE_FLAGS "${CXX_COMPILE_FLAGS} -Wno-non-template-friend" CACHE STRING "CXX Compiler flags" FORCE )
+  add_definitions (${CXX_COMPILE_FLAGS})
+else (CASACORE_INCLUDES AND CASACORE_LIBRARIES)
+  set (CASACORE_FOUND FALSE)
+  if (NOT CASACORE_FIND_QUIETLY)
+    if (NOT CASACORE_INCLUDES)
+      message (STATUS "Unable to find CASACORE header files!")
+    endif (NOT CASACORE_INCLUDES)
+    if (NOT CASACORE_LIBRARIES)
+      message (STATUS "Unable to find CASACORE library files!")
+    endif (NOT CASACORE_LIBRARIES)
+  endif (NOT CASACORE_FIND_QUIETLY)
+endif (CASACORE_INCLUDES AND CASACORE_LIBRARIES)
+
+IF (CASACORE_FOUND)
+  IF (NOT CASACORE_FIND_QUIETLY)
+    MESSAGE (STATUS "Found components for CASACORE")
+    MESSAGE (STATUS "CASACORE_LIBRARIES = ${CASACORE_LIBRARIES}")
+    MESSAGE (STATUS "CASACORE_INCLUDES  = ${CASACORE_INCLUDES}")
+  ENDIF (NOT CASACORE_FIND_QUIETLY)
+ENDIF (CASACORE_FOUND)
+
+## ------------------------------------------------------------------------------
+## Final assembly of the provided variables and flags; once this is done, we
+## provide some extended feedback.
+
+## --- Compiler settings -------------------------
+
+IF (UNIX)
+  add_definitions (
+    -DAIPS_STDLIB
+    -DAIPS_AUTO_STL
+    )
+  set (CASACORE_COMPILE_FLAGS "-DAIPS_STDLIB -DAIPS_AUTO_STL -DAIPS_NO_LEA_MALLOC")
+  IF (APPLE)
+    add_definitions (-DAIPS_DARWIN)
+    set (CASACORE_COMPILE_FLAGS "${CASACORE_COMPILE_FLAGS} -DAIPS_DARWIN")
+  else (APPLE)
+    add_definitions (-DAIPS_LINUX)
+    set (CASACORE_COMPILE_FLAGS "${CASACORE_COMPILE_FLAGS} -DAIPS_LINUX")
+  endif (APPLE)
+  ##
+  ## Platform test Big/Little Endian ------------------------------------
+  ##
+  if (CMAKE_SYSTEM_PROCESSOR MATCHES "powerpc")
+    add_definitions (-DAIPS_BIG_ENDIAN)
+    set (CMAKE_SYSTEM_BIG_ENDIAN 1)
+    set (CASACORE_COMPILE_FLAGS "${CASACORE_COMPILE_FLAGS} -DAIPS_BIG_ENDIAN")
+  else (CMAKE_SYSTEM_PROCESSOR MATCHES "powerpc")
+    add_definitions (-DAIPS_LITTLE_ENDIAN)
+    set (CMAKE_SYSTEM_BIG_ENDIAN 0)
+  endif (CMAKE_SYSTEM_PROCESSOR MATCHES "powerpc")
+  #  TEST_BIG_ENDIAN (CMAKE_SYSTEM_BIG_ENDIAN)
+  #  if (CMAKE_SYSTEM_BIG_ENDIAN)
+  #    message (STATUS "System is big endian.")
+  #    add_definitions (-DAIPS_BIG_ENDIAN)
+  #  elseif (CMAKE_SYSTEM_BIG_ENDIAN)
+  #    message (STATUS "System is little endian.")
+  #    add_definitions (-DAIPS_LITTLE_ENDIAN)
+  #  endif (CMAKE_SYSTEM_BIG_ENDIAN)
+  ##
+  ## Platform test 32/64 bit ------------------------------
+  ##
+  set (CMAKE_SYSTEM_64BIT 0)
+  if (NOT CMAKE_SYSTEM_PROCESSOR MATCHES i386)
+    if (NOT CMAKE_SYSTEM_PROCESSOR MATCHES i686)
+      if (NOT CMAKE_SYSTEM_PROCESSOR MATCHES powerpc)
+        set (CMAKE_SYSTEM_64BIT 1)
+        add_definitions (-DAIPS_64B)
+      endif (NOT CMAKE_SYSTEM_PROCESSOR MATCHES powerpc)
+    endif (NOT CMAKE_SYSTEM_PROCESSOR MATCHES i686)
+  endif (NOT CMAKE_SYSTEM_PROCESSOR MATCHES i386)
+  if (APPLE)
+    if (NOT CMAKE_SYSTEM_PROCESSOR MATCHES powerpc)
+      set (CMAKE_SYSTEM_64BIT 1)
+      add_definitions (-DAIPS_64B)
+    endif (NOT CMAKE_SYSTEM_PROCESSOR MATCHES powerpc)
+  endif (APPLE)
+ENDIF (UNIX)
+
+## ------------------------------------------------------------------------------
+## Compatibility settings (should be removed at some point)
+
+set (CASA_INCLUDES "")
+set (CASA_INCLUDES ${CASACORE_INCLUDES})
+
+set (CASA_LIBRARIES "")
+set (CASA_LIBRARIES ${CASACORE_LIBRARIES})
+
+## ------------------------------------------------------------------------------
+## Variables only to be displayed in advanced mode
+
+mark_as_advanced (
+  CASACORE_INCLUDES_casa
+  CASACORE_INCLUDES_tables
+  CASACORE_INCLUDES_scimath
+  CASACORE_ms
+  CASACORE_msfits
+  CASACORE_msvis
+  CASACORE_images
+  CASACORE_components
+  CASACORE_INCLUDES_coordinates
+  CASACORE_INCLUDES_fits
+  CASACORE_lattices
+  CASACORE_INCLUDES_mirlib
+  CASACORE_INCLUDES_measures
+  )
diff --git a/cmake/modules/gelsm.lofar_config.h.in b/cmake/modules/gelsm.lofar_config.h.in
new file mode 100644
index 00000000000..28cb136f4f0
--- /dev/null
+++ b/cmake/modules/gelsm.lofar_config.h.in
@@ -0,0 +1 @@
+#cmakedefine AUTO_FUNCTION_NAME __PRETTY_FUNCTION__
\ No newline at end of file
diff --git a/cmake/modules/lofar_config.h.in b/cmake/modules/lofar_config.h.in
new file mode 100644
index 00000000000..28cb136f4f0
--- /dev/null
+++ b/cmake/modules/lofar_config.h.in
@@ -0,0 +1 @@
+#cmakedefine AUTO_FUNCTION_NAME __PRETTY_FUNCTION__
\ No newline at end of file
diff --git a/cmake/modules/makefile b/cmake/modules/makefile
new file mode 100644
index 00000000000..24704c4dddb
--- /dev/null
+++ b/cmake/modules/makefile
@@ -0,0 +1,7 @@
+##------------------------------------------------------------------------
+## $Id:: CMakeLists.txt 390 2007-06-13 09:03:07Z baehren                 $
+##------------------------------------------------------------------------
+
+clean:
+	rm -rf *~
+
diff --git a/cmake/modules/template_FindXX.cmake b/cmake/modules/template_FindXX.cmake
new file mode 100644
index 00000000000..882fe3086a4
--- /dev/null
+++ b/cmake/modules/template_FindXX.cmake
@@ -0,0 +1,89 @@
+# +-----------------------------------------------------------------------------+
+# | $Id:: template_FindXX.cmake 1643 2008-06-14 10:19:20Z baehren             $ |
+# +-----------------------------------------------------------------------------+
+# |   Copyright (C) 2007                                                        |
+# |   Lars B"ahren (bahren@astron.nl)                                           |
+# |                                                                             |
+# |   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, write to the                             |
+# |   Free Software Foundation, Inc.,                                           |
+# |   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.                 |
+# +-----------------------------------------------------------------------------+
+
+# - Check for the presence of <PACKAGE>
+#
+# The following variables are set when <PACKAGE> is found:
+#  HAVE_<PACKAGE>       = Set to true, if all components of <PACKAGE>
+#                          have been found.
+#  <PACKAGE>_INCLUDES   = Include path for the header files of <PACKAGE>
+#  <PACKAGE>_LIBRARIES  = Link these to use <PACKAGE>
+#  <PACKAGE>_LFLAGS     = Linker flags (optional)
+
+## -----------------------------------------------------------------------------
+## Search locations
+
+include (CMakeSettings)
+
+## -----------------------------------------------------------------------------
+## Check for the header files
+
+find_path (<PACKAGE>_INCLUDES <header file(s)>
+  PATHS ${include_locations}
+  PATH_SUFFIXES <optional path extension>
+  NO_DEFAULT_PATH
+  )
+
+## -----------------------------------------------------------------------------
+## Check for the library
+
+find_library (<PACKAGE>_LIBRARIES <package name>
+  PATHS ${lib_locations}
+  NO_DEFAULT_PATH
+  )
+
+## -----------------------------------------------------------------------------
+## Actions taken when all components have been found
+
+if (<PACKAGE>_INCLUDES AND <PACKAGE>_LIBRARIES)
+  set (HAVE_<PACKAGE> TRUE)
+else (<PACKAGE>_INCLUDES AND <PACKAGE>_LIBRARIES)
+  set (HAVE_<PACKAGE> FALSE)
+  if (NOT <PACKAGE>_FIND_QUIETLY)
+    if (NOT <PACKAGE>_INCLUDES)
+      message (STATUS "Unable to find <PACKAGE> header files!")
+    endif (NOT <PACKAGE>_INCLUDES)
+    if (NOT <PACKAGE>_LIBRARIES)
+      message (STATUS "Unable to find <PACKAGE> library files!")
+    endif (NOT <PACKAGE>_LIBRARIES)
+  endif (NOT <PACKAGE>_FIND_QUIETLY)
+endif (<PACKAGE>_INCLUDES AND <PACKAGE>_LIBRARIES)
+
+if (HAVE_<PACKAGE>)
+  if (NOT <PACKAGE>_FIND_QUIETLY)
+    message (STATUS "Found components for <PACKAGE>")
+    message (STATUS "<PACKAGE>_INCLUDES  = ${<PACKAGE>_INCLUDES}")
+    message (STATUS "<PACKAGE>_LIBRARIES = ${<PACKAGE>_LIBRARIES}")
+  endif (NOT <PACKAGE>_FIND_QUIETLY)
+else (HAVE_<PACKAGE>)
+  if (<PACKAGE>_FIND_REQUIRED)
+    message (FATAL_ERROR "Could not find <PACKAGE>!")
+  endif (<PACKAGE>_FIND_REQUIRED)
+endif (HAVE_<PACKAGE>)
+
+## -----------------------------------------------------------------------------
+## Mark advanced variables
+
+mark_as_advanced (
+  <PACKAGE>_INCLUDES
+  <PACKAGE>_LIBRARIES
+  )
diff --git a/cmake/variants/variants b/cmake/variants/variants
new file mode 100644
index 00000000000..a5076ba39f7
--- /dev/null
+++ b/cmake/variants/variants
@@ -0,0 +1,43 @@
+SET(gnu_compiler    "/usr/bin/g++")
+SET(GNUM32_COMPILER "CXX=/usr/bin/g++ -m32 CC=/usr/bin/gcc -m32 --disable-lib64")
+SET(KCC_COMPILER )
+SET(ICC_COMPILER )
+
+SET(STANDARD_MODULES "FindSHMEM")
+
+
+SET(NOTHREADS        "--with-threads=no")
+SET(NOSHMEM          "--with-shmem=no")
+
+SET(PROFILE          "--with-optimize='-pg -O2' --with-compiletools --with-ldflags='-lc_p'")
+SET(MPE              "--with-mpich=/usr/local/mpich-1.2.5/ch_p4 --enable-mpi-profiler")
+SET(DEBUG            "-g")
+SET(DEBUGOPT         "-g -O2")
+SET(PROFOPT          "--with-optimize='-pg -O2' --with-ldflags='-lc_p'")
+SET(OPTIMIZE         "-O2 -g")
+SET(MPICH            "--with-mpich")
+SET(LAM              "--with-lam")
+SET(SCAMPI           "--with-scampi")
+SET(MPIPROF          "--enable-mpi-profiler --with-cppflags=-DHAVE_MPE")
+SET(VBROKER          "--with-vbroker")
+
+SET(profile     "${PROFILE} ${MPE}" CACHE STRING "profile_variant" FORCE)
+SET(debug       "${DEBUG}" CACHE STRING "debug_variant" FORCE)
+SET(profopt     "${PROFOPT}" CACHE STRING "profopt_variant" FORCE)
+SET(opt         "${OPTIMIZE}" CACHE STRING "opt_variant" FORCE)
+SET(debugopt    "${DEBUGOPT}" CACHE STRING "debugopt_variant" FORCE)
+SET(mpich       "${MPICH}" CACHE STRING "mpich_variant" FORCE)
+SET(mpich-opt   "${MPICH} ${OPTIMIZE}" CACHE STRING "mpich-opt_variant" FORCE)
+SET(lam         "${LAM}" CACHE STRING "lam_variant" FORCE)
+SET(lam-opt     "${LAM} ${OPTIMIZE}" CACHE STRING "lam-opt_variant" FORCE)
+SET(corba       "${VBROKER}" CACHE STRING "corba_variant" FORCE)
+SET(mpich-corba "${MPICH} ${VBROKER}" CACHE STRING "mpich-corba_variant" FORCE)
+SET(lam-corba   "${LAM} ${VBROKER}" CACHE STRING "lam-corba_variant" FORCE)
+SET(scampi      "${SCAMPI}" CACHE STRING "scampi_variant" FORCE)
+SET(scampi-opt  "${SCAMPI} ${OPTIMIZE}" CACHE STRING "scampi-opt_variant" FORCE)
+SET(scampi-prof "${SCAMPI} ${OPTIMIZE} ${MPIPROF}" CACHE STRING "scampi-prof_variant" FORCE)
+SET(mpich-prof  "${MPICH} ${OPTIMIZE} ${MPIPROF}" CACHE STRING "mpich-prof_variant" FORCE)
+SET(fakebgl     "${DEBUG} ${NOTHREADS} ${NOSHMEM} --without-log4cplus --with-cppflags=-DHAVE_BGL" CACHE STRING "fakebgl_variant" FORCE)
+SET(nolog4cplus "${DEBUG} --without-log4cplus" CACHE STRING "nolog4cplus_variant" FORCE)
+SET(insure      "--with-insuretools --with-cppflags=-D__INSURE__" CACHE STRING "insure.variant" FORCE)
+SET(insure_make "QA=insure" CACHE STRING "insure_variant_make" FORCE)
diff --git a/cmake/variants/variants.bgfen0 b/cmake/variants/variants.bgfen0
new file mode 100644
index 00000000000..bf524175a53
--- /dev/null
+++ b/cmake/variants/variants.bgfen0
@@ -0,0 +1,55 @@
+## GNU-Compiler setting
+SET(gnubgp_compiler "CC=/usr/bin/gcc;CXX=/usr/bin/g++;CCAS=/bgsys/drivers/ppcfloor/gnu-linux/bin/powerpc-bgp-linux-gcc")
+SET(CCASFLAGS "-DHAVE_BGP")
+
+## Set compiler-flags
+SET(ion "${debugopt}" CACHE STRING "ion: flag(s) settings" FORCE)
+SET(cn "${debugopt}" CACHE STRING "cn: flag(s) settings" FORCE)
+
+SET(CASACORE_PATH "/cephome/romein/packages/casacore-0.3.0/stage" CACHE STRING "CasaCore path" FORCE)
+
+SET ( Boost_FIND_COMPONENTS "date_time" "thread") 
+
+add_definitions (-DHAVE_BGP)
+add_definitions (-DHAVE_BGP_ION)
+add_definitions (-DUSE_THREADS)
+add_definitions (-DHAVE_PKVERSION)
+
+include_directories (/bgsys/drivers/ppcfloor/comm/include)
+include_directories (/bgsys/drivers/ppcfloor/arch/include)
+
+if ( ${PACKAGE_NAME} STREQUAL "CNProc" )
+  include_directories (/cephome/romein/packages/fftw-2.1.5-single-precision/include)
+  link_directories(/bgsys/drivers/ppcfloor/comm/lib)
+  link_directories(/bgsys/drivers/ppcfloor/runtime/SPI)
+  link_directories(/cephome/romein/packages/fftw-2.1.5-single-precision/lib)
+  link_directories(/opt/mass/lib)
+
+  SET ( WITH-LIBS "-lcxxmpich.cnk -lmpich.cnk -ldcmfcoll.cnk -ldcmf.cnk -lpthread -lrt -lSPI.cna -lm -lrfftw -lfftw -lmass" CACHE STRING "With libs" FORCE)
+
+  add_definitions (-DHAVE_FFTW2)
+  add_definitions (-DHAVE_MPI)
+
+  # Initialize CXX link type selection flags.  These flags are used when
+  # building a shared library, shared module, or executable that links
+  # to other libraries to select whether to use the static or shared
+  # versions of the libraries.
+  # Tempory solution! More info see:
+  # 0005087: Can't build static binary on Linux - Mantis
+  # http://www.vtk.org/Bug/view.php?id=5087 
+  SET(CMAKE_SHARED_LIBRARY_LINK_DYNAMIC_CXX_FLAGS "-Wl,-Bstatic")
+  SET(CMAKE_SHARED_MODULE_LINK_DYNAMIC_CXX_FLAGS "-Wl,-Bstatic")
+  SET(CMAKE_EXE_LINK_DYNAMIC_CXX_FLAGS "-Wl,-Bstatic")
+
+  SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") 
+
+  #SET (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static" CACHE STRING "EXE" FORCE)
+  #SET (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -static" CACHE STRING "SHARED" FORCE)
+  #SET (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -static" CACHE STRING "MODULE" FORCE)
+endif ( ${PACKAGE_NAME} STREQUAL "CNProc" )
+
+SET( CXX_COMPILE_FLAGS "-B/bgsys/drivers/ppcfloor/gnu-linux/powerpc-bgp-linux/bin -pthread" CACHE STRING "g++ Compiler flags" FORCE )
+
+## Package module(s):
+SET(${PACKAGE_NAME}_modules "FindBoost;FindCASACORE;FindBacktrace" CACHE STRING "CNProc module(s)" FORCE)
+SET(${PACKAGE_NAME}_modules "FindBoost;FindCASACORE;FindBacktrace" CACHE STRING "IONProc module(s)" FORCE)
diff --git a/cmake/variants/variants.liifen b/cmake/variants/variants.liifen
new file mode 100644
index 00000000000..e27b34948d2
--- /dev/null
+++ b/cmake/variants/variants.liifen
@@ -0,0 +1,12 @@
+## GNU-Compiler setting
+SET(gnu_compiler   "CC=/usr/bin/gcc;CXX=/usr/bin/g++")
+
+## Set compiler-flags
+SET(openmpi-opt "${opt}" CACHE STRING "openmpi-opt: flag(s) settings" FORCE)
+
+add_definitions (-DHAVE_PKVERSION)
+
+SET ( Boost_FIND_COMPONENTS "date_time" "filesystem" "iostreams" "program_options" "regex" "serialization" "thread" "wave") 
+
+## Modules: Storage
+SET(${PACKAGE_NAME}_modules "${STANDARD_MODULES};FindMPI;FindBoost;FindCASACORE;FindLog4CPlus;FindBacktrace" CACHE STRING "Storage module(s)" FORCE)
-- 
GitLab