From 29f28541cf688c8159e009130fca5088308788bf Mon Sep 17 00:00:00 2001
From: Marcel Loose <loose@astron.nl>
Date: Tue, 16 Jun 2009 22:15:37 +0000
Subject: [PATCH] Bug 1310: Merge of development branch
 LOFAR-bug1310-task-branch rev. 12447-13413 with the trunk.

---
 .gitattributes                                |  88 +--
 .gitignore                                    |   6 +-
 CEP/CMakeLists.txt                            | 150 ++---
 CEP/Calibration/BBSControl/CMakeLists.txt     |  56 ++
 .../include/BBSControl/CMakeLists.txt         |  65 ++
 CEP/Calibration/BBSControl/src/CMakeLists.txt |  69 ++
 .../BBSControl/test/CMakeLists.txt            |  24 +
 CEP/Calibration/BBSKernel/CMakeLists.txt      |  54 ++
 .../include/BBSKernel/CMakeLists.txt          |  91 +++
 CEP/Calibration/BBSKernel/src/CMakeLists.txt  |  88 +++
 CEP/Calibration/BBSKernel/test/CMakeLists.txt |  24 +
 CEP/Calibration/CMakeLists.txt                |  43 ++
 CEP/DP3/CMakeLists.txt                        |  43 ++
 CEP/DP3/DPPP/CMakeLists.txt                   |  53 ++
 CEP/DP3/DPPP/src/CMakeLists.txt               |  46 ++
 CEP/DP3/DPPP/test/CMakeLists.txt              |  23 +
 CEP/Imager/CMakeLists.txt                     |  43 ++
 CEP/Imager/MWCommon/src/finddproc.cc          | 154 -----
 CEP/Imager/MWCommon/src/socketrun             | 115 ----
 CEP/Imager/MWCommon/test/tfinddproc.stdout    |   3 -
 CEP/Imager/MWCommon/test/tstartdproc.stdout   |  22 -
 CEP/Imager/MWControl/CMakeLists.txt           |  53 ++
 .../include/MWControl/CMakeLists.txt          |  41 ++
 CEP/Imager/MWControl/src/CMakeLists.txt       |  38 ++
 CEP/Imager/MWControl/test/CMakeLists.txt      |  25 +
 CEP/MS/CMakeLists.txt                         |  53 ++
 CEP/MS/include/MS/CMakeLists.txt              |  33 +
 CEP/MS/src/CMakeLists.txt                     |  46 ++
 CEP/MS/test/CMakeLists.txt                    |  24 +
 CEP/MS/test/{tMSSplit_test.sh => tMSSplit.sh} |   0
 CEP/MWCommon/CMakeLists.txt                   |  53 ++
 CEP/{Imager => }/MWCommon/Makefile.am         |   0
 CEP/{Imager => }/MWCommon/bootstrap           |   0
 CEP/{Imager => }/MWCommon/configure.in        |   2 -
 CEP/MWCommon/include/MWCommon/CMakeLists.txt  |  65 ++
 .../MWCommon/include/MWCommon/ClusterDesc.h   |   0
 .../MWCommon/include/MWCommon/Controller.h    |   0
 .../include/MWCommon/ControllerBase.h         |   0
 .../MWCommon/include/MWCommon/DomainShape.h   |   0
 .../MWCommon/include/MWCommon/MPIConnection.h |   0
 .../include/MWCommon/MPIConnectionSet.h       |   0
 .../MWCommon/include/MWCommon/MWBlobIO.h      |   0
 .../MWCommon/include/MWCommon/MWConnection.h  |   0
 .../include/MWCommon/MWConnectionSet.h        |   0
 .../MWCommon/include/MWCommon/MWError.h       |   0
 .../MWCommon/include/MWCommon/MWGlobalStep.h  |   0
 .../MWCommon/include/MWCommon/MWIos.h         |   0
 .../MWCommon/include/MWCommon/MWLocalStep.h   |   0
 .../MWCommon/include/MWCommon/MWMultiStep.h   |   0
 .../MWCommon/include/MWCommon/MWStep.h        |   0
 .../MWCommon/include/MWCommon/MWStepFactory.h |   0
 .../MWCommon/include/MWCommon/MWStepVisitor.h |   0
 .../MWCommon/include/MWCommon/Makefile.am     |   0
 .../MWCommon/include/MWCommon/MasterControl.h |   0
 .../MWCommon/include/MWCommon/MemConnection.h |   0
 .../include/MWCommon/MemConnectionSet.h       |   0
 .../MWCommon/include/MWCommon/NodeDesc.h      |   0
 .../MWCommon/include/MWCommon/ObsDomain.h     |   0
 .../include/MWCommon/ParameterHandler.h       |   0
 .../include/MWCommon/SocketConnection.h       |   2 +-
 .../include/MWCommon/SocketConnectionSet.h    |   0
 .../include/MWCommon/SocketListener.h         |   0
 .../MWCommon/include/MWCommon/VdsDesc.h       |   0
 .../MWCommon/include/MWCommon/VdsPartDesc.h   |   7 -
 .../include/MWCommon/WorkDomainSpec.h         |   0
 .../MWCommon/include/MWCommon/WorkerControl.h |   0
 .../MWCommon/include/MWCommon/WorkerFactory.h |   0
 .../MWCommon/include/MWCommon/WorkerInfo.h    |   0
 .../MWCommon/include/MWCommon/WorkerProxy.h   |   0
 .../MWCommon/include/MWCommon/WorkersDesc.h   |   0
 CEP/{Imager => }/MWCommon/include/Makefile.am |   0
 CEP/{Imager => }/MWCommon/package.dox         |   0
 CEP/MWCommon/src/CMakeLists.txt               |  66 ++
 CEP/{Imager => }/MWCommon/src/ClusterDesc.cc  |   0
 CEP/{Imager => }/MWCommon/src/Controller.cc   |   3 +-
 .../MWCommon/src/ControllerBase.cc            |   0
 CEP/{Imager => }/MWCommon/src/DomainShape.cc  |   0
 .../MWCommon/src/MPIConnection.cc             |   0
 .../MWCommon/src/MPIConnectionSet.cc          |   0
 CEP/{Imager => }/MWCommon/src/MWBlobIO.cc     |   0
 CEP/{Imager => }/MWCommon/src/MWConnection.cc |   0
 .../MWCommon/src/MWConnectionSet.cc           |   0
 CEP/{Imager => }/MWCommon/src/MWGlobalStep.cc |   0
 CEP/{Imager => }/MWCommon/src/MWIos.cc        |   0
 CEP/{Imager => }/MWCommon/src/MWLocalStep.cc  |   0
 CEP/{Imager => }/MWCommon/src/MWMultiStep.cc  |   0
 CEP/{Imager => }/MWCommon/src/MWStep.cc       |   0
 .../MWCommon/src/MWStepFactory.cc             |   0
 .../MWCommon/src/MWStepVisitor.cc             |   0
 CEP/{Imager => }/MWCommon/src/Makefile.am     |   0
 .../MWCommon/src/MasterControl.cc             |   0
 .../MWCommon/src/MemConnection.cc             |   0
 .../MWCommon/src/MemConnectionSet.cc          |   0
 CEP/{Imager => }/MWCommon/src/NodeDesc.cc     |   0
 CEP/{Imager => }/MWCommon/src/ObsDomain.cc    |   0
 .../MWCommon/src/ParameterHandler.cc          |   0
 .../MWCommon/src/SocketConnection.cc          |   0
 .../MWCommon/src/SocketConnectionSet.cc       |   0
 .../MWCommon/src/SocketListener.cc            |   0
 CEP/{Imager => }/MWCommon/src/VdsDesc.cc      |   0
 CEP/{Imager => }/MWCommon/src/VdsPartDesc.cc  |   8 +-
 .../MWCommon/src/WorkDomainSpec.cc            |   0
 .../MWCommon/src/WorkerControl.cc             |   0
 .../MWCommon/src/WorkerFactory.cc             |   0
 CEP/{Imager => }/MWCommon/src/WorkerInfo.cc   |   0
 CEP/{Imager => }/MWCommon/src/WorkerProxy.cc  |   0
 CEP/{Imager => }/MWCommon/src/WorkersDesc.cc  |   0
 CEP/MWCommon/src/finddproc.cc                 |  74 ++
 CEP/MWCommon/src/socketrun                    |  60 ++
 CEP/{Imager => }/MWCommon/src/startdistproc   |  82 +--
 CEP/MWCommon/test/CMakeLists.txt              |  31 +
 CEP/{Imager => }/MWCommon/test/Makefile.am    |   0
 .../MWCommon/test/tClusterDesc.cc             |   0
 .../MWCommon/test/tClusterDesc.parset         |   0
 .../MWCommon/test/tClusterDesc.sh             |   0
 CEP/{Imager => }/MWCommon/test/tNodeDesc.cc   |   0
 CEP/{Imager => }/MWCommon/test/tNodeDesc.sh   |   0
 .../MWCommon/test/tSocketConnection.cc        |   0
 .../MWCommon/test/tSocketConnection.run       |   0
 .../MWCommon/test/tSocketConnection.sh        |   0
 .../MWCommon/test/tSocketConnection.stdout    |   0
 CEP/{Imager => }/MWCommon/test/tVdsDesc.cc    |   0
 CEP/{Imager => }/MWCommon/test/tVdsDesc.sh    |   0
 .../MWCommon/test/tVdsPartDesc.cc             |   2 -
 .../MWCommon/test/tVdsPartDesc.sh             |   0
 .../MWCommon/test/tWorkersDesc.cc             |   0
 .../MWCommon/test/tWorkersDesc.sh             |   0
 .../MWCommon/test/tfinddproc.in_cd            |   0
 .../MWCommon/test/tfinddproc.in_vd            |   9 +-
 CEP/{Imager => }/MWCommon/test/tfinddproc.run |   0
 CEP/{Imager => }/MWCommon/test/tfinddproc.sh  |   0
 CEP/MWCommon/test/tfinddproc.stdout           |   3 +
 .../MWCommon/test/tstartdproc.in_cd           |   0
 .../MWCommon/test/tstartdproc.in_vd           |   9 +-
 .../MWCommon/test/tstartdproc.run             |   0
 CEP/{Imager => }/MWCommon/test/tstartdproc.sh |   0
 CEP/MWCommon/test/tstartdproc.stdout          |  22 +
 CEP/ParmDB/CMakeLists.txt                     |  54 ++
 CEP/ParmDB/include/ParmDB/CMakeLists.txt      |  48 ++
 CEP/ParmDB/src/CMakeLists.txt                 |  50 ++
 CEP/ParmDB/test/CMakeLists.txt                |  36 +
 CEP/ParmDB/test/tParmFacade.run               |   2 +-
 CMake/CMakeASM-BGPInformation.cmake           |  32 +
 CMake/CMakeDetermineASM-BGPCompiler.cmake     |  30 +
 CMake/CMakeSettings.cmake                     |  39 ++
 .../CMakeTestASM-BGPCompiler.cmake            |  18 +-
 CMake/FindBISON.cmake                         | 164 +++++
 CMake/FindBacktrace.cmake                     |  69 ++
 CMake/FindCasacore.cmake                      | 235 +++++++
 CMake/FindFFTW2.cmake                         | 167 +++++
 CMake/FindFFTW3.cmake                         | 158 +++++
 CMake/FindFLEX.cmake                          | 134 ++++
 CMake/FindLog4Cplus.cmake                     |  46 ++
 {cmake/modules => CMake}/FindMPI.cmake        |  23 +-
 CMake/FindPQXX.cmake                          |  47 ++
 CMake/FindPackageHandleStandardArgs.cmake     |  65 ++
 CMake/FindPthreads.cmake                      |  98 +++
 CMake/JoinArguments.cmake                     |   8 +
 CMake/LofarAddPackage.cmake                   | 101 +++
 CMake/LofarCTest.cmake                        |  37 +
 CMake/LofarConf.cmake                         |  40 ++
 CMake/LofarConfig.cmake                       |  35 +
 CMake/LofarFindPackage.cmake                  |  81 +++
 CMake/LofarGeneral.cmake                      |  79 +++
 CMake/LofarInit.cmake                         | 216 ++++++
 CMake/LofarMacros.cmake                       | 211 ++++++
 CMake/LofarOptions.cmake                      | 108 +++
 CMake/LofarPackageVersion.cmake               |  50 ++
 CMake/LofarProject.cmake                      |  46 ++
 CMake/LofarSearchPath.cmake                   |  50 ++
 CMake/LofarVariants.cmake                     |  48 ++
 CMake/MACAddProtocol.cmake                    |  63 ++
 CMake/makeversion                             | 316 +++++++++
 CMake/variants/variants                       |  70 ++
 CMake/variants/variants.bgfen0                |  55 ++
 CMake/variants/variants.dop131                |  42 ++
 CMakeLists.txt                                | 314 ++-------
 LCS/ACC/ALC/CMakeLists.txt                    |  52 ++
 LCS/ACC/ALC/include/ALC/CMakeLists.txt        |  20 +
 LCS/ACC/ALC/src/CMakeLists.txt                |  41 ++
 LCS/ACC/ALC/test/CMakeLists.txt               |   5 +
 LCS/ACC/CMakeLists.txt                        |  69 +-
 LCS/ACC/PLC/CMakeLists.txt                    |  79 ++-
 LCS/ACC/PLC/include/PLC/CMakeLists.txt        |  36 +-
 LCS/ACC/PLC/src/CMakeLists.txt                |  55 +-
 LCS/ACC/PLC/test/CMakeLists.txt               |  36 +-
 LCS/ACC/PLC/test/tPCCmd.cc                    |   2 +-
 LCS/AMC/AMCBase/CMakeLists.txt                |  78 ++-
 .../AMCBase/include/AMCBase/CMakeLists.txt    |  45 +-
 LCS/AMC/AMCBase/src/CMakeLists.txt            |  59 +-
 LCS/AMC/AMCBase/test/CMakeLists.txt           |  79 +--
 LCS/AMC/AMCImpl/CMakeLists.txt                |  80 ++-
 .../AMCImpl/include/AMCImpl/CMakeLists.txt    |  23 +-
 LCS/AMC/AMCImpl/src/CMakeLists.txt            |  84 +--
 LCS/AMC/AMCImpl/test/CMakeLists.txt           |  52 +-
 LCS/AMC/CMakeLists.txt                        |  58 +-
 LCS/ApplCommon/CMakeLists.txt                 |  82 ++-
 .../include/ApplCommon/CMakeLists.txt         |  40 +-
 LCS/ApplCommon/src/CMakeLists.txt             |  41 +-
 LCS/ApplCommon/test/CMakeLists.txt            |  66 +-
 LCS/Blob/CMakeLists.txt                       |  79 ++-
 LCS/Blob/include/Blob/CMakeLists.txt          | 100 +--
 LCS/Blob/src/CMakeLists.txt                   | 133 ++--
 LCS/Blob/test/CMakeLists.txt                  |  93 +--
 LCS/Blob/test/Makefile.am                     |  18 +-
 .../{tBlobAipsIO_test.sh => tBlobAipsIO.sh}   |   0
 .../{tBlobArray_test.sh => tBlobArray.sh}     |   0
 LCS/Blob/test/tBlobArrayHeader.sh             |   2 +
 .../test/{tBlobCasa_test.sh => tBlobCasa.sh}  |   0
 .../{tBlobField_test.sh => tBlobField.sh}     |   0
 .../{tBlobHeader_test.sh => tBlobHeader.sh}   |   0
 .../test/{tBlobSTL_test.sh => tBlobSTL.sh}    |   0
 .../{tBlobStream_test.sh => tBlobStream.sh}   |   0
 .../{tBlobString_test.sh => tBlobString.sh}   |   0
 .../{tKeyValueMap_test.sh => tKeyValueMap.sh} |   0
 LCS/CMakeLists.txt                            | 172 ++---
 LCS/Common/CMakeLists.txt                     |  79 ++-
 LCS/Common/config.h.cmake                     | 148 ++++
 LCS/Common/include/Common/CMakeLists.txt      | 167 +++--
 LCS/Common/lofar_config.h.cmake               | 152 ++++-
 LCS/Common/src/CMakeLists.txt                 | 150 +++--
 LCS/Common/src/Version.cc                     |   2 +-
 LCS/Common/test/CMakeLists.txt                | 100 ++-
 LCS/Common/test/tBacktrace.cc                 |   4 +-
 LCS/Common/test/tBacktrace.sh                 |   2 +
 LCS/Common/test/tParameterSetPerf.run         |   2 +-
 LCS/Stream/CMakeLists.txt                     |  62 +-
 LCS/Stream/include/Stream/CMakeLists.txt      |  29 +-
 LCS/Stream/src/CMakeLists.txt                 |  51 +-
 LCS/Stream/test/CMakeLists.txt                |   7 +
 LCS/Tools/CMakeLists.txt                      |  42 ++
 LCS/Tools/config.h.cmake                      | 124 ++++
 LCS/Tools/lofar_config.h.cmake                | 124 ++++
 LCS/Tools/src/CMakeLists.txt                  |  71 ++
 .../src/{lofarinit.csh => lofarinit.csh.in}   |   2 +-
 .../src/{lofarinit.sh => lofarinit.sh.in}     |   2 +-
 LCS/Transport/CMakeLists.txt                  |  73 +-
 .../include/Transport/CMakeLists.txt          |  49 +-
 LCS/Transport/src/CMakeLists.txt              |  69 +-
 LCS/Transport/test/CMakeLists.txt             | 121 +---
 .../test/{Example_test.sh => Example.sh}      |   0
 .../{ExampleBlMem_test.sh => ExampleBlMem.sh} |   0
 ...pleEthernet_test.sh => ExampleEthernet.sh} |   0
 .../{ExampleMPI_test.sh => ExampleMPI.sh}     |   0
 .../{ExampleMem_test.sh => ExampleMem.sh}     |   0
 ...Blocking_test.sh => ExampleNonBlocking.sh} |   0
 .../{ExampleShMem_test.sh => ExampleShMem.sh} |   0
 LCS/Transport/test/ExampleSocket.run          |  12 +-
 ...ExampleSocket_test.sh => ExampleSocket.sh} |   0
 ...ExampleVarBuf_test.sh => ExampleVarBuf.sh} |   0
 LCS/Transport/test/Makefile.am                |  18 +-
 ...rectional_test.sh => TestBidirectional.sh} |   0
 .../{tTH_Socket_test.sh => tTH_Socket.sh}     |   0
 LCS/config.h.cmake                            | 148 ++++
 LCS/lofar_config.h.cmake                      | 148 ++++
 MAC/CMakeLists.txt                            |  46 ++
 MAC/GCF/CMakeLists.txt                        |  45 ++
 MAC/GCF/TM/CMakeLists.txt                     |  53 ++
 MAC/GCF/TM/include/GCF/TM/CMakeLists.txt      |  45 ++
 MAC/GCF/TM/src/CMakeLists.txt                 |  55 ++
 MAC/GCF/TM/test/CMakeLists.txt                |  53 ++
 MAC/MACIO/CMakeLists.txt                      |  53 ++
 MAC/MACIO/autogen/protocol.tpl                |   1 +
 MAC/MACIO/include/MACIO/CMakeLists.txt        |  38 ++
 MAC/MACIO/src/CMakeLists.txt                  |  46 ++
 MAC/MACIO/test/CMakeLists.txt                 |  33 +
 MAC/MACIO/test/tEventPort.cc                  |   2 +-
 MAC/MACIO/test/tEventPort.sh                  |   2 +
 MAC/MACIO/test/tProtocol.sh                   |   2 +
 RTCP/CMakeLists.txt                           | 139 ++--
 RTCP/CNProc/CMakeLists.txt                    |  77 ++-
 RTCP/CNProc/src/CMakeLists.txt                | 166 ++---
 RTCP/CNProc/src/FIR.cc                        |   1 +
 RTCP/FCNP/CMakeLists.txt                      |  76 ++-
 RTCP/FCNP/src/CMakeLists.txt                  |  56 +-
 RTCP/Interface/CMakeLists.txt                 |  79 ++-
 .../include/Interface/CMakeLists.txt          |  62 +-
 RTCP/Interface/src/CMakeLists.txt             |  47 +-
 RTCP/Interface/test/CMakeLists.txt            |  72 +-
 RTCP/Interface/test/tRSPTimeStamp.sh          |   2 +
 RTCP/Interface/test/tSparseSet.sh             |   2 +
 RTCP/RTCPTools/CMakeLists.txt                 |  40 ++
 RTCP/RTCPTools/src/CMakeLists.txt             |  26 +
 RTCP/Storage/CMakeLists.txt                   |  79 ++-
 RTCP/Storage/include/Storage/CMakeLists.txt   |  24 +-
 RTCP/Storage/src/CMakeLists.txt               |  78 +--
 RTCP/Storage/test/CMakeLists.txt              |  23 +
 RTCP/Storage/test/tAH_TestStorage.sh          |   2 +
 SAS/CMakeLists.txt                            |  44 ++
 SAS/OTB/CMakeLists.txt                        |  44 ++
 SAS/OTB/jOTDB2/CMakeLists.txt                 |  54 ++
 SAS/OTB/jOTDB2/include/jOTDB2/CMakeLists.txt  |  40 ++
 SAS/OTB/jOTDB2/src/CMakeLists.txt             |  41 ++
 SAS/OTDB/CMakeLists.txt                       |  54 ++
 SAS/OTDB/include/OTDB/CMakeLists.txt          |  49 ++
 SAS/OTDB/src/CMakeLists.txt                   |  41 ++
 SAS/OTDB/test/CMakeLists.txt                  |  30 +
 .../{tConnection_test.sh => tConnection.sh}   |   0
 SAS/OTDB/test/tConverter_test.sh              |   5 -
 .../test/{tPICtree_test.sh => tPICtree.sh}    |   0
 .../test/{tPICvalue_test.sh => tPICvalue.sh}  |   0
 .../test/{tConverter.cc => tParamTypeConv.cc} |   1 -
 ...erter.log_prop => tParamTypeConv.log_prop} |   0
 SAS/OTDB/test/tParamTypeConv.sh               |   5 +
 SAS/OTDB/test/{tVHtree_test.sh => tVHtree.sh} |   0
 .../test/{tVHvalue_test.sh => tVHvalue.sh}    |   0
 .../test/{tVICcomp_test.sh => tVICcomp.sh}    |   0
 SAS/OTDB/test/{tVTtree_test.sh => tVTtree.sh} |   0
 autoconf_share/runctest.sh                    |  37 +
 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             | 174 -----
 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/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/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/makefile                        |   7 -
 cmake/modules/template_FindXX.cmake           |  89 ---
 cmake/variants/variants                       |  43 --
 cmake/variants/variants.bgfen0                |  44 --
 cmake/variants/variants.liifen                |  13 -
 config.h.cmake                                |   3 +
 lofar_config.h.cmake                          | 164 ++++-
 372 files changed, 8795 insertions(+), 9948 deletions(-)
 create mode 100644 CEP/Calibration/BBSControl/CMakeLists.txt
 create mode 100644 CEP/Calibration/BBSControl/include/BBSControl/CMakeLists.txt
 create mode 100644 CEP/Calibration/BBSControl/src/CMakeLists.txt
 create mode 100644 CEP/Calibration/BBSControl/test/CMakeLists.txt
 create mode 100644 CEP/Calibration/BBSKernel/CMakeLists.txt
 create mode 100644 CEP/Calibration/BBSKernel/include/BBSKernel/CMakeLists.txt
 create mode 100644 CEP/Calibration/BBSKernel/src/CMakeLists.txt
 create mode 100644 CEP/Calibration/BBSKernel/test/CMakeLists.txt
 create mode 100644 CEP/Calibration/CMakeLists.txt
 create mode 100644 CEP/DP3/CMakeLists.txt
 create mode 100644 CEP/DP3/DPPP/CMakeLists.txt
 create mode 100644 CEP/DP3/DPPP/src/CMakeLists.txt
 create mode 100644 CEP/DP3/DPPP/test/CMakeLists.txt
 create mode 100644 CEP/Imager/CMakeLists.txt
 delete mode 100644 CEP/Imager/MWCommon/src/finddproc.cc
 delete mode 100755 CEP/Imager/MWCommon/src/socketrun
 delete mode 100644 CEP/Imager/MWCommon/test/tfinddproc.stdout
 delete mode 100644 CEP/Imager/MWCommon/test/tstartdproc.stdout
 create mode 100644 CEP/Imager/MWControl/CMakeLists.txt
 create mode 100644 CEP/Imager/MWControl/include/MWControl/CMakeLists.txt
 create mode 100644 CEP/Imager/MWControl/src/CMakeLists.txt
 create mode 100644 CEP/Imager/MWControl/test/CMakeLists.txt
 create mode 100644 CEP/MS/CMakeLists.txt
 create mode 100644 CEP/MS/include/MS/CMakeLists.txt
 create mode 100644 CEP/MS/src/CMakeLists.txt
 create mode 100644 CEP/MS/test/CMakeLists.txt
 rename CEP/MS/test/{tMSSplit_test.sh => tMSSplit.sh} (100%)
 create mode 100644 CEP/MWCommon/CMakeLists.txt
 rename CEP/{Imager => }/MWCommon/Makefile.am (100%)
 rename CEP/{Imager => }/MWCommon/bootstrap (100%)
 rename CEP/{Imager => }/MWCommon/configure.in (93%)
 create mode 100644 CEP/MWCommon/include/MWCommon/CMakeLists.txt
 rename CEP/{Imager => }/MWCommon/include/MWCommon/ClusterDesc.h (100%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/Controller.h (100%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/ControllerBase.h (100%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/DomainShape.h (100%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/MPIConnection.h (100%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/MPIConnectionSet.h (100%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/MWBlobIO.h (100%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/MWConnection.h (100%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/MWConnectionSet.h (100%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/MWError.h (100%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/MWGlobalStep.h (100%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/MWIos.h (100%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/MWLocalStep.h (100%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/MWMultiStep.h (100%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/MWStep.h (100%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/MWStepFactory.h (100%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/MWStepVisitor.h (100%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/Makefile.am (100%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/MasterControl.h (100%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/MemConnection.h (100%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/MemConnectionSet.h (100%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/NodeDesc.h (100%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/ObsDomain.h (100%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/ParameterHandler.h (100%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/SocketConnection.h (97%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/SocketConnectionSet.h (100%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/SocketListener.h (100%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/VdsDesc.h (100%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/VdsPartDesc.h (95%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/WorkDomainSpec.h (100%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/WorkerControl.h (100%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/WorkerFactory.h (100%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/WorkerInfo.h (100%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/WorkerProxy.h (100%)
 rename CEP/{Imager => }/MWCommon/include/MWCommon/WorkersDesc.h (100%)
 rename CEP/{Imager => }/MWCommon/include/Makefile.am (100%)
 rename CEP/{Imager => }/MWCommon/package.dox (100%)
 create mode 100644 CEP/MWCommon/src/CMakeLists.txt
 rename CEP/{Imager => }/MWCommon/src/ClusterDesc.cc (100%)
 rename CEP/{Imager => }/MWCommon/src/Controller.cc (98%)
 rename CEP/{Imager => }/MWCommon/src/ControllerBase.cc (100%)
 rename CEP/{Imager => }/MWCommon/src/DomainShape.cc (100%)
 rename CEP/{Imager => }/MWCommon/src/MPIConnection.cc (100%)
 rename CEP/{Imager => }/MWCommon/src/MPIConnectionSet.cc (100%)
 rename CEP/{Imager => }/MWCommon/src/MWBlobIO.cc (100%)
 rename CEP/{Imager => }/MWCommon/src/MWConnection.cc (100%)
 rename CEP/{Imager => }/MWCommon/src/MWConnectionSet.cc (100%)
 rename CEP/{Imager => }/MWCommon/src/MWGlobalStep.cc (100%)
 rename CEP/{Imager => }/MWCommon/src/MWIos.cc (100%)
 rename CEP/{Imager => }/MWCommon/src/MWLocalStep.cc (100%)
 rename CEP/{Imager => }/MWCommon/src/MWMultiStep.cc (100%)
 rename CEP/{Imager => }/MWCommon/src/MWStep.cc (100%)
 rename CEP/{Imager => }/MWCommon/src/MWStepFactory.cc (100%)
 rename CEP/{Imager => }/MWCommon/src/MWStepVisitor.cc (100%)
 rename CEP/{Imager => }/MWCommon/src/Makefile.am (100%)
 rename CEP/{Imager => }/MWCommon/src/MasterControl.cc (100%)
 rename CEP/{Imager => }/MWCommon/src/MemConnection.cc (100%)
 rename CEP/{Imager => }/MWCommon/src/MemConnectionSet.cc (100%)
 rename CEP/{Imager => }/MWCommon/src/NodeDesc.cc (100%)
 rename CEP/{Imager => }/MWCommon/src/ObsDomain.cc (100%)
 rename CEP/{Imager => }/MWCommon/src/ParameterHandler.cc (100%)
 rename CEP/{Imager => }/MWCommon/src/SocketConnection.cc (100%)
 rename CEP/{Imager => }/MWCommon/src/SocketConnectionSet.cc (100%)
 rename CEP/{Imager => }/MWCommon/src/SocketListener.cc (100%)
 rename CEP/{Imager => }/MWCommon/src/VdsDesc.cc (100%)
 rename CEP/{Imager => }/MWCommon/src/VdsPartDesc.cc (95%)
 rename CEP/{Imager => }/MWCommon/src/WorkDomainSpec.cc (100%)
 rename CEP/{Imager => }/MWCommon/src/WorkerControl.cc (100%)
 rename CEP/{Imager => }/MWCommon/src/WorkerFactory.cc (100%)
 rename CEP/{Imager => }/MWCommon/src/WorkerInfo.cc (100%)
 rename CEP/{Imager => }/MWCommon/src/WorkerProxy.cc (100%)
 rename CEP/{Imager => }/MWCommon/src/WorkersDesc.cc (100%)
 create mode 100644 CEP/MWCommon/src/finddproc.cc
 create mode 100755 CEP/MWCommon/src/socketrun
 rename CEP/{Imager => }/MWCommon/src/startdistproc (64%)
 create mode 100644 CEP/MWCommon/test/CMakeLists.txt
 rename CEP/{Imager => }/MWCommon/test/Makefile.am (100%)
 rename CEP/{Imager => }/MWCommon/test/tClusterDesc.cc (100%)
 rename CEP/{Imager => }/MWCommon/test/tClusterDesc.parset (100%)
 rename CEP/{Imager => }/MWCommon/test/tClusterDesc.sh (100%)
 rename CEP/{Imager => }/MWCommon/test/tNodeDesc.cc (100%)
 rename CEP/{Imager => }/MWCommon/test/tNodeDesc.sh (100%)
 rename CEP/{Imager => }/MWCommon/test/tSocketConnection.cc (100%)
 rename CEP/{Imager => }/MWCommon/test/tSocketConnection.run (100%)
 rename CEP/{Imager => }/MWCommon/test/tSocketConnection.sh (100%)
 rename CEP/{Imager => }/MWCommon/test/tSocketConnection.stdout (100%)
 rename CEP/{Imager => }/MWCommon/test/tVdsDesc.cc (100%)
 rename CEP/{Imager => }/MWCommon/test/tVdsDesc.sh (100%)
 rename CEP/{Imager => }/MWCommon/test/tVdsPartDesc.cc (96%)
 rename CEP/{Imager => }/MWCommon/test/tVdsPartDesc.sh (100%)
 rename CEP/{Imager => }/MWCommon/test/tWorkersDesc.cc (100%)
 rename CEP/{Imager => }/MWCommon/test/tWorkersDesc.sh (100%)
 rename CEP/{Imager => }/MWCommon/test/tfinddproc.in_cd (100%)
 rename CEP/{Imager => }/MWCommon/test/tfinddproc.in_vd (76%)
 rename CEP/{Imager => }/MWCommon/test/tfinddproc.run (100%)
 rename CEP/{Imager => }/MWCommon/test/tfinddproc.sh (100%)
 create mode 100644 CEP/MWCommon/test/tfinddproc.stdout
 rename CEP/{Imager => }/MWCommon/test/tstartdproc.in_cd (100%)
 rename CEP/{Imager => }/MWCommon/test/tstartdproc.in_vd (76%)
 rename CEP/{Imager => }/MWCommon/test/tstartdproc.run (100%)
 rename CEP/{Imager => }/MWCommon/test/tstartdproc.sh (100%)
 create mode 100644 CEP/MWCommon/test/tstartdproc.stdout
 create mode 100644 CEP/ParmDB/CMakeLists.txt
 create mode 100644 CEP/ParmDB/include/ParmDB/CMakeLists.txt
 create mode 100644 CEP/ParmDB/src/CMakeLists.txt
 create mode 100644 CEP/ParmDB/test/CMakeLists.txt
 create mode 100644 CMake/CMakeASM-BGPInformation.cmake
 create mode 100644 CMake/CMakeDetermineASM-BGPCompiler.cmake
 create mode 100644 CMake/CMakeSettings.cmake
 rename cmake/modules/LOFARTest.cmake => CMake/CMakeTestASM-BGPCompiler.cmake (73%)
 create mode 100644 CMake/FindBISON.cmake
 create mode 100644 CMake/FindBacktrace.cmake
 create mode 100644 CMake/FindCasacore.cmake
 create mode 100644 CMake/FindFFTW2.cmake
 create mode 100644 CMake/FindFFTW3.cmake
 create mode 100644 CMake/FindFLEX.cmake
 create mode 100644 CMake/FindLog4Cplus.cmake
 rename {cmake/modules => CMake}/FindMPI.cmake (92%)
 create mode 100644 CMake/FindPQXX.cmake
 create mode 100644 CMake/FindPackageHandleStandardArgs.cmake
 create mode 100644 CMake/FindPthreads.cmake
 create mode 100644 CMake/JoinArguments.cmake
 create mode 100644 CMake/LofarAddPackage.cmake
 create mode 100644 CMake/LofarCTest.cmake
 create mode 100644 CMake/LofarConf.cmake
 create mode 100644 CMake/LofarConfig.cmake
 create mode 100644 CMake/LofarFindPackage.cmake
 create mode 100644 CMake/LofarGeneral.cmake
 create mode 100644 CMake/LofarInit.cmake
 create mode 100644 CMake/LofarMacros.cmake
 create mode 100644 CMake/LofarOptions.cmake
 create mode 100644 CMake/LofarPackageVersion.cmake
 create mode 100644 CMake/LofarProject.cmake
 create mode 100644 CMake/LofarSearchPath.cmake
 create mode 100644 CMake/LofarVariants.cmake
 create mode 100644 CMake/MACAddProtocol.cmake
 create mode 100755 CMake/makeversion
 create mode 100644 CMake/variants/variants
 create mode 100644 CMake/variants/variants.bgfen0
 create mode 100644 CMake/variants/variants.dop131
 create mode 100644 LCS/ACC/ALC/CMakeLists.txt
 create mode 100644 LCS/ACC/ALC/include/ALC/CMakeLists.txt
 create mode 100644 LCS/ACC/ALC/src/CMakeLists.txt
 create mode 100644 LCS/ACC/ALC/test/CMakeLists.txt
 rename LCS/Blob/test/{tBlobAipsIO_test.sh => tBlobAipsIO.sh} (100%)
 rename LCS/Blob/test/{tBlobArray_test.sh => tBlobArray.sh} (100%)
 create mode 100755 LCS/Blob/test/tBlobArrayHeader.sh
 rename LCS/Blob/test/{tBlobCasa_test.sh => tBlobCasa.sh} (100%)
 rename LCS/Blob/test/{tBlobField_test.sh => tBlobField.sh} (100%)
 rename LCS/Blob/test/{tBlobHeader_test.sh => tBlobHeader.sh} (100%)
 rename LCS/Blob/test/{tBlobSTL_test.sh => tBlobSTL.sh} (100%)
 rename LCS/Blob/test/{tBlobStream_test.sh => tBlobStream.sh} (100%)
 rename LCS/Blob/test/{tBlobString_test.sh => tBlobString.sh} (100%)
 rename LCS/Blob/test/{tKeyValueMap_test.sh => tKeyValueMap.sh} (100%)
 create mode 100644 LCS/Common/config.h.cmake
 create mode 100755 LCS/Common/test/tBacktrace.sh
 create mode 100644 LCS/Stream/test/CMakeLists.txt
 create mode 100644 LCS/Tools/CMakeLists.txt
 create mode 100644 LCS/Tools/config.h.cmake
 create mode 100644 LCS/Tools/lofar_config.h.cmake
 create mode 100644 LCS/Tools/src/CMakeLists.txt
 rename LCS/Tools/src/{lofarinit.csh => lofarinit.csh.in} (99%)
 rename LCS/Tools/src/{lofarinit.sh => lofarinit.sh.in} (99%)
 rename LCS/Transport/test/{Example_test.sh => Example.sh} (100%)
 rename LCS/Transport/test/{ExampleBlMem_test.sh => ExampleBlMem.sh} (100%)
 rename LCS/Transport/test/{ExampleEthernet_test.sh => ExampleEthernet.sh} (100%)
 rename LCS/Transport/test/{ExampleMPI_test.sh => ExampleMPI.sh} (100%)
 rename LCS/Transport/test/{ExampleMem_test.sh => ExampleMem.sh} (100%)
 rename LCS/Transport/test/{ExampleNonBlocking_test.sh => ExampleNonBlocking.sh} (100%)
 rename LCS/Transport/test/{ExampleShMem_test.sh => ExampleShMem.sh} (100%)
 rename LCS/Transport/test/{ExampleSocket_test.sh => ExampleSocket.sh} (100%)
 rename LCS/Transport/test/{ExampleVarBuf_test.sh => ExampleVarBuf.sh} (100%)
 rename LCS/Transport/test/{TestBidirectional_test.sh => TestBidirectional.sh} (100%)
 rename LCS/Transport/test/{tTH_Socket_test.sh => tTH_Socket.sh} (100%)
 create mode 100644 LCS/config.h.cmake
 create mode 100644 LCS/lofar_config.h.cmake
 create mode 100644 MAC/CMakeLists.txt
 create mode 100644 MAC/GCF/CMakeLists.txt
 create mode 100644 MAC/GCF/TM/CMakeLists.txt
 create mode 100644 MAC/GCF/TM/include/GCF/TM/CMakeLists.txt
 create mode 100644 MAC/GCF/TM/src/CMakeLists.txt
 create mode 100644 MAC/GCF/TM/test/CMakeLists.txt
 create mode 100644 MAC/MACIO/CMakeLists.txt
 create mode 100644 MAC/MACIO/include/MACIO/CMakeLists.txt
 create mode 100644 MAC/MACIO/src/CMakeLists.txt
 create mode 100644 MAC/MACIO/test/CMakeLists.txt
 create mode 100755 MAC/MACIO/test/tEventPort.sh
 create mode 100755 MAC/MACIO/test/tProtocol.sh
 create mode 100755 RTCP/Interface/test/tRSPTimeStamp.sh
 create mode 100755 RTCP/Interface/test/tSparseSet.sh
 create mode 100644 RTCP/RTCPTools/CMakeLists.txt
 create mode 100644 RTCP/RTCPTools/src/CMakeLists.txt
 create mode 100644 RTCP/Storage/test/CMakeLists.txt
 create mode 100755 RTCP/Storage/test/tAH_TestStorage.sh
 create mode 100644 SAS/CMakeLists.txt
 create mode 100644 SAS/OTB/CMakeLists.txt
 create mode 100644 SAS/OTB/jOTDB2/CMakeLists.txt
 create mode 100644 SAS/OTB/jOTDB2/include/jOTDB2/CMakeLists.txt
 create mode 100644 SAS/OTB/jOTDB2/src/CMakeLists.txt
 create mode 100644 SAS/OTDB/CMakeLists.txt
 create mode 100644 SAS/OTDB/include/OTDB/CMakeLists.txt
 create mode 100644 SAS/OTDB/src/CMakeLists.txt
 create mode 100644 SAS/OTDB/test/CMakeLists.txt
 rename SAS/OTDB/test/{tConnection_test.sh => tConnection.sh} (100%)
 delete mode 100755 SAS/OTDB/test/tConverter_test.sh
 rename SAS/OTDB/test/{tPICtree_test.sh => tPICtree.sh} (100%)
 rename SAS/OTDB/test/{tPICvalue_test.sh => tPICvalue.sh} (100%)
 rename SAS/OTDB/test/{tConverter.cc => tParamTypeConv.cc} (98%)
 rename SAS/OTDB/test/{tConverter.log_prop => tParamTypeConv.log_prop} (100%)
 create mode 100755 SAS/OTDB/test/tParamTypeConv.sh
 rename SAS/OTDB/test/{tVHtree_test.sh => tVHtree.sh} (100%)
 rename SAS/OTDB/test/{tVHvalue_test.sh => tVHvalue.sh} (100%)
 rename SAS/OTDB/test/{tVICcomp_test.sh => tVICcomp.sh} (100%)
 rename SAS/OTDB/test/{tVTtree_test.sh => tVTtree.sh} (100%)
 create mode 100755 autoconf_share/runctest.sh
 delete mode 100644 cmake/modules/CMakeASM-BGPInformation.cmake
 delete mode 100644 cmake/modules/CMakeDetermineASM-BGPCompiler.cmake
 delete mode 100644 cmake/modules/CMakeLists.txt
 delete mode 100644 cmake/modules/CMakeSettings.cmake
 delete mode 100644 cmake/modules/CMakeTestASM-BGPCompiler.cmake
 delete mode 100644 cmake/modules/FindBacktrace.cmake
 delete mode 100644 cmake/modules/FindBlitz.cmake
 delete mode 100644 cmake/modules/FindBoost.cmake
 delete mode 100644 cmake/modules/FindCASA.cmake
 delete mode 100644 cmake/modules/FindCASACORE.cmake
 delete mode 100644 cmake/modules/FindCFITSIO.cmake
 delete mode 100644 cmake/modules/FindCPGPLOT.cmake
 delete mode 100644 cmake/modules/FindDAL.cmake
 delete mode 100644 cmake/modules/FindFFTW3.cmake
 delete mode 100644 cmake/modules/FindG2C.cmake
 delete mode 100644 cmake/modules/FindGIF.cmake
 delete mode 100644 cmake/modules/FindGLIB.cmake
 delete mode 100644 cmake/modules/FindGSL.cmake
 delete mode 100644 cmake/modules/FindGTK.cmake
 delete mode 100644 cmake/modules/FindGlish.cmake
 delete mode 100644 cmake/modules/FindGlobus.cmake
 delete mode 100644 cmake/modules/FindHDF5.cmake
 delete mode 100644 cmake/modules/FindLAPACK.cmake
 delete mode 100644 cmake/modules/FindLibxml2.cmake
 delete mode 100644 cmake/modules/FindLog4CPlus.cmake
 delete mode 100644 cmake/modules/FindMPICC.cmake
 delete mode 100644 cmake/modules/FindMatlab.cmake
 delete mode 100644 cmake/modules/FindMySQL.cmake
 delete mode 100644 cmake/modules/FindNumarray.cmake
 delete mode 100644 cmake/modules/FindNumeric.cmake
 delete mode 100644 cmake/modules/FindPGPLOT.cmake
 delete mode 100644 cmake/modules/FindPLplot.cmake
 delete mode 100644 cmake/modules/FindPNG.cmake
 delete mode 100644 cmake/modules/FindPOPT.cmake
 delete mode 100644 cmake/modules/FindPostgreSQL.cmake
 delete mode 100644 cmake/modules/FindPyGTK.cmake
 delete mode 100644 cmake/modules/FindPython.cmake
 delete mode 100644 cmake/modules/FindROOT.cmake
 delete mode 100644 cmake/modules/FindRuby.cmake
 delete mode 100644 cmake/modules/FindSHMEM.cmake
 delete mode 100644 cmake/modules/FindSWIG.cmake
 delete mode 100644 cmake/modules/FindStarTools.cmake
 delete mode 100644 cmake/modules/FindTCL.cmake
 delete mode 100644 cmake/modules/FindTK.cmake
 delete mode 100644 cmake/modules/FindWCS.cmake
 delete mode 100644 cmake/modules/FindXaw.cmake
 delete mode 100644 cmake/modules/FindXm.cmake
 delete mode 100644 cmake/modules/InstallROOT.cmake
 delete mode 100644 cmake/modules/LofarGeneral.cmake
 delete mode 100644 cmake/modules/MakePackageVersion.cmake
 delete mode 100644 cmake/modules/Package__Version.cc.in
 delete mode 100644 cmake/modules/Package__Version.h.in
 delete mode 100644 cmake/modules/README.txt
 delete mode 100644 cmake/modules/SettingsPLplot.cmake
 delete mode 100644 cmake/modules/UpdateCASACORE.cmake
 delete mode 100644 cmake/modules/changes.txt
 delete mode 100644 cmake/modules/makefile
 delete mode 100644 cmake/modules/template_FindXX.cmake
 delete mode 100644 cmake/variants/variants
 delete mode 100644 cmake/variants/variants.bgfen0
 delete mode 100644 cmake/variants/variants.liifen

diff --git a/.gitattributes b/.gitattributes
index 1d3a7d7e7ec..94b222fd308 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -118,13 +118,6 @@ CEP/DP3/DPPP/src/RunDetails.cc -text
 CEP/DP3/DPPP/test/CS1_IDPPP.log_prop -text
 CEP/DP3/DPPP/test/CS1_IDPPP.parset -text
 CEP/DP3/DPPP/test/Makefile.am -text
-CEP/Imager/MWCommon/bootstrap -text
-CEP/Imager/MWCommon/src/socketrun -text
-CEP/Imager/MWCommon/src/startdistproc -text
-CEP/Imager/MWCommon/test/tfinddproc.in_cd -text
-CEP/Imager/MWCommon/test/tfinddproc.in_vd -text
-CEP/Imager/MWCommon/test/tstartdproc.in_cd -text
-CEP/Imager/MWCommon/test/tstartdproc.in_vd -text
 CEP/Imager/MWControl/bootstrap -text
 CEP/Imager/MWControl/test/tMWControl.in_mpi_out3 -text
 CEP/Imager/MWControl/test/tMWControl.in_mpi_out4 -text
@@ -142,6 +135,13 @@ CEP/MS/src/makemsdistr-part -text
 CEP/MS/test/tcombinevds.in_vds1 -text
 CEP/MS/test/tcombinevds.in_vds2 -text
 CEP/MS/test/tmakems.in_antenna.tgz -text svneol=unset#application/x-compressed-tar
+CEP/MWCommon/bootstrap -text
+CEP/MWCommon/src/socketrun -text
+CEP/MWCommon/src/startdistproc -text
+CEP/MWCommon/test/tfinddproc.in_cd -text
+CEP/MWCommon/test/tfinddproc.in_vd -text
+CEP/MWCommon/test/tstartdproc.in_cd -text
+CEP/MWCommon/test/tstartdproc.in_vd -text
 CEP/ParmDB/src/parmdbremote-scr -text
 CEP/ParmDB/src/setupparmdb -text
 CEP/ParmDB/src/setupparmdb-part -text
@@ -162,7 +162,8 @@ CEP/ParmDB/test/tsetupsourcedb.in_ms2.vds -text
 CEP/Pipeline/bootstrap -text
 CEP/Pipeline/library/lioff.clusterdesc -text
 CEP/Pipeline/library/makevds.bash -text
-/CMakeLists.txt -text
+CMake/makeversion -text
+CMake/variants/variants.bgfen0 -text
 Firmware/images/ap3b_v5_3.hex -text
 Firmware/images/bp3b_v5_5.hex -text
 Firmware/images/mp7_4.hex -text
@@ -259,7 +260,6 @@ JAVA/LofarUtils/src/com/toedter/components/images/JSpinFieldMono16.gif -text
 JAVA/LofarUtils/src/com/toedter/components/images/JSpinFieldMono32.gif -text
 JAVA/MAC/jRSP/.cvsignore -text
 JAVA/MAC/jRSP/nbproject/.cvsignore -text
-LCS/ACC/CMakeLists.txt -text
 LCS/ACC/PLC/lofar_config.h.cmake -text
 LCS/AMC/AMCBase/lofar_config.h.cmake -text
 LCS/AMC/AMCImpl/lofar_config.h.cmake -text
@@ -274,24 +274,20 @@ LCS/ApplCommon/test/tObservation.in_conflict3 -text
 LCS/ApplCommon/test/tObservation.in_conflict4 -text
 LCS/ApplCommon/test/tObservation.in_conflict5 -text
 LCS/ApplCommon/test/tObservation.in_parset1 -text
-LCS/Blob/CMakeLists.txt -text
 LCS/Blob/lofar_config.h.cmake -text
-LCS/Blob/src/CMakeLists.txt -text
-LCS/Blob/test/CMakeLists.txt -text
 LCS/Blob/test/tBlobField.in_be -text svneol=unset#unset
 LCS/Blob/test/tBlobField.in_le -text svneol=unset#unset
 LCS/Blob/test/tBlobStream.in_be -text svneol=unset#unset
 LCS/Blob/test/tBlobStream.in_le -text svneol=unset#unset
 LCS/CMakeLists.txt -text
-LCS/Common/CMakeLists.txt -text
-LCS/Common/include/Common/CMakeLists.txt -text
+LCS/Common/config.h.cmake -text
 LCS/Common/lofar_config.h.cmake -text
-LCS/Common/src/CMakeLists.txt -text
 LCS/Common/src/Common-Model.cat -text
-LCS/Common/test/CMakeLists.txt -text
 LCS/LACE/bootstrap -text
 LCS/Stream/bootstrap -text
 LCS/Stream/lofar_config.h.cmake -text
+LCS/Tools/config.h.cmake -text
+LCS/Tools/lofar_config.h.cmake -text
 LCS/Tools/src/countalllines -text
 LCS/Tools/src/countlines -text
 LCS/Tools/src/countpurecode -text
@@ -300,6 +296,8 @@ LCS/Tools/src/fillreview -text
 LCS/Tools/src/makecov -text
 LCS/Tools/src/processgcov -text
 LCS/Transport/lofar_config.h.cmake -text
+LCS/config.h.cmake -text
+LCS/lofar_config.h.cmake -text
 LCS/pyparameterset/bootstrap -text
 LCS/pytools/bootstrap -text
 MAC/APL/APLCommon/Makefile.am -text svneol=native#application/octet-stream
@@ -1430,64 +1428,6 @@ autoconf_share/variants.bgfen0 -text
 autoconf_share/variants.frontend-4 -text
 autoconf_share/variants.kis001 -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/makefile -text
-cmake/modules/template_FindXX.cmake -text
-cmake/variants/variants -text
-cmake/variants/variants.bgfen0 -text
-cmake/variants/variants.liifen -text
 /config.h.cmake -text
 doc/UML/CPA-Packages-Model.mdl -text
 doc/papers/2008/IEEE-SIG/LBA_calibrated.png -text
diff --git a/.gitignore b/.gitignore
index a2c712a4a19..79dac15d559 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,9 +10,6 @@ CEP/DP3/DPPP/lofarconf
 CEP/DP3/SPWCombine/Makefile.common
 CEP/DP3/SPWCombine/autoconf_share
 CEP/DP3/SPWCombine/lofarconf
-CEP/Imager/MWCommon/Makefile.common
-CEP/Imager/MWCommon/autoconf_share
-CEP/Imager/MWCommon/lofarconf
 CEP/Imager/MWControl/Makefile.common
 CEP/Imager/MWControl/autoconf_share
 CEP/Imager/MWControl/lofarconf
@@ -22,6 +19,9 @@ CEP/Imager/MWImager/lofarconf
 CEP/MS/Makefile.common
 CEP/MS/autoconf_share
 CEP/MS/lofarconf
+CEP/MWCommon/Makefile.common
+CEP/MWCommon/autoconf_share
+CEP/MWCommon/lofarconf
 CEP/ParmDB/Makefile.common
 CEP/ParmDB/autoconf_share
 CEP/ParmDB/lofarconf
diff --git a/CEP/CMakeLists.txt b/CEP/CMakeLists.txt
index 05c1c3842b0..5f71d54b6ff 100644
--- a/CEP/CMakeLists.txt
+++ b/CEP/CMakeLists.txt
@@ -1,103 +1,49 @@
-
-## ------------------------------------------------------------------------------
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
 ## Project characteristics
-
-project (CEP)
-
-cmake_minimum_required (VERSION 2.5)
-
-##-------------------------------------------------------------------------------
-## Options
-
-option (CEP_BUILD_TESTS "Build test programs?" FALSE)
-
-## ------------------------------------------------------------------------------
-## Set CMAKE_MODULE_PATH to load custom CMake modules
-
-if (NOT USG_ROOT)
-find_path (USG_ROOT cmake/CMakeSettings.cmake
-  PATHS 
-  ${CEP_SOURCE_DIR}
-  ${CEP_SOURCE_DIR}/..
-  ${CEP_SOURCE_DIR}/../..
-  ${CEP_SOURCE_DIR}/../../..
-  $ENV{LOFARSOFT}
-  )
-
-if (USG_ROOT)
-  include (${USG_ROOT}/cmake/CMakeSettings.cmake)
-else (USG_ROOT)
-  message (FATAL_ERROR "Unable to locate additional CMake scripts!")
-endif (USG_ROOT)
-endif (NOT USG_ROOT)
-
-## ------------------------------------------------------------------------------
-## Commonly used configuration files
-
-set (CEP_config ${CEP_BINARY_DIR}/lofar_config.h)
-
-file (WRITE ${CEP_config} "/* lofar_config.h --  Generated by CMake. */\n\n")
-
-include_directories (${CEP_BINARY_DIR})
-
-## ------------------------------------------------------------------------------
-## Additional CMake modules
-
-include (CheckIncludeFiles)
-include (CheckLibraryExists)
-include (CheckTypeSize)
-include (CTest)
-enable_testing()
-
-## Custom modules
-
-#include (MakePackageVersion)
-
-## ------------------------------------------------------------------------------
-## 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)
-
-## ------------------------------------------------------------------------------
-## Module header files
-
-include_directories (
-  ${CEP_SOURCE_DIR}/CEPFrame/src
-  ${CEP_SOURCE_DIR}/tinyCEP/include
-  )
-
-## ------------------------------------------------------------------------------
-## Directories to be included in the build
-
-add_subdirectory (CEPFrame)
-add_subdirectory (tinyCEP)
+## ---------------------------------------------------------------------------
+project(CEP)
+include(LofarGeneral)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(MWCommon)
+add_subdirectory(MS)
+add_subdirectory(ParmDB)
+add_subdirectory(Calibration)
+add_subdirectory(DP3)
+add_subdirectory(Imager)
+#add_subdirectory(Pipeline)
+#add_subdirectory(pyparmdb)
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
diff --git a/CEP/Calibration/BBSControl/CMakeLists.txt b/CEP/Calibration/BBSControl/CMakeLists.txt
new file mode 100644
index 00000000000..ec8477195bc
--- /dev/null
+++ b/CEP/Calibration/BBSControl/CMakeLists.txt
@@ -0,0 +1,56 @@
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
+## Project characteristics
+## ---------------------------------------------------------------------------
+project(BBSControl)
+include(LofarGeneral)
+
+include(LofarAddPackage)
+# Do not split the following line, otherwise makeversion will fail!
+lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS BBSKernel Blob Common ParmDB PLC Transport)
+
+## ---------------------------------------------------------------------------
+## External packages
+## ---------------------------------------------------------------------------
+include(LofarFindPackage)
+lofar_find_package(Boost REQUIRED)
+lofar_find_package(Casacore REQUIRED COMPONENTS casa)
+lofar_find_package(PQXX REQUIRED)
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(include/BBSControl)
+add_subdirectory(src)
+add_subdirectory(test)
diff --git a/CEP/Calibration/BBSControl/include/BBSControl/CMakeLists.txt b/CEP/Calibration/BBSControl/include/BBSControl/CMakeLists.txt
new file mode 100644
index 00000000000..1f5ff72f5d5
--- /dev/null
+++ b/CEP/Calibration/BBSControl/include/BBSControl/CMakeLists.txt
@@ -0,0 +1,65 @@
+#  $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
+
+# List of header files that will be installed.
+set(inst_HEADERS
+  Package__Version.h
+  BlobStreamableConnection.h
+  BlobStreamableVector.h
+  Command.h
+  CommandExecutor.h
+  CommandQueue.h
+  CommandResult.h
+  CommandVisitor.h
+  CorrectStep.h
+  Exceptions.h
+  FinalizeCommand.h
+  GlobalProcessControl.h
+  GlobalSolveController.h
+  InitializeCommand.h
+  KernelProcessControl.h
+  LocalSolveController.h
+  Messages.h
+  MessageHandlers.h
+  MultiStep.h
+  NextChunkCommand.h
+  NoiseStep.h
+  PredictStep.h
+  RecoverCommand.h
+  RefitStep.h
+  SenderId.h
+  ShiftStep.h
+  SingleStep.h
+  SolverProcessControl.h
+  SolveStep.h
+  SolveTask.h
+  Step.h
+  Strategy.h
+  SubtractStep.h
+  SynchronizeCommand.h
+  Types.h)
+
+# Create symbolic link to include directory.
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink 
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_BINARY_DIR}/include/${PROJECT_NAME})
+
+# Install header files.
+install(FILES ${inst_HEADERS} DESTINATION include/${PROJECT_NAME})
diff --git a/CEP/Calibration/BBSControl/src/CMakeLists.txt b/CEP/Calibration/BBSControl/src/CMakeLists.txt
new file mode 100644
index 00000000000..925a9d8a83b
--- /dev/null
+++ b/CEP/Calibration/BBSControl/src/CMakeLists.txt
@@ -0,0 +1,69 @@
+#  $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
+
+include(LofarPackageVersion)
+
+set(bbscontrol_LIB_SRCS
+  Package__Version.cc
+  BlobStreamableConnection.cc
+  Command.cc
+  CommandExecutor.cc
+  CommandQueue.cc
+  CommandResult.cc
+  CorrectStep.cc
+  FinalizeCommand.cc
+  GlobalProcessControl.cc
+  GlobalSolveController.cc
+  InitializeCommand.cc
+  KernelConnection.cc
+  KernelProcessControl.cc
+  LocalSolveController.cc
+  Messages.cc
+  MultiStep.cc
+  NextChunkCommand.cc
+  NoiseStep.cc
+  PredictStep.cc
+  QueryBuilder/AddCommand.cc
+  RecoverCommand.cc
+  RefitStep.cc
+  SenderId.cc
+  ShiftStep.cc
+  SingleStep.cc
+  SolverProcessControl.cc
+  SolveStep.cc
+  SolveTask.cc
+  Step.cc
+  Strategy.cc
+  StreamUtil.cc
+  SubtractStep.cc
+  SynchronizeCommand.cc
+  Types.cc)
+
+set(bbscontrol_PROGRAMS
+  versionbbscontrol
+  GlobalControl
+  KernelControl
+  SolverControl)
+
+lofar_add_library(bbscontrol ${bbscontrol_LIB_SRCS})
+
+foreach(prog ${bbscontrol_PROGRAMS})
+  lofar_add_executable(${prog} ${prog}.cc)
+endforeach(prog ${bbscontrol_PROGRAMS})
diff --git a/CEP/Calibration/BBSControl/test/CMakeLists.txt b/CEP/Calibration/BBSControl/test/CMakeLists.txt
new file mode 100644
index 00000000000..8453f995ce8
--- /dev/null
+++ b/CEP/Calibration/BBSControl/test/CMakeLists.txt
@@ -0,0 +1,24 @@
+#  $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
+
+include(LofarCTest)
+
+lofar_add_test(tStrategy tStrategy.cc)
+lofar_add_test(tCommandQueue tCommandQueue.cc)
diff --git a/CEP/Calibration/BBSKernel/CMakeLists.txt b/CEP/Calibration/BBSKernel/CMakeLists.txt
new file mode 100644
index 00000000000..d35408ba32c
--- /dev/null
+++ b/CEP/Calibration/BBSKernel/CMakeLists.txt
@@ -0,0 +1,54 @@
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
+## Project characteristics
+## ---------------------------------------------------------------------------
+project(BBSKernel)
+include(LofarGeneral)
+
+include(LofarAddPackage)
+lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS Blob Common MS ParmDB)
+
+## ---------------------------------------------------------------------------
+## External packages
+## ---------------------------------------------------------------------------
+include(LofarFindPackage)
+lofar_find_package(Boost REQUIRED)
+lofar_find_package(Casacore COMPONENTS casa measures ms scimath tables REQUIRED)
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(include/BBSKernel)
+add_subdirectory(src)
+add_subdirectory(test)
diff --git a/CEP/Calibration/BBSKernel/include/BBSKernel/CMakeLists.txt b/CEP/Calibration/BBSKernel/include/BBSKernel/CMakeLists.txt
new file mode 100644
index 00000000000..7bde594d55e
--- /dev/null
+++ b/CEP/Calibration/BBSKernel/include/BBSKernel/CMakeLists.txt
@@ -0,0 +1,91 @@
+#  $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
+
+# List of header files that will be installed.
+set(inst_HEADERS
+  Package__Version.h
+  BlobIOExtensions.h
+  Evaluator.h
+  Equator.h
+  Exceptions.h
+  Instrument.h
+  Measurement.h
+  MeasurementAIPS.h
+  MetaMeasurement.h
+  Model.h
+  ModelConfig.h
+  ParmManager.h
+  ParmProxy.h
+  Solver.h
+  SolverInterfaceTypes.h
+  Types.h
+  VisData.h
+  VisDimensions.h
+  VisSelection.h
+  Expr/AzEl.h
+  Expr/Diag.h
+  Expr/DFTPS.h
+  Expr/Expr.h
+  Expr/ExprParm.h
+  Expr/ExternalFunction.h
+  Expr/GaussianCoherence.h
+  Expr/GaussianSource.h
+  Expr/HamakerDipole.h
+  Expr/JonesCMul2.h
+  Expr/JonesCMul3.h
+  Expr/JonesExpr.h
+  Expr/JonesInvert.h
+  Expr/JonesMul.h
+  Expr/JonesMul2.h
+  Expr/JonesMul3.h
+  Expr/JonesNode.h
+  Expr/JonesResult.h
+  Expr/JonesSum.h
+  Expr/JonesVisData.h
+  Expr/LMN.h
+  Expr/Matrix.h
+  Expr/MatrixComplexArr.h
+  Expr/MatrixComplexSca.h
+  Expr/MatrixRealArr.h
+  Expr/MatrixRealSca.h
+  Expr/MatrixRep.h
+  Expr/MatrixTmp.h
+  Expr/MIM.h
+  Expr/PhaseRef.h
+  Expr/PhaseShift.h
+  Expr/PiercePoint.h
+  Expr/PointCoherence.h
+  Expr/PointSource.h
+  Expr/PValueIterator.h
+  Expr/Request.h
+  Expr/Result.h
+  Expr/ResultVec.h
+  Expr/Pool.h
+  Expr/Source.h
+  Expr/StatUVW.h
+  Expr/YatawattaDipole.h)
+
+# Create symbolic link to include directory.
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink 
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_BINARY_DIR}/include/${PROJECT_NAME})
+
+# Install header files.
+install(FILES ${inst_HEADERS} DESTINATION include/${PROJECT_NAME})
diff --git a/CEP/Calibration/BBSKernel/src/CMakeLists.txt b/CEP/Calibration/BBSKernel/src/CMakeLists.txt
new file mode 100644
index 00000000000..cd20c434a0c
--- /dev/null
+++ b/CEP/Calibration/BBSKernel/src/CMakeLists.txt
@@ -0,0 +1,88 @@
+#  $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
+
+include(LofarPackageVersion)
+
+set(bbskernel_LIB_SRCS
+  Package__Version.cc
+  BlobIOExtensions.cc
+  Evaluator.cc
+  Equator.cc
+  Instrument.cc
+  MeasurementAIPS.cc
+  MetaMeasurement.cc
+  Model.cc
+  ModelConfig.cc
+  ParmManager.cc
+  ParmProxy.cc
+  Solver.cc
+  SolverInterfaceTypes.cc
+  VisData.cc
+  VisDimensions.cc
+  VisSelection.cc
+  Expr/AzEl.cc
+  Expr/Diag.cc
+  Expr/DFTPS.cc
+  Expr/Expr.cc
+  Expr/ExprParm.cc
+  Expr/ExternalFunction.cc
+  Expr/GaussianCoherence.cc
+  Expr/GaussianSource.cc
+  Expr/HamakerDipole.cc
+  Expr/JonesCMul2.cc
+  Expr/JonesCMul3.cc
+  Expr/JonesExpr.cc
+  Expr/JonesInvert.cc
+  Expr/JonesMul.cc
+  Expr/JonesMul2.cc
+  Expr/JonesMul3.cc
+  Expr/JonesNode.cc
+  Expr/JonesSum.cc
+  Expr/JonesVisData.cc
+  Expr/LMN.cc
+  Expr/Matrix.cc
+  Expr/MatrixComplexArr.cc
+  Expr/MatrixComplexSca.cc
+  Expr/MatrixRealArr.cc
+  Expr/MatrixRealSca.cc
+  Expr/MatrixRep.cc
+  Expr/MatrixTmp.cc
+  Expr/MIM.cc
+  Expr/PhaseRef.cc
+  Expr/PhaseShift.cc
+  Expr/PiercePoint.cc
+  Expr/PointCoherence.cc
+  Expr/PointSource.cc
+  Expr/Request.cc
+  Expr/Result.cc
+  Expr/ResultVec.cc
+  Expr/Source.cc
+  Expr/StatUVW.cc
+  Expr/YatawattaDipole.cc)
+
+set(bbskernel_PROGRAMS
+  versionbbskernel
+  metams)
+
+lofar_add_library(bbskernel ${bbskernel_LIB_SRCS})
+
+foreach(prog ${bbskernel_PROGRAMS})
+  lofar_add_executable(${prog} ${prog}.cc)
+endforeach(prog ${bbskernel_PROGRAMS})
diff --git a/CEP/Calibration/BBSKernel/test/CMakeLists.txt b/CEP/Calibration/BBSKernel/test/CMakeLists.txt
new file mode 100644
index 00000000000..1a1e46ab9ce
--- /dev/null
+++ b/CEP/Calibration/BBSKernel/test/CMakeLists.txt
@@ -0,0 +1,24 @@
+#  $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
+
+include(LofarCTest)
+
+lofar_add_test(tFillRow tFillRow.cc)
+lofar_add_test(tJonesCMul3 tJonesCMul3.cc utils.cc)
diff --git a/CEP/Calibration/CMakeLists.txt b/CEP/Calibration/CMakeLists.txt
new file mode 100644
index 00000000000..99010fd7c6e
--- /dev/null
+++ b/CEP/Calibration/CMakeLists.txt
@@ -0,0 +1,43 @@
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
+## Project characteristics
+## ---------------------------------------------------------------------------
+project(Calibration)
+include(LofarGeneral)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(BBSKernel)
+add_subdirectory(BBSControl)
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
diff --git a/CEP/DP3/CMakeLists.txt b/CEP/DP3/CMakeLists.txt
new file mode 100644
index 00000000000..af763783f15
--- /dev/null
+++ b/CEP/DP3/CMakeLists.txt
@@ -0,0 +1,43 @@
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
+## Project characteristics
+## ---------------------------------------------------------------------------
+project(DP3)
+include(LofarGeneral)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(DPPP)
+add_subdirectory(SPWCombine)
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
diff --git a/CEP/DP3/DPPP/CMakeLists.txt b/CEP/DP3/DPPP/CMakeLists.txt
new file mode 100644
index 00000000000..139152666d2
--- /dev/null
+++ b/CEP/DP3/DPPP/CMakeLists.txt
@@ -0,0 +1,53 @@
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
+## Project characteristics
+## ---------------------------------------------------------------------------
+project(DPPP)
+include(LofarGeneral)
+
+include(LofarAddPackage)
+lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS Common PLC)
+
+## ---------------------------------------------------------------------------
+## External packages
+## ---------------------------------------------------------------------------
+include(LofarFindPackage)
+lofar_find_package(Casacore COMPONENTS casa ms tables REQUIRED)
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(include/CS1_pp_lib)
+add_subdirectory(src)
+add_subdirectory(test)
diff --git a/CEP/DP3/DPPP/src/CMakeLists.txt b/CEP/DP3/DPPP/src/CMakeLists.txt
new file mode 100644
index 00000000000..db0c07903cd
--- /dev/null
+++ b/CEP/DP3/DPPP/src/CMakeLists.txt
@@ -0,0 +1,46 @@
+#  $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
+
+include(LofarPackageVersion)
+
+set(dppp_LIB_SRCS
+  Package__Version.cc
+  FlaggerStatistics.cc
+  MsInfo.cc
+  MsFile.cc
+  ComplexMedianFlagger.cc
+  FrequencyFlagger.cc
+  ComplexMedianFlagger2.cc
+  MADFlagger.cc
+  BandpassCorrector.cc
+  DataSquasher.cc
+  DataBuffer.cc
+  RunDetails.cc
+  Pipeline.cc)
+
+set(dppp_PROGRAMS
+  versioncs1_pp_lib
+  CS1_IDPPP
+)
+
+lofar_add_library(dppp ${dppp_LIB_SRCS})
+
+lofar_add_executable(CS1_IDPPP IDPPP.cc PipelineProcessControl.cc)
+lofar_add_executable(versioncs1_pp_lib versiondppp.cc)
diff --git a/CEP/DP3/DPPP/test/CMakeLists.txt b/CEP/DP3/DPPP/test/CMakeLists.txt
new file mode 100644
index 00000000000..81f6a38bc32
--- /dev/null
+++ b/CEP/DP3/DPPP/test/CMakeLists.txt
@@ -0,0 +1,23 @@
+#  $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
+
+include(LofarCTest)
+
+lofar_add_test(test_flaggers test_flaggers.cc)
diff --git a/CEP/Imager/CMakeLists.txt b/CEP/Imager/CMakeLists.txt
new file mode 100644
index 00000000000..1e18ab2781a
--- /dev/null
+++ b/CEP/Imager/CMakeLists.txt
@@ -0,0 +1,43 @@
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
+## Project characteristics
+## ---------------------------------------------------------------------------
+project(Imager)
+include(LofarGeneral)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(MWControl)
+#add_subdirectory(MWImager)
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
diff --git a/CEP/Imager/MWCommon/src/finddproc.cc b/CEP/Imager/MWCommon/src/finddproc.cc
deleted file mode 100644
index c51225a2173..00000000000
--- a/CEP/Imager/MWCommon/src/finddproc.cc
+++ /dev/null
@@ -1,154 +0,0 @@
-//# finddproc.cc: Create machinefile based on 
-//#
-//# Copyright (C) 2006
-//# 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
-//#
-//# $Id$
-
-#include <lofar_config.h>
-#include <MWCommon/VdsDesc.h>
-#include <MWCommon/ClusterDesc.h>
-#include <MWCommon/WorkersDesc.h>
-#include <MWCommon/MWError.h>
-#include <Common/StringUtil.h>
-#include <Common/LofarLogger.h>
-#include <iostream>
-
-using namespace LOFAR::CEP;
-using namespace LOFAR;
-using namespace std;
-
-
-void makeFile (const vector<string>& fileSys, const vector<string>& fileNames,
-               const vector<string>& names, const ClusterDesc& cluster)
-{
-  WorkersDesc workers(cluster);
-  // Make a worker for each node in the cluster.
-  // Create a fake work type for them.
-  const int workType=0;
-  vector<int> workTypes(1, workType);
-  const vector<NodeDesc>& nodes = cluster.getNodes();
-  for (unsigned i=0; i<nodes.size(); ++i) {
-    workers.addWorker (i, nodes[i].getName(), workTypes);
-  }
-  // Loop through fileSys.
-  for (uint i=0; i<fileSys.size(); ++i) {
-    // Find a worker that can deal with the file system the dataset part is on.
-    int winx = workers.findWorker (workType, fileSys[i]);
-    if (winx < 0) {
-      THROW (MWError, "finddproc: no suitable host could be found" <<
-	     " for dataset part " << names[i] <<
-	     " on file system " << fileSys[i]);
-    }
-    cout << nodes[winx].getName() << '#' << fileNames[i] << ','
-         << fileSys[i] << ',' << names[i] << endl;
-    // Increment the load to indicate it is already in use. In that way it
-    // will only be used again if all other possible nodes are used as well.
-    workers.incrLoad (winx);
-  }
-}
-
-void makeFromFile (const string& vdsName, const string& clusterName)
-{
-  // Read in the vds and cluster desc.
-  VdsDesc vds(vdsName);
-  ClusterDesc cluster(clusterName);
-  // Loop through all parts of the dataset.
-  const vector<VdsPartDesc>& parts = vds.getParts();
-  vector<string> fileSys, fileNames, names;
-  fileSys.reserve (parts.size());
-  fileNames.reserve (parts.size());
-  names.reserve (parts.size());
-  for (vector<VdsPartDesc>::const_iterator iter = parts.begin();
-       iter != parts.end();
-       ++iter) {
-    fileSys.push_back (iter->getFileSys());
-    fileNames.push_back (iter->getFileName());
-    names.push_back (iter->getName());
-  }
-  // Create the machinefile.
-  makeFile (fileSys, fileNames, names, cluster);
-}
-
-void makeFromDirs (const string& dirStr, const string& clusterName)
-{
-  // Read in the cluster desc.
-  ClusterDesc cluster(clusterName);
-  const vector<NodeDesc>& nodes = cluster.getNodes();
-  // Split string.
-  vector<string> dirs = StringUtil::split(dirStr, ',');
-  // Create a list of FileSys from the dirs.
-  vector<string> fileSys, fileNames;
-  fileSys.reserve (dirs.size());
-  fileNames.reserve (dirs.size());
-  for (uint i=0; i<dirs.size(); ++i) {
-    string nodeName;
-    string mountName(dirs[i]);
-    string::size_type colon = dirs[i].find(':');
-    if (colon != string::npos) {
-      nodeName  = dirs[i].substr (0, colon);
-      mountName = dirs[i].substr (colon+1);
-    }
-    // Find the mountpoint by looping over all nodes.
-    // If a node name is given, only that one is considered.
-    // Add a dummy file name to the mountName for findFileSys.
-    for (uint j=0; j<nodes.size(); ++j) {
-      if (nodeName.empty()  ||  nodeName == nodes[j].getName()) {
-        fileSys.push_back (nodes[j].findFileSys (mountName+"/xx"));
-        break;
-      }
-    }
-    fileNames.push_back (mountName);
-  }
-  makeFile (fileSys, fileNames, fileNames, cluster);
-}
-
-int main (int argc, const char* argv[])
-{
-  try {
-    int st = 3;
-    if (argc > 1  &&  string(argv[1]) == "-dirs") {
-      st = 4;
-    }
-    if (argc < st) {
-      cerr << "Run as:  finddproc vdsdescname clusterdescname [otherhosts]"
-	   << endl;
-      cerr << "    or   finddproc -dirs directories clusterdescname [otherhosts]"
-           << endl;
-      cerr << "             directories is a single argument separated by commas" << endl;
-      cerr << "   The other hosts are listed first in the resulting machinefile"
-           << endl;
-      cout << "   (represent master and e.g. solvers)" << endl;
-      return 1;
-    }
-
-    // First list the other hosts (master and extra).
-    for (int i=st; i<argc; ++i) {
-      cout << argv[i] << endl;
-    }
-    if (st == 3) {
-      makeFromFile (argv[1], argv[2]);
-    } else {
-      makeFromDirs (argv[2], argv[3]);
-    }
-  } catch (std::exception& x) {
-    cerr << "Unexpected exception: " << x.what() << endl;
-    return 1;
-  }
-  return 0;
-}
diff --git a/CEP/Imager/MWCommon/src/socketrun b/CEP/Imager/MWCommon/src/socketrun
deleted file mode 100755
index cf43abe4d9a..00000000000
--- a/CEP/Imager/MWCommon/src/socketrun
+++ /dev/null
@@ -1,115 +0,0 @@
-#!/bin/sh
-
-# socketrun.cc: Start a distributed process using socket connections
-#
-# @copyright (c) 2008 ASKAP, All Rights Reserved.
-# @author Ger van Diepen <diepen AT astron nl>
-#
-# $Id$
-
-
-# This script starts a distributed process to process a dataset.
-# The processes will use sockets for communication.
-# The processed are started in the MPI-style; a machinefile tells on which
-# hosts to start a process; they also get a rank (0..n).
-#
-# This script is a helper script for startdistproc, but it could be used
-# stand-alone as well.
-#
-# run as: socketrun dry hfn masterhost port wait logfile program [arg1 arg2 ...]
-#
-#   dry!=0      means that the command is only printed, not executed.
-#   hfn         is the name of an MPI-style machinefile. Each line in it
-#               looks like:  host#part,filesys,partvds
-#                host     name of the host to start a process on
-#                part     name of the dataset part to process on the host
-#                filesys  the file system the dataset part is on
-#                partvds  name of the VDS-file of the dataset part
-#   masterhost  the host the master process is running on; if empty, the first
-#               host in the machine file is the master host.
-#   port        the port the master host process is using and where the workers
-#               can connect to.
-#               Note that it is up to implementation to use a masterhost/port.
-#               E.g. mwimager only starts distributed processes, but they do
-#               not communicate, so there is no master.
-#   wait=1      means that socketrun waits for all processes to end.
-#   logfile     name of the log file to use; It will be suffixed with '-rank'
-#               where rank is the process rank.
-#   program     name of the program to start.
-#   arg-i       extra arguments directly passed to the program started.
-#
-# The processes are started with the following fixed arguments:
-#   socket      a string with the value 'socket'.
-#   masterhost  name of the master host
-#   port        port on master host
-#   np          number of processes started
-#   rank        process rank (0..np-1)
-#   part        name of dataset part to process
-#   filesys     file system dataset part is on
-#   partvds     name of VDS-file describing dataset part
-# Thereafter the variable arguments (passed to socketrun) are given.
-
-
-dry=$1
-shift
-hfn=$1
-shift
-masterhost=$1
-shift
-port=$1
-shift
-wait=$1
-shift
-logfile=$1
-shift
-program=$1
-shift
-
-np=`wc -l $hfn | awk '{print $1}'`
-
-# The first host is the master one.
-pidlist=
-rank=0
-for inline in `cat $hfn`
-do
-  host=`echo $inline | awk -F'#' '{print $1'}`
-  rest=`echo $inline | awk -F'#' '{print $2'}`
-  part=`echo $rest | awk -F',' '{print $1'}`
-  fsys=`echo $rest | awk -F',' '{print $2'}`
-  partvds=`echo $rest | awk -F',' '{print $3'}`
-  if test "$part" = ""; then
-    part=.
-  fi
-  if test "$fsys" = ""; then
-    fsys=.
-  fi
-  if test "$partvds" = ""; then
-    partvds=.
-  fi
-  if test "$masterhost" = ""; then
-    masterhost=$host
-  fi
-  echo "ssh -x -n $host $program socket $masterhost $port $np $rank $part $fsys $partvds " "$@" " &"
-  if test $dry = 0; then
-    if test "$logfile" = ""; then
-      ssh -x -n $host $program socket $masterhost $port $np $rank $part $fsys $partvds "$@" &
-    else
-      ssh -x -n $host $program socket $masterhost $port $np $rank $part $fsys $partvds "$@" > $logfile-$rank 2>&1 &
-    fi
-    pidlist="$pidlist $!"
-  fi
-  rank=`expr $rank + 1`
-done
-
-# If needed, wait for the processes to end.
-status=0
-if test "$wait" = 1; then
-  for pid in $pidlist
-  do
-    if ! wait $pid; then
-      status=1
-    fi
-  done
-fi
-
-exit $status
diff --git a/CEP/Imager/MWCommon/test/tfinddproc.stdout b/CEP/Imager/MWCommon/test/tfinddproc.stdout
deleted file mode 100644
index dfe62a6d0a8..00000000000
--- a/CEP/Imager/MWCommon/test/tfinddproc.stdout
+++ /dev/null
@@ -1,3 +0,0 @@
-node1#/usr/local/xyx0,node1:/usr,/usr/local/xyx0.vds
-node2#/usr/local/xyx1,node1:/usr,/usr/local/xyx1.vds
-node1#/usr/local/xyx2,node1:/usr,/usr/local/xyx2.vds
diff --git a/CEP/Imager/MWCommon/test/tstartdproc.stdout b/CEP/Imager/MWCommon/test/tstartdproc.stdout
deleted file mode 100644
index c76ca8e8013..00000000000
--- a/CEP/Imager/MWCommon/test/tstartdproc.stdout
+++ /dev/null
@@ -1,22 +0,0 @@
-
-prog1 -arg a b
-localhost
-node1#/usr/local/xyx0,node1:/usr,/usr/local/xyx0.vds
-node2#/usr/local/xyx1,node1:/usr,/usr/local/xyx1.vds
-node1#/usr/local/xyx2,node1:/usr,/usr/local/xyx2.vds
-
-mpirun -np 4 -machinefile tstartdproc_tmp.out2 prog1 -arg a b
-localhost
-node1
-node2
-node1
-
-socketrun 1 tstartdproc_tmp.out3 'localhost' 3851 1  prog1 -arg a b
-ssh -x -n localhost prog1 socket localhost 3851 4 0 . . .  -arg a b  &
-ssh -x -n node1 prog1 socket localhost 3851 4 1 /usr/local/xyx0 node1:/usr /usr/local/xyx0.vds  -arg a b  &
-ssh -x -n node2 prog1 socket localhost 3851 4 2 /usr/local/xyx1 node1:/usr /usr/local/xyx1.vds  -arg a b  &
-ssh -x -n node1 prog1 socket localhost 3851 4 3 /usr/local/xyx2 node1:/usr /usr/local/xyx2.vds  -arg a b  &
-localhost
-node1#/usr/local/xyx0,node1:/usr,/usr/local/xyx0.vds
-node2#/usr/local/xyx1,node1:/usr,/usr/local/xyx1.vds
-node1#/usr/local/xyx2,node1:/usr,/usr/local/xyx2.vds
diff --git a/CEP/Imager/MWControl/CMakeLists.txt b/CEP/Imager/MWControl/CMakeLists.txt
new file mode 100644
index 00000000000..0470507dc1e
--- /dev/null
+++ b/CEP/Imager/MWControl/CMakeLists.txt
@@ -0,0 +1,53 @@
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
+## Project characteristics
+## ---------------------------------------------------------------------------
+project(MWControl)
+include(LofarGeneral)
+
+include(LofarAddPackage)
+# Do not split the following line, otherwise makeversion will fail!
+lofar_add_package(${PROJECT_NAME} 0.1 DEPENDS Common Blob MWCommon ParmDB BBSKernel)
+
+## ---------------------------------------------------------------------------
+## External packages
+## ---------------------------------------------------------------------------
+include(LofarFindPackage)
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(include/MWControl)
+add_subdirectory(src)
+add_subdirectory(test)
diff --git a/CEP/Imager/MWControl/include/MWControl/CMakeLists.txt b/CEP/Imager/MWControl/include/MWControl/CMakeLists.txt
new file mode 100644
index 00000000000..1adba3b44bd
--- /dev/null
+++ b/CEP/Imager/MWControl/include/MWControl/CMakeLists.txt
@@ -0,0 +1,41 @@
+#  $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
+
+# List of header files that will be installed.
+set(inst_HEADERS
+  Package__Version.h
+  MWGlobalSpec.h
+  MWLocalSpec.h
+  MWMultiSpec.h
+  MWParameterHandler.h
+  MWSpec.h
+  MWStrategySpec.h
+  PredifferBBS.h
+  PredifferProxy.h
+  SolverBBS.h
+  SolverProxy.h)
+
+# Create symbolic link to include directory.
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink 
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_BINARY_DIR}/include/${PROJECT_NAME})
+
+# Install header files.
+install(FILES ${inst_HEADERS} DESTINATION include/${PROJECT_NAME})
diff --git a/CEP/Imager/MWControl/src/CMakeLists.txt b/CEP/Imager/MWControl/src/CMakeLists.txt
new file mode 100644
index 00000000000..dfa99517ee8
--- /dev/null
+++ b/CEP/Imager/MWControl/src/CMakeLists.txt
@@ -0,0 +1,38 @@
+#  $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
+
+include(LofarPackageVersion)
+
+set(mwcontrol_LIB_SRCS
+  Package__Version.cc
+  MWGlobalSpec.cc
+  MWLocalSpec.cc
+  MWMultiSpec.cc
+  MWParameterHandler.cc
+  MWSpec.cc
+  MWStrategySpec.cc
+  PredifferBBS.cc
+  PredifferProxy.cc
+  SolverBBS.cc
+  SolverProxy.cc)
+
+lofar_add_library(mwcontrol ${mwcontrol_LIB_SRCS})
+
+lofar_add_executable(versionmwcontrol versionmwcontrol.cc)
diff --git a/CEP/Imager/MWControl/test/CMakeLists.txt b/CEP/Imager/MWControl/test/CMakeLists.txt
new file mode 100644
index 00000000000..cb96806faa4
--- /dev/null
+++ b/CEP/Imager/MWControl/test/CMakeLists.txt
@@ -0,0 +1,25 @@
+#  $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
+
+include(LofarCTest)
+
+lofar_add_test(tMWControl
+  tMWControl.cc PredifferTest.cc SolverTest.cc MWStepTester.cc)
+lofar_add_test(tMWSpec tMWSpec.cc)
diff --git a/CEP/MS/CMakeLists.txt b/CEP/MS/CMakeLists.txt
new file mode 100644
index 00000000000..5afb1becff4
--- /dev/null
+++ b/CEP/MS/CMakeLists.txt
@@ -0,0 +1,53 @@
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
+## Project characteristics
+## ---------------------------------------------------------------------------
+project(MS)
+include(LofarGeneral)
+
+include(LofarAddPackage)
+lofar_add_package(${PROJECT_NAME} 0.1 DEPENDS Common Blob Transport MWCommon)
+
+## ---------------------------------------------------------------------------
+## External packages
+## ---------------------------------------------------------------------------
+include(LofarFindPackage)
+lofar_find_package(Casacore COMPONENTS casa measures ms tables REQUIRED)
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(include/MS)
+add_subdirectory(src)
+add_subdirectory(test)
diff --git a/CEP/MS/include/MS/CMakeLists.txt b/CEP/MS/include/MS/CMakeLists.txt
new file mode 100644
index 00000000000..f8afec7334b
--- /dev/null
+++ b/CEP/MS/include/MS/CMakeLists.txt
@@ -0,0 +1,33 @@
+#  $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
+
+# List of header files that will be installed.
+set(inst_HEADERS
+  Package__Version.h
+  MSDesc.h
+  VdsMaker.h)
+
+# Create symbolic link to include directory.
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink 
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_BINARY_DIR}/include/${PROJECT_NAME})
+
+# Install header files.
+install(FILES ${inst_HEADERS} DESTINATION include/${PROJECT_NAME})
diff --git a/CEP/MS/src/CMakeLists.txt b/CEP/MS/src/CMakeLists.txt
new file mode 100644
index 00000000000..3b47bf8f166
--- /dev/null
+++ b/CEP/MS/src/CMakeLists.txt
@@ -0,0 +1,46 @@
+#  $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
+
+include(LofarPackageVersion)
+
+set(ms_LIB_SRCS
+  Package__Version.cc
+  DH_MSMake.cc
+  MSCreate.cc
+  MSDesc.cc
+  VdsMaker.cc)
+
+set(ms_PROGRAMS
+  versionms
+  MSSplit
+  makevds
+  combinevds
+  makemsdesc
+  readmsdesc
+  makems
+  msplay)
+
+lofar_add_library(ms ${ms_LIB_SRCS})
+
+foreach(prog ${ms_PROGRAMS})
+  lofar_add_executable(${prog} ${prog}.cc)
+endforeach(prog ${ms_PROGRAMS})
+
+install(PROGRAMS mssplit DESTINATION bin)
diff --git a/CEP/MS/test/CMakeLists.txt b/CEP/MS/test/CMakeLists.txt
new file mode 100644
index 00000000000..f1bcf8a8417
--- /dev/null
+++ b/CEP/MS/test/CMakeLists.txt
@@ -0,0 +1,24 @@
+#  $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
+
+include(LofarCTest)
+
+lofar_add_test(tMSSplit tMSSplit.cc)
+add_test(tcombinevds ${CMAKE_CURRENT_SOURCE_DIR}/tcombinevds.sh)
diff --git a/CEP/MS/test/tMSSplit_test.sh b/CEP/MS/test/tMSSplit.sh
similarity index 100%
rename from CEP/MS/test/tMSSplit_test.sh
rename to CEP/MS/test/tMSSplit.sh
diff --git a/CEP/MWCommon/CMakeLists.txt b/CEP/MWCommon/CMakeLists.txt
new file mode 100644
index 00000000000..9e8759ae68b
--- /dev/null
+++ b/CEP/MWCommon/CMakeLists.txt
@@ -0,0 +1,53 @@
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
+## Project characteristics
+## ---------------------------------------------------------------------------
+project(MWCommon)
+include(LofarGeneral)
+
+include(LofarAddPackage)
+lofar_add_package(${PROJECT_NAME} 0.1 DEPENDS Common Blob)
+
+## ---------------------------------------------------------------------------
+## External packages
+## ---------------------------------------------------------------------------
+include(LofarFindPackage)
+lofar_find_package(Casacore COMPONENTS casa REQUIRED)
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(include/MWCommon)
+add_subdirectory(src)
+add_subdirectory(test)
diff --git a/CEP/Imager/MWCommon/Makefile.am b/CEP/MWCommon/Makefile.am
similarity index 100%
rename from CEP/Imager/MWCommon/Makefile.am
rename to CEP/MWCommon/Makefile.am
diff --git a/CEP/Imager/MWCommon/bootstrap b/CEP/MWCommon/bootstrap
similarity index 100%
rename from CEP/Imager/MWCommon/bootstrap
rename to CEP/MWCommon/bootstrap
diff --git a/CEP/Imager/MWCommon/configure.in b/CEP/MWCommon/configure.in
similarity index 93%
rename from CEP/Imager/MWCommon/configure.in
rename to CEP/MWCommon/configure.in
index 72d9f212dcf..6024a848a3c 100644
--- a/CEP/Imager/MWCommon/configure.in
+++ b/CEP/MWCommon/configure.in
@@ -58,8 +58,6 @@ lofar_INTERNAL(LCS/Blob,Blob,,1,Blob/BlobHeader.h,,)
 dnl
 dnl Output Makefiles
 dnl
-AC_CONFIG_FILES([test/runctest.sh:autoconf_share/runctest.sh.in],
-                [chmod +x test/runctest.sh])
 AC_OUTPUT(
 include/Makefile
 include/MWCommon/Makefile
diff --git a/CEP/MWCommon/include/MWCommon/CMakeLists.txt b/CEP/MWCommon/include/MWCommon/CMakeLists.txt
new file mode 100644
index 00000000000..713c1338163
--- /dev/null
+++ b/CEP/MWCommon/include/MWCommon/CMakeLists.txt
@@ -0,0 +1,65 @@
+#  $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
+
+# List of header files that will be installed.
+set(inst_HEADERS
+  Package__Version.h
+  ClusterDesc.h
+  ControllerBase.h
+  Controller.h
+  DomainShape.h
+  MPIConnection.h
+  MPIConnectionSet.h
+  MWBlobIO.h
+  MWConnection.h
+  MWConnectionSet.h
+  MWError.h
+  MWGlobalStep.h
+  MWIos.h
+  MWLocalStep.h
+  MWMultiStep.h
+  MWStep.h
+  MWStepFactory.h
+  MWStepVisitor.h
+  MasterControl.h
+  MemConnection.h
+  MemConnectionSet.h
+  NodeDesc.h
+  ObsDomain.h
+  ParameterHandler.h
+  SocketConnection.h
+  SocketConnectionSet.h
+  SocketListener.h
+  VdsDesc.h
+  VdsPartDesc.h
+  WorkDomainSpec.h
+  WorkerControl.h
+  WorkerFactory.h
+  WorkerInfo.h
+  WorkerProxy.h
+  WorkersDesc.h) 
+
+# Create symbolic link to include directory.
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink 
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_BINARY_DIR}/include/${PROJECT_NAME})
+
+# Install header files.
+install(FILES ${inst_HEADERS} DESTINATION include/${PROJECT_NAME})
diff --git a/CEP/Imager/MWCommon/include/MWCommon/ClusterDesc.h b/CEP/MWCommon/include/MWCommon/ClusterDesc.h
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/ClusterDesc.h
rename to CEP/MWCommon/include/MWCommon/ClusterDesc.h
diff --git a/CEP/Imager/MWCommon/include/MWCommon/Controller.h b/CEP/MWCommon/include/MWCommon/Controller.h
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/Controller.h
rename to CEP/MWCommon/include/MWCommon/Controller.h
diff --git a/CEP/Imager/MWCommon/include/MWCommon/ControllerBase.h b/CEP/MWCommon/include/MWCommon/ControllerBase.h
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/ControllerBase.h
rename to CEP/MWCommon/include/MWCommon/ControllerBase.h
diff --git a/CEP/Imager/MWCommon/include/MWCommon/DomainShape.h b/CEP/MWCommon/include/MWCommon/DomainShape.h
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/DomainShape.h
rename to CEP/MWCommon/include/MWCommon/DomainShape.h
diff --git a/CEP/Imager/MWCommon/include/MWCommon/MPIConnection.h b/CEP/MWCommon/include/MWCommon/MPIConnection.h
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/MPIConnection.h
rename to CEP/MWCommon/include/MWCommon/MPIConnection.h
diff --git a/CEP/Imager/MWCommon/include/MWCommon/MPIConnectionSet.h b/CEP/MWCommon/include/MWCommon/MPIConnectionSet.h
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/MPIConnectionSet.h
rename to CEP/MWCommon/include/MWCommon/MPIConnectionSet.h
diff --git a/CEP/Imager/MWCommon/include/MWCommon/MWBlobIO.h b/CEP/MWCommon/include/MWCommon/MWBlobIO.h
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/MWBlobIO.h
rename to CEP/MWCommon/include/MWCommon/MWBlobIO.h
diff --git a/CEP/Imager/MWCommon/include/MWCommon/MWConnection.h b/CEP/MWCommon/include/MWCommon/MWConnection.h
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/MWConnection.h
rename to CEP/MWCommon/include/MWCommon/MWConnection.h
diff --git a/CEP/Imager/MWCommon/include/MWCommon/MWConnectionSet.h b/CEP/MWCommon/include/MWCommon/MWConnectionSet.h
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/MWConnectionSet.h
rename to CEP/MWCommon/include/MWCommon/MWConnectionSet.h
diff --git a/CEP/Imager/MWCommon/include/MWCommon/MWError.h b/CEP/MWCommon/include/MWCommon/MWError.h
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/MWError.h
rename to CEP/MWCommon/include/MWCommon/MWError.h
diff --git a/CEP/Imager/MWCommon/include/MWCommon/MWGlobalStep.h b/CEP/MWCommon/include/MWCommon/MWGlobalStep.h
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/MWGlobalStep.h
rename to CEP/MWCommon/include/MWCommon/MWGlobalStep.h
diff --git a/CEP/Imager/MWCommon/include/MWCommon/MWIos.h b/CEP/MWCommon/include/MWCommon/MWIos.h
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/MWIos.h
rename to CEP/MWCommon/include/MWCommon/MWIos.h
diff --git a/CEP/Imager/MWCommon/include/MWCommon/MWLocalStep.h b/CEP/MWCommon/include/MWCommon/MWLocalStep.h
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/MWLocalStep.h
rename to CEP/MWCommon/include/MWCommon/MWLocalStep.h
diff --git a/CEP/Imager/MWCommon/include/MWCommon/MWMultiStep.h b/CEP/MWCommon/include/MWCommon/MWMultiStep.h
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/MWMultiStep.h
rename to CEP/MWCommon/include/MWCommon/MWMultiStep.h
diff --git a/CEP/Imager/MWCommon/include/MWCommon/MWStep.h b/CEP/MWCommon/include/MWCommon/MWStep.h
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/MWStep.h
rename to CEP/MWCommon/include/MWCommon/MWStep.h
diff --git a/CEP/Imager/MWCommon/include/MWCommon/MWStepFactory.h b/CEP/MWCommon/include/MWCommon/MWStepFactory.h
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/MWStepFactory.h
rename to CEP/MWCommon/include/MWCommon/MWStepFactory.h
diff --git a/CEP/Imager/MWCommon/include/MWCommon/MWStepVisitor.h b/CEP/MWCommon/include/MWCommon/MWStepVisitor.h
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/MWStepVisitor.h
rename to CEP/MWCommon/include/MWCommon/MWStepVisitor.h
diff --git a/CEP/Imager/MWCommon/include/MWCommon/Makefile.am b/CEP/MWCommon/include/MWCommon/Makefile.am
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/Makefile.am
rename to CEP/MWCommon/include/MWCommon/Makefile.am
diff --git a/CEP/Imager/MWCommon/include/MWCommon/MasterControl.h b/CEP/MWCommon/include/MWCommon/MasterControl.h
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/MasterControl.h
rename to CEP/MWCommon/include/MWCommon/MasterControl.h
diff --git a/CEP/Imager/MWCommon/include/MWCommon/MemConnection.h b/CEP/MWCommon/include/MWCommon/MemConnection.h
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/MemConnection.h
rename to CEP/MWCommon/include/MWCommon/MemConnection.h
diff --git a/CEP/Imager/MWCommon/include/MWCommon/MemConnectionSet.h b/CEP/MWCommon/include/MWCommon/MemConnectionSet.h
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/MemConnectionSet.h
rename to CEP/MWCommon/include/MWCommon/MemConnectionSet.h
diff --git a/CEP/Imager/MWCommon/include/MWCommon/NodeDesc.h b/CEP/MWCommon/include/MWCommon/NodeDesc.h
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/NodeDesc.h
rename to CEP/MWCommon/include/MWCommon/NodeDesc.h
diff --git a/CEP/Imager/MWCommon/include/MWCommon/ObsDomain.h b/CEP/MWCommon/include/MWCommon/ObsDomain.h
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/ObsDomain.h
rename to CEP/MWCommon/include/MWCommon/ObsDomain.h
diff --git a/CEP/Imager/MWCommon/include/MWCommon/ParameterHandler.h b/CEP/MWCommon/include/MWCommon/ParameterHandler.h
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/ParameterHandler.h
rename to CEP/MWCommon/include/MWCommon/ParameterHandler.h
diff --git a/CEP/Imager/MWCommon/include/MWCommon/SocketConnection.h b/CEP/MWCommon/include/MWCommon/SocketConnection.h
similarity index 97%
rename from CEP/Imager/MWCommon/include/MWCommon/SocketConnection.h
rename to CEP/MWCommon/include/MWCommon/SocketConnection.h
index fe95b0dc846..c763712a755 100644
--- a/CEP/Imager/MWCommon/include/MWCommon/SocketConnection.h
+++ b/CEP/MWCommon/include/MWCommon/SocketConnection.h
@@ -54,7 +54,7 @@ namespace LOFAR { namespace CEP {
     // Set up the client side of a connection.
     // Upon the first send or receive it connects to the server
     // on the given host and port.
-    // If making the connection fails, it will sleep one second and try
+    // If the making the connection fails, it will sleep one second and try
     // again for up to 60 attempts. In this way the case is handled
     // where a server is started a bit later than a client.
     SocketConnection (const std::string& hostName, const std::string& port);
diff --git a/CEP/Imager/MWCommon/include/MWCommon/SocketConnectionSet.h b/CEP/MWCommon/include/MWCommon/SocketConnectionSet.h
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/SocketConnectionSet.h
rename to CEP/MWCommon/include/MWCommon/SocketConnectionSet.h
diff --git a/CEP/Imager/MWCommon/include/MWCommon/SocketListener.h b/CEP/MWCommon/include/MWCommon/SocketListener.h
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/SocketListener.h
rename to CEP/MWCommon/include/MWCommon/SocketListener.h
diff --git a/CEP/Imager/MWCommon/include/MWCommon/VdsDesc.h b/CEP/MWCommon/include/MWCommon/VdsDesc.h
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/VdsDesc.h
rename to CEP/MWCommon/include/MWCommon/VdsDesc.h
diff --git a/CEP/Imager/MWCommon/include/MWCommon/VdsPartDesc.h b/CEP/MWCommon/include/MWCommon/VdsPartDesc.h
similarity index 95%
rename from CEP/Imager/MWCommon/include/MWCommon/VdsPartDesc.h
rename to CEP/MWCommon/include/MWCommon/VdsPartDesc.h
index b9955659229..5c7471bef44 100644
--- a/CEP/Imager/MWCommon/include/MWCommon/VdsPartDesc.h
+++ b/CEP/MWCommon/include/MWCommon/VdsPartDesc.h
@@ -69,10 +69,6 @@ namespace LOFAR { namespace CEP {
     void setFileName (const std::string& name)
       { itsFileName = name; }
 
-    // Set the name of the ClusterDesc file used.
-    void setClusterDescName (const std::string& cdName)
-      { itsCDescName = cdName; }
-
     // Change the base part of the name.
     void changeBaseName (const string& newBaseName);
 
@@ -113,8 +109,6 @@ namespace LOFAR { namespace CEP {
       { return itsFileName; }
     const std::string& getFileSys() const
       { return itsFileSys; }
-    const std::string& getClusterDescName() const
-      { return itsCDescName; }
     double getStartTime() const
       { return itsStartTime; }
     double getEndTime() const
@@ -145,7 +139,6 @@ namespace LOFAR { namespace CEP {
     std::string itsName;       //# full name of the VDS desc
     std::string itsFileName;   //# full name of the VDS (data set name)
     std::string itsFileSys;    //# name of file system the VDS resides on
-    std::string itsCDescName;  //# name of ClusterDesc file used
     double      itsStartTime;
     double      itsEndTime;
     double      itsStepTime;
diff --git a/CEP/Imager/MWCommon/include/MWCommon/WorkDomainSpec.h b/CEP/MWCommon/include/MWCommon/WorkDomainSpec.h
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/WorkDomainSpec.h
rename to CEP/MWCommon/include/MWCommon/WorkDomainSpec.h
diff --git a/CEP/Imager/MWCommon/include/MWCommon/WorkerControl.h b/CEP/MWCommon/include/MWCommon/WorkerControl.h
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/WorkerControl.h
rename to CEP/MWCommon/include/MWCommon/WorkerControl.h
diff --git a/CEP/Imager/MWCommon/include/MWCommon/WorkerFactory.h b/CEP/MWCommon/include/MWCommon/WorkerFactory.h
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/WorkerFactory.h
rename to CEP/MWCommon/include/MWCommon/WorkerFactory.h
diff --git a/CEP/Imager/MWCommon/include/MWCommon/WorkerInfo.h b/CEP/MWCommon/include/MWCommon/WorkerInfo.h
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/WorkerInfo.h
rename to CEP/MWCommon/include/MWCommon/WorkerInfo.h
diff --git a/CEP/Imager/MWCommon/include/MWCommon/WorkerProxy.h b/CEP/MWCommon/include/MWCommon/WorkerProxy.h
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/WorkerProxy.h
rename to CEP/MWCommon/include/MWCommon/WorkerProxy.h
diff --git a/CEP/Imager/MWCommon/include/MWCommon/WorkersDesc.h b/CEP/MWCommon/include/MWCommon/WorkersDesc.h
similarity index 100%
rename from CEP/Imager/MWCommon/include/MWCommon/WorkersDesc.h
rename to CEP/MWCommon/include/MWCommon/WorkersDesc.h
diff --git a/CEP/Imager/MWCommon/include/Makefile.am b/CEP/MWCommon/include/Makefile.am
similarity index 100%
rename from CEP/Imager/MWCommon/include/Makefile.am
rename to CEP/MWCommon/include/Makefile.am
diff --git a/CEP/Imager/MWCommon/package.dox b/CEP/MWCommon/package.dox
similarity index 100%
rename from CEP/Imager/MWCommon/package.dox
rename to CEP/MWCommon/package.dox
diff --git a/CEP/MWCommon/src/CMakeLists.txt b/CEP/MWCommon/src/CMakeLists.txt
new file mode 100644
index 00000000000..4c4e68ff577
--- /dev/null
+++ b/CEP/MWCommon/src/CMakeLists.txt
@@ -0,0 +1,66 @@
+#  $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
+
+include(LofarPackageVersion)
+
+set(mwcommon_LIB_SRCS
+  Package__Version.cc
+  ClusterDesc.cc
+  ControllerBase.cc
+  DomainShape.cc
+  MPIConnection.cc
+  MPIConnectionSet.cc
+  MWBlobIO.cc
+  MWConnection.cc
+  MWConnectionSet.cc
+  MWGlobalStep.cc
+  MWIos.cc
+  MWLocalStep.cc
+  MWMultiStep.cc
+  MWStep.cc
+  MWStepFactory.cc
+  MWStepVisitor.cc
+  MasterControl.cc
+  MemConnection.cc
+  MemConnectionSet.cc
+  NodeDesc.cc
+  ObsDomain.cc
+  ParameterHandler.cc
+  SocketConnection.cc
+  SocketConnectionSet.cc
+  SocketListener.cc
+  VdsDesc.cc
+  VdsPartDesc.cc
+  WorkDomainSpec.cc
+  WorkerControl.cc
+  WorkerFactory.cc
+  WorkerInfo.cc
+  WorkerProxy.cc
+  WorkersDesc.cc)
+
+lofar_add_library(mwcommon ${mwcommon_LIB_SRCS})
+
+lofar_add_executable(versionmwcommon versionmwcommon.cc)
+lofar_add_executable(finddproc finddproc.cc)
+
+install(PROGRAMS
+  startdistproc
+  socketrun
+  DESTINATION bin)
diff --git a/CEP/Imager/MWCommon/src/ClusterDesc.cc b/CEP/MWCommon/src/ClusterDesc.cc
similarity index 100%
rename from CEP/Imager/MWCommon/src/ClusterDesc.cc
rename to CEP/MWCommon/src/ClusterDesc.cc
diff --git a/CEP/Imager/MWCommon/src/Controller.cc b/CEP/MWCommon/src/Controller.cc
similarity index 98%
rename from CEP/Imager/MWCommon/src/Controller.cc
rename to CEP/MWCommon/src/Controller.cc
index 8fd8972d108..76071dfa736 100644
--- a/CEP/Imager/MWCommon/src/Controller.cc
+++ b/CEP/MWCommon/src/Controller.cc
@@ -55,7 +55,8 @@ namespace LOFAR { namespace CEP {
 	  rank  = MPIConnection::getRank();
 	}
 	// If only one MPI node, we may run in a single process
-	// or in multiple processes connected via sockets (a port is given).
+	// or in multiple processes connected via sockets.
+	// Find out from argv.
 	if (nnode <= 1  &&  !port.empty()) {
 	  nnode = nproc;
 	  rank  = procRank;
diff --git a/CEP/Imager/MWCommon/src/ControllerBase.cc b/CEP/MWCommon/src/ControllerBase.cc
similarity index 100%
rename from CEP/Imager/MWCommon/src/ControllerBase.cc
rename to CEP/MWCommon/src/ControllerBase.cc
diff --git a/CEP/Imager/MWCommon/src/DomainShape.cc b/CEP/MWCommon/src/DomainShape.cc
similarity index 100%
rename from CEP/Imager/MWCommon/src/DomainShape.cc
rename to CEP/MWCommon/src/DomainShape.cc
diff --git a/CEP/Imager/MWCommon/src/MPIConnection.cc b/CEP/MWCommon/src/MPIConnection.cc
similarity index 100%
rename from CEP/Imager/MWCommon/src/MPIConnection.cc
rename to CEP/MWCommon/src/MPIConnection.cc
diff --git a/CEP/Imager/MWCommon/src/MPIConnectionSet.cc b/CEP/MWCommon/src/MPIConnectionSet.cc
similarity index 100%
rename from CEP/Imager/MWCommon/src/MPIConnectionSet.cc
rename to CEP/MWCommon/src/MPIConnectionSet.cc
diff --git a/CEP/Imager/MWCommon/src/MWBlobIO.cc b/CEP/MWCommon/src/MWBlobIO.cc
similarity index 100%
rename from CEP/Imager/MWCommon/src/MWBlobIO.cc
rename to CEP/MWCommon/src/MWBlobIO.cc
diff --git a/CEP/Imager/MWCommon/src/MWConnection.cc b/CEP/MWCommon/src/MWConnection.cc
similarity index 100%
rename from CEP/Imager/MWCommon/src/MWConnection.cc
rename to CEP/MWCommon/src/MWConnection.cc
diff --git a/CEP/Imager/MWCommon/src/MWConnectionSet.cc b/CEP/MWCommon/src/MWConnectionSet.cc
similarity index 100%
rename from CEP/Imager/MWCommon/src/MWConnectionSet.cc
rename to CEP/MWCommon/src/MWConnectionSet.cc
diff --git a/CEP/Imager/MWCommon/src/MWGlobalStep.cc b/CEP/MWCommon/src/MWGlobalStep.cc
similarity index 100%
rename from CEP/Imager/MWCommon/src/MWGlobalStep.cc
rename to CEP/MWCommon/src/MWGlobalStep.cc
diff --git a/CEP/Imager/MWCommon/src/MWIos.cc b/CEP/MWCommon/src/MWIos.cc
similarity index 100%
rename from CEP/Imager/MWCommon/src/MWIos.cc
rename to CEP/MWCommon/src/MWIos.cc
diff --git a/CEP/Imager/MWCommon/src/MWLocalStep.cc b/CEP/MWCommon/src/MWLocalStep.cc
similarity index 100%
rename from CEP/Imager/MWCommon/src/MWLocalStep.cc
rename to CEP/MWCommon/src/MWLocalStep.cc
diff --git a/CEP/Imager/MWCommon/src/MWMultiStep.cc b/CEP/MWCommon/src/MWMultiStep.cc
similarity index 100%
rename from CEP/Imager/MWCommon/src/MWMultiStep.cc
rename to CEP/MWCommon/src/MWMultiStep.cc
diff --git a/CEP/Imager/MWCommon/src/MWStep.cc b/CEP/MWCommon/src/MWStep.cc
similarity index 100%
rename from CEP/Imager/MWCommon/src/MWStep.cc
rename to CEP/MWCommon/src/MWStep.cc
diff --git a/CEP/Imager/MWCommon/src/MWStepFactory.cc b/CEP/MWCommon/src/MWStepFactory.cc
similarity index 100%
rename from CEP/Imager/MWCommon/src/MWStepFactory.cc
rename to CEP/MWCommon/src/MWStepFactory.cc
diff --git a/CEP/Imager/MWCommon/src/MWStepVisitor.cc b/CEP/MWCommon/src/MWStepVisitor.cc
similarity index 100%
rename from CEP/Imager/MWCommon/src/MWStepVisitor.cc
rename to CEP/MWCommon/src/MWStepVisitor.cc
diff --git a/CEP/Imager/MWCommon/src/Makefile.am b/CEP/MWCommon/src/Makefile.am
similarity index 100%
rename from CEP/Imager/MWCommon/src/Makefile.am
rename to CEP/MWCommon/src/Makefile.am
diff --git a/CEP/Imager/MWCommon/src/MasterControl.cc b/CEP/MWCommon/src/MasterControl.cc
similarity index 100%
rename from CEP/Imager/MWCommon/src/MasterControl.cc
rename to CEP/MWCommon/src/MasterControl.cc
diff --git a/CEP/Imager/MWCommon/src/MemConnection.cc b/CEP/MWCommon/src/MemConnection.cc
similarity index 100%
rename from CEP/Imager/MWCommon/src/MemConnection.cc
rename to CEP/MWCommon/src/MemConnection.cc
diff --git a/CEP/Imager/MWCommon/src/MemConnectionSet.cc b/CEP/MWCommon/src/MemConnectionSet.cc
similarity index 100%
rename from CEP/Imager/MWCommon/src/MemConnectionSet.cc
rename to CEP/MWCommon/src/MemConnectionSet.cc
diff --git a/CEP/Imager/MWCommon/src/NodeDesc.cc b/CEP/MWCommon/src/NodeDesc.cc
similarity index 100%
rename from CEP/Imager/MWCommon/src/NodeDesc.cc
rename to CEP/MWCommon/src/NodeDesc.cc
diff --git a/CEP/Imager/MWCommon/src/ObsDomain.cc b/CEP/MWCommon/src/ObsDomain.cc
similarity index 100%
rename from CEP/Imager/MWCommon/src/ObsDomain.cc
rename to CEP/MWCommon/src/ObsDomain.cc
diff --git a/CEP/Imager/MWCommon/src/ParameterHandler.cc b/CEP/MWCommon/src/ParameterHandler.cc
similarity index 100%
rename from CEP/Imager/MWCommon/src/ParameterHandler.cc
rename to CEP/MWCommon/src/ParameterHandler.cc
diff --git a/CEP/Imager/MWCommon/src/SocketConnection.cc b/CEP/MWCommon/src/SocketConnection.cc
similarity index 100%
rename from CEP/Imager/MWCommon/src/SocketConnection.cc
rename to CEP/MWCommon/src/SocketConnection.cc
diff --git a/CEP/Imager/MWCommon/src/SocketConnectionSet.cc b/CEP/MWCommon/src/SocketConnectionSet.cc
similarity index 100%
rename from CEP/Imager/MWCommon/src/SocketConnectionSet.cc
rename to CEP/MWCommon/src/SocketConnectionSet.cc
diff --git a/CEP/Imager/MWCommon/src/SocketListener.cc b/CEP/MWCommon/src/SocketListener.cc
similarity index 100%
rename from CEP/Imager/MWCommon/src/SocketListener.cc
rename to CEP/MWCommon/src/SocketListener.cc
diff --git a/CEP/Imager/MWCommon/src/VdsDesc.cc b/CEP/MWCommon/src/VdsDesc.cc
similarity index 100%
rename from CEP/Imager/MWCommon/src/VdsDesc.cc
rename to CEP/MWCommon/src/VdsDesc.cc
diff --git a/CEP/Imager/MWCommon/src/VdsPartDesc.cc b/CEP/MWCommon/src/VdsPartDesc.cc
similarity index 95%
rename from CEP/Imager/MWCommon/src/VdsPartDesc.cc
rename to CEP/MWCommon/src/VdsPartDesc.cc
index 9aad495010d..a82827aebf2 100644
--- a/CEP/Imager/MWCommon/src/VdsPartDesc.cc
+++ b/CEP/MWCommon/src/VdsPartDesc.cc
@@ -28,7 +28,6 @@ namespace LOFAR { namespace CEP {
     itsName         = parset.getString ("Name");
     itsFileName     = parset.getString ("FileName", "");
     itsFileSys      = parset.getString ("FileSys", "");
-    itsCDescName    = parset.getString ("ClusterDesc", "");
     itsStepTime     = parset.getDouble ("StepTime");
     itsNChan        = parset.getInt32Vector ("NChan", vector<int32>());
     itsStartFreqs   = parset.getDoubleVector ("StartFreqs", vector<double>());
@@ -62,9 +61,6 @@ namespace LOFAR { namespace CEP {
     if (! itsFileSys.empty()) {
       os << prefix << "FileSys    = " << itsFileSys << endl;
     }
-    if (! itsCDescName.empty()) {
-      os << prefix << "ClusterDesc= " << itsCDescName << endl;
-    }
     os << prefix << "StartTime  = "
 	<< MVTime::Format(MVTime::YMD,9) << MVTime(itsStartTime/86400) << endl;
     os << prefix << "EndTime    = "
@@ -162,7 +158,7 @@ namespace LOFAR { namespace CEP {
   BlobOStream& VdsPartDesc::toBlob (BlobOStream& bs) const
   {
     bs.putStart ("VdsPartDesc", 1);
-    bs << itsName << itsFileName << itsFileSys << itsCDescName
+    bs << itsName << itsFileName << itsFileSys
        << itsStartTime << itsEndTime << itsStepTime
        << itsStartTimes << itsEndTimes
        << itsNChan << itsStartFreqs << itsEndFreqs
@@ -174,7 +170,7 @@ namespace LOFAR { namespace CEP {
   BlobIStream& VdsPartDesc::fromBlob (BlobIStream& bs)
   {
     bs.getStart ("VdsPartDesc");
-    bs >> itsName >> itsFileName >> itsFileSys >> itsCDescName
+    bs >> itsName >> itsFileName >> itsFileSys
        >> itsStartTime >> itsEndTime >> itsStepTime
        >> itsStartTimes >> itsEndTimes
        >> itsNChan >> itsStartFreqs >> itsEndFreqs
diff --git a/CEP/Imager/MWCommon/src/WorkDomainSpec.cc b/CEP/MWCommon/src/WorkDomainSpec.cc
similarity index 100%
rename from CEP/Imager/MWCommon/src/WorkDomainSpec.cc
rename to CEP/MWCommon/src/WorkDomainSpec.cc
diff --git a/CEP/Imager/MWCommon/src/WorkerControl.cc b/CEP/MWCommon/src/WorkerControl.cc
similarity index 100%
rename from CEP/Imager/MWCommon/src/WorkerControl.cc
rename to CEP/MWCommon/src/WorkerControl.cc
diff --git a/CEP/Imager/MWCommon/src/WorkerFactory.cc b/CEP/MWCommon/src/WorkerFactory.cc
similarity index 100%
rename from CEP/Imager/MWCommon/src/WorkerFactory.cc
rename to CEP/MWCommon/src/WorkerFactory.cc
diff --git a/CEP/Imager/MWCommon/src/WorkerInfo.cc b/CEP/MWCommon/src/WorkerInfo.cc
similarity index 100%
rename from CEP/Imager/MWCommon/src/WorkerInfo.cc
rename to CEP/MWCommon/src/WorkerInfo.cc
diff --git a/CEP/Imager/MWCommon/src/WorkerProxy.cc b/CEP/MWCommon/src/WorkerProxy.cc
similarity index 100%
rename from CEP/Imager/MWCommon/src/WorkerProxy.cc
rename to CEP/MWCommon/src/WorkerProxy.cc
diff --git a/CEP/Imager/MWCommon/src/WorkersDesc.cc b/CEP/MWCommon/src/WorkersDesc.cc
similarity index 100%
rename from CEP/Imager/MWCommon/src/WorkersDesc.cc
rename to CEP/MWCommon/src/WorkersDesc.cc
diff --git a/CEP/MWCommon/src/finddproc.cc b/CEP/MWCommon/src/finddproc.cc
new file mode 100644
index 00000000000..3eded25b9ef
--- /dev/null
+++ b/CEP/MWCommon/src/finddproc.cc
@@ -0,0 +1,74 @@
+//# finddproc.cc: Create machinefile based on 
+//#
+//# @copyright (c) 2007 ASKAP, All Rights Reserved.
+//# @author Ger van Diepen <diepen AT astron nl>
+//#
+//# $Id$
+
+#include <lofar_config.h>
+
+#include <MWCommon/VdsDesc.h>
+#include <MWCommon/ClusterDesc.h>
+#include <MWCommon/WorkersDesc.h>
+#include <MWCommon/MWError.h>
+#include <Common/LofarLogger.h>
+#include <iostream>
+
+using namespace LOFAR::CEP;
+using namespace std;
+
+
+void makeFile (const string& vdsName, const string& clusterName)
+{
+  // Read in the vds and cluster desc.
+  VdsDesc vds(vdsName);
+  ClusterDesc cluster(clusterName);
+  WorkersDesc workers(cluster);
+  // Make a worker for each node in the cluster.
+  // Create a fake work type for them.
+  const int workType=0;
+  vector<int> workTypes(1, workType);
+  const vector<NodeDesc>& nodes = cluster.getNodes();
+  for (unsigned i=0; i<nodes.size(); ++i) {
+    workers.addWorker (i, nodes[i].getName(), workTypes);
+  }
+  // Loop through all parts of the dataset.
+  const vector<VdsPartDesc>& parts = vds.getParts();
+  for (vector<VdsPartDesc>::const_iterator iter = parts.begin();
+       iter != parts.end();
+       ++iter) {
+    // Find a worker that can deal with the file system the dataset part is on.
+    int winx = workers.findWorker (workType, iter->getFileSys());
+    if (winx < 0) {
+      THROW (MWError, "finddproc: no suitable host could be found" <<
+	     " for dataset part " << iter->getName() <<
+	     " on file system " << iter->getFileSys());
+    }
+    cout << nodes[winx].getName() << '#' << iter->getName() << endl;
+    // Increment the load to indicate it is already in use. In that way it
+    // will only be used again if all other possible nodes are used as well.
+    workers.incrLoad (winx);
+  }
+}
+
+int main (int argc, const char* argv[])
+{
+  try {
+    if (argc < 3) {
+      cerr << "Run as:  finddproc vdsdescname clusterdescname [otherhosts]"
+	   << endl;
+      cerr << "   The other hosts are listed first "
+	   << "(represent master and e.g. solvers)" << endl;
+      return 1;
+    }
+    // First list the other hosts (master and extra).
+    for (int i=3; i<argc; ++i) {
+      cout << argv[i] << endl;
+    }
+    makeFile (argv[1], argv[2]);
+  } catch (std::exception& x) {
+    cerr << "Unexpected exception: " << x.what() << endl;
+    return 1;
+  }
+  return 0;
+}
diff --git a/CEP/MWCommon/src/socketrun b/CEP/MWCommon/src/socketrun
new file mode 100755
index 00000000000..5b741c59703
--- /dev/null
+++ b/CEP/MWCommon/src/socketrun
@@ -0,0 +1,60 @@
+#!/bin/sh
+
+# socketrun.cc: Start a distributed process using socket connections
+#
+# @copyright (c) 2008 ASKAP, All Rights Reserved.
+# @author Ger van Diepen <diepen AT astron nl>
+#
+# $Id$
+
+
+# This script starts a distributed process to process a datasets.
+# The processes will use sockets for communication.
+#
+# run as:  socketrun dry hfn port logfile program [arg1 arg2 ...]
+
+dry=$1
+shift
+hfn=$1
+shift
+port=$1
+shift
+logfile=$1
+shift
+program=$1
+shift
+
+np=`wc -l $hfn | awk '{print $1}'`
+
+# The first host is the master one.
+masterhost=
+pidlist=
+rank=0
+for inline in `cat $hfn`
+do
+  host=`echo $inline | sed -e 's%#.*%%'`
+  part=`echo $inline | sed -e 's%.*#%%'`
+  if test "$masterhost" = ""; then
+    masterhost=$host
+  fi
+  echo "ssh $host $program socket $masterhost $port $np $rank $part" "$@"
+  if test $dry = 0; then
+    if test "$logfile" = ""; then
+      ssh -x -n $host $program socket $masterhost $port $np $rank $part "$@" &
+    else
+      ssh -x -n $host $program socket $masterhost $port $np $rank $part "$@" > $logfile-$rank 2>&1 &
+    fi
+    pidlist="$pidlist $!"
+  fi
+  rank=`expr $rank + 1`
+done
+
+status=0
+for pid in $pidlist
+do
+  if ! wait $pid; then
+    status=1
+  fi
+done
+
+exit $status
diff --git a/CEP/Imager/MWCommon/src/startdistproc b/CEP/MWCommon/src/startdistproc
similarity index 64%
rename from CEP/Imager/MWCommon/src/startdistproc
rename to CEP/MWCommon/src/startdistproc
index 031edffdbbb..bbf55275ba1 100755
--- a/CEP/Imager/MWCommon/src/startdistproc
+++ b/CEP/MWCommon/src/startdistproc
@@ -12,7 +12,7 @@
 # It can use sockets or MPI.
 # The VdsDesc and ClusterDesc files are used to determine on which nodes
 # the various processes need to be started.
-# Possible arguments can be given after the program name. They are given as
+# Possible arguments can be given after the program namw. They are given as
 # arguments to the distributed programs.
 
 
@@ -22,14 +22,11 @@ pgmpath=`cd $pgmpath > /dev/null 2>&1  &&  pwd`
 
 # Set default options.
 modxx=single
-wait=1
 dsn=
 cdn=
 hfn=
-dirs=
 fdp=
 master=localhost
-startmaster=1
 extra=
 dry=0
 logfile=
@@ -60,13 +57,6 @@ do
   elif [ "$1" = "-nohfn" ]; then
     shift
     hfn=
-  elif [ "$1" = "-dirs" ]; then
-    shift
-    dirs="$1"
-    shift
-  elif [ "$1" = "-nodirs" ]; then
-    shift
-    dirs=
   elif [ "$1" = "-fdp" ]; then
     shift
     fdp="$1"
@@ -88,12 +78,6 @@ do
     shift
     modxx="$1"
     shift
-  elif [ "$1" = "-wait" ]; then
-    shift
-    wait=1
-  elif [ "$1" = "-nowait" ]; then
-    shift
-    wait=0
   elif [ "$1" = "-masterhost" ]; then
     shift
     master="$1"
@@ -101,12 +85,6 @@ do
   elif [ "$1" = "-nomasterhost" ]; then
     shift
     master=
-  elif [ "$1" = "-startmaster" ]; then
-    shift
-    startmaster=1
-  elif [ "$1" = "-nostartmaster" ]; then
-    shift
-    startmaster=0
   elif [ "$1" = "-extrahosts" ]; then
     shift
     extra="$1"
@@ -132,24 +110,18 @@ done
 
 if [ $help = 1 ]; then
   echo ''
-  echo 'startdistproc starts distributed processes to process a given dataset.'
+  echo 'startdistproc starts a distributed process to process the given dataset.'
   echo 'The mode tells if it is started through MPI, sockets, or as a single process.'
   echo ''
   echo 'Run as:'
-  echo ' startdistproc -cdn clusterdescname [-dsn datasetname]"
-  echo "              [-dirs directories] [-mode mode]'
+  echo ' startdistproc -dsn datasetname -cdn clusterdescname [-mode mode]'
   echo '              [-hfn hostfilename] [-fdp finddproc-path]'
   echo '              [-logfile logfilename] [-[no]dry]'
   echo '              [-extrahosts "host1 host2 ..."] [-noextrahosts]'
-  echo '              [-masterhost host] [-startmaster] program [arg1 arg2 ...]'
+  echo '              [-masterhost host] program [arg1 arg2 ...]'
   echo ''
-  echo '  -cdn clusterdescname  The name of the file describing the cluster.'
   echo '  -dsn datasetname      The name of the file describing the distributed dataset.'
-  echo '  -dirs directories     Directories to use if -dsn is not given.'
-  echo '                        Each directory can be preceeded by host: (a la scp).'
-  echo '                        This is useful if a distributed dataset has'
-  echo '                        to be created for which no VDS file exists yet.'
-  echo '                        -dsn and dirs cannot be given both.'
+  echo '  -cdn clusterdescname  The name of the file describing the cluster.'
   echo '  -hfn hostfilename     The name of the generated hostfile.'
   echo '                        It defaults to /tmp/machinefile_$$'
   echo '  -fdp finddproc-path   Path where to find finddistproc.'
@@ -165,16 +137,9 @@ if [ $help = 1 ]; then
   echo '  -masterhost host      The name of the host the master runs on.'
   echo '                        The default is localhost.'
   echo '                        -nomasterhost means that no master process is started.'
-  echo '  -startmaster          Start the master process (which is the default).'
-  echo '                        -nostartmaster can be used to indicate that the'
-  echo '                        master process is running already. In that case'
-  echo '                        only a socket connection mode can be used.'
   echo '  -extrahosts hosts     The hosts to be used for extra processes (e.g. solvers).'
   echo '                        Multiple hosts have to be separated by whitespace'
   echo '                        and enclosed in quotes.'
-  echo '  program               name of the program to start.'
-  echo '  arg1 arg2 ..          Optional extra arguments which are passed to'
-  echo '                        the program to start.'
   echo '  -h -help --help       This help text.'
   exit 0
 fi
@@ -183,23 +148,17 @@ if [ "$program" = "" ]; then
   echo "Error: no program name given  ('startdistproc -h' gives help)"
   exit 1
 fi
-if test "$dsn" = ""  -a  "$dirs" = ""; then
-  echo "Error: dataset name nor directories given (use -dsn or -dirs)"
-  exit 1
-fi
-if test "$dsn" != ""  -a  "$dirs" != ""; then
-  echo "Error: dataset name and directories given both (use -dsn or -dirs)"
+if test "$dsn" = ""; then
+  echo "Error: no dataset name given (use -dsn)"
   exit 1
 fi
 if test "$cdn" = ""; then
   echo "Error: no clusterdesc name given (use -cdn)"
   exit 1
 fi
-if test $startmaster = 0; then
-  if test $modxx = "mpi"  -a  $modxx = "single"; then
-    echo "Error: -nostartmaster cannot be used with mode=mpi or single"
-    exit 1
-  fi
+if test ! -f "$dsn"; then
+  echo "Error: dataset $dsn not found"
+  exit 1
 fi
 if test ! -f "$cdn"; then
   echo "Error: clusterdesc $cdn not found"
@@ -213,21 +172,7 @@ if test "$fdp" != ""; then
 fi
 
 # Prepend the hosts with the master and extra hosts.
-# Only give a master if it needs to be started.
-masterh=$master
-if test $startmaster = 0; then
-  masterh=
-fi
-# If a dataset name is given, find out where to process it.
-if test "$dsn" != ""; then
-  if test ! -f "$dsn"; then
-    echo "Error: dataset $dsn not found"
-    exit 1
-  fi
-  ${fdp}finddproc $dsn $cdn $masterh $extra > $hfn || exit 1
-else
-  ${fdp}finddproc -dirs "$dirs" $cdn $masterh $extra > $hfn || exit 1
-fi  
+${fdp}finddproc $dsn $cdn $master $extra > $hfn || exit 1
 np=`wc -l $hfn | awk '{print $1}'`
 
 # Run the program as needed.
@@ -244,7 +189,6 @@ elif test "$modxx" = "single"; then
     $program "$@" || exit 1
   fi
 else
-  echo "socketrun $dry $hfn '$master' $modxx $wait $logfile $program" "$@"
-  $pgmpath/socketrun $dry $hfn "$master" $modxx $wait "$logfile" $program "$@" || exit 1
+  echo "socketrun $dry $hfn $modxx $logfile $program" "$@"
+  $pgmpath/socketrun $dry $hfn $modxx "$logfile" $program "$@" || exit 1
 fi
-#rm -f $hfn
diff --git a/CEP/MWCommon/test/CMakeLists.txt b/CEP/MWCommon/test/CMakeLists.txt
new file mode 100644
index 00000000000..dcd0d1e73fb
--- /dev/null
+++ b/CEP/MWCommon/test/CMakeLists.txt
@@ -0,0 +1,31 @@
+#  $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
+
+include(LofarCTest)
+
+lofar_add_test(tClusterDesc tClusterDesc.cc)
+lofar_add_test(tNodeDesc tNodeDesc.cc)
+lofar_add_test(tVdsDesc tVdsDesc.cc)
+lofar_add_test(tVdsPartDesc tVdsPartDesc.cc)
+lofar_add_test(tWorkersDesc tWorkersDesc.cc)
+lofar_add_test(tSocketConnection tSocketConnection.cc)
+
+add_test(tfinddproc ${CMAKE_CURRENT_SOURCE_DIR}/tfinddproc.sh)
+add_test(tstartdproc ${CMAKE_CURRENT_SOURCE_DIR}/tstartdproc.sh)
diff --git a/CEP/Imager/MWCommon/test/Makefile.am b/CEP/MWCommon/test/Makefile.am
similarity index 100%
rename from CEP/Imager/MWCommon/test/Makefile.am
rename to CEP/MWCommon/test/Makefile.am
diff --git a/CEP/Imager/MWCommon/test/tClusterDesc.cc b/CEP/MWCommon/test/tClusterDesc.cc
similarity index 100%
rename from CEP/Imager/MWCommon/test/tClusterDesc.cc
rename to CEP/MWCommon/test/tClusterDesc.cc
diff --git a/CEP/Imager/MWCommon/test/tClusterDesc.parset b/CEP/MWCommon/test/tClusterDesc.parset
similarity index 100%
rename from CEP/Imager/MWCommon/test/tClusterDesc.parset
rename to CEP/MWCommon/test/tClusterDesc.parset
diff --git a/CEP/Imager/MWCommon/test/tClusterDesc.sh b/CEP/MWCommon/test/tClusterDesc.sh
similarity index 100%
rename from CEP/Imager/MWCommon/test/tClusterDesc.sh
rename to CEP/MWCommon/test/tClusterDesc.sh
diff --git a/CEP/Imager/MWCommon/test/tNodeDesc.cc b/CEP/MWCommon/test/tNodeDesc.cc
similarity index 100%
rename from CEP/Imager/MWCommon/test/tNodeDesc.cc
rename to CEP/MWCommon/test/tNodeDesc.cc
diff --git a/CEP/Imager/MWCommon/test/tNodeDesc.sh b/CEP/MWCommon/test/tNodeDesc.sh
similarity index 100%
rename from CEP/Imager/MWCommon/test/tNodeDesc.sh
rename to CEP/MWCommon/test/tNodeDesc.sh
diff --git a/CEP/Imager/MWCommon/test/tSocketConnection.cc b/CEP/MWCommon/test/tSocketConnection.cc
similarity index 100%
rename from CEP/Imager/MWCommon/test/tSocketConnection.cc
rename to CEP/MWCommon/test/tSocketConnection.cc
diff --git a/CEP/Imager/MWCommon/test/tSocketConnection.run b/CEP/MWCommon/test/tSocketConnection.run
similarity index 100%
rename from CEP/Imager/MWCommon/test/tSocketConnection.run
rename to CEP/MWCommon/test/tSocketConnection.run
diff --git a/CEP/Imager/MWCommon/test/tSocketConnection.sh b/CEP/MWCommon/test/tSocketConnection.sh
similarity index 100%
rename from CEP/Imager/MWCommon/test/tSocketConnection.sh
rename to CEP/MWCommon/test/tSocketConnection.sh
diff --git a/CEP/Imager/MWCommon/test/tSocketConnection.stdout b/CEP/MWCommon/test/tSocketConnection.stdout
similarity index 100%
rename from CEP/Imager/MWCommon/test/tSocketConnection.stdout
rename to CEP/MWCommon/test/tSocketConnection.stdout
diff --git a/CEP/Imager/MWCommon/test/tVdsDesc.cc b/CEP/MWCommon/test/tVdsDesc.cc
similarity index 100%
rename from CEP/Imager/MWCommon/test/tVdsDesc.cc
rename to CEP/MWCommon/test/tVdsDesc.cc
diff --git a/CEP/Imager/MWCommon/test/tVdsDesc.sh b/CEP/MWCommon/test/tVdsDesc.sh
similarity index 100%
rename from CEP/Imager/MWCommon/test/tVdsDesc.sh
rename to CEP/MWCommon/test/tVdsDesc.sh
diff --git a/CEP/Imager/MWCommon/test/tVdsPartDesc.cc b/CEP/MWCommon/test/tVdsPartDesc.cc
similarity index 96%
rename from CEP/Imager/MWCommon/test/tVdsPartDesc.cc
rename to CEP/MWCommon/test/tVdsPartDesc.cc
index 610e8203ebb..54a8f8186af 100644
--- a/CEP/Imager/MWCommon/test/tVdsPartDesc.cc
+++ b/CEP/MWCommon/test/tVdsPartDesc.cc
@@ -24,7 +24,6 @@ void check (const VdsPartDesc& vds, uint nTimes=0)
   ASSERT (vds.getName() == "/usr/local/xyx");
   ASSERT (vds.getFileName() == "/usr/local/abcd");
   ASSERT (vds.getFileSys() == "node1:/usr");
-  ASSERT (vds.getClusterDescName() == "/usr/local/cdesc.dat");
   ASSERT (vds.getStartTime() == 0.5);
   ASSERT (vds.getEndTime() == 1);
   ASSERT (vds.getStepTime() == 0.25);
@@ -61,7 +60,6 @@ void doIt()
   vds.setName ("/usr/local/abcd", "node1:/usr");
   ASSERT (vds.getFileName().empty());
   vds.setFileName ("/usr/local/abcd");
-  vds.setClusterDescName ("/usr/local/cdesc.dat");
   vds.changeBaseName ("xyx");
   vds.setTimes (0.5, 1, 0.25);
   vds.addBand (2, 20, 100);
diff --git a/CEP/Imager/MWCommon/test/tVdsPartDesc.sh b/CEP/MWCommon/test/tVdsPartDesc.sh
similarity index 100%
rename from CEP/Imager/MWCommon/test/tVdsPartDesc.sh
rename to CEP/MWCommon/test/tVdsPartDesc.sh
diff --git a/CEP/Imager/MWCommon/test/tWorkersDesc.cc b/CEP/MWCommon/test/tWorkersDesc.cc
similarity index 100%
rename from CEP/Imager/MWCommon/test/tWorkersDesc.cc
rename to CEP/MWCommon/test/tWorkersDesc.cc
diff --git a/CEP/Imager/MWCommon/test/tWorkersDesc.sh b/CEP/MWCommon/test/tWorkersDesc.sh
similarity index 100%
rename from CEP/Imager/MWCommon/test/tWorkersDesc.sh
rename to CEP/MWCommon/test/tWorkersDesc.sh
diff --git a/CEP/Imager/MWCommon/test/tfinddproc.in_cd b/CEP/MWCommon/test/tfinddproc.in_cd
similarity index 100%
rename from CEP/Imager/MWCommon/test/tfinddproc.in_cd
rename to CEP/MWCommon/test/tfinddproc.in_cd
diff --git a/CEP/Imager/MWCommon/test/tfinddproc.in_vd b/CEP/MWCommon/test/tfinddproc.in_vd
similarity index 76%
rename from CEP/Imager/MWCommon/test/tfinddproc.in_vd
rename to CEP/MWCommon/test/tfinddproc.in_vd
index 9a768cad51a..b09ba353480 100644
--- a/CEP/Imager/MWCommon/test/tfinddproc.in_vd
+++ b/CEP/MWCommon/test/tfinddproc.in_vd
@@ -8,8 +8,7 @@ StartFreqs = [20,120]
 EndFreqs = [100,300]
 NParts = 3
 
-Part0.Name = /usr/local/xyx0.vds
-Part0.FileName = /usr/local/xyx0
+Part0.Name = /usr/local/xyx0
 Part0.FileSys = node1:/usr
 Part0.StartTime = 0
 Part0.EndTime = 2
@@ -18,8 +17,7 @@ Part0.NChan = [64,128]
 Part0.StartFreqs = [20,120]
 Part0.EndFreqs = [100,300]
 
-Part1.Name = /usr/local/xyx1.vds
-Part1.FileName = /usr/local/xyx1
+Part1.Name = /usr/local/xyx1
 Part1.FileSys = node1:/usr
 Part1.StartTime = 0
 Part1.EndTime = 2
@@ -28,8 +26,7 @@ Part1.NChan = [64,128]
 Part1.StartFreqs = [20,120]
 Part1.EndFreqs = [100,300]
 
-Part2.Name = /usr/local/xyx2.vds
-Part2.FileName = /usr/local/xyx2
+Part2.Name = /usr/local/xyx2
 Part2.FileSys = node1:/usr
 Part2.StartTime = 0
 Part2.EndTime = 2
diff --git a/CEP/Imager/MWCommon/test/tfinddproc.run b/CEP/MWCommon/test/tfinddproc.run
similarity index 100%
rename from CEP/Imager/MWCommon/test/tfinddproc.run
rename to CEP/MWCommon/test/tfinddproc.run
diff --git a/CEP/Imager/MWCommon/test/tfinddproc.sh b/CEP/MWCommon/test/tfinddproc.sh
similarity index 100%
rename from CEP/Imager/MWCommon/test/tfinddproc.sh
rename to CEP/MWCommon/test/tfinddproc.sh
diff --git a/CEP/MWCommon/test/tfinddproc.stdout b/CEP/MWCommon/test/tfinddproc.stdout
new file mode 100644
index 00000000000..e7b773b4cdd
--- /dev/null
+++ b/CEP/MWCommon/test/tfinddproc.stdout
@@ -0,0 +1,3 @@
+node1#/usr/local/xyx0
+node2#/usr/local/xyx1
+node1#/usr/local/xyx2
diff --git a/CEP/Imager/MWCommon/test/tstartdproc.in_cd b/CEP/MWCommon/test/tstartdproc.in_cd
similarity index 100%
rename from CEP/Imager/MWCommon/test/tstartdproc.in_cd
rename to CEP/MWCommon/test/tstartdproc.in_cd
diff --git a/CEP/Imager/MWCommon/test/tstartdproc.in_vd b/CEP/MWCommon/test/tstartdproc.in_vd
similarity index 76%
rename from CEP/Imager/MWCommon/test/tstartdproc.in_vd
rename to CEP/MWCommon/test/tstartdproc.in_vd
index 9a768cad51a..b09ba353480 100644
--- a/CEP/Imager/MWCommon/test/tstartdproc.in_vd
+++ b/CEP/MWCommon/test/tstartdproc.in_vd
@@ -8,8 +8,7 @@ StartFreqs = [20,120]
 EndFreqs = [100,300]
 NParts = 3
 
-Part0.Name = /usr/local/xyx0.vds
-Part0.FileName = /usr/local/xyx0
+Part0.Name = /usr/local/xyx0
 Part0.FileSys = node1:/usr
 Part0.StartTime = 0
 Part0.EndTime = 2
@@ -18,8 +17,7 @@ Part0.NChan = [64,128]
 Part0.StartFreqs = [20,120]
 Part0.EndFreqs = [100,300]
 
-Part1.Name = /usr/local/xyx1.vds
-Part1.FileName = /usr/local/xyx1
+Part1.Name = /usr/local/xyx1
 Part1.FileSys = node1:/usr
 Part1.StartTime = 0
 Part1.EndTime = 2
@@ -28,8 +26,7 @@ Part1.NChan = [64,128]
 Part1.StartFreqs = [20,120]
 Part1.EndFreqs = [100,300]
 
-Part2.Name = /usr/local/xyx2.vds
-Part2.FileName = /usr/local/xyx2
+Part2.Name = /usr/local/xyx2
 Part2.FileSys = node1:/usr
 Part2.StartTime = 0
 Part2.EndTime = 2
diff --git a/CEP/Imager/MWCommon/test/tstartdproc.run b/CEP/MWCommon/test/tstartdproc.run
similarity index 100%
rename from CEP/Imager/MWCommon/test/tstartdproc.run
rename to CEP/MWCommon/test/tstartdproc.run
diff --git a/CEP/Imager/MWCommon/test/tstartdproc.sh b/CEP/MWCommon/test/tstartdproc.sh
similarity index 100%
rename from CEP/Imager/MWCommon/test/tstartdproc.sh
rename to CEP/MWCommon/test/tstartdproc.sh
diff --git a/CEP/MWCommon/test/tstartdproc.stdout b/CEP/MWCommon/test/tstartdproc.stdout
new file mode 100644
index 00000000000..1b8e2d3a244
--- /dev/null
+++ b/CEP/MWCommon/test/tstartdproc.stdout
@@ -0,0 +1,22 @@
+
+prog1 -arg a b
+localhost
+node1#/usr/local/xyx0
+node2#/usr/local/xyx1
+node1#/usr/local/xyx2
+
+mpirun -np 4 -machinefile tstartdproc_tmp.out2 prog1 -arg a b
+localhost
+node1
+node2
+node1
+
+socketrun 1 tstartdproc_tmp.out3 3851  prog1 -arg a b
+ssh localhost prog1 socket localhost 3851 4 0 localhost -arg a b
+ssh node1 prog1 socket localhost 3851 4 1 /usr/local/xyx0 -arg a b
+ssh node2 prog1 socket localhost 3851 4 2 /usr/local/xyx1 -arg a b
+ssh node1 prog1 socket localhost 3851 4 3 /usr/local/xyx2 -arg a b
+localhost
+node1#/usr/local/xyx0
+node2#/usr/local/xyx1
+node1#/usr/local/xyx2
diff --git a/CEP/ParmDB/CMakeLists.txt b/CEP/ParmDB/CMakeLists.txt
new file mode 100644
index 00000000000..83db508c14a
--- /dev/null
+++ b/CEP/ParmDB/CMakeLists.txt
@@ -0,0 +1,54 @@
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
+## Project characteristics
+## ---------------------------------------------------------------------------
+project(ParmDB)
+include(LofarGeneral)
+
+include(LofarAddPackage)
+lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS Common Blob)
+
+## ---------------------------------------------------------------------------
+## External packages
+## ---------------------------------------------------------------------------
+include(LofarFindPackage)
+lofar_find_package(Casacore COMPONENTS casa tables REQUIRED)
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(include/ParmDB)
+add_subdirectory(src)
+add_subdirectory(sql)
+add_subdirectory(test)
diff --git a/CEP/ParmDB/include/ParmDB/CMakeLists.txt b/CEP/ParmDB/include/ParmDB/CMakeLists.txt
new file mode 100644
index 00000000000..8e3136fe159
--- /dev/null
+++ b/CEP/ParmDB/include/ParmDB/CMakeLists.txt
@@ -0,0 +1,48 @@
+#  $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
+
+# List of header files that will be installed.
+set(inst_HEADERS
+  Package__Version.h
+  Axis.h
+  AxisMapping.h
+  Box.h
+  Grid.h
+  ParmValue.h
+  ParmSet.h
+  ParmMap.h
+  ParmCache.h
+  ParmDBMeta.h
+  ParmDB.h
+  ParmDBCasa.h
+  ParmDBLocker.h
+  Parm.h
+  ParmFacade.h
+  SourceInfo.h
+  SourceDB.h
+  SourceDBCasa.h)
+
+# Create symbolic link to include directory.
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink 
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_BINARY_DIR}/include/${PROJECT_NAME})
+
+# Install header files.
+install(FILES ${inst_HEADERS} DESTINATION include/${PROJECT_NAME})
diff --git a/CEP/ParmDB/src/CMakeLists.txt b/CEP/ParmDB/src/CMakeLists.txt
new file mode 100644
index 00000000000..f10d8cbd20b
--- /dev/null
+++ b/CEP/ParmDB/src/CMakeLists.txt
@@ -0,0 +1,50 @@
+#  $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
+
+include(LofarPackageVersion)
+
+set(parmdb_LIB_SRCS
+  Package__Version.cc
+  Axis.cc
+  AxisMapping.cc
+  Box.cc
+  Grid.cc
+  ParmValue.cc
+  ParmSet.cc
+  ParmMap.cc
+  ParmCache.cc
+  ParmDBMeta.cc
+  ParmDB.cc
+  ParmDBCasa.cc
+  ParmDBLocker.cc
+  Parm.cc ParmFacade.cc
+  SourceDB.cc
+  SourceDBCasa.cc)
+
+set(parmdb_PROGRAMS
+  versionparmdb
+  parmdb_main
+  makesourcedb)
+
+lofar_add_library(parmdb ${parmdb_LIB_SRCS})
+
+foreach(prog ${parmdb_PROGRAMS})
+  lofar_add_executable(${prog} ${prog}.cc)
+endforeach(prog ${parmdb_PROGRAMS})
diff --git a/CEP/ParmDB/test/CMakeLists.txt b/CEP/ParmDB/test/CMakeLists.txt
new file mode 100644
index 00000000000..2c92abd1ef0
--- /dev/null
+++ b/CEP/ParmDB/test/CMakeLists.txt
@@ -0,0 +1,36 @@
+#  $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
+
+include(LofarCTest)
+
+lofar_add_test(tAxis tAxis.cc)
+lofar_add_test(tAxisMapping tAxisMapping.cc)
+lofar_add_test(tBox tBox.cc)
+lofar_add_test(tGrid tGrid.cc)
+lofar_add_test(tParmCache tParmCache.cc)
+lofar_add_test(tParm tParm.cc)
+lofar_add_test(tParmDBCasa tParmDBCasa.cc)
+lofar_add_test(tParmFacade tParmFacade.cc)
+lofar_add_test(tParmSet tParmSet.cc)
+lofar_add_test(tParmValue tParmValue.cc)
+lofar_add_test(tSourceDBCasa tSourceDBCasa.cc)
+#lofar_add_test(tTimeAxis tTimeAxis.cc)
+add_test(tparmdb ${CMAKE_CURRENT_SOURCE_DIR}/tparmdb.sh)
+add_test(tmakesourcedb ${CMAKE_CURRENT_SOURCE_DIR}/tmakesourcedb.sh)
diff --git a/CEP/ParmDB/test/tParmFacade.run b/CEP/ParmDB/test/tParmFacade.run
index 31d79f8b311..04112c8154c 100755
--- a/CEP/ParmDB/test/tParmFacade.run
+++ b/CEP/ParmDB/test/tParmFacade.run
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-../src/parmdb <<EOF > tParmFacade_tmp.pdbout
+../src/parmdb_main <<EOF > tParmFacade_tmp.pdbout
  create tablename='tParmFacade_tmp.pdb'
  add parm1 domain=[1,4,5,10],values=2
  add parm2 type='polc', domain=[1,4,5,10], values=[2,0.1], nx=2
diff --git a/CMake/CMakeASM-BGPInformation.cmake b/CMake/CMakeASM-BGPInformation.cmake
new file mode 100644
index 00000000000..cdbfc37c3e7
--- /dev/null
+++ b/CMake/CMakeASM-BGPInformation.cmake
@@ -0,0 +1,32 @@
+#  $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
+
+## ---------------------------------------------------------------------------
+## Set all the assembler specific variables, like filename suffixes, compile
+## rules, etc. If necessary you can override the assembler specific variables
+## by setting them before including the generic file.
+##
+## See http://www.vtk.org/Wiki/CMake/Assembler for details.
+## ---------------------------------------------------------------------------
+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> -c -o <OBJECT> <SOURCE>")
+include(CMakeASMInformation)
+set(ASM_DIALECT)
diff --git a/CMake/CMakeDetermineASM-BGPCompiler.cmake b/CMake/CMakeDetermineASM-BGPCompiler.cmake
new file mode 100644
index 00000000000..a780f51cc50
--- /dev/null
+++ b/CMake/CMakeDetermineASM-BGPCompiler.cmake
@@ -0,0 +1,30 @@
+#  $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
+
+## ---------------------------------------------------------------------------
+## Determine the compiler to use for ASM using BGP syntax. Basically you just
+## set CMAKE_ASM-BGP_COMPILER to the name of the BGP assembler.
+##
+## See http://www.vtk.org/Wiki/CMake/Assembler for details
+## ---------------------------------------------------------------------------
+set(ASM_DIALECT "-BGP")
+set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ${CMAKE_ASM_COMPILER})
+include(CMakeDetermineASMCompiler)
+set(ASM_DIALECT)
diff --git a/CMake/CMakeSettings.cmake b/CMake/CMakeSettings.cmake
new file mode 100644
index 00000000000..3bddcf2a60c
--- /dev/null
+++ b/CMake/CMakeSettings.cmake
@@ -0,0 +1,39 @@
+#  $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
+
+## ----------------------------------------------------------------------------
+## Variables set by the global CMake settings module:
+##
+## ----------------------------------------------------------------------------
+
+#if(NOT LOFAR_CMAKE_CONFIG)
+
+  message(STATUS "**** ENTER: CMakeSettings.cmake ****")
+
+  set(LOFAR_CMAKE_CONFIG TRUE CACHE INTERNAL "LOFAR CMake config flag")
+
+  ## --------------------------------------------------------------------------
+  ## Several "Auto-tools variables" needed for backward compatibility
+  ## --------------------------------------------------------------------------
+  set(srcdir "${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL "srcdir")
+
+  message(STATUS "**** LEAVE: CMakeSettings.cmake ****")
+
+#endif(NOT LOFAR_CMAKE_CONFIG)
diff --git a/cmake/modules/LOFARTest.cmake b/CMake/CMakeTestASM-BGPCompiler.cmake
similarity index 73%
rename from cmake/modules/LOFARTest.cmake
rename to CMake/CMakeTestASM-BGPCompiler.cmake
index e744b1359b1..384e61b8593 100644
--- a/cmake/modules/LOFARTest.cmake
+++ b/CMake/CMakeTestASM-BGPCompiler.cmake
@@ -18,11 +18,13 @@
 #  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)
+## ---------------------------------------------------------------------------
+## Test whether the assembler works. This is not really possible. Instead it
+## just tests whether the assembler has been found, i.e. whether the variable
+## CMAKE_ASM-BGP_COMPILER has been set.
+##
+## See http://www.vtk.org/Wiki/CMake/Assembler for details
+## ---------------------------------------------------------------------------
+set(ASM_DIALECT "-BGP")
+include(CMakeTestASMCompiler)
+set(ASM_DIALECT)
diff --git a/CMake/FindBISON.cmake b/CMake/FindBISON.cmake
new file mode 100644
index 00000000000..2e786fed1cb
--- /dev/null
+++ b/CMake/FindBISON.cmake
@@ -0,0 +1,164 @@
+# - Find bison executable and provides macros to generate custom build rules
+# The module defined the following variables:
+#  BISON_EXECUTABLE - path to the bison program
+#  BISON_VERSION - version of bison
+#  BISON_FOUND - true if the program was found
+# If bison is found, the module defines the macros:
+#  BISON_TARGET(<Name> <YaccInput> <CodeOutput> [VERBOSE <file>]
+#              [COMPILE_FLAGS <string>])
+# which will create  a custom rule to generate  a parser. <YaccInput> is
+# the path to  a yacc file. <CodeOutput> is the name  of the source file
+# generated by bison.  A header file is also  be generated, and contains
+# the  token  list.  If  COMPILE_FLAGS  option is  specified,  the  next
+# parameter is  added in the bison  command line.  if  VERBOSE option is
+# specified, <file> is created  and contains verbose descriptions of the
+# grammar and parser. The macro defines a set of variables:
+#  BISON_${Name}_DEFINED - true is the macro ran successfully
+#  BISON_${Name}_INPUT - The input source file, an alias for <YaccInput>
+#  BISON_${Name}_OUTPUT_SOURCE - The source file generated by bison
+#  BISON_${Name}_OUTPUT_HEADER - The header file generated by bison
+#  BISON_${Name}_OUTPUTS - The sources files generated by bison
+#  BISON_${Name}_COMPILE_FLAGS - Options used in the bison command line
+#
+# Example:
+# FIND_PACKAGE(BISON)
+# BISON_TARGET(MyParser parser.y ${PROJECT_BINARY_DIR}/parser.cpp)
+# ADD_EXECUTABLE(Foo main.cpp ${BISON_MyParser_OUTPUTS})
+#
+
+# Copyright (c) 2006, Tristan Carel
+# All rights reserved.
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+#     * Redistributions of source code must retain the above copyright
+#       notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above copyright
+#       notice, this list of conditions and the following disclaimer in the
+#       documentation and/or other materials provided with the distribution.
+#     * Neither the name of the University of California, Berkeley nor the
+#       names of its contributors may be used to endorse or promote products
+#       derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# $Id::                                                                       $
+
+SET(BISON_FOUND FALSE)
+
+FIND_PROGRAM(BISON_EXECUTABLE bison DOC "path to the bison executable")
+MARK_AS_ADVANCED(BISON_EXECUTABLE)
+
+IF(BISON_EXECUTABLE)
+  SET(BISON_FOUND TRUE)
+
+  EXECUTE_PROCESS(COMMAND ${BISON_EXECUTABLE} --version
+    OUTPUT_VARIABLE BISON_version_output
+    ERROR_VARIABLE BISON_version_error
+    RESULT_VARIABLE BISON_version_result
+    OUTPUT_STRIP_TRAILING_WHITESPACE)
+  IF(NOT ${BISON_version_result} EQUAL 0)
+    MESSAGE(SEND_ERROR "Command \"${BISON_EXECUTABLE} --version\" failed with output:\n${BISON_version_error}")
+  ELSE(NOT ${BISON_version_result} EQUAL 0)
+    STRING(REGEX REPLACE "^bison \\(GNU Bison\\) ([^\n]+)\n.*" "\\1"
+      BISON_VERSION "${BISON_version_output}")
+  ENDIF(NOT ${BISON_version_result} EQUAL 0)
+
+  # internal macro
+  MACRO(BISON_TARGET_option_verbose Name BisonOutput filename)
+    LIST(APPEND BISON_TARGET_cmdopt "--verbose")
+    GET_FILENAME_COMPONENT(BISON_TARGET_output_path "${BisonOutput}" PATH)
+    GET_FILENAME_COMPONENT(BISON_TARGET_output_name "${BisonOutput}" NAME_WE)
+    ADD_CUSTOM_COMMAND(OUTPUT ${filename}
+      COMMAND ${CMAKE_COMMAND} -E copy
+      "${BISON_TARGET_output_path}/${BISON_TARGET_output_name}.output"
+      "${filename}"
+      DEPENDS
+      "${BISON_TARGET_output_path}/${BISON_TARGET_output_name}.output"
+      COMMENT "[BISON][${Name}] Copying bison verbose table to ${filename}"
+      WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+    SET(BISON_${Name}_VERBOSE_FILE ${filename})
+    LIST(APPEND BISON_TARGET_extraoutputs
+      "${BISON_TARGET_output_path}/${BISON_TARGET_output_name}.output")
+  ENDMACRO(BISON_TARGET_option_verbose)
+
+  # internal macro
+  MACRO(BISON_TARGET_option_extraopts Options)
+    SET(BISON_TARGET_extraopts "${Options}")
+    SEPARATE_ARGUMENTS(BISON_TARGET_extraopts)
+    LIST(APPEND BISON_TARGET_cmdopt ${BISON_TARGET_extraopts})
+  ENDMACRO(BISON_TARGET_option_extraopts)
+
+  MACRO(BISON_TARGET Name BisonInput BisonOutput)
+    SET(BISON_TARGET_output_header "")
+    SET(BISON_TARGET_command_opt "")
+    SET(BISON_TARGET_outputs "${BisonOutput}")
+    IF(NOT ${ARGC} EQUAL 3 AND NOT ${ARGC} EQUAL 5 AND NOT ${ARGC} EQUAL 7)
+      MESSAGE(SEND_ERROR "Usage")
+    ELSE(NOT ${ARGC} EQUAL 3 AND NOT ${ARGC} EQUAL 5 AND NOT ${ARGC} EQUAL 7)
+      # Parsing parameters
+      IF(${ARGC} GREATER 5 OR ${ARGC} EQUAL 5)
+	IF("${ARGV3}" STREQUAL "VERBOSE")
+	  BISON_TARGET_option_verbose(${Name} ${BisonOutput} "${ARGV4}")
+	ENDIF("${ARGV3}" STREQUAL "VERBOSE")
+	IF("${ARGV3}" STREQUAL "COMPILE_FLAGS")
+	  BISON_TARGET_option_extraopts("${ARGV4}")
+	ENDIF("${ARGV3}" STREQUAL "COMPILE_FLAGS")
+      ENDIF(${ARGC} GREATER 5 OR ${ARGC} EQUAL 5)
+      IF(${ARGC} EQUAL 7)
+	IF("${ARGV5}" STREQUAL "VERBOSE")
+	  BISON_TARGET_option_verbose(${Name} ${BisonOutput} "${ARGV6}")
+	ENDIF("${ARGV5}" STREQUAL "VERBOSE")
+	IF("${ARGV5}" STREQUAL "COMPILE_FLAGS")
+	  BISON_TARGET_option_extraopts("${ARGV6}")
+	ENDIF("${ARGV5}" STREQUAL "COMPILE_FLAGS")
+      ENDIF(${ARGC} EQUAL 7)
+
+      # Header's name generated by bison (see option -d)
+      LIST(APPEND BISON_TARGET_cmdopt "-d")
+      STRING(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\2" _fileext "${ARGV2}")
+      STRING(REPLACE "c" "h" _fileext ${_fileext})
+      STRING(REGEX REPLACE "^(.*)(\\.[^.]*)$" "\\1${_fileext}" 
+	BISON_${Name}_OUTPUT_HEADER "${ARGV2}")
+      LIST(APPEND BISON_TARGET_outputs "${BISON_${Name}_OUTPUT_HEADER}")
+
+      ADD_CUSTOM_COMMAND(OUTPUT ${BISON_TARGET_outputs}
+	${BISON_TARGET_extraoutputs}
+	COMMAND ${BISON_EXECUTABLE} ${BISON_TARGET_cmdopt} -o ${ARGV2} ${ARGV1}
+	DEPENDS ${ARGV1}
+	COMMENT "[BISON][${Name}] Building parser with bison ${BISON_VERSION}"
+	WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+
+      # define target variables
+      SET(BISON_${Name}_DEFINED TRUE)
+      SET(BISON_${Name}_INPUT ${ARGV1})
+      SET(BISON_${Name}_OUTPUTS ${BISON_TARGET_outputs})
+      SET(BISON_${Name}_COMPILE_FLAGS ${BISON_TARGET_cmdopt})
+      SET(BISON_${Name}_OUTPUT_SOURCE "${BisonOutput}")
+
+    ENDIF(NOT ${ARGC} EQUAL 3 AND NOT ${ARGC} EQUAL 5 AND NOT ${ARGC} EQUAL 7)
+  ENDMACRO(BISON_TARGET)
+
+ENDIF(BISON_EXECUTABLE)
+
+
+IF(NOT BISON_FOUND)
+  IF(NOT BISON_FIND_QUIETLY)
+    MESSAGE(STATUS "BISON was not found.")
+  ELSE(NOT BISON_FIND_QUIETLY)
+    IF(BISON_FIND_REQUIRED)
+      MESSAGE(FATAL_ERROR "BISON was not found.")
+    ENDIF(BISON_FIND_REQUIRED)
+  ENDIF(NOT BISON_FIND_QUIETLY)
+ENDIF(NOT BISON_FOUND)
+
+# FindBISON.cmake ends here
diff --git a/CMake/FindBacktrace.cmake b/CMake/FindBacktrace.cmake
new file mode 100644
index 00000000000..2d657c285fb
--- /dev/null
+++ b/CMake/FindBacktrace.cmake
@@ -0,0 +1,69 @@
+# $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
+
+
+# Check whether the C library provides support for backtrace information.
+# The backtrace() function provides you with stack frame return addresses. 
+# In order to translate these return addresses to filename, line number
+# and function name, we need support from the binutils:
+#   - libbfd contains functions to do the address translation
+#   - liberty contains a function to demangle C++ function names.
+#
+# The following variables are set:
+#   BACKTRACE_FOUND - system has backtrace support
+#   BACKTRACE_LIBRARIES - libraries needed for backtrace support
+
+include(CheckIncludeFile)
+include(CheckFunctionExists)
+include(CheckLibraryExists)
+include(FindPackageHandleStandardArgs)
+include(LofarMacros)
+
+if(NOT BACKTRACE_FOUND)
+  set(BACKTRACE_LIBRARIES)
+  check_include_file(execinfo.h HAVE_EXECINFO_H)
+  if(HAVE_EXECINFO_H)
+    check_function_exists(backtrace HAVE_BACKTRACE)
+    if(HAVE_BACKTRACE)
+      check_include_file(bfd.h HAVE_BFD_H)
+      if(HAVE_BFD_H)
+        find_library(BFD_LIBRARY bfd)
+        if(BFD_LIBRARY)
+          set(HAVE_BFD 1 CACHE INTERNAL "Have bfd library")
+          list(APPEND BACKTRACE_LIBRARIES ${BFD_LIBRARY})
+          check_include_file(demangle.h HAVE_DEMANGLE_H)
+          if(HAVE_DEMANGLE_H)
+            find_library(IBERTY_LIBRARY iberty)
+            set(CMAKE_REQUIRED_LIBRARIES ${IBERTY_LIBRARY})
+            check_function_exists(cplus_demangle HAVE_CPLUS_DEMANGLE)
+            if(HAVE_CPLUS_DEMANGLE)
+              list(APPEND BACKTRACE_LIBRARIES ${IBERTY_LIBRARY})
+            endif(HAVE_CPLUS_DEMANGLE)
+          endif(HAVE_DEMANGLE_H)
+        endif(BFD_LIBRARY)
+        # Newer version fo libbfd also depend on libz. We need to specify libz
+        # explicity when linking statically.
+        find_library(Z_LIBRARY z)
+        list_append_if(Z_LIBRARY BACKTRACE_LIBRARIES ${Z_LIBRARY})
+      endif(HAVE_BFD_H)
+    endif(HAVE_BACKTRACE)
+  endif(HAVE_EXECINFO_H)
+  find_package_handle_standard_args(Backtrace DEFAULT_MSG HAVE_BACKTRACE)
+endif(NOT BACKTRACE_FOUND)
diff --git a/CMake/FindCasacore.cmake b/CMake/FindCasacore.cmake
new file mode 100644
index 00000000000..7151b3cf5e5
--- /dev/null
+++ b/CMake/FindCasacore.cmake
@@ -0,0 +1,235 @@
+# $Id$
+#
+# - Try to find Casacore include dirs and libraries
+# Usage:
+#   find_package(Casacore [REQUIRED] [COMPONENTS components...])
+# Valid components are:
+#   casa, scimath_f, scimath, tables, measures, measures_f, lattices,
+#   fits, ms, coordinates, msfits, components, mirlib, images
+#
+# Note that most components are dependent on other (more basic) components.
+# In that case, it suffices to specify the "top-level" components; dependent
+# components will be searched for automatically.
+#
+# Here's the dependency tree:
+#   scimath_f    ->  casa
+#   scimath      ->  scimath_f
+#   tables       ->  casa
+#   measures     ->  scimath, tables
+#   measures_f   ->  scimath, tables
+#   lattices     ->  scimath, tables
+#   fits         ->  measures
+#   ms           ->  measures
+#   coordinates  ->  fits
+#   msfits       ->  fits, ms
+#   components   ->  coordinates
+#   images       ->  components, mirlib, lattices
+#
+# Variables defined by this module:
+#  CASACORE_FOUND            - System has Casacore, which means that the
+#                              include dir was found, as well as all 
+#                              libraries specified (not cached)
+#  CASACORE_INCLUDE_DIR      - Casacore include directory (cached)
+#  CASACORE_INCLUDE_DIRS     - Casacore include directories (not cached)
+#                              identical to CASACORE_INCLUDE_DIR
+#  CASACORE_LIBRARIES        - The Casacore libraries (not cached)
+#  CASA_${COMPONENT}_LIBRARY - The absolute path of Casacore library 
+#                              "component" (cached)
+#  HAVE_AIPSPP               - True if system has Casacore (cached)
+#                              for backward compatibility with AIPS++
+#  HAVE_CASACORE             - True if system has Casacore (cached)
+#                              identical to CASACORE_FOUND
+#
+# ATTENTION: The component names need to be in lower case, just as the
+# casacore library names. However, the CMake variables use all upper case.
+#
+#
+#  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
+
+
+# - casacore_resolve_dependencies(_result)
+#
+# Resolve the Casacore library dependencies for the given components. 
+# The list of dependent libraries will be returned in the variable result.
+# It is sorted from least dependent to most dependent library, so it can be
+# directly fed to the linker.
+#
+#   Usage: casacore_resolve_dependencies(result components...)
+#
+macro(casacore_resolve_dependencies _result)
+  set(${_result} ${ARGN})
+  set(_index 0)
+  # Do a breadth-first search through the dependency graph; append to the
+  # result list the dependent components for each item in that list. 
+  # Duplicates will be removed later.
+  while(1)
+    list(LENGTH ${_result} _length)
+    if(NOT _index LESS _length)
+      break()
+    endif(NOT _index LESS _length)
+    list(GET ${_result} ${_index} item)
+    list(APPEND ${_result} ${Casacore_${item}_DEPENDENCIES})
+    math(EXPR _index "${_index}+1")
+  endwhile(1)
+  # Remove all duplicates in the current result list, while retaining only the
+  # last of each duplicate.
+  list(REVERSE ${_result})
+  list(REMOVE_DUPLICATES ${_result})
+  list(REVERSE ${_result})
+endmacro(casacore_resolve_dependencies _result)
+
+
+# - casacore_find_library(_name)
+#
+# Search for the library ${_name}. 
+# If library is found, add it to CASACORE_LIBRARIES; if not, add ${_name}
+# to CASACORE_MISSING_COMPONENTS and set CASACORE_FOUND to false.
+#
+#   Usage: casacore_find_library(name)
+#
+macro(casacore_find_library _name)
+  string(TOUPPER ${_name} _NAME)
+  find_library(${_NAME}_LIBRARY ${_name})
+  mark_as_advanced(${_NAME}_LIBRARY)
+  if(${_NAME}_LIBRARY)
+    list(APPEND CASACORE_LIBRARIES ${${_NAME}_LIBRARY})
+  else(${_NAME}_LIBRARY)
+    set(CASACORE_FOUND FALSE)
+    list(APPEND CASACORE_MISSING_COMPONENTS ${_name})
+  endif(${_NAME}_LIBRARY)
+endmacro(casacore_find_library _name)
+
+
+# Define the Casacore components
+set(Casacore_components
+  casa
+  components
+  coordinates
+  fits
+  images
+  lattices
+  measures
+  measures_f
+  mirlib
+  ms
+  msfits
+  scimath
+  scimath_f
+  tables
+)
+
+# Define the Casacore library dependencies
+set(Casacore_components_DEPENDENCIES  coordinates)
+set(Casacore_coordinates_DEPENDENCIES fits)
+set(Casacore_fits_DEPENDENCIES        measures)
+set(Casacore_images_DEPENDENCIES      components lattices mirlib)
+set(Casacore_lattices_DEPENDENCIES    scimath tables)
+set(Casacore_measures_DEPENDENCIES    scimath tables)
+set(Casacore_measures_f_DEPENDENCIES  scimath tables)
+set(Casacore_ms_DEPENDENCIES          measures)
+set(Casacore_msfits_DEPENDENCIES      fits ms)
+set(Casacore_scimath_DEPENDENCIES     scimath_f)
+set(Casacore_scimath_f_DEPENDENCIES   casa)
+set(Casacore_tables_DEPENDENCIES      casa)
+
+# Initialize variables.
+set(CASACORE_FOUND FALSE)
+set(CASACORE_DEFINITIONS)
+set(CASACORE_LIBRARIES)
+set(CASACORE_MISSING_COMPONENTS)
+
+# If the user specified the root directory of the Casacore package, use it
+# when searching for header files and libraries.
+if(CASACORE_ROOT_DIR)
+  set(CMAKE_PREFIX_PATH ${CASACORE_ROOT_DIR})
+endif(CASACORE_ROOT_DIR)
+
+# Search for the header file first. We need to add "casacore" as path suffix,
+# because, by default, casacore installs the header files in
+# ${prefix}/include/casacore, instead of the more usual ${prefix}/include.
+if(NOT CASACORE_INCLUDE_DIR)
+  find_path(CASACORE_INCLUDE_DIR casa/aips.h PATH_SUFFIXES casacore)
+  mark_as_advanced(CASACORE_INCLUDE_DIR)
+endif(NOT CASACORE_INCLUDE_DIR)
+
+if(NOT CASACORE_INCLUDE_DIR)
+  set(CASACORE_ERROR_MESSAGE "Casacore: unable to find the header file casa/aips.h.\n   Please set CASACORE_ROOT_DIR to the root directory containing Casacore.")
+else(NOT CASACORE_INCLUDE_DIR)
+  # We've found the header file; let's continue.
+  set(CASACORE_FOUND TRUE)
+  set(CASACORE_INCLUDE_DIRS ${CASACORE_INCLUDE_DIR})
+
+  # If the user specified components explicity, use that list; otherwise we'll
+  # assume that the user wants to use all components.
+  if(NOT Casacore_FIND_COMPONENTS)
+    set(Casacore_FIND_COMPONENTS ${Casacore_components})
+  endif(NOT Casacore_FIND_COMPONENTS)
+
+  # Get a list of all dependent Casacore libraries that need to be found.
+  casacore_resolve_dependencies(find_components ${Casacore_FIND_COMPONENTS})
+
+  # Find the library for each component
+  foreach(component ${find_components})
+    casacore_find_library(casa_${component})
+  endforeach(component ${find_components})
+
+  # Skip this part (temporarily), because on bgfen neither lapack nor blas
+  # are installed.
+  if(0)
+  # Find required external packages.
+  # - scimath_f requires lapack/blas (which depend on gfortran)
+  list(FIND find_components scimath_f _found)
+  if(_found GREATER -1)
+    foreach(package lapack blas)# gfortran)
+      casacore_find_library(${package})
+    endforeach(package lapack blas)# gfortran)
+  endif(_found GREATER -1)
+  endif(0)
+
+  # - all casa components require math library
+  casacore_find_library(m)
+endif(NOT CASACORE_INCLUDE_DIR)
+
+# Set HAVE_CASACORE; and HAVE_AIPSPP (for backward compatibility with AIPS++).
+if(CASACORE_FOUND)
+  set(HAVE_CASACORE TRUE CACHE BOOL "Define if Casacore is installed")
+  set(HAVE_AIPSPP TRUE CACHE BOOL "Define if AIPS++/Casacore is installed")
+endif(CASACORE_FOUND)
+
+# Compose diagnostic message if not all necessary components were found.
+if(CASACORE_MISSING_COMPONENTS)
+  set(CASACORE_ERROR_MESSAGE "Casacore: the following components could not be found:\n     ${CASACORE_MISSING_COMPONENTS}")
+endif(CASACORE_MISSING_COMPONENTS)
+
+# Print diagnostics.
+if(CASACORE_FOUND)
+  if(NOT Casacore_FIND_QUIETLY)
+    message(STATUS "Found the following Casacore components: ")
+    foreach(comp ${find_components})
+      message(STATUS "  ${comp}")
+    endforeach(comp ${find_components})
+  endif(NOT Casacore_FIND_QUIETLY)
+else(CASACORE_FOUND)
+  if(Casacore_FIND_REQUIRED)
+    message(FATAL_ERROR "${CASACORE_ERROR_MESSAGE}")
+  else(Casacore_FIND_REQUIRED)
+    message(STATUS "${CASACORE_ERROR_MESSAGE}")
+  endif(Casacore_FIND_REQUIRED)
+endif(CASACORE_FOUND)
+
diff --git a/CMake/FindFFTW2.cmake b/CMake/FindFFTW2.cmake
new file mode 100644
index 00000000000..b527aa5c637
--- /dev/null
+++ b/CMake/FindFFTW2.cmake
@@ -0,0 +1,167 @@
+# $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
+
+# Try to find FFTW.
+#
+# Usage: find_package(FFTW [COMPONENTS [real] [double|single] [mpi|threads]])
+#
+# This will define:
+#  
+#  FFTW2_FOUND           - FFTW is present for the requested components.
+#  FFTW2_INCLUDE_DIR     - FFTW include directory for the requested components
+#                         (cached)
+#  FFTW2_INCLUDE_DIRS    - FFTW include directory 
+#                         (identical to FFTW2_INCLUDE_DIR)
+#  FFTW2_<YYY>_LIBRARY   - FFTW library for the requested component <YYY>
+#                         (cached)
+#  FFTW2_LIBRARIES       - FFTW libraries needed to when linking
+#
+#  FFTW2_PRECISION       - FFTW precision specified (double|single)
+#                         (cached internal)
+#  FFTW2_PARALLELIZATION - FFTW parallelization specified(off|mpi|threads)
+#                         (cached internal)
+
+set(_usage_msg 
+  "Usage: find_package(FFTW [COMPONENTS [real] [double|single] [mpi|threads]]")
+
+# -----------------------------------------------------------------------------
+# Get the optional `type' component: [real]. 
+# The output will be stored in the variable _fftw_type.
+# -----------------------------------------------------------------------------
+macro(get_fftw_type)
+  set(_fftw_type)
+  list(FIND FFTW2_FIND_COMPONENTS real _idx)
+  if(_idx GREATER -1)
+    set(_fftw_type real)
+  endif(_idx GREATER -1)
+endmacro(get_fftw_type)
+
+# -----------------------------------------------------------------------------
+# Get the optional component ${_kind}. Sensible values for ${_kind} are (at
+# the moment) precision, or parallelization.
+# The variable _options will contain the list of valid components for
+# ${_kind}; the first element of _options is used as default value, in case no
+# matching component could be found.
+# The output will be stored in the variable _fftw_${_kind}.
+#
+# It is an error if, between multiple calls of FindFFTW(), the currently
+# specified component value is different from the cached one.
+#
+# Usage: get_fftw_component(<kind> <default-option> [option] ...)
+# -----------------------------------------------------------------------------
+macro(get_fftw_component _kind)
+  set(_options ${ARGN})
+  if(_options)
+    list(GET _options 0 _default_option)
+  endif(_options)
+  set(_fftw_${_kind})
+  foreach(_opt ${_options})
+    list(FIND FFTW2_FIND_COMPONENTS ${_opt} _idx)
+    if(_idx GREATER -1)
+      if(NOT _fftw_${_kind})
+        set(_fftw_${_kind} ${_opt})
+      else(NOT _fftw_${_kind})
+        message(FATAL_ERROR
+          "FindFFTW: more than one `${_kind}' component was specified.\n"
+          "${_usage_msg}")
+      endif(NOT _fftw_${_kind})
+    endif(_idx GREATER -1)
+  endforeach(_opt ${_options})
+  if(NOT _fftw_${_kind})
+    set(_fftw_${_kind} "${_default_option}")
+  endif(NOT _fftw_${_kind})
+  string(TOUPPER "FFTW2_${_kind}" _cached_option)
+  if(DEFINED ${_cached_option})
+    if(NOT "${_fftw_${_kind}}" STREQUAL "${${_cached_option}}")
+      message(FATAL_ERROR
+        "FindFFTW: previous call used ${_kind} `${${_cached_option}}', "
+        "which is different from `${_fftw_${_kind}}'. This is not supported!")
+    endif(NOT "${_fftw_${_kind}}" STREQUAL "${${_cached_option}}")
+  endif(DEFINED ${_cached_option})
+endmacro(get_fftw_component _kind)
+
+# -----------------------------------------------------------------------------
+
+# Get FFTW type (optional: [real])
+get_fftw_type()
+
+# Get FFTW precision (optional: [double|single])
+get_fftw_component(precision double single)
+
+# Get FFTW parallelization (optional: [off|mpi|threads])
+get_fftw_component(parallelization off mpi threads)
+
+# This is the default: complex transforms
+set(_libraries fftw)
+set(_headerfile fftw.h)
+
+# The real transforms also require rfftw.h and -lrfftw; i.e. prefixed with 'r'.
+if(_fftw_type)
+  set(_headerfile rfftw.h)
+  set(_libraries rfftw ${_libraries})
+endif(_fftw_type)
+
+# Parallelization using mpi or threads also requires fftw_mpi.h and lfftw_mpi
+# or fftw_threads.h and -lfftw_threads.
+if(_fftw_parallelization)
+  set(_headerfile fftw_${_fftw_parallelization}.h)
+  set(_libraries fftw_${_fftw_parallelization} ${_libraries})
+  # And again, if using real transforms, also add the real transform headers
+  # and libraries.
+  if(_fftw_type)
+    set(_headerfile rfftw_${_fftw_parallelization}.h)
+    set(_libraries rfftw_${_fftw_parallelization} ${_libraries})
+  endif(_fftw_type)
+endif(_fftw_parallelization)
+
+# Some distributions choose to prefix the header files and libraries with
+# the precision: (s)ingle or (d)ouble.
+string(SUBSTRING ${_fftw_precision} 0 1 _prec)
+
+# Keep a list of variable names that we need to pass on to
+# find_package_handle_standard_args().
+set(_check_list)
+
+# Search for all required libraries.
+set(FFTW2_LIBRARIES)
+foreach(_lib ${_libraries})
+  string(TOUPPER ${_lib} _LIB)
+  find_library(${_LIB}_LIBRARY NAMES ${_prec}${_lib} ${_lib})
+  list(APPEND FFTW2_LIBRARIES ${${_LIB}_LIBRARY})
+  list(APPEND _check_list ${_LIB}_LIBRARY)
+endforeach(_lib ${_libraries})
+
+# Search for header file, with and without prefix.
+find_path(FFTW2_INCLUDE_DIR NAMES ${_prec}${_headerfile} ${_headerfile})
+list(APPEND _check_list FFTW2_INCLUDE_DIR)
+
+# Handle the QUIETLY and REQUIRED arguments and set FFTW2_FOUND to TRUE if
+# all listed variables are TRUE
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(FFTW2 DEFAULT_MSG ${_check_list})
+
+# If everything was found, put the following variables in the cache. We need
+# them to check if a second call to FindFFTW has conflicting options.
+if(FFTW2_FOUND)
+  set(FFTW2_PRECISION ${_fftw_precision} CACHE INTERNAL
+    "FFTW precision")
+  set(FFTW2_PARALLELIZATION ${_fftw_parallelization} CACHE INTERNAL
+    "FFTW parallelization")
+endif(FFTW2_FOUND)
diff --git a/CMake/FindFFTW3.cmake b/CMake/FindFFTW3.cmake
new file mode 100644
index 00000000000..bb38c4e70da
--- /dev/null
+++ b/CMake/FindFFTW3.cmake
@@ -0,0 +1,158 @@
+# $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
+
+# Try to find FFTW3.
+#
+# Usage: find_package(FFTW3 [COMPONENTS [double|single|long-double] [threads]])
+# This will define:
+#  
+#  FFTW3_FOUND        - system has FFTW3
+#  FFTW3_INCLUDE_DIR  - the FFTW3 include directory (cached)
+#  FFTW3_INCLUDE_DIRS - the FFTW3 include directories
+#                       (identical to FFTW3_INCLUDE_DIR)
+#  FFTW3_LIBRARY      - the FFTW3 library (cached)
+#  FFTW3_LIBRARIES    - the FFTW3 libraries
+#                       (identical to FFTW3_LIBRARY)
+
+set(_usage_msg
+  "Usage: find_package(FFTW3 [COMPONENTS [double|single|long-double]"
+  "[threads]])")
+
+# -----------------------------------------------------------------------------
+# Get the optional component _fftw3_${_kind}. Sensible values for _fftw3_${_kind}
+# are (at the moment) precision, or parallelization.
+# The variable _values will contain the list of valid components for
+# _fftw3_${_kind}; the first element of _values is used as default value, in case
+# no matching component could be found.
+# The output will be stored in the variable _fftw3_${_kind}.
+#
+# It is an error if, between multiple calls of FindFFTW3(), the currently
+# specified component value is different from the cached one.
+#
+# Usage: get_fftw3_component(<category> <default-value> [value] ...)
+# -----------------------------------------------------------------------------
+macro(get_fftw3_component _kind _default_value)
+  message(STATUS "_kind = ${_kind}")
+  set(_values ${ARGN})
+  set(_fftw3_${_kind})
+  foreach(_val ${_values})
+    list(FIND FFTW3_FIND_COMPONENTS ${_val} _idx)
+    if(_idx GREATER -1)
+      if(NOT _fftw3_${_kind})
+        set(_fftw3_${_kind} ${_val})
+      else(NOT _fftw3_${_kind})
+        message(FATAL_ERROR
+          "FindFFTW3: more than one `_fftw3_${_kind}' component was specified.\n"
+          "${_usage_msg}")
+      endif(NOT _fftw3_${_kind})
+    endif(_idx GREATER -1)
+  endforeach(_val ${_values})
+  if(NOT _fftw3_${_kind})
+    set(_fftw3_${_kind} "${_default_value}")
+  endif(NOT _fftw3_${_kind})
+  string(TOUPPER "FFTW3_${_kind}" _cached_value)
+  message(STATUS "_cached_value = ${_cached_value}")
+  if(DEFINED ${_cached_value})
+    message(STATUS "\"${_fftw3_${_kind}}\" STREQUAL \"${${_cached_value}}\"")
+    if(NOT "${_fftw3_${_kind}}" STREQUAL "${${_cached_value}}")
+      message(FATAL_ERROR
+        "FindFFTW3: previous call used ${_kind} `${${_cached_value}}', "
+        "which is different from `${_fftw3_${_kind}}'. This is not supported!")
+    endif(NOT "${_fftw3_${_kind}}" STREQUAL "${${_cached_value}}")
+  endif(DEFINED ${_cached_value})
+endmacro(get_fftw3_component _kind)
+
+# -----------------------------------------------------------------------------
+# get_fftw3_precision() 
+#
+# Return the precision `component' (single|double|long-double) in _precision.
+# Set the _precision_tag depending on the specified precision.
+# -----------------------------------------------------------------------------
+macro(get_fftw3_precision)
+  get_fftw3_component(precision double single long-double)
+  if(_precision MATCHES single)
+    set(_precision_tag f)
+  elseif(_precision MATCHES long-double)
+    set(_precision_tag l)
+  else()
+    set(_precision_tag)
+  endif(_precision MATCHES single)
+  message(STATUS "precision = ${precision}")
+endmacro(get_fftw3_precision)
+
+# -----------------------------------------------------------------------------
+# get_fftw3_parallelization()
+#
+# Return the parallelization `component' (off|threads) in _parallelization.
+# -----------------------------------------------------------------------------
+macro(get_fftw3_parallelization)
+  get_fftw3_component(parallelization off threads)
+  message(STATUS "parallelization = ${parallelization}")
+endmacro(get_fftw3_parallelization)
+
+# =============================================================================
+
+# Get the precision `component' (single|double|long-double)
+get_fftw3_precision()
+
+# Get the parallelization `component' (off|threads)
+get_fftw3_parallelization()
+
+# Set the default header and library file names.
+set(_libraries fftw3${_precision_tag})
+set(_headerfile fftw3.h)
+
+# Parallelization using threads also requires fftw3_threads library
+if(_fftw3_parallelization)
+  set(_libraries fftw3${_precision_tag}_${_fftw3_parallelization} ${_libraries})
+endif(_fftw3_parallelization)
+
+# Keep a list of variable names that we need to pass on to
+# find_package_handle_standard_args().
+set(_check_list)
+
+message(STATUS "_headerfile = ${_headerfile}")
+message(STATUS "_libraries = ${_libraries}")
+
+# Search for all required libraries.
+foreach(_lib ${_libraries})
+  string(TOUPPER ${_lib} _LIB)
+  find_library(${_LIB}_LIBRARY ${_lib})
+  list(APPEND FFTW3_LIBRARIES ${${_LIB}_LIBRARY})
+  list(APPEND _check_list ${_LIB}_LIBRARY)
+endforeach(_lib ${_libraries})
+
+# Search for the header file.
+find_path(FFTW3_INCLUDE_DIR fftw3.h)
+list(APPEND _check_list FFTW3_INCLUDE_DIR)
+
+# Handle the QUIETLY and REQUIRED arguments and set FFTW_FOUND to TRUE if
+# all listed variables are TRUE
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(FFTW3 DEFAULT_MSG ${_check_list})
+
+# If everything was found, put the following variables in the cache. We need
+# them to check if a second call to FindFFTW has conflicting options.
+if(FFTW3_FOUND)
+  set(FFTW3_PRECISION ${_fftw3_precision} CACHE INTERNAL
+    "FFTW precision")
+  set(FFTW3_PARALLELIZATION ${_fftw3_parallelization} CACHE INTERNAL
+    "FFTW parallelization")
+endif(FFTW3_FOUND)
diff --git a/CMake/FindFLEX.cmake b/CMake/FindFLEX.cmake
new file mode 100644
index 00000000000..eb226b5b84f
--- /dev/null
+++ b/CMake/FindFLEX.cmake
@@ -0,0 +1,134 @@
+# - Find flex executable and provides a macro to generate custom build rules
+# The module defines the following variables:
+#  FLEX_FOUND - true is flex executable is found
+#  FLEX_VERSION - the version of flex
+# If flex is found on the system, the module provides the macro:
+#  FLEX_TARGET(Name FlexInput FlexOutput [COMPILE_FLAGS <string>])
+# which creates a custom command  to generate the <FlexOutput> file from
+# the <FlexInput> file.  If  COMPILE_FLAGS option is specified, the next
+# parameter is added to the flex  command line. Name is an alias used to
+# get  details of  this custom  command.  Indeed the  macro defines  the
+# following variables:
+#  FLEX_${Name}_DEFINED - true is the macro ran successfully
+#  FLEX_${Name}_OUTPUTS - the source file generated by the custom rule, an
+#  alias for FlexOutput
+#  FLEX_${Name}_INPUT - the flex source file, an alias for ${FlexInput}
+#
+# Flex scanners oftenly use tokens  defined by Bison: the code generated
+# by Flex  depends of the header  generated by Bison.   This module also
+# defines a macro:
+#  ADD_FLEX_BISON_DEPENDENCY(FlexTarget BisonTarget)
+# which  adds the  required dependency  between a  scanner and  a parser
+# where  <FlexTarget>  and <BisonTarget>  are  the  first parameters  of
+# respectively FLEX_TARGET and BISON_TARGET macros.
+#
+# Example:
+#  FIND_PACKAGE(BISON)
+#  FIND_PACKAGE(FLEX)
+#  BISON_TARGET(MyParser parser.y ${PROJECT_BINARY_DIR}/parser.cpp
+#  FLEX_TARGET(MyScanner lexer.l ${PROJECT_BINARY_DIR}/lexer.cpp)
+#  ADD_FLEX_BISON_DEPENDENCY(MyScanner MyParser)
+#
+
+# Copyright (c) 2006, Tristan Carel
+# All rights reserved.
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+#     * Redistributions of source code must retain the above copyright
+#       notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above copyright
+#       notice, this list of conditions and the following disclaimer in the
+#       documentation and/or other materials provided with the distribution.
+#     * Neither the name of the University of California, Berkeley nor the
+#       names of its contributors may be used to endorse or promote products
+#       derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
+# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+# DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+# $Id::                                                                       $
+
+SET(FLEX_FOUND FALSE)
+
+FIND_PROGRAM(FLEX_EXECUTABLE flex DOC "path to the flex executable")
+MARK_AS_ADVANCED(FLEX_EXECUTABLE)
+
+FIND_LIBRARY(FL_LIBRARY NAMES fl
+  PATHS /usr/lib DOC "path to the fl library")
+SET(FLEX_LIBRARIES ${FL_LIBRARY})
+
+IF(FLEX_EXECUTABLE)
+  SET(FLEX_FOUND TRUE)
+
+  EXECUTE_PROCESS(COMMAND ${FLEX_EXECUTABLE} --version
+    OUTPUT_VARIABLE FLEX_version_output
+    ERROR_VARIABLE FLEX_version_error
+    RESULT_VARIABLE FLEX_version_result
+    OUTPUT_STRIP_TRAILING_WHITESPACE)
+  IF(NOT ${FLEX_version_result} EQUAL 0)
+    MESSAGE(SEND_ERROR "Command \"${FLEX_EXECUTABLE} --version\" failed with output:\n${FLEX_version_error}")
+  ELSE(NOT ${FLEX_version_result} EQUAL 0)
+    STRING(REGEX REPLACE "^flex (.*)$" "\\1"
+      FLEX_VERSION "${FLEX_version_output}")
+  ENDIF(NOT ${FLEX_version_result} EQUAL 0)
+
+  MACRO(FLEX_TARGET Name Input Output)
+    SET(FLEX_TARGET_usage "FLEX_TARGET(<Name> <Input> <Output> [COMPILE_FLAGS <string>]")
+    IF(${ARGC} GREATER 3)
+      IF(${ARGC} EQUAL 5)
+	IF("${ARGV3}" STREQUAL "COMPILE_FLAGS")
+	  SET(FLEX_EXECUTABLE_opts  "${ARGV4}")
+	  SEPARATE_ARGUMENTS(FLEX_EXECUTABLE_opts)
+	ELSE("${ARGV3}" STREQUAL "COMPILE_FLAGS")
+	  MESSAGE(SEND_ERROR ${FLEX_TARGET_usage})
+	ENDIF("${ARGV3}" STREQUAL "COMPILE_FLAGS")
+      ELSE(${ARGC} EQUAL 5)
+	MESSAGE(SEND_ERROR ${FLEX_TARGET_usage})
+      ENDIF(${ARGC} EQUAL 5)
+    ENDIF(${ARGC} GREATER 3)
+    ADD_CUSTOM_COMMAND(OUTPUT ${Output}
+      COMMAND ${FLEX_EXECUTABLE} ${FLEX_EXECUTABLE_opts} -o${Output} ${Input}
+      DEPENDS ${Input}
+      COMMENT "[FLEX][${Name}] Building scanner with flex ${FLEX_VERSION}"
+      WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
+
+    SET(FLEX_${Name}_DEFINED TRUE)
+    SET(FLEX_${Name}_OUTPUTS ${Output})
+    SET(FLEX_${Name}_INPUT ${Input})
+    SET(FLEX_${Name}_COMPILE_FLAGS ${FLEX_EXECUTABLE_opts})
+  ENDMACRO(FLEX_TARGET)
+
+  MACRO(ADD_FLEX_BISON_DEPENDENCY FlexTarget BisonTarget)
+    IF(NOT FLEX_${FlexTarget}_OUTPUTS)
+      MESSAGE(SEND_ERROR "Flex target `${FlexTarget}' does not exists.")
+    ENDIF(NOT FLEX_${FlexTarget}_OUTPUTS)
+    IF(NOT BISON_${BisonTarget}_OUTPUT_HEADER)
+      MESSAGE(SEND_ERROR "Bison target `${BisonTarget}' does not exists.")
+    ENDIF(NOT BISON_${BisonTarget}_OUTPUT_HEADER)
+
+    SET_SOURCE_FILES_PROPERTIES(${FLEX_${FlexTarget}_OUTPUTS}
+      PROPERTIES OBJECT_DEPENDS ${BISON_${BisonTarget}_OUTPUT_HEADER})
+  ENDMACRO(ADD_FLEX_BISON_DEPENDENCY)
+
+ENDIF(FLEX_EXECUTABLE)
+
+IF(NOT FLEX_FOUND)
+  IF(NOT FLEX_FIND_QUIETLY)
+    MESSAGE(STATUS "FLEX was not found.")
+  ELSE(NOT FLEX_FIND_QUIETLY)
+    IF(FLEX_FIND_REQUIRED)
+      MESSAGE(FATAL_ERROR "FLEX was not found.")
+    ENDIF(FLEX_FIND_REQUIRED)
+  ENDIF(NOT FLEX_FIND_QUIETLY)
+ENDIF(NOT FLEX_FOUND)
+
+# FindFLEX.cmake ends here
diff --git a/CMake/FindLog4Cplus.cmake b/CMake/FindLog4Cplus.cmake
new file mode 100644
index 00000000000..ad45c5c5860
--- /dev/null
+++ b/CMake/FindLog4Cplus.cmake
@@ -0,0 +1,46 @@
+# $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
+
+# Try to find Log4Cplus.
+#
+# This will define:
+#  
+#  LOG4CPLUS_FOUND        - system has Log4Cplus
+#  LOG4CPLUS_INCLUDE_DIR  - the Log4Cplus include directory (cached)
+#  LOG4CPLUS_INCLUDE_DIRS - the Log4Cplus include directories
+#                           (identical to LOG4CPLUS_INCLUDE_DIR)
+#  LOG4CPLUS_LIBRARY      - the Log4Cplus library (cached)
+#  LOG4CPLUS_LIBRARIES    - the Log4Cplus libraries
+#                           (identical to LOG4CPLUS_LIBRARY)
+
+if(NOT LOG4CPLUS_FOUND)
+
+  find_path(LOG4CPLUS_INCLUDE_DIR log4cplus/logger.h)
+  find_library(LOG4CPLUS_LIBRARY log4cplus)
+
+  include(FindPackageHandleStandardArgs)
+  set(custom_msg "Could NOT find Log4cplus in ${CMAKE_PREFIX_PATH}")
+  find_package_handle_standard_args(Log4Cplus "${custom_msg}"
+    LOG4CPLUS_LIBRARY LOG4CPLUS_INCLUDE_DIR)
+
+  set(LOG4CPLUS_INCLUDE_DIRS ${LOG4CPLUS_INCLUDE_DIR})
+  set(LOG4CPLUS_LIBRARIES ${LOG4CPLUS_LIBRARY})
+
+endif(NOT LOG4CPLUS_FOUND)
diff --git a/cmake/modules/FindMPI.cmake b/CMake/FindMPI.cmake
similarity index 92%
rename from cmake/modules/FindMPI.cmake
rename to CMake/FindMPI.cmake
index 03e95ef7149..23fba1ad61b 100644
--- a/cmake/modules/FindMPI.cmake
+++ b/CMake/FindMPI.cmake
@@ -123,6 +123,13 @@ elseif (MPI_COMPILER)
   else (MPI_COMPILER_RETURN EQUAL 0)
     message(STATUS "Unable to determine MPI from MPI driver ${MPI_COMPILER}")
   endif (MPI_COMPILER_RETURN EQUAL 0)
+
+  # In order to prevent spurious matches of -D<var>, -I<path>, -L<path>,
+  # -l<lib>, and -Wl,<opts> (issue #9093), we should match against "^ -D",
+  # instead of "-D", etc. Make sure we don't miss the first argument by
+  # prepending a space to the command line.
+  set(MPI_COMPILE_CMDLINE " ${MPI_COMPILE_CMDLINE}")
+  set(MPI_LINK_CMDLINE " ${MPI_LINK_CMDLINE}")
 endif (MPI_INCLUDE_PATH AND MPI_LIBRARY)
 
 if (MPI_INCLUDE_PATH AND MPI_LIBRARY)
@@ -130,7 +137,7 @@ if (MPI_INCLUDE_PATH AND MPI_LIBRARY)
   # 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}")
+  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)
@@ -141,10 +148,10 @@ elseif (MPI_COMPILE_CMDLINE)
   endforeach(FLAG)
 
   # Extract include paths from compile command line
-  string(REGEX MATCHALL "-I([^\" ]+|\"[^\"]+\")" MPI_ALL_INCLUDE_PATHS "${MPI_COMPILE_CMDLINE}")
+  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 "^ -I" "" IPATH ${IPATH})
     string(REGEX REPLACE "//" "/" IPATH ${IPATH})
     list(APPEND MPI_INCLUDE_PATH_WORK ${IPATH})
   endforeach(IPATH)
@@ -169,10 +176,10 @@ elseif (MPI_COMPILE_CMDLINE)
   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}")
+  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 "^ -L" "" LPATH ${LPATH})
     string(REGEX REPLACE "//" "/" LPATH ${LPATH})
     list(APPEND MPI_LINK_PATH ${LPATH})
   endforeach(LPATH)
@@ -190,7 +197,7 @@ elseif (MPI_COMPILE_CMDLINE)
   endif (NOT MPI_LINK_PATH)
 
   # Extract linker flags from the link command line
-  string(REGEX MATCHALL "-Wl,([^\" ]+|\"[^\"]+\")" MPI_ALL_LINK_FLAGS "${MPI_LINK_CMDLINE}")
+  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)
@@ -202,13 +209,13 @@ elseif (MPI_COMPILE_CMDLINE)
 
   # Extract the set of libraries to link against from the link command
   # line
-  string(REGEX MATCHALL "-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}")
+  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})
+    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)
diff --git a/CMake/FindPQXX.cmake b/CMake/FindPQXX.cmake
new file mode 100644
index 00000000000..f79a656e219
--- /dev/null
+++ b/CMake/FindPQXX.cmake
@@ -0,0 +1,47 @@
+# $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
+
+# Try to find libpqxx: the official C++ client API for PostgreSQL
+#
+# This will define:
+#  
+#  PQXX_FOUND        - system has PQXX
+#  PQXX_INCLUDE_DIR  - the PQXX include directory (cached)
+#  PQXX_INCLUDE_DIRS - the PQXX include directories 
+#                      (identical to PQXX_INCLUDE_DIR)
+#  PQXX_LIBRARY      - the PQXX library (cached)
+#  PQXX_LIBRARIES    - the PQXX libraries
+#                      (identical to PQXX_LIBRARY)
+
+if(NOT PQXX_FOUND)
+
+  find_path(PQXX_INCLUDE_DIR pqxx/pqxx)
+  find_library(PQXX_LIBRARY pqxx)
+  find_library(PQ_LIBRARY pq)
+
+  include(FindPackageHandleStandardArgs)
+  set(custom_msg "Could NOT find PQXX in ${CMAKE_PREFIX_PATH}")
+  find_package_handle_standard_args(PQXX "${custom_msg}"
+    PQXX_LIBRARY PQ_LIBRARY PQXX_INCLUDE_DIR)
+
+  set(PQXX_INCLUDE_DIRS ${PQXX_INCLUDE_DIR})
+  set(PQXX_LIBRARIES ${PQXX_LIBRARY} ${PQ_LIBRARY})
+
+endif(NOT PQXX_FOUND)
diff --git a/CMake/FindPackageHandleStandardArgs.cmake b/CMake/FindPackageHandleStandardArgs.cmake
new file mode 100644
index 00000000000..cda1d640f17
--- /dev/null
+++ b/CMake/FindPackageHandleStandardArgs.cmake
@@ -0,0 +1,65 @@
+# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME (DEFAULT_MSG|"Custom failure message") VAR1 ... )
+#    This macro is intended to be used in FindXXX.cmake modules files.
+#    It handles the REQUIRED and QUIET argument to FIND_PACKAGE() and
+#    it also sets the <UPPERCASED_NAME>_FOUND variable.
+#    The package is found if all variables listed are TRUE.
+#    Example:
+#
+#    FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR)
+#
+#    LibXml2 is considered to be found, if both LIBXML2_LIBRARIES and 
+#    LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to TRUE.
+#    If it is not found and REQUIRED was used, it fails with FATAL_ERROR, 
+#    independent whether QUIET was used or not.
+#    If it is found, the location is reported using the VAR1 argument, so 
+#    here a message "Found LibXml2: /usr/lib/libxml2.so" will be printed out.
+#    If the second argument is DEFAULT_MSG, the message in the failure case will 
+#    be "Could NOT find LibXml2", if you don't like this message you can specify
+#    your own custom failure message there.
+
+INCLUDE(FindPackageMessage)
+FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FAIL_MSG _VAR1 )
+
+  SET(ARGS)
+  FOREACH(_ARG ${_VAR1} ${ARGN})
+    LIST(APPEND ARGS ${${_ARG}})
+  ENDFOREACH(_ARG)
+
+  IF("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
+    SET(_FAIL_MESSAGE "Could NOT find ${_NAME}")
+  ELSE("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
+    SET(_FAIL_MESSAGE "${_FAIL_MSG}")
+  ENDIF("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
+
+  STRING(TOUPPER ${_NAME} _NAME_UPPER)
+
+  # Check if all passed variables are valid. 
+  # Collect all variables which were not found, so they can be printed, so the 
+  # user knows better what went wrong (#6375)
+  SET(MISSING_VARS "")
+  SET(DETAILS "")
+  SET(${_NAME_UPPER}_FOUND TRUE)
+  FOREACH(_CURRENT_VAR ${ARGS})
+    IF(NOT _CURRENT_VAR)
+      SET(${_NAME_UPPER}_FOUND FALSE)
+      SET(MISSING_VARS "${MISSING_VARS} ${_CURRENT_VAR}")
+    ELSE(NOT _CURRENT_VAR)
+      SET(DETAILS "${DETAILS}[${_CURRENT_VAR}]")
+    ENDIF(NOT _CURRENT_VAR)
+  ENDFOREACH(_CURRENT_VAR)
+
+  IF (${_NAME_UPPER}_FOUND)
+    FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${ARGS}" "${DETAILS}")
+  ELSE (${_NAME_UPPER}_FOUND)
+    IF (${_NAME}_FIND_REQUIRED)
+        MESSAGE(FATAL_ERROR "${_FAIL_MESSAGE} (missing: ${MISSING_VARS})")
+    ELSE (${_NAME}_FIND_REQUIRED)
+      IF (NOT ${_NAME}_FIND_QUIETLY)
+        MESSAGE(STATUS "${_FAIL_MESSAGE}  (missing: ${MISSING_VARS})")
+      ENDIF (NOT ${_NAME}_FIND_QUIETLY)
+    ENDIF (${_NAME}_FIND_REQUIRED)
+  ENDIF (${_NAME_UPPER}_FOUND)
+
+  SET(${_NAME_UPPER}_FOUND ${${_NAME_UPPER}_FOUND} PARENT_SCOPE)
+
+ENDFUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS)
diff --git a/CMake/FindPthreads.cmake b/CMake/FindPthreads.cmake
new file mode 100644
index 00000000000..d9426d48733
--- /dev/null
+++ b/CMake/FindPthreads.cmake
@@ -0,0 +1,98 @@
+# - Find the Pthreads library
+# This module searches for the Pthreads library (including the
+# pthreads-win32 port).
+#
+# This module defines these variables:
+#
+#  PTHREADS_FOUND
+#      True if the Pthreads library was found
+#  PTHREADS_LIBRARY
+#      The location of the Pthreads library
+#  PTHREADS_INCLUDE_DIR
+#      The include path of the Pthreads library
+#  PTHREADS_DEFINITIONS
+#      Preprocessor definitions to define
+#
+# This module responds to the PTHREADS_EXCEPTION_SCHEME
+# variable on Win32 to allow the user to control the
+# library linked against.  The Pthreads-win32 port
+# provides the ability to link against a version of the
+# library with exception handling.  IT IS NOT RECOMMENDED
+# THAT YOU USE THIS because most POSIX thread implementations
+# do not support stack unwinding.
+#
+#  PTHREADS_EXCEPTION_SCHEME
+#      C  = no exceptions (default)
+#         (NOTE: This is the default scheme on most POSIX thread
+#          implementations and what you should probably be using)
+#      CE = C++ Exception Handling
+#      SE = Structure Exception Handling (MSVC only)
+#
+
+#
+# Define a default exception scheme to link against
+# and validate user choice.
+#
+IF(NOT DEFINED PTHREADS_EXCEPTION_SCHEME)
+    # Assign default if needed
+    SET(PTHREADS_EXCEPTION_SCHEME "C")
+ELSE(NOT DEFINED PTHREADS_EXCEPTION_SCHEME)
+    # Validate
+    IF(NOT PTHREADS_EXCEPTION_SCHEME STREQUAL "C" AND
+       NOT PTHREADS_EXCEPTION_SCHEME STREQUAL "CE" AND
+       NOT PTHREADS_EXCEPTION_SCHEME STREQUAL "SE")
+
+    MESSAGE(FATAL_ERROR "See documentation for FindPthreads.cmake, only C, CE, and SE modes are allowed")
+
+    ENDIF(NOT PTHREADS_EXCEPTION_SCHEME STREQUAL "C" AND
+          NOT PTHREADS_EXCEPTION_SCHEME STREQUAL "CE" AND
+          NOT PTHREADS_EXCEPTION_SCHEME STREQUAL "SE")
+
+     IF(NOT MSVC AND PTHREADS_EXCEPTION_SCHEME STREQUAL "SE")
+         MESSAGE(FATAL_ERROR "Structured Exception Handling is only allowed for MSVC")
+     ENDIF(NOT MSVC AND PTHREADS_EXCEPTION_SCHEME STREQUAL "SE")
+
+ENDIF(NOT DEFINED PTHREADS_EXCEPTION_SCHEME)
+
+#
+# Find the header file
+#
+FIND_PATH(PTHREADS_INCLUDE_DIR pthread.h)
+
+#
+# Find the library
+#
+SET(names)
+IF(MSVC)
+    SET(names
+            pthreadV${PTHREADS_EXCEPTION_SCHEME}2
+            pthread
+    )
+ELSEIF(MINGW)
+    SET(names
+            pthreadG${PTHREADS_EXCEPTION_SCHEME}2
+            pthread
+    )
+ELSE(MSVC) # Unix / Cygwin / Apple
+    SET(names pthread)
+ENDIF(MSVC)
+    
+FIND_LIBRARY(PTHREADS_LIBRARY ${names}
+    DOC "The Portable Threads Library")
+
+IF(PTHREADS_INCLUDE_DIR AND PTHREADS_LIBRARY)
+    SET(PTHREADS_FOUND true)
+    SET(PTHREADS_DEFINITIONS -DHAVE_PTHREAD_H)
+    SET(PTHREADS_INCLUDE_DIRS ${PTHREADS_INCLUDE_DIR})
+    SET(PTHREADS_LIBRARIES    ${PTHREADS_LIBRARY})
+ENDIF(PTHREADS_INCLUDE_DIR AND PTHREADS_LIBRARY)
+
+IF(PTHREADS_FOUND)
+    IF(NOT PTHREADS_FIND_QUIETLY)
+        MESSAGE(STATUS "Found Pthreads: ${PTHREADS_LIBRARY}")
+    ENDIF(NOT PTHREADS_FIND_QUIETLY)
+ELSE(PTHREADS_FOUND) 
+    IF(PTHREADS_FIND_REQUIRED)
+        MESSAGE(FATAL_ERROR "Could not find the Pthreads Library")
+    ENDIF(PTHREADS_FIND_REQUIRED)
+ENDIF(PTHREADS_FOUND)
diff --git a/CMake/JoinArguments.cmake b/CMake/JoinArguments.cmake
new file mode 100644
index 00000000000..78454581cda
--- /dev/null
+++ b/CMake/JoinArguments.cmake
@@ -0,0 +1,8 @@
+macro(join_arguments var)
+  set(_var)
+  foreach(_v ${${var}})
+    set(_var "${_var} ${_v}")
+  endforeach(_v ${${var}})
+  string(STRIP ${_var} _var)
+  set(${var} ${_var})
+endmacro(join_arguments)
diff --git a/CMake/LofarAddPackage.cmake b/CMake/LofarAddPackage.cmake
new file mode 100644
index 00000000000..654138872be
--- /dev/null
+++ b/CMake/LofarAddPackage.cmake
@@ -0,0 +1,101 @@
+#  $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
+
+# --------------------------------------------------------------------------
+# lofar_add_package(<name> [version] [DEPENDS <depend> [depend] ...])
+#
+# Add a LOFAR package. 
+#
+# This function performs the following actions:
+# - Create a custom target for package <name>, using add_custom_target().
+# - Create dependencies for this custom target, using add_dependencies().
+# - If package <name> has dependencies, then, for each dependency:
+#   - add the list of include directories to that of package <name>.
+#
+# This function sets the following variables in the parent scope:
+#   ${name}_VERSION       Version number of package <name>
+#   ${name}_DEPENDENCIES  List of packages that package <name> depends on.
+#
+# --------------------------------------------------------------------------
+function(lofar_add_package _name)
+
+  set(_errmsg 
+    "Wrong arguments supplied to lofar_add_package().\n"
+    "Usage: lofar_add_package(name [version] [DEPENDS depend ...])\n")
+
+  # Print message to console if configuring verbose.
+  if(LOFAR_VERBOSE_CONFIGURE)
+    message(STATUS "Adding package ${_name}...")
+  endif(LOFAR_VERBOSE_CONFIGURE)
+
+  # If arguments were given, then the first could be a version number.
+  if(ARGC GREATER 1)
+    list(GET ARGV 1 _version)
+    string(REGEX MATCH "^[0-9]+(\\.[0-9]+)*$" _version ${_version})
+  endif(ARGC GREATER 1)
+  
+  # If two arguments were given, then the second must be a version number.
+  if(ARGC EQUAL 2 AND NOT _version)
+    message(FATAL_ERROR ${_errmsg})
+  endif(ARGC EQUAL 2 AND NOT _version)
+
+  # If more than two arguments were given, then search for the DEPENDS
+  # keyword, which must be present.
+  if(ARGC GREATER 2)
+    list(FIND ARGV DEPENDS _idx)
+    if(_idx EQUAL -1)
+      message(FATAL_ERROR ${_errmsg})
+    endif(_idx EQUAL -1)
+    # Let _idx point to the first argument of DEPENDS
+    math(EXPR _idx "${_idx}+1")
+    if(NOT _idx LESS ARGC)
+      # Missing arguments after DEPENDS
+      message(FATAL_ERROR ${_errmsg})
+    endif(NOT _idx LESS ARGC)
+    # Add dependencies to the dependency list
+    while(_idx LESS ARGC)
+      list(GET ARGV ${_idx} _dep)
+      list(APPEND _dependencies ${_dep})
+      math(EXPR _idx "${_idx}+1")
+    endwhile(_idx LESS ARGC)
+  endif(ARGC GREATER 2)
+
+  # Create a custom target for package <name>.
+  add_custom_target(${_name})
+
+  # For each package <pkg> that this package depends on:
+  # - add a dependency of package <name> on package <pkg>
+  # - add the list of include directories of <pkg> to that of package <name>
+  foreach(_dep ${_dependencies})
+    get_directory_property(_dirs 
+      DIRECTORY ${${_dep}_SOURCE_DIR} INCLUDE_DIRECTORIES)
+    add_dependencies(${_name} ${_dep})
+#    message(STATUS "set(BUILD_${_dep} TRUE CACHE BOOL \"Build ${_dep}?\"")
+#    set(BUILD_${_dep} TRUE CACHE BOOL "Build ${_dep}?")
+    include_directories(${_dirs})
+  endforeach(_dep ${_dependencies})
+
+  # Export variables to the parent scope
+  set(LOFAR_PACKAGE_NAME ${_name} PARENT_SCOPE)
+  set(${_name}_VERSION ${_version} PARENT_SCOPE)
+  set(${_name}_DEPENDENCIES ${_dependencies} PARENT_SCOPE)
+
+endfunction(lofar_add_package _name)
+  
diff --git a/CMake/LofarCTest.cmake b/CMake/LofarCTest.cmake
new file mode 100644
index 00000000000..78fe25d5ba7
--- /dev/null
+++ b/CMake/LofarCTest.cmake
@@ -0,0 +1,37 @@
+#  $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
+
+#include(LofarAddCheck)
+
+## --------------------------------------------------------------------------
+## "Auto-tools variable" needed for backward compatibility
+## --------------------------------------------------------------------------
+set(srcdir "${CMAKE_CURRENT_SOURCE_DIR}")
+
+## --------------------------------------------------------------------------
+## Add current source directory to compiler's include path
+## --------------------------------------------------------------------------
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+
+## ----------------------------------------------------------------------------
+## Configure the LOFAR CTest wrapper script in the current binary directory
+## ----------------------------------------------------------------------------
+configure_file(${LOFAR_ROOT}/autoconf_share/runctest.sh
+               ${CMAKE_CURRENT_BINARY_DIR}/runctest.sh)
diff --git a/CMake/LofarConf.cmake b/CMake/LofarConf.cmake
new file mode 100644
index 00000000000..a25937b48cd
--- /dev/null
+++ b/CMake/LofarConf.cmake
@@ -0,0 +1,40 @@
+#  LofarConf.cmake: global configurations for LOFAR builds.
+#
+#  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
+#
+#  $Id$
+
+message(STATUS "**** ENTER: LofarConf.cmake ****")
+
+## ----------------------------------------------------------------------------
+## Includes
+## ----------------------------------------------------------------------------
+
+include(LofarInit)
+include(LofarGeneral)
+include(LofarOptions)
+
+
+message(STATUS "[LofarConf] CMAKE_C_COMPILER = ${CMAKE_C_COMPILER}")
+message(STATUS "[LofarConf] CMAKE_CXX_COMPILER = ${CMAKE_CXX_COMPILER}")
+message(STATUS "[LofarConf] CMAKE_FORTRAN_COMPILER = ${CMAKE_FORTRAN_COMPILER}")
+message(STATUS "[LofarConf] CMAKE_CXX_FLAGS_DEBUG = ${CMAKE_CXX_FLAGS_DEBUG}")
+message(STATUS "[LofarConf] CMAKE_CXX_FLAGS_RELEASE = ${CMAKE_CXX_FLAGS_RELEASE}")
+
+message(STATUS "**** LEAVE: LofarConf.cmake ****")
diff --git a/CMake/LofarConfig.cmake b/CMake/LofarConfig.cmake
new file mode 100644
index 00000000000..91f640a4faa
--- /dev/null
+++ b/CMake/LofarConfig.cmake
@@ -0,0 +1,35 @@
+#  $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 header containing global configurations for LOFAR builds. 
+# We should only do this when we're at the top-level source directory.
+if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
+  message(STATUS "Generating lofar_config.h ...")
+  configure_file(
+    ${CMAKE_SOURCE_DIR}/lofar_config.h.cmake
+    ${CMAKE_BINARY_DIR}/include/lofar_config.h)
+endif(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
+
+# Set LOFAR Logger package name to the current project
+string(REGEX REPLACE "^${LOFAR_ROOT}" "" _pkg "${PROJECT_SOURCE_DIR}")
+string(REGEX REPLACE "^/" "" _pkg "${_pkg}")
+string(REPLACE "/" "." _pkg "${_pkg}")
+add_definitions(-DLOFARLOGGER_PACKAGE="${_pkg}")
diff --git a/CMake/LofarFindPackage.cmake b/CMake/LofarFindPackage.cmake
new file mode 100644
index 00000000000..6bd1ced50be
--- /dev/null
+++ b/CMake/LofarFindPackage.cmake
@@ -0,0 +1,81 @@
+#  LofarFindPackage.cmake: 
+#
+#  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
+#
+#  $Id$
+
+## ----------------------------------------------------------------------------
+## Includes
+## ----------------------------------------------------------------------------
+include(LofarSearchPath)
+include(FindPackageHandleStandardArgs)
+
+## ----------------------------------------------------------------------------
+## function lofar_find_package
+## ----------------------------------------------------------------------------
+function(lofar_find_package _package)
+
+  string(TOLOWER ${_package} _pkg)
+  string(TOUPPER ${_package} _PKG)
+
+  if(NOT ${_PKG}_FOUND)
+
+    # Set CMAKE_PREFIX_PATH; used by the find_xxx() commands for searching.
+    if(DEFINED ${_PKG}_PREFIX_PATH)
+      set(CMAKE_PREFIX_PATH ${${_PKG}_PREFIX_PATH})
+    else(DEFINED ${_PKG}_PREFIX_PATH)
+      lofar_search_path(_prefix_path ${_pkg})
+      set(CMAKE_PREFIX_PATH ${_prefix_path})
+    endif(DEFINED ${_PKG}_PREFIX_PATH)
+
+    # If package has been disabled explicitly, but is required, raise an
+    # error.
+    if(DEFINED USE_${_PKG} AND NOT USE_${_PKG})
+      list(FIND ARGN REQUIRED is_required)
+      if(is_required GREATER -1)
+        message(SEND_ERROR 
+          "Package ${_package} is required, but has been disabled explicitly!")
+      endif(is_required GREATER -1)
+    endif(DEFINED USE_${_PKG} AND NOT USE_${_PKG})
+
+    # Use the Find${_package}.cmake module.
+    find_package(${ARGV})
+
+    # Define an all-uppercase variable for each mixed-case variable we're
+    # interested in. This is a clumsy hack for modules like FindBoost.cmake
+    foreach(_var INCLUDE_DIRS LIBRARIES DEFINITIONS ROOT_DIR FOUND)
+      if(DEFINED ${_package}_${_var})
+        set(${_PKG}_${_var} ${${_package}_${_var}})
+      endif(DEFINED ${_package}_${_var})
+    endforeach(_var INCLUDE_DIRS LIBRARIES DEFINITIONS ROOT_DIR FOUND)
+
+    # Add include directories and libraries, if package was found.
+    if(${_PKG}_FOUND)
+      set(${_PKG}_FOUND ${${_PKG}_FOUND} PARENT_SCOPE)
+      set(HAVE_${_PKG} TRUE CACHE BOOL "Have ${_package}")
+      include_directories(${${_PKG}_INCLUDE_DIRS})
+      ## Using link_libraries() would avoid the need to collect libs in
+      ## LOFAR_LIBRARIES, but this command has been deprecated.
+      # link_libraries(${${_PKG}_LIBRARIES}) 
+      set(LOFAR_LIBRARIES ${LOFAR_LIBRARIES} ${${_PKG}_LIBRARIES} PARENT_SCOPE)
+    endif(${_PKG}_FOUND)
+
+  endif(NOT ${_PKG}_FOUND)
+
+endfunction(lofar_find_package _package)
diff --git a/CMake/LofarGeneral.cmake b/CMake/LofarGeneral.cmake
new file mode 100644
index 00000000000..dbef9f030c1
--- /dev/null
+++ b/CMake/LofarGeneral.cmake
@@ -0,0 +1,79 @@
+#  LofarGeneral.cmake: 
+#
+#  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
+#
+#  $Id$
+
+if(NOT DEFINED LOFAR_GENERAL_INCLUDED)
+
+  set(LOFAR_GENERAL_INCLUDED TRUE)
+
+  ## --------------------------------------------------------------------------
+  ## Handle all LOFAR build configuration options
+  ## --------------------------------------------------------------------------
+  include(LofarOptions)
+
+  ## --------------------------------------------------------------------------
+  ## Configure for testing with CTest/Dart
+  ## --------------------------------------------------------------------------
+  include(CTest)
+  
+  ## --------------------------------------------------------------------------
+  ## Add include directory in the binary directory to the -I path.
+  ## --------------------------------------------------------------------------
+  include_directories(${CMAKE_BINARY_DIR}/include)
+
+  ## --------------------------------------------------------------------------
+  ## Check for typedefs of primitive types
+  ## --------------------------------------------------------------------------
+  include(CheckTypeSize)
+  check_type_size("ushort"    HAVE_USHORT   )
+  check_type_size("uint"      HAVE_UINT     )
+  check_type_size("ulong"     HAVE_ULONG    )
+  check_type_size("long long" HAVE_LONG_LONG)
+
+  ## --------------------------------------------------------------------------
+  ## Check endianess
+  ## --------------------------------------------------------------------------
+  include(TestBigEndian)
+  test_big_endian(WORDS_BIGENDIAN)
+
+  ## --------------------------------------------------------------------------
+  ## Define `AUTO_FUNCTION_NAME' as either __PRETTY_FUNCTION__, __FUNCTION__,
+  ## or "<unknown>", depending on compiler support for function name macro.
+  ## --------------------------------------------------------------------------
+  include(CheckCSourceCompiles)
+  foreach(func_name __PRETTY_FUNCTION__ __FUNCTION__ "\"<unkown>\"")
+    check_c_source_compiles("
+    #include <stdio.h> 
+    int main() { puts(${func_name}); }
+    " HAVE_${func_name})
+    if(HAVE_${func_name})
+      set(AUTO_FUNCTION_NAME ${func_name} CACHE INTERNAL 
+        "Define as __PRETTY_FUNCTION__, __FUNCTION__, or \"<unknown>\"")
+      break()
+    endif(HAVE_${func_name})
+  endforeach(func_name)
+
+  ## --------------------------------------------------------------------------
+  ## Locate the Doxygen documentation tool
+  ## --------------------------------------------------------------------------
+  find_package(Doxygen)
+
+endif(NOT DEFINED LOFAR_GENERAL_INCLUDED)
diff --git a/CMake/LofarInit.cmake b/CMake/LofarInit.cmake
new file mode 100644
index 00000000000..37774146e03
--- /dev/null
+++ b/CMake/LofarInit.cmake
@@ -0,0 +1,216 @@
+#  $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
+
+
+#  Initialize common LOFAR CMake variables.
+#
+#  The following variables and properties are set.
+#
+#  Variable               Type      Cached  Description
+#  ========               ====      ======  ===========
+#  CMAKE_INSTALL_PREFIX   path      yes     Installation prefix
+#  CMAKE_MODULE_PATH      path      yes     Path to LOFAR CMake module files
+#  CMAKE_<LANG>_COMPILER  filepath  yes     Compiler to use for <LANG>, where
+#                                           <LANG> is usually C and C++
+#  LOFAR_ROOT             internal  yes     Root directory of LOFAR source tree
+#  LOFAR_COMPILER_SUITE   internal  yes     Compiler suite (e.g., gnu),
+#                                           derived from CMAKE_BINARY_DIR
+#  LOFAR_BUILD_VARIANT    internal  yes     Build variant (e.g., debug), 
+#                                           derived from CMAKE_BINARY_DIR
+#
+#  for backward compatibility:
+#  --------------------------
+#  lofar_top_srcdir       internal  yes     Root directory of LOFAR source tree
+#  lofar_sharedir         internal  yes     $lofar_top_srcdir/autoconf_share
+#  prefix                 internal  yes     Install prefix
+#
+#
+#  Property                         Scope   Description
+#  ========                         =====   ===========
+#  FIND_LIBRARY_USE_LIB64_PATHS     global  Set to true if either ENABLE_LIB64
+#                                           is set or directory /lib64 exists,
+#                                           otherwise set to false.
+
+if(NOT DEFINED LOFAR_INIT_INCLUDED)
+
+  set(LOFAR_INIT_INCLUDED TRUE)
+
+  # Root directory of the LOFAR source code tree
+  string(REGEX REPLACE 
+    "^(.*/LOFAR)/.*$" "\\1" LOFAR_ROOT ${CMAKE_SOURCE_DIR})
+  if(NOT LOFAR_ROOT MATCHES "/LOFAR$")
+    message(FATAL_ERROR 
+      "${CMAKE_SOURCE_DIR} is not inside the LOFAR source code tree!")
+  endif(NOT LOFAR_ROOT MATCHES "/LOFAR$")
+  set(LOFAR_ROOT ${LOFAR_ROOT} CACHE INTERNAL "LOFAR root directory")
+
+  # Here's where we keep our own CMake modules.
+  set(CMAKE_MODULE_PATH "${LOFAR_ROOT}/CMake" CACHE PATH 
+    "LOFAR CMake module path")
+
+  # Include host-specific variants file, if present, and global variants file.
+  include(LofarVariants)
+
+  # Get compiler suite and build variant from binary directory name.
+  # The directory name should follow the naming convention
+  # <compiler>_<variant>, where <compiler> specifies the compiler suite to
+  # use, and <variant> specifies the build variant (e.g., debug).
+  get_filename_component(_cmpvar ${CMAKE_BINARY_DIR} NAME)
+
+  # Set the default install path prefix.
+  set(CMAKE_INSTALL_PREFIX "${LOFAR_ROOT}/installed/${_cmpvar}" CACHE PATH 
+    "Instal path prefix")
+
+  # Split directory name in compiler suite part and build variant part.
+  string(TOUPPER ${_cmpvar} _cmpvar)
+  string(REGEX REPLACE "\(.*)_.*" "\\1" _cmp ${_cmpvar})
+  string(REGEX REPLACE ".*_\(.*)" "\\1" _var ${_cmpvar})
+
+  # Check if compiler suite is known. Compiler suites should be defined in the
+  # variants file.
+  list(FIND LOFAR_COMPILER_SUITES ${_cmp} _index)
+  if(_index GREATER -1)
+    set(LOFAR_COMPILER_SUITE ${_cmp} CACHE INTERNAL 
+      "Compiler suite, options are ${LOFAR_COMPILER_SUITES}")
+  else(_index GREATER -1)
+    message(FATAL_ERROR
+      "Compiler suite ${_cmp} is not defined, check your variants file!")
+  endif(_index GREATER -1)
+
+  # Get the list of compilers for this compiler suite.
+  set(_compilers "${LOFAR_COMPILER_SUITE}_COMPILERS")
+  if(NOT DEFINED ${_compilers})
+    message(FATAL_ERROR 
+      "${_compilers} is not defined. Check your variants file!")
+  endif(NOT DEFINED ${_compilers})
+
+  # Check if build variant is known. Build variants should be defined in the
+  # variants file.
+  list(FIND LOFAR_BUILD_VARIANTS ${_var} _index)
+  if(_index GREATER -1)
+    set(LOFAR_BUILD_VARIANT ${_var} CACHE INTERNAL
+      "Build variant, options are ${LOFAR_BUILD_VARIANTS}")
+  else(_index GREATER -1)
+    message(FATAL_ERROR
+      "Build variant ${_var} is not defined. Check your variants file!")
+  endif(_index GREATER -1)
+
+  # Define all the available build types. 
+  set(CMAKE_CONFIGURATION_TYPES ${LOFAR_BUILD_VARIANTS} CACHE INTERNAL
+    "Specify the available build types" FORCE)
+
+  # Set the correct build type. The build type influences which compiler flags
+  # will be supplied by CMake (see below).
+  set(CMAKE_BUILD_TYPE "${LOFAR_BUILD_VARIANT}" CACHE STRING 
+    "Set the correct build type, options are ${LOFAR_BUILD_VARIANTS}" FORCE)
+
+  # Set the CMAKE_<LANG>_COMPILER and the CMAKE_<LANG>_FLAGS_<BUILD_TYPE>
+  # variables. These variables are used by CMake in choosing the
+  # appropiate compiler and supplying the correct compiler flags depending on
+  # the build variant (e.g. debug or opt). These are all cache variables whose
+  # values must be forced to the values specified in our variants file.
+  foreach(_cmp ${${_compilers}})
+    string(REGEX REPLACE "${LOFAR_COMPILER_SUITE}_" "" _lang ${_cmp})
+    message(STATUS "${_lang} compiler: ${${_cmp}}")
+    set(CMAKE_${_lang}_COMPILER ${${_cmp}} CACHE FILEPATH 
+      "${_lang} compiler." FORCE)
+    set(CMAKE_${_lang}_FLAGS ${${_cmp}_FLAGS} CACHE STRING 
+      "Flags used by the compiler for all build types." FORCE)
+    foreach(_var ${LOFAR_BUILD_VARIANTS})
+      set(CMAKE_${_lang}_FLAGS_${_var} ${${_cmp}_FLAGS_${_var}} CACHE STRING
+        "Flags used by the compiler for ${_var} builds." FORCE)
+    endforeach(_var ${LOFAR_BUILD_VARIANTS})
+  endforeach(_cmp ${_compilers})
+
+  # Set the CMAKE_EXE_LINKER_FLAGS and CMAKE_EXE_LINKER_FLAGS_<BUILD_TYPE>
+  # variables. These variables are used by CMake to supply the correct link
+  # flags depending on the build variant (e.g. debug or opt). These are all
+  # cache variables whose values must be forced to the values specified in our
+  # variants file.
+  set(CMAKE_EXE_LINKER_FLAGS ${${LOFAR_COMPILER_SUITE}_EXE_LINKER_FLAGS}
+    CACHE STRING "Flags used by the linker for all build types." FORCE)
+  foreach(_var ${LOFAR_BUILD_VARIANTS})
+    set(CMAKE_EXE_LINKER_FLAGS_${_var} 
+      ${${LOFAR_COMPILER_SUITE}_EXE_LINKER_FLAGS_${_var}} CACHE STRING
+      "Flags used by the linker for ${_var} builds." FORCE)
+  endforeach(_var ${LOFAR_BUILD_VARIANTS})
+
+  # Set compiler definitions (e.g., -D options). There are global options that
+  # apply to each build variant, and there are build variant-specific options.
+  # Use separate_arguments to convert spaces to semicolons first.
+  separate_arguments(${LOFAR_COMPILER_SUITE}_COMPILE_DEFINITIONS)
+  separate_arguments(${LOFAR_COMPILER_SUITE}_COMPILE_DEFINITIONS_${LOFAR_BUILD_VARIANT})
+  add_definitions(${${LOFAR_COMPILER_SUITE}_COMPILE_DEFINITIONS})
+  add_definitions(${${LOFAR_COMPILER_SUITE}_COMPILE_DEFINITIONS_${LOFAR_BUILD_VARIANT}})
+
+  # Determine if lib64 has to be used. This is somewhat tricky for the default
+  # case, because: Debian puts 64-bit libs in /lib and 32-bit libs in /lib32,
+  # but SuSE and RedHat put 64-bit libs in /lib64 and 32-bit libs in /lib.
+  # We cannot use `uname -s`, since all distros return "Linux", hence we must
+  # test for the presence of these lib directories instead. To further
+  # complicate matters, Debian distros may create a symlink /lib64; therefore
+  # we should make sure that /lib64 is a "real" directory, not a symlink.
+  set(LOFAR_LIBDIR lib)
+  if(DEFINED ENABLE_LIB64)
+    if(ENABLE_LIB64)
+      set(LOFAR_LIBDIR lib64)
+    else(ENABLE_LIB64)
+      execute_process(COMMAND test -d /lib32 -a ! -L /lib32 RESULT_VARIABLE result)
+      if(NOT result)
+        set(LOFAR_LIBDIR lib32)
+      endif(NOT result)
+    endif(ENABLE_LIB64)
+  else(DEFINED ENABLE_LIB64)
+    execute_process(COMMAND test -d /lib64 -a ! -L /lib64 RESULT_VARIABLE result)
+    if(NOT result)
+      set(LOFAR_LIBDIR lib64)
+    endif(NOT result)
+  endif(DEFINED ENABLE_LIB64)
+
+  if(LOFAR_LIBDIR STREQUAL lib64)
+    set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE)
+  else(LOFAR_LIBDIR STREQUAL lib64)
+    set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS FALSE)
+  endif(LOFAR_LIBDIR STREQUAL lib64)
+
+  # Create include directory that will hold symbolic links to all
+  # (sub)projects of the current build. This is needed, because we use
+  # #include's that all contain the names of the different subprojects
+  # (e.g. Common, Blob).
+  if(NOT EXISTS ${CMAKE_BINARY_DIR}/include)
+    execute_process(COMMAND ${CMAKE_COMMAND} -E 
+      make_directory ${CMAKE_BINARY_DIR}/include)
+  endif(NOT EXISTS ${CMAKE_BINARY_DIR}/include)
+
+  # Add a custom target, so that we can do a 'make check', like we did with
+  # the GNU Autotools. 
+  # Tests should be added with:
+  #   - add_executable(<testprog> EXCLUDE_FROM_ALL ...) 
+  #   - add_dependencies(check <testprog>)
+  add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
+
+  ## --------------------------------------------------------------------------
+  ## 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")
+
+endif(NOT DEFINED LOFAR_INIT_INCLUDED)
diff --git a/CMake/LofarMacros.cmake b/CMake/LofarMacros.cmake
new file mode 100644
index 00000000000..10824d8310f
--- /dev/null
+++ b/CMake/LofarMacros.cmake
@@ -0,0 +1,211 @@
+#  $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
+#
+
+
+# ----------------------------------------------------------------------------
+# Generic CMake macros for LOFAR
+#
+# Defines the following macros:
+#   join_arguments(var)
+#   list_append_if(condition var value1..valuen)
+#   lofar_add_executable(name)
+#   lofar_add_library(name)
+#   lofar_add_subdirectory(name)
+#   lofar_add_test(name)
+#   lofar_get_date(date)
+#   lofar_get_hostname(name)
+# ----------------------------------------------------------------------------
+
+if(NOT DEFINED LOFAR_MACROS_INCLUDED)
+
+  set(LOFAR_MACROS_INCLUDED TRUE)
+
+  # --------------------------------------------------------------------------
+  # join_arguments(var)
+  #
+  # Join the arguments in the (semi-colon separated) list VAR into one space
+  # separated string. The string will be returned in the variable VAR.
+  # This command is the opposite of the built-in command separate_arguments().
+  # --------------------------------------------------------------------------
+  macro(join_arguments var)
+    set(_var)
+    foreach(_v ${${var}})
+      set(_var "${_var} ${_v}")
+    endforeach(_v ${${var}})
+    string(STRIP ${_var} _var)
+    set(${var} ${_var})
+  endmacro(join_arguments)
+
+  # --------------------------------------------------------------------------
+  # list_append_if(condition var value1..valuen)
+  #
+  # Apppend the values VALUE1 upto VALUEN to the list VAR if CONDITION is TRUE.
+  # --------------------------------------------------------------------------
+  macro(list_append_if _cond _list)
+    if(${_cond})
+      list(APPEND ${_list} ${ARGN})
+    endif(${_cond})
+  endmacro(list_append_if _cond _list)
+
+
+  # --------------------------------------------------------------------------
+  # lofar_add_executable(name)
+  #
+  # Add an executable like add_executable() does.
+  # Furthermore:
+  # - Set the link dependencies of this executable on other LOFAR libraries
+  #   using the information in ${PROJECT_NAME}_LIBRARIES.
+  # - Add a dependency of the current project on this executable.
+  #
+  # Note: since the libraries of the current project already have all their
+  # link dependencies setup correctly (using lofar_add_library()), executables
+  # only need to link to the libraries of the current project.
+  # --------------------------------------------------------------------------
+  macro(lofar_add_executable _name)
+    add_executable(${_name} ${ARGN})
+    get_property(_libs GLOBAL PROPERTY ${PROJECT_NAME}_LIBRARIES)
+    target_link_libraries(${_name} ${_libs})
+    add_dependencies(${PROJECT_NAME} ${_name})
+  endmacro(lofar_add_executable _name)
+
+
+  # --------------------------------------------------------------------------
+  # lofar_add_library(name)
+  #
+  # Adds a library like add_library() does. 
+  # Furthermore:
+  # - add the library to the list of libraries for the current project
+  #   (global property ${PROJECT_NAME}_LIBRARIES). 
+  # - set the link dependencies of this library on other LOFAR libraries 
+  #   using the information in ${PROJECT_NAME}_DEPENDENCIES.
+  # - mark the library for install into LOFAR_LIBDIR.
+  # - add a dependency of the current project on the library.
+  #
+  # Note: link dependencies are determined by examining the link dependencies
+  # of the libraries in the LOFAR packages that the current package depends
+  # on. For this to work, each package must have its own CMake project.
+  # --------------------------------------------------------------------------
+  macro(lofar_add_library _name)
+    add_library(${_name} ${ARGN})
+    set_property(GLOBAL APPEND PROPERTY ${PROJECT_NAME}_LIBRARIES ${_name})
+    set(_link_libs)
+    foreach(_dep ${${PROJECT_NAME}_DEPENDENCIES})
+      get_property(_dep_libs GLOBAL PROPERTY ${_dep}_LIBRARIES)
+      list(APPEND _link_libs ${_dep_libs})
+    endforeach(_dep ${${PROJECT_NAME}_DEPENDENCIES})
+    target_link_libraries(${_name} ${_link_libs} ${LOFAR_LIBRARIES})
+    install(TARGETS ${_name} DESTINATION ${LOFAR_LIBDIR})
+    add_dependencies(${PROJECT_NAME} ${_name})
+  endmacro(lofar_add_library _name)
+
+
+  # --------------------------------------------------------------------------
+  # lofar_add_subdirectory(name)
+  #
+  # Add a subdirectory like add_subdirectory() does. 
+  # Furthermore:
+  # - It is not an error if the subdirectory does not exist. 
+  # - An option BUILD_${name} will be provided to enable or disable inclusion.
+  #   By default, the option will be set to TRUE if the directory exists, and
+  #   to FALSE otherwise.
+  #
+  # Note: This macro is intended to be used to include a LOFAR package.
+  # --------------------------------------------------------------------------
+  macro(lofar_add_subdirectory _name)
+    message(STATUS "lofar_add_subdirectory(${_name})")
+    get_filename_component(_fullname ${_name} ABSOLUTE)
+    if(EXISTS ${_fullname})
+      message(STATUS "Directory ${_name} exists")
+      option(BUILD_${_name} "Build package ${_name}?" TRUE)
+      if(BUILD_${_name})
+        add_subdirectory(${_name})
+      endif(BUILD_${_name})
+    else()
+      message(STATUS "Directory ${_name} DOES NOT exist")
+    endif(EXISTS ${_fullname})
+  endmacro(lofar_add_subdirectory _name)
+
+
+  # --------------------------------------------------------------------------
+  # lofar_add_test(name)
+  #
+  # Add a test like add_test() does.
+  # Furthermore:
+  # - Instructs CMake how to compile and link the test program using
+  #   lofar_add_executable().
+  # - Adds a dependency for this test on the global target 'check', so that
+  #   it will be compiled, linked and run when you do a 'make check'.
+  # --------------------------------------------------------------------------
+  macro(lofar_add_test _name)
+    lofar_add_executable(${_name} EXCLUDE_FROM_ALL ${ARGN})
+    add_test(${_name} ${CMAKE_CURRENT_SOURCE_DIR}/${_name}.sh)
+    add_dependencies(check ${_name})
+  endmacro(lofar_add_test _name)
+
+
+  # --------------------------------------------------------------------------
+  # lofar_get_date(date)
+  #
+  # Return the current date and time in the variable DATE.
+  # --------------------------------------------------------------------------
+  macro(lofar_get_date _date)
+    execute_process(COMMAND date
+      OUTPUT_VARIABLE ${_date}
+      OUTPUT_STRIP_TRAILING_WHITESPACE)
+  endmacro(lofar_get_date _date)
+
+  # --------------------------------------------------------------------------
+  # lofar_get_hostname(name)
+  #
+  # Return the machine name (hostname) in the variable _hostname.
+  # --------------------------------------------------------------------------
+  macro(lofar_get_hostname _hostname)
+    execute_process(COMMAND hostname -s
+      OUTPUT_VARIABLE ${_hostname}
+      OUTPUT_STRIP_TRAILING_WHITESPACE)
+  endmacro(lofar_get_hostname _hostname)
+
+
+  ## -------------------------------------------------------------------------
+  ##       STUFF BELOW THIS LINE IS NOT BEING USED (AT THE MOMENT)
+  ## -------------------------------------------------------------------------
+  if(0)
+
+  # --------------------------------------------------------------------------
+  # lofar_add_bin_program(name)
+  # --------------------------------------------------------------------------
+  macro(lofar_add_bin_program _name)
+    lofar_add_executable(${_name})
+    install(TARGETS ${_name} DESTINATION bin)
+  endmacro(lofar_add_bin_program _name)
+
+
+  # --------------------------------------------------------------------------
+  # lofar_add_sbin_program(name)
+  # --------------------------------------------------------------------------
+  macro(lofar_add_sbin_program _name)
+    lofar_add_executable(${_name})
+    install(TARGETS ${_name} DESTINATION sbin)
+  endmacro(lofar_add_sbin_program _name)
+
+  endif(0)
+
+endif(NOT DEFINED LOFAR_MACROS_INCLUDED)
diff --git a/CMake/LofarOptions.cmake b/CMake/LofarOptions.cmake
new file mode 100644
index 00000000000..552b9035fc7
--- /dev/null
+++ b/CMake/LofarOptions.cmake
@@ -0,0 +1,108 @@
+#  LofarOptions.cmake: Parse CMake options and set associated variables
+#
+#  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
+#
+#  $Id$
+
+include(LofarFindPackage)
+
+if(NOT DEFINED LOFAR_OPTIONS_INCLUDED)
+
+  set(LOFAR_OPTIONS_INCLUDED TRUE)
+
+  ## --------------------------------------------------------------------------
+  ## Handle contradicting options
+  ## --------------------------------------------------------------------------
+
+  if(USE_LOG4CXX AND USE_LOG4CPLUS)
+    message(FATAL_ERROR 
+      "You cannot use more than one logger implementation. "
+      "Please check your variants file!")
+  endif(USE_LOG4CXX AND USE_LOG4CPLUS)
+
+  if(BUILD_STATIC_EXECUTABLES AND BUILD_SHARED_LIBS)
+    message(FATAL_ERROR 
+      "Cannot create static executables, when creating shared libraries. "
+      "Please check your variants file!")
+  endif(BUILD_STATIC_EXECUTABLES AND BUILD_SHARED_LIBS)
+
+
+  ## --------------------------------------------------------------------------
+  ## Handle each option
+  ## --------------------------------------------------------------------------
+
+  if(BUILD_STATIC_EXECUTABLES)
+    set(CMAKE_EXE_LINKER_FLAGS -static)
+    set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
+    set(CMAKE_EXE_LINK_DYNAMIC_C_FLAGS)       # remove -Wl,-Bdynamic
+    set(CMAKE_EXE_LINK_DYNAMIC_CXX_FLAGS)
+    set(CMAKE_SHARED_LIBRARY_C_FLAGS)         # remove -fPIC
+    set(CMAKE_SHARED_LIBRARY_CXX_FLAGS)
+    set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS)    # remove -rdynamic
+    set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS)
+    # Maybe this works as well, haven't tried yet.
+    # set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
+  endif(BUILD_STATIC_EXECUTABLES)
+  
+#  if(USE_AIPSPP)
+#    lofar_find_package(CasaCore)
+#  endif(USE_AIPSPP)
+  
+  if(USE_BACKTRACE)
+    lofar_find_package(Backtrace)
+  endif(USE_BACKTRACE)
+
+  if(USE_LOG4CXX)
+    lofar_find_package(Log4Cxx)
+  endif(USE_LOG4CXX)
+
+  if(USE_LOG4CPLUS)
+    lofar_find_package(Log4Cplus)
+  endif(USE_LOG4CPLUS)
+
+  if(USE_MPI)
+    lofar_find_package(MPI)
+  endif(USE_MPI)
+  
+  if(USE_PYTHON)
+#    lofar_find_package(Python)
+  endif(USE_PYTHON)
+
+  if(USE_SSE)
+    set(GNU_SSE_FLAGS "-msse2")
+    set(ICC_SSE_FLAGS "-xW")
+  endif(USE_SSE)
+
+  if(USE_SHMEM)
+    set(HAVE_SHMEM 1)
+  endif(USE_SHMEM)
+
+  if(USE_SOCKETS)
+    #
+  endif(USE_SOCKETS)
+
+  if(USE_THREADS)
+    lofar_find_package(Pthreads)
+  endif(USE_THREADS)
+
+  if(USE_ZOID)
+    #
+  endif(USE_ZOID)
+
+endif(NOT DEFINED LOFAR_OPTIONS_INCLUDED)
diff --git a/CMake/LofarPackageVersion.cmake b/CMake/LofarPackageVersion.cmake
new file mode 100644
index 00000000000..d3557de02c8
--- /dev/null
+++ b/CMake/LofarPackageVersion.cmake
@@ -0,0 +1,50 @@
+# Include useful macros
+include(LofarMacros)
+
+# First check to see whether we need to update our CMakeLists.txt files.
+
+# Generate version program source file
+execute_process(COMMAND ${CMAKE_MODULE_PATH}/makeversion
+  WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
+  RESULT_VARIABLE result)
+if(result)
+  message(SEND_ERROR "makeversion failed!")
+endif(result)
+
+# Create FillPackage__VersionInc.h
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/FillPackage__VersionInc.h"
+  "/* Generated by CMake for project ${PROJECT_NAME} */\n\n")
+foreach(dep ${${PROJECT_NAME}_DEPENDENCIES})
+  file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/FillPackage__VersionInc.h"
+    "#include <${dep}/Package__Version.h>\n")
+endforeach(dep ${${PROJECT_NAME}_DEPENDENCIES})
+
+# Create FillPackage__VersionFunc.h
+lofar_get_date(date)
+lofar_get_hostname(hostname)
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/FillPackage__VersionFunc.h"
+  "/* Generated by CMake for project ${PROJECT_NAME} */\n\n"
+  "namespace LOFAR {\n"
+  "  std::string ${PROJECT_NAME}Version::getBuildTime()\n"
+  "  { return \"${date}\"; }\n"
+  "  std::string ${PROJECT_NAME}Version::getBuildUser()\n"
+  "  { return \"$ENV{USER}\"; }\n"
+  "  std::string ${PROJECT_NAME}Version::getBuildMachine()\n"
+  "  { return \"${hostname}\"; }\n"
+  "  void ${PROJECT_NAME}Version::fillInfo\n"
+  "    (int level, std::vector<Version::PkgInfo>& vec)\n"
+  "  {\n"
+  "    // Add info of this package if needed.\n"
+  "    vec.push_back (Version::PkgInfo(level, &getInfo));\n"
+  "    // Add info of packages being used.\n")
+foreach(dep ${${PROJECT_NAME}_DEPENDENCIES})
+  file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/FillPackage__VersionFunc.h"
+    "    ${dep}Version::fillInfo (level+1, vec);\n")
+endforeach(dep ${${PROJECT_NAME}_DEPENDENCIES})
+file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/FillPackage__VersionFunc.h"
+  "  }\n"
+  "}\n")
+
+# Add current binary directory to compiler's include path, so that the
+# generated header files can be found during compilation.
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
diff --git a/CMake/LofarProject.cmake b/CMake/LofarProject.cmake
new file mode 100644
index 00000000000..9fe4ef2030e
--- /dev/null
+++ b/CMake/LofarProject.cmake
@@ -0,0 +1,46 @@
+#  $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
+#
+
+## ---------------------------------------------------------------------------
+## Define a new LOFAR project for CMake.
+## ---------------------------------------------------------------------------
+macro(lofar_project name)
+
+  # Project characteristics
+  project(${name})
+
+  # Load/execute general macro's
+  include(LofarGeneral)
+
+  # Handle LOFAR options
+  include(LofarOptions)
+
+#  # Generate configuration header file
+#  configure_file(
+#    ${CMAKE_SOURCE_DIR}/lofar_config.h.cmake 
+#    ${CMAKE_BINARY_DIR}/lofar_config.h)
+
+  # Build tests?
+  if(ENABLE_TESTING)
+    include(CTest)
+  endif(ENABLE_TESTING)
+
+endmacro(lofar_project name)
diff --git a/CMake/LofarSearchPath.cmake b/CMake/LofarSearchPath.cmake
new file mode 100644
index 00000000000..1a88fa5d60a
--- /dev/null
+++ b/CMake/LofarSearchPath.cmake
@@ -0,0 +1,50 @@
+#  LofarSearchPath.cmake: Return search path based on pattern in variants file,
+#                         package name plus optional package version.
+#
+#  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
+#
+#  $Id$
+
+include(LofarVariants)
+
+# Return search path to use when searching for package '_pkg' as '_path'.
+# Replace placeholders in LOFAR_SEARCH_PATH with actual values. Note that 
+# we need to quote the variables, because they may be undefined.
+macro(lofar_search_path _path _pkg)
+  set(${_path})
+  string(TOLOWER "${LOFAR_COMPILER_SUITE}" comp)
+  foreach(_dir ${LOFAR_SEARCH_PATH})
+    string(REPLACE "+prefix" "${CMAKE_INSTALL_PREFIX}" _dir "${_dir}")
+    string(REPLACE "+root" "${LOFAR_ROOT}" _dir "${_dir}")
+    string(REPLACE "+pkg" "${_pkg}" _dir "${_dir}")
+    string(REPLACE "+vers" "${${_pkg}-version}" _dir "${_dir}")
+    string(REPLACE "+comp" "${comp}" _dir "${_dir}")
+    file(TO_CMAKE_PATH "${_dir}" _dir)    # remove trailing slash(es)
+    list(APPEND ${_path} ${_dir})
+  endforeach(_dir in ${LOFAR_SEARCH_PATH})
+  list(REMOVE_DUPLICATES ${_path})
+endmacro(lofar_search_path _path _pkg)
+
+# Set the search path to use when searching for package '_pkg', by setting the
+# CMake variable CMAKE_PREFIX_PATH.
+macro(lofar_set_search_path _pkg)
+  lofar_search_path(_path ${_pkg})
+  set(CMAKE_PREFIX_PATH ${_path})
+endmacro(lofar_set_search_path _pkg)
+
diff --git a/CMake/LofarVariants.cmake b/CMake/LofarVariants.cmake
new file mode 100644
index 00000000000..72ed79fb26c
--- /dev/null
+++ b/CMake/LofarVariants.cmake
@@ -0,0 +1,48 @@
+#  $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
+
+#  Include a host-specific 'variants.<hostname>' file, if present; and a
+#  global 'variants' file. These files must be located in the directory
+#  ${LOFAR_ROOT}/CMake/variants.
+
+include(LofarMacros)
+
+if(NOT DEFINED LOFAR_VARIANTS_INCLUDED)
+
+  set(LOFAR_VARIANTS_INCLUDED TRUE)
+  
+  ## --------------------------------------------------------------------------
+  ## First, include host-specific variants file, if present
+  ## --------------------------------------------------------------------------
+  lofar_get_hostname(hostname)
+  set(variants_file ${CMAKE_MODULE_PATH}/variants/variants.${hostname})
+  
+  if (EXISTS ${variants_file})
+    message(STATUS "Loading host-specific variants file")
+    include(${variants_file})
+  endif (EXISTS ${variants_file})
+  
+  ## --------------------------------------------------------------------------
+  ## Next, include global variants file.
+  ## --------------------------------------------------------------------------
+  message(STATUS "Loading global variants file")
+  include(${CMAKE_MODULE_PATH}/variants/variants)
+  
+endif(NOT DEFINED LOFAR_VARIANTS_INCLUDED)
diff --git a/CMake/MACAddProtocol.cmake b/CMake/MACAddProtocol.cmake
new file mode 100644
index 00000000000..153a405b9e8
--- /dev/null
+++ b/CMake/MACAddProtocol.cmake
@@ -0,0 +1,63 @@
+#  $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
+
+# --------------------------------------------------------------------------
+# mac_add_protocol(protocol templ_dir)
+#
+# Add a MAC protocol source file. 
+# Use autogen to generate a C++ header and source file from the protocol
+# definition file ${protocol}.prot, using a template in the template directory
+# ${templ_dir}.
+#
+# The generated C++ header file will have an extension '.ph', to distinguish
+# it from ordinary header files. Both C++ header and source file will be
+# generated in the directory ${CMAKE_CURRENT_BINARY_DIR}.
+# --------------------------------------------------------------------------
+macro(mac_add_protocol _protocol _templ_dir)
+
+  # Search for the autogen program
+  find_program(AUTOGEN_EXECUTABLE autogen)
+  if(NOT AUTOGEN_EXECUTABLE)
+    message(FATAL_ERROR 
+      "Could not find autogen - the Automated Program Generator")
+  endif(NOT AUTOGEN_EXECUTABLE)
+
+  # Get the full path to the protocol file and the template directory.
+  get_filename_component(_proto_file "${_protocol}.prot" ABSOLUTE)
+  get_filename_component(_templ_dir "${_templ_dir}" ABSOLUTE)
+
+  # Determine the destination directory for the generated C++ header file. 
+  # This directory is chosen such that other MAC packages only have to
+  # add <binary-root>/include/MAC to their -I path.
+  string(REGEX REPLACE "${LOFAR_ROOT}" "${CMAKE_BINARY_DIR}/include" 
+    _dest_dir ${${PROJECT_NAME}_SOURCE_DIR})
+
+  # Define the command to generate the C++ header and source files. The header
+  # file will be copied to the correct destination directory.
+  set(_cxx_hdr "${_protocol}.ph")
+  set(_cxx_src "${_protocol}.cc")
+  add_custom_command(OUTPUT "${_cxx_hdr}" "${_cxx_src}"
+    COMMAND ${AUTOGEN_EXECUTABLE} 
+    ARGS --writable -L "${_templ_dir}" "${_proto_file}"
+    COMMAND ${CMAKE_COMMAND}
+    ARGS -E copy "${_cxx_hdr}" "${_dest_dir}/${_cxx_hdr}"
+    DEPENDS "${_proto_file}")
+
+endmacro(mac_add_protocol _protocol _templ_dir)
diff --git a/CMake/makeversion b/CMake/makeversion
new file mode 100755
index 00000000000..44221106259
--- /dev/null
+++ b/CMake/makeversion
@@ -0,0 +1,316 @@
+#!/bin/sh
+
+# makeversion: create the version.cc file of a package
+#
+#  Copyright (C) 2007-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
+#
+#  $Id$
+
+# This script creates files <package>Version.h and .cc containing a class
+# to return the version and revision of the package.
+# The .cc file includes a file which is created by LofarPackageVersion.cmake
+# It also creates an file version<package>.cc which is an executable program
+# to print the version.
+# Optionally the CMakeLists.txt files are changed to build the code.
+# Note: Each package's CMakeLists.txt file must contain a line
+#     lofar_add_package(<package> [version] [DEPENDS <depend> [depend]])
+#   for this to work.
+
+# The class name used is <package>Version, for eaxmple CommonVersion.
+# makeversion retrieves the package name from the basename of the current
+# directory which works fine for the normal cases. However, MAC uses some
+# special directory structure like GCF/TM/include/GCF/TM. It also detects
+# this and sets in this example the package name to GCFTM (removes the /).
+# The package name given in lofar_add_package() has to match the package
+# name found here, thus must be GCFTM in this example.
+
+# Trap handler
+trap 'rm -f version.*.tmp; \
+      trap - 0; \
+      exit' 0 1 2 3 15
+
+# Get the package name (also in lower and uppercase).
+fpkg=`pwd`
+pkg=`basename $fpkg`
+
+# No version info is needed (in fact, not possible) for Tools and pytools.
+if [ "$pkg" = Tools  -o  "$pkg" = pytools ]; then
+  exit 0
+fi
+
+# Take the package from the CMakeLists.txt file.
+# It looks like: project (GCFProtocols ...)
+tpkg=`sed -n 's,^[ \t]*project[ \t]*([ \t]*\([^ \t)]\+\).*$,\1,ip' CMakeLists.txt`
+if test "$tpkg" != ""; then
+  pkg=$tpkg
+fi
+
+# If the include directory exists, find the include path from the package's
+# CMakeLists.txt. Otherwise header files are in src and <package> is the
+# include path.
+incdir=`sed -n 's,^[ \t]*add_subdirectory[ \t]*([ \t]*\(include/[^)]\+\).*$,\1,ip' CMakeLists.txt`
+if test "$incdir" = ""; then
+  echo "Could not derive include directory from $pkg/CMakeLists.txt"
+  exit 1
+fi
+incpath="${incdir##include/}"
+
+# Check if source and include directory exist. If not, then it is probably not
+# a package directory.
+if ! [ -d src -a -d $incdir ]; then
+  echo "makeversion: no source or include directory found: "
+  echo "  is this a package directory?"
+  exit 1
+fi
+
+# Get version and revision (if possible) from repository.
+# Both the global revision and local one (i.e. last changed for this version).
+cvers=Unknown
+rvers=Unknown
+grev=Unknown
+lrev=Unknown
+nrch=0
+svn info > version.svn.tmp 2>&1
+hassvn=$?
+if [ $hassvn = 0 ]; then
+  # Get version.
+  # It should look like trunk/package or tags/package-version/package
+  rvers1=`fgrep 'URL: ' version.svn.tmp | sed -e 's%.*/LOFAR/%%'`
+  rvers=`echo $rvers1 | sed -e 's%/.*%%'`
+  if test "$rvers" = "tags"  -o  "$rvers" = "branches"; then
+    # We have a task branch (for a bug) or a release branch.
+    # Remove all but version and replace _ in version by .
+    rvers1=`echo $rvers1 | sed -e 's%^[^/]*/%%' -e 's%/.*%%'`
+    rvers=`echo $rvers1 | sed -e 's%-Bug[0-9]%%'`
+    if test "$rvers" = "$rvers1"; then
+      # No task branch, thus normal version number after the -.
+      rvers=`echo $rvers1 | sed -e 's%-release-.*%%' -e 's%.*-%%' -e 's%_%.%g'`
+    else
+      # Task branch, so extract from 'Bug' on.
+      rvers=`echo $rvers1 | sed -e 's%-task-.*%%' -e 's%.*-Bug%Bug%'`
+    fi
+  fi
+  # Get revision.
+  grev=`fgrep 'Revision: ' version.svn.tmp | sed -e 's/.*: *//'`
+  lrev=`fgrep 'Last Changed Rev: ' version.svn.tmp | sed -e 's/.*: *//'`
+  # Check if there are locally modified files (excluding CMakeLists.txt)
+  svn status | egrep '^M ' | fgrep -v CMakeLists.txt > version.svn.tmp 2>&1
+  if [ $? ]; then
+    nrch=`wc -l version.svn.tmp | sed -e 's/^ *//' | sed -e 's/ .*//'`
+  fi
+fi
+# Get the version from the CMakeLists.txt. We'll assume (for the time being)
+# that the project's CMakeLists.txt file contains a line like
+# "lofad_add_package(<name> [version] [DEPENDS <depend> [depend]])
+cvers1=`sed -n 's,^[ \t]*lofar_add_package[ \t]*([ \t]*[^ \t]*[ \t]\+\([0-9.]\+\).*$,\1,ip' CMakeLists.txt`
+#cvers1=`sed -n 's,^[ \t]*set[ \t]*([ \t]*package_version[ \t]\+\([0-9.]\+\).*$,\1,ip' CMakeLists.txt`
+if [ "$cvers1" != "" ]; then
+  cvers=$cvers1
+fi
+
+# Get package name in lower and uppercase
+lpkg=`echo $pkg | tr A-Z a-z`
+upkg=`echo $pkg | tr a-z A-Z`
+
+# Create temporary version.h/cc
+cat > version.h.tmp <<EOF
+//# Get revision info; generated by CMake/makeversion
+
+#ifndef LOFAR_${upkg}_PACKAGE__VERSION_H
+#define LOFAR_${upkg}_PACKAGE__VERSION_H
+
+#include <Common/Version.h>
+
+// Class to get the version (revision) of the package and the packages it uses.
+namespace LOFAR {
+  class ${pkg}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 CMakeLists.txt.
+    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
+EOF
+
+cat > version.cc.tmp <<EOF
+//# Get revision info; generated by CMake/makeversion
+
+//## pkg=$pkg
+//## incpath=$incpath
+//## incdir=$incdir
+
+#include <${incpath}/Package__Version.h>
+#include <Common/Version.h>
+#include "FillPackage__VersionInc.h"
+
+namespace LOFAR {
+  Version ${pkg}Version::getInfo()
+  {
+    return Version ("${pkg}",
+		    getVersion(), getConfVersion(),
+		    getRevision(), getPackageRevision(),
+		    getNrChangedFiles(),
+		    getBuildTime(), getBuildUser(), getBuildMachine());
+  }
+
+  std::string ${pkg}Version::getVersion()
+    { return "$rvers"; }
+  std::string ${pkg}Version::getConfVersion()
+    { return "$cvers"; }
+  std::string ${pkg}Version::getRevision()
+    { return "$grev"; }
+  std::string ${pkg}Version::getPackageRevision()
+    { return "$lrev"; }
+  std::string ${pkg}Version::getNrChangedFiles()
+    { return "$nrch"; }
+}
+
+//# FillPackage__VersionFunc.h is generated in the build area by
+//# LofarPackageVersion.cmake. It contains function fillInfo.
+#include "FillPackage__VersionFunc.h"
+EOF
+
+cat > version.mcc.tmp <<EOF
+//# Print revision info; generated by CMake/makeversion
+
+#include <${incpath}/Package__Version.h>
+#include <Common/Version.h>
+#include <iostream>
+
+using namespace LOFAR;
+
+int main (int argc, const char* argv[])
+{
+  std::string type = "brief";
+  if (argc > 1) {
+    type = argv[1];
+  }
+  Version::show<${pkg}Version> (std::cout, "${pkg}", type);
+  return 0;
+}
+EOF
+
+# Do not copy if existing version is the same,
+# so code is not rebuilt needlessly.
+if [ ! -e $incdir/Package__Version.h ]; then
+  cp version.h.tmp $incdir/Package__Version.h
+  echo "makeversion created $incdir/Package__Version.h"
+elif [ $hassvn = 0 ]; then
+  diff version.h.tmp $incdir/Package__Version.h > /dev/null 2>&1
+  if [ $? != 0 ]; then
+    cp version.h.tmp $incdir/Package__Version.h
+    echo "makeversion replaced $incdir/Package__Version.h"
+  fi
+fi
+
+if [ ! -e src/Package__Version.cc ]; then
+  cp version.cc.tmp src/Package__Version.cc
+  echo "makeversion created src/Package__Version.cc"
+elif [ $hassvn = 0 ]; then
+  diff version.cc.tmp src/Package__Version.cc > /dev/null 2>&1
+  if [ $? != 0 ]; then
+    cp version.cc.tmp src/Package__Version.cc
+    echo "makeversion replaced src/Package__Version.cc"
+  fi
+fi
+
+versmainname=version${lpkg}
+if [ ! -e src/${versmainname}.cc ]; then
+  cp version.mcc.tmp src/${versmainname}.cc
+  echo "makeversion created src/${versmainname}.cc"
+elif [ $hassvn = 0 ]; then
+  diff version.mcc.tmp src/${versmainname}.cc > /dev/null 2>&1
+  if [ $? != 0 ]; then
+    cp version.mcc.tmp src/${versmainname}.cc
+    echo "makeversion replaced src/${versmainname}.cc"
+  fi
+fi
+
+# Get the library name, and the name of the variable containing a list of
+# library sources (if present). Get it from the CMakeLists.txt, because
+# sometimes it differs from the package name (e.g. libbbms for BB/MS).
+# Make sure that the first library is taken unless one matches exactly.
+addlib=`sed -n 's,^[ \t]*add_library[ \t]*([ \t]*\(.*\)).*$,\1,ip' src/CMakeLists.txt | head -1`
+if [ "$addlib" != "" ]; then
+  libnm=`echo $addlib | sed 's,[ \t].*,,'`
+  libsrcs=`echo $addlib | sed 's,^.*\${\(.*\)}.*$,\1,'`
+else
+  libnm=lib${lpkg}
+  libsrcs=${lpkg}_LIB_SRCS
+fi
+
+# Add Package__Version source file to CMakeLists.txt files as needed.
+fgrep Package__Version.cc src/CMakeLists.txt > /dev/null 2>&1
+if [ $? != 0 ]; then
+  # Lookup variable that contains the list of library sources.
+  grep "^[ \t]*set[ \t]*([ \t]*${libsrcs}[ \t]*$" src/CMakeLists.txt > /dev/null 2>&1
+  if [ $? = 0 ]; then
+    # Found it. Add Package__Version.cc to the list
+    sed "s,^\([ \t]*\)\(set[ \t]*([ \t]*${libsrcs}\)\(.*\)$,\1\2\n\1  Package__Version.cc\3," src/CMakeLists.txt > version.mf.tmp
+  else
+    # It's not there. Create a line with a set() command
+    cat > version.mf.tmp <<EOF
+set(${libsrcs} Package__Version.cc)
+add_library(${lpkg} \${$libsrcs})
+
+EOF
+    cat src/CMakeLists.txt >> version.mf.tmp
+  fi
+  mv version.mf.tmp src/CMakeLists.txt
+  echo "makeversion added Package__Version.cc to src/CMakeLists.txt"
+fi
+
+# Add version program tot CMakeLists.txt file as needed.
+fgrep "${versmainname}" src/CMakeLists.txt > /dev/null 2>&1
+if [ $? != 0 ]; then
+  # It's not there, add it.
+  cat src/CMakeLists.txt > version.mf.tmp
+  cat >> version.mf.tmp <<EOF
+add_executable(${versmainname} ${versmainname}.cc)
+target_link_libraries(${versmainname} ${lpkg} \${LOFAR_LIBRARIES})
+install(TARGETS ${versmainname} DESTINATION bin)
+
+EOF
+  mv version.mf.tmp src/CMakeLists.txt
+  echo "makeversion added ${versmainname}.cc to src/CMakeLists.txt"
+fi
diff --git a/CMake/variants/variants b/CMake/variants/variants
new file mode 100644
index 00000000000..761a35e33f7
--- /dev/null
+++ b/CMake/variants/variants
@@ -0,0 +1,70 @@
+## -*- CMake -*-
+##
+## Global variants file.
+##
+## Defines compiler suites (e.g., GNU),
+## build variants (e.g., debug or optimized),
+## defaults for several options.
+##
+## $Id$
+
+# Define compiler suites.
+list(APPEND LOFAR_COMPILER_SUITES
+  GNU
+)
+
+# Define build variants.
+list(APPEND LOFAR_BUILD_VARIANTS
+  DEBUG  
+  OPT
+)
+
+# GNU compiler suite
+set(GNU_COMPILERS GNU_C GNU_CXX)  # GNU Compiler Suite
+set(GNU_C         /usr/bin/gcc )  # GNU C compiler
+set(GNU_CXX       /usr/bin/g++ )  # GNU C++ compiler
+
+set(GNU_C_FLAGS)
+set(GNU_C_FLAGS_DEBUG    "-g")
+set(GNU_C_FLAGS_OPT      "-g -O2")
+set(GNU_CXX_FLAGS        "-W -Wall -Woverloaded-virtual -Wno-unknown-pragmas")
+set(GNU_CXX_FLAGS_DEBUG  "-g")
+set(GNU_CXX_FLAGS_OPT    "-g -O2")
+set(GNU_EXE_LINKER_FLAGS)
+set(GNU_EXE_LINKER_FLAGS_DEBUG)
+set(GNU_EXE_LINKER_FLAGS_OPT)
+set(GNU_COMPILE_DEFINITIONS)
+set(GNU_COMPILE_DEFINITIONS_DEBUG "-DLOFAR_DEBUG -DENABLE_TRACER")
+set(GNU_COMPILE_DEFINITIONS_OPT)
+
+# Default search path to use when searching for an external package.
+set(LOFAR_SEARCH_PATH 
+  "+prefix"
+  "+root"
+  "/opt/lofar/external/+pkg+vers/+comp"
+  "/opt/lofar/external/+pkg+vers"
+  "/usr/local/+pkg+vers/+comp"
+  "/usr/local/+pkg+vers"
+  "/usr/local"
+  "/usr"
+)
+
+# Define default values for all LOFAR build options. 
+# NOT IMPLEMENTED YET: These options may be overridden for a given compiler
+# suite. For example: option(USE_BOOST_GNU "Use Boost for GNU" OFF)
+option(BUILD_STATIC_EXECUTABLES "Build static executables" OFF)
+option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
+#option(BUILD_TESTING     "Build the testing tree" OFF)
+option(LOFAR_VERBOSE_CONFIGURE "Be verbose when configuring" ON)
+option(USE_BACKTRACE     "Use backtrace" ON)
+option(USE_BOOST         "Use Boost"     ON)
+#option(USE_CASACORE      "Use Casacore"  OFF)
+option(USE_LOG4CPLUS     "Use Log4Cplus" ON)
+option(USE_LOG4CXX       "Use Log4Cxx"   OFF)
+option(USE_MPI           "Use MPI"       OFF)
+option(USE_PYTHON        "Use Python"    ON)
+option(USE_SSE           "Use SSE"       OFF)
+option(USE_SHMEM         "Use shmem"     ON)
+option(USE_SOCKETS       "Use Sockets"   OFF)
+option(USE_THREADS       "Use threads"   ON)
+option(USE_ZOID          "Use ZOID"      OFF)
diff --git a/CMake/variants/variants.bgfen0 b/CMake/variants/variants.bgfen0
new file mode 100644
index 00000000000..e6c6dd4d2a1
--- /dev/null
+++ b/CMake/variants/variants.bgfen0
@@ -0,0 +1,55 @@
+## -*- CMake -*-
+##
+## Host specific variants file. 
+## Settings in this file extend or override those in the global variants file.
+##
+## $Id: variants.dop131 13362 2009-05-29 15:32:43Z loose $
+
+#set(CMAKE_SYSTEM_NAME BlueGeneP)
+
+# Define compiler suites.
+set(LOFAR_COMPILER_SUITES
+  GNUBGP
+)
+
+# Define build variants.
+set(LOFAR_BUILD_VARIANTS
+  CN
+  ION
+)
+
+# Options
+option(USE_MPI "Use MPI" ON)
+option(BUILD_STATIC_EXECUTABLES "Build static executables" ON)
+
+# GNU BG/P compiler suite
+set(GNUBGP_COMPILERS GNUBGP_C GNUBGP_CXX GNUBGP_ASM)
+set(GNUBGP_C         /usr/bin/gcc)
+set(GNUBGP_CXX       /usr/bin/g++)
+set(GNUBGP_ASM       /bgsys/drivers/ppcfloor/gnu-linux/bin/powerpc-bgp-linux-gcc)
+
+set(GNUBGP_C_FLAGS)
+set(GNUBGP_C_FLAGS_DEBUG "-g")
+set(GNUBGP_C_FLAGS_OPT "-g -O2")
+set(GNUBGP_CXX_FLAGS "-W -Wall -Woverloaded-virtual -Wno-unknown-pragmas")
+set(GNUBGP_CXX_FLAGS_DEBUG "-g")
+set(GNUBGP_CXX_FLAGS_OPT "-g -O2")
+set(GNUBGP_EXE_LINKER_FLAGS)
+#  -B/bgsys/drivers/ppcfloor/gnu-linux/powerpc-bgp-linux/bin)
+set(GNUBGP_EXE_LINKER_FLAGS_CN)
+#  -L/bgsys/drivers/ppcfloor/comm/lib
+#  -L/bgsys/drivers/ppcfloor/runtime/SPI)
+#  -lcxxmpich.cnk -lmpich.cnk -ldcmfcoll.cnk -ldcmf.cnk -lSPI.cna)
+# -lpthread -lrt -lSPI.cna -lm)
+set(GNUBGP_EXE_LINKER_FLAGS_ION)
+set(GNUBGP_COMPILE_DEFINITIONS 
+  -B/bgsys/drivers/ppcfloor/gnu-linux/powerpc-bgp-linux/bin
+  -DHAVE_BGP
+  -DHAVE_MPI
+  -I/bgsys/drivers/ppcfloor/comm/include
+  -I/bgsys/drivers/ppcfloor/arch/include)
+set(GNUBGP_COMPILE_DEFINITIONS_CN -DHAVE_BGP_CN)
+set(GNUBGP_COMPILE_DEFINITIONS_ION -DHAVE_BGP_ION)
+
+# Host specific paths to third party packages
+set(CASACORE_ROOT_DIR /cephome/romein/packages/casacore-0.3.0/stage)
diff --git a/CMake/variants/variants.dop131 b/CMake/variants/variants.dop131
new file mode 100644
index 00000000000..c7a7dc7fe6e
--- /dev/null
+++ b/CMake/variants/variants.dop131
@@ -0,0 +1,42 @@
+## -*- CMake -*-
+##
+## Host specific variants file. 
+## Settings in this file extend or override those in the global variants file.
+##
+## $Id$
+
+set(CMAKE_SYSTEM_NAME BlueGeneP)
+
+# Define compiler suites.
+set(LOFAR_COMPILER_SUITES
+  GNUBGP
+)
+
+# Define build variants.
+set(LOFAR_BUILD_VARIANTS
+  CN
+  ION
+)
+
+# GNU BG/P compiler suite
+set(GNUBGP_COMPILERS GNUBGP_C GNUBGP_CXX)# GNUBGP_ASM)
+set(GNUBGP_C         /usr/bin/gcc)
+set(GNUBGP_CXX       /usr/bin/g++)
+#set(GNUBGP_ASM       /usr/bin/as)
+
+set(GNUBGP_C_FLAGS)
+set(GNUBGP_C_FLAGS_DEBUG "-g")
+set(GNUBGP_C_FLAGS_OPT "-g -O2")
+set(GNUBGP_CXX_FLAGS "-W -Wall -Woverloaded-virtual -Wno-unknown-pragmas")
+set(GNUBGP_CXX_FLAGS_DEBUG "-g")
+set(GNUBGP_CXX_FLAGS_OPT "-g -O2")
+set(GNUBGP_EXE_LINKER_FLAGS)
+set(GNUBGP_EXE_LINKER_FLAGS_CN)
+set(GNUBGP_EXE_LINKER_FLAGS_ION)
+set(GNUBGP_COMPILE_DEFINITIONS 
+  -B/bgsys/drivers/ppcfloor/gnu-linux/powerpc-bgp-linux/bin
+  -DHAVE_BGP
+  -I/bgsys/drivers/ppcfloor/comm/include
+  -I/bgsys/drivers/ppcfloor/arch/include)
+set(GNUBGP_COMPILE_DEFINITIONS_CN -DHAVE_BGP_CN)
+set(GNUBGP_COMPILE_DEFINITIONS_ION -DHAVE_BGP_ION)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 40a967580cd..877fed0fe62 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,254 +1,62 @@
-execute_process (COMMAND pwd
-    OUTPUT_VARIABLE path
-    OUTPUT_STRIP_TRAILING_WHITESPACE)
-
-## ----------------------------------------------------------------------------
-##  Host-specific overrides
-
-function(check_package_name _NAME result_var)
-  if ("${_NAME}" MATCHES "^$")
-    set(${result_var} 0 PARENT_SCOPE)
-    break()
-  elseif (${_NAME} STREQUAL "IONProc")
-    set(${result_var} 1 PARENT_SCOPE)
-    break()
-  elseif (${_NAME} STREQUAL "CNProc") 
-    set(${result_var} 1 PARENT_SCOPE)
-    break()
-  elseif (${_NAME} STREQUAL "Storage") 
-    set(${result_var} 1 PARENT_SCOPE)
-    break()
-  else ("${_NAME}" MATCHES "^$")
-    set(${result_var} 0 PARENT_SCOPE)
-  endif ("${_NAME}" MATCHES "^$") 
-endfunction(check_package_name)  
-
-set (PACKAGE_NAME "${PACKAGE_NAME}")
-
-check_package_name("${PACKAGE_NAME}" valid_package_name)
-if (NOT ${valid_package_name})
-  message (FATAL_ERROR "Illegal package name: (${PACKAGE_NAME})")
-endif(NOT ${valid_package_name})
-
-execute_process (COMMAND hostname -s
-  OUTPUT_VARIABLE hostname
-  OUTPUT_STRIP_TRAILING_WHITESPACE)
-
-set (LOFAR_VARIANTS_FILE ${path}/../../cmake/variants/variants.${hostname})
-
-message (STATUS "Loading settings variants ${path}/../../cmake/variants/variants")
-include (${path}/../../cmake/variants/variants)
-
-if (EXISTS ${LOFAR_VARIANTS_FILE})
-  message (STATUS "Loading settings variants " ${LOFAR_VARIANTS_FILE})
-  include (${LOFAR_VARIANTS_FILE})
-endif (EXISTS ${LOFAR_VARIANTS_FILE})
-  
-## Get compiler: e.g. ~/projects/LOFAR/build/gnu_openmpi-opt
-get_filename_component (BUILD_VARIANT ${path} NAME)
-
-
-#set ( BUILD_VARIANT gnubgp_cn )
-STRING (REGEX MATCH ".*_" compiler ${BUILD_VARIANT})
-STRING (REGEX REPLACE "_" "" compiler ${compiler})
-
-## Get variant
-STRING (REGEX MATCH "_.*" variant ${BUILD_VARIANT})
-STRING (REGEX REPLACE "_" "" variant ${variant})
-
-foreach (comp ${${compiler}_compiler})
-  STRING (REGEX MATCH "^C[CX].*=" result ${comp})
-  if (${result} STREQUAL "CC=")
-    STRING (REGEX MATCH "/.*" cc ${comp})
-    set( CMAKE_C_COMPILER ${cc} CACHE INTERNAL "gcc Compiler" FORCE )
-  elseif (${result} STREQUAL "CXX=")
-    STRING (REGEX MATCH "/.*" cc ${comp})
-    set( CMAKE_CXX_COMPILER ${cc} CACHE INTERNAL "g++ Compiler" FORCE )
-    if (${variant} STREQUAL "ion") 
-      set( CXX_COMPILE_FLAGS "${CXX_COMPILE_FLAGS} ${${variant}}" CACHE STRING "g++ Compiler flags" FORCE )
-    else (${variant} STREQUAL "ion") 
-      set( CXX_COMPILE_FLAGS "${${variant}}" CACHE STRING "g++ Compiler flags" FORCE )
-    endif (${variant} STREQUAL "ion")
-  elseif (${result} STREQUAL "CCAS=")
-    STRING (REGEX MATCH "/.*" asm ${comp})
-    set( CCAS "${asm}" CACHE STRING "Assembler" FORCE )
-  else (${result} STREQUAL "CC=")
-    message(SEND_ERROR "Invalid compiler: ${comp}")
-  endif (${result} STREQUAL "CC=")
-endforeach (comp ${${compiler}_compiler})
-
-## ------------------------------------------------------------------------------
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
 ## Project characteristics
-
-project (LOFAR)
-
-cmake_minimum_required (VERSION 2.6)
-
-## ------------------------------------------------------------------------------
-## Set CMAKE_MODULE_PATH to load custom CMake modules
-
-find_path (LOFAR_ROOT cmake/modules/CMakeSettings.cmake
-  PATHS 
-  ${LOFAR_SOURCE_DIR}
-  ${LOFAR_SOURCE_DIR}/..
-  ${LOFAR_SOURCE_DIR}/../..
-  ${LOFAR_SOURCE_DIR}/../../..
-  $ENV{LOFARSOFT}
-  )
-
-if (LOFAR_ROOT)
-  include (${LOFAR_ROOT}/cmake/modules/CMakeSettings.cmake)
-else (LOFAR_ROOT)
-  message (FATAL_ERROR "Unable to locate additional CMake scripts!")
-endif (LOFAR_ROOT)
-
-## -----------------------------------------------------------------------------
-## Include Lofar general
-
-include (LofarGeneral)
-
-## ------------------------------------------------------------------------------
-## Set debug options
-
-option (LOFAR_VERBOSE_CONFIGURE "Verbose output during configuration?" 1)
-option (LOFAR_BUILD_TESTS       "Build the test programs?"             1)
-
-## ------------------------------------------------------------------------------
-## Additional CMake modules
-
-include (CheckIncludeFiles)
-include (CheckLibraryExists)
-include (CheckCXXSourceCompiles)
-include (CheckTypeSize)
-include (CTest)
-enable_testing()
-
-## ------------------------------------------------------------------------------
-## Configure file
-
-configure_file(${CMAKE_SOURCE_DIR}/config.h.cmake
-               ${CMAKE_BINARY_DIR}/config.h)
-configure_file(${CMAKE_SOURCE_DIR}/lofar_config.h.cmake
-               ${CMAKE_BINARY_DIR}/lofar_config.h)
-
-## ------------------------------------------------------------------------------
-## Search for external libraries
-
-if (NOT LOFAR_VERBOSE_CONFIGURE)
-  set (BOOST_FIND_QUIETLY TRUE)
-  set (CASACORE_FIND_QUIETLY FALSE)
-endif (NOT LOFAR_VERBOSE_CONFIGURE)
-
-## Load module(s)
-foreach (mod ${${PACKAGE_NAME}_modules})
-  include(${CMAKE_MODULE_PATH}/${mod}.cmake)
-  STRING (REGEX REPLACE "Find" "" mod ${mod})
-  if (${mod}_FOUND)
-    string(TOUPPER ${mod} mod)
-    if (${mod} STREQUAL "BOOST")
-      include_directories (${${mod}_INCLUDE_DIR})
-    elseif (${mod} STREQUAL "MPI")
-      include_directories (${${mod}_INCLUDE_PATH})
-    else (${mod} STREQUAL "BOOST")
-      include_directories (${${mod}_INCLUDES})
-    endif (${mod} STREQUAL "BOOST")
-    if (${mod} STREQUAL "CASACORE")
-      add_definitions (-DHAVE_AIPSPP)
-    else (${mod} STREQUAL "CASACORE")
-      add_definitions (-DHAVE_${mod})
-    endif (${mod} STREQUAL "CASACORE")
-    if (${mod} STREQUAL "MPI")
-      set( CMAKE_CXX_COMPILER ${MPI_COMPILER} CACHE INTERNAL "MPI Compiler" FORCE )
-    endif (${mod} STREQUAL "MPI")
-  endif (${mod}_FOUND)
-endforeach (mod ${${PACKAGE_NAME}_modules})
-
-## ------------------------------------------------------------------------------
-## Commonly used configuration files
-
-if (${compiler} STREQUAL "gnu" OR ${compiler} STREQUAL "gnubgp")
-  set( CXX_COMPILE_FLAGS "${CXX_COMPILE_FLAGS} -W -Wall -Woverloaded-virtual -Wno-unknown-pragmas" CACHE STRING "CXX Compiler flags" FORCE )
-  add_definitions (${CXX_COMPILE_FLAGS})
-endif (${compiler} STREQUAL "gnu" OR ${compiler} STREQUAL "gnubgp")
-
-## Common compiler flags
-
-## ------------------------------------------------------------------------------
-## Module header files
-
-include_directories (
-  ## LCS
-  ${LOFAR_SOURCE_DIR}/LCS/Blob/include
-  ${LOFAR_SOURCE_DIR}/LCS/Common/include
-  ${LOFAR_SOURCE_DIR}/LCS/ACC/APS/include
-  ${LOFAR_SOURCE_DIR}/LCS/ACC/PLC/include
-  ${LOFAR_SOURCE_DIR}/LCS/AMC/AMCBase/include
-  ${LOFAR_SOURCE_DIR}/LCS/AMC/AMCImpl/include
-  ${LOFAR_SOURCE_DIR}/LCS/Transport/include
-  ${LOFAR_SOURCE_DIR}/LCS/Stream/include
-  ${LOFAR_SOURCE_DIR}/LCS/ApplCommon/include
-  ## RTCP
-  ${LOFAR_SOURCE_DIR}/RTCP/Interface/include
-  ${LOFAR_SOURCE_DIR}/RTCP/Storage/include
-  ${LOFAR_SOURCE_DIR}/RTCP/IONProc/src
-  ${LOFAR_SOURCE_DIR}/RTCP/CNProc/src
-  ${LOFAR_SOURCE_DIR}/RTCP/FCNP/src
-  )
-
-## ------------------------------------------------------------------------------
-## Check for the presence of various packages in the code tree
-
-
-## ------------------------------------------------------------------------------
-## Directories to be included in the build
-
-## --- LCS ---------------------------------------
-
-find_path (HAVE_LCS CMakeLists.txt ${LOFAR_SOURCE_DIR}/LCS)
-if (HAVE_LCS)
-  set (HAVE_LCS TRUE CACHE BOOL "Have package LCS?" FORCE)
-  add_subdirectory (LCS)
-endif (HAVE_LCS)  
-
-### --- RTCP ---------------------------------------
-
-find_path (HAVE_RTCP CMakeLists.txt ${LOFAR_SOURCE_DIR}/RTCP)
-if (HAVE_RTCP)
-  set (HAVE_RTCP TRUE CACHE BOOL "Have package RTCP?" FORCE)
-  add_subdirectory (RTCP)
-endif (HAVE_RTCP)  
-
-# ------------------------------------------------------------------------------
-## Additional target dependencies 
-message (STATUS "TEST_PROGRAMS      = ${TEST_PROGRAMS}")
-add_custom_target (check
-  ctest
-  DEPENDS ${TEST_PROGRAMS}
-)
-
-## ==============================================================================
-##
-## Feedback on configuration settings
-##
-## ==============================================================================
-
-if (LOFAR_VERBOSE_CONFIGURE)
-  message (STATUS "-----------------------------------------------------------------")
-  message (STATUS "[LOFAR] Configuration summary")
-  message (STATUS "PACKAGE_NAME            = ${PACKAGE_NAME}")
-  message (STATUS "LOFAR_SOURCE_DIR        = ${LOFAR_SOURCE_DIR}")
-  message (STATUS "CMAKE_C_COMPILER        = ${CMAKE_C_COMPILER}")
-  message (STATUS "CMAKE_CXX_COMPILER      = ${CMAKE_CXX_COMPILER}")
-  message (STATUS "CCAS                    = ${CCAS}")
-  message (STATUS "CXX_COMPILE_FLAGS       = ${CXX_COMPILE_FLAGS}")
-  message (STATUS "CMAKE_MODULE_PATH       = ${CMAKE_MODULE_PATH}")
-  message (STATUS "Have package MPI        = ${MPI_FOUND}")
-  message (STATUS "Boost++                 = ${Boost_FOUND}")
-  message (STATUS "Boost++ includes        = ${Boost_INCLUDE_DIR}")
-  message (STATUS "Boost++ libraries       = ${Boost_LIBRARIES}")
-  message (STATUS "CasaCore                = ${CASACORE_FOUND}")
-  message (STATUS "Log4CPlus               = ${Log4CPlus_FOUND}")
-  message (STATUS "SHMEM                   = ${HAVE_SHEM}")
-  message (STATUS "Backtrace               = ${Backtrace_FOUND}")
-  message (STATUS "-----------------------------------------------------------------")
-endif (LOFAR_VERBOSE_CONFIGURE)
+## ---------------------------------------------------------------------------
+project(LOFAR)
+include(LofarGeneral)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(LCS)
+#add_subdirectory(CEP)
+#add_subdirectory(RTCP)
+add_subdirectory(SAS)
+add_subdirectory(MAC)
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
+
+get_directory_property(def DEFINITIONS)
+message(STATUS "COMPILE_DEFINITIONS = ${def}")
+
+if(0)
+  get_cmake_property(cache_vars CACHE_VARIABLES)
+  message(STATUS "vvvvvvvv Cache variables vvvvvvvv")
+  foreach(var ${cache_vars})
+    message(STATUS "[cached] ${var} = ${${var}}")
+  endforeach(var ${cache_vars})
+  message(STATUS "^^^^^^^^ Cache variables ^^^^^^^^")
+  message(STATUS "vvvvvvvv Variables vvvvvvvv")
+  include(AllVariables)
+  all_variables()
+  message(STATUS "^^^^^^^^ Variables ^^^^^^^^")
+endif(0)
diff --git a/LCS/ACC/ALC/CMakeLists.txt b/LCS/ACC/ALC/CMakeLists.txt
new file mode 100644
index 00000000000..f869f45a684
--- /dev/null
+++ b/LCS/ACC/ALC/CMakeLists.txt
@@ -0,0 +1,52 @@
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
+## Project characteristics
+## ---------------------------------------------------------------------------
+project(ALC)
+include(LofarGeneral)
+
+include(LofarAddPackage)
+lofar_add_package(${PROJECT_NAME} 2.1 DEPENDS Common Blob Transport)
+
+## ---------------------------------------------------------------------------
+## External packages
+## ---------------------------------------------------------------------------
+include(LofarFindPackage)
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(include/ALC)
+add_subdirectory(src)
+add_subdirectory(test EXCLUDE_FROM_ALL)
diff --git a/LCS/ACC/ALC/include/ALC/CMakeLists.txt b/LCS/ACC/ALC/include/ALC/CMakeLists.txt
new file mode 100644
index 00000000000..28c7cddcff4
--- /dev/null
+++ b/LCS/ACC/ALC/include/ALC/CMakeLists.txt
@@ -0,0 +1,20 @@
+# List of header files that will be installed.
+set (inst_HEADERS
+  Package__Version.h
+  ACCmd.h
+  ACAsyncClient.h
+  ACRequest.h
+  ACSyncClient.h
+  ApplControlClient.h
+  ApplControlComm.h
+  ApplControl.h
+  ApplControlServer.h
+  DH_ApplControl.h)
+
+# Create symbolic link to include directory.
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink 
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_BINARY_DIR}/include/${PROJECT_NAME})
+
+# Install header files.
+install(FILES ${inst_HEADERS} DESTINATION include/${PROJECT_NAME})
diff --git a/LCS/ACC/ALC/src/CMakeLists.txt b/LCS/ACC/ALC/src/CMakeLists.txt
new file mode 100644
index 00000000000..761fc0745d3
--- /dev/null
+++ b/LCS/ACC/ALC/src/CMakeLists.txt
@@ -0,0 +1,41 @@
+#  $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
+
+include(LofarPackageVersion)
+
+set(alc_LIB_SRCS
+  Package__Version.cc
+  ACCmd.cc
+  DH_ApplControl.cc
+  ApplControlComm.cc
+  ApplControlClient.cc
+  ACSyncClient.cc
+  ACAsyncClient.cc
+  ApplControlServer.cc)
+
+set(alc_PROGRAMS
+  versionalc
+)
+
+lofar_add_library(alc ${alc_LIB_SRCS})
+
+foreach(prog ${alc_PROGRAMS})
+  lofar_add_executable(${prog} ${prog}.cc)
+endforeach(prog ${alc_PROGRAMS})
diff --git a/LCS/ACC/ALC/test/CMakeLists.txt b/LCS/ACC/ALC/test/CMakeLists.txt
new file mode 100644
index 00000000000..3c1bd3c4e0d
--- /dev/null
+++ b/LCS/ACC/ALC/test/CMakeLists.txt
@@ -0,0 +1,5 @@
+include(LofarCTest)
+
+lofar_add_executable(tACServer tACServer.cc)
+lofar_add_executable(tACClient tACClient.cc)
+lofar_add_executable(tACCmd    tACCmd.cc)
diff --git a/LCS/ACC/CMakeLists.txt b/LCS/ACC/CMakeLists.txt
index 7ff696fdb87..c7e96f67629 100644
--- a/LCS/ACC/CMakeLists.txt
+++ b/LCS/ACC/CMakeLists.txt
@@ -1,28 +1,43 @@
-## ------------------------------------------------------------------------------
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
 ## Project characteristics
-
-project (ACC)
-
-cmake_minimum_required (VERSION 2.6)
-
-## ------------------------------------------------------------------------------
-## Directories to be included in the build
-
-## --- APS ------------------------------------------
-
-find_path (HAVE_APS CMakeLists.txt ${LOFAR_SOURCE_DIR}/LCS/ACC/APS)
-
-if (HAVE_APS)
-  set (HAVE_APS TRUE CACHE BOOL "Have package APS?" FORCE)
-  add_subdirectory (APS)
-endif (HAVE_APS)  
-
-## --- PLC ------------------------------------------
-
-find_path (HAVE_PLC CMakeLists.txt ${LOFAR_SOURCE_DIR}/LCS/ACC/PLC)
-
-if (HAVE_PLC)
-  set (HAVE_PLC TRUE CACHE BOOL "Have package PLC?" FORCE)
-  add_subdirectory (PLC)
-endif (HAVE_PLC)  
-
+## ---------------------------------------------------------------------------
+project(ACC)
+include(LofarGeneral)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+lofar_add_subdirectory(ALC)
+lofar_add_subdirectory(PLC)
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
diff --git a/LCS/ACC/PLC/CMakeLists.txt b/LCS/ACC/PLC/CMakeLists.txt
index 7e55982b051..3dd0e020e8f 100644
--- a/LCS/ACC/PLC/CMakeLists.txt
+++ b/LCS/ACC/PLC/CMakeLists.txt
@@ -1,28 +1,53 @@
-## ------------------------------------------------------------------------------
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
 ## Project characteristics
-
-project (PLC)
-
-cmake_minimum_required (VERSION 2.6)
-
-## ------------------------------------------------------------------------------
-## Enable test?
-
-option (PLC_ENABLE_TESTING "Enable building and executing test programs?" NO  )
-
-## ------------------------------------------------------------------------------
-## Directories to be included in the build
-
-include_directories (${PLC_BINARY_DIR}/include)
-
-configure_file(${CMAKE_SOURCE_DIR}/config.h.cmake
-               ${PLC_BINARY_DIR}/include/config.h)
-configure_file(${PLC_SOURCE_DIR}/lofar_config.h.cmake
-               ${PLC_BINARY_DIR}/include/lofar_config.h)
-	       
-add_subdirectory (include)
-add_subdirectory (src)
-
-if (PLC_ENABLE_TESTING)
-  add_subdirectory (test)
-endif (PLC_ENABLE_TESTING) 
+## ---------------------------------------------------------------------------
+project(PLC)
+include(LofarGeneral)
+
+include(LofarAddPackage)
+lofar_add_package(${PROJECT_NAME} 2.1 DEPENDS Common Blob Transport)
+
+## ---------------------------------------------------------------------------
+## External packages
+## ---------------------------------------------------------------------------
+include(LofarFindPackage)
+lofar_find_package(Boost REQUIRED)
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(include/PLC)
+add_subdirectory(src)
+add_subdirectory(test EXCLUDE_FROM_ALL)
diff --git a/LCS/ACC/PLC/include/PLC/CMakeLists.txt b/LCS/ACC/PLC/include/PLC/CMakeLists.txt
index 438322c1785..29b1ad8d8d7 100644
--- a/LCS/ACC/PLC/include/PLC/CMakeLists.txt
+++ b/LCS/ACC/PLC/include/PLC/CMakeLists.txt
@@ -1,20 +1,20 @@
-## ------------------------------------------------------------------------------
-## Include files
+# List of header files that will be installed.
+set (inst_HEADERS
+  Package__Version.h
+  DH_ProcControl.h
+  PCCmd.h
+  ProcControlComm.h
+  ProcControlServer.h
+  ProcessControl.h
+  ProcCtrlProxy.h
+  ProcCtrlCmdLine.h
+  ProcCtrlRemote.h
+  ACCmain.h)
 
-file (GLOB libplc_HEADERS DH_ProcControl.h
-			  BGLConnection.h
-			  PCCmd.h
-			  ProcControlComm.h
-			  ProcControlServer.h
-			  ProcessControl.h
-			  ProcCtrlProxy.h
-			  ProcCtrlCmdLine.h
-			  ProcCtrlRemote.h
-			  ACCmain.h )
+# Create symbolic link to include directory.
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink 
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_BINARY_DIR}/include/${PROJECT_NAME})
 
-## ------------------------------------------------------------------------------
-## Installation
-   
-install (FILES ${libplc_HEADERS}
-  DESTINATION include/PLC
-  )
+# Install header files.
+install(FILES ${inst_HEADERS} DESTINATION include/${PROJECT_NAME})
diff --git a/LCS/ACC/PLC/src/CMakeLists.txt b/LCS/ACC/PLC/src/CMakeLists.txt
index 4ccd6706e63..38cfa68b6fa 100644
--- a/LCS/ACC/PLC/src/CMakeLists.txt
+++ b/LCS/ACC/PLC/src/CMakeLists.txt
@@ -1,22 +1,41 @@
-## ------------------------------------------------------------------------------
-## Build the library
+#  $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
 
-file (GLOB libplc_SOURCES DH_ProcControl.cc
-			  PCCmd.cc
-			  ProcControlComm.cc
-			  ProcControlServer.cc
-			  ProcCtrlProxy.cc
-			  ProcCtrlCmdLine.cc
-			  ProcCtrlRemote.cc
-			  ACCmain.cc)
+include(LofarPackageVersion)
 
-add_library (plc ${libplc_SOURCES})
+set(plc_LIB_SRCS
+  Package__Version.cc
+  DH_ProcControl.cc
+  PCCmd.cc
+  ProcControlComm.cc
+  ProcControlServer.cc
+  ProcCtrlProxy.cc
+  ProcCtrlCmdLine.cc
+  ProcCtrlRemote.cc
+  ACCmain.cc)
 
-## ------------------------------------------------------------------------------
-## Installation
+set(plc_PROGRAMS
+  versionplc)
 
-install (
-  TARGETS plc
-  LIBRARY DESTINATION lib
-  ARCHIVE DESTINATION lib
-  )
+lofar_add_library(plc ${plc_LIB_SRCS})
+
+foreach(prog ${plc_PROGRAMS})
+  lofar_add_executable(${prog} ${prog}.cc)
+endforeach(prog ${plc_PROGRAMS})
diff --git a/LCS/ACC/PLC/test/CMakeLists.txt b/LCS/ACC/PLC/test/CMakeLists.txt
index 447026da61a..2252dbf9d88 100644
--- a/LCS/ACC/PLC/test/CMakeLists.txt
+++ b/LCS/ACC/PLC/test/CMakeLists.txt
@@ -1,32 +1,8 @@
-cmake_minimum_required (VERSION 2.6)
+include(LofarCTest)
 
-include(LOFARTest)
-include_directories ( ${LOFAR_SOURCE_DIR}/LCS/ACC/PLC/test )
+set(CHECK_PROGRAMS
+  tPCCmd)
 
-## ------------------------------------------------------------------------------
-## Sourses
-
-file (GLOB tPCCmd_SRCS tPCCmd.cc )
-
-## --- Macro(s) -------------------------------------
-
-MACRO (TARGETLINKLIBRARIES_PLC_TEST _PROG)
-  target_link_libraries (${_PROG} 
-                         plc
-			 ${LOG4CPLUS_LIBRARIES}
-			 ${BACKTRACE_LIBRARIES}
-			 ${SHMEM_LIBRARIES} )
-ENDMACRO (TARGETLINKLIBRARIES_PLC_TEST)
-
-## --- Programs to be built -------------------------
-
-set (CHECKPROGS
-     tPCCmd
-)
-
-foreach (prog ${CHECKPROGS})
-  add_executable (${prog} ${${prog}_SRCS})
-  TARGETLINKLIBRARIES_PLC_TEST (${prog})
-endforeach (prog ${CHECKPROGS})
-
-## --- Programs to be run ---------------------------
+foreach(prog ${CHECK_PROGRAMS})
+  lofar_add_executable(${prog} ${prog}.cc)
+endforeach(prog ${CHECK_PROGRAMS})
diff --git a/LCS/ACC/PLC/test/tPCCmd.cc b/LCS/ACC/PLC/test/tPCCmd.cc
index a62f7e69633..f228335ee98 100644
--- a/LCS/ACC/PLC/test/tPCCmd.cc
+++ b/LCS/ACC/PLC/test/tPCCmd.cc
@@ -7,7 +7,7 @@ using namespace LOFAR::ACC::PLC;
 
 #define NAME_TEST(cmd)	cout <<	"value: " << (cmd) << " = " << PCCmdName(cmd) << endl;
 
-int main (int /*argc*/, char /* *argv[]*/) {
+int main (int /*argc*/, char** /*argv*/) {
 	NAME_TEST(PCCmdNone);
 	NAME_TEST(PCCmdBoot);
 	NAME_TEST(PCCmdQuit);
diff --git a/LCS/AMC/AMCBase/CMakeLists.txt b/LCS/AMC/AMCBase/CMakeLists.txt
index 51d258b9807..85fe831fce6 100644
--- a/LCS/AMC/AMCBase/CMakeLists.txt
+++ b/LCS/AMC/AMCBase/CMakeLists.txt
@@ -1,28 +1,52 @@
-## ------------------------------------------------------------------------------
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
 ## Project characteristics
-
-project (AMCBase)
-
-cmake_minimum_required (VERSION 2.6)
-
-## ------------------------------------------------------------------------------
-## Enable test?
-
-option (AMCBASE_ENABLE_TESTING "Enable building and executing test programs?" NO  )
-
-## ------------------------------------------------------------------------------
-## Directories to be included in the build
-
-include_directories (${AMCBase_BINARY_DIR}/include)
-
-configure_file(${CMAKE_SOURCE_DIR}/config.h.cmake
-               ${AMCBase_BINARY_DIR}/include/config.h)
-configure_file(${AMCBase_SOURCE_DIR}/lofar_config.h.cmake
-               ${AMCBase_BINARY_DIR}/include/lofar_config.h)
-	       
-add_subdirectory (include)
-add_subdirectory (src)
-
-if (AMCBASE_ENABLE_TESTING)
-  add_subdirectory (test)
-endif (AMCBASE_ENABLE_TESTING) 
+## ---------------------------------------------------------------------------
+project(AMCBase)
+include(LofarGeneral)
+
+include(LofarAddPackage)
+lofar_add_package(${PROJECT_NAME} 2.0 DEPENDS Common Blob Transport)
+
+## ---------------------------------------------------------------------------
+## External packages
+## ---------------------------------------------------------------------------
+include(LofarFindPackage)
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(include/AMCBase)
+add_subdirectory(src)
+add_subdirectory(test EXCLUDE_FROM_ALL)
diff --git a/LCS/AMC/AMCBase/include/AMCBase/CMakeLists.txt b/LCS/AMC/AMCBase/include/AMCBase/CMakeLists.txt
index 86e53ef7f83..da466436418 100644
--- a/LCS/AMC/AMCBase/include/AMCBase/CMakeLists.txt
+++ b/LCS/AMC/AMCBase/include/AMCBase/CMakeLists.txt
@@ -1,24 +1,25 @@
-## ------------------------------------------------------------------------------
-## Include files
+# List of header files that will be installed.
+set (inst_HEADERS
+  Package__Version.h
+  BlobIO.h
+  ConverterClient.h
+  ConverterCommand.h
+  Converter.h
+  ConverterStatus.h
+  Coord3D.h
+  DH_Request.h
+  DH_Result.h
+  Direction.h
+  Epoch.h
+  Exceptions.h
+  Position.h
+  RequestData.h
+  ResultData.h)
 
-file (GLOB libamcbase_HEADERS BlobIO.h
-			      ConverterClient.h
-			      ConverterCommand.h
-			      Converter.h
-			      ConverterStatus.h
-			      Coord3D.h
-			      DH_Request.h
-			      DH_Result.h
-			      Direction.h
-			      Epoch.h
-			      Exceptions.h
-			      Position.h
-			      RequestData.h
-			      ResultData.h )
+# Create symbolic link to include directory.
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink 
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_BINARY_DIR}/include/${PROJECT_NAME})
 
-## ------------------------------------------------------------------------------
-## Installation
-   
-install (FILES ${libamcbase_HEADERS}
-  DESTINATION include/AMCBase
-  )
+# Install header files.
+install(FILES ${inst_HEADERS} DESTINATION include/${PROJECT_NAME})
diff --git a/LCS/AMC/AMCBase/src/CMakeLists.txt b/LCS/AMC/AMCBase/src/CMakeLists.txt
index d7fd2556e5b..aa692b38864 100644
--- a/LCS/AMC/AMCBase/src/CMakeLists.txt
+++ b/LCS/AMC/AMCBase/src/CMakeLists.txt
@@ -1,25 +1,44 @@
-## ------------------------------------------------------------------------------
-## Build the library
+#  $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
 
-file (GLOB libamcbase_SOURCES BlobIO.cc
-			      ConverterClient.cc
-			      ConverterCommand.cc
-			      ConverterStatus.cc
-			      Coord3D.cc
-			      DH_Request.cc
-			      DH_Result.cc
-			      Direction.cc
-			      Epoch.cc
-			      Position.cc )
+include(LofarPackageVersion)
 
-add_library (amcbase ${libamcbase_SOURCES})
+set(amcbase_LIB_SRCS
+  Package__Version.cc
+  BlobIO.cc
+  ConverterClient.cc
+  ConverterCommand.cc
+  ConverterStatus.cc
+  Coord3D.cc
+  DH_Request.cc
+  DH_Result.cc
+  Direction.cc
+  Epoch.cc
+  Position.cc)
 
-## ------------------------------------------------------------------------------
-## Installation
+set(amcbase_PROGRAMS
+  versionamcbase
+)
 
-install (
-  TARGETS amcbase
-  LIBRARY DESTINATION lib
-  ARCHIVE DESTINATION lib
-  )
+lofar_add_library(amcbase ${amcbase_LIB_SRCS})
 
+foreach(prog ${amcbase_PROGRAMS})
+  lofar_add_executable(${prog} ${prog}.cc)
+endforeach(prog ${amcbase_PROGRAMS})
diff --git a/LCS/AMC/AMCBase/test/CMakeLists.txt b/LCS/AMC/AMCBase/test/CMakeLists.txt
index cd0835d568f..b1d52556675 100644
--- a/LCS/AMC/AMCBase/test/CMakeLists.txt
+++ b/LCS/AMC/AMCBase/test/CMakeLists.txt
@@ -1,68 +1,11 @@
-cmake_minimum_required (VERSION 2.6)
-
-include(LOFARTest)
-include_directories ( ${LOFAR_SOURCE_DIR}/LCS/AMC/AMCBase/test )
-
-## ------------------------------------------------------------------------------
-## Sourses
-
-file (GLOB tCoord3D_SRCS          tCoord3D.cc )
-file (GLOB tDirection_SRCS        tDirection.cc )
-file (GLOB tPosition_SRCS         tPosition.cc )
-file (GLOB tEpoch_SRCS            tEpoch.cc )
-file (GLOB tConverterCommand_SRCS tConverterCommand.cc )
-file (GLOB tConverterStatus_SRCS  tConverterStatus.cc )
-file (GLOB tBlobIO_SRCS           tBlobIO.cc )
-file (GLOB tDH_Request_SRCS       tDH_Request.cc )
-file (GLOB tDH_Result_SRCS        tDH_Result.cc )
-
-## --- Macro(s) -------------------------------------
-
-MACRO (TARGETLINKLIBRARIES_AMCBASE_TEST _PROG)
-  target_link_libraries (${_PROG} 
-                         amcbase
-			 transport
-			 blob
-			 common
-			 ${LOG4CPLUS_LIBRARIES}
-			 ${BACKTRACE_LIBRARIES}
-			 ${SHMEM_LIBRARIES} )
-ENDMACRO (TARGETLINKLIBRARIES_AMCBASE_TEST)
-
-## --- Programs to be built -------------------------
-
-set (CHECKPROGS
-     tCoord3D
-     tDirection
-     tPosition
-     tEpoch
-     tConverterCommand
-     tConverterStatus
-     tBlobIO
-     tDH_Request
-     tDH_Result
-)
-
-foreach (prog ${CHECKPROGS})
-  add_executable (${prog} ${${prog}_SRCS})
-  TARGETLINKLIBRARIES_AMCBASE_TEST (${prog})
-endforeach (prog ${CHECKPROGS})
-
-## --- Programs to be run ---------------------------
-
-set (CHECKTOOLPROGS
-     tCoord3D
-     tDirection
-     tPosition
-     tEpoch
-     tConverterCommand
-     tConverterStatus
-     tBlobIO
-     tDH_Request
-     tDH_Result
-)
-
-foreach (prog ${CHECKTOOLPROGS})
-  add_test(${prog} ${CMAKE_CURRENT_SOURCE_DIR}/${prog}.sh) 
-  set (TEST_PROGRAMS "${TEST_PROGRAMS};${prog}" CACHE STRING "Test programs" FORCE)
-endforeach (prog ${CHECKTOOLPROGS})
+include(LofarCTest)
+
+lofar_add_test(tCoord3D tCoord3D.cc)
+lofar_add_test(tDirection tDirection.cc)
+lofar_add_test(tPosition tPosition.cc)
+lofar_add_test(tEpoch tEpoch.cc)
+lofar_add_test(tConverterCommand tConverterCommand.cc)
+lofar_add_test(tConverterStatus tConverterStatus.cc)
+lofar_add_test(tBlobIO tBlobIO.cc)
+lofar_add_test(tDH_Request tDH_Request.cc)
+lofar_add_test(tDH_Result tDH_Result.cc)
diff --git a/LCS/AMC/AMCImpl/CMakeLists.txt b/LCS/AMC/AMCImpl/CMakeLists.txt
index e748878f4f6..cdef6d2e348 100644
--- a/LCS/AMC/AMCImpl/CMakeLists.txt
+++ b/LCS/AMC/AMCImpl/CMakeLists.txt
@@ -1,29 +1,53 @@
-
-## ------------------------------------------------------------------------------
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
 ## Project characteristics
-
-project (AMCImpl)
-
-cmake_minimum_required (VERSION 2.6)
-
-## ------------------------------------------------------------------------------
-## Enable test?
-
-option (AMCIMPLE_ENABLE_TESTING "Enable building and executing test programs?" NO  )
-
-## ------------------------------------------------------------------------------
-## Directories to be included in the build
-
-include_directories (${AMCImpl_BINARY_DIR}/include)
-
-configure_file(${CMAKE_SOURCE_DIR}/config.h.cmake
-               ${AMCImpl_BINARY_DIR}/include/config.h)
-configure_file(${AMCImpl_SOURCE_DIR}/lofar_config.h.cmake
-               ${AMCImpl_BINARY_DIR}/include/lofar_config.h)
-	       
-add_subdirectory (include)
-add_subdirectory (src)
-
-if (AMCIMPLE_ENABLE_TESTING)
-  add_subdirectory (test)
-endif (AMCIMPLE_ENABLE_TESTING) 
+## ---------------------------------------------------------------------------
+project(AMCImpl)
+include(LofarGeneral)
+
+include(LofarAddPackage)
+lofar_add_package(${PROJECT_NAME} 2.0 DEPENDS Common Transport AMCBase)
+
+## ---------------------------------------------------------------------------
+## External packages
+## ---------------------------------------------------------------------------
+include(LofarFindPackage)
+lofar_find_package(Casacore COMPONENTS measures REQUIRED)
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(include/AMCImpl)
+add_subdirectory(src)
+add_subdirectory(test EXCLUDE_FROM_ALL)
diff --git a/LCS/AMC/AMCImpl/include/AMCImpl/CMakeLists.txt b/LCS/AMC/AMCImpl/include/AMCImpl/CMakeLists.txt
index c2395c0077b..afc2fe98ab7 100644
--- a/LCS/AMC/AMCImpl/include/AMCImpl/CMakeLists.txt
+++ b/LCS/AMC/AMCImpl/include/AMCImpl/CMakeLists.txt
@@ -1,13 +1,14 @@
-## ------------------------------------------------------------------------------
-## Include files
+# List of header files that will be installed.
+set (inst_HEADERS
+  Package__Version.h
+  ConverterImpl.h
+  ConverterProcess.h
+  ConverterServer.h)
 
-file (GLOB libamcimpl_HEADERS ConverterImpl.h
-			      ConverterProcess.h
-			      ConverterServer.h )
+# Create symbolic link to include directory.
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink 
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_BINARY_DIR}/include/${PROJECT_NAME})
 
-## ------------------------------------------------------------------------------
-## Installation
-   
-install (FILES ${libamcimpl_HEADERS}
-  DESTINATION include/AMCImpl
-  )
+# Install header files.
+install(FILES ${inst_HEADERS} DESTINATION include/${PROJECT_NAME})
diff --git a/LCS/AMC/AMCImpl/src/CMakeLists.txt b/LCS/AMC/AMCImpl/src/CMakeLists.txt
index 6a0b04b8242..d2d22fda130 100644
--- a/LCS/AMC/AMCImpl/src/CMakeLists.txt
+++ b/LCS/AMC/AMCImpl/src/CMakeLists.txt
@@ -1,41 +1,43 @@
-## --- Macro(s) -------------------------------------
-
-MACRO (TARGETLINKLIBRARIES_AMCIMPL_SRC _PROG)
-  target_link_libraries (${_PROG} 
-                	 amcimpl
-			 amcbase
-			 transport
-			 blob
-			 common
-			 ${CASACORE_LIBRARIES}
-	        	 ${LOG4CPLUS_LIBRARIES}
-			 ${BACKTRACE_LIBRARIES}
-			 ${SHMEM_LIBRARIES} )
-ENDMACRO (TARGETLINKLIBRARIES_AMCIMPL_SRC)
-
-## ------------------------------------------------------------------------------
-## Build the library
-
-file (GLOB libamcimpl_SOURCES ConverterImpl.cc
-			      ConverterProcess.cc
-			      ConverterServer.cc )
-
-add_library (amcimpl ${libamcimpl_SOURCES})
-
-## ------------------------------------------------------------------------------
-## Build Programs
-
-add_executable (AMCServer AMCServer.cc)
-TARGETLINKLIBRARIES_AMCIMPL_SRC (AMCServer)
-
-add_executable (WGS84toITRF WGS84toITRF.cc)
-TARGETLINKLIBRARIES_AMCIMPL_SRC (WGS84toITRF)
-
-## ------------------------------------------------------------------------------
-## Installation
-
-install (
-  TARGETS amcimpl
-  LIBRARY DESTINATION lib
-  ARCHIVE DESTINATION lib
-  )
+#  $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
+
+include(LofarPackageVersion)
+
+set(amcimpl_LIB_SRCS
+  Package__Version.cc
+  ConverterImpl.cc
+  ConverterProcess.cc
+  ConverterServer.cc
+)
+
+set(amcimpl_PROGRAMS
+  versionamcimpl
+  AMCServer
+  WGS84toITRF)
+
+## Suppress warnings from the Casacore Measures component.
+#set_source_files_properties(${amcimpl_LIB_SRCS} ${amcimpl_PROGRAMS}
+#  PROPERTIES COMPILE_FLAGS "-Wno-ignored-qualifiers")
+
+lofar_add_library(amcimpl ${amcimpl_LIB_SRCS})
+
+foreach(prog ${amcimpl_PROGRAMS})
+  lofar_add_executable(${prog} ${prog}.cc)
+endforeach(prog ${amcimpl_PROGRAMS})
diff --git a/LCS/AMC/AMCImpl/test/CMakeLists.txt b/LCS/AMC/AMCImpl/test/CMakeLists.txt
index 7bfaf158710..8b6a33d5699 100644
--- a/LCS/AMC/AMCImpl/test/CMakeLists.txt
+++ b/LCS/AMC/AMCImpl/test/CMakeLists.txt
@@ -1,50 +1,4 @@
-cmake_minimum_required (VERSION 2.6)
+include(LofarCTest)
 
-include(LOFARTest)
-include_directories ( ${LOFAR_SOURCE_DIR}/LCS/AMC/AMCImpl/test )
-
-## ------------------------------------------------------------------------------
-## Sourses
-
-file (GLOB tConverter_SRCS       tConverter.cc )
-file (GLOB tConverterStress_SRCS tConverterStress.cc )
-
-## --- Macro(s) -------------------------------------
-
-MACRO (TARGETLINKLIBRARIES_AMCIMPL_TEST _PROG)
-  target_link_libraries (${_PROG} 
-                         amcimpl
-			 amcbase
-			 transport
-			 blob
-			 common
-			 ${CASACORE_LIBRARIES}
-			 ${LOG4CPLUS_LIBRARIES}
-			 ${BACKTRACE_LIBRARIES}
-			 ${SHMEM_LIBRARIES} )
-ENDMACRO (TARGETLINKLIBRARIES_AMCIMPL_TEST)
-
-## --- Programs to be built -------------------------
-
-set (CHECKPROGS
-     tConverter
-     tConverterStress
-)
-
-foreach (prog ${CHECKPROGS})
-  add_executable (${prog} ${${prog}_SRCS})
-  TARGETLINKLIBRARIES_AMCIMPL_TEST (${prog})
-  add_dependencies (${prog} AMCServer)
-endforeach (prog ${CHECKPROGS})
-
-## --- Programs to be run ---------------------------
-
-set (CHECKTOOLPROGS
-     tConverter
-     tConverterStress
-)
-
-foreach (prog ${CHECKTOOLPROGS})
-  add_test(${prog} ${CMAKE_CURRENT_SOURCE_DIR}/${prog}.sh) 
-  set (TEST_PROGRAMS "${TEST_PROGRAMS};${prog}" CACHE STRING "Test programs" FORCE)
-endforeach (prog ${CHECKTOOLPROGS})
+lofar_add_test(tConverter tConverter.cc)
+lofar_add_test(tConverterStress tConverterStress.cc)
diff --git a/LCS/AMC/CMakeLists.txt b/LCS/AMC/CMakeLists.txt
index a2a3dbd5356..96eb23c9146 100644
--- a/LCS/AMC/CMakeLists.txt
+++ b/LCS/AMC/CMakeLists.txt
@@ -1,25 +1,43 @@
-## ------------------------------------------------------------------------------
-## Project characteristics
-
-project (AMC)
+#  $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
 
-cmake_minimum_required (VERSION 2.6)
+cmake_minimum_required(VERSION 2.6)
 
-## ------------------------------------------------------------------------------
-## Directories to be included in the build
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
 
-## --- AMCBASE --------------------------------------
-
-find_path (HAVE_AMCBASE CMakeLists.txt ${LOFAR_SOURCE_DIR}/LCS/AMC/AMCBase)
+## ---------------------------------------------------------------------------
+## Project characteristics
+## ---------------------------------------------------------------------------
+project(AMC)
+include(LofarGeneral)
 
-if (HAVE_AMCBASE)
-  set (HAVE_AMCBASE TRUE CACHE BOOL "Have package AMCBase?" FORCE)
-  add_subdirectory (AMCBase)
-endif (HAVE_AMCBASE)  
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+lofar_add_subdirectory(AMCBase)
+lofar_add_subdirectory(AMCImpl)
 
-## --- AMCIMPL -------------------------------------
-find_path (HAVE_AMCIMPL CMakeLists.txt ${LOFAR_SOURCE_DIR}/LCS/AMC/AMCImpl)
-if (HAVE_AMCIMPL)
-  set (HAVE_AMCIMPL TRUE CACHE BOOL "Have package AMCImpl?" FORCE)
-  add_subdirectory (AMCImpl)
-endif (HAVE_AMCIMPL)  
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
diff --git a/LCS/ApplCommon/CMakeLists.txt b/LCS/ApplCommon/CMakeLists.txt
index f13a364ea46..ea0fc9c210d 100644
--- a/LCS/ApplCommon/CMakeLists.txt
+++ b/LCS/ApplCommon/CMakeLists.txt
@@ -1,31 +1,53 @@
-## ------------------------------------------------------------------------------
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
 ## Project characteristics
-
-project (ApplCommon)
-
-cmake_minimum_required (VERSION 2.6)
-
-## ------------------------------------------------------------------------------
-## Enable test?
-
-option (APPLCOMMON_ENABLE_TESTING "Enable building and executing test programs?" NO  )
-
-## ------------------------------------------------------------------------------
-## Directories to be included in the build
-
-## ------------------------------------------------------------------------------
-## Directories to be included in the build
-
-include_directories (${ApplCommon_BINARY_DIR}/include)
-
-configure_file(${CMAKE_SOURCE_DIR}/config.h.cmake
-               ${ApplCommon_BINARY_DIR}/include/config.h)
-configure_file(${ApplCommon_SOURCE_DIR}/lofar_config.h.cmake
-               ${ApplCommon_BINARY_DIR}/include/lofar_config.h)
-	       
-add_subdirectory (include)
-add_subdirectory (src)
-
-if (APPLCOMMON_ENABLE_TESTING)
-  add_subdirectory (test)
-endif (APPLCOMMON_ENABLE_TESTING)  
+## ---------------------------------------------------------------------------
+project(ApplCommon)
+include(LofarGeneral)
+
+include(LofarAddPackage)
+lofar_add_package(${PROJECT_NAME} 3.1 DEPENDS Common)
+
+## ---------------------------------------------------------------------------
+## External packages
+## ---------------------------------------------------------------------------
+include(LofarFindPackage)
+lofar_find_package(Boost COMPONENTS date_time regex)
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(include/ApplCommon)
+add_subdirectory(src)
+add_subdirectory(test EXCLUDE_FROM_ALL)
diff --git a/LCS/ApplCommon/include/ApplCommon/CMakeLists.txt b/LCS/ApplCommon/include/ApplCommon/CMakeLists.txt
index 02a9e2fce4f..832473a66fe 100644
--- a/LCS/ApplCommon/include/ApplCommon/CMakeLists.txt
+++ b/LCS/ApplCommon/include/ApplCommon/CMakeLists.txt
@@ -1,11 +1,33 @@
-## ------------------------------------------------------------------------------
-## Include files
+#  $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
 
-file (GLOB libapplcommon_HEADERS Observation.h )
+# List of header files that will be installed.
+set(inst_HEADERS
+  Package__Version.h
+  Observation.h)
+
+# Create symbolic link to include directory.
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink 
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_BINARY_DIR}/include/${PROJECT_NAME})
+
+# Install header files.
+install(FILES ${inst_HEADERS} DESTINATION include/${PROJECT_NAME})
 
-## ------------------------------------------------------------------------------
-## Installation
-   
-install (FILES ${libapplcommon_HEADERS}
-  DESTINATION include/ApplCommon
-  )
diff --git a/LCS/ApplCommon/src/CMakeLists.txt b/LCS/ApplCommon/src/CMakeLists.txt
index 64487ea209d..c3d1d846e78 100644
--- a/LCS/ApplCommon/src/CMakeLists.txt
+++ b/LCS/ApplCommon/src/CMakeLists.txt
@@ -1,16 +1,35 @@
-## ------------------------------------------------------------------------------
-## Build the library
+#  $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
 
-file (GLOB libapplcommon_SOURCES Observation.cc )
+include(LofarPackageVersion)
 
-add_library (applcommon ${libapplcommon_SOURCES})
+set(applcommon_LIB_SRCS
+  Package__Version.cc
+  Observation.cc)
 
-## ------------------------------------------------------------------------------
-## Installation
+set(applcommon_PROGRAMS
+  versionapplcommon)
 
-install (
-  TARGETS applcommon
-  LIBRARY DESTINATION lib
-  ARCHIVE DESTINATION lib
-  )
+lofar_add_library(applcommon ${applcommon_LIB_SRCS})
+
+foreach(prog ${stream_PROGRAMS})
+  lofar_add_executable(${prog} ${prog}.cc)
+endforeach(prog ${stream_PROGRAMS})
 
diff --git a/LCS/ApplCommon/test/CMakeLists.txt b/LCS/ApplCommon/test/CMakeLists.txt
index 68e965e5a71..8877d12d399 100644
--- a/LCS/ApplCommon/test/CMakeLists.txt
+++ b/LCS/ApplCommon/test/CMakeLists.txt
@@ -1,43 +1,23 @@
-cmake_minimum_required (VERSION 2.6)
-
-include(LOFARTest)
-include_directories ( ${LOFAR_SOURCE_DIR}/LCS/ApplCommon/test )
-
-## ------------------------------------------------------------------------------
-## Sourses
-
-file (GLOB tObservation_SRCS tObservation.cc )
-
-## --- Macro(s) -------------------------------------
-
-MACRO (TARGETLINKLIBRARIES_APPLCOMMON_TEST _PROG)
-  target_link_libraries (${_PROG} 
-                         applcommon
-			 common
-			 ${Boost_LIBRARIES}
-			 ${LOG4CPLUS_LIBRARIES}
-			 ${BACKTRACE_LIBRARIES}
-			 ${SHMEM_LIBRARIES} )
-ENDMACRO (TARGETLINKLIBRARIES_APPLCOMMON_TEST)
-
-## --- Programs to be built -------------------------
-
-set (CHECKPROGS
-     tObservation
-)
-
-foreach (prog ${CHECKPROGS})
-  add_executable (${prog} ${${prog}_SRCS})
-  TARGETLINKLIBRARIES_APPLCOMMON_TEST (${prog})
-endforeach (prog ${CHECKPROGS})
-
-## --- Programs to be run ---------------------------
-
-set (CHECKTOOLPROGS
-     tObservation
-)
-
-foreach (prog ${CHECKTOOLPROGS})
-  add_test(${prog} ${CMAKE_CURRENT_SOURCE_DIR}/${prog}.sh) 
-  set (TEST_PROGRAMS "${TEST_PROGRAMS};${prog}" CACHE STRING "Test programs" FORCE)
-endforeach (prog ${CHECKTOOLPROGS})
+#  $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
+
+include(LofarCTest)
+
+lofar_add_test(tObservation tObservation.cc)
diff --git a/LCS/Blob/CMakeLists.txt b/LCS/Blob/CMakeLists.txt
index dfcf689f6ae..d27fe9d8016 100644
--- a/LCS/Blob/CMakeLists.txt
+++ b/LCS/Blob/CMakeLists.txt
@@ -1,28 +1,53 @@
-## ------------------------------------------------------------------------------
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
 ## Project characteristics
-
-project (Blob)
-
-cmake_minimum_required (VERSION 2.6)
-
-## ------------------------------------------------------------------------------
-## Enable test?
-
-option (BLOB_ENABLE_TESTING "Enable building and executing test programs?" NO  )
-
-## ------------------------------------------------------------------------------
-## Directories to be included in the build
-
-include_directories (${Blob_BINARY_DIR}/include)
-
-configure_file(${CMAKE_SOURCE_DIR}/config.h.cmake
-               ${Blob_BINARY_DIR}/include/config.h)
-configure_file(${Blob_SOURCE_DIR}/lofar_config.h.cmake
-               ${Blob_BINARY_DIR}/include/lofar_config.h)
-	       
-add_subdirectory (include)
-add_subdirectory (src)
-
-if (BLOB_ENABLE_TESTING)
-  add_subdirectory (test)
-endif (BLOB_ENABLE_TESTING)  
+## ---------------------------------------------------------------------------
+project(Blob)
+include(LofarGeneral)
+
+include(LofarAddPackage)
+lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS Common)
+
+## ---------------------------------------------------------------------------
+## External packages
+## ---------------------------------------------------------------------------
+include(LofarFindPackage)
+lofar_find_package(Casacore COMPONENTS casa)
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(include/Blob)
+add_subdirectory(src)
+add_subdirectory(test EXCLUDE_FROM_ALL)
diff --git a/LCS/Blob/include/Blob/CMakeLists.txt b/LCS/Blob/include/Blob/CMakeLists.txt
index 00e199e0b21..a256c2116a1 100644
--- a/LCS/Blob/include/Blob/CMakeLists.txt
+++ b/LCS/Blob/include/Blob/CMakeLists.txt
@@ -1,41 +1,63 @@
-## ------------------------------------------------------------------------------
-## Include files
+#  $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
 
-file (GLOB libblob_HEADERS BlobAipsIO.h
-        		   BlobArray.h
-			   BlobArray.tcc
-        		   BlobArrayHeader.h
-        		   BlobException.h
-        		   BlobField.h
-			   BlobField.tcc
-        		   BlobFieldSet.h
-        		   BlobHeader.h
-        		   BlobIBufChar.h
-        		   BlobIBuffer.h
-        		   BlobIBufStream.h
-        		   BlobIBufString.h
-        		   BlobIBufVector.h
-        		   BlobIStream.h
-        		   BlobOBufChar.h
-        		   BlobOBuffer.h
-        		   BlobOBufNull.h
-        		   BlobOBufStream.h
-        		   BlobOBufString.h
-        		   BlobOBufVector.h
-        		   BlobOStream.h
-			   BlobSTL.h
-			   BlobSTL.tcc
-			   BlobStreamable.h
-        		   BlobString.h
-        		   BlobStringTraits.h
-        		   BlobStringType.h
-        		   KeyParser.h
-        		   KeyValue.h
-        		   KeyValueMap.h )
+# List of header files that will be installed.
+set (inst_HEADERS
+  Package__Version.h
+  BlobAipsIO.h
+  BlobArray.h
+  BlobArray.tcc
+  BlobArrayHeader.h
+  BlobException.h
+  BlobField.h
+  BlobField.tcc
+  BlobFieldSet.h
+  BlobHeader.h
+  BlobIBufChar.h
+  BlobIBuffer.h
+  BlobIBufStream.h
+  BlobIBufString.h
+  BlobIBufVector.h
+  BlobIStream.h
+  BlobOBufChar.h
+  BlobOBuffer.h
+  BlobOBufNull.h
+  BlobOBufStream.h
+  BlobOBufString.h
+  BlobOBufVector.h
+  BlobOStream.h
+  BlobSTL.h
+  BlobSTL.tcc
+  BlobStreamable.h
+  BlobString.h
+  BlobStringTraits.h
+  BlobStringType.h
+  KeyParser.h
+  KeyValue.h
+  KeyValueMap.h)
+
+# Create symbolic link to include directory.
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink 
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_BINARY_DIR}/include/${PROJECT_NAME})
+
+# Install header files.
+install(FILES ${inst_HEADERS} DESTINATION include/${PROJECT_NAME})
 
-## ------------------------------------------------------------------------------
-## Installation
-   
-install (FILES ${libblob_HEADERS}
-  DESTINATION include/Blob
-  )
diff --git a/LCS/Blob/src/CMakeLists.txt b/LCS/Blob/src/CMakeLists.txt
index 7705906f7f3..f62e4574911 100644
--- a/LCS/Blob/src/CMakeLists.txt
+++ b/LCS/Blob/src/CMakeLists.txt
@@ -1,73 +1,82 @@
-#make_package_version (${LCS_SOURCE_DIR}/Blob/src TRUE TRUE)
+#  $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
 
-## ------------------------------------------------------------------------------
+include(LofarPackageVersion)
+
+## ----------------------------------------------------------------------------
 ## Process input files for Flex and Bison
+## ----------------------------------------------------------------------------
+find_package(BISON REQUIRED)
+find_package(FLEX REQUIRED)
 
-if (bison_bin)
-  execute_process (
-    WORKING_DIRECTORY ${LCS_SOURCE_DIR}/Blob/src
-    COMMAND bison -y -d -p KeyParse KeyParse.yy -o KeyParse
-    TIMEOUT 20
-    ERROR_VARIABLE yacc_error
-    OUTPUT_QUIET
-    )
-  execute_process (
-    WORKING_DIRECTORY ${LCS_SOURCE_DIR}/Blob/src
-    COMMAND mv KeyParse KeyParse.cc
-    )
-else (bison_bin)
-  message (SEND_ERROR "Unable to run YACC; missing application!")
-endif (bison_bin)
+bison_target(KeyParse KeyParse.yy 
+  ${CMAKE_CURRENT_BINARY_DIR}/KeyParse.cc
+  COMPILE_FLAGS "-y -pKeyParse")
 
-if (flex_bin)
-   execute_process (
-    WORKING_DIRECTORY ${LCS_SOURCE_DIR}/Blob/src
-    COMMAND flex -t -PKeyTokenize KeyTokenize.ll
-    TIMEOUT 20
-    OUTPUT_FILE KeyTokenize.cc
-    ERROR_VARIABLE lex_error
-    OUTPUT_QUIET
-   )
-else (flex_bin)
-  message (SEND_ERROR "Unable to run FLEX; missing application!")
-endif (flex_bin)
+# Create symbolic link from KeyParse.h -> KeyParse.hh, because KeyParser.cc
+# #include's KeyParse.h.
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
+  KeyParse.hh
+  KeyParse.h
+  WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
 
-## ------------------------------------------------------------------------------
-## Build the library
+# Add current binary directory to include, because that's where flex/bison
+# will output the files they generate.
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
 
-##file (GLOB libblob_SOURCES *.cc Net/*.cc)
-file (GLOB libblob_SOURCES BlobAipsIO.cc
-        		   BlobArray.cc
-        		   BlobField2.cc
-        		   BlobFieldSet.cc
-        		   BlobHeader.cc
-        		   BlobIBufChar.cc
-        		   BlobIBufStream.cc
-        		   BlobIStream.cc
-        		   BlobOBufChar.cc
-        		   BlobOBufNull.cc
-        		   BlobOBufStream.cc
-        		   BlobOBufString.cc
-        		   BlobOStream.cc
-			   BlobStreamable.cc
-        		   BlobString.cc
-        		   BlobStringType.cc
-        		   KeyParse.cc
-        		   KeyTokenize.cc
-        		   KeyParser.cc
-        		   KeyValue.cc
-        		   KeyValueMap.cc )
+flex_target(KeyTokenize KeyTokenize.ll 
+  ${CMAKE_CURRENT_BINARY_DIR}/KeyTokenize.cc
+  COMPILE_FLAGS "-PKeyTokenize")
 
-add_library (blob ${libblob_SOURCES})
+add_flex_bison_dependency(KeyTokenize KeyParse)
 
-target_link_libraries (blob ${CASA_LIBRARIES})
+set(blob_LIB_SRCS
+  Package__Version.cc
+  BlobAipsIO.cc
+  BlobArray.cc
+  BlobField2.cc
+  BlobFieldSet.cc
+  BlobHeader.cc
+  BlobIBufChar.cc
+  BlobIBufStream.cc
+  BlobIStream.cc
+  BlobOBufChar.cc
+  BlobOBufNull.cc
+  BlobOBufStream.cc
+  BlobOBufString.cc
+  BlobOStream.cc
+  BlobStreamable.cc
+  BlobString.cc
+  BlobStringType.cc
+  ${BISON_KeyParse_OUTPUTS}
+  ${FLEX_KeyTokenize_OUTPUTS}
+  KeyParser.cc
+  KeyValue.cc
+  KeyValueMap.cc)
 
-## ------------------------------------------------------------------------------
-## Installation
+set(blob_PROGRAMS
+  versionblob
+)
 
-install (
-  TARGETS blob
-  LIBRARY DESTINATION lib
-  ARCHIVE DESTINATION lib
-  )
+lofar_add_library(blob ${blob_LIB_SRCS})
 
+foreach(prog ${blob_PROGRAMS})
+  lofar_add_executable(${prog} ${prog}.cc)
+endforeach(prog ${blob_PROGRAMS})
diff --git a/LCS/Blob/test/CMakeLists.txt b/LCS/Blob/test/CMakeLists.txt
index 6746ce17d35..e77e1006bf9 100644
--- a/LCS/Blob/test/CMakeLists.txt
+++ b/LCS/Blob/test/CMakeLists.txt
@@ -1,81 +1,12 @@
-cmake_minimum_required (VERSION 2.6)
-
-include(LOFARTest)
-include_directories ( ${LOFAR_SOURCE_DIR}/LCS/Blob/test )
-
-## ------------------------------------------------------------------------------
-## Sourses
-
-file (GLOB tBlobString_SRCS  tBlobString.cc )
-file (GLOB tBlobStream_SRCS  tBlobStream.cc )
-file (GLOB tBlobArray_SRCS   tBlobArray.cc )
-file (GLOB tBlobSTL_SRCS     tBlobSTL.cc )
-file (GLOB tBlobCasa_SRCS    tBlobCasa.cc )
-file (GLOB tBlobField_SRCS   tBlobField.cc )
-file (GLOB tBlobAipsIO_SRCS  tBlobAipsIO.cc )
-file (GLOB tKeyValueMap_SRCS tKeyValueMap.cc )
-
-## --- Macro(s) -------------------------------------
-
-MACRO (TARGETLINKLIBRARIES_BLOB_TEST _PROG)
-  target_link_libraries (${_PROG} 
-			 blob
-			 common
-			 ${CASA_LIBRARIES}
-			 ${LOG4CPLUS_LIBRARIES}
-			 ${BACKTRACE_LIBRARIES}
-			 ${SHMEM_LIBRARIES} )
-ENDMACRO (TARGETLINKLIBRARIES_BLOB_TEST)
-
-
-## --- Programs to be built -------------------------
-
-set (CHECKPROGS
-     tBlobString
-     tBlobStream
-     tBlobArray
-     tBlobSTL
-     tBlobCasa
-     tBlobField
-     tBlobAipsIO
-     tKeyValueMap
-)
-
-foreach (prog ${CHECKPROGS})
-  add_executable (${prog} ${${prog}_SRCS})
-  TARGETLINKLIBRARIES_BLOB_TEST (${prog})
-endforeach (prog ${CHECKPROGS})
-
-## --- Programs to be run ---------------------------
-
-set (CHECKTOOLPROGS
-     tBlobString
-     tBlobStream
-     tBlobArray
-     tBlobSTL
-     tBlobCasa
-     tBlobField
-     tBlobAipsIO
-     tKeyValueMap
-)
-
-foreach (prog ${CHECKTOOLPROGS})
-  add_test(${prog} ${CMAKE_CURRENT_SOURCE_DIR}/${prog}_test.sh) 
-  set (TEST_PROGRAMS "${TEST_PROGRAMS};${prog}" CACHE STRING "Test programs" FORCE)
-endforeach (prog ${CHECKTOOLPROGS})
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+include(LofarCTest)
+
+lofar_add_test(tBlobString  tBlobString.cc)
+lofar_add_test(tBlobStream  tBlobStream.cc)
+lofar_add_test(tBlobArray   tBlobArray.cc)
+lofar_add_test(tBlobSTL     tBlobSTL.cc)
+lofar_add_test(tBlobField   tBlobField.cc)
+lofar_add_test(tKeyValueMap tKeyValueMap.cc)
+if(HAVE_AIPSPP)
+  lofar_add_test(tBlobCasa    tBlobCasa.cc)
+  lofar_add_test(tBlobAipsIO  tBlobAipsIO.cc)
+endif(HAVE_AIPSPP)
diff --git a/LCS/Blob/test/Makefile.am b/LCS/Blob/test/Makefile.am
index e21419154ae..7c9f29ac11b 100644
--- a/LCS/Blob/test/Makefile.am
+++ b/LCS/Blob/test/Makefile.am
@@ -6,15 +6,15 @@ check_PROGRAMS	      =	tBlobHeader tBlobString tBlobStream tBlobArray \
 CHECKTOOLPROGS	      =	$(check_PROGRAMS)
 
 TESTSCRIPTS = \
-          tBlobHeader_test.sh \
-          tBlobString_test.sh \
-          tBlobStream_test.sh \
-	  tBlobArray_test.sh \
-	  tBlobSTL_test.sh \
-	  tBlobCasa_test.sh \
-	  tBlobField_test.sh \
-	  tBlobAipsIO_test.sh \
-	  tKeyValueMap_test.sh 
+          tBlobHeader.sh \
+          tBlobString.sh \
+          tBlobStream.sh \
+	  tBlobArray.sh \
+	  tBlobSTL.sh \
+	  tBlobCasa.sh \
+	  tBlobField.sh \
+	  tBlobAipsIO.sh \
+	  tKeyValueMap.sh 
 
 TESTS	= $(TESTSCRIPTS)
 
diff --git a/LCS/Blob/test/tBlobAipsIO_test.sh b/LCS/Blob/test/tBlobAipsIO.sh
similarity index 100%
rename from LCS/Blob/test/tBlobAipsIO_test.sh
rename to LCS/Blob/test/tBlobAipsIO.sh
diff --git a/LCS/Blob/test/tBlobArray_test.sh b/LCS/Blob/test/tBlobArray.sh
similarity index 100%
rename from LCS/Blob/test/tBlobArray_test.sh
rename to LCS/Blob/test/tBlobArray.sh
diff --git a/LCS/Blob/test/tBlobArrayHeader.sh b/LCS/Blob/test/tBlobArrayHeader.sh
new file mode 100755
index 00000000000..3f8dd8b145d
--- /dev/null
+++ b/LCS/Blob/test/tBlobArrayHeader.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+./runctest.sh tBlobArrayHeader 2>&1 > tBlobArrayHeader_test.log
diff --git a/LCS/Blob/test/tBlobCasa_test.sh b/LCS/Blob/test/tBlobCasa.sh
similarity index 100%
rename from LCS/Blob/test/tBlobCasa_test.sh
rename to LCS/Blob/test/tBlobCasa.sh
diff --git a/LCS/Blob/test/tBlobField_test.sh b/LCS/Blob/test/tBlobField.sh
similarity index 100%
rename from LCS/Blob/test/tBlobField_test.sh
rename to LCS/Blob/test/tBlobField.sh
diff --git a/LCS/Blob/test/tBlobHeader_test.sh b/LCS/Blob/test/tBlobHeader.sh
similarity index 100%
rename from LCS/Blob/test/tBlobHeader_test.sh
rename to LCS/Blob/test/tBlobHeader.sh
diff --git a/LCS/Blob/test/tBlobSTL_test.sh b/LCS/Blob/test/tBlobSTL.sh
similarity index 100%
rename from LCS/Blob/test/tBlobSTL_test.sh
rename to LCS/Blob/test/tBlobSTL.sh
diff --git a/LCS/Blob/test/tBlobStream_test.sh b/LCS/Blob/test/tBlobStream.sh
similarity index 100%
rename from LCS/Blob/test/tBlobStream_test.sh
rename to LCS/Blob/test/tBlobStream.sh
diff --git a/LCS/Blob/test/tBlobString_test.sh b/LCS/Blob/test/tBlobString.sh
similarity index 100%
rename from LCS/Blob/test/tBlobString_test.sh
rename to LCS/Blob/test/tBlobString.sh
diff --git a/LCS/Blob/test/tKeyValueMap_test.sh b/LCS/Blob/test/tKeyValueMap.sh
similarity index 100%
rename from LCS/Blob/test/tKeyValueMap_test.sh
rename to LCS/Blob/test/tKeyValueMap.sh
diff --git a/LCS/CMakeLists.txt b/LCS/CMakeLists.txt
index 1d5a1afc4d0..73d19968c2c 100644
--- a/LCS/CMakeLists.txt
+++ b/LCS/CMakeLists.txt
@@ -1,125 +1,49 @@
-## ------------------------------------------------------------------------------
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
 ## Project characteristics
-
-project (LCS)
-
-cmake_minimum_required (VERSION 2.6)
-
-##-------------------------------------------------------------------------------
-## Options
-
-option (LCS_BUILD_TESTS "Build test programs?" FALSE)
-
-## ------------------------------------------------------------------------------
-## Set CMAKE_MODULE_PATH to load custom CMake modules
-
-if (NOT LOFAR_ROOT)
-find_path (LOFAR_ROOT cmake/modules/CMakeSettings.cmake
-  PATHS 
-  ${LCS_SOURCE_DIR}
-  ${LCS_SOURCE_DIR}/..
-  ${LCS_SOURCE_DIR}/../..
-  ${LCS_SOURCE_DIR}/../../..
-  $ENV{LOFARSOFT}
-  )
-
-if (LOFAR_ROOT)
-  include (${LOFAR_ROOT}/cmake/CMakeSettings.cmake)
-else (LOFAR_ROOT)
-  message (FATAL_ERROR "Unable to locate additional CMake scripts!")
-endif (LOFAR_ROOT)
-endif (NOT LOFAR_ROOT)
-
-## ------------------------------------------------------------------------------
-## Additional CMake modules
-
-include (CheckIncludeFiles)
-include (CheckLibraryExists)
-include (CheckTypeSize)
-include (CTest)
-enable_testing()
-
-## Custom modules
-
-#include (MakePackageVersion)
-
-## ------------------------------------------------------------------------------
-## Check system libraries
-
-## ------------------------------------------------------------------------------
-## Search for external libraries
-
-## ------------------------------------------------------------------------------
-## Check for required tools
-
-## ------------------------------------------------------------------------------
-## Module header files
-
-
-## ------------------------------------------------------------------------------
-## Directories to be included in the build
-
-## --- Tools ----------------------------------------
-
-find_path (HAVE_TOOLS CMakeLists.txt ${LOFAR_SOURCE_DIR}/LCS/Tools)
-if (HAVE_TOOLS)
-  set (HAVE_TOOLS TRUE CACHE BOOL "Have package Tools?" FORCE)
-  add_subdirectory (Tools)
-endif (HAVE_TOOLS)  
-
-## --- Common ---------------------------------------
-
-find_path (HAVE_COMMON CMakeLists.txt ${LOFAR_SOURCE_DIR}/LCS/Common)
-if (HAVE_COMMON)
-  set (HAVE_COMMON TRUE CACHE BOOL "Have package Common?" FORCE)
-  add_subdirectory (Common)
-endif (HAVE_COMMON)  
-
-## --- ACC ------------------------------------------
-
-find_path (HAVE_ACC CMakeLists.txt ${LOFAR_SOURCE_DIR}/LCS/ACC)
-if (HAVE_ACC)
-  set (HAVE_ACC TRUE CACHE BOOL "Have package ACC?" FORCE)
-  add_subdirectory (ACC)
-endif (HAVE_ACC)  
-
-## --- AMC ------------------------------------------
-
-find_path (HAVE_AMC CMakeLists.txt ${LOFAR_SOURCE_DIR}/LCS/AMC)
-if (HAVE_AMC)
-  set (HAVE_AMC TRUE CACHE BOOL "Have package AMC?" FORCE)
-  add_subdirectory (AMC)
-endif (HAVE_AMC)  
-
-## --- BLOB -----------------------------------------
-
-find_path (HAVE_BLOB CMakeLists.txt ${LOFAR_SOURCE_DIR}/LCS/Blob)
-if (HAVE_BLOB)
-  set (HAVE_BLOB TRUE CACHE BOOL "Have package Blob?" FORCE)
-  add_subdirectory (Blob)
-endif (HAVE_BLOB)  
-
-## --- TRANSPORT ------------------------------------
-
-find_path (HAVE_TRANSPORT CMakeLists.txt ${LOFAR_SOURCE_DIR}/LCS/Transport)
-if (HAVE_TRANSPORT)
-  set (HAVE_TRANSPORT TRUE CACHE BOOL "Have package Transport?" FORCE)
-  add_subdirectory (Transport)
-endif (HAVE_TRANSPORT)  
-
-## --- STREAM ---------------------------------------
-
-find_path (HAVE_STREAM CMakeLists.txt ${LOFAR_SOURCE_DIR}/LCS/Stream)
-if (HAVE_STREAM)
-  set (HAVE_STREAM TRUE CACHE BOOL "Have package Stream?" FORCE)
-  add_subdirectory (Stream)
-endif (HAVE_STREAM)  
-
-## --- APPLCOMMON -----------------------------------
-
-find_path (HAVE_APPLCOMMON CMakeLists.txt ${LOFAR_SOURCE_DIR}/LCS/ApplCommon)
-if (HAVE_APPLCOMMON)
-  set (HAVE_APPLCOMMON TRUE CACHE BOOL "Have package ApplCommon?" FORCE)
-  add_subdirectory (ApplCommon)
-endif (HAVE_APPLCOMMON)  
-
+## ---------------------------------------------------------------------------
+project(LCS)
+include(LofarGeneral)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+lofar_add_subdirectory(Tools)         # Useful tools
+lofar_add_subdirectory(Common)        # Common stuff
+lofar_add_subdirectory(Blob)          # Binary Large Objects
+lofar_add_subdirectory(Stream)        # Low-level support for streaming data
+lofar_add_subdirectory(Transport)     # Low-level transport library
+lofar_add_subdirectory(ACC)           # Application Configuration & Control
+lofar_add_subdirectory(AMC)           # Astronomical Measures Conversions
+lofar_add_subdirectory(ApplCommon)    # Application common stuff
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
diff --git a/LCS/Common/CMakeLists.txt b/LCS/Common/CMakeLists.txt
index a493add342c..60726788227 100644
--- a/LCS/Common/CMakeLists.txt
+++ b/LCS/Common/CMakeLists.txt
@@ -1,28 +1,53 @@
-## ------------------------------------------------------------------------------
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
 ## Project characteristics
-
-project (Common)
-
-cmake_minimum_required (VERSION 2.5)
-
-## ------------------------------------------------------------------------------
-## Enable test?
-
-option (COMMON_ENABLE_TESTING "Enable building and executing test programs?" NO  )
-
-## ------------------------------------------------------------------------------
-## Directories to be included in the build
-
-include_directories (${Common_BINARY_DIR}/include)
-
-configure_file(${CMAKE_SOURCE_DIR}/config.h.cmake
-               ${Common_BINARY_DIR}/include/config.h)
-configure_file(${Common_SOURCE_DIR}/lofar_config.h.cmake
-               ${Common_BINARY_DIR}/include/lofar_config.h)
-	       
-add_subdirectory (include)
-add_subdirectory (src)
-
-if (COMMON_ENABLE_TESTING)
-  add_subdirectory (test)
-endif (COMMON_ENABLE_TESTING)  
+## ---------------------------------------------------------------------------
+project(Common)
+include(LofarGeneral)
+
+include(LofarAddPackage)
+lofar_add_package(${PROJECT_NAME} 3.1)
+
+## ---------------------------------------------------------------------------
+## External packages
+## ---------------------------------------------------------------------------
+include(LofarFindPackage)
+lofar_find_package(Boost)
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(include/Common)
+add_subdirectory(src)
+add_subdirectory(test)# EXCLUDE_FROM_ALL)
diff --git a/LCS/Common/config.h.cmake b/LCS/Common/config.h.cmake
new file mode 100644
index 00000000000..291391d8a4d
--- /dev/null
+++ b/LCS/Common/config.h.cmake
@@ -0,0 +1,148 @@
+/* config.h.in.  Generated from configure.in by autoheader.  */
+
+/* Define if building universal (internal helper macro) */
+#cmakedefine AC_APPLE_UNIVERSAL_BUILD 1
+
+/* Define as __PRETTY_FUNCTION__, __FUNCTION__, or "<unknown>" */
+#cmakedefine AUTO_FUNCTION_NAME 1
+
+/* Define if DbgAssert is enabled */
+#cmakedefine ENABLE_DBGASSERT 1
+
+/* Define if TRACER is enabled */
+#cmakedefine ENABLE_TRACER 1
+
+/* Define if backtrace() is available */
+#cmakedefine HAVE_BACKTRACE 1
+
+/* Define if libbfd is available */
+#cmakedefine HAVE_BFD 1
+
+/* Define if MPICH is installed */
+#cmakedefine HAVE_BGLMPICH 1
+
+/* Define if BOOST is installed */
+#cmakedefine HAVE_BOOST 1
+
+/* Define to 1 if you have the `cplus_demangle' function. */
+#cmakedefine HAVE_CPLUS_DEMANGLE 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#cmakedefine HAVE_DLFCN_H 1
+
+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
+#cmakedefine HAVE_DOPRNT 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#cmakedefine HAVE_INTTYPES_H 1
+
+/* Define if LAM is installed */
+#cmakedefine HAVE_LAM 1
+
+/* Define if LOG4CPLUS is installed */
+#cmakedefine HAVE_LOG4CPLUS 1
+
+/* Define if LOG4CXX is installed */
+#cmakedefine HAVE_LOG4CXX 1
+
+/* Define if `long long' is supported */
+#cmakedefine HAVE_LONG_LONG 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#cmakedefine HAVE_MEMORY_H 1
+
+/* Define if we have an MPI implementation installed */
+#cmakedefine HAVE_MPI 1
+
+/* Define if MPICH is installed */
+#cmakedefine HAVE_MPICH 1
+
+/* Define if MPI profiler should be enabled */
+#cmakedefine HAVE_MPI_PROFILER 1
+
+/* Define if using Rational Purify */
+#cmakedefine HAVE_PURIFY 1
+
+/* Define if ScaMPI is installed */
+#cmakedefine HAVE_SCAMPI 1
+
+/* Defined if shared memory is used */
+#cmakedefine HAVE_SHMEM 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#cmakedefine HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#cmakedefine HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#cmakedefine HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#cmakedefine HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#cmakedefine HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#cmakedefine HAVE_SYS_TYPES_H 1
+
+/* Define if TOOLS is installed */
+#cmakedefine HAVE_TOOLS 1
+
+/* Define if `uint' is supported */
+#cmakedefine HAVE_UINT 1
+
+/* Define if `ulong' is supported */
+#cmakedefine HAVE_ULONG 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#cmakedefine HAVE_UNISTD_H 1
+
+/* Define if `ushort' is supported */
+#cmakedefine HAVE_USHORT 1
+
+/* Define to 1 if you have the `vprintf' function. */
+#cmakedefine HAVE_VPRINTF 1
+
+/* Define if we are compiling with debugging information */
+#cmakedefine LOFAR_DEBUG 1
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#cmakedefine LT_OBJDIR 1
+
+/* Define to the address where bug reports for this package should be sent. */
+#cmakedefine PACKAGE_BUGREPORT 1
+
+/* Define to the full name of this package. */
+#cmakedefine PACKAGE_NAME 1
+
+/* Define to the full name and version of this package. */
+#cmakedefine PACKAGE_STRING 1
+
+/* Define to the one symbol short name of this package. */
+#cmakedefine PACKAGE_TARNAME 1
+
+/* Define to the version of this package. */
+#cmakedefine PACKAGE_VERSION 1
+
+/* Define RPM release nr */
+#cmakedefine RPM_RELEASE 1
+
+/* Define to 1 if you have the ANSI C header files. */
+#cmakedefine STDC_HEADERS 1
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+   significant byte first (like Motorola and SPARC, unlike Intel). */
+#cmakedefine WORDS_BIGENDIAN 1
+
+/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
+   `char[]'. */
+#cmakedefine YYTEXT_POINTER 1
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#cmakedefine const 1
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#cmakedefine size_t 1
diff --git a/LCS/Common/include/Common/CMakeLists.txt b/LCS/Common/include/Common/CMakeLists.txt
index 2cd5492971b..05c7981c301 100644
--- a/LCS/Common/include/Common/CMakeLists.txt
+++ b/LCS/Common/include/Common/CMakeLists.txt
@@ -1,74 +1,97 @@
-## ------------------------------------------------------------------------------
-## Include files
+#  $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
 
-file (GLOB libcommon_HEADERS Allocator.h
-			     Backtrace.h
-			     CheckConfig.h
-			     ComplexBuiltinFP.h
-			     ComplexBuiltinInt.h
-			     ComplexC99.h
-			     ComplexStdFP.h
-			     ComplexStdInt.h
-			     DataConvert.h
-			     DataFormat.h
-			     Exception.h
-			     Exceptions.h
-			     FileLocator.h
-			     hexdump.h
-			     i4complex.h
-			     KVpair.h
-			     Lock.h
-			     lofar_algorithm.h
-			     lofar_bitset.h
-			     LofarConstants.h
-			     lofar_complex.h
-			     lofar_datetime.h
-			     lofar_deque.h
-			     lofar_fstream.h
-			     lofar_iomanip.h
-			     lofar_iosfwd.h
-			     lofar_iostream.h
-			     lofar_list.h
-			     LofarLocators.h
-			     LofarLog4Cplus.h
-			     LofarLog4Cxx.h
-			     LofarLogCout.h
-			     LofarLogger.h
-			     lofar_map.h
-			     lofar_math.h
-			     lofar_numeric.h
-			     lofar_set.h
-			     lofar_smartptr.h
-			     lofar_sstream.h
-			     lofar_stack.h
-			     lofar_string.h
-			     lofar_thread.h
-			     lofar_tribool.h
-			     lofar_typeinfo.h
-			     LofarTypedefs.h
-			     LofarTypes.h
-			     lofar_vector.h
-			     Numeric.h
-			     ObjectFactory.h
-			     ParameterValue.h
-			     ParameterSet.h
-			     ParameterSetImpl.h
-			     PrettyUnits.h
-			     Process.h
-			     ReadLine.h
-			     RunOnNode.h
-			     Semaphore.h
-			     Singleton.h
-			     Stopwatch.h
-			     StreamUtil.h
-			     StringUtil.h
-			     SystemUtil.h
-			     Timer.h
-			     TypeNames.h)
-   
-## ------------------------------------------------------------------------------
-## Installation
+# List of header files that will be installed.
+set(inst_HEADERS
+  Allocator.h
+  Backtrace.h
+  CheckConfig.h
+  ComplexBuiltinFP.h
+  ComplexBuiltinInt.h
+  ComplexC99.h
+  ComplexStdFP.h
+  ComplexStdInt.h
+  DataConvert.h
+  DataFormat.h
+  Exception.h
+  Exceptions.h
+  FileLocator.h
+  hexdump.h
+  i4complex.h
+  KVpair.h
+  lofar_algorithm.h
+  lofar_bitset.h
+  LofarConstants.h
+  lofar_complex.h
+  lofar_datetime.h
+  lofar_deque.h
+  lofar_fstream.h
+  lofar_iomanip.h
+  lofar_iosfwd.h
+  lofar_iostream.h
+  lofar_list.h
+  LofarLocators.h
+  LofarLog4Cplus.h
+  LofarLog4Cxx.h
+  LofarLogCout.h
+  LofarLogger.h
+  lofar_map.h
+  lofar_math.h
+  lofar_numeric.h
+  lofar_set.h
+  lofar_smartptr.h
+  lofar_sstream.h
+  lofar_stack.h
+  lofar_string.h
+  lofar_thread.h
+  lofar_tribool.h
+  lofar_typeinfo.h
+  LofarTypedefs.h
+  LofarTypes.h
+  lofar_vector.h
+  Numeric.h
+  ObjectFactory.h
+  ParameterValue.h
+  ParameterSet.h
+  ParameterSetImpl.h
+  PrettyUnits.h
+  Process.h
+  RunOnNode.h
+  Semaphore.h
+  Singleton.h
+  Stopwatch.h
+  StreamUtil.h
+  StringUtil.h
+  SystemUtil.h
+  Timer.h
+  TypeNames.h
+  TypeNames.tcc
+  Version.h
+  Net/FdSet.h
+  Net/Socket.h)
+
+# Create symbolic link to include directory.
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink 
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_BINARY_DIR}/include/${PROJECT_NAME})
+
+# Install header files.
+install(FILES ${inst_HEADERS} DESTINATION include/${PROJECT_NAME})
 
-install (FILES ${libcommon_HEADERS}
-  DESTINATION include/Common
-  )
diff --git a/LCS/Common/lofar_config.h.cmake b/LCS/Common/lofar_config.h.cmake
index d0c98288e1a..54c643dae09 100644
--- a/LCS/Common/lofar_config.h.cmake
+++ b/LCS/Common/lofar_config.h.cmake
@@ -1,14 +1,148 @@
-/* Generated by lofar_init.m4 */
+/* config.h.cmake.  [LOFAR.LCS.Common].  */
 
-#ifndef LOFAR_CONFIG_H
-#define LOFAR_CONFIG_H
+/* Define if building universal (internal helper macro) */
+#cmakedefine AC_APPLE_UNIVERSAL_BUILD 1
 
-#if defined(HAVE_CONFIG_H)
-#include <config.h>
-#endif
+/* Define as __PRETTY_FUNCTION__, __FUNCTION__, or "<unknown>" */
+#cmakedefine AUTO_FUNCTION_NAME
 
-#define HAVE_LOFAR_COMMON 1
+/* Define if DbgAssert is enabled */
+#cmakedefine ENABLE_DBGASSERT 1
 
-#define LOFARLOGGER_PACKAGE "LCS.Common"
+/* Define if TRACER is enabled */
+#cmakedefine ENABLE_TRACER 1
 
-#endif
+/* Define if backtrace() is available */
+#cmakedefine HAVE_BACKTRACE 1
+
+/* Define if libbfd is available */
+#cmakedefine HAVE_BFD 1
+
+/* Define if MPICH is installed */
+#cmakedefine HAVE_BGLMPICH 1
+
+/* Define if BOOST is installed */
+#cmakedefine HAVE_BOOST 1
+
+/* Define to 1 if you have the `cplus_demangle' function. */
+#cmakedefine HAVE_CPLUS_DEMANGLE 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#cmakedefine HAVE_DLFCN_H 1
+
+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
+#cmakedefine HAVE_DOPRNT 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#cmakedefine HAVE_INTTYPES_H 1
+
+/* Define if LAM is installed */
+#cmakedefine HAVE_LAM 1
+
+/* Define if LOG4CPLUS is installed */
+#cmakedefine HAVE_LOG4CPLUS 1
+
+/* Define if LOG4CXX is installed */
+#cmakedefine HAVE_LOG4CXX 1
+
+/* Define if `long long' is supported */
+#cmakedefine HAVE_LONG_LONG 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#cmakedefine HAVE_MEMORY_H 1
+
+/* Define if we have an MPI implementation installed */
+#cmakedefine HAVE_MPI 1
+
+/* Define if MPICH is installed */
+#cmakedefine HAVE_MPICH 1
+
+/* Define if MPI profiler should be enabled */
+#cmakedefine HAVE_MPI_PROFILER 1
+
+/* Define if using Rational Purify */
+#cmakedefine HAVE_PURIFY 1
+
+/* Define if ScaMPI is installed */
+#cmakedefine HAVE_SCAMPI 1
+
+/* Defined if shared memory is used */
+#cmakedefine HAVE_SHMEM 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#cmakedefine HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#cmakedefine HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#cmakedefine HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#cmakedefine HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#cmakedefine HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#cmakedefine HAVE_SYS_TYPES_H 1
+
+/* Define if TOOLS is installed */
+#cmakedefine HAVE_TOOLS 1
+
+/* Define if `uint' is supported */
+#cmakedefine HAVE_UINT 1
+
+/* Define if `ulong' is supported */
+#cmakedefine HAVE_ULONG 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#cmakedefine HAVE_UNISTD_H 1
+
+/* Define if `ushort' is supported */
+#cmakedefine HAVE_USHORT 1
+
+/* Define to 1 if you have the `vprintf' function. */
+#cmakedefine HAVE_VPRINTF 1
+
+/* Define if we are compiling with debugging information */
+#cmakedefine LOFAR_DEBUG 1
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#cmakedefine LT_OBJDIR 1
+
+/* Define to the address where bug reports for this package should be sent. */
+#cmakedefine PACKAGE_BUGREPORT 1
+
+/* Define to the full name of this package. */
+#cmakedefine PACKAGE_NAME 1
+
+/* Define to the full name and version of this package. */
+#cmakedefine PACKAGE_STRING 1
+
+/* Define to the one symbol short name of this package. */
+#cmakedefine PACKAGE_TARNAME 1
+
+/* Define to the version of this package. */
+#cmakedefine PACKAGE_VERSION 1
+
+/* Define RPM release nr */
+#cmakedefine RPM_RELEASE 1
+
+/* Define to 1 if you have the ANSI C header files. */
+#cmakedefine STDC_HEADERS 1
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+   significant byte first (like Motorola and SPARC, unlike Intel). */
+#cmakedefine WORDS_BIGENDIAN 1
+
+/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
+   `char[]'. */
+#cmakedefine YYTEXT_POINTER 1
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#cmakedefine const 1
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#cmakedefine size_t 1
diff --git a/LCS/Common/src/CMakeLists.txt b/LCS/Common/src/CMakeLists.txt
index 1be33cf7f79..678fd44d621 100644
--- a/LCS/Common/src/CMakeLists.txt
+++ b/LCS/Common/src/CMakeLists.txt
@@ -1,77 +1,87 @@
-#make_package_version (${LCS_SOURCE_DIR}/Common/src TRUE TRUE)
+#  $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
 
-## ------------------------------------------------------------------------------
-## Build the library
+include(LofarPackageVersion)
 
-if (Backtrace_FOUND)
-  file (GLOB backtrace_SRCS AddressTranslator.cc
-                            Backtrace.cc
-			    SymbolTable.cc )
-endif (Backtrace_FOUND)
+set(common_LIB_SRCS
+  Package__Version.cc
+  Allocator.cc
+  DataConvert.cc
+  Exception.cc
+  FileLocator.cc
+  hexdump.cc
+  KVpair.cc
+  lofar_bitset.cc
+  LofarLogCout.cc
+  LofarLogger.cc
+  Numeric.cc
+  ParameterSet.cc
+  ParameterSetImpl.cc
+  ParameterValue.cc
+  PrettyUnits.cc
+  Process.cc
+  RunOnNode.cc
+  Stopwatch.cc
+  StreamUtil.cc
+  StringUtil.cc
+  SystemUtil.cc
+  Timer.cc
+  TypeNames.cc
+  Version.cc
+  Net/FdSet.cc
+  Net/Socket.cc)
 
-if (HAVE_SHEM)
-  file (GLOB shmem_SRCS     shmem/dlmalloc.c
-                            shmem/segbasemap.cc
-                            shmem/shmem_alloc.cc )
-  add_library (shmem ${shmem_SRCS})
-  
-  set_target_properties( shmem PROPERTIES
-                         COMPILE_FLAGS "-DUSE_PUBLIC_MALLOC_WRAPPERS -DUSE_DL_PREFIX -DHAVE_MMAP=0 -DMORECORE=shmbrk -DMORECORE_CONTIGUOUS=0 -DMORECORE_CANNOT_TRIM=1 -DSHMEM_ALLOC -DHAVE_USR_INCLUDE_MALLOC_H -DUSE_THREADS -pthread"
-  )
-  
-  
-endif (HAVE_SHEM)
+set(common_PROGRAMS
+  getparsetvalue
+  versioncommon
+)
 
-file (GLOB libcommon_SOURCES Allocator.cc
-			     DataConvert.cc
-			     Exception.cc
-			     FileLocator.cc
-			     hexdump.cc
-			     KVpair.cc
-			     Lock.cc
-			     lofar_bitset.cc
-			     LofarLogCout.cc
-			     LofarLogger.cc
-			     Numeric.cc
-			     ParameterSet.cc
-			     ParameterSetImpl.cc
-			     ParameterValue.cc
-			     PrettyUnits.cc
-			     Process.cc
-			     ReadLine.cc
-			     RunOnNode.cc
-			     Stopwatch.cc
-			     StreamUtil.cc
-			     StringUtil.cc
-			     SystemUtil.cc
-			     Timer.cc
-			     TypeNames.cc
-			     Net/FdSet.cc
-			     Net/Socket.cc
-			     ${backtrace_SRCS})
+if(HAVE_BACKTRACE)
+  list(APPEND common_LIB_SRCS 
+    AddressTranslator.cc 
+    Backtrace.cc
+    SymbolTable.cc)
+endif(HAVE_BACKTRACE)
 
-add_library (common ${libcommon_SOURCES})
+if(HAVE_SHMEM)
+  set(shmem_LIB_SRCS
+    shmem/segbasemap.cc
+    shmem/dlmalloc.c
+    shmem/shmem_alloc.cc)
+  set(shmem_COMPILE_FLAGS
+    -DUSE_PUBLIC_MALLOC_WRAPPERS
+    -DUSE_DL_PREFIX
+    -DHAVE_MMAP=0
+    -DMORECORE=shmbrk
+    -DMORECORE_CONTIGUOUS=0
+    -DMORECORE_CANNOT_TRIM=1
+    -DSHMEM_ALLOC
+    -DHAVE_USR_INCLUDE_MALLOC_H)
+  join_arguments(shmem_COMPILE_FLAGS)
+  set_source_files_properties(${shmem_LIB_SRCS} 
+    PROPERTIES COMPILE_FLAGS ${shmem_COMPILE_FLAGS})
+  list(APPEND common_LIB_SRCS ${shmem_LIB_SRCS})
+endif(HAVE_SHMEM)
 
-if (HAVE_SHEM)
-target_link_libraries (common
-                       shmem
-                      )
-endif (HAVE_SHEM)
+lofar_add_library(common ${common_LIB_SRCS})
 
-
-## ------------------------------------------------------------------------------
-## Installation
-if (HAVE_SHEM)
-install (
-  TARGETS common shmem
-  LIBRARY DESTINATION lib
-  ARCHIVE DESTINATION lib
-  )
-
-else (HAVE_SHEM)
-install (
-  TARGETS common
-  LIBRARY DESTINATION lib
-  ARCHIVE DESTINATION lib
-  )
-endif (HAVE_SHEM)
+foreach(prog ${common_PROGRAMS})
+  lofar_add_executable(${prog} ${prog}.cc)
+endforeach(prog ${common_PROGRAMS})
diff --git a/LCS/Common/src/Version.cc b/LCS/Common/src/Version.cc
index 4230abb514a..722eab72cc8 100644
--- a/LCS/Common/src/Version.cc
+++ b/LCS/Common/src/Version.cc
@@ -124,7 +124,7 @@ namespace LOFAR {
   { 
     os << indent << packageName() << ": version = " << version();
     if (version() != confVersion()) {
-      os << " (in configure.in: " << confVersion() << ')';
+      os << " (in CMakeLists.txt: " << confVersion() << ')';
     }
     os << std::endl;
     os << indent << " overall revision  = " << revision();
diff --git a/LCS/Common/test/CMakeLists.txt b/LCS/Common/test/CMakeLists.txt
index d289274b26d..37c99fb5ae8 100644
--- a/LCS/Common/test/CMakeLists.txt
+++ b/LCS/Common/test/CMakeLists.txt
@@ -1,59 +1,47 @@
-## ------------------------------------------------------------------------------
-## Build the tests
+#  $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
 
-## --- tObjectFactory -------------------------------
+include(LofarCTest)
 
-file (GLOB tObjectFactory_SRCS tObjectFactory.cc
-                               Shapes.h
-			       Shapes.cc
-			       Coordinates.h
-			       Coordinates.cc )
+lofar_add_test(testLogger testLogger.cc)
+lofar_add_test(tAllocator tAllocator.cc)
+lofar_add_test(tDataConvert tDataConvert.cc)
+lofar_add_test(tFileLocator tFileLocator.cc)
+lofar_add_test(tStringUtil tStringUtil.cc)
+lofar_add_test(tStreamUtil tStreamUtil.cc)
+lofar_add_test(tHexdump tHexdump.cc)
+#lofar_add_test(testSocket testSocket.cc)
+lofar_add_test(tComplex tComplex.cc)
+#lofar_add_test(tProcess tProcess.cc)
+lofar_add_test(tRunOnNode tRunOnNode.cc)
+lofar_add_test(tTimer tTimer.cc)
+#lofar_add_test(tNumeric tNumeric.cc)
+lofar_add_test(tSingleton tSingleton.cc)
+lofar_add_test(tObjectFactory tObjectFactory.cc Shapes.cc Coordinates.cc)
+#lofar_add_test(tSystemUtil tSystemUtil.cc)
+#lofar_add_test(tSaxpy tSaxpy.cc)
+lofar_add_test(tPrettyUnits tPrettyUnits.cc)
+lofar_add_test(tParameterValue tParameterValue.cc)
+lofar_add_test(tParameterSet tParameterSet.cc)
+lofar_add_test(tParameterSetPerf tParameterSetPerf.cc)
+lofar_add_test(tBacktrace tBacktrace.cc)
 
-## compiler instructions
-add_executable (tObjectFactory ${tObjectFactory_SRCS})
-## linker instructions
-target_link_libraries (tObjectFactory 
-                       common 
-	               ${LOG4CPLUS_LIBRARIES}
-		       ${BACKTRACE_LIBRARIES} )
-			 
-## testing instructions
-add_test (tObjectFactory tObjectFactory)
-
-## --- Test -----------------------------------------
-
-foreach (Common_test
-    testLogger
-    tAllocator
-    tDataConvert
-    tFileLocator
-    tStringUtil
-    tStreamUtil
-    tHexdump
-    testSocket
-    tComplex
-    tProcess
-    tRunOnNode
-    tTimer
-    tNumeric
-    tSingleton
-    tSystemUtil
-    tSaxpy
-    tPrettyUnits
-    tBacktrace
-    tParameterValue
-    tParameterSet
-    tParameterSetPerf
-    )
-
-  ## compiler instructions
-  add_executable (${Common_test} ${Common_test}.cc)
-  ## linker instructions
-  target_link_libraries (${Common_test} 
-                         common 
-			 ${LOG4CPLUS_LIBRARIES}
-			 ${BACKTRACE_LIBRARIES} )
-
-  ## testing instructions
-  add_test (${Common_test} ${Common_test})
-endforeach (Common_test)
+add_test(tgetparsetvalue ${CMAKE_CURRENT_SOURCE_DIR}/tgetparsetvalue.sh)
+#lofar_add_test(tReadLine tReadLine.cc)
diff --git a/LCS/Common/test/tBacktrace.cc b/LCS/Common/test/tBacktrace.cc
index 14b98c0dcf4..0a4c1a260ad 100644
--- a/LCS/Common/test/tBacktrace.cc
+++ b/LCS/Common/test/tBacktrace.cc
@@ -45,8 +45,8 @@ struct J
 //     terminate();
 //     throw;
 //     throw 1;
-//     throw runtime_error("Oops!");
-//     THROW (AssertError, "Ouch!"); 
+    throw runtime_error("Oops!");
+    THROW (AssertError, "Ouch!"); 
     LOFAR::Exception* excp;
     char* p;
     cerr << "sizeof(AssertError) = " << sizeof(AssertError) << endl;
diff --git a/LCS/Common/test/tBacktrace.sh b/LCS/Common/test/tBacktrace.sh
new file mode 100755
index 00000000000..407df858ee3
--- /dev/null
+++ b/LCS/Common/test/tBacktrace.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+./runctest.sh tBacktrace 2>&1 > tBacktrace.log
diff --git a/LCS/Common/test/tParameterSetPerf.run b/LCS/Common/test/tParameterSetPerf.run
index bd23fa91a9c..6157ec515f9 100755
--- a/LCS/Common/test/tParameterSetPerf.run
+++ b/LCS/Common/test/tParameterSetPerf.run
@@ -13,4 +13,4 @@ do
   done
 done
 
-tParameterSetPerf
+./tParameterSetPerf
diff --git a/LCS/Stream/CMakeLists.txt b/LCS/Stream/CMakeLists.txt
index 431b71d5270..1d7553454c2 100644
--- a/LCS/Stream/CMakeLists.txt
+++ b/LCS/Stream/CMakeLists.txt
@@ -1,20 +1,52 @@
-## ------------------------------------------------------------------------------
-## Project characteristics
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
 
-project (Stream)
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
+## Project characteristics
+## ---------------------------------------------------------------------------
+project(Stream)
+include(LofarGeneral)
 
-cmake_minimum_required (VERSION 2.5)
+include(LofarAddPackage)
+lofar_add_package(${PROJECT_NAME} 0.1 DEPENDS Common)
 
-## ------------------------------------------------------------------------------
-## Directories to be included in the build
+## ---------------------------------------------------------------------------
+## External packages
+## ---------------------------------------------------------------------------
+include(LofarFindPackage)
 
-include_directories (${Stream_BINARY_DIR}/include)
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
 
-configure_file(${CMAKE_SOURCE_DIR}/config.h.cmake
-               ${Stream_BINARY_DIR}/include/config.h)
-configure_file(${Stream_SOURCE_DIR}/lofar_config.h.cmake
-               ${Stream_BINARY_DIR}/include/lofar_config.h)
-	       
-add_subdirectory (include)
-add_subdirectory (src)
-## GELSM add_subdirectory (test)
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(include/Stream)
+add_subdirectory(src)
+add_subdirectory(test EXCLUDE_FROM_ALL)
diff --git a/LCS/Stream/include/Stream/CMakeLists.txt b/LCS/Stream/include/Stream/CMakeLists.txt
index 8099fdbf59a..1a922d0c812 100644
--- a/LCS/Stream/include/Stream/CMakeLists.txt
+++ b/LCS/Stream/include/Stream/CMakeLists.txt
@@ -1,16 +1,17 @@
-## ------------------------------------------------------------------------------
-## Include files
+# List of header files that will be installed.
+set (inst_HEADERS
+  Package__Version.h
+  FileDescriptorBasedStream.h
+  FileStream.h
+  NullStream.h
+  SocketStream.h
+  Stream.h
+  SystemCallException.h)
 
-file (GLOB libstream_HEADERS FileDescriptorBasedStream.h
-			     FileStream.h
-			     NullStream.h
-			     SocketStream.h
-			     Stream.h
-			     SystemCallException.h )
+# Create symbolic link to include directory.
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink 
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_BINARY_DIR}/include/${PROJECT_NAME})
 
-## ------------------------------------------------------------------------------
-## Installation
-   
-install (FILES ${libstream_HEADERS}
-  DESTINATION include/Stream
-  )
+# Install header files.
+install(FILES ${inst_HEADERS} DESTINATION include/${PROJECT_NAME})
diff --git a/LCS/Stream/src/CMakeLists.txt b/LCS/Stream/src/CMakeLists.txt
index 432922c6c53..2b33043f57f 100644
--- a/LCS/Stream/src/CMakeLists.txt
+++ b/LCS/Stream/src/CMakeLists.txt
@@ -1,21 +1,40 @@
-## ------------------------------------------------------------------------------
-## Build the library
+#  $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
 
-file (GLOB libstream_SOURCES FileDescriptorBasedStream.cc
-			     FileStream.cc
-			     NullStream.cc
-			     SocketStream.cc
-			     Stream.cc
-			     SystemCallException.cc)
+include(LofarPackageVersion)
 
-add_library (stream ${libstream_SOURCES})
+set(stream_LIB_SRCS
+  Package__Version.cc
+  FileDescriptorBasedStream.cc
+  FileStream.cc
+  NullStream.cc
+  SocketStream.cc
+  Stream.cc
+  SystemCallException.cc)
 
-## ------------------------------------------------------------------------------
-## Installation
+set(stream_PROGRAMS
+  versionstream
+)
 
-install (
-  TARGETS stream
-  LIBRARY DESTINATION lib
-  ARCHIVE DESTINATION lib
-  )
+lofar_add_library(stream ${stream_LIB_SRCS})
 
+foreach(prog ${stream_PROGRAMS})
+  lofar_add_executable(${prog} ${prog}.cc)
+endforeach(prog ${stream_PROGRAMS})
diff --git a/LCS/Stream/test/CMakeLists.txt b/LCS/Stream/test/CMakeLists.txt
new file mode 100644
index 00000000000..35043d6575b
--- /dev/null
+++ b/LCS/Stream/test/CMakeLists.txt
@@ -0,0 +1,7 @@
+include(LofarCTest)
+
+set(CHECK_PROGRAMS)
+
+foreach(prog ${CHECK_PROGRAMS})
+  lofar_add_executable(${prog} ${prog}.cc)
+endforeach(prog ${CHECK_PROGRAMS})
diff --git a/LCS/Tools/CMakeLists.txt b/LCS/Tools/CMakeLists.txt
new file mode 100644
index 00000000000..13cd493b51a
--- /dev/null
+++ b/LCS/Tools/CMakeLists.txt
@@ -0,0 +1,42 @@
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
+## Project characteristics
+## ---------------------------------------------------------------------------
+project(Tools)
+include(LofarGeneral)
+
+## ---------------------------------------------------------------------------
+## Generate configuration-specific header file
+## ---------------------------------------------------------------------------
+include(LofarConfig)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(src)
diff --git a/LCS/Tools/config.h.cmake b/LCS/Tools/config.h.cmake
new file mode 100644
index 00000000000..8a6af90a231
--- /dev/null
+++ b/LCS/Tools/config.h.cmake
@@ -0,0 +1,124 @@
+/* config.h.in.  Generated from configure.in by autoheader.  */
+
+/* Define if building universal (internal helper macro) */
+#cmakedefine AC_APPLE_UNIVERSAL_BUILD
+
+/* Define as __PRETTY_FUNCTION__, __FUNCTION__, or "<unknown>" */
+#cmakedefine AUTO_FUNCTION_NAME
+
+/* Define if DbgAssert is enabled */
+#cmakedefine ENABLE_DBGASSERT
+
+/* Define if TRACER is enabled */
+#cmakedefine ENABLE_TRACER
+
+/* Define if backtrace() is available */
+#cmakedefine HAVE_BACKTRACE
+
+/* Define if libbfd is available */
+#cmakedefine HAVE_BFD
+
+/* Define to 1 if you have the `cplus_demangle' function. */
+#cmakedefine HAVE_CPLUS_DEMANGLE
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#cmakedefine HAVE_DLFCN_H
+
+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
+#cmakedefine HAVE_DOPRNT
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#cmakedefine HAVE_INTTYPES_H
+
+/* Define if LOG4CPLUS is installed */
+#cmakedefine HAVE_LOG4CPLUS
+
+/* Define if LOG4CXX is installed */
+#cmakedefine HAVE_LOG4CXX
+
+/* Define if `long long' is supported */
+#cmakedefine HAVE_LONG_LONG
+
+/* Define to 1 if you have the <memory.h> header file. */
+#cmakedefine HAVE_MEMORY_H
+
+/* Define if using Rational Purify */
+#cmakedefine HAVE_PURIFY
+
+/* Defined if shared memory is used */
+#cmakedefine HAVE_SHMEM
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#cmakedefine HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#cmakedefine HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#cmakedefine HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#cmakedefine HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#cmakedefine HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#cmakedefine HAVE_SYS_TYPES_H
+
+/* Define if `uint' is supported */
+#cmakedefine HAVE_UINT
+
+/* Define if `ulong' is supported */
+#cmakedefine HAVE_ULONG
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#cmakedefine HAVE_UNISTD_H
+
+/* Define if `ushort' is supported */
+#cmakedefine HAVE_USHORT
+
+/* Define to 1 if you have the `vprintf' function. */
+#cmakedefine HAVE_VPRINTF
+
+/* Define if we are compiling with debugging information */
+#cmakedefine LOFAR_DEBUG
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#cmakedefine LT_OBJDIR
+
+/* Define to the address where bug reports for this package should be sent. */
+#cmakedefine PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#cmakedefine PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#cmakedefine PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#cmakedefine PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#cmakedefine PACKAGE_VERSION
+
+/* Define RPM release nr */
+#cmakedefine RPM_RELEASE
+
+/* Define to 1 if you have the ANSI C header files. */
+#cmakedefine STDC_HEADERS
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+   significant byte first (like Motorola and SPARC, unlike Intel). */
+#cmakedefine WORDS_BIGENDIAN
+
+/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
+   `char[]'. */
+#cmakedefine YYTEXT_POINTER
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#cmakedefine const
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#cmakedefine size_t
diff --git a/LCS/Tools/lofar_config.h.cmake b/LCS/Tools/lofar_config.h.cmake
new file mode 100644
index 00000000000..525dee6b880
--- /dev/null
+++ b/LCS/Tools/lofar_config.h.cmake
@@ -0,0 +1,124 @@
+/* config.h.cmake.  [LOFAR.LCS.Tools].  */
+
+/* Define if building universal (internal helper macro) */
+#cmakedefine AC_APPLE_UNIVERSAL_BUILD
+
+/* Define as __PRETTY_FUNCTION__, __FUNCTION__, or "<unknown>" */
+#cmakedefine AUTO_FUNCTION_NAME
+
+/* Define if DbgAssert is enabled */
+#cmakedefine ENABLE_DBGASSERT
+
+/* Define if TRACER is enabled */
+#cmakedefine ENABLE_TRACER
+
+/* Define if backtrace() is available */
+#cmakedefine HAVE_BACKTRACE
+
+/* Define if libbfd is available */
+#cmakedefine HAVE_BFD
+
+/* Define to 1 if you have the `cplus_demangle' function. */
+#cmakedefine HAVE_CPLUS_DEMANGLE
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#cmakedefine HAVE_DLFCN_H
+
+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
+#cmakedefine HAVE_DOPRNT
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#cmakedefine HAVE_INTTYPES_H
+
+/* Define if LOG4CPLUS is installed */
+#cmakedefine HAVE_LOG4CPLUS
+
+/* Define if LOG4CXX is installed */
+#cmakedefine HAVE_LOG4CXX
+
+/* Define if `long long' is supported */
+#cmakedefine HAVE_LONG_LONG
+
+/* Define to 1 if you have the <memory.h> header file. */
+#cmakedefine HAVE_MEMORY_H
+
+/* Define if using Rational Purify */
+#cmakedefine HAVE_PURIFY
+
+/* Defined if shared memory is used */
+#cmakedefine HAVE_SHMEM
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#cmakedefine HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#cmakedefine HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#cmakedefine HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#cmakedefine HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#cmakedefine HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#cmakedefine HAVE_SYS_TYPES_H
+
+/* Define if `uint' is supported */
+#cmakedefine HAVE_UINT
+
+/* Define if `ulong' is supported */
+#cmakedefine HAVE_ULONG
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#cmakedefine HAVE_UNISTD_H
+
+/* Define if `ushort' is supported */
+#cmakedefine HAVE_USHORT
+
+/* Define to 1 if you have the `vprintf' function. */
+#cmakedefine HAVE_VPRINTF
+
+/* Define if we are compiling with debugging information */
+#cmakedefine LOFAR_DEBUG
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#cmakedefine LT_OBJDIR
+
+/* Define to the address where bug reports for this package should be sent. */
+#cmakedefine PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#cmakedefine PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#cmakedefine PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#cmakedefine PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#cmakedefine PACKAGE_VERSION
+
+/* Define RPM release nr */
+#cmakedefine RPM_RELEASE
+
+/* Define to 1 if you have the ANSI C header files. */
+#cmakedefine STDC_HEADERS
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+   significant byte first (like Motorola and SPARC, unlike Intel). */
+#cmakedefine WORDS_BIGENDIAN
+
+/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
+   `char[]'. */
+#cmakedefine YYTEXT_POINTER
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#cmakedefine const
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#cmakedefine size_t
diff --git a/LCS/Tools/src/CMakeLists.txt b/LCS/Tools/src/CMakeLists.txt
new file mode 100644
index 00000000000..62320016edb
--- /dev/null
+++ b/LCS/Tools/src/CMakeLists.txt
@@ -0,0 +1,71 @@
+#  $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
+
+add_executable(LimitExec LimitExec.cc)
+add_executable(pkgdep pkgdep.cc)
+
+install(TARGETS
+  LimitExec
+  pkgdep
+  DESTINATION sbin)
+
+install(PROGRAMS
+  checkrun
+  finddep
+  lofarcvsmv
+  lofarcvsx
+  makedoc
+  makedep.sh
+  makeClass.py
+  makePackage.py
+  makeTest.py
+  DESTINATION sbin)
+
+install(FILES
+  templates/header.cc_template
+  templates/header.h_template
+  templates/main.cc_template  		      
+  templates/package_bootstrap_template  		      
+  templates/package_configure.in_template  		      
+  templates/package_spec.in_template  		      
+  templates/package_lofarconf.in_template
+  templates/package_makefile.am_template  		      
+  templates/include_makefile.am_template  		      
+  templates/include_pkg_makefile.am_template  		      
+  templates/src_makefile.am_template  	              
+  templates/templated_header.cc_template  		      
+  templates/templated_header.h_template  		      
+  templates/templated_header.tcc_template
+  templates/test.cc_template
+  templates/test.in_template
+  templates/test.out_template
+  templates/test.sh_template  		      
+  templates/test_makefile.am_template
+  DESTINATION share/templates)
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/lofarinit.sh.in
+               ${CMAKE_BINARY_DIR}/lofarinit.sh @ONLY)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/lofarinit.csh.in
+               ${CMAKE_BINARY_DIR}/lofarinit.csh @ONLY)
+
+install(FILES
+  ${CMAKE_BINARY_DIR}/lofarinit.sh
+  ${CMAKE_BINARY_DIR}/lofarinit.csh
+  DESTINATION .)
diff --git a/LCS/Tools/src/lofarinit.csh b/LCS/Tools/src/lofarinit.csh.in
similarity index 99%
rename from LCS/Tools/src/lofarinit.csh
rename to LCS/Tools/src/lofarinit.csh.in
index 491ed148489..fa4c1dc46d6 100644
--- a/LCS/Tools/src/lofarinit.csh
+++ b/LCS/Tools/src/lofarinit.csh.in
@@ -26,7 +26,7 @@
 # Define root here.
 # This is a placeholder, so do NOT change the line.
 # The actual value is filled in by make install (see Makefile.am).
-set a_root = . #filled in by install
+set a_root=@CMAKE_INSTALL_PREFIX@
 
 # Get python version.
 set a_pyv=`python -V |& cat --`
diff --git a/LCS/Tools/src/lofarinit.sh b/LCS/Tools/src/lofarinit.sh.in
similarity index 99%
rename from LCS/Tools/src/lofarinit.sh
rename to LCS/Tools/src/lofarinit.sh.in
index d820801f3d6..9626d6366cb 100644
--- a/LCS/Tools/src/lofarinit.sh
+++ b/LCS/Tools/src/lofarinit.sh.in
@@ -26,7 +26,7 @@
 # Define root here.
 # This is a placeholder, so do NOT change the line.
 # The actual value is filled in by make install (see Makefile.am).
-lfr_root=. #filled in by install
+lfr_root=@CMAKE_INSTALL_PREFIX@
 
 # Get python version.
 a_pyv=`python -V 2>&1`
diff --git a/LCS/Transport/CMakeLists.txt b/LCS/Transport/CMakeLists.txt
index 9eab3428dca..998288d493c 100644
--- a/LCS/Transport/CMakeLists.txt
+++ b/LCS/Transport/CMakeLists.txt
@@ -1,28 +1,47 @@
-## ------------------------------------------------------------------------------
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
 ## Project characteristics
-
-project (Transport)
-
-cmake_minimum_required (VERSION 2.6)
-
-## ------------------------------------------------------------------------------
-## Enable test?
-
-option (TRANSPORT_ENABLE_TESTING "Enable building and executing test programs?" NO  )
-
-## ------------------------------------------------------------------------------
-## Directories to be included in the build
-
-include_directories (${Transport_BINARY_DIR}/include)
-
-configure_file(${CMAKE_SOURCE_DIR}/config.h.cmake
-               ${Transport_BINARY_DIR}/include/config.h)
-configure_file(${Transport_SOURCE_DIR}/lofar_config.h.cmake
-               ${Transport_BINARY_DIR}/include/lofar_config.h)
-	       
-add_subdirectory (include)
-add_subdirectory (src)
-
-if (TRANSPORT_ENABLE_TESTING)
-  add_subdirectory (test)
-endif (TRANSPORT_ENABLE_TESTING)  
+## ---------------------------------------------------------------------------
+project(Transport)
+include(LofarGeneral)
+
+include(LofarAddPackage)
+lofar_add_package(${PROJECT_NAME} 2.3 DEPENDS Blob)
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(include/Transport)
+add_subdirectory(src)
+add_subdirectory(test EXCLUDE_FROM_ALL)
diff --git a/LCS/Transport/include/Transport/CMakeLists.txt b/LCS/Transport/include/Transport/CMakeLists.txt
index e6726ac8d14..19dd3646f3f 100644
--- a/LCS/Transport/include/Transport/CMakeLists.txt
+++ b/LCS/Transport/include/Transport/CMakeLists.txt
@@ -1,26 +1,27 @@
-## ------------------------------------------------------------------------------
-## Include files
+# List of header files that will be installed.
+set(inst_HEADERS
+  BaseSim.h
+  BGLConnection.h
+  Connection.h
+  ConnectionPool.h
+  CSConnection.h
+  DataBlobExtra.h
+  DataHolder.h
+  DH_BlobStreamable.h
+  TH_Ethernet.h
+  TH_File.h
+  TH_Mem.h
+  TH_MPI.h
+  TH_Null.h
+  TH_ShMem.h
+  TH_Socket.h
+  TransportHolder.h 
+)
 
-file (GLOB libtransport_HEADERS BaseSim.h
-				BGLConnection.h
-				Connection.h
-				ConnectionPool.h
-				CSConnection.h
-				DataBlobExtra.h
-				DataHolder.h
-				DH_BlobStreamable.h
-				TH_Ethernet.h
-				TH_File.h
-				TH_Mem.h
-				TH_MPI.h
-				TH_Null.h
-				TH_ShMem.h
-				TH_Socket.h
-				TransportHolder.h )
+# Create symbolic link to include directory.
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink 
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_BINARY_DIR}/include/${PROJECT_NAME})
 
-## ------------------------------------------------------------------------------
-## Installation
-   
-install (FILES ${libtransport_HEADERS}
-  DESTINATION include/Transport
-  )
+# Install header files.
+install(FILES ${inst_HEADERS} DESTINATION include/${PROJECT_NAME})
diff --git a/LCS/Transport/src/CMakeLists.txt b/LCS/Transport/src/CMakeLists.txt
index 7c6134c58d9..6c86cffe928 100644
--- a/LCS/Transport/src/CMakeLists.txt
+++ b/LCS/Transport/src/CMakeLists.txt
@@ -1,29 +1,50 @@
-## ------------------------------------------------------------------------------
-## Build the library
+#  $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
 
-file (GLOB libtransport_SOURCES BGLConnection.cc
-				Connection.cc
-				ConnectionPool.cc
-				CSConnection.cc
-				DataBlobExtra.cc
-				DataHolder.cc
-				DH_BlobStreamable.cc
-				TH_Ethernet.cc
-				TH_File.cc
-				TH_Mem.cc
-				TH_MPI.cc
-				TH_ShMem.cc
-				TH_Socket.cc
-				TransportHolder.cc)
+include(LofarPackageVersion)
 
-add_library (transport ${libtransport_SOURCES})
+set(transport_LIB_SRCS
+  Package__Version.cc
+  BGLConnection.cc
+  Connection.cc
+  ConnectionPool.cc
+  CSConnection.cc
+  DataBlobExtra.cc
+  DataHolder.cc
+  DH_BlobStreamable.cc
+  TH_Ethernet.cc
+  TH_File.cc
+  TH_Mem.cc
+  TH_MPI.cc
+  TH_ShMem.cc
+  TH_Socket.cc
+  TransportHolder.cc
+)
 
-## ------------------------------------------------------------------------------
-## Installation
+set(transport_PROGRAMS
+  versiontransport
+)
 
-install (
-  TARGETS transport
-  LIBRARY DESTINATION lib
-  ARCHIVE DESTINATION lib
-  )
+lofar_add_library(transport ${transport_LIB_SRCS})
+
+foreach(prog ${transport_PROGRAMS})
+  lofar_add_executable(${prog} ${prog}.cc)
+endforeach(prog ${transport_PROGRAMS})
 
diff --git a/LCS/Transport/test/CMakeLists.txt b/LCS/Transport/test/CMakeLists.txt
index ae6f1fe5bf0..7a4022f2b8f 100644
--- a/LCS/Transport/test/CMakeLists.txt
+++ b/LCS/Transport/test/CMakeLists.txt
@@ -1,92 +1,29 @@
-cmake_minimum_required (VERSION 2.6)
-
-include(LOFARTest)
-include_directories ( ${LOFAR_SOURCE_DIR}/LCS/Transport/test )
-
-## ------------------------------------------------------------------------------
-## Sourses
-
-file (GLOB Example_SRCS            Example.cc DH_Example.cc )
-file (GLOB ExampleMem_SRCS         ExampleMem.cc DH_Example.cc DH_ExampleExtra.cc )
-file (GLOB ExampleBlMem_SRCS       ExampleBlMem.cc DH_Example.cc DH_ExampleExtra.cc )
-file (GLOB ExampleNonBlocking_SRCS ExampleBlMem.cc DH_Example.cc DH_ExampleExtra.cc )
-file (GLOB ExampleVarBuf_SRCS      ExampleVarBuf.cc DH_VarBuf.cc )
-file (GLOB ExampleShMem_SRCS       ExampleShMem.cc DH_Example.cc DH_ExampleExtra.cc )
-file (GLOB ExampleMPI_SRCS         ExampleMPI.cc DH_Example.cc DH_ExampleExtra.cc )
-file (GLOB TestBidirectional_SRCS  TestBidirectional.cc DH_Example.cc )
-file (GLOB ExampleSocket_SRCS      ExampleSocket.cc DH_Socket.cc )
-file (GLOB ExampleEthernet_SRCS    ExampleEthernet.cc DH_Ethernet.cc )
-file (GLOB tServer_SRCS            tServer.cc DH_Socket.cc )
-file (GLOB tClient_SRCS            tClient.cc DH_Socket.cc )
-file (GLOB tCSConnection_SRCS      tCSConnection.cc )
-
-## --- Macro(s) -------------------------------------
-
-MACRO (TARGETLINKLIBRARIES_TRANSPORT_TEST _PROG)
-  target_link_libraries (${_PROG} 
-                         transport
-			 blob
-			 common
-			 ${LOG4CPLUS_LIBRARIES}
-			 ${BACKTRACE_LIBRARIES}
-			 ${SHMEM_LIBRARIES} )
-ENDMACRO (TARGETLINKLIBRARIES_TRANSPORT_TEST)
-
-
-## --- Programs to be built -------------------------
-
-set (CHECKPROGS
-     Example
-     TestBidirectional
-     ExampleMem
-     ExampleBlMem
-     ExampleNonBlocking
-     ExampleVarBuf
-     ExampleShMem
-     ExampleMPI
-     ExampleSocket
-     ExampleEthernet
-     tServer
-     tClient
-     tCSConnection
-)
-
-foreach (prog ${CHECKPROGS})
-  add_executable (${prog} ${${prog}_SRCS})
-  TARGETLINKLIBRARIES_TRANSPORT_TEST (${prog})
-endforeach (prog ${CHECKPROGS})
-
-## --- Programs to be run ---------------------------
-
-set (CHECKTOOLPROGS
-     Example
-     TestBidirectional
-     ExampleMem
-     ExampleBlMem
-     ExampleNonBlocking
-     ExampleVarBuf
-     ExampleSocket
-)
-
-foreach (prog ${CHECKTOOLPROGS})
-  add_test(${prog} ${CMAKE_CURRENT_SOURCE_DIR}/${prog}_test.sh) 
-  set (TEST_PROGRAMS "${TEST_PROGRAMS};${prog}" CACHE STRING "Test programs" FORCE)
-endforeach (prog ${CHECKTOOLPROGS})
-
-## --- ExampleShMem ---------------------------------
-
-if ( MPI_FOUND )
-  add_test (ExampleShMem ${CMAKE_CURRENT_SOURCE_DIR}/ExampleShMem_test.sh)
-  set (TEST_PROGRAMS "${TEST_PROGRAMS};ExampleShMem" CACHE STRING "Test programs" FORCE)
-else ( MPI_FOUND )
-  message (STATUS "Warning: ExampleShMem.run skipped: probably MPI is not configured in!")
-endif ( MPI_FOUND ) 
-
-## --- ExampleMPI -----------------------------------
-
-if ( MPI_FOUND )
-  add_test (ExampleMPI ${CMAKE_CURRENT_SOURCE_DIR}/ExampleMPI_test.sh)
-  set (TEST_PROGRAMS "${TEST_PROGRAMS};ExampleMPI" CACHE STRING "Test programs" FORCE) 
-else ( MPI_FOUND )
-  message (STATUS "Warning: ExampleMPI.run skipped: probably MPI is not configured in!")
-endif ( MPI_FOUND ) 
+include(LofarCTest)
+
+lofar_add_test(Example Example.cc DH_Example.cc)
+lofar_add_test(ExampleMem ExampleMem.cc DH_Example.cc DH_ExampleExtra.cc)
+lofar_add_test(ExampleBlMem ExampleBlMem.cc DH_Example.cc DH_ExampleExtra.cc)
+lofar_add_test(ExampleNonBlocking ExampleNonBlocking.cc DH_Example.cc)
+lofar_add_test(ExampleVarBuf ExampleVarBuf.cc DH_VarBuf.cc)
+lofar_add_test(TestBidirectional TestBidirectional.cc DH_Example.cc)
+lofar_add_test(ExampleSocket ExampleSocket.cc DH_Socket.cc)
+#lofar_add_test(ExampleEthernet ExampleEthernet.cc DH_Ethernet.cc)
+#lofar_add_test(tServer tServer.cc DH_Socket.cc)
+#lofar_add_test(tClient tClient.cc DH_Socket.cc)
+#lofar_add_test(tCSConnection tCSConnection.cc)
+
+if(HAVE_MPI)
+  lofar_add_test(ExampleMPI ExampleMPI.cc DH_Example.cc DH_ExampleExtra.cc)
+  if(HAVE_SHMEM)
+    set(shmem_COMPILE_FLAGS
+      -DHAVE_MMAP=0
+      -DMORECORE=shmbrk
+      -DMORECORE_CONTIGUOUS=0
+      -DMORECORE_CANNOT_TRIM=1
+      -DSHMEM_ALLOC)
+    join_arguments(shmem_COMPILE_FLAGS)
+    set_source_files_properties(ExampleShMem.cc 
+      PROPERTIES COMPILE_FLAGS ${shmem_COMPILE_FLAGS})
+    lofar_add_test(ExampleShMem ExampleShMem.cc DH_Example.cc DH_ExampleExtra.cc)
+  endif(HAVE_SHMEM)
+endif(HAVE_MPI)
diff --git a/LCS/Transport/test/Example_test.sh b/LCS/Transport/test/Example.sh
similarity index 100%
rename from LCS/Transport/test/Example_test.sh
rename to LCS/Transport/test/Example.sh
diff --git a/LCS/Transport/test/ExampleBlMem_test.sh b/LCS/Transport/test/ExampleBlMem.sh
similarity index 100%
rename from LCS/Transport/test/ExampleBlMem_test.sh
rename to LCS/Transport/test/ExampleBlMem.sh
diff --git a/LCS/Transport/test/ExampleEthernet_test.sh b/LCS/Transport/test/ExampleEthernet.sh
similarity index 100%
rename from LCS/Transport/test/ExampleEthernet_test.sh
rename to LCS/Transport/test/ExampleEthernet.sh
diff --git a/LCS/Transport/test/ExampleMPI_test.sh b/LCS/Transport/test/ExampleMPI.sh
similarity index 100%
rename from LCS/Transport/test/ExampleMPI_test.sh
rename to LCS/Transport/test/ExampleMPI.sh
diff --git a/LCS/Transport/test/ExampleMem_test.sh b/LCS/Transport/test/ExampleMem.sh
similarity index 100%
rename from LCS/Transport/test/ExampleMem_test.sh
rename to LCS/Transport/test/ExampleMem.sh
diff --git a/LCS/Transport/test/ExampleNonBlocking_test.sh b/LCS/Transport/test/ExampleNonBlocking.sh
similarity index 100%
rename from LCS/Transport/test/ExampleNonBlocking_test.sh
rename to LCS/Transport/test/ExampleNonBlocking.sh
diff --git a/LCS/Transport/test/ExampleShMem_test.sh b/LCS/Transport/test/ExampleShMem.sh
similarity index 100%
rename from LCS/Transport/test/ExampleShMem_test.sh
rename to LCS/Transport/test/ExampleShMem.sh
diff --git a/LCS/Transport/test/ExampleSocket.run b/LCS/Transport/test/ExampleSocket.run
index 5f0963adadf..6969463e967 100755
--- a/LCS/Transport/test/ExampleSocket.run
+++ b/LCS/Transport/test/ExampleSocket.run
@@ -2,7 +2,7 @@
 
 trap 'cleanup; trap - 0; exit' 0 1 2 3 15
 
-# Kill the background (server) process (if it's still running)
+# Kill the background process (if it's still running)
 cleanup()
 {
   if kill -0 $! 2>/dev/null; then 
@@ -20,8 +20,9 @@ $CMDPREFIX $LOFAR_CHECKTOOL ./ExampleSocket -s > ExampleSocket_tmp.outs1 &
 $CMDPREFIX $LOFAR_CHECKTOOL ./ExampleSocket -c > ExampleSocket_tmp.outc1
 
 # Exit if something went wrong.
-if [ $? != 0 ]; then
-  exit $?
+STATUS=$?
+if [ $STATUS != 0 ]; then
+  exit $STATUS
 fi
 
 # Output the result in order.
@@ -34,8 +35,9 @@ $CMDPREFIX $LOFAR_CHECKTOOL ./ExampleSocket -c > ExampleSocket_tmp.outc2 &
 $CMDPREFIX $LOFAR_CHECKTOOL ./ExampleSocket -s > ExampleSocket_tmp.outs2
 
 # Exit if something went wrong.
-if [ $? != 0 ]; then 
-  exit $?
+STATUS=$?
+if [ $STATUS != 0 ]; then 
+  exit $STATUS
 fi
 
 # Output the result in order.
diff --git a/LCS/Transport/test/ExampleSocket_test.sh b/LCS/Transport/test/ExampleSocket.sh
similarity index 100%
rename from LCS/Transport/test/ExampleSocket_test.sh
rename to LCS/Transport/test/ExampleSocket.sh
diff --git a/LCS/Transport/test/ExampleVarBuf_test.sh b/LCS/Transport/test/ExampleVarBuf.sh
similarity index 100%
rename from LCS/Transport/test/ExampleVarBuf_test.sh
rename to LCS/Transport/test/ExampleVarBuf.sh
diff --git a/LCS/Transport/test/Makefile.am b/LCS/Transport/test/Makefile.am
index 6ddb605bf62..6cc1315c81f 100644
--- a/LCS/Transport/test/Makefile.am
+++ b/LCS/Transport/test/Makefile.am
@@ -58,15 +58,15 @@ LDADD			  = ../src/libtransport.la
 DEPENDENCIES		  = ../src/libtransport.la $(LOFAR_DEPEND)
 
 TESTSCRIPTS = \
-	Example_test.sh			\
-	TestBidirectional_test.sh	\
-	ExampleMem_test.sh		\
-	ExampleBlMem_test.sh		\
-	ExampleNonBlocking_test.sh	\
-	ExampleShMem_test.sh		\
-	ExampleMPI_test.sh		\
-	ExampleVarBuf_test.sh		\
-	ExampleSocket_test.sh
+	Example.sh		\
+	TestBidirectional.sh	\
+	ExampleMem.sh		\
+	ExampleBlMem.sh		\
+	ExampleNonBlocking.sh	\
+	ExampleShMem.sh		\
+	ExampleMPI.sh		\
+	ExampleVarBuf.sh	\
+	ExampleSocket.sh
 
 TESTS = $(TESTSCRIPTS)
 
diff --git a/LCS/Transport/test/TestBidirectional_test.sh b/LCS/Transport/test/TestBidirectional.sh
similarity index 100%
rename from LCS/Transport/test/TestBidirectional_test.sh
rename to LCS/Transport/test/TestBidirectional.sh
diff --git a/LCS/Transport/test/tTH_Socket_test.sh b/LCS/Transport/test/tTH_Socket.sh
similarity index 100%
rename from LCS/Transport/test/tTH_Socket_test.sh
rename to LCS/Transport/test/tTH_Socket.sh
diff --git a/LCS/config.h.cmake b/LCS/config.h.cmake
new file mode 100644
index 00000000000..7e6c5886db1
--- /dev/null
+++ b/LCS/config.h.cmake
@@ -0,0 +1,148 @@
+/* config.h.in.  Generated from configure.in by autoheader.  */
+
+/* Define if building universal (internal helper macro) */
+#cmakedefine AC_APPLE_UNIVERSAL_BUILD 1
+
+/* Define as __PRETTY_FUNCTION__, __FUNCTION__, or "<unknown>" */
+#define AUTO_FUNCTION_NAME __PRETTY_FUNCTION__
+
+/* Define if DbgAssert is enabled */
+#cmakedefine ENABLE_DBGASSERT 1
+
+/* Define if TRACER is enabled */
+#cmakedefine ENABLE_TRACER 1
+
+/* Define if backtrace() is available */
+#cmakedefine HAVE_BACKTRACE 1
+
+/* Define if libbfd is available */
+#cmakedefine HAVE_BFD 1
+
+/* Define if MPICH is installed */
+#cmakedefine HAVE_BGLMPICH 1
+
+/* Define if BOOST is installed */
+#cmakedefine HAVE_BOOST 1
+
+/* Define to 1 if you have the `cplus_demangle' function. */
+#cmakedefine HAVE_CPLUS_DEMANGLE 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#cmakedefine HAVE_DLFCN_H 1
+
+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
+#cmakedefine HAVE_DOPRNT 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#cmakedefine HAVE_INTTYPES_H 1
+
+/* Define if LAM is installed */
+#cmakedefine HAVE_LAM 1
+
+/* Define if LOG4CPLUS is installed */
+#cmakedefine HAVE_LOG4CPLUS 1
+
+/* Define if LOG4CXX is installed */
+#cmakedefine HAVE_LOG4CXX 1
+
+/* Define if `long long' is supported */
+#cmakedefine HAVE_LONG_LONG 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#cmakedefine HAVE_MEMORY_H 1
+
+/* Define if we have an MPI implementation installed */
+#cmakedefine HAVE_MPI 1
+
+/* Define if MPICH is installed */
+#cmakedefine HAVE_MPICH 1
+
+/* Define if MPI profiler should be enabled */
+#cmakedefine HAVE_MPI_PROFILER 1
+
+/* Define if using Rational Purify */
+#cmakedefine HAVE_PURIFY 1
+
+/* Define if ScaMPI is installed */
+#cmakedefine HAVE_SCAMPI 1
+
+/* Defined if shared memory is used */
+#cmakedefine HAVE_SHMEM 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#cmakedefine HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#cmakedefine HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#cmakedefine HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#cmakedefine HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#cmakedefine HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#cmakedefine HAVE_SYS_TYPES_H 1
+
+/* Define if TOOLS is installed */
+#cmakedefine HAVE_TOOLS 1
+
+/* Define if `uint' is supported */
+#cmakedefine HAVE_UINT 1
+
+/* Define if `ulong' is supported */
+#cmakedefine HAVE_ULONG 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#cmakedefine HAVE_UNISTD_H 1
+
+/* Define if `ushort' is supported */
+#cmakedefine HAVE_USHORT 1
+
+/* Define to 1 if you have the `vprintf' function. */
+#cmakedefine HAVE_VPRINTF 1
+
+/* Define if we are compiling with debugging information */
+#cmakedefine LOFAR_DEBUG 1
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#cmakedefine LT_OBJDIR 1
+
+/* Define to the address where bug reports for this package should be sent. */
+#cmakedefine PACKAGE_BUGREPORT 1
+
+/* Define to the full name of this package. */
+#cmakedefine PACKAGE_NAME 1
+
+/* Define to the full name and version of this package. */
+#cmakedefine PACKAGE_STRING 1
+
+/* Define to the one symbol short name of this package. */
+#cmakedefine PACKAGE_TARNAME 1
+
+/* Define to the version of this package. */
+#cmakedefine PACKAGE_VERSION 1
+
+/* Define RPM release nr */
+#cmakedefine RPM_RELEASE 1
+
+/* Define to 1 if you have the ANSI C header files. */
+#cmakedefine STDC_HEADERS 1
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+   significant byte first (like Motorola and SPARC, unlike Intel). */
+#cmakedefine WORDS_BIGENDIAN 1
+
+/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
+   `char[]'. */
+#cmakedefine YYTEXT_POINTER 1
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#cmakedefine const 1
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#cmakedefine size_t 1
diff --git a/LCS/lofar_config.h.cmake b/LCS/lofar_config.h.cmake
new file mode 100644
index 00000000000..6f10b60867c
--- /dev/null
+++ b/LCS/lofar_config.h.cmake
@@ -0,0 +1,148 @@
+/* config.h.cmake.  [LOFAR.LCS].  */
+
+/* Define if building universal (internal helper macro) */
+#cmakedefine AC_APPLE_UNIVERSAL_BUILD 1
+
+/* Define as __PRETTY_FUNCTION__, __FUNCTION__, or "<unknown>" */
+#cmakedefine AUTO_FUNCTION_NAME __PRETTY_FUNCTION__
+
+/* Define if DbgAssert is enabled */
+#cmakedefine ENABLE_DBGASSERT 1
+
+/* Define if TRACER is enabled */
+#cmakedefine ENABLE_TRACER 1
+
+/* Define if backtrace() is available */
+#cmakedefine HAVE_BACKTRACE 1
+
+/* Define if libbfd is available */
+#cmakedefine HAVE_BFD 1
+
+/* Define if MPICH is installed */
+#cmakedefine HAVE_BGLMPICH 1
+
+/* Define if BOOST is installed */
+#cmakedefine HAVE_BOOST 1
+
+/* Define to 1 if you have the `cplus_demangle' function. */
+#cmakedefine HAVE_CPLUS_DEMANGLE 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#cmakedefine HAVE_DLFCN_H 1
+
+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
+#cmakedefine HAVE_DOPRNT 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#cmakedefine HAVE_INTTYPES_H 1
+
+/* Define if LAM is installed */
+#cmakedefine HAVE_LAM 1
+
+/* Define if LOG4CPLUS is installed */
+#cmakedefine HAVE_LOG4CPLUS 1
+
+/* Define if LOG4CXX is installed */
+#cmakedefine HAVE_LOG4CXX 1
+
+/* Define if `long long' is supported */
+#cmakedefine HAVE_LONG_LONG 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#cmakedefine HAVE_MEMORY_H 1
+
+/* Define if we have an MPI implementation installed */
+#cmakedefine HAVE_MPI 1
+
+/* Define if MPICH is installed */
+#cmakedefine HAVE_MPICH 1
+
+/* Define if MPI profiler should be enabled */
+#cmakedefine HAVE_MPI_PROFILER 1
+
+/* Define if using Rational Purify */
+#cmakedefine HAVE_PURIFY 1
+
+/* Define if ScaMPI is installed */
+#cmakedefine HAVE_SCAMPI 1
+
+/* Defined if shared memory is used */
+#cmakedefine HAVE_SHMEM 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#cmakedefine HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#cmakedefine HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#cmakedefine HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#cmakedefine HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#cmakedefine HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#cmakedefine HAVE_SYS_TYPES_H 1
+
+/* Define if TOOLS is installed */
+#cmakedefine HAVE_TOOLS 1
+
+/* Define if `uint' is supported */
+#cmakedefine HAVE_UINT 1
+
+/* Define if `ulong' is supported */
+#cmakedefine HAVE_ULONG 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#cmakedefine HAVE_UNISTD_H 1
+
+/* Define if `ushort' is supported */
+#cmakedefine HAVE_USHORT 1
+
+/* Define to 1 if you have the `vprintf' function. */
+#cmakedefine HAVE_VPRINTF 1
+
+/* Define if we are compiling with debugging information */
+#cmakedefine LOFAR_DEBUG 1
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#cmakedefine LT_OBJDIR 1
+
+/* Define to the address where bug reports for this package should be sent. */
+#cmakedefine PACKAGE_BUGREPORT 1
+
+/* Define to the full name of this package. */
+#cmakedefine PACKAGE_NAME 1
+
+/* Define to the full name and version of this package. */
+#cmakedefine PACKAGE_STRING 1
+
+/* Define to the one symbol short name of this package. */
+#cmakedefine PACKAGE_TARNAME 1
+
+/* Define to the version of this package. */
+#cmakedefine PACKAGE_VERSION 1
+
+/* Define RPM release nr */
+#cmakedefine RPM_RELEASE 1
+
+/* Define to 1 if you have the ANSI C header files. */
+#cmakedefine STDC_HEADERS 1
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+   significant byte first (like Motorola and SPARC, unlike Intel). */
+#cmakedefine WORDS_BIGENDIAN 1
+
+/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
+   `char[]'. */
+#cmakedefine YYTEXT_POINTER 1
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#cmakedefine const 1
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#cmakedefine size_t 1
diff --git a/MAC/CMakeLists.txt b/MAC/CMakeLists.txt
new file mode 100644
index 00000000000..ddc1307d8fc
--- /dev/null
+++ b/MAC/CMakeLists.txt
@@ -0,0 +1,46 @@
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
+## Project characteristics
+## ---------------------------------------------------------------------------
+project(MAC)
+include(LofarGeneral)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+lofar_add_subdirectory(MACIO)       # MAC I/O related functions
+lofar_add_subdirectory(GCF)         # Generic Control Framework
+#lofar_add_subdirectory(APL)
+#lofar_add_subdirectory(Deployment)
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
+
diff --git a/MAC/GCF/CMakeLists.txt b/MAC/GCF/CMakeLists.txt
new file mode 100644
index 00000000000..69b55a6baf9
--- /dev/null
+++ b/MAC/GCF/CMakeLists.txt
@@ -0,0 +1,45 @@
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
+## Project characteristics
+## ---------------------------------------------------------------------------
+project(GCF)
+include(LofarGeneral)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+lofar_add_subdirectory(TM)     # Task Management
+lofar_add_subdirectory(PVSS)   # Low-level interface to PVSS database
+lofar_add_subdirectory(RTDB)   # Real-Time Database layer.
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
+
diff --git a/MAC/GCF/TM/CMakeLists.txt b/MAC/GCF/TM/CMakeLists.txt
new file mode 100644
index 00000000000..477b274ce51
--- /dev/null
+++ b/MAC/GCF/TM/CMakeLists.txt
@@ -0,0 +1,53 @@
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
+## Project characteristics
+## ---------------------------------------------------------------------------
+project(GCFTM)
+include(LofarGeneral)
+
+include(LofarAddPackage)
+lofar_add_package(${PROJECT_NAME} 6.1 DEPENDS Common MACIO)
+
+## ---------------------------------------------------------------------------
+## External packages
+## ---------------------------------------------------------------------------
+include(LofarFindPackage)
+lofar_find_package(Boost)
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(include/GCF/TM)
+add_subdirectory(src)
+add_subdirectory(test)
diff --git a/MAC/GCF/TM/include/GCF/TM/CMakeLists.txt b/MAC/GCF/TM/include/GCF/TM/CMakeLists.txt
new file mode 100644
index 00000000000..10a2b711ee8
--- /dev/null
+++ b/MAC/GCF/TM/include/GCF/TM/CMakeLists.txt
@@ -0,0 +1,45 @@
+#  $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
+
+# List of header files that will be installed.
+set(inst_HEADERS
+  Package__Version.h
+  GCF_Control.h
+  GCF_DevicePort.h
+  GCF_ETHRawPort.h
+  GCF_Fsm.h
+  GCF_Handler.h
+  GCF_ITCPort.h
+  GCF_Port.h
+  GCF_PortInterface.h
+  GCF_Protocols.h
+  GCF_RawPort.h
+  GCF_Task.h
+  GCF_TCPPort.h
+  GCF_TimerPort.h)
+
+# Create symbolic link to include directory.
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink 
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_BINARY_DIR}/include/GCF/TM)
+
+# Install header files.
+install(FILES ${inst_HEADERS} DESTINATION include/GCF/TM)
+
diff --git a/MAC/GCF/TM/src/CMakeLists.txt b/MAC/GCF/TM/src/CMakeLists.txt
new file mode 100644
index 00000000000..a7090eb587c
--- /dev/null
+++ b/MAC/GCF/TM/src/CMakeLists.txt
@@ -0,0 +1,55 @@
+#  $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
+
+include(LofarPackageVersion)
+
+# Add current source directory to -I path. This is needed because GCFTM uses
+# angle brackets for internal header files, instead of quotes.
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+
+# Add the directory where the generated C++ headers are stored to the -I path.
+include_directories(${CMAKE_BINARY_DIR}/include/MAC)
+
+set(gcftm_LIB_SRCS
+  Package__Version.cc
+  GCF_Fsm.cc
+  GCF_Protocols.cc
+  GCF_Task.cc
+  Port/GCF_PortInterface.cc
+  Port/GCF_Port.cc
+  Port/GCF_RawPort.cc
+  Timer/GTM_Timer.cc
+  Timer/GTM_TimerHandler.cc
+  PortImpl/GCF_DevicePort.cc
+  PortImpl/GCF_ETHRawPort.cc
+  PortImpl/GCF_ITCPort.cc
+  PortImpl/GCF_TCPPort.cc
+  PortImpl/GTM_Device.cc
+  PortImpl/GTM_ETHSocket.cc
+  PortImpl/GTM_File.cc
+  PortImpl/GTM_FileHandler.cc
+  PortImpl/GTM_TCPServerSocket.cc
+  PortImpl/GTM_TCPSocket.cc
+  ServiceBroker/GTM_SBTCPPort.cc
+  ServiceBroker/ServiceBrokerTask.cc)
+
+lofar_add_library(gcftm ${gcftm_LIB_SRCS})
+
+lofar_add_executable(versiongcftm versiongcftm.cc)
diff --git a/MAC/GCF/TM/test/CMakeLists.txt b/MAC/GCF/TM/test/CMakeLists.txt
new file mode 100644
index 00000000000..ab6b3e01be9
--- /dev/null
+++ b/MAC/GCF/TM/test/CMakeLists.txt
@@ -0,0 +1,53 @@
+#  $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
+
+include(LofarCTest)
+
+# Add MAC protocol(s)
+include(MACAddProtocol)
+mac_add_protocol(Echo_Protocol "${MACIO_SOURCE_DIR}/autogen")
+
+# Add current binary directory to -I path, so that the generated C++ header
+# files can be found.
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
+
+# Tests were not run in the "old" autotools environment and they all seem to
+# hang when being run. Therefore we will only build them for the time being.
+if(0)
+  lofar_add_test(tmEcho Echo_Protocol.cc Echo.cc)
+  lofar_add_test(tmPing Echo_Protocol.cc Ping.cc)
+  lofar_add_test(tGCFPort Echo_Protocol.cc tGCFPort.cc)
+  lofar_add_test(tGCFTimer tTimer.cc)
+  lofar_add_test(tGCFTask1 tGCFTask1.cc testTask.cc)
+  lofar_add_test(tGCFTask2 tGCFTask2.cc testTask.cc)
+  lofar_add_test(tGCFTask3 tGCFTask3.cc testTask.cc)
+  lofar_add_test(tGCFTask4 tGCFTask4.cc testTask.cc)
+  lofar_add_test(tGCFTask5 tGCFTask5.cc testTask.cc)
+else()
+  lofar_add_executable(tmEcho Echo_Protocol.cc Echo.cc)
+  lofar_add_executable(tmPing Echo_Protocol.cc Ping.cc)
+  lofar_add_executable(tGCFPort Echo_Protocol.cc tGCFPort.cc)
+  lofar_add_executable(tGCFTimer tTimer.cc)
+  lofar_add_executable(tGCFTask1 tGCFTask1.cc testTask.cc)
+  lofar_add_executable(tGCFTask2 tGCFTask2.cc testTask.cc)
+  lofar_add_executable(tGCFTask3 tGCFTask3.cc testTask.cc)
+  lofar_add_executable(tGCFTask4 tGCFTask4.cc testTask.cc)
+  lofar_add_executable(tGCFTask5 tGCFTask5.cc testTask.cc)
+endif(0)
diff --git a/MAC/MACIO/CMakeLists.txt b/MAC/MACIO/CMakeLists.txt
new file mode 100644
index 00000000000..90337ffa368
--- /dev/null
+++ b/MAC/MACIO/CMakeLists.txt
@@ -0,0 +1,53 @@
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
+## Project characteristics
+## ---------------------------------------------------------------------------
+project(MACIO)
+include(LofarGeneral)
+
+include(LofarAddPackage)
+lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS Common)
+
+## ---------------------------------------------------------------------------
+## External packages
+## ---------------------------------------------------------------------------
+include(LofarFindPackage)
+lofar_find_package(Boost)
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(include/MACIO)
+add_subdirectory(src)
+add_subdirectory(test)
diff --git a/MAC/MACIO/autogen/protocol.tpl b/MAC/MACIO/autogen/protocol.tpl
index 3fa051a74fc..b6df452678f 100644
--- a/MAC/MACIO/autogen/protocol.tpl
+++ b/MAC/MACIO/autogen/protocol.tpl
@@ -56,6 +56,7 @@ const struct protocolStrings		LOFAR::[+ (base-name) +]::[+ protocol-name +]_STRI
 #include <MACIO/ProtocolDefs.h>
 #include <Common/LofarTypes.h>
 #include <string>
+#include <cstring>
 
 namespace LOFAR
 {
diff --git a/MAC/MACIO/include/MACIO/CMakeLists.txt b/MAC/MACIO/include/MACIO/CMakeLists.txt
new file mode 100644
index 00000000000..a4d82695098
--- /dev/null
+++ b/MAC/MACIO/include/MACIO/CMakeLists.txt
@@ -0,0 +1,38 @@
+#  $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
+
+# List of header files that will be installed.
+set(inst_HEADERS
+  Package__Version.h
+  EventPort.h
+  GCF_Event.h
+  MACServiceInfo.h
+  Marshalling.h
+  ProtocolDefs.h
+  StringVector.h
+)
+
+# Create symbolic link to include directory.
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink 
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_BINARY_DIR}/include/${PROJECT_NAME})
+
+# Install header files.
+install(FILES ${inst_HEADERS} DESTINATION include/${PROJECT_NAME})
diff --git a/MAC/MACIO/src/CMakeLists.txt b/MAC/MACIO/src/CMakeLists.txt
new file mode 100644
index 00000000000..e2835366fee
--- /dev/null
+++ b/MAC/MACIO/src/CMakeLists.txt
@@ -0,0 +1,46 @@
+#  $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
+
+include(LofarPackageVersion)
+
+## ---------------------------------------------------------------------------
+## Add MAC protocols (generates a .ph and .cc file from a .prot file)
+## ---------------------------------------------------------------------------
+include(MACAddProtocol)
+mac_add_protocol(LOG_Protocol "${${PROJECT_NAME}_SOURCE_DIR}/autogen")
+mac_add_protocol(KVT_Protocol "${${PROJECT_NAME}_SOURCE_DIR}/autogen")
+mac_add_protocol(SB_Protocol "${${PROJECT_NAME}_SOURCE_DIR}/autogen")
+
+## ---------------------------------------------------------------------------
+## Add libraries to be generated
+## ---------------------------------------------------------------------------
+lofar_add_library(log_protocol LOG_Protocol.cc)
+lofar_add_library(kvt_protocol KVT_Protocol.cc)
+lofar_add_library(macio 
+  Package__Version.cc
+  GCF_Event.cc
+  EventPort.cc
+  ProtocolDefs.cc
+  SB_Protocol.cc)
+
+## ---------------------------------------------------------------------------
+## Add executables to be generated
+## ---------------------------------------------------------------------------
+lofar_add_executable(versionmacio versionmacio.cc)
diff --git a/MAC/MACIO/test/CMakeLists.txt b/MAC/MACIO/test/CMakeLists.txt
new file mode 100644
index 00000000000..bb301607348
--- /dev/null
+++ b/MAC/MACIO/test/CMakeLists.txt
@@ -0,0 +1,33 @@
+#  $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
+
+include(LofarCTest)
+
+include(MACAddProtocol)
+
+mac_add_protocol(Echo_Protocol "${${PROJECT_NAME}_SOURCE_DIR}/autogen")
+mac_add_protocol(testprotocol "${${PROJECT_NAME}_SOURCE_DIR}/autogen")
+
+# Add current binary directory to -I path, so that the generated C++ header
+# files can be found.
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
+
+lofar_add_test(tEventPort tEventPort.cc Echo_Protocol.cc)
+lofar_add_test(tProtocol tProtocol.cc Echo_Protocol.cc testprotocol.cc)
diff --git a/MAC/MACIO/test/tEventPort.cc b/MAC/MACIO/test/tEventPort.cc
index f8a994a9f2d..8491e24363d 100644
--- a/MAC/MACIO/test/tEventPort.cc
+++ b/MAC/MACIO/test/tEventPort.cc
@@ -32,7 +32,7 @@ using namespace LOFAR::MACIO;
 static	EchoPingEvent		pingEvent;
 static	EventPort*			echoPort;
 
-int main (int32	argc, char*argv[]) 
+int main (int	argc, char*argv[]) 
 {
 	bool	syncMode;
 	switch (argc) {
diff --git a/MAC/MACIO/test/tEventPort.sh b/MAC/MACIO/test/tEventPort.sh
new file mode 100755
index 00000000000..31daee34996
--- /dev/null
+++ b/MAC/MACIO/test/tEventPort.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+./runctest.sh tEventPort 2>&1 > tEventPort.log
diff --git a/MAC/MACIO/test/tProtocol.sh b/MAC/MACIO/test/tProtocol.sh
new file mode 100755
index 00000000000..c0bb06b7570
--- /dev/null
+++ b/MAC/MACIO/test/tProtocol.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+./runctest.sh tProtocol 2>&1 > tProtocol.log
diff --git a/RTCP/CMakeLists.txt b/RTCP/CMakeLists.txt
index c2a01142e95..29b221bde44 100644
--- a/RTCP/CMakeLists.txt
+++ b/RTCP/CMakeLists.txt
@@ -1,97 +1,62 @@
-## ------------------------------------------------------------------------------
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
 ## Project characteristics
+## ---------------------------------------------------------------------------
+project(RTCP)
+include(LofarGeneral)
 
-project (RTCP)
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
 
-cmake_minimum_required (VERSION 2.6)
+# Several RTCP tools
+lofar_add_subdirectory(RTCPTools)
 
-## ------------------------------------------------------------------------------
-## Set CMAKE_MODULE_PATH to load custom CMake modules
+# Several run scripts to start the RTCP components
+#lofar_add_subdirectory(Run)
 
-if (NOT LOFAR_ROOT)
-find_path (LOFAR_ROOT cmake/modules/CMakeSettings.cmake
-  PATHS 
-  ${LCS_SOURCE_DIR}
-  ${LCS_SOURCE_DIR}/..
-  ${LCS_SOURCE_DIR}/../..
-  ${LCS_SOURCE_DIR}/../../..
-  $ENV{LOFARSOFT}
-  )
+# Fast Collective Network Protocol; used on BlueGene only.
+lofar_add_subdirectory(FCNP)
 
-if (LOFAR_ROOT)
-  include (${LOFAR_ROOT}/cmake/CMakeSettings.cmake)
-else (LOFAR_ROOT)
-  message (FATAL_ERROR "Unable to locate additional CMake scripts!")
-endif (LOFAR_ROOT)
-endif (NOT LOFAR_ROOT)
+# Defines interfaces between the different components within the RTCP product
+lofar_add_subdirectory(Interface)
 
-## ------------------------------------------------------------------------------
-## Additional CMake modules
+# Compute-Node Processing: application running on the BlueGene compute nodes
+lofar_add_subdirectory(CNProc)
 
-include (CheckIncludeFiles)
-include (CheckLibraryExists)
-include (CheckTypeSize)
-include (CTest)
-enable_testing()
+# I/O Node Processing: application running on the BlueGene I/O nodes
+#lofar_add_subdirectory(IONProc)
 
-## Custom modules
+# Stores output from the correlator in one or more MeasurmentSet files.
+lofar_add_subdirectory(Storage)
 
-#include (MakePackageVersion)
-
-## ------------------------------------------------------------------------------
-## Check system libraries
-
-## ------------------------------------------------------------------------------
-## Search for external libraries
-
-## ------------------------------------------------------------------------------
-## Check for required tools
-
-## ------------------------------------------------------------------------------
-## Module header files
-
-
-## ------------------------------------------------------------------------------
-## Directories to be included in the build
-
-## --- Interface ------------------------------------
-
-find_path (HAVE_INTERFACE CMakeLists.txt ${LOFAR_SOURCE_DIR}/RTCP/Interface)
-if (HAVE_INTERFACE)
-  set (HAVE_INTERFACE TRUE CACHE BOOL "Have package Interface?" FORCE)
-  add_subdirectory (Interface)
-endif (HAVE_INTERFACE)  
-
-## --- FCNP -----------------------------------------
-
-find_path (HAVE_FCNP CMakeLists.txt ${LOFAR_SOURCE_DIR}/RTCP/FCNP)
-if (HAVE_FCNP)
-  set (HAVE_FCNP TRUE CACHE BOOL "Have package FCNP?" FORCE)
-  add_subdirectory (FCNP)
-endif (HAVE_FCNP)  
-
-## --- Storage --------------------------------------
-
-find_path (HAVE_STORAGE CMakeLists.txt ${LOFAR_SOURCE_DIR}/RTCP/Storage)
-if (HAVE_STORAGE)
-  set (HAVE_STORAGE TRUE CACHE BOOL "Have package Storage?" FORCE)
-  add_subdirectory (Storage)
-endif (HAVE_STORAGE)  
-
-## --- IONProc --------------------------------------
-
-find_path (HAVE_IONPROC CMakeLists.txt ${LOFAR_SOURCE_DIR}/RTCP/IONProc)
-if (HAVE_IONPROC)
-  set (HAVE_IONPROC TRUE CACHE BOOL "Have package IONProc?" FORCE)
-  add_subdirectory (IONProc)
-endif (HAVE_IONPROC)  
-
-## --- CNProc ---------------------------------------
-
-find_path (HAVE_CNPROC CMakeLists.txt ${LOFAR_SOURCE_DIR}/RTCP/CNProc)
-if (HAVE_CNPROC)
-  set (HAVE_CNPROC TRUE CACHE BOOL "Have package CNProc?" FORCE)
-  add_subdirectory (CNProc)
-endif (HAVE_CNPROC)  
-
-#add_subdirectory (CS1_Tools)
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
diff --git a/RTCP/CNProc/CMakeLists.txt b/RTCP/CNProc/CMakeLists.txt
index 7c1bfd0ecee..7d144a58d53 100644
--- a/RTCP/CNProc/CMakeLists.txt
+++ b/RTCP/CNProc/CMakeLists.txt
@@ -1,27 +1,66 @@
-## ------------------------------------------------------------------------------
-## Project characteristics
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
 
-project (CNProc)
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
 
-cmake_minimum_required (VERSION 2.6)
+## ---------------------------------------------------------------------------
+## Project characteristics
+## ---------------------------------------------------------------------------
+project(CNProc)
+include(LofarGeneral)
 
-## ------------------------------------------------------------------------------
-## Enable test?
+include(LofarAddPackage)
+lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS Common Stream Interface FCNP)
 
-option (CNPROC_ENABLE_TESTING "Enable building and executing test programs?" NO  )
+## ---------------------------------------------------------------------------
+## External packages
+## ---------------------------------------------------------------------------
+include(LofarFindPackage)
+lofar_find_package(Boost REQUIRED)
+lofar_find_package(FFTW3)
+if(NOT FFTW3_F0UND)
+  lofar_find_package(FFTW2)
+  if(NOT FFTW2_FOUND)
+    message(SEND_ERROR "Should have FFTW3 or FFTW2 installed.")
+  endif(NOT FFTW2_FOUND)
+endif(NOT FFTW3_F0UND)
 
-## ------------------------------------------------------------------------------
-## Directories to be included in the build
+#lofar_find_package(Mass)
 
-include_directories (${CNProc_BINARY_DIR}/include)
+## ---------------------------------------------------------------------------
+## Enable BGP specific assembler
+## ---------------------------------------------------------------------------
+enable_language(ASM-BGP)
 
-configure_file(${CMAKE_SOURCE_DIR}/config.h.cmake
-               ${CNProc_BINARY_DIR}/include/config.h)
-configure_file(${CNProc_SOURCE_DIR}/lofar_config.h.cmake
-               ${CNProc_BINARY_DIR}/include/lofar_config.h)
-	       
-add_subdirectory (src)
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
 
-if (CNPROC_ENABLE_TESTING)
-  add_subdirectory (test)
-endif (CNPROC_ENABLE_TESTING)  
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(src)
+add_subdirectory(test)
diff --git a/RTCP/CNProc/src/CMakeLists.txt b/RTCP/CNProc/src/CMakeLists.txt
index 81a152c1a7a..96cf2253d75 100644
--- a/RTCP/CNProc/src/CMakeLists.txt
+++ b/RTCP/CNProc/src/CMakeLists.txt
@@ -1,105 +1,63 @@
-find_path (HAVE_LINK_CNPROC CNProc ${CMAKE_CURRENT_SOURCE_DIR})
-if (HAVE_LINK_CNPROC)
-  set (HAVE_LINK_CNPROC TRUE CACHE BOOL "Have link CNProc?" FORCE)
-  execute_process(COMMAND rm -rf ${CMAKE_CURRENT_SOURCE_DIR}/CNProc )
-endif (HAVE_LINK_CNPROC)
+#  $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
+
+include(LofarPackageVersion)
+
+# Create symbolic link to include directory.
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_BINARY_DIR}/include/${PROJECT_NAME})
+
+# Add current source directory to -I path. This is needed because CNProc uses
+# angle brackets for internal header files, instead of quotes.
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+
+set(cnproc_LIB_SRCS
+  Package__Version.cc
+  AsyncCommunication.cc
+  AsyncTranspose.cc
+  BandPass.cc
+  BeamFormer.cc
+  CN_Processing.cc
+  Correlator.cc
+  FCNP_ClientStream.cc
+  FIR.cc
+  LocationInfo.cc
+  PencilBeams.cc
+  PPF.cc
+  Stokes.cc)
+
+if(CMAKE_ASM-BGP_COMPILER_WORKS)
+#  set(CMAKE_ASM-BGP_LINK_EXECUTABLE "<CMAKE_LINKER> <FLAGS> <CMAKE_ASM${ASM_DIALECT}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS>  -o <TARGET> <LINK_LIBRARIES>")
+  list(APPEND cnproc_LIB_SRCS
+    CorrelatorAsm.S
+    FIR_Asm.S
+    FFT_Asm.S)
+endif(CMAKE_ASM-BGP_COMPILER_WORKS)
+
+lofar_add_library(cnproc ${cnproc_LIB_SRCS})
+
+message(STATUS "ASM-BGP = ${ASM-BGP}")
+message(STATUS "CMAKE_ASM-BGP_COMPILER = ${CMAKE_ASM-BGP_COMPILER}")
+message(STATUS "CMAKE_ASM-BGP_LINK_EXECUTABLE = ${CMAKE_ASM-BGP_LINK_EXECUTABLE}")
+
+lofar_add_executable(CN_Processing CN_Processing_main.cc)
+lofar_add_executable(versioncnproc versioncnproc.cc)
 
-execute_process(COMMAND ln -s ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/CNProc )
-
-
-## ------------------------------------------------------------------------------
-## Include files
-
-file (GLOB libinterface_HEADERS BandPass.h
-				LocationInfo.h
-				CorrelatorAsm.h
-				FFT_Asm.h
-				FIR_Asm.h
-				InputData.h
-				TransposedData.h
-				FIR.h
-				PPF.h
-				AsyncTranspose.h
-				BeamFormer.h
-				BeamFormerAsm.h
-				Correlator.h
-				CN_Processing.h
-				FCNP_ClientStream.h
-				AsyncCommunication.h
-				PencilBeams.h
-				Stokes.h)
- 
-enable_language(ASM-BGP)
-
-if (CMAKE_ASM-BGP_COMPILER_WORKS)
-  file(GLOB amsSrcs BeamFormerAsm.S
-		    BeamFormerAsm3St6Bm.inc
-		    BeamFormerAsm6St3Bm.inc
-		    CorrelatorAsm.S
-                    FIR_Asm.S
-		    FFT_Asm.S)
-endif (CMAKE_ASM-BGP_COMPILER_WORKS)  
-
-## ------------------------------------------------------------------------------
-## Build the library
-
-file (GLOB libcnproc_SOURCES BandPass.cc
-			     LocationInfo.cc
-			     FIR.cc
-			     AsyncTranspose.cc
-			     BeamFormer.cc
-			     PPF.cc
-			     Correlator.cc
-			     CN_Processing.cc
-			     FCNP_ClientStream.cc
-			     AsyncCommunication.cc
-			     PencilBeams.cc
-			     Stokes.cc
-			     ${amsSrcs})
-
-add_library (cnproc ${libcnproc_SOURCES})
-
-## linker instructions
-target_link_libraries (  cnproc 
-			 interface
-			 stream
-			 fcnp_cn
-			 fcnp_ion
-			 applcommon
-                         common
-			 ${Boost_LIBRARIES}
-			 ${CASA_LIBRARIES}
-			 ${BACKTRACE_LIBRARIES}
-			 ${WITH-LIBS}
-			 )
-
-add_executable(CN_Processing CN_Processing_main.cc)
-
-target_link_libraries (CN_Processing
-                       cnproc
-                      )
-
-SET (CMAKE_ASM-BGP_LINK_EXECUTABLE "${ASM-BGP} <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
-
-set_target_properties(CN_Processing
-                      PROPERTIES LINK_FLAGS "-static -g -O2 -W -Wall -Woverloaded-virtual -Wno-unknown-pragmas -B/bgsys/drivers/ppcfloor/gnu-linux/powerpc-bgp-linux/bin"
-                                 LINKER_LANGUAGE ASM-BGP
-)
-
-#set_target_properties(CN_Processing
-#                      LINK_SEARCH_END_STATIC TRUE
-#)
-
-#set_target_properties(CN_Processing
-#                      LINK_TYPE STATIC
-#)
-
-## ------------------------------------------------------------------------------
-## Installation
-
-install (
-  TARGETS cnproc CN_Processing
-  LIBRARY DESTINATION lib
-  ARCHIVE DESTINATION lib
-  RUNTIME DESTINATION bin
-  )
diff --git a/RTCP/CNProc/src/FIR.cc b/RTCP/CNProc/src/FIR.cc
index 0018a33bc21..a67d16e46f4 100644
--- a/RTCP/CNProc/src/FIR.cc
+++ b/RTCP/CNProc/src/FIR.cc
@@ -2,6 +2,7 @@
 #include <lofar_config.h>
 
 #include <FIR.h>
+#include <cstring>
 
 #include <math.h>
 #include <iostream>
diff --git a/RTCP/FCNP/CMakeLists.txt b/RTCP/FCNP/CMakeLists.txt
index b005044bd70..3cf091d6c9c 100644
--- a/RTCP/FCNP/CMakeLists.txt
+++ b/RTCP/FCNP/CMakeLists.txt
@@ -1,27 +1,51 @@
-## ------------------------------------------------------------------------------
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
 ## Project characteristics
-
-project (FCNP)
-
-cmake_minimum_required (VERSION 2.6)
-
-## ------------------------------------------------------------------------------
-## Enable test?
-
-option (FCNP_ENABLE_TESTING "Enable building and executing test programs?" NO  )
-
-## ------------------------------------------------------------------------------
-## Directories to be included in the build
-
-include_directories (${FCNP_BINARY_DIR}/include)
-
-configure_file(${CMAKE_SOURCE_DIR}/config.h.cmake
-               ${FCNP_BINARY_DIR}/include/config.h)
-configure_file(${FCNP_SOURCE_DIR}/lofar_config.h.cmake
-               ${FCNP_BINARY_DIR}/include/lofar_config.h)
-	       
-add_subdirectory (src)
-
-if (FCNP_ENABLE_TESTING)
-  add_subdirectory (test)
-endif (FCNP_ENABLE_TESTING)  
+## ---------------------------------------------------------------------------
+project(FCNP)
+include(LofarGeneral)
+
+include(LofarAddPackage)
+lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS Common)
+
+## ---------------------------------------------------------------------------
+## External packages
+## ---------------------------------------------------------------------------
+include(LofarFindPackage)
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(src)
+add_subdirectory(test)
diff --git a/RTCP/FCNP/src/CMakeLists.txt b/RTCP/FCNP/src/CMakeLists.txt
index 7cc2853a5b6..b6f986a7a3e 100644
--- a/RTCP/FCNP/src/CMakeLists.txt
+++ b/RTCP/FCNP/src/CMakeLists.txt
@@ -1,31 +1,33 @@
-find_path (HAVE_LINK_FCNP FCNP ${CMAKE_CURRENT_SOURCE_DIR})
-if (HAVE_LINK_FCNP)
-  set (HAVE_LINK_FCNP TRUE CACHE BOOL "Have link FCNP?" FORCE)
-  execute_process(COMMAND rm -rf ${CMAKE_CURRENT_SOURCE_DIR}/FCNP )
-endif (HAVE_LINK_FCNP)
+#  $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
 
-execute_process(COMMAND ln -s ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/FCNP )
+include(LofarPackageVersion)
 
-## ------------------------------------------------------------------------------
-## Build the library
+# Create symbolic link to include directory.
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_BINARY_DIR}/include/${PROJECT_NAME})
 
-file (GLOB libfcnp_ion_SOURCES fcnp_ion.cc)
-add_library (fcnp_ion ${libfcnp_ion_SOURCES})
+# Add libraries
+lofar_add_library(fcnp_cn Package__Version.cc fcnp_cn.cc)
+lofar_add_library(libfcnp_ion Package__Version.cc fcnp_ion.cc)
 
-file (GLOB libfcnp_cn_SOURCES fcnp_cn.cc)
-add_library (fcnp_cn ${libfcnp_cn_SOURCES})
-
-## ------------------------------------------------------------------------------
-## Installation
-
-install (
-  TARGETS fcnp_ion
-  LIBRARY DESTINATION lib
-  ARCHIVE DESTINATION lib
-  )
-
-install (
-  TARGETS fcnp_cn
-  LIBRARY DESTINATION lib
-  ARCHIVE DESTINATION lib
-  )
+# Add executable
+lofar_add_executable(versionfcnp versionfcnp.cc)
diff --git a/RTCP/Interface/CMakeLists.txt b/RTCP/Interface/CMakeLists.txt
index 5b671efd333..08dc9170e47 100644
--- a/RTCP/Interface/CMakeLists.txt
+++ b/RTCP/Interface/CMakeLists.txt
@@ -1,28 +1,53 @@
-## ------------------------------------------------------------------------------
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
 ## Project characteristics
-
-project (Interface)
-
-cmake_minimum_required (VERSION 2.6)
-
-## ------------------------------------------------------------------------------
-## Enable test?
-
-option (INTERFACE_ENABLE_TESTING "Enable building and executing test programs?" NO  )
-
-## ------------------------------------------------------------------------------
-## Directories to be included in the build
-
-include_directories (${Interface_BINARY_DIR}/include)
-
-configure_file(${CMAKE_SOURCE_DIR}/config.h.cmake
-               ${Interface_BINARY_DIR}/include/config.h)
-configure_file(${Interface_SOURCE_DIR}/lofar_config.h.cmake
-               ${Interface_BINARY_DIR}/include/lofar_config.h)
-	       
-add_subdirectory (include)
-add_subdirectory (src)
-
-if (INTERFACE_ENABLE_TESTING)
-  add_subdirectory (test)
-endif (INTERFACE_ENABLE_TESTING)  
+## ---------------------------------------------------------------------------
+project(Interface)
+include(LofarGeneral)
+
+include(LofarAddPackage)
+lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS Common Stream ApplCommon)
+
+## ---------------------------------------------------------------------------
+## External packages
+## ---------------------------------------------------------------------------
+include(LofarFindPackage)
+lofar_find_package(Boost COMPONENTS date_time REQUIRED)
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(include/Interface)
+add_subdirectory(src)
+add_subdirectory(test)
diff --git a/RTCP/Interface/include/Interface/CMakeLists.txt b/RTCP/Interface/include/Interface/CMakeLists.txt
index 102832e8aed..75e2f833c32 100644
--- a/RTCP/Interface/include/Interface/CMakeLists.txt
+++ b/RTCP/Interface/include/Interface/CMakeLists.txt
@@ -1,32 +1,34 @@
-## ------------------------------------------------------------------------------
-## Include files
+# List of header files that will be installed.
+set(inst_HEADERS
+  Package__Version.h
+  Align.h
+  AlignedStdAllocator.h
+  Allocator.h
+  CN_Command.h
+  CN_Configuration.h
+  CN_Mapping.h
+  CN_Mode.h
+  CorrelatedData.h
+  Config.h
+  DataHolder.h
+  FilteredData.h
+  MultiDimArray.h
+  Parset.h
+  SubbandMetaData.h
+  PrintVector.h
+  Queue.h
+  RSPTimeStamp.h
+  SparseSet.h
+  Exceptions.h
+  StreamableData.h
+  PencilBeamData.h
+  StokesData.h)
 
-file (GLOB libinterface_HEADERS Align.h
-				AlignedStdAllocator.h
-				Allocator.h
-				CN_Command.h
-				CN_Configuration.h
-				CN_Mapping.h
-				CN_Mode.h
-				CorrelatedData.h
-				Config.h
-				FilteredData.h
-				MultiDimArray.h
-				Parset.h
-				SubbandMetaData.h
-				PrintVector.h
-				Queue.h
-				RSPTimeStamp.h
-				SparseSet.h
-				Exceptions.h
-				StreamableData.h
-				PencilBeamData.h
-                		StokesData.h
-                		PipelineOutput.h)
-   
-## ------------------------------------------------------------------------------
-## Installation
+# Create symbolic link to include directory.
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink 
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_BINARY_DIR}/include/${PROJECT_NAME})
+
+# Install header files.
+install(FILES ${inst_HEADERS} DESTINATION include/${PROJECT_NAME})
 
-install (FILES ${libinterface_HEADERS}
-  DESTINATION include/Interface
-  )
diff --git a/RTCP/Interface/src/CMakeLists.txt b/RTCP/Interface/src/CMakeLists.txt
index b57c6d0f6c7..e5a28a4573a 100644
--- a/RTCP/Interface/src/CMakeLists.txt
+++ b/RTCP/Interface/src/CMakeLists.txt
@@ -1,20 +1,35 @@
-## ------------------------------------------------------------------------------
-## Build the library
+#  $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
 
-file (GLOB libinterface_SOURCES Allocator.cc
-				CN_Configuration.cc
-				CN_Mapping.cc
-				Parset.cc
-				RSPTimeStamp.cc
-				CN_Mode.cc)
+include(LofarPackageVersion)
 
-add_library (interface ${libinterface_SOURCES})
+set(interface_LIB_SRCS
+  Package__Version.cc
+  Allocator.cc
+  CN_Configuration.cc
+  CN_Mapping.cc
+  Parset.cc
+  RSPTimeStamp.cc
+  DataHolder.cc
+  CN_Mode.cc)
 
-## ------------------------------------------------------------------------------
-## Installation
+lofar_add_library(interface ${interface_LIB_SRCS})
 
-install (
-  TARGETS interface
-  LIBRARY DESTINATION lib
-  ARCHIVE DESTINATION lib
-  )
+lofar_add_executable(versioninterface versioninterface.cc)
diff --git a/RTCP/Interface/test/CMakeLists.txt b/RTCP/Interface/test/CMakeLists.txt
index 9064e0326fd..9f6d1a20db7 100644
--- a/RTCP/Interface/test/CMakeLists.txt
+++ b/RTCP/Interface/test/CMakeLists.txt
@@ -1,48 +1,24 @@
-cmake_minimum_required (VERSION 2.6)
-
-include(LOFARTest)
-include_directories ( ${LOFAR_SOURCE_DIR}/RTCP/Interface/test )
-
-add_definitions (-DHAVE_PKVERSION)
-
-## ------------------------------------------------------------------------------
-## Sourses
-
-file (GLOB tSparseSet_SRCS         tSparseSet.cc )
-file (GLOB tRSPTimeStamp_SRCS      tRSPTimeStamp.cc )
-
-## --- Macro(s) -------------------------------------
-
-MACRO (TARGETLINKLIBRARIES_INTERFACE_TEST _PROG)
-  target_link_libraries (${_PROG} 
-                         interface
-			 common
-			 ${BACKTRACE_LIBRARIES}
-			 ${LOG4CPLUS_LIBRARIES}
-			 ${SHMEM_LIBRARIES} )
-ENDMACRO (TARGETLINKLIBRARIES_INTERFACE_TEST)
-
-
-## --- Programs to be built -------------------------
-
-set (CHECKPROGS
-     tSparseSet
-     tRSPTimeStamp
-)
-
-foreach (prog ${CHECKPROGS})
-  add_executable (${prog} ${${prog}_SRCS})
-  TARGETLINKLIBRARIES_INTERFACE_TEST (${prog})
-endforeach (prog ${CHECKPROGS})
-
-## --- Programs to be run ---------------------------
-
-set (CHECKTOOLPROGS
-     tSparseSet
-     tRSPTimeStamp
-)
-
-foreach (prog ${CHECKTOOLPROGS})
-  add_test(${prog} ${prog}) 
-  set (TEST_PROGRAMS "${TEST_PROGRAMS};${prog}" CACHE STRING "Test programs" FORCE)
-endforeach (prog ${CHECKTOOLPROGS})
+#  $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
+
+include(LofarCTest)
+
+lofar_add_test(tSparseSet tSparseSet.cc)
+lofar_add_test(tRSPTimeStamp tRSPTimeStamp.cc)
diff --git a/RTCP/Interface/test/tRSPTimeStamp.sh b/RTCP/Interface/test/tRSPTimeStamp.sh
new file mode 100755
index 00000000000..b266ab349cc
--- /dev/null
+++ b/RTCP/Interface/test/tRSPTimeStamp.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+./runctest.sh tRSPTimeStamp 2>&1 > tRSPTimeStamp.log
diff --git a/RTCP/Interface/test/tSparseSet.sh b/RTCP/Interface/test/tSparseSet.sh
new file mode 100755
index 00000000000..351dfc993f0
--- /dev/null
+++ b/RTCP/Interface/test/tSparseSet.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+./runctest.sh tSparseSet 2>&1 > tSparseSet.log
diff --git a/RTCP/RTCPTools/CMakeLists.txt b/RTCP/RTCPTools/CMakeLists.txt
new file mode 100644
index 00000000000..98ca0915177
--- /dev/null
+++ b/RTCP/RTCPTools/CMakeLists.txt
@@ -0,0 +1,40 @@
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
+## Project characteristics
+## ---------------------------------------------------------------------------
+project(RTCPTools)
+include(LofarGeneral)
+
+include(LofarAddPackage)
+lofar_add_package(${PROJECT_NAME} 1.0)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(src)
diff --git a/RTCP/RTCPTools/src/CMakeLists.txt b/RTCP/RTCPTools/src/CMakeLists.txt
new file mode 100644
index 00000000000..6f791dba42d
--- /dev/null
+++ b/RTCP/RTCPTools/src/CMakeLists.txt
@@ -0,0 +1,26 @@
+#  $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
+
+find_library(M_LIBRARY m)
+
+add_executable(generator generator.c)
+target_link_libraries(generator ${M_LIBRARY})
+
+add_executable(udp-copy udp-copy.c)
diff --git a/RTCP/Storage/CMakeLists.txt b/RTCP/Storage/CMakeLists.txt
index 933b2ccd774..338206642a1 100644
--- a/RTCP/Storage/CMakeLists.txt
+++ b/RTCP/Storage/CMakeLists.txt
@@ -1,28 +1,53 @@
-## ------------------------------------------------------------------------------
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
 ## Project characteristics
-
-project (Storage)
-
-cmake_minimum_required (VERSION 2.6)
-
-## ------------------------------------------------------------------------------
-## Enable test?
-
-option (STORAGE_ENABLE_TESTING "Enable building and executing test programs?" YES  )
-
-## ------------------------------------------------------------------------------
-## Directories to be included in the build
-
-include_directories (${Storage_BINARY_DIR}/include)
-
-configure_file(${CMAKE_SOURCE_DIR}/config.h.cmake
-               ${Storage_BINARY_DIR}/include/config.h)
-configure_file(${Storage_SOURCE_DIR}/lofar_config.h.cmake
-               ${Storage_BINARY_DIR}/include/lofar_config.h)
-	       
-add_subdirectory (include)
-add_subdirectory (src)
-
-if (STORAGE_ENABLE_TESTING)
-  add_subdirectory (test)
-endif (STORAGE_ENABLE_TESTING)  
+## ---------------------------------------------------------------------------
+project(Storage)
+include(LofarGeneral)
+
+include(LofarAddPackage)
+lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS Common AMCBase Interface)
+
+## ---------------------------------------------------------------------------
+## External packages
+## ---------------------------------------------------------------------------
+include(LofarFindPackage)
+lofar_find_package(Casacore COMPONENTS casa measures ms tables REQUIRED)
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(include/Storage)
+add_subdirectory(src)
+add_subdirectory(test)
diff --git a/RTCP/Storage/include/Storage/CMakeLists.txt b/RTCP/Storage/include/Storage/CMakeLists.txt
index 5373f273ed4..b2e0cdba212 100644
--- a/RTCP/Storage/include/Storage/CMakeLists.txt
+++ b/RTCP/Storage/include/Storage/CMakeLists.txt
@@ -1,16 +1,12 @@
-## ------------------------------------------------------------------------------
-## Include files
+# List of header files that will be installed.
+set(inst_HEADERS
+  Package__Version.h)
 
-file (GLOB libstorage_HEADERS InputThread.h
-			      SubbandWriter.h
-			      MSWriter.h
-			      MSWriterCasa.h
-			      MSWriterNull.h
-			      MSWriterFile.h)
-   
-## ------------------------------------------------------------------------------
-## Installation
+# Create symbolic link to include directory.
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink 
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_BINARY_DIR}/include/${PROJECT_NAME})
+
+# Install header files.
+install(FILES ${inst_HEADERS} DESTINATION include/${PROJECT_NAME})
 
-install (FILES ${libstorage_HEADERS}
-  DESTINATION include/Storage
-  )
diff --git a/RTCP/Storage/src/CMakeLists.txt b/RTCP/Storage/src/CMakeLists.txt
index 457da3dbda6..9092b93c787 100644
--- a/RTCP/Storage/src/CMakeLists.txt
+++ b/RTCP/Storage/src/CMakeLists.txt
@@ -1,43 +1,35 @@
-## ------------------------------------------------------------------------------
-## Build the library
-
-file (GLOB libstorage_SOURCES InputThread.cc
-			      SubbandWriter.cc
-			      MSWriter.cc
-			      MSWriterCasa.cc
-			      MSWriterNull.cc
-			      MSWriterFile.cc)
-
-
-add_library (storage ${libstorage_SOURCES})
-
-## linker instructions
-target_link_libraries (  storage 
-                         interface
-                         stream
-			 amcbase
-			 applcommon
-                         common
-			 ${Boost_LIBRARIES}
-			 ${CASA_LIBRARIES}
-			 ${LOG4CPLUS_LIBRARIES}
-			 ${BACKTRACE_LIBRARIES}
-			 ${SHMEM_LIBRARIES}
-			 )
-
-
-add_executable(Storage Storage_main.cc)
-
-target_link_libraries (Storage
-                       storage
-		      )
-
-## ------------------------------------------------------------------------------
-## Installation
-
-install (
-  TARGETS storage
-  LIBRARY DESTINATION lib
-  ARCHIVE DESTINATION lib
-  RUNTIME DESTINATION bin
-  )
+#  $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
+
+include(LofarPackageVersion)
+
+set(storage_LIB_SRCS
+  Package__Version.cc
+  InputThread.cc
+  SubbandWriter.cc
+  MSWriter.cc
+  MSWriterCasa.cc
+  MSWriterNull.cc
+  MSWriterFile.cc)
+
+lofar_add_library(storage ${storage_LIB_SRCS})
+
+lofar_add_executable(Storage_main Storage_main.cc)
+lofar_add_executable(versionstorage versionstorage.cc)
diff --git a/RTCP/Storage/test/CMakeLists.txt b/RTCP/Storage/test/CMakeLists.txt
new file mode 100644
index 00000000000..e1e03302978
--- /dev/null
+++ b/RTCP/Storage/test/CMakeLists.txt
@@ -0,0 +1,23 @@
+#  $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
+
+include(LofarCTest)
+
+lofar_add_test(tAH_TestStorage tAH_TestStorage.cc AH_TestStorage.cc)
diff --git a/RTCP/Storage/test/tAH_TestStorage.sh b/RTCP/Storage/test/tAH_TestStorage.sh
new file mode 100755
index 00000000000..d367ccfd196
--- /dev/null
+++ b/RTCP/Storage/test/tAH_TestStorage.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+./runctest.sh tAH_TestStorage RTCP.parset 2>&1 > tAH_TestStorage.log
diff --git a/SAS/CMakeLists.txt b/SAS/CMakeLists.txt
new file mode 100644
index 00000000000..86cfa2abdda
--- /dev/null
+++ b/SAS/CMakeLists.txt
@@ -0,0 +1,44 @@
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
+## Project characteristics
+## ---------------------------------------------------------------------------
+project(SAS)
+include(LofarGeneral)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(OTDB)
+add_subdirectory(OTB)
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
+
diff --git a/SAS/OTB/CMakeLists.txt b/SAS/OTB/CMakeLists.txt
new file mode 100644
index 00000000000..9a4d5442d32
--- /dev/null
+++ b/SAS/OTB/CMakeLists.txt
@@ -0,0 +1,44 @@
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
+## Project characteristics
+## ---------------------------------------------------------------------------
+project(OTB)
+include(LofarGeneral)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(jOTDB2)
+add_subdirectory(OTB)
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
+
diff --git a/SAS/OTB/jOTDB2/CMakeLists.txt b/SAS/OTB/jOTDB2/CMakeLists.txt
new file mode 100644
index 00000000000..1287947441d
--- /dev/null
+++ b/SAS/OTB/jOTDB2/CMakeLists.txt
@@ -0,0 +1,54 @@
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
+## Project characteristics
+## ---------------------------------------------------------------------------
+project(jOTDB2)
+include(LofarGeneral)
+
+include(LofarAddPackage)
+lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS Common OTDB)
+
+## ---------------------------------------------------------------------------
+## External packages
+## ---------------------------------------------------------------------------
+include(LofarFindPackage)
+lofar_find_package(Boost REQUIRED COMPONENTS date_time)
+lofar_find_package(PQXX REQUIRED)
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(include/jOTDB2)
+add_subdirectory(src)
+#add_subdirectory(test)
diff --git a/SAS/OTB/jOTDB2/include/jOTDB2/CMakeLists.txt b/SAS/OTB/jOTDB2/include/jOTDB2/CMakeLists.txt
new file mode 100644
index 00000000000..e17d26a3b60
--- /dev/null
+++ b/SAS/OTB/jOTDB2/include/jOTDB2/CMakeLists.txt
@@ -0,0 +1,40 @@
+#  $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
+
+# List of header files that will be installed.
+set(inst_HEADERS
+  nl_astron_lofar_sas_otb_jotdb2_jClassifConv.h
+  nl_astron_lofar_sas_otb_jotdb2_jCommon.h
+  nl_astron_lofar_sas_otb_jotdb2_jInitCPPLogger.h
+  nl_astron_lofar_sas_otb_jotdb2_jOTDBconnection.h
+  nl_astron_lofar_sas_otb_jotdb2_jParamTypeConv.h
+  nl_astron_lofar_sas_otb_jotdb2_jTreeMaintenance.h
+  nl_astron_lofar_sas_otb_jotdb2_jTreeStateConv.h
+  nl_astron_lofar_sas_otb_jotdb2_jTreeTypeConv.h
+  nl_astron_lofar_sas_otb_jotdb2_jTreeValue.h
+  nl_astron_lofar_sas_otb_jotdb2_jUnitConv.h)
+
+# Create symbolic link to include directory.
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink 
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_BINARY_DIR}/include/${PROJECT_NAME})
+
+# Install header files.
+install(FILES ${inst_HEADERS} DESTINATION include/${PROJECT_NAME})
diff --git a/SAS/OTB/jOTDB2/src/CMakeLists.txt b/SAS/OTB/jOTDB2/src/CMakeLists.txt
new file mode 100644
index 00000000000..f0d3583129b
--- /dev/null
+++ b/SAS/OTB/jOTDB2/src/CMakeLists.txt
@@ -0,0 +1,41 @@
+#  $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
+
+include(LofarPackageVersion)
+
+set(jotdb2_LIB_SRCS
+  Package__Version.cc
+  nl_astron_lofar_sas_otb_jotdb2_jCommon.cc
+  nl_astron_lofar_sas_otb_jotdb2_jOTDBconnection.cc
+  nl_astron_lofar_sas_otb_jotdb2_jTreeMaintenance.cc
+  nl_astron_lofar_sas_otb_jotdb2_jClassifConv.cc
+  nl_astron_lofar_sas_otb_jotdb2_jParamTypeConv.cc
+  nl_astron_lofar_sas_otb_jotdb2_jTreeStateConv.cc
+  nl_astron_lofar_sas_otb_jotdb2_jTreeTypeConv.cc
+  nl_astron_lofar_sas_otb_jotdb2_jUnitConv.cc
+  nl_astron_lofar_sas_otb_jotdb2_jInitCPPLogger.cc
+  nl_astron_lofar_sas_otb_jotdb2_jTreeValue.cc)
+
+lofar_add_library(jotdb2 ${jotdb2_LIB_SRCS})
+
+add_executable(versionjotdb2 versionjotdb2.cc)
+target_link_libraries(versionjotdb2 jotdb2 ${LOFAR_LIBRARIES})
+install(TARGETS versionjotdb2 DESTINATION bin)
+
diff --git a/SAS/OTDB/CMakeLists.txt b/SAS/OTDB/CMakeLists.txt
new file mode 100644
index 00000000000..37fbb8b4f72
--- /dev/null
+++ b/SAS/OTDB/CMakeLists.txt
@@ -0,0 +1,54 @@
+#  $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
+
+cmake_minimum_required(VERSION 2.6)
+
+## ---------------------------------------------------------------------------
+## Preamble: set compilers
+## ---------------------------------------------------------------------------
+include(LofarInit)
+
+## ---------------------------------------------------------------------------
+## Project characteristics
+## ---------------------------------------------------------------------------
+project(OTDB)
+include(LofarGeneral)
+
+include(LofarAddPackage)
+lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS Common)
+
+## ---------------------------------------------------------------------------
+## External packages
+## ---------------------------------------------------------------------------
+include(LofarFindPackage)
+lofar_find_package(Boost REQUIRED COMPONENTS date_time)
+lofar_find_package(PQXX REQUIRED)
+
+## ---------------------------------------------------------------------------
+## Generate configuration header file.
+## ---------------------------------------------------------------------------
+include(LofarConfig)
+
+## ---------------------------------------------------------------------------
+## Subdirectories
+## ---------------------------------------------------------------------------
+add_subdirectory(include/OTDB)
+add_subdirectory(src)
+add_subdirectory(test)
diff --git a/SAS/OTDB/include/OTDB/CMakeLists.txt b/SAS/OTDB/include/OTDB/CMakeLists.txt
new file mode 100644
index 00000000000..4682e330f3c
--- /dev/null
+++ b/SAS/OTDB/include/OTDB/CMakeLists.txt
@@ -0,0 +1,49 @@
+#  $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
+
+# List of header files that will be installed.
+set(inst_HEADERS
+  Package__Version.h
+  Converter.h
+  ClassifConv.h
+  ParamTypeConv.h
+  TreeStateConv.h
+  TreeTypeConv.h
+  UnitConv.h
+  OTDBnode.h
+  OTDBparam.h
+  OTDBtree.h
+  OTDBtypes.h
+  OTDBvalue.h
+  TreeState.h
+  VICnodeDef.h
+  OTDBconstants.h
+  misc.h
+  OTDBconnection.h
+  TreeMaintenance.h
+  TreeValue.h)
+
+# Create symbolic link to include directory.
+execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink 
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  ${CMAKE_BINARY_DIR}/include/${PROJECT_NAME})
+
+# Install header files.
+install(FILES ${inst_HEADERS} DESTINATION include/${PROJECT_NAME})
diff --git a/SAS/OTDB/src/CMakeLists.txt b/SAS/OTDB/src/CMakeLists.txt
new file mode 100644
index 00000000000..a866b74c97b
--- /dev/null
+++ b/SAS/OTDB/src/CMakeLists.txt
@@ -0,0 +1,41 @@
+#  $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
+
+include(LofarPackageVersion)
+
+set(otdb_LIB_SRCS
+  Package__Version.cc
+  OTDBconnection.cc
+  misc.cc
+  OTDBtree.cc
+  OTDBnode.cc
+  OTDBvalue.cc
+  OTDBparam.cc
+  VICnodeDef.cc
+  Converter.cc
+  wSpaceSplit.cc
+  TreeMaintenance.cc
+  TreeState.cc
+  TreeValue.cc
+  loadCompFile.cc)
+
+lofar_add_library(otdb ${otdb_LIB_SRCS})
+
+lofar_add_executable(versionotdb versionotdb.cc)
diff --git a/SAS/OTDB/test/CMakeLists.txt b/SAS/OTDB/test/CMakeLists.txt
new file mode 100644
index 00000000000..154e7b81057
--- /dev/null
+++ b/SAS/OTDB/test/CMakeLists.txt
@@ -0,0 +1,30 @@
+#  $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
+
+include(LofarCTest)
+
+lofar_add_test(tPICtree tPICtree.cc)
+lofar_add_test(tPICvalue tPICvalue.cc)
+lofar_add_test(tVICcomp tVICcomp.cc)
+lofar_add_test(tVTtree tVTtree.cc)
+lofar_add_test(tVHtree tVHtree.cc)
+lofar_add_test(tVHvalue tVHvalue.cc)
+lofar_add_test(tConnection tConnection.cc)
+lofar_add_test(tParamTypeConv tParamTypeConv.cc)
diff --git a/SAS/OTDB/test/tConnection_test.sh b/SAS/OTDB/test/tConnection.sh
similarity index 100%
rename from SAS/OTDB/test/tConnection_test.sh
rename to SAS/OTDB/test/tConnection.sh
diff --git a/SAS/OTDB/test/tConverter_test.sh b/SAS/OTDB/test/tConverter_test.sh
deleted file mode 100755
index 71f431fdef8..00000000000
--- a/SAS/OTDB/test/tConverter_test.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-# do a hard copy until a variable is available
-cp ../../../test/DATABASENAME .
-./runctest.sh tConverter 2>&1 > tConverter.log
-rm -f DATABASENAME
diff --git a/SAS/OTDB/test/tPICtree_test.sh b/SAS/OTDB/test/tPICtree.sh
similarity index 100%
rename from SAS/OTDB/test/tPICtree_test.sh
rename to SAS/OTDB/test/tPICtree.sh
diff --git a/SAS/OTDB/test/tPICvalue_test.sh b/SAS/OTDB/test/tPICvalue.sh
similarity index 100%
rename from SAS/OTDB/test/tPICvalue_test.sh
rename to SAS/OTDB/test/tPICvalue.sh
diff --git a/SAS/OTDB/test/tConverter.cc b/SAS/OTDB/test/tParamTypeConv.cc
similarity index 98%
rename from SAS/OTDB/test/tConverter.cc
rename to SAS/OTDB/test/tParamTypeConv.cc
index 28d204a6340..e654a73b9c3 100644
--- a/SAS/OTDB/test/tConverter.cc
+++ b/SAS/OTDB/test/tParamTypeConv.cc
@@ -29,7 +29,6 @@
 #include <Common/lofar_datetime.h>
 #include <OTDB/OTDBconnection.h>
 #include <OTDB/ParamTypeConv.h>
-#include <libgen.h>             // for basename
 
 using namespace LOFAR;
 using namespace LOFAR::OTDB;
diff --git a/SAS/OTDB/test/tConverter.log_prop b/SAS/OTDB/test/tParamTypeConv.log_prop
similarity index 100%
rename from SAS/OTDB/test/tConverter.log_prop
rename to SAS/OTDB/test/tParamTypeConv.log_prop
diff --git a/SAS/OTDB/test/tParamTypeConv.sh b/SAS/OTDB/test/tParamTypeConv.sh
new file mode 100755
index 00000000000..d8cd5836789
--- /dev/null
+++ b/SAS/OTDB/test/tParamTypeConv.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+# do a hard copy until a variable is available
+cp $srcdir/DATABASENAME .
+./runctest.sh tParamTypeConv 2>&1 > tParamTypeConv.log
+rm -f DATABASENAME
diff --git a/SAS/OTDB/test/tVHtree_test.sh b/SAS/OTDB/test/tVHtree.sh
similarity index 100%
rename from SAS/OTDB/test/tVHtree_test.sh
rename to SAS/OTDB/test/tVHtree.sh
diff --git a/SAS/OTDB/test/tVHvalue_test.sh b/SAS/OTDB/test/tVHvalue.sh
similarity index 100%
rename from SAS/OTDB/test/tVHvalue_test.sh
rename to SAS/OTDB/test/tVHvalue.sh
diff --git a/SAS/OTDB/test/tVICcomp_test.sh b/SAS/OTDB/test/tVICcomp.sh
similarity index 100%
rename from SAS/OTDB/test/tVICcomp_test.sh
rename to SAS/OTDB/test/tVICcomp.sh
diff --git a/SAS/OTDB/test/tVTtree_test.sh b/SAS/OTDB/test/tVTtree.sh
similarity index 100%
rename from SAS/OTDB/test/tVTtree_test.sh
rename to SAS/OTDB/test/tVTtree.sh
diff --git a/autoconf_share/runctest.sh b/autoconf_share/runctest.sh
new file mode 100755
index 00000000000..4a2933e696a
--- /dev/null
+++ b/autoconf_share/runctest.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+# runctest.sh: CTest wrapper script for runtest.sh
+#
+#  Copyright (C) 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
+#
+#  $Id$
+
+export lofar_sharedir=${lofar_sharedir}
+export srcdir=${srcdir}
+
+$lofar_sharedir/runtest.sh "$@"
+
+# The Autotools use the magic return value 77 for skipped tests. CMake can
+# only handle zero and non-zero return values. To avoid that CMake will flag a
+# skipped test as failed, we will silently change the return value 77 to 0.
+STATUS=$?
+if [ $STATUS -eq 77 ]; then
+  STATUS=0
+fi
+exit $STATUS
diff --git a/cmake/modules/CMakeASM-BGPInformation.cmake b/cmake/modules/CMakeASM-BGPInformation.cmake
deleted file mode 100644
index 1c507d9f785..00000000000
--- a/cmake/modules/CMakeASM-BGPInformation.cmake
+++ /dev/null
@@ -1,5 +0,0 @@
-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
deleted file mode 100644
index 56e33d1d82a..00000000000
--- a/cmake/modules/CMakeDetermineASM-BGPCompiler.cmake
+++ /dev/null
@@ -1,6 +0,0 @@
-# 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
deleted file mode 100644
index dddcc9ae9ac..00000000000
--- a/cmake/modules/CMakeLists.txt
+++ /dev/null
@@ -1,49 +0,0 @@
-##------------------------------------------------------------------------------
-## $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
deleted file mode 100644
index e1bbf78dd80..00000000000
--- a/cmake/modules/CMakeSettings.cmake
+++ /dev/null
@@ -1,154 +0,0 @@
-
-## -----------------------------------------------------------------------------
-## $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
deleted file mode 100644
index fb53a8390ad..00000000000
--- a/cmake/modules/CMakeTestASM-BGPCompiler.cmake
+++ /dev/null
@@ -1,9 +0,0 @@
-
-# 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
deleted file mode 100644
index bc410754e97..00000000000
--- a/cmake/modules/FindBacktrace.cmake
+++ /dev/null
@@ -1,174 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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)
-  
-  SET (Bactrace_LIB_PREFIX "lib")
-  find_library (HAVE_LIBZ ${Bactrace_LIB_PREFIX}z.a
-    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
deleted file mode 100644
index 9d4799a0e2b..00000000000
--- a/cmake/modules/FindBlitz.cmake
+++ /dev/null
@@ -1,95 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index 448707cddeb..00000000000
--- a/cmake/modules/FindBoost.cmake
+++ /dev/null
@@ -1,635 +0,0 @@
-# - 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
deleted file mode 100644
index 00f9303025b..00000000000
--- a/cmake/modules/FindCASA.cmake
+++ /dev/null
@@ -1,557 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index ab792d625e8..00000000000
--- a/cmake/modules/FindCASACORE.cmake
+++ /dev/null
@@ -1,291 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index 52826d944b4..00000000000
--- a/cmake/modules/FindCFITSIO.cmake
+++ /dev/null
@@ -1,135 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index 3073d1bd01a..00000000000
--- a/cmake/modules/FindCPGPLOT.cmake
+++ /dev/null
@@ -1,79 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index 22847e53d7d..00000000000
--- a/cmake/modules/FindDAL.cmake
+++ /dev/null
@@ -1,90 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index f368ce16d85..00000000000
--- a/cmake/modules/FindFFTW3.cmake
+++ /dev/null
@@ -1,86 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index a5686888f7f..00000000000
--- a/cmake/modules/FindG2C.cmake
+++ /dev/null
@@ -1,117 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index 54afe92f6e5..00000000000
--- a/cmake/modules/FindGIF.cmake
+++ /dev/null
@@ -1,88 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index 09d1b5c8d65..00000000000
--- a/cmake/modules/FindGLIB.cmake
+++ /dev/null
@@ -1,123 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index 2a894e2a09c..00000000000
--- a/cmake/modules/FindGSL.cmake
+++ /dev/null
@@ -1,109 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index 91b808e69f5..00000000000
--- a/cmake/modules/FindGTK.cmake
+++ /dev/null
@@ -1,141 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index 4f3e0713796..00000000000
--- a/cmake/modules/FindGlish.cmake
+++ /dev/null
@@ -1,176 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index 644c17c3542..00000000000
--- a/cmake/modules/FindGlobus.cmake
+++ /dev/null
@@ -1,79 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index 72db8ddda32..00000000000
--- a/cmake/modules/FindHDF5.cmake
+++ /dev/null
@@ -1,153 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index c53560417e3..00000000000
--- a/cmake/modules/FindLAPACK.cmake
+++ /dev/null
@@ -1,106 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index 0062aa8b388..00000000000
--- a/cmake/modules/FindLibxml2.cmake
+++ /dev/null
@@ -1,88 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index 086918d46aa..00000000000
--- a/cmake/modules/FindLog4CPlus.cmake
+++ /dev/null
@@ -1,91 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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/FindMPICC.cmake b/cmake/modules/FindMPICC.cmake
deleted file mode 100644
index 8c5e4f751a9..00000000000
--- a/cmake/modules/FindMPICC.cmake
+++ /dev/null
@@ -1,316 +0,0 @@
-# - 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
deleted file mode 100644
index 21283cbca1e..00000000000
--- a/cmake/modules/FindMatlab.cmake
+++ /dev/null
@@ -1,89 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index 702319decc0..00000000000
--- a/cmake/modules/FindMySQL.cmake
+++ /dev/null
@@ -1,102 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index 1247df2f328..00000000000
--- a/cmake/modules/FindNumarray.cmake
+++ /dev/null
@@ -1,103 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index f2cc61887ec..00000000000
--- a/cmake/modules/FindNumeric.cmake
+++ /dev/null
@@ -1,104 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index 8e79c629191..00000000000
--- a/cmake/modules/FindPGPLOT.cmake
+++ /dev/null
@@ -1,128 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index fe5f5e29e60..00000000000
--- a/cmake/modules/FindPLplot.cmake
+++ /dev/null
@@ -1,109 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index 0617f892b89..00000000000
--- a/cmake/modules/FindPNG.cmake
+++ /dev/null
@@ -1,88 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index df40634af5a..00000000000
--- a/cmake/modules/FindPOPT.cmake
+++ /dev/null
@@ -1,77 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index e7127c5759a..00000000000
--- a/cmake/modules/FindPostgreSQL.cmake
+++ /dev/null
@@ -1,163 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index 6d23b51d74e..00000000000
--- a/cmake/modules/FindPyGTK.cmake
+++ /dev/null
@@ -1,114 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index 54c1a155f56..00000000000
--- a/cmake/modules/FindPython.cmake
+++ /dev/null
@@ -1,171 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index 4532651cf40..00000000000
--- a/cmake/modules/FindROOT.cmake
+++ /dev/null
@@ -1,140 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index cdb8105f901..00000000000
--- a/cmake/modules/FindRuby.cmake
+++ /dev/null
@@ -1,97 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index dea7a37d412..00000000000
--- a/cmake/modules/FindSHMEM.cmake
+++ /dev/null
@@ -1,92 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index 3127978bc69..00000000000
--- a/cmake/modules/FindSWIG.cmake
+++ /dev/null
@@ -1,96 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index 539c9709eac..00000000000
--- a/cmake/modules/FindStarTools.cmake
+++ /dev/null
@@ -1,103 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index e3d66efcbd7..00000000000
--- a/cmake/modules/FindTCL.cmake
+++ /dev/null
@@ -1,88 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index 6f2640d2262..00000000000
--- a/cmake/modules/FindTK.cmake
+++ /dev/null
@@ -1,88 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index 5a711e4ac8f..00000000000
--- a/cmake/modules/FindWCS.cmake
+++ /dev/null
@@ -1,88 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index f58379ec569..00000000000
--- a/cmake/modules/FindXaw.cmake
+++ /dev/null
@@ -1,88 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index dc77827d12c..00000000000
--- a/cmake/modules/FindXm.cmake
+++ /dev/null
@@ -1,90 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index e00af0afa11..00000000000
--- a/cmake/modules/InstallROOT.cmake
+++ /dev/null
@@ -1,201 +0,0 @@
-##------------------------------------------------------------------------------
-## $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/LofarGeneral.cmake b/cmake/modules/LofarGeneral.cmake
deleted file mode 100644
index 3c89c325233..00000000000
--- a/cmake/modules/LofarGeneral.cmake
+++ /dev/null
@@ -1,107 +0,0 @@
-## -----------------------------------------------------------------------------
-## 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
deleted file mode 100644
index 0016ef22ee7..00000000000
--- a/cmake/modules/MakePackageVersion.cmake
+++ /dev/null
@@ -1,156 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index 075a0c6deb7..00000000000
--- a/cmake/modules/Package__Version.cc.in
+++ /dev/null
@@ -1,35 +0,0 @@
-//# 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
deleted file mode 100644
index eb560a19d79..00000000000
--- a/cmake/modules/Package__Version.h.in
+++ /dev/null
@@ -1,41 +0,0 @@
-//# 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
deleted file mode 100644
index dc4d900f3bb..00000000000
--- a/cmake/modules/README.txt
+++ /dev/null
@@ -1,142 +0,0 @@
-##------------------------------------------------------------------------
-## $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
deleted file mode 100644
index 1a3138d27e1..00000000000
--- a/cmake/modules/SettingsPLplot.cmake
+++ /dev/null
@@ -1,94 +0,0 @@
-
-## -------------------------------------------------------------------
-## 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
deleted file mode 100644
index faebc39befd..00000000000
--- a/cmake/modules/UpdateCASACORE.cmake
+++ /dev/null
@@ -1,96 +0,0 @@
-##------------------------------------------------------------------------------
-## $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
deleted file mode 100644
index d2b54ac0c82..00000000000
--- a/cmake/modules/changes.txt
+++ /dev/null
@@ -1,75 +0,0 @@
-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/makefile b/cmake/modules/makefile
deleted file mode 100644
index 24704c4dddb..00000000000
--- a/cmake/modules/makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-##------------------------------------------------------------------------
-## $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
deleted file mode 100644
index 882fe3086a4..00000000000
--- a/cmake/modules/template_FindXX.cmake
+++ /dev/null
@@ -1,89 +0,0 @@
-# +-----------------------------------------------------------------------------+
-# | $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
deleted file mode 100644
index ec8c6eeed1e..00000000000
--- a/cmake/variants/variants
+++ /dev/null
@@ -1,43 +0,0 @@
-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 "")
-
-
-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
deleted file mode 100644
index 14249d16374..00000000000
--- a/cmake/variants/variants.bgfen0
+++ /dev/null
@@ -1,44 +0,0 @@
-## GNU-Compiler setting
-SET (ASM-BGP "/bgsys/drivers/ppcfloor/gnu-linux/bin/powerpc-bgp-linux-gcc")
-
-SET(gnubgp_compiler "CC=/usr/bin/gcc;CXX=/usr/bin/g++;CCAS=${ASM-BGP}")
-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 (-DHAVE_BGP_CN)
-add_definitions (-DHAVE_FCNP)
-add_definitions (-DUSE_THREADS)
-add_definitions (-DHAVE_PKVERSION)
-add_definitions (-DWORDS_BIGENDIAN)
-
-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 /bgsys/drivers/ppcfloor/gnu-linux/powerpc-bgp-linux/lib/libstdc++.a -lmpich.cnk -ldcmfcoll.cnk -ldcmf.cnk -lpthread -lrt -lSPI.cna -lm -lrfftw -lfftw -lmass" CACHE STRING "With libs" FORCE)
-  SET ( Boost_USE_STATIC_LIBS TRUE )
-
-  add_definitions (-DHAVE_FFTW2)
-  add_definitions (-DHAVE_MPI)
-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
deleted file mode 100644
index c912086f5fc..00000000000
--- a/cmake/variants/variants.liifen
+++ /dev/null
@@ -1,13 +0,0 @@
-## 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 (HAVE_SHEM TRUE)
-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)
diff --git a/config.h.cmake b/config.h.cmake
index 29a64d513f8..7e6c5886db1 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -115,6 +115,9 @@
 /* Define to the address where bug reports for this package should be sent. */
 #cmakedefine PACKAGE_BUGREPORT 1
 
+/* Define to the full name of this package. */
+#cmakedefine PACKAGE_NAME 1
+
 /* Define to the full name and version of this package. */
 #cmakedefine PACKAGE_STRING 1
 
diff --git a/lofar_config.h.cmake b/lofar_config.h.cmake
index 4abd60fabb3..ce993c1b89e 100644
--- a/lofar_config.h.cmake
+++ b/lofar_config.h.cmake
@@ -1,14 +1,160 @@
-/* Generated by lofar_init.m4 */
+/* config.h.cmake.  [LOFAR.LCS.Common].  */
 
-#ifndef LOFAR_CONFIG_H
-#define LOFAR_CONFIG_H
+/* Define if building universal (internal helper macro) */
+#cmakedefine AC_APPLE_UNIVERSAL_BUILD 1
 
-#if defined(HAVE_CONFIG_H)
-#include <config.h>
-#endif
+/* Define as __PRETTY_FUNCTION__, __FUNCTION__, or "<unknown>" */
+#cmakedefine AUTO_FUNCTION_NAME @AUTO_FUNCTION_NAME@
 
-#define HAVE_LOFAR_TOOLS 1
+/* Define if DbgAssert is enabled */
+#cmakedefine ENABLE_DBGASSERT 1
 
-#define LOFARLOGGER_PACKAGE "LCS.Tools"
+/* Define if TRACER is enabled */
+#cmakedefine ENABLE_TRACER 1
 
-#endif
+/* Define if backtrace() is available */
+#cmakedefine HAVE_BACKTRACE 1
+
+/* Define if libbfd is available */
+#cmakedefine HAVE_BFD 1
+
+/* Define if MPICH is installed */
+#cmakedefine HAVE_BGLMPICH 1
+
+/* Define if BOOST is installed */
+#cmakedefine HAVE_BOOST 1
+
+/* Define to 1 if you have the `cplus_demangle' function. */
+#cmakedefine HAVE_CPLUS_DEMANGLE 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#cmakedefine HAVE_DLFCN_H 1
+
+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
+#cmakedefine HAVE_DOPRNT 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#cmakedefine HAVE_INTTYPES_H 1
+
+/* Define if LAM is installed */
+#cmakedefine HAVE_LAM 1
+
+/* Define if LOG4CPLUS is installed */
+#cmakedefine HAVE_LOG4CPLUS 1
+
+/* Define if LOG4CXX is installed */
+#cmakedefine HAVE_LOG4CXX 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#cmakedefine HAVE_MEMORY_H 1
+
+/* Define if we have an MPI implementation installed */
+#cmakedefine HAVE_MPI 1
+
+/* Define if MPICH is installed */
+#cmakedefine HAVE_MPICH 1
+
+/* Define if MPI profiler should be enabled */
+#cmakedefine HAVE_MPI_PROFILER 1
+
+/* Define if using Rational Purify */
+#cmakedefine HAVE_PURIFY 1
+
+/* Define if ScaMPI is installed */
+#cmakedefine HAVE_SCAMPI 1
+
+/* Defined if shared memory is used */
+#cmakedefine HAVE_SHMEM 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#cmakedefine HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#cmakedefine HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#cmakedefine HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#cmakedefine HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#cmakedefine HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#cmakedefine HAVE_SYS_TYPES_H 1
+
+/* Define if TOOLS is installed */
+#cmakedefine HAVE_TOOLS 1
+
+/* Define if `ushort' is supported */
+#cmakedefine HAVE_USHORT 1
+
+/* Define if `uint' is supported */
+#cmakedefine HAVE_UINT 1
+
+/* Define if `ulong' is supported */
+#cmakedefine HAVE_ULONG 1
+
+/* Define if `long long' is supported */
+#cmakedefine HAVE_LONG_LONG 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#cmakedefine HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `vprintf' function. */
+#cmakedefine HAVE_VPRINTF 1
+
+/* Define if we are compiling with debugging information */
+#cmakedefine LOFAR_DEBUG 1
+
+/* Define if AIPS++ is installed */
+#cmakedefine HAVE_AIPSPP
+
+/* Define if FFTW2 is installed */
+#cmakedefine HAVE_FFTW2
+
+/* Define if FFTW3 is installed */
+#cmakedefine HAVE_FFTW3
+
+/* Define if libpqxx is installed */
+#cmakedefine HAVE_PQXX
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#cmakedefine LT_OBJDIR 1
+
+/* Define to the address where bug reports for this package should be sent. */
+#cmakedefine PACKAGE_BUGREPORT 1
+
+/* Define to the full name of this package. */
+#cmakedefine PACKAGE_NAME 1
+
+/* Define to the full name and version of this package. */
+#cmakedefine PACKAGE_STRING 1
+
+/* Define to the one symbol short name of this package. */
+#cmakedefine PACKAGE_TARNAME 1
+
+/* Define to the version of this package. */
+#cmakedefine PACKAGE_VERSION 1
+
+/* Define RPM release nr */
+#cmakedefine RPM_RELEASE 1
+
+/* Define to 1 if you have the ANSI C header files. */
+#cmakedefine STDC_HEADERS 1
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+   significant byte first (like Motorola and SPARC, unlike Intel). */
+#cmakedefine WORDS_BIGENDIAN 1
+
+/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
+   `char[]'. */
+#cmakedefine YYTEXT_POINTER 1
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#cmakedefine const 1
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#cmakedefine size_t 1
-- 
GitLab