[med-svn] [castxml] 01/07: Imported Upstream version 0.1+git20160131

Gert Wollny gert-guest at moszumanska.debian.org
Sun Jan 31 15:39:06 UTC 2016


This is an automated email from the git hooks/post-receive script.

gert-guest pushed a commit to branch master
in repository castxml.

commit aed4a62ec9c978493383a3331e2c443ddb523965
Author: Gert Wollny <gw.fossdev at gmail.com>
Date:   Sun Jan 31 15:21:01 2016 +0000

    Imported Upstream version 0.1+git20160131
---
 CMakeLists.txt                                     |   12 +-
 README.rst                                         |    2 +-
 doc/manual/castxml.1.rst                           |   37 +-
 share/castxml/{detect_vs.cpp => detect_vs.c}       |   18 +-
 share/castxml/detect_vs.cpp                        |   12 +
 share/castxml/empty.c                              |    0
 src/CMakeLists.txt                                 |    1 +
 src/Detect.cxx                                     |   71 +-
 src/Options.h                                      |    6 +-
 src/Output.cxx                                     |  184 +-
 src/Output.h                                       |    2 +-
 src/RunClang.cxx                                   |  199 +-
 src/Utils.cxx                                      |   40 +-
 src/Utils.h                                        |    5 +-
 src/Version.cmake                                  |   14 +-
 src/Version.h.in                                   |    5 +-
 src/castxml.cxx                                    |   11 +-
 src/kwsys/.gitattributes                           |   16 +
 src/kwsys/Base64.c                                 |  279 -
 src/kwsys/Base64.h.in                              |  120 -
 src/kwsys/CMakeEmptyInputFile.in                   |    1 -
 src/kwsys/CMakeLists.txt                           |   29 +-
 src/kwsys/CONTRIBUTING.rst                         |   35 +
 src/kwsys/CPU.h.in                                 |  129 -
 src/kwsys/CTestConfig.cmake                        |   17 -
 src/kwsys/CommandLineArguments.cxx                 |  859 ----
 src/kwsys/CommandLineArguments.hxx.in              |  286 --
 src/kwsys/Configure.hxx.in                         |  179 -
 src/kwsys/Directory.cxx                            |  253 -
 src/kwsys/Directory.hxx.in                         |   91 -
 src/kwsys/DynamicLoader.cxx                        |  527 --
 src/kwsys/DynamicLoader.hxx.in                     |  112 -
 src/kwsys/Encoding.hxx.in                          |   87 -
 src/kwsys/EncodingC.c                              |   18 +-
 src/kwsys/EncodingCXX.cxx                          |  184 -
 src/kwsys/ExtraTest.cmake.in                       |    1 -
 src/kwsys/FStream.cxx                              |   76 -
 src/kwsys/FStream.hxx.in                           |  188 -
 src/kwsys/FundamentalType.h.in                     |  146 -
 src/kwsys/Glob.cxx                                 |  513 --
 src/kwsys/Glob.hxx.in                              |  117 -
 src/kwsys/IOStream.cxx                             |  282 -
 src/kwsys/IOStream.hxx.in                          |  142 -
 src/kwsys/MD5.c                                    |  523 --
 src/kwsys/MD5.h.in                                 |  107 -
 src/kwsys/Process.h.in                             |  138 +-
 src/kwsys/ProcessUNIX.c                            |  707 ++-
 src/kwsys/ProcessWin32.c                           | 1103 ++--
 src/kwsys/README.txt                               |    2 +
 src/kwsys/RegularExpression.cxx                    | 1244 -----
 src/kwsys/RegularExpression.hxx.in                 |  453 --
 src/kwsys/SharedForward.h.in                       |  922 ----
 src/kwsys/String.c                                 |  115 -
 src/kwsys/String.h.in                              |   67 -
 src/kwsys/String.hxx.in                            |   65 -
 src/kwsys/System.c                                 |  585 +--
 src/kwsys/System.h.in                              |   98 -
 src/kwsys/SystemInformation.cxx                    | 5374 --------------------
 src/kwsys/SystemInformation.hxx.in                 |  159 -
 src/kwsys/SystemTools.cxx                          | 5201 -------------------
 src/kwsys/SystemTools.hxx.in                       |  959 ----
 src/kwsys/Terminal.c                               |  433 --
 src/kwsys/Terminal.h.in                            |  159 -
 src/kwsys/auto_ptr.hxx.in                          |  219 -
 src/kwsys/hash_fun.hxx.in                          |  149 -
 src/kwsys/hash_map.hxx.in                          |  461 --
 src/kwsys/hash_set.hxx.in                          |  445 --
 src/kwsys/hashtable.hxx.in                         | 1296 -----
 src/kwsys/kwsysHeaderDump.pl                       |   50 -
 src/kwsys/kwsysPlatformTestsCXX.cxx                |   17 +
 src/kwsys/kwsys_cstddef.hxx.in                     |   35 -
 src/kwsys/kwsys_ios_fstream.h.in                   |   46 -
 src/kwsys/kwsys_ios_iosfwd.h.in                    |   49 -
 src/kwsys/kwsys_ios_iostream.h.in                  |   99 -
 src/kwsys/kwsys_ios_sstream.h.in                   |  199 -
 src/kwsys/kwsys_stl.hxx.in                         |   49 -
 src/kwsys/kwsys_stl_string.hxx.in                  |  123 -
 src/kwsys/testAutoPtr.cxx                          |  166 -
 src/kwsys/testCommandLineArguments.cxx             |  187 -
 src/kwsys/testCommandLineArguments1.cxx            |  108 -
 src/kwsys/testDynamicLoader.cxx                    |  129 -
 src/kwsys/testDynload.c                            |   22 -
 src/kwsys/testEncode.c                             |   76 -
 src/kwsys/testEncoding.cxx                         |  199 -
 src/kwsys/testFStream.cxx                          |  190 -
 src/kwsys/testFail.c                               |   35 -
 src/kwsys/testHashSTL.cxx                          |   75 -
 src/kwsys/testIOS.cxx                              |  167 -
 src/kwsys/testProcess.c                            |  548 --
 src/kwsys/testSharedForward.c.in                   |   36 -
 src/kwsys/testSystemInformation.cxx                |  118 -
 src/kwsys/testSystemTools.bin                      |  Bin 766 -> 0 bytes
 src/kwsys/testSystemTools.cxx                      |  650 ---
 src/kwsys/testSystemTools.h.in                     |   21 -
 src/kwsys/testTerminal.c                           |   31 -
 test/CMakeLists.txt                                |  211 +-
 test/cc-gnu.c                                      |   21 +-
 test/cc-msvc.c                                     |   19 +-
 ...14.result.txt => cmd.cc-gnu-bad-cmd.result.txt} |    0
 test/expect/cmd.cc-gnu-bad-cmd.stderr.txt          |    3 +
 test/expect/cmd.cc-gnu-c-E.stdout.txt              |    2 -
 ....result.txt => cmd.cc-gnu-c-bad-cmd.result.txt} |    0
 test/expect/cmd.cc-gnu-c-bad-cmd.stderr.txt        |    3 +
 test/expect/cmd.cc-gnu-c-src-c-E.stdout.txt        |    6 +
 ...tderr.txt => cmd.cc-gnu-c-src-c-cmd.stderr.txt} |    0
 test/expect/cmd.cc-gnu-c-std-c11.stderr.txt        |    1 +
 test/expect/cmd.cc-gnu-c-std-c89.stderr.txt        |    1 +
 test/expect/cmd.cc-gnu-c-std-c99.stderr.txt        |    1 +
 test/expect/cmd.cc-gnu-c-std-gnu11.stderr.txt      |    1 +
 test/expect/cmd.cc-gnu-c-std-gnu89.stderr.txt      |    1 +
 test/expect/cmd.cc-gnu-c-std-gnu99.stderr.txt      |    1 +
 test/expect/cmd.cc-gnu-cxx-E.stdout.txt            |    2 -
 ...14.result.txt => cmd.cc-gnu-src-c-E.result.txt} |    0
 test/expect/cmd.cc-gnu-src-c-E.stderr.txt          |    1 +
 test/expect/cmd.cc-gnu-src-cxx-E.stdout.txt        |    7 +
 ...tderr.txt => cmd.cc-gnu-src-cxx-cmd.stderr.txt} |    0
 test/expect/cmd.cc-gnu-std-c++11.stderr.txt        |    1 +
 test/expect/cmd.cc-gnu-std-c++14.stderr.txt        |    1 +
 test/expect/cmd.cc-gnu-std-c++98.stderr.txt        |    1 +
 test/expect/cmd.cc-gnu-std-explicit.stderr.txt     |    1 +
 test/expect/cmd.cc-gnu-std-gnu++11.stderr.txt      |    1 +
 test/expect/cmd.cc-gnu-std-gnu++14.stderr.txt      |    1 +
 test/expect/cmd.cc-gnu-std-gnu++98.stderr.txt      |    1 +
 ...4.result.txt => cmd.cc-msvc-bad-cmd.result.txt} |    0
 test/expect/cmd.cc-msvc-bad-cmd.stderr.txt         |    3 +
 test/expect/cmd.cc-msvc-c-E.stdout.txt             |    2 -
 ...result.txt => cmd.cc-msvc-c-bad-cmd.result.txt} |    0
 test/expect/cmd.cc-msvc-c-bad-cmd.stderr.txt       |    3 +
 test/expect/cmd.cc-msvc-c-src-c-E.stdout.txt       |    6 +
 ...derr.txt => cmd.cc-msvc-c-src-c-cmd.stderr.txt} |    0
 test/expect/cmd.cc-msvc-c-std-c89.stderr.txt       |    1 +
 test/expect/cmd.cc-msvc-cxx-E.stdout.txt           |    2 -
 ...4.result.txt => cmd.cc-msvc-src-c-E.result.txt} |    0
 test/expect/cmd.cc-msvc-src-c-E.stderr.txt         |    1 +
 test/expect/cmd.cc-msvc-src-cxx-E.stdout.txt       |    7 +
 ...derr.txt => cmd.cc-msvc-src-cxx-cmd.stderr.txt} |    0
 test/expect/cmd.cc-msvc-std-c++11.stderr.txt       |    1 +
 test/expect/cmd.cc-msvc-std-c++14.stderr.txt       |    1 +
 test/expect/cmd.cc-msvc-std-c++98.stderr.txt       |    1 +
 test/expect/cmd.cc-msvc-std-explicit.stderr.txt    |    1 +
 test/expect/cmd.gccxml-and-c++14.stderr.txt        |    1 -
 test/expect/cmd.predefined-macros.stdout.txt.in    |    9 +
 ...4.result.txt => cmd.std-c++98-src-c.result.txt} |    0
 test/expect/cmd.std-c++98-src-c.stderr.txt         |    1 +
 ...4.result.txt => cmd.std-c89-src-cxx.result.txt} |    0
 test/expect/cmd.std-c89-src-cxx.stderr.txt         |    1 +
 test/expect/gccxml.any.Class-annotate.xml.txt      |   17 +
 test/expect/gccxml.any.Class-base-offset.xml.txt   |   11 +
 test/expect/gccxml.any.Class-base-typedef.xml.txt  |    2 +-
 ...ny.Class-implicit-member-access-mutable.xml.txt |    2 +-
 ...gccxml.any.Class-implicit-member-access.xml.txt |    2 +-
 ...cxml.any.Class-implicit-member-bad-base.xml.txt |    2 +-
 .../expect/gccxml.any.Constructor-annotate.xml.txt |   17 +
 test/expect/gccxml.any.Constructor.xml.txt         |   17 +
 test/expect/gccxml.any.Converter-annotate.xml.txt  |   19 +
 test/expect/gccxml.any.Converter.xml.txt           |   19 +
 test/expect/gccxml.any.Destructor-annotate.xml.txt |   17 +
 test/expect/gccxml.any.Destructor.xml.txt          |   17 +
 .../expect/gccxml.any.Enumeration-annotate.xml.txt |    8 +
 test/expect/gccxml.any.Field-annotate.xml.txt      |   19 +
 .../gccxml.any.Function-Argument-Annotate.xml.txt  |   10 +
 test/expect/gccxml.any.Function-annotate.xml.txt   |   10 +
 ...Function-calling-convention-ms-annotate.xml.txt |   26 +
 test/expect/gccxml.any.Method-annotate.xml.txt     |   21 +
 test/expect/gccxml.any.Method-overrides.xml.txt    |   38 +
 .../gccxml.any.OperatorFunction-annotate.xml.txt   |   13 +
 .../gccxml.any.OperatorMethod-annotate.xml.txt     |   21 +
 test/expect/gccxml.any.RValueReferenceType.xml.txt |    6 +-
 test/expect/gccxml.any.TypeAlias.xml.txt           |    5 +
 test/expect/gccxml.any.TypeAliasTemplate.xml.txt   |    5 +
 test/expect/gccxml.any.Typedef-annotate.xml.txt    |    7 +
 test/expect/gccxml.any.Variable-annotate.xml.txt   |    7 +
 .../gccxml.any.invalid-decl-for-type.xml.txt       |   32 +
 .../gccxml.any.using-declaration-class.xml.txt     |    2 +-
 test/expect/gccxml.c++11.Class-bases.xml.txt       |    4 +-
 .../gccxml.c++11.Class-template-bases.xml.txt      |    4 +-
 ...es.xml.txt => gccxml.c++14.Class-bases.xml.txt} |    4 +-
 ...t => gccxml.c++14.Class-template-bases.xml.txt} |    4 +-
 test/expect/gccxml.c++98.Class-bases.xml.txt       |    4 +-
 .../gccxml.c++98.Class-template-bases.xml.txt      |    4 +-
 test/expect/gccxml.c++98.TypeAlias.stderr.txt      |    1 +
 .../gccxml.c++98.TypeAliasTemplate.stderr.txt      |    1 +
 test/expect/gccxml.c89.GNU-float128.xml.txt        |    2 +-
 test/input/Class-annotate.cxx                      |    1 +
 test/input/Class-base-offset.cxx                   |    4 +
 test/input/Constructor-annotate.cxx                |    3 +
 test/input/Constructor.cxx                         |    3 +
 test/input/Converter-annotate.cxx                  |    3 +
 test/input/Converter.cxx                           |    3 +
 test/input/Destructor-annotate.cxx                 |    3 +
 test/input/Destructor.cxx                          |    3 +
 test/input/Enumeration-annotate.cxx                |    3 +
 test/input/Field-annotate.cxx                      |    3 +
 test/input/Function-Argument-annotate.cxx          |    1 +
 test/input/Function-annotate.cxx                   |    1 +
 .../Function-calling-convention-ms-annotate.cxx    |    4 +
 test/input/Method-annotate.cxx                     |    3 +
 test/input/Method-overrides.cxx                    |    6 +
 test/input/OperatorFunction-annotate.cxx           |    4 +
 test/input/OperatorMethod-annotate.cxx             |    3 +
 test/input/RValueReferenceType.cxx                 |    4 +-
 test/input/TypeAlias.cxx                           |    3 +
 test/input/TypeAliasTemplate.cxx                   |    4 +
 test/input/Typedef-annotate.cxx                    |    1 +
 test/input/Variable-annotate.cxx                   |    1 +
 test/input/invalid-decl-for-type.cxx               |    7 +
 test/run.cmake                                     |   17 +-
 207 files changed, 2571 insertions(+), 27961 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index ebb234f..b56b0a8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -33,26 +33,30 @@ if(NOT CastXML_INSTALL_DATA_DIR)
   set(CastXML_INSTALL_DATA_DIR share/castxml)
 endif()
 if(NOT CastXML_INSTALL_DOC_DIR)
-  set(CastXML_INSTALL_DOC_DIR doc/castxml)
+  set(CastXML_INSTALL_DOC_DIR share/doc/castxml)
 endif()
 if(NOT CastXML_INSTALL_MAN_DIR)
   set(CastXML_INSTALL_MAN_DIR man)
 endif()
 
 if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
+  if(NOT LLVM_ENABLE_EH)
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")
+  endif()
+  if(NOT LLVM_ENABLE_RTTI)
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
+  endif()
   if(CYGWIN OR MINGW)
     # Use GNU extensions on Windows as LLVM upstream does.
     set(std_cxx11 "-std=gnu++11")
   else()
     set(std_cxx11 "-std=c++11")
   endif()
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti ${std_cxx11}")
+  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${std_cxx11}")
 endif()
 
 set(KWSYS_NAMESPACE cxsys)
 set(KWSYS_USE_Process 1)
-set(KWSYS_USE_RegularExpression 1)
-set(KWSYS_USE_SystemTools 1)
 set(KWSYS_HEADER_ROOT ${CastXML_BINARY_DIR}/src)
 add_subdirectory(src/kwsys)
 include_directories(${KWSYS_HEADER_ROOT})
diff --git a/README.rst b/README.rst
index cd420a3..9e44ad2 100644
--- a/README.rst
+++ b/README.rst
@@ -46,7 +46,7 @@ To build CastXML from source, first obtain the prerequisites:
 * `LLVM/Clang`_ compiler SDK install tree built using the C++ compiler.
   This version of CastXML has been tested with LLVM/Clang
 
-  - SVN revision ``243888``
+  - SVN revision ``245954``
   - Release ``3.7``
   - Release ``3.6``
 
diff --git a/doc/manual/castxml.1.rst b/doc/manual/castxml.1.rst
index 4bf31f9..250372c 100644
--- a/doc/manual/castxml.1.rst
+++ b/doc/manual/castxml.1.rst
@@ -37,23 +37,27 @@ Remaining options are given to the internal Clang compiler.
   a reference compiler with which the given command is compatible.
   It must be one of:
 
-  * ``gnu``: GNU Compiler Collection (gcc)
+  * ``gnu``: GNU Compiler Collection C++ (g++)
+  * ``gnu-c``: GNU Compiler Collection C (gcc)
   * ``msvc``: Microsoft Visual C++ (cl)
+  * ``msvc-c``: Microsoft Visual C (cl)
 
   ``<cc>`` names a compiler (e.g. ``/usr/bin/gcc`` or ``cl``) and
   ``<cc-opt>...`` specifies options that may affect its target
   (e.g. ``-m32``).
   The target platform detected from the given compiler may be
   overridden by a separate Clang ``-target`` option.
+  The language standard level detected from the given compiler
+  may be overridden by a separate Clang ``-std=`` option.
 
 ``--castxml-gccxml``
   Generate XML output in a format close to that of `gccxml`_.
   Write output to ``<src>.xml`` or file named by ``-o``.
   The gccxml format does not support Clang language modes other than
   ``-std=c++98`` or ``-std=c89``.  This output format may be used with
-  language mode ``-std=c++11`` but the output will not contain implicit
-  move constructors or move assignment operators, and may contain
-  ``<Unimplemented/>`` elements on non-c++98 constructs.
+  language modes ``-std=c++11`` and ``-std=c++14`` but the output will
+  not contain implicit move constructors or move assignment operators,
+  and may contain ``<Unimplemented/>`` elements on non-c++98 constructs.
 
 ``--castxml-start <name>[,<name>]...``
   Start AST traversal at declaration(s) with the given qualified name(s).
@@ -69,3 +73,28 @@ Remaining options are given to the internal Clang compiler.
 
 ``--version``
   Print ``castxml`` and internal Clang compiler version information.
+
+Preprocessing
+=============
+
+CastXML preprocesses source files using an internal Clang compiler
+using its own predefined macros for the target platform by default.
+The ``--castxml-cc-<id>`` option switches the predefined macros
+to match those detected from the given compiler command.  In either
+case, CastXML always adds the following predefined macros:
+
+``__castxml__``
+  Defined to an integer encoding the CastXML version number as
+  ``printf("%d%03d%03d",major,minor,patch)``.
+
+``__castxml_clang_major__``
+  Defined to the value of  ``__clang_major__`` from the internal Clang.
+
+``__castxml_clang_minor__``
+  Defined to the value of  ``__clang_minor__`` from the internal Clang.
+
+``__castxml_clang_patchlevel__``
+  Defined to the value of  ``__clang_patchlevel__`` from the internal Clang.
+
+Source files may use these to identify the tool that is actually doing the
+preprocessing even when ``--castxml-cc-<id>`` changes the predefined macros.
diff --git a/share/castxml/detect_vs.cpp b/share/castxml/detect_vs.c
similarity index 93%
copy from share/castxml/detect_vs.cpp
copy to share/castxml/detect_vs.c
index 2e51743..eca94bc 100644
--- a/share/castxml/detect_vs.cpp
+++ b/share/castxml/detect_vs.c
@@ -14,12 +14,18 @@
   limitations under the License.
 */
 
-/* cl -c -FoNUL detect_vs.cpp */
+/* cl -c -FoNUL detect_vs.c */
 #define TO_STRING0(x) #x
 #define TO_STRING(x) TO_STRING0(x)
 #define TO_DEFINE(x) "#define " #x " " TO_STRING(x)
 
 #pragma message("")
+#ifdef __AVX__
+# pragma message(TO_DEFINE(__AVX__))
+#endif
+#ifdef __AVX2__
+# pragma message(TO_DEFINE(__AVX2__))
+#endif
 #ifdef _ATL_VER
 # pragma message(TO_DEFINE(_ATL_VER))
 #endif
@@ -68,6 +74,9 @@
 #ifdef _M_AMD64
 # pragma message(TO_DEFINE(_M_AMD64))
 #endif
+#ifdef _M_ARM
+# pragma message(TO_DEFINE(_M_ARM))
+#endif
 #ifdef _M_ARM_FP
 # pragma message(TO_DEFINE(_M_ARM_FP))
 #endif
@@ -128,10 +137,3 @@
 #ifdef __MSVC_RUNTIME_CHECKS
 # pragma message(TO_DEFINE(__MSVC_RUNTIME_CHECKS))
 #endif
-#ifdef __cplusplus
-# pragma message(TO_DEFINE(__cplusplus))
-#endif
-#ifdef __cplusplus_cli
-# pragma message(TO_DEFINE(__cplusplus_cli))
-#endif
-#pragma message("class type_info;")
diff --git a/share/castxml/detect_vs.cpp b/share/castxml/detect_vs.cpp
index 2e51743..130c974 100644
--- a/share/castxml/detect_vs.cpp
+++ b/share/castxml/detect_vs.cpp
@@ -20,6 +20,12 @@
 #define TO_DEFINE(x) "#define " #x " " TO_STRING(x)
 
 #pragma message("")
+#ifdef __AVX__
+# pragma message(TO_DEFINE(__AVX__))
+#endif
+#ifdef __AVX2__
+# pragma message(TO_DEFINE(__AVX2__))
+#endif
 #ifdef _ATL_VER
 # pragma message(TO_DEFINE(_ATL_VER))
 #endif
@@ -68,6 +74,9 @@
 #ifdef _M_AMD64
 # pragma message(TO_DEFINE(_M_AMD64))
 #endif
+#ifdef _M_ARM
+# pragma message(TO_DEFINE(_M_ARM))
+#endif
 #ifdef _M_ARM_FP
 # pragma message(TO_DEFINE(_M_ARM_FP))
 #endif
@@ -134,4 +143,7 @@
 #ifdef __cplusplus_cli
 # pragma message(TO_DEFINE(__cplusplus_cli))
 #endif
+#ifdef __cplusplus_winrt
+# pragma message(TO_DEFINE(__cplusplus_winrt))
+#endif
 #pragma message("class type_info;")
diff --git a/share/castxml/empty.c b/share/castxml/empty.c
new file mode 100644
index 0000000..e69de29
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 71014d2..667f04e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -47,6 +47,7 @@ llvm_map_components_to_libnames(llvm_libs
   native
   option
   bitreader
+  support
   ${LLVM_TARGETS_TO_BUILD}
   )
 
diff --git a/src/Detect.cxx b/src/Detect.cxx
index c7a7bae..ec1e8e6 100644
--- a/src/Detect.cxx
+++ b/src/Detect.cxx
@@ -18,11 +18,14 @@
 #include "Options.h"
 #include "Utils.h"
 
+#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Triple.h"
+#include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Host.h"
 
-#include <cxsys/SystemTools.hxx>
-
+#include <algorithm>
+#include <cstdlib>
 #include <iostream>
 #include <string.h>
 
@@ -70,22 +73,6 @@ static void fixPredefines(Options& opts)
       pd.erase(beg);
     }
   }
-
-  // Provide __float128 if simulating the actual GNU compiler.
-  if (pd.find("#define __GNUC__ ") != pd.npos &&
-      pd.find("#define __clang__ ") == pd.npos &&
-      pd.find("#define __INTEL_COMPILER ") == pd.npos &&
-      pd.find("#define __CUDACC__ ") == pd.npos &&
-      pd.find("#define __PGI ") == pd.npos &&
-      (pd.find("#define __i386__ ") != pd.npos ||
-       pd.find("#define __x86_64__ ") != pd.npos ||
-       pd.find("#define __ia64__ ") != pd.npos)) {
-    pd += "\n"
-      "typedef struct __castxml_float128 { "
-      "  char x[16] __attribute__((aligned(16))); "
-      "} __float128;\n"
-      ;
-  }
 }
 
 //----------------------------------------------------------------------------
@@ -116,12 +103,14 @@ static void setTriple(Options& opts)
 //----------------------------------------------------------------------------
 static bool detectCC_GNU(const char* const* argBeg,
                          const char* const* argEnd,
-                         Options& opts)
+                         Options& opts,
+                         const char* id,
+                         const char* ext)
 {
   std::string const fwExplicitSuffix = " (framework directory)";
   std::string const fwImplicitSuffix = "/Frameworks";
   std::vector<const char*> cc_args(argBeg, argEnd);
-  std::string empty_cpp = getResourceDir() + "/empty.cpp";
+  std::string empty_cpp = getResourceDir() + "/empty." + ext;
   int ret;
   std::string out;
   std::string err;
@@ -144,7 +133,7 @@ static bool detectCC_GNU(const char* const* argBeg,
               --e;
             }
             std::string inc(s, e-s);
-            cxsys::SystemTools::ConvertToUnixSlashes(inc);
+            std::replace(inc.begin(), inc.end(), '\\', '/');
             bool fw = ((inc.size() > fwExplicitSuffix.size()) &&
                        (inc.substr(inc.size()-fwExplicitSuffix.size()) ==
                         fwExplicitSuffix));
@@ -156,7 +145,7 @@ static bool detectCC_GNU(const char* const* argBeg,
                      fwImplicitSuffix));
             }
             // Replace the compiler builtin include directory with ours.
-            if(!fw && cxsys::SystemTools::FileExists((inc+"/emmintrin.h"))) {
+            if (!fw && llvm::sys::fs::exists(inc+"/emmintrin.h")) {
               inc = getClangBuiltinIncludeDir();
             }
             opts.Includes.push_back(Options::Include(inc, fw));
@@ -168,17 +157,19 @@ static bool detectCC_GNU(const char* const* argBeg,
     setTriple(opts);
     return true;
   } else {
-    return failedCC("gnu", cc_args, out, err, msg);
+    return failedCC(id, cc_args, out, err, msg);
   }
 }
 
 //----------------------------------------------------------------------------
 static bool detectCC_MSVC(const char* const* argBeg,
                           const char* const* argEnd,
-                          Options& opts)
+                          Options& opts,
+                          const char* id,
+                          const char* ext)
 {
   std::vector<const char*> cc_args(argBeg, argEnd);
-  std::string detect_vs_cpp = getResourceDir() + "/detect_vs.cpp";
+  std::string detect_vs_cpp = getResourceDir() + "/detect_vs." + ext;
   int ret;
   std::string out;
   std::string err;
@@ -191,14 +182,14 @@ static bool detectCC_MSVC(const char* const* argBeg,
     if(const char* predefs = strstr(out.c_str(), "\n#define")) {
       opts.Predefines = predefs+1;
     }
-    if(const char* includes_str = cxsys::SystemTools::GetEnv("INCLUDE")) {
-      std::vector<std::string> includes;
-      cxsys::SystemTools::Split(includes_str, includes, ';');
-      for(std::vector<std::string>::iterator i = includes.begin(),
-            e = includes.end(); i != e; ++i) {
-        if(!i->empty()) {
-          std::string inc = *i;
-          cxsys::SystemTools::ConvertToUnixSlashes(inc);
+    if(const char* includes_str = std::getenv("INCLUDE")) {
+      llvm::SmallVector<llvm::StringRef, 8> includes;
+      llvm::StringRef includes_ref(includes_str);
+      includes_ref.split(includes, ";", -1, false);
+      for (llvm::StringRef i: includes) {
+        if (!i.empty()) {
+          std::string inc = i;
+          std::replace(inc.begin(), inc.end(), '\\', '/');
           opts.Includes.push_back(inc);
         }
       }
@@ -207,7 +198,7 @@ static bool detectCC_MSVC(const char* const* argBeg,
     setTriple(opts);
     return true;
   } else {
-    return failedCC("msvc", cc_args, out, err, msg);
+    return failedCC(id, cc_args, out, err, msg);
   }
 }
 
@@ -217,10 +208,14 @@ bool detectCC(const char* id,
               const char* const* argEnd,
               Options& opts)
 {
-  if(strcmp(id, "gnu") == 0) {
-    return detectCC_GNU(argBeg, argEnd, opts);
-  } else if(strcmp(id, "msvc") == 0) {
-    return detectCC_MSVC(argBeg, argEnd, opts);
+  if (strcmp(id, "gnu") == 0) {
+    return detectCC_GNU(argBeg, argEnd, opts, id, "cpp");
+  } else if (strcmp(id, "gnu-c") == 0) {
+    return detectCC_GNU(argBeg, argEnd, opts, id, "c");
+  } else if (strcmp(id, "msvc") == 0) {
+    return detectCC_MSVC(argBeg, argEnd, opts, id, "cpp");
+  } else if (strcmp(id, "msvc-c") == 0) {
+    return detectCC_MSVC(argBeg, argEnd, opts, id, "c");
   } else {
     std::cerr << "error: '--castxml-cc-" << id << "' not known!\n";
     return false;
diff --git a/src/Options.h b/src/Options.h
index 7d9c5f5..34f5089 100644
--- a/src/Options.h
+++ b/src/Options.h
@@ -16,16 +16,18 @@
 #ifndef CASTXML_OPTIONS_H
 #define CASTXML_OPTIONS_H
 
-#include <cxsys/Configure.hxx>
+#include <cxsys/Configure.h>
 #include <string>
 #include <vector>
 
 struct Options
 {
-  Options(): PPOnly(false), GccXml(false), HaveCC(false), HaveTarget(false) {}
+  Options(): PPOnly(false), GccXml(false), HaveCC(false),
+    HaveStd(false), HaveTarget(false) {}
   bool PPOnly;
   bool GccXml;
   bool HaveCC;
+  bool HaveStd;
   bool HaveTarget;
   struct Include {
     Include(std::string const& d, bool f = false):
diff --git a/src/Output.cxx b/src/Output.cxx
index affb4fb..ab76b81 100644
--- a/src/Output.cxx
+++ b/src/Output.cxx
@@ -26,6 +26,7 @@
 #include "clang/AST/DeclOpenMP.h"
 #include "clang/AST/DeclTemplate.h"
 #include "clang/AST/Mangle.h"
+#include "clang/AST/RecordLayout.h"
 #include "clang/Basic/Specifiers.h"
 #include "clang/Frontend/CompilerInstance.h"
 #include "clang/Lex/Preprocessor.h"
@@ -233,8 +234,10 @@ class ASTVisitor: public ASTVisitorBase
   }
 
   /** Allocate a dump node for a Clang declaration.  */
-  DumpId AddDeclDumpNode(clang::Decl const* d, bool complete);
-  DumpId AddDeclDumpNode(clang::Decl const* d, bool complete, DumpQual dq);
+  DumpId AddDeclDumpNode(clang::Decl const* d, bool complete,
+                         bool forType = false);
+  DumpId AddDeclDumpNodeForType(clang::Decl const* d, bool complete,
+                                DumpQual dq);
 
   /** Allocate a dump node for a Clang type.  */
   DumpId AddTypeDumpNode(DumpType dt, bool complete, DumpQual dq = DumpQual());
@@ -340,9 +343,20 @@ class ASTVisitor: public ASTVisitorBase
       for later output.  */
   void PrintBasesAttribute(clang::CXXRecordDecl const* dx);
 
-  /** Print an attributes="..." attribute listing the attributes
-      of the given function type.  */
-  void PrintFunctionTypeAttributes(clang::FunctionProtoType const* t);
+  /** Print an attributes="..." attribute listing the given attributes.  */
+  void PrintAttributesAttribute(std::vector<std::string> const& attrs);
+
+  /** Print an attributes="..." attribute listing the given
+      declaration's attributes.  */
+  void PrintAttributesAttribute(clang::Decl const* d);
+
+  /** Get the attributes of the given function type.  */
+  void GetFunctionTypeAttributes(clang::FunctionProtoType const* t,
+                                 std::vector<std::string>& attrs);
+
+  /** Get the attributes of the given declaration.  */
+  void GetDeclAttributes(clang::Decl const* d,
+                         std::vector<std::string>& attrs);
 
   /** Print a throw="..." attribute listing the XML IDREFs for
       the types that the given function prototype declares in
@@ -394,6 +408,8 @@ class ASTVisitor: public ASTVisitorBase
       indicate public, protected, or private membership.  */
   void PrintContextAttribute(clang::Decl const* d);
 
+  void PrintFloat128Type(DumpNode const* dn);
+
   // Decl node output methods.
   void OutputTranslationUnitDecl(clang::TranslationUnitDecl const* d,
                                  DumpNode const* dn);
@@ -503,7 +519,7 @@ public:
 
 //----------------------------------------------------------------------------
 ASTVisitor::DumpId ASTVisitor::AddDeclDumpNode(clang::Decl const* d,
-                                               bool complete) {
+                                               bool complete, bool forType) {
   // Select the definition or canonical declaration.
   d = d->getCanonicalDecl();
   if(clang::RecordDecl const* rd = clang::dyn_cast<clang::RecordDecl>(d)) {
@@ -517,19 +533,19 @@ ASTVisitor::DumpId ASTVisitor::AddDeclDumpNode(clang::Decl const* d,
   case clang::Decl::UsingShadow:
     return this->AddDeclDumpNode(
       static_cast<clang::UsingShadowDecl const*>(d)->getTargetDecl(),
-      complete);
+      complete, forType);
   case clang::Decl::LinkageSpec: {
     clang::DeclContext const* dc =
       static_cast<clang::LinkageSpecDecl const*>(d)->getDeclContext();
     return this->AddDeclDumpNode(clang::Decl::castFromDeclContext(dc),
-                                 complete);
+                                 complete, forType);
   } break;
   default:
     break;
   }
 
-  // Skip invalid declarations.
-  if(d->isInvalidDecl()) {
+  // Skip invalid declarations that are not needed for a type element.
+  if (d->isInvalidDecl() && !forType) {
     return DumpId();
   }
 
@@ -555,16 +571,32 @@ ASTVisitor::DumpId ASTVisitor::AddDeclDumpNode(clang::Decl const* d,
         }
       }
     }
+
+    if (clang::dyn_cast<clang::TypeAliasDecl>(d)) {
+      return DumpId();
+    }
+
+    if (clang::dyn_cast<clang::TypeAliasTemplateDecl>(d)) {
+      return DumpId();
+    }
+
+    if (clang::TypedefDecl const* td =
+        clang::dyn_cast<clang::TypedefDecl>(d)) {
+      if (td->getUnderlyingType()->isRValueReferenceType()) {
+        return DumpId();
+      }
+    }
   }
 
   return this->AddDumpNodeImpl(d, complete);
 }
 
 //----------------------------------------------------------------------------
-ASTVisitor::DumpId ASTVisitor::AddDeclDumpNode(clang::Decl const* d,
-                                               bool complete, DumpQual dq) {
+ASTVisitor::DumpId ASTVisitor::AddDeclDumpNodeForType(clang::Decl const* d,
+                                                      bool complete,
+                                                      DumpQual dq) {
   // Get the id for the canonical decl.
-  DumpId id = this->AddDeclDumpNode(d, complete);
+  DumpId id = this->AddDeclDumpNode(d, complete, true);
 
   // If any qualifiers were collected through layers of desugaring
   // then get the id of the qualified type referencing this decl.
@@ -609,15 +641,15 @@ ASTVisitor::DumpId ASTVisitor::AddTypeDumpNode(DumpType dt, bool complete,
       t->getAs<clang::ElaboratedType>()->getNamedType(), c),
       complete, dq);
   case clang::Type::Enum:
-    return this->AddDeclDumpNode(t->getAs<clang::EnumType>()->getDecl(),
-                                 complete, dq);
+    return this->AddDeclDumpNodeForType(
+      t->getAs<clang::EnumType>()->getDecl(), complete, dq);
   case clang::Type::Paren:
     return this->AddTypeDumpNode(DumpType(
       t->getAs<clang::ParenType>()->getInnerType(), c),
       complete, dq);
   case clang::Type::Record:
-    return this->AddDeclDumpNode(t->getAs<clang::RecordType>()->getDecl(),
-                                 complete, dq);
+    return this->AddDeclDumpNodeForType(
+      t->getAs<clang::RecordType>()->getDecl(), complete, dq);
   case clang::Type::SubstTemplateTypeParm:
     return this->AddTypeDumpNode(DumpType(
       t->getAs<clang::SubstTemplateTypeParmType>()->getReplacementType(), c),
@@ -649,7 +681,7 @@ ASTVisitor::DumpId ASTVisitor::AddTypeDumpNode(DumpType dt, bool complete,
         }
       }
     }
-    return this->AddDeclDumpNode(tdt->getDecl(), complete, dq);
+    return this->AddDeclDumpNodeForType(tdt->getDecl(), complete, dq);
   } break;
   default:
     break;
@@ -769,7 +801,7 @@ void ASTVisitor::AddDeclContextMembers(clang::DeclContext const* dc,
       if (rd->isInjectedClassName()) {
         continue;
       }
-      if (isTranslationUnit && rd->getName() == "__castxml_float128") {
+      if (isTranslationUnit && rd->getName() == "__castxml__float128") {
         continue;
       }
     } break;
@@ -810,7 +842,7 @@ void ASTVisitor::AddDeclContextMembers(clang::DeclContext const* dc,
     } break;
     case clang::Decl::Record: {
       clang::RecordDecl const* rd = static_cast<clang::RecordDecl const*>(d);
-      if (isTranslationUnit && rd->getName() == "__castxml_float128") {
+      if (isTranslationUnit && rd->getName() == "__castxml__float128") {
         continue;
       }
     } break;
@@ -1043,7 +1075,7 @@ void ASTVisitor::PrintMangledAttribute(clang::NamedDecl const* d)
 
   // We cannot mangle __float128 correctly because Clang does not have
   // it as an internal type, so skip mangled attributes involving it.
-  if (s.find("18__castxml_float128") != s.npos) {
+  if (s.find("__float128") != s.npos) {
     s = "";
   }
 
@@ -1193,19 +1225,44 @@ void ASTVisitor::PrintBasesAttribute(clang::CXXRecordDecl const* dx)
 }
 
 //----------------------------------------------------------------------------
-void ASTVisitor::PrintFunctionTypeAttributes(clang::FunctionProtoType const* t)
+void ASTVisitor::PrintAttributesAttribute(
+  std::vector<std::string> const& attrs)
+{
+  if (attrs.empty()) {
+    return;
+  }
+  this->OS << " attributes=\"";
+  const char* sep = "";
+  for (std::string const& a: attrs) {
+    this->OS << sep << encodeXML(a);
+    sep = " ";
+  }
+  this->OS << "\"";
+}
+
+//----------------------------------------------------------------------------
+void ASTVisitor::PrintAttributesAttribute(clang::Decl const* d)
+{
+  std::vector<std::string> attributes;
+  this->GetDeclAttributes(d, attributes);
+  this->PrintAttributesAttribute(attributes);
+}
+
+//----------------------------------------------------------------------------
+void ASTVisitor::GetFunctionTypeAttributes(clang::FunctionProtoType const* t,
+                                           std::vector<std::string>& attrs)
 {
   switch (t->getExtInfo().getCC()) {
   case clang::CallingConv::CC_C:
     break;
   case clang::CallingConv::CC_X86StdCall:
-    this->OS << " attributes=\"__stdcall__\"";
+    attrs.push_back("__stdcall__");
     break;
   case clang::CallingConv::CC_X86FastCall:
-    this->OS << " attributes=\"__fastcall__\"";
+    attrs.push_back("__fastcall__");
     break;
   case clang::CallingConv::CC_X86ThisCall:
-    this->OS << " attributes=\"__thiscall__\"";
+    attrs.push_back("__thiscall__");
     break;
   default:
     break;
@@ -1213,6 +1270,15 @@ void ASTVisitor::PrintFunctionTypeAttributes(clang::FunctionProtoType const* t)
 }
 
 //----------------------------------------------------------------------------
+void ASTVisitor::GetDeclAttributes(clang::Decl const* d,
+                                   std::vector<std::string>& attrs)
+{
+  for (auto const* a: d->specific_attrs<clang::AnnotateAttr>()) {
+    attrs.push_back("annotate(" + a->getAnnotation().str() + ")");
+  }
+}
+
+//----------------------------------------------------------------------------
 void ASTVisitor::PrintThrowsAttribute(clang::FunctionProtoType const* fpt,
                                       bool complete)
 {
@@ -1260,6 +1326,14 @@ void ASTVisitor::PrintBefriendingAttribute(clang::CXXRecordDecl const* dx)
 }
 
 //----------------------------------------------------------------------------
+void ASTVisitor::PrintFloat128Type(DumpNode const* dn)
+{
+  this->OS << "  <FundamentalType";
+  this->PrintIdAttribute(dn);
+  this->OS << " name=\"__float128\" size=\"128\" align=\"128\"/>\n";
+}
+
+//----------------------------------------------------------------------------
 void ASTVisitor::OutputFunctionHelper(clang::FunctionDecl const* d,
                                       DumpNode const* dn,
                                       const char* tag,
@@ -1302,6 +1376,26 @@ void ASTVisitor::OutputFunctionHelper(clang::FunctionDecl const* d,
     this->OS << " artificial=\"1\"";
   }
 
+  if (clang::CXXMethodDecl const* md =
+      clang::dyn_cast<clang::CXXMethodDecl>(d)) {
+    if (md->size_overridden_methods() > 0) {
+      this->OS << " overrides=\"";
+      const char* sep = "";
+      for (clang::CXXMethodDecl::method_iterator
+             i = md->begin_overridden_methods(),
+             e = md->end_overridden_methods();
+           i != e; ++i) {
+        if (DumpId id = this->AddDeclDumpNode(*i, false)) {
+          this->OS << sep << "_" << id;
+          sep = " ";
+        }
+      }
+      this->OS << "\"";
+    }
+  }
+
+  std::vector<std::string> attributes;
+
   if (clang::FunctionProtoType const* fpt =
       d->getType()->getAs<clang::FunctionProtoType>()) {
     this->PrintThrowsAttribute(fpt, dn->Complete);
@@ -1309,9 +1403,12 @@ void ASTVisitor::OutputFunctionHelper(clang::FunctionDecl const* d,
         !clang::isa<clang::CXXDestructorDecl>(d)) {
       this->PrintMangledAttribute(d);
     }
-    this->PrintFunctionTypeAttributes(fpt);
+    this->GetFunctionTypeAttributes(fpt, attributes);
   }
 
+  this->GetDeclAttributes(d, attributes);
+  this->PrintAttributesAttribute(attributes);
+
   if(unsigned np = d->getNumParams()) {
     this->OS << ">\n";
     for (unsigned i = 0; i < np; ++i) {
@@ -1356,7 +1453,9 @@ void ASTVisitor::OutputFunctionTypeHelper(clang::FunctionProtoType const* t,
   if(t->isRestrict()) {
     this->OS << " restrict=\"1\"";
   }
-  this->PrintFunctionTypeAttributes(t);
+  std::vector<std::string> attributes;
+  this->GetFunctionTypeAttributes(t, attributes);
+  this->PrintAttributesAttribute(attributes);
   if(t->param_type_begin() != t->param_type_end()) {
     this->OS << ">\n";
     for (clang::FunctionProtoType::param_type_iterator
@@ -1393,6 +1492,7 @@ void ASTVisitor::OutputFunctionArgument(clang::ParmVarDecl const* a,
     this->OS << encodeXML(rso.str());
     this->OS << "\"";
   }
+  this->PrintAttributesAttribute(a);
   this->OS << "/>\n";
 }
 
@@ -1434,6 +1534,14 @@ void ASTVisitor::OutputNamespaceDecl(
 void ASTVisitor::OutputRecordDecl(clang::RecordDecl const* d,
                                   DumpNode const* dn)
 {
+  // As a special case, replace the Clang fake builtin for __float128
+  // with a FundamentalType so we generate the same thing gccxml did.
+  if (this->CI.getLangOpts().CPlusPlus &&
+      d == this->CI.getASTContext().getFloat128StubType()) {
+    this->PrintFloat128Type(dn);
+    return;
+  }
+
   const char* tag;
   switch (d->getTagKind()) {
   case clang::TTK_Class: tag = "Class"; break;
@@ -1459,7 +1567,7 @@ void ASTVisitor::OutputRecordDecl(clang::RecordDecl const* d,
     if(dx && dx->isAbstract()) {
       this->OS << " abstract=\"1\"";
     }
-    if(dn->Complete) {
+    if (dn->Complete && !d->isInvalidDecl()) {
       this->PrintMembersAttribute(d);
       doBases = dx && dx->getNumBases();
       if(doBases) {
@@ -1471,14 +1579,23 @@ void ASTVisitor::OutputRecordDecl(clang::RecordDecl const* d,
     this->OS << " incomplete=\"1\"";
   }
   this->PrintABIAttributes(d);
+  this->PrintAttributesAttribute(d);
   if(doBases) {
     this->OS << ">\n";
+    clang::ASTRecordLayout const& layout = this->CTX.getASTRecordLayout(dx);
     for(clang::CXXRecordDecl::base_class_const_iterator i = dx->bases_begin(),
           e = dx->bases_end(); i != e; ++i) {
+      clang::QualType bt = i->getType().getCanonicalType();
+      clang::CXXRecordDecl const* bd = clang::dyn_cast<clang::CXXRecordDecl>(
+        bt->getAs<clang::RecordType>()->getDecl());
       this->OS << "    <Base";
-      this->PrintTypeAttribute(i->getType().getCanonicalType(), true);
+      this->PrintTypeAttribute(bt, true);
       this->PrintAccessAttribute(i->getAccessSpecifier());
       this->OS << " virtual=\"" << (i->isVirtual()? 1 : 0) << "\"";
+      if (bd && !i->isVirtual()) {
+        this->OS << " offset=\"" <<
+          layout.getBaseClassOffset(bd).getQuantity() << "\"";
+      }
       this->OS << "/>\n";
     }
     this->OS << "  </" << tag << ">\n";
@@ -1519,9 +1636,7 @@ void ASTVisitor::OutputTypedefDecl(clang::TypedefDecl const* d,
     if (sl.isValid()) {
       clang::FullSourceLoc fsl = this->CTX.getFullLoc(sl).getExpansionLoc();
       if (!this->CI.getSourceManager().getFileEntryForID(fsl.getFileID())) {
-        this->OS << "  <FundamentalType";
-        this->PrintIdAttribute(dn);
-        this->OS << " name=\"__float128\" size=\"128\" align=\"128\"/>\n";
+        this->PrintFloat128Type(dn);
         return;
       }
     }
@@ -1533,6 +1648,7 @@ void ASTVisitor::OutputTypedefDecl(clang::TypedefDecl const* d,
   this->PrintTypeAttribute(d->getUnderlyingType(), dn->Complete);
   this->PrintContextAttribute(d);
   this->PrintLocationAttribute(d);
+  this->PrintAttributesAttribute(d);
   this->OS << "/>\n";
 }
 
@@ -1550,6 +1666,7 @@ void ASTVisitor::OutputEnumDecl(clang::EnumDecl const* d, DumpNode const* dn)
   this->PrintNameAttribute(name);
   this->PrintContextAttribute(d);
   this->PrintLocationAttribute(d);
+  this->PrintAttributesAttribute(d);
   clang::EnumDecl::enumerator_iterator enum_begin = d->enumerator_begin();
   clang::EnumDecl::enumerator_iterator enum_end = d->enumerator_end();
   if(enum_begin != enum_end) {
@@ -1560,6 +1677,7 @@ void ASTVisitor::OutputEnumDecl(clang::EnumDecl const* d, DumpNode const* dn)
       this->OS << "    <EnumValue";
       this->PrintNameAttribute(ecd->getName());
       this->OS << " init=\"" << ecd->getInitVal() << "\"";
+      this->PrintAttributesAttribute(ecd);
       this->OS << "/>\n";
     }
     this->OS << "  </Enumeration>\n";
@@ -1585,6 +1703,7 @@ void ASTVisitor::OutputFieldDecl(clang::FieldDecl const* d, DumpNode const* dn)
   if(d->isMutable()) {
     this->OS << " mutable=\"1\"";
   }
+  this->PrintAttributesAttribute(d);
 
   this->OS << "/>\n";
 }
@@ -1613,6 +1732,7 @@ void ASTVisitor::OutputVarDecl(clang::VarDecl const* d, DumpNode const* dn)
     this->OS << " extern=\"1\"";
   }
   this->PrintMangledAttribute(d);
+  this->PrintAttributesAttribute(d);
 
   this->OS << "/>\n";
 }
diff --git a/src/Output.h b/src/Output.h
index 68f5e47..9df6391 100644
--- a/src/Output.h
+++ b/src/Output.h
@@ -16,7 +16,7 @@
 #ifndef CASTXML_OUTPUT_H
 #define CASTXML_OUTPUT_H
 
-#include <cxsys/Configure.hxx>
+#include <cxsys/Configure.h>
 
 namespace llvm {
   class raw_ostream;
diff --git a/src/RunClang.cxx b/src/RunClang.cxx
index d902123..6f35f2a 100644
--- a/src/RunClang.cxx
+++ b/src/RunClang.cxx
@@ -19,13 +19,12 @@
 #include "Output.h"
 #include "Utils.h"
 
-#include <cxsys/SystemTools.hxx>
-
 #include "llvm/Config/llvm-config.h"
 
 #include "clang/AST/ASTConsumer.h"
 #include "clang/AST/Decl.h"
 #include "clang/AST/DeclCXX.h"
+#include "clang/Basic/Version.h"
 #include "clang/Driver/Compilation.h"
 #include "clang/Driver/Driver.h"
 #include "clang/Driver/DriverDiagnostic.h"
@@ -41,9 +40,12 @@
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Option/ArgList.h"
+#include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Host.h"
+#include "llvm/Support/Path.h"
 #include "llvm/Support/raw_ostream.h"
 
+#include <cstdlib>
 #include <iostream>
 #include <memory>
 #include <queue>
@@ -133,30 +135,85 @@ protected:
   Options const& Opts;
 
   CastXMLPredefines(Options const& opts): Opts(opts) {}
-  std::string UpdatePredefines(std::string const& predefines) {
-    // Clang's InitializeStandardPredefinedMacros forces some
-    // predefines even when -undef is given.  Filter them out.
-    // Also substitute our chosen predefines prior to those that came
-    // from the command line.
+  std::string UpdatePredefines(clang::CompilerInstance const& CI) {
+    std::string const& predefines = CI.getPreprocessor().getPredefines();
+
+    // Identify the portion of the predefines string corresponding to
+    // built-in predefined macros.
     char const predef_start[] = "# 1 \"<built-in>\" 3\n";
     char const predef_end[] = "# 1 \"<command line>\" 1\n";
     std::string::size_type start = predefines.find(predef_start);
-    std::string::size_type end = predefines.find(predef_end);
-    if(start != std::string::npos && end != std::string::npos) {
-      return (predefines.substr(0, start+sizeof(predef_start)-1) +
-              this->Opts.Predefines +
-              predefines.substr(end));
+    std::string::size_type end = std::string::npos;
+    if (start != std::string::npos) {
+      start += sizeof(predef_start)-1;
+      end = predefines.find(predef_end, start);
+      if (end == std::string::npos) {
+        end = predefines.size();
+      }
+    }
+
+    std::string builtins;
+
+    // Add a builtin to identify CastXML itself.
+    char castxml_version[64];
+    sprintf(castxml_version, "#define __castxml__ %u\n", getVersionValue());
+    builtins += castxml_version;
+
+    // Add builtins to identify the internal Clang compiler.
+    builtins +=
+#define STR(x) STR_(x)
+#define STR_(x) #x
+      "#define __castxml_clang_major__ " STR(CLANG_VERSION_MAJOR) "\n"
+      "#define __castxml_clang_minor__ " STR(CLANG_VERSION_MINOR) "\n"
+      "#define __castxml_clang_patchlevel__ "
+#ifdef CLANG_VERSION_PATCHLEVEL
+      STR(CLANG_VERSION_PATCHLEVEL)
+#else
+      "0"
+#endif
+      "\n"
+#undef STR
+#undef STR_
+      ;
+
+    // If we detected predefines from another compiler, substitute them.
+    if (this->Opts.HaveCC) {
+      builtins += this->Opts.Predefines;
+
+      // Provide __float128 if simulating the actual GNU compiler.
+      if (this->NeedFloat128(this->Opts.Predefines)) {
+        // Clang provides its own (fake) builtin in gnu++11 mode.
+        // Otherwise we need to provide our own.
+        if (!(CI.getLangOpts().CPlusPlus11 &&
+              CI.getLangOpts().GNUMode)) {
+          builtins += "\n"
+            "typedef struct __castxml__float128 { "
+            "  char x[16] __attribute__((aligned(16))); "
+            "} __float128;\n"
+            ;
+        }
+      }
+
     } else {
-      return predefines + this->Opts.Predefines;
+      builtins += predefines.substr(start, end-start);
     }
+    return predefines.substr(0, start) + builtins + predefines.substr(end);
+  }
+
+  bool NeedFloat128(std::string const& pd) {
+    return (pd.find("#define __GNUC__ ") != pd.npos &&
+            pd.find("#define __clang__ ") == pd.npos &&
+            pd.find("#define __INTEL_COMPILER ") == pd.npos &&
+            pd.find("#define __CUDACC__ ") == pd.npos &&
+            pd.find("#define __PGI ") == pd.npos &&
+            (pd.find("#define __i386__ ") != pd.npos ||
+             pd.find("#define __x86_64__ ") != pd.npos ||
+             pd.find("#define __ia64__ ") != pd.npos));
   }
 
   bool BeginSourceFileAction(clang::CompilerInstance& CI,
                              llvm::StringRef /*Filename*/) {
-    if(this->Opts.HaveCC) {
-      CI.getPreprocessor().setPredefines(
-      this->UpdatePredefines(CI.getPreprocessor().getPredefines()));
-    }
+    CI.getPreprocessor().setPredefines(this->UpdatePredefines(CI));
 
     // Tell Clang not to tear down the parser at EOF.
     CI.getPreprocessor().enableIncrementalProcessing();
@@ -231,10 +288,6 @@ static bool runClangCI(clang::CompilerInstance* CI, Options const& opts)
       std::cerr << MSG("Objective C");
       return false;
     }
-    if(CI->getLangOpts().CPlusPlus14) {
-      std::cerr << MSG("c++14");
-      return false;
-    }
     if(CI->getLangOpts().C11) {
       std::cerr << MSG("c11");
       return false;
@@ -301,8 +354,8 @@ static int runClangImpl(const char* const* argBeg,
   // get system compiler setting arguments from the Driver.
   clang::driver::Driver d("clang", llvm::sys::getDefaultTargetTriple(),
                           *diags);
-  if(!cxsys::SystemTools::FileIsFullPath(d.ResourceDir.c_str()) ||
-     !cxsys::SystemTools::FileIsDirectory(d.ResourceDir.c_str())) {
+  if (!llvm::sys::path::is_absolute(d.ResourceDir) ||
+      !llvm::sys::fs::is_directory(d.ResourceDir)) {
     d.ResourceDir = getClangResourceDir();
   }
   llvm::SmallVector<const char *, 16> cArgs;
@@ -348,6 +401,9 @@ static int runClangImpl(const char* const* argBeg,
       const char* const* cmdArgEnd = cmdArgBeg + cmd->getArguments().size();
       if (clang::CompilerInvocation::CreateFromArgs
           (CI->getInvocation(), cmdArgBeg, cmdArgEnd, *diags)) {
+        if (diags->hasErrorOccurred()) {
+          return 1;
+        }
         result = runClangCI(CI.get(), opts) && result;
       } else {
         result = false;
@@ -373,6 +429,7 @@ int runClang(const char* const* argBeg,
 {
   llvm::SmallVector<const char*, 32> args(argBeg, argEnd);
   std::string fmsc_version = "-fmsc-version=";
+  std::string std_flag = "-std=";
 
   if(opts.HaveCC) {
     // Configure target to match that of given compiler.
@@ -401,11 +458,11 @@ int runClang(const char* const* argBeg,
     args.push_back("-undef");
 
     // Configure language options to match given compiler.
-    const char* pd = opts.Predefines.c_str();
-    if(strstr(pd, "#define _MSC_EXTENSIONS ")) {
+    std::string const& pd = opts.Predefines;
+    if(pd.find("#define _MSC_EXTENSIONS ") != pd.npos) {
       args.push_back("-fms-extensions");
     }
-    if(const char* d = strstr(pd, "#define _MSC_VER ")) {
+    if(const char* d = strstr(pd.c_str(), "#define _MSC_VER ")) {
       args.push_back("-fms-compatibility");
       // Extract the _MSC_VER value to give to -fmsc-version=.
       d += 17;
@@ -413,8 +470,96 @@ int runClang(const char* const* argBeg,
         if(*(e - 1) == '\r') {
           --e;
         }
-        fmsc_version.append(d, e-d);
+        std::string const msc_ver_str(d, e-d);
+        fmsc_version += msc_ver_str;
         args.push_back(fmsc_version.c_str());
+
+        if (!opts.HaveStd) {
+          if (pd.find("#define __cplusplus ") != pd.npos) {
+            // Extract the C++ level from _MSC_VER to give to -std=.
+            // Note that Clang also does this but old versions of Clang
+            // do not know about new versions of MSVC.
+            errno = 0;
+            long msc_ver = std::strtol(msc_ver_str.c_str(), nullptr, 10);
+            if (errno != 0) {
+              msc_ver = 1600;
+            }
+            if (msc_ver >= 1900) {
+              args.push_back("-std=c++14");
+            } else if (msc_ver >= 1600) {
+              args.push_back("-std=c++11");
+            } else {
+              args.push_back("-std=c++98");
+            }
+          } else {
+            args.push_back("-std=c89");
+          }
+        }
+      }
+    } else if (!opts.HaveStd) {
+      // Check for GNU extensions.
+      if (pd.find("#define __GNUC__ ") != pd.npos &&
+          pd.find("#define __STRICT_ANSI__ ") == pd.npos) {
+        std_flag += "gnu";
+      } else {
+        std_flag += "c";
+      }
+
+      if (const char* d = strstr(pd.c_str(), "#define __cplusplus ")) {
+        // Extract the C++ level to give to -std=.  We do this above for
+        // MSVC because it does not set __cplusplus to standard values.
+        d += 20;
+        if (const char* e = strchr(d, '\n')) {
+          if (*(e - 1) == '\r') {
+            --e;
+          }
+
+          // Add the standard year.
+          std::string const std_date_str(d, e-d);
+          errno = 0;
+          long std_date = std::strtol(std_date_str.c_str(), nullptr, 10);
+          if (errno != 0) {
+            std_date = 0;
+          }
+          std_flag += "++";
+          if (std_date >= 201406L) {
+            std_flag += "1z";
+          } else if (std_date >= 201402L) {
+            std_flag += "14";
+          } else if (std_date >= 201103L) {
+            std_flag += "11";
+          } else {
+            std_flag += "98";
+          }
+          args.push_back(std_flag.c_str());
+        }
+      } else if (const char* d =
+                 strstr(pd.c_str(), "#define __STDC_VERSION__ ")) {
+        // Extract the C standard level.
+        d += 25;
+        if (const char* e = strchr(d, '\n')) {
+          if (*(e - 1) == '\r') {
+            --e;
+          }
+          std::string const std_date_str(d, e-d);
+          errno = 0;
+          long std_date = std::strtol(std_date_str.c_str(), nullptr, 10);
+          if (errno != 0) {
+            std_date = 0;
+          }
+          if (std_date >= 201112L) {
+            std_flag += "11";
+          } else if (std_date >= 199901L) {
+            std_flag += "99";
+          } else {
+            std_flag += "89";
+          }
+          args.push_back(std_flag.c_str());
+        }
+      } else {
+        // Assume C 89.
+        std_flag += "89";
+        args.push_back(std_flag.c_str());
       }
     }
   }
diff --git a/src/Utils.cxx b/src/Utils.cxx
index 86c0036..400b563 100644
--- a/src/Utils.cxx
+++ b/src/Utils.cxx
@@ -18,8 +18,9 @@
 #include "Version.h"
 
 #include <cxsys/Process.h>
-#include <cxsys/SystemTools.hxx>
+#include <llvm/ADT/SmallString.h>
 #include <llvm/Support/FileSystem.h>
+#include <llvm/Support/Path.h>
 #include <fstream>
 #include <vector>
 
@@ -45,10 +46,10 @@ static bool tryBuildDir(std::string const& dir)
   std::ifstream cl_fin(cl_dir_txt.c_str());
   std::string src_dir;
   std::string cl_dir;
-  if(src_fin && cxsys::SystemTools::GetLineFromStream(src_fin, src_dir) &&
-     cxsys::SystemTools::FileIsDirectory(src_dir.c_str()) &&
-     cl_fin && cxsys::SystemTools::GetLineFromStream(cl_fin, cl_dir) &&
-     cxsys::SystemTools::FileIsDirectory(cl_dir.c_str())) {
+  if (std::getline(src_fin, src_dir) &&
+      llvm::sys::fs::is_directory(src_dir) &&
+      std::getline(cl_fin, cl_dir) &&
+      llvm::sys::fs::is_directory(cl_dir)) {
     castxmlResourceDir = src_dir + "/share/castxml";
     castxmlClangResourceDir = cl_dir;
     return true;
@@ -60,25 +61,28 @@ static bool tryBuildDir(std::string const& dir)
 bool findResourceDir(const char* argv0, std::ostream& error)
 {
   std::string exe = GetMainExecutable(argv0);
-  if(!cxsys::SystemTools::FileIsFullPath(exe.c_str())) {
+  if (!llvm::sys::path::is_absolute(exe)) {
     error << "error: unable to locate " << argv0 << "\n";
     return false;
   }
-  std::string exe_dir = cxsys::SystemTools::GetFilenamePath(exe);
 
   // Install tree has
   //   <prefix>/bin/castxml
   //   <prefix>/<CASTXML_INSTALL_DATA_DIR>
   //   <prefix>/<CASTXML_INSTALL_DATA_DIR>/clang
-  std::string dir = cxsys::SystemTools::GetFilenamePath(exe_dir);
-  castxmlResourceDir = dir + "/" + CASTXML_INSTALL_DATA_DIR;
+  llvm::SmallString<16> dir(exe);
+  llvm::sys::path::remove_filename(dir);
+  llvm::sys::path::remove_filename(dir);
+  castxmlResourceDir = std::string(dir.str()) + "/" + CASTXML_INSTALL_DATA_DIR;
   castxmlClangResourceDir = castxmlResourceDir + "/clang";
-  if(!cxsys::SystemTools::FileIsDirectory(castxmlResourceDir.c_str()) ||
-     !cxsys::SystemTools::FileIsDirectory(castxmlClangResourceDir.c_str())) {
+  if (!llvm::sys::fs::is_directory(castxmlResourceDir) ||
+      !llvm::sys::fs::is_directory(castxmlClangResourceDir)) {
+    llvm::SmallString<16> dir2(dir);
+    llvm::sys::path::remove_filename(dir2);
     // Build tree has
     //   <build>/bin[/<config>]/castxml
-    if(!tryBuildDir(dir) &&
-       !tryBuildDir(cxsys::SystemTools::GetFilenamePath(dir))) {
+    if (!tryBuildDir(dir.str()) &&
+        !tryBuildDir(dir2.str())) {
       error << "Unable to locate resources for " << exe << "\n";
       return false;
     }
@@ -102,7 +106,15 @@ std::string getClangResourceDir()
 //----------------------------------------------------------------------------
 std::string getVersionString()
 {
-  return CASTXML_VERSION;
+  return CASTXML_VERSION_STRING;
+}
+
+//----------------------------------------------------------------------------
+unsigned int getVersionValue()
+{
+  return (CASTXML_VERSION_MAJOR * 1000000 +
+          CASTXML_VERSION_MINOR *    1000 +
+          CASTXML_VERSION_PATCH *       1);
 }
 
 //----------------------------------------------------------------------------
diff --git a/src/Utils.h b/src/Utils.h
index 3d48d27..1baeb33 100644
--- a/src/Utils.h
+++ b/src/Utils.h
@@ -16,7 +16,7 @@
 #ifndef CASTXML_UTILS_H
 #define CASTXML_UTILS_H
 
-#include <cxsys/Configure.hxx>
+#include <cxsys/Configure.h>
 #include <string>
 
 /// findResources - Call from main() to find resources
@@ -33,6 +33,9 @@ std::string getClangResourceDir();
 /// getVersionString - Get the CastXML version string
 std::string getVersionString();
 
+/// getVersionValue - Get CastXML version encoded as %d%03d%03d
+unsigned int getVersionValue();
+
 /// runCommand - Run a given command line and capture the output.
 bool runCommand(int argc, const char* const* argv,
                 int& ret, std::string& out, std::string& err,
diff --git a/src/Version.cmake b/src/Version.cmake
index b9697e6..03a029d 100644
--- a/src/Version.cmake
+++ b/src/Version.cmake
@@ -39,10 +39,22 @@ elseif(COMMAND _git)
       set(CastXML_VERSION "${CastXML_VERSION}-git")
     endif()
   endif()
-elseif("8a08a44" MATCHES "^([0-9a-f]+)$")
+elseif("fc71eb9" MATCHES "^([0-9a-f]+)$")
   # Use version exported by 'git archive'.
   set(CastXML_VERSION "${CastXML_VERSION}-g${CMAKE_MATCH_1}")
 else()
   # Generic development version.
   set(CastXML_VERSION "${CastXML_VERSION}-git")
 endif()
+
+if(CastXML_VERSION MATCHES "^([0-9]+)\\.([0-9]+)(\\.([0-9]+))?")
+  set(CastXML_VERSION_MAJOR "${CMAKE_MATCH_1}")
+  set(CastXML_VERSION_MINOR "${CMAKE_MATCH_2}")
+  if(CMAKE_MATCH_4)
+    set(CastXML_VERSION_PATCH "${CMAKE_MATCH_4}")
+  else()
+    set(CastXML_VERSION_PATCH 0)
+  endif()
+else()
+  message(FATAL_ERROR "Failed to extract version components from '${CastXML_VERSION}'")
+endif()
diff --git a/src/Version.h.in b/src/Version.h.in
index cff30c1..3290311 100644
--- a/src/Version.h.in
+++ b/src/Version.h.in
@@ -16,6 +16,9 @@
 #ifndef CASTXML_VERSION_H
 #define CASTXML_VERSION_H
 
-#define CASTXML_VERSION "@CastXML_VERSION@"
+#define CASTXML_VERSION_STRING "@CastXML_VERSION@"
+#define CASTXML_VERSION_MAJOR @CastXML_VERSION_MAJOR@
+#define CASTXML_VERSION_MINOR @CastXML_VERSION_MINOR@
+#define CASTXML_VERSION_PATCH @CastXML_VERSION_PATCH@
 
 #endif // CASTXML_VERSION_H
diff --git a/src/castxml.cxx b/src/castxml.cxx
index bd05beb..f3cb861 100644
--- a/src/castxml.cxx
+++ b/src/castxml.cxx
@@ -71,7 +71,10 @@ int main(int argc_in, const char** argv_in)
   }
 
 #if LLVM_VERSION_MAJOR > 3 \
- || LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 7
+ || LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 8
+  llvm::BumpPtrAllocator argSaverAlloc;
+  llvm::StringSaver argSaver(argSaverAlloc);
+#elif LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR == 7
   llvm::BumpPtrAllocator argSaverAlloc;
   llvm::BumpPtrStringSaver argSaver(argSaverAlloc);
 #else
@@ -98,8 +101,8 @@ int main(int argc_in, const char** argv_in)
     "  --castxml-cc-<id> \"(\" <cc> <cc-opt>... \")\"\n"
     "    Configure the internal Clang preprocessor and target\n"
     "    platform to match that of the given compiler command.\n"
-    "    The <id> must be \"gnu\" or \"msvc\".  <cc> names a\n"
-    "    compiler (e.g. \"gcc\") and <cc-opt>... specifies\n"
+    "    The <id> must be \"gnu\", \"msvc\", \"gnu-c\", or \"msvc-c\".\n"
+    "    <cc> names a compiler (e.g. \"gcc\") and <cc-opt>... specifies\n"
     "    options that may affect its target (e.g. \"-m32\").\n"
     "\n"
     "  --castxml-gccxml\n"
@@ -254,6 +257,8 @@ int main(int argc_in, const char** argv_in)
           strncmp(argv[i], "-target=", 8) == 0 ||
           strncmp(argv[i], "--target=", 9) == 0) {
         opts.HaveTarget = true;
+      } else if (strncmp(argv[i], "-std=", 5) == 0) {
+        opts.HaveStd = true;
       }
     }
   }
diff --git a/src/kwsys/.gitattributes b/src/kwsys/.gitattributes
new file mode 100644
index 0000000..248786e
--- /dev/null
+++ b/src/kwsys/.gitattributes
@@ -0,0 +1,16 @@
+.git*            export-ignore
+.gitattributes  -export-ignore
+
+/GitSetup        export-ignore
+/SetupForDevelopment.sh  export-ignore  eol=lf
+
+/CONTRIBUTING.rst conflict-marker-size=78
+
+*.c              whitespace=tab-in-indent,no-lf-at-eof
+*.h              whitespace=tab-in-indent,no-lf-at-eof
+*.h.in           whitespace=tab-in-indent,no-lf-at-eof
+*.cxx            whitespace=tab-in-indent,no-lf-at-eof
+*.hxx            whitespace=tab-in-indent,no-lf-at-eof
+*.hxx.in         whitespace=tab-in-indent,no-lf-at-eof
+*.txt            whitespace=tab-in-indent,no-lf-at-eof
+*.cmake          whitespace=tab-in-indent,no-lf-at-eof
diff --git a/src/kwsys/Base64.c b/src/kwsys/Base64.c
deleted file mode 100644
index d07bdd0..0000000
--- a/src/kwsys/Base64.c
+++ /dev/null
@@ -1,279 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#include "kwsysPrivate.h"
-#include KWSYS_HEADER(Base64.h)
-
-/* Work-around CMake dependency scanning limitation.  This must
-   duplicate the above list of headers.  */
-#if 0
-# include "Base64.h.in"
-#endif
-
-/*--------------------------------------------------------------------------*/
-static const unsigned char kwsysBase64EncodeTable[65] =
-"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-"abcdefghijklmnopqrstuvwxyz"
-"0123456789+/";
-
-/*--------------------------------------------------------------------------*/
-static const unsigned char kwsysBase64DecodeTable[256] =
-{
-  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
-  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
-  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
-  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
-  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
-  0xFF,0xFF,0xFF,0x3E,0xFF,0xFF,0xFF,0x3F,
-  0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,
-  0x3C,0x3D,0xFF,0xFF,0xFF,0x00,0xFF,0xFF,
-  0xFF,0x00,0x01,0x02,0x03,0x04,0x05,0x06,
-  0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,
-  0x0F,0x10,0x11,0x12,0x13,0x14,0x15,0x16,
-  0x17,0x18,0x19,0xFF,0xFF,0xFF,0xFF,0xFF,
-  0xFF,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F,0x20,
-  0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,
-  0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F,0x30,
-  0x31,0x32,0x33,0xFF,0xFF,0xFF,0xFF,0xFF,
-  /*------------------------------------*/
-  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
-  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
-  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
-  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
-  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
-  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
-  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
-  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
-  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
-  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
-  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
-  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
-  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
-  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
-  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
-  0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF
-};
-
-/*--------------------------------------------------------------------------*/
-static unsigned char kwsysBase64EncodeChar(int c)
-{
-  return kwsysBase64EncodeTable[(unsigned char)c];
-}
-
-/*--------------------------------------------------------------------------*/
-static unsigned char kwsysBase64DecodeChar(unsigned char c)
-{
-  return kwsysBase64DecodeTable[c];
-}
-
-/*--------------------------------------------------------------------------*/
-/* Encode 3 bytes into a 4 byte string. */
-void kwsysBase64_Encode3(const unsigned char *src, unsigned char *dest)
-{
-  dest[0] = kwsysBase64EncodeChar((src[0] >> 2) & 0x3F);
-  dest[1] = kwsysBase64EncodeChar(((src[0] << 4) & 0x30)|((src[1] >> 4) & 0x0F));
-  dest[2] = kwsysBase64EncodeChar(((src[1] << 2) & 0x3C)|((src[2] >> 6) & 0x03));
-  dest[3] = kwsysBase64EncodeChar(src[2] & 0x3F);
-}
-
-/*--------------------------------------------------------------------------*/
-/* Encode 2 bytes into a 4 byte string. */
-void kwsysBase64_Encode2(const unsigned char *src, unsigned char *dest)
-{
-  dest[0] = kwsysBase64EncodeChar((src[0] >> 2) & 0x3F);
-  dest[1] = kwsysBase64EncodeChar(((src[0] << 4) & 0x30)|((src[1] >> 4) & 0x0F));
-  dest[2] = kwsysBase64EncodeChar(((src[1] << 2) & 0x3C));
-  dest[3] = '=';
-}
-
-/*--------------------------------------------------------------------------*/
-/* Encode 1 bytes into a 4 byte string. */
-void kwsysBase64_Encode1(const unsigned char *src, unsigned char *dest)
-{
-  dest[0] = kwsysBase64EncodeChar((src[0] >> 2) & 0x3F);
-  dest[1] = kwsysBase64EncodeChar(((src[0] << 4) & 0x30));
-  dest[2] = '=';
-  dest[3] = '=';
-}
-
-/*--------------------------------------------------------------------------*/
-/* Encode 'length' bytes from the input buffer and store the
-   encoded stream into the output buffer. Return the length of the encoded
-   buffer (output). Note that the output buffer must be allocated by the caller
-   (length * 1.5 should be a safe estimate).  If 'mark_end' is true than an
-   extra set of 4 bytes is added to the end of the stream if the input is a
-   multiple of 3 bytes.  These bytes are invalid chars and therefore they will
-   stop the decoder thus enabling the caller to decode a stream without
-   actually knowing how much data to expect (if the input is not a multiple of
-   3 bytes then the extra padding needed to complete the encode 4 bytes will
-   stop the decoding anyway).  */
-unsigned long kwsysBase64_Encode(const unsigned char *input,
-                                 unsigned long length,
-                                 unsigned char *output,
-                                 int mark_end)
-{
-  const unsigned char *ptr = input;
-  const unsigned char *end = input + length;
-  unsigned char *optr = output;
-
-  /* Encode complete triplet */
-
-  while ((end - ptr) >= 3)
-    {
-    kwsysBase64_Encode3(ptr, optr);
-    ptr += 3;
-    optr += 4;
-    }
-
-  /* Encodes a 2-byte ending into 3 bytes and 1 pad byte and writes. */
-
-  if (end - ptr == 2)
-    {
-    kwsysBase64_Encode2(ptr, optr);
-    optr += 4;
-    }
-
-  /* Encodes a 1-byte ending into 2 bytes and 2 pad bytes */
-  
-  else if (end - ptr == 1)
-    {
-    kwsysBase64_Encode1(ptr, optr);
-    optr += 4;
-    }
-
-  /* Do we need to mark the end */
-
-  else if (mark_end)
-    {
-    optr[0] = optr[1] = optr[2] = optr[3] = '=';
-    optr += 4;
-    }
-
-  return (unsigned long)(optr - output);
-}
-
-/*--------------------------------------------------------------------------*/
-/* Decode 4 bytes into a 3 byte string. */
-int kwsysBase64_Decode3(const unsigned char *src, unsigned char *dest)
-{
-  unsigned char d0, d1, d2, d3;
-
-  d0 = kwsysBase64DecodeChar(src[0]);
-  d1 = kwsysBase64DecodeChar(src[1]);
-  d2 = kwsysBase64DecodeChar(src[2]);
-  d3 = kwsysBase64DecodeChar(src[3]);
-  
-  /* Make sure all characters were valid */
-
-  if (d0 == 0xFF || d1 == 0xFF || d2 == 0xFF || d3 == 0xFF)
-    { 
-    return 0; 
-    }
-  
-  /* Decode the 3 bytes */
-
-  dest[0] = (unsigned char)(((d0 << 2) & 0xFC) | ((d1 >> 4) & 0x03));
-  dest[1] = (unsigned char)(((d1 << 4) & 0xF0) | ((d2 >> 2) & 0x0F));
-  dest[2] = (unsigned char)(((d2 << 6) & 0xC0) | ((d3 >> 0) & 0x3F));
-  
-  /* Return the number of bytes actually decoded */
-
-  if (src[2] == '=') 
-    { 
-    return 1; 
-    }
-  if (src[3] == '=') 
-    { 
-    return 2; 
-    }
-  return 3;
-}
-
-/*--------------------------------------------------------------------------*/
-/* Decode bytes from the input buffer and store the decoded stream 
-   into the output buffer until 'length' bytes have been decoded.  Return the
-   real length of the decoded stream (which should be equal to 'length'). Note
-   that the output buffer must be allocated by the caller.  If
-   'max_input_length' is not null, then it specifies the number of encoded
-   bytes that should be at most read from the input buffer. In that case the
-   'length' parameter is ignored. This enables the caller to decode a stream
-   without actually knowing how much decoded data to expect (of course, the
-   buffer must be large enough). */
-unsigned long kwsysBase64_Decode(const unsigned char *input, 
-                                 unsigned long length,
-                                 unsigned char *output,
-                                 unsigned long max_input_length)
-{
-  const unsigned char *ptr = input;
-  unsigned char *optr = output;
-
-  /* Decode complete triplet */
-
-  if (max_input_length)
-    {
-    const unsigned char *end = input + max_input_length;
-    while (ptr < end)
-      {
-      int len = kwsysBase64_Decode3(ptr, optr);
-      optr += len;
-      if(len < 3)
-        {
-        return (unsigned long)(optr - output);
-        }
-      ptr += 4;
-      }
-    } 
-  else 
-    {
-    unsigned char *oend = output + length;
-    while ((oend - optr) >= 3)
-      {
-      int len = kwsysBase64_Decode3(ptr, optr);
-      optr += len;
-      if(len < 3)
-        {
-        return (unsigned long)(optr - output);
-        }
-      ptr += 4;
-      }
-
-    /* Decode the last triplet */
-  
-    if (oend - optr == 2)
-      {
-      unsigned char temp[3];
-      int len = kwsysBase64_Decode3(ptr, temp);
-      if(len >= 2)
-        {
-        optr[0] = temp[0];
-        optr[1] = temp[1];
-        optr += 2;
-        }
-      else if(len > 0)
-        {
-        optr[0] = temp[0];
-        optr += 1;
-        }
-      }
-    else if (oend - optr == 1)
-      {
-      unsigned char temp[3];
-      int len = kwsysBase64_Decode3(ptr, temp);
-      if(len > 0)
-        {
-        optr[0] = temp[0];
-        optr += 1;
-        }
-      }
-    }
-
-  return (unsigned long)(optr - output);
-}
diff --git a/src/kwsys/Base64.h.in b/src/kwsys/Base64.h.in
deleted file mode 100644
index 3468007..0000000
--- a/src/kwsys/Base64.h.in
+++ /dev/null
@@ -1,120 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef @KWSYS_NAMESPACE at _Base64_h
-#define @KWSYS_NAMESPACE at _Base64_h
-
-#include <@KWSYS_NAMESPACE@/Configure.h>
-
-/* Redefine all public interface symbol names to be in the proper
-   namespace.  These macros are used internally to kwsys only, and are
-   not visible to user code.  Use kwsysHeaderDump.pl to reproduce
-   these macros after making changes to the interface.  */
-#if !defined(KWSYS_NAMESPACE)
-# define kwsys_ns(x) @KWSYS_NAMESPACE@##x
-# define kwsysEXPORT @KWSYS_NAMESPACE at _EXPORT
-#endif
-#if !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
-# define kwsysBase64          kwsys_ns(Base64)
-# define kwsysBase64_Decode   kwsys_ns(Base64_Decode)
-# define kwsysBase64_Decode3  kwsys_ns(Base64_Decode3)
-# define kwsysBase64_Encode   kwsys_ns(Base64_Encode)
-# define kwsysBase64_Encode1  kwsys_ns(Base64_Encode1)
-# define kwsysBase64_Encode2  kwsys_ns(Base64_Encode2)
-# define kwsysBase64_Encode3  kwsys_ns(Base64_Encode3)
-#endif
-
-#if defined(__cplusplus)
-extern "C"
-{
-#endif
-
-/**
- * Encode 3 bytes into a 4 byte string.
- */
-kwsysEXPORT void kwsysBase64_Encode3(const unsigned char *src,
-                                     unsigned char *dest);
-
-/**
- * Encode 2 bytes into a 4 byte string.
- */
-kwsysEXPORT void kwsysBase64_Encode2(const unsigned char *src,
-                                     unsigned char *dest);
-
-/**
- * Encode 1 bytes into a 4 byte string.
- */
-kwsysEXPORT void kwsysBase64_Encode1(const unsigned char *src,
-                                     unsigned char *dest);
-
-/**
- * Encode 'length' bytes from the input buffer and store the encoded
- * stream into the output buffer. Return the length of the encoded
- * buffer (output). Note that the output buffer must be allocated by
- * the caller (length * 1.5 should be a safe estimate).  If 'mark_end'
- * is true than an extra set of 4 bytes is added to the end of the
- * stream if the input is a multiple of 3 bytes.  These bytes are
- * invalid chars and therefore they will stop the decoder thus
- * enabling the caller to decode a stream without actually knowing how
- * much data to expect (if the input is not a multiple of 3 bytes then
- * the extra padding needed to complete the encode 4 bytes will stop
- * the decoding anyway).
- */
-kwsysEXPORT unsigned long kwsysBase64_Encode(const unsigned char *input,
-                                             unsigned long length,
-                                             unsigned char *output,
-                                             int mark_end);
-
-/**
- * Decode 4 bytes into a 3 byte string.  Returns the number of bytes
- * actually decoded.
- */
-kwsysEXPORT int kwsysBase64_Decode3(const unsigned char *src,
-                                    unsigned char *dest);
-
-/**
- * Decode bytes from the input buffer and store the decoded stream
- * into the output buffer until 'length' bytes have been decoded.
- * Return the real length of the decoded stream (which should be equal
- * to 'length'). Note that the output buffer must be allocated by the
- * caller.  If 'max_input_length' is not null, then it specifies the
- * number of encoded bytes that should be at most read from the input
- * buffer. In that case the 'length' parameter is ignored. This
- * enables the caller to decode a stream without actually knowing how
- * much decoded data to expect (of course, the buffer must be large
- * enough).
- */
-kwsysEXPORT unsigned long kwsysBase64_Decode(const unsigned char *input, 
-                                             unsigned long length,
-                                             unsigned char *output,
-                                             unsigned long max_input_length);
-
-#if defined(__cplusplus)
-} /* extern "C" */
-#endif
-
-/* If we are building a kwsys .c or .cxx file, let it use these macros.
-   Otherwise, undefine them to keep the namespace clean.  */
-#if !defined(KWSYS_NAMESPACE)
-# undef kwsys_ns
-# undef kwsysEXPORT
-# if !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
-#  undef kwsysBase64
-#  undef kwsysBase64_Decode
-#  undef kwsysBase64_Decode3
-#  undef kwsysBase64_Encode
-#  undef kwsysBase64_Encode1
-#  undef kwsysBase64_Encode2
-#  undef kwsysBase64_Encode3
-# endif
-#endif
-
-#endif
diff --git a/src/kwsys/CMakeEmptyInputFile.in b/src/kwsys/CMakeEmptyInputFile.in
deleted file mode 100644
index 40b7ea2..0000000
--- a/src/kwsys/CMakeEmptyInputFile.in
+++ /dev/null
@@ -1 +0,0 @@
- at CMAKE_EMPTY_INPUT_FILE_CONTENT@
diff --git a/src/kwsys/CMakeLists.txt b/src/kwsys/CMakeLists.txt
index 8069ee2..9b26553 100644
--- a/src/kwsys/CMakeLists.txt
+++ b/src/kwsys/CMakeLists.txt
@@ -88,6 +88,9 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3 FATAL_ERROR)
 IF(POLICY CMP0025)
   CMAKE_POLICY(SET CMP0025 NEW)
 ENDIF()
+IF(POLICY CMP0056)
+  CMAKE_POLICY(SET CMP0056 NEW)
+ENDIF()
 
 #-----------------------------------------------------------------------------
 # If a namespace is not specified, use "kwsys" and enable testing.
@@ -338,6 +341,7 @@ ENDIF()
 # capabilities and parent project's request.  Enforce 0/1 as only
 # possible values for configuration into Configure.hxx.
 
+IF(0) # Not used by CastXML
 KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAVE_STD
   "Checking whether STL classes are in std namespace" DIRECT)
 
@@ -474,6 +478,7 @@ IF(KWSYS_CXX_HAS___INT64)
     ENDIF()
   ENDIF()
 ENDIF()
+ENDIF()
 
 IF(KWSYS_USE_FundamentalType)
   # Look for type size helper macros.
@@ -537,11 +542,13 @@ IF(KWSYS_USE_FundamentalType)
     "Checking whether char is signed" DIRECT)
 ENDIF()
 
+IF(0) # Not used by CastXML
 IF(KWSYS_USE_Encoding)
   # Look for type size helper macros.
   KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_WSTRING
     "Checking whether wstring is available" DIRECT)
 ENDIF()
+ENDIF()
 
 IF(KWSYS_USE_IOStream)
   # Determine whether iostreams support long long.
@@ -783,6 +790,15 @@ IF(KWSYS_USE_SystemInformation)
     SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
       COMPILE_DEFINITIONS KWSYS_BUILD_SHARED=1)
   ENDIF()
+
+  IF(UNIX AND NOT CYGWIN)
+    KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_GETLOADAVG
+      "Checking whether CXX compiler has getloadavg" DIRECT)
+    IF(KWSYS_CXX_HAS_GETLOADAVG)
+      SET_PROPERTY(SOURCE SystemInformation.cxx APPEND PROPERTY
+        COMPILE_DEFINITIONS KWSYS_CXX_HAS_GETLOADAVG=1)
+    ENDIF()
+  ENDIF()
 ENDIF()
 
 #-----------------------------------------------------------------------------
@@ -812,6 +828,7 @@ ENDIF()
 #-----------------------------------------------------------------------------
 # Create STL header wrappers to block warnings in the STL headers and
 # give standard names by which they may be included.
+IF(0) # Not used by CastXML
 SET(KWSYS_STL_HEADER_EXTRA_string 1)
 FOREACH(header
   algorithm
@@ -886,11 +903,14 @@ FOREACH(header iostream fstream sstream iosfwd)
       ${KWSYS_INSTALL_INCLUDE_OPTIONS})
   ENDIF()
 ENDFOREACH()
+ENDIF()
 
 #-----------------------------------------------------------------------------
 # Build a list of classes and headers we need to implement the
 # selected components.  Initialize with required components.
 SET(KWSYS_CLASSES)
+SET(KWSYS_H_FILES Configure) # CastXML needs only this.
+IF(0) # Not used by CastXML
 SET(KWSYS_H_FILES Configure SharedForward)
 SET(KWSYS_HXX_FILES Configure String
   hashtable hash_fun hash_map hash_set
@@ -913,6 +933,7 @@ FOREACH(cpp ${cppclasses})
     ENDIF()
   ENDIF()
 ENDFOREACH()
+ENDIF()
 
 # Add selected C components.
 FOREACH(c
@@ -1059,7 +1080,7 @@ IF(KWSYS_ENABLE_C AND KWSYS_C_SRCS)
 
   # Apply user-defined target properties to the library.
   IF(KWSYS_PROPERTIES_C)
-    SET_TARGET_PROPERTIES(${KWSYS_NAMESPACE} PROPERTIES
+    SET_TARGET_PROPERTIES(${KWSYS_NAMESPACE}_c PROPERTIES
       ${KWSYS_PROPERTIES_C}
       )
   ENDIF()
@@ -1225,7 +1246,7 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
     IF(NOT CYGWIN)
       SET(KWSYS_TEST_PROCESS_7 7)
     ENDIF()
-    FOREACH(n 1 2 3 4 5 6 ${KWSYS_TEST_PROCESS_7})
+    FOREACH(n 1 2 3 4 5 6 ${KWSYS_TEST_PROCESS_7} 9 10)
       ADD_TEST(kwsys.testProcess-${n} ${EXEC_DIR}/${KWSYS_NAMESPACE}TestProcess ${n})
       SET_PROPERTY(TEST kwsys.testProcess-${n} PROPERTY LABELS ${KWSYS_LABELS_TEST})
       SET_TESTS_PROPERTIES(kwsys.testProcess-${n} PROPERTIES TIMEOUT 120)
@@ -1258,6 +1279,10 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
       MESSAGE(STATUS "GET_TEST_PROPERTY returned: ${wfv}")
     ENDIF()
 
+    # Set up ctest custom configuration file.
+    CONFIGURE_FILE(${PROJECT_SOURCE_DIR}/CTestCustom.cmake.in
+                   ${PROJECT_BINARY_DIR}/CTestCustom.cmake @ONLY)
+
     # Suppress known consistent failures on buggy systems.
     IF(KWSYS_TEST_BOGUS_FAILURES)
       SET_TESTS_PROPERTIES(${KWSYS_TEST_BOGUS_FAILURES} PROPERTIES WILL_FAIL ON)
diff --git a/src/kwsys/CONTRIBUTING.rst b/src/kwsys/CONTRIBUTING.rst
new file mode 100644
index 0000000..960eea4
--- /dev/null
+++ b/src/kwsys/CONTRIBUTING.rst
@@ -0,0 +1,35 @@
+Contributing to KWSys
+*********************
+
+Overview
+========
+
+KWSys is kept in its own Git repository and shared by several projects
+via copies in their source trees.  Changes to KWSys should not be made
+directly in a host project, except perhaps in maintenance branches.
+
+Please visit
+
+  http://public.kitware.com/Wiki/KWSys/Git
+
+to contribute changes directly to KWSys upstream.  Once changes are
+reviewed, tested, and integrated there then the copies of KWSys within
+dependent projects can be updated to get the changes.
+
+Issues
+======
+
+KWSys has no independent issue tracker.  After encountering an issue
+(bug) please try to submit a patch using the above instructions.
+Otherwise please report the issue to the tracker for the project that
+hosts the copy of KWSys in which the problem was found.
+
+License
+=======
+
+We do not require any formal copyright assignment or contributor license
+agreement.  Any contributions intentionally sent upstream are presumed
+to be offered under terms of the OSI-approved BSD 3-clause License.
+See `Copyright.txt`_ for details.
+
+.. _`Copyright.txt`: Copyright.txt
diff --git a/src/kwsys/CPU.h.in b/src/kwsys/CPU.h.in
deleted file mode 100644
index 626914b..0000000
--- a/src/kwsys/CPU.h.in
+++ /dev/null
@@ -1,129 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef @KWSYS_NAMESPACE at _CPU_h
-#define @KWSYS_NAMESPACE at _CPU_h
-
-#include <@KWSYS_NAMESPACE@/Configure.h>
-
-/* Identify possible endian cases.  The macro
-   @KWSYS_NAMESPACE at _CPU_ENDIAN_ID will be defined to one of these, or
-   0 if unknown.  */
-#define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_BIG    4321
-#define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_LITTLE 1234
-
-/* Apple always defines one of these.  */
-#if defined(__LITTLE_ENDIAN__)
-# define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_LITTLE
-#elif defined(__BIG_ENDIAN__)
-# define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_BIG
-
-/* Alpha */
-#elif defined(__alpha) || defined(__alpha__) || defined(_M_ALPHA)
-# define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_LITTLE
-
-/* Arm */
-#elif defined(__arm__)
-# if !defined(__ARMEB__)
-#  define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_LITTLE
-# else
-#  define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_BIG
-# endif
-
-/* Intel x86 */
-#elif defined(__i386) || defined(__i386__) || defined(_M_IX86)
-# define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_LITTLE
-#elif defined(_X86_) || defined(__THW_INTEL__) || defined(__I86__)
-# define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_LITTLE
-#elif defined(__MWERKS__) && defined(__INTEL__)
-# define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_LITTLE
-
-/* Intel x86-64 */
-#elif defined(__x86_64) || defined(__x86_64__) || defined(_M_X64)
-# define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_LITTLE
-#elif defined(__amd64) || defined(__amd64__)
-# define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_LITTLE
-
-/* Intel Architecture-64 (Itanium) */
-#elif defined(__ia64) || defined(__ia64__)
-# define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_LITTLE
-#elif defined(_IA64) || defined(__IA64__) || defined(_M_IA64)
-# define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_LITTLE
-
-/* PowerPC */
-#elif defined(__powerpc) || defined(__powerpc__)
-# define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_BIG
-#elif defined(__ppc) || defined(__ppc__) || defined(__POWERPC__)
-# define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_BIG
-
-/* SPARC */
-#elif defined(__sparc) || defined(__sparc__)
-# define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_BIG
-
-/* HP/PA RISC */
-#elif defined(__hppa) || defined(__hppa__)
-# define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_BIG
-
-/* Motorola 68k */
-#elif defined(__m68k__) || defined(M68000)
-# define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_BIG
-
-/* MIPS */
-#elif defined(__mips) || defined(__mips__) || defined(__MIPS__)
-# define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_BIG
-
-/* OpenRISC 1000 */
-#elif defined(__or1k__)
-# define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_BIG
-
-/* RS/6000 */
-#elif defined(__THW_RS600) || defined(_IBMR2) || defined(_POWER)
-# define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_BIG
-#elif defined(_ARCH_PWR) || defined(_ARCH_PWR2)
-# define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_BIG
-
-/* System/370 */
-#elif defined(__370__) || defined(__THW_370__)
-# define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_BIG
-
-/* System/390 */
-#elif defined(__s390__) || defined(__s390x__)
-# define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_BIG
-
-/* z/Architecture */
-#elif defined(__SYSC_ZARCH__)
-# define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_BIG
-
-/* Aarch64 */
-#elif defined(__aarch64__)
-# if !defined(__AARCH64EB__)
-#  define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_LITTLE
-# else
-#  define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_BIG
-# endif
-
-/* Unknown CPU */
-#else
-# define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID 0
-# if !defined(@KWSYS_NAMESPACE at _CPU_UNKNOWN_OKAY)
-#  error "The target CPU architecture is not known."
-# endif
-#endif
-
-/* If building a C or C++ file in kwsys itself, give the source file
-   access to the macros without a configured namespace.  */
-#if defined(KWSYS_NAMESPACE)
-# define KWSYS_CPU_ENDIAN_ID        @KWSYS_NAMESPACE at _CPU_ENDIAN_ID
-# define KWSYS_CPU_ENDIAN_ID_BIG    @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_BIG
-# define KWSYS_CPU_ENDIAN_ID_LITTLE @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_LITTLE
-#endif
-
-#endif
diff --git a/src/kwsys/CTestConfig.cmake b/src/kwsys/CTestConfig.cmake
deleted file mode 100644
index 3954dd7..0000000
--- a/src/kwsys/CTestConfig.cmake
+++ /dev/null
@@ -1,17 +0,0 @@
-#=============================================================================
-# KWSys - Kitware System Library
-# Copyright 2000-2012 Kitware, Inc., Insight Software Consortium
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-set(CTEST_PROJECT_NAME "KWSys")
-set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT")
-set(CTEST_DROP_METHOD "http")
-set(CTEST_DROP_SITE "open.cdash.org")
-set(CTEST_DROP_LOCATION "/submit.php?project=KWSys")
-set(CTEST_DROP_SITE_CDASH TRUE)
diff --git a/src/kwsys/CommandLineArguments.cxx b/src/kwsys/CommandLineArguments.cxx
deleted file mode 100644
index 9fa9802..0000000
--- a/src/kwsys/CommandLineArguments.cxx
+++ /dev/null
@@ -1,859 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#include "kwsysPrivate.h"
-#include KWSYS_HEADER(CommandLineArguments.hxx)
-
-#include KWSYS_HEADER(Configure.hxx)
-#include KWSYS_HEADER(String.hxx)
-
-#include KWSYS_HEADER(stl/vector)
-#include KWSYS_HEADER(stl/map)
-#include KWSYS_HEADER(stl/set)
-#include KWSYS_HEADER(ios/sstream)
-#include KWSYS_HEADER(ios/iostream)
-
-// Work-around CMake dependency scanning limitation.  This must
-// duplicate the above list of headers.
-#if 0
-# include "CommandLineArguments.hxx.in"
-# include "Configure.hxx.in"
-# include "kwsys_stl.hxx.in"
-# include "kwsys_ios_sstream.h.in"
-# include "kwsys_ios_iostream.h.in"
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef _MSC_VER
-# pragma warning (disable: 4786)
-#endif
-
-#if defined(__sgi) && !defined(__GNUC__)
-# pragma set woff 1375 /* base class destructor not virtual */
-#endif
-
-#if 0
-#  define CommandLineArguments_DEBUG(x) \
-  kwsys_ios::cout << __LINE__ << " CLA: " << x << kwsys_ios::endl
-#else
-#  define CommandLineArguments_DEBUG(x)
-#endif
-
-namespace KWSYS_NAMESPACE
-{
-
-//----------------------------------------------------------------------------
-//============================================================================
-struct CommandLineArgumentsCallbackStructure
-{
-  const char* Argument;
-  int ArgumentType;
-  CommandLineArguments::CallbackType Callback;
-  void* CallData;
-  void* Variable;
-  int VariableType;
-  const char* Help;
-};
- 
-class CommandLineArgumentsVectorOfStrings : 
-  public kwsys_stl::vector<kwsys::String> {};
-class CommandLineArgumentsSetOfStrings :
-  public kwsys_stl::set<kwsys::String> {};
-class CommandLineArgumentsMapOfStrucs : 
-  public kwsys_stl::map<kwsys::String,
-    CommandLineArgumentsCallbackStructure> {};
-
-class CommandLineArgumentsInternal
-{
-public:
-  CommandLineArgumentsInternal()
-    {
-    this->UnknownArgumentCallback = 0;
-    this->ClientData = 0;
-    this->LastArgument = 0;
-    }
-
-  typedef CommandLineArgumentsVectorOfStrings VectorOfStrings;
-  typedef CommandLineArgumentsMapOfStrucs CallbacksMap;
-  typedef kwsys::String String;
-  typedef CommandLineArgumentsSetOfStrings SetOfStrings;
-
-  VectorOfStrings Argv;
-  String Argv0;
-  CallbacksMap Callbacks;
-
-  CommandLineArguments::ErrorCallbackType UnknownArgumentCallback;
-  void*             ClientData;
-
-  VectorOfStrings::size_type LastArgument;
-
-  VectorOfStrings UnusedArguments;
-};
-//============================================================================
-//----------------------------------------------------------------------------
-
-//----------------------------------------------------------------------------
-CommandLineArguments::CommandLineArguments()
-{
-  this->Internals = new CommandLineArguments::Internal;
-  this->Help = "";
-  this->LineLength = 80;
-  this->StoreUnusedArgumentsFlag = false;
-}
-
-//----------------------------------------------------------------------------
-CommandLineArguments::~CommandLineArguments()
-{
-  delete this->Internals;
-}
-
-//----------------------------------------------------------------------------
-void CommandLineArguments::Initialize(int argc, const char* const argv[])
-{
-  int cc;
-
-  this->Initialize();
-  this->Internals->Argv0 = argv[0];
-  for ( cc = 1; cc < argc; cc ++ )
-    {
-    this->ProcessArgument(argv[cc]);
-    }
-}
-
-//----------------------------------------------------------------------------
-void CommandLineArguments::Initialize(int argc, char* argv[])
-{
-  this->Initialize(argc, static_cast<const char* const*>(argv));
-}
-
-//----------------------------------------------------------------------------
-void CommandLineArguments::Initialize()
-{
-  this->Internals->Argv.clear();
-  this->Internals->LastArgument = 0;
-}
-
-//----------------------------------------------------------------------------
-void CommandLineArguments::ProcessArgument(const char* arg)
-{
-  this->Internals->Argv.push_back(arg);
-}
-
-//----------------------------------------------------------------------------
-bool CommandLineArguments::GetMatchedArguments(
-  kwsys_stl::vector<kwsys_stl::string>* matches,
-  const kwsys_stl::string& arg)
-{
-  matches->clear();
-  CommandLineArguments::Internal::CallbacksMap::iterator it;
-
-  // Does the argument match to any we know about?
-  for ( it = this->Internals->Callbacks.begin();
-    it != this->Internals->Callbacks.end();
-    it ++ )
-    {
-    const CommandLineArguments::Internal::String& parg = it->first;
-    CommandLineArgumentsCallbackStructure *cs = &it->second;
-    if (cs->ArgumentType == CommandLineArguments::NO_ARGUMENT ||
-      cs->ArgumentType == CommandLineArguments::SPACE_ARGUMENT) 
-      {
-      if ( arg == parg )
-        {
-        matches->push_back(parg);
-        }
-      }
-    else if ( arg.find( parg ) == 0 )
-      {
-      matches->push_back(parg);
-      }
-    }
-  return !matches->empty();
-}
-
-//----------------------------------------------------------------------------
-int CommandLineArguments::Parse()
-{
-  kwsys_stl::vector<kwsys_stl::string>::size_type cc;
-  kwsys_stl::vector<kwsys_stl::string> matches;
-  if ( this->StoreUnusedArgumentsFlag )
-    {
-    this->Internals->UnusedArguments.clear();
-    }
-  for ( cc = 0; cc < this->Internals->Argv.size(); cc ++ )
-    {
-    const kwsys_stl::string& arg = this->Internals->Argv[cc]; 
-    CommandLineArguments_DEBUG("Process argument: " << arg);
-    this->Internals->LastArgument = cc;
-    if ( this->GetMatchedArguments(&matches, arg) )
-      {
-      // Ok, we found one or more arguments that match what user specified.
-      // Let's find the longest one.
-      CommandLineArguments::Internal::VectorOfStrings::size_type kk;
-      CommandLineArguments::Internal::VectorOfStrings::size_type maxidx = 0;
-      CommandLineArguments::Internal::String::size_type maxlen = 0;
-      for ( kk = 0; kk < matches.size(); kk ++ )
-        {
-        if ( matches[kk].size() > maxlen )
-          {
-          maxlen = matches[kk].size();
-          maxidx = kk;
-          }
-        }
-      // So, the longest one is probably the right one. Now see if it has any
-      // additional value
-      CommandLineArgumentsCallbackStructure *cs 
-        = &this->Internals->Callbacks[matches[maxidx]];
-      const kwsys_stl::string& sarg = matches[maxidx];
-      if ( cs->Argument != sarg )
-        {
-        abort();
-        }
-      switch ( cs->ArgumentType )
-        {
-      case NO_ARGUMENT:
-        // No value
-        if ( !this->PopulateVariable(cs, 0) )
-          {
-          return 0;
-          }
-        break;
-      case SPACE_ARGUMENT:
-        if ( cc == this->Internals->Argv.size()-1 )
-          {
-          this->Internals->LastArgument --;
-          return 0;
-          }
-        CommandLineArguments_DEBUG("This is a space argument: " << arg
-          << " value: " << this->Internals->Argv[cc+1]);
-        // Value is the next argument
-        if ( !this->PopulateVariable(cs, this->Internals->Argv[cc+1].c_str()) )
-          {
-          return 0;
-          }
-        cc ++;
-        break;
-      case EQUAL_ARGUMENT:
-        if ( arg.size() == sarg.size() || arg.at(sarg.size()) != '=' )
-          {
-          this->Internals->LastArgument --;
-          return 0;
-          }
-        // Value is everythng followed the '=' sign
-        if ( !this->PopulateVariable(cs, arg.c_str() + sarg.size() + 1) )
-          {
-          return 0;
-          }
-        break;
-      case CONCAT_ARGUMENT:
-        // Value is whatever follows the argument
-        if ( !this->PopulateVariable(cs, arg.c_str() + sarg.size()) )
-          {
-          return 0;
-          }
-        break;
-      case MULTI_ARGUMENT:
-        // Suck in all the rest of the arguments
-        CommandLineArguments_DEBUG("This is a multi argument: " << arg);
-        for (cc++; cc < this->Internals->Argv.size(); ++ cc )
-          {
-          const kwsys_stl::string& marg = this->Internals->Argv[cc];
-          CommandLineArguments_DEBUG(" check multi argument value: " << marg);
-          if ( this->GetMatchedArguments(&matches, marg) )
-            {
-            CommandLineArguments_DEBUG("End of multi argument " << arg << " with value: " << marg);
-            break;
-            }
-          CommandLineArguments_DEBUG(" populate multi argument value: " << marg);
-          if ( !this->PopulateVariable(cs, marg.c_str()) )
-            {
-            return 0;
-            }
-          }
-        if ( cc != this->Internals->Argv.size() )
-          {
-          CommandLineArguments_DEBUG("Again End of multi argument " << arg);
-          cc--;
-          continue;
-          }
-        break;
-      default:
-        kwsys_ios::cerr << "Got unknown argument type: \"" << cs->ArgumentType << "\"" << kwsys_ios::endl;
-        this->Internals->LastArgument --;
-        return 0;
-        }
-      }
-    else
-      {
-      // Handle unknown arguments
-      if ( this->Internals->UnknownArgumentCallback )
-        {
-        if ( !this->Internals->UnknownArgumentCallback(arg.c_str(), 
-            this->Internals->ClientData) )
-          {
-          this->Internals->LastArgument --;
-          return 0;
-          }
-        return 1;
-        }
-      else if ( this->StoreUnusedArgumentsFlag )
-        {
-        CommandLineArguments_DEBUG("Store unused argument " << arg);
-        this->Internals->UnusedArguments.push_back(arg);
-        }
-      else
-        {
-        kwsys_ios::cerr << "Got unknown argument: \"" << arg << "\"" << kwsys_ios::endl;
-        this->Internals->LastArgument --;
-        return 0;
-        }
-      }
-    }
-  return 1;
-}
-
-//----------------------------------------------------------------------------
-void CommandLineArguments::GetRemainingArguments(int* argc, char*** argv)
-{
-  CommandLineArguments::Internal::VectorOfStrings::size_type size 
-    = this->Internals->Argv.size() - this->Internals->LastArgument + 1;
-  CommandLineArguments::Internal::VectorOfStrings::size_type cc;
-
-  // Copy Argv0 as the first argument
-  char** args = new char*[ size ];
-  args[0] = new char[ this->Internals->Argv0.size() + 1 ];
-  strcpy(args[0], this->Internals->Argv0.c_str());
-  int cnt = 1;
-
-  // Copy everything after the LastArgument, since that was not parsed.
-  for ( cc = this->Internals->LastArgument+1; 
-    cc < this->Internals->Argv.size(); cc ++ )
-    {
-    args[cnt] = new char[ this->Internals->Argv[cc].size() + 1];
-    strcpy(args[cnt], this->Internals->Argv[cc].c_str());
-    cnt ++;
-    }
-  *argc = cnt;
-  *argv = args;
-}
-
-//----------------------------------------------------------------------------
-void CommandLineArguments::GetUnusedArguments(int* argc, char*** argv)
-{
-  CommandLineArguments::Internal::VectorOfStrings::size_type size 
-    = this->Internals->UnusedArguments.size() + 1;
-  CommandLineArguments::Internal::VectorOfStrings::size_type cc;
-
-  // Copy Argv0 as the first argument
-  char** args = new char*[ size ];
-  args[0] = new char[ this->Internals->Argv0.size() + 1 ];
-  strcpy(args[0], this->Internals->Argv0.c_str());
-  int cnt = 1;
-
-  // Copy everything after the LastArgument, since that was not parsed.
-  for ( cc = 0;
-    cc < this->Internals->UnusedArguments.size(); cc ++ )
-    {
-    kwsys::String &str = this->Internals->UnusedArguments[cc];
-    args[cnt] = new char[ str.size() + 1];
-    strcpy(args[cnt], str.c_str());
-    cnt ++;
-    }
-  *argc = cnt;
-  *argv = args;
-}
-
-//----------------------------------------------------------------------------
-void CommandLineArguments::DeleteRemainingArguments(int argc, char*** argv)
-{
-  int cc;
-  for ( cc = 0; cc < argc; ++ cc )
-    {
-    delete [] (*argv)[cc];
-    }
-  delete [] *argv;
-}
-
-//----------------------------------------------------------------------------
-void CommandLineArguments::AddCallback(const char* argument, ArgumentTypeEnum type, 
-  CallbackType callback, void* call_data, const char* help)
-{
-  CommandLineArgumentsCallbackStructure s;
-  s.Argument     = argument;
-  s.ArgumentType = type;
-  s.Callback     = callback;
-  s.CallData     = call_data;
-  s.VariableType = CommandLineArguments::NO_VARIABLE_TYPE;
-  s.Variable     = 0;
-  s.Help         = help;
-
-  this->Internals->Callbacks[argument] = s;
-  this->GenerateHelp();
-}
-
-//----------------------------------------------------------------------------
-void CommandLineArguments::AddArgument(const char* argument, ArgumentTypeEnum type,
-  VariableTypeEnum vtype, void* variable, const char* help)
-{
-  CommandLineArgumentsCallbackStructure s;
-  s.Argument     = argument;
-  s.ArgumentType = type;
-  s.Callback     = 0;
-  s.CallData     = 0;
-  s.VariableType = vtype;
-  s.Variable     = variable;
-  s.Help         = help;
-
-  this->Internals->Callbacks[argument] = s;
-  this->GenerateHelp();
-}
-
-//----------------------------------------------------------------------------
-#define CommandLineArgumentsAddArgumentMacro(type, ctype) \
-  void CommandLineArguments::AddArgument(const char* argument, ArgumentTypeEnum type, \
-    ctype* variable, const char* help) \
-  { \
-    this->AddArgument(argument, type, CommandLineArguments::type##_TYPE, variable, help); \
-  }
-
-CommandLineArgumentsAddArgumentMacro(BOOL,       bool)
-CommandLineArgumentsAddArgumentMacro(INT,        int)
-CommandLineArgumentsAddArgumentMacro(DOUBLE,     double)
-CommandLineArgumentsAddArgumentMacro(STRING,     char*)
-CommandLineArgumentsAddArgumentMacro(STL_STRING, kwsys_stl::string)
-
-CommandLineArgumentsAddArgumentMacro(VECTOR_BOOL,       kwsys_stl::vector<bool>)
-CommandLineArgumentsAddArgumentMacro(VECTOR_INT,        kwsys_stl::vector<int>)
-CommandLineArgumentsAddArgumentMacro(VECTOR_DOUBLE,     kwsys_stl::vector<double>)
-CommandLineArgumentsAddArgumentMacro(VECTOR_STRING,     kwsys_stl::vector<char*>)
-CommandLineArgumentsAddArgumentMacro(VECTOR_STL_STRING, kwsys_stl::vector<kwsys_stl::string>)
-
-//----------------------------------------------------------------------------
-#define CommandLineArgumentsAddBooleanArgumentMacro(type, ctype) \
-  void CommandLineArguments::AddBooleanArgument(const char* argument, \
-    ctype* variable, const char* help) \
-  { \
-    this->AddArgument(argument, CommandLineArguments::NO_ARGUMENT, \
-      CommandLineArguments::type##_TYPE, variable, help); \
-  }
-
-CommandLineArgumentsAddBooleanArgumentMacro(BOOL,       bool)
-CommandLineArgumentsAddBooleanArgumentMacro(INT,        int)
-CommandLineArgumentsAddBooleanArgumentMacro(DOUBLE,     double)
-CommandLineArgumentsAddBooleanArgumentMacro(STRING,     char*)
-CommandLineArgumentsAddBooleanArgumentMacro(STL_STRING, kwsys_stl::string)
-
-//----------------------------------------------------------------------------
-void CommandLineArguments::SetClientData(void* client_data)
-{
-  this->Internals->ClientData = client_data;
-}
-
-//----------------------------------------------------------------------------
-void CommandLineArguments::SetUnknownArgumentCallback(
-  CommandLineArguments::ErrorCallbackType callback)
-{
-  this->Internals->UnknownArgumentCallback = callback;
-}
-
-//----------------------------------------------------------------------------
-const char* CommandLineArguments::GetHelp(const char* arg)
-{
-  CommandLineArguments::Internal::CallbacksMap::iterator it 
-    = this->Internals->Callbacks.find(arg);
-  if ( it == this->Internals->Callbacks.end() )
-    {
-    return 0;
-    }
-
-  // Since several arguments may point to the same argument, find the one this
-  // one point to if this one is pointing to another argument.
-  CommandLineArgumentsCallbackStructure *cs = &(it->second);
-  for(;;)
-    {
-    CommandLineArguments::Internal::CallbacksMap::iterator hit 
-      = this->Internals->Callbacks.find(cs->Help);
-    if ( hit == this->Internals->Callbacks.end() )
-      {
-      break;
-      }
-    cs = &(hit->second);
-    }
-  return cs->Help;
-}
-
-//----------------------------------------------------------------------------
-void CommandLineArguments::SetLineLength(unsigned int ll)
-{
-  if ( ll < 9 || ll > 1000 )
-    {
-    return;
-    }
-  this->LineLength = ll;
-  this->GenerateHelp();
-}
-
-//----------------------------------------------------------------------------
-const char* CommandLineArguments::GetArgv0()
-{
-  return this->Internals->Argv0.c_str();
-}
-
-//----------------------------------------------------------------------------
-unsigned int CommandLineArguments::GetLastArgument()
-{
-  return static_cast<unsigned int>(this->Internals->LastArgument + 1);
-}
-
-//----------------------------------------------------------------------------
-void CommandLineArguments::GenerateHelp()
-{
-  kwsys_ios::ostringstream str;
-  
-  // Collapse all arguments into the map of vectors of all arguments that do
-  // the same thing.
-  CommandLineArguments::Internal::CallbacksMap::iterator it;
-  typedef kwsys_stl::map<CommandLineArguments::Internal::String, 
-     CommandLineArguments::Internal::SetOfStrings > MapArgs;
-  MapArgs mp;
-  MapArgs::iterator mpit, smpit;
-  for ( it = this->Internals->Callbacks.begin();
-    it != this->Internals->Callbacks.end();
-    it ++ )
-    {
-    CommandLineArgumentsCallbackStructure *cs = &(it->second);
-    mpit = mp.find(cs->Help);
-    if ( mpit != mp.end() )
-      {
-      mpit->second.insert(it->first);
-      mp[it->first].insert(it->first);
-      }
-    else
-      {
-      mp[it->first].insert(it->first);
-      }
-    }
-  for ( it = this->Internals->Callbacks.begin();
-    it != this->Internals->Callbacks.end();
-    it ++ )
-    {
-    CommandLineArgumentsCallbackStructure *cs = &(it->second);
-    mpit = mp.find(cs->Help);
-    if ( mpit != mp.end() )
-      {
-      mpit->second.insert(it->first);
-      smpit = mp.find(it->first);
-      CommandLineArguments::Internal::SetOfStrings::iterator sit;
-      for ( sit = smpit->second.begin(); sit != smpit->second.end(); sit++ )
-        {
-        mpit->second.insert(*sit);
-        }
-      mp.erase(smpit);
-      }
-    else
-      {
-      mp[it->first].insert(it->first);
-      }
-    }
- 
-  // Find the length of the longest string
-  CommandLineArguments::Internal::String::size_type maxlen = 0;
-  for ( mpit = mp.begin();
-    mpit != mp.end();
-    mpit ++ )
-    {
-    CommandLineArguments::Internal::SetOfStrings::iterator sit;
-    for ( sit = mpit->second.begin(); sit != mpit->second.end(); sit++ )
-      {
-      CommandLineArguments::Internal::String::size_type clen = sit->size();
-      switch ( this->Internals->Callbacks[*sit].ArgumentType )
-        {
-        case CommandLineArguments::NO_ARGUMENT:     clen += 0; break;
-        case CommandLineArguments::CONCAT_ARGUMENT: clen += 3; break;
-        case CommandLineArguments::SPACE_ARGUMENT:  clen += 4; break;
-        case CommandLineArguments::EQUAL_ARGUMENT:  clen += 4; break;
-        }
-      if ( clen > maxlen )
-        {
-        maxlen = clen;
-        }
-      }
-    }
-
-  // Create format for that string
-  char format[80];
-  sprintf(format, "  %%-%us  ", static_cast<unsigned int>(maxlen));
-
-  maxlen += 4; // For the space before and after the option
-
-  // Print help for each option
-  for ( mpit = mp.begin();
-    mpit != mp.end();
-    mpit ++ )
-    {
-    CommandLineArguments::Internal::SetOfStrings::iterator sit;
-    for ( sit = mpit->second.begin(); sit != mpit->second.end(); sit++ )
-      {
-      str << kwsys_ios::endl;
-      char argument[100];
-      sprintf(argument, "%s", sit->c_str());
-      switch ( this->Internals->Callbacks[*sit].ArgumentType )
-        {
-        case CommandLineArguments::NO_ARGUMENT: break;
-        case CommandLineArguments::CONCAT_ARGUMENT: strcat(argument, "opt"); break;
-        case CommandLineArguments::SPACE_ARGUMENT:  strcat(argument, " opt"); break;
-        case CommandLineArguments::EQUAL_ARGUMENT:  strcat(argument, "=opt"); break;
-        case CommandLineArguments::MULTI_ARGUMENT:  strcat(argument, " opt opt ..."); break;
-        }
-      char buffer[80];
-      sprintf(buffer, format, argument);
-      str << buffer;
-      }
-    const char* ptr = this->Internals->Callbacks[mpit->first].Help;
-    size_t len = strlen(ptr);
-    int cnt = 0;
-    while ( len > 0)
-      {
-      // If argument with help is longer than line length, split it on previous
-      // space (or tab) and continue on the next line
-      CommandLineArguments::Internal::String::size_type cc;
-      for ( cc = 0; ptr[cc]; cc ++ )
-        {
-        if ( *ptr == ' ' || *ptr == '\t' )
-          {
-          ptr ++;
-          len --;
-          }
-        }
-      if ( cnt > 0 )
-        {
-        for ( cc = 0; cc < maxlen; cc ++ )
-          {
-          str << " ";
-          }
-        }
-      CommandLineArguments::Internal::String::size_type skip = len;
-      if ( skip > this->LineLength - maxlen )
-        {
-        skip = this->LineLength - maxlen;
-        for ( cc = skip-1; cc > 0; cc -- )
-          {
-          if ( ptr[cc] == ' ' || ptr[cc] == '\t' )
-            {
-            break;
-            }
-          }
-        if ( cc != 0 )
-          {
-          skip = cc;
-          }
-        }
-      str.write(ptr, static_cast<kwsys_ios::streamsize>(skip));
-      str << kwsys_ios::endl;
-      ptr += skip;
-      len -= skip;
-      cnt ++;
-      }
-    }
-  /*
-  // This can help debugging help string
-  str << endl;
-  unsigned int cc;
-  for ( cc = 0; cc < this->LineLength; cc ++ )
-    {
-    str << cc % 10;
-    }
-  str << endl;
-  */
-  this->Help = str.str();
-}
-
-//----------------------------------------------------------------------------
-void CommandLineArguments::PopulateVariable(
-  bool* variable, const kwsys_stl::string& value)
-{
-  if ( value == "1" || value == "ON" || value == "on" || value == "On" ||
-    value == "TRUE" || value == "true" || value == "True" ||
-    value == "yes" || value == "Yes" || value == "YES" )
-    {
-    *variable = true;
-    }
-  else
-    {
-    *variable = false;
-    }
-}
-
-//----------------------------------------------------------------------------
-void CommandLineArguments::PopulateVariable(
-  int* variable, const kwsys_stl::string& value)
-{
-  char* res = 0;
-  *variable = static_cast<int>(strtol(value.c_str(), &res, 10));
-  //if ( res && *res )
-  //  {
-  //  Can handle non-int
-  //  }
-}
-
-//----------------------------------------------------------------------------
-void CommandLineArguments::PopulateVariable(
-  double* variable, const kwsys_stl::string& value)
-{
-  char* res = 0;
-  *variable = strtod(value.c_str(), &res);
-  //if ( res && *res )
-  //  {
-  //  Can handle non-double
-  //  }
-}
-
-//----------------------------------------------------------------------------
-void CommandLineArguments::PopulateVariable(
-  char** variable, const kwsys_stl::string& value)
-{
-  if ( *variable )
-    {
-    delete [] *variable;
-    *variable = 0;
-    }
-  *variable = new char[ value.size() + 1 ];
-  strcpy(*variable, value.c_str());
-}
-
-//----------------------------------------------------------------------------
-void CommandLineArguments::PopulateVariable(
-  kwsys_stl::string* variable, const kwsys_stl::string& value)
-{
-  *variable = value;
-}
-
-//----------------------------------------------------------------------------
-void CommandLineArguments::PopulateVariable(
-  kwsys_stl::vector<bool>* variable, const kwsys_stl::string& value)
-{
-  bool val = false;
-  if ( value == "1" || value == "ON" || value == "on" || value == "On" ||
-    value == "TRUE" || value == "true" || value == "True" ||
-    value == "yes" || value == "Yes" || value == "YES" )
-    {
-    val = true;
-    }
-  variable->push_back(val);
-}
-
-//----------------------------------------------------------------------------
-void CommandLineArguments::PopulateVariable(
-  kwsys_stl::vector<int>* variable, const kwsys_stl::string& value)
-{
-  char* res = 0;
-  variable->push_back(static_cast<int>(strtol(value.c_str(), &res, 10)));
-  //if ( res && *res )
-  //  {
-  //  Can handle non-int
-  //  }
-}
-
-//----------------------------------------------------------------------------
-void CommandLineArguments::PopulateVariable(
-  kwsys_stl::vector<double>* variable, const kwsys_stl::string& value)
-{
-  char* res = 0;
-  variable->push_back(strtod(value.c_str(), &res));
-  //if ( res && *res )
-  //  {
-  //  Can handle non-int
-  //  }
-}
-
-//----------------------------------------------------------------------------
-void CommandLineArguments::PopulateVariable(
-  kwsys_stl::vector<char*>* variable, const kwsys_stl::string& value)
-{
-  char* var = new char[ value.size() + 1 ];
-  strcpy(var, value.c_str());
-  variable->push_back(var);
-}
-
-//----------------------------------------------------------------------------
-void CommandLineArguments::PopulateVariable(
-  kwsys_stl::vector<kwsys_stl::string>* variable,
-  const kwsys_stl::string& value)
-{
-  variable->push_back(value);
-}
-
-//----------------------------------------------------------------------------
-bool CommandLineArguments::PopulateVariable(CommandLineArgumentsCallbackStructure* cs,
-  const char* value)
-{
-  // Call the callback
-  if ( cs->Callback )
-    {
-    if ( !cs->Callback(cs->Argument, value, cs->CallData) )
-      {
-      this->Internals->LastArgument --;
-      return 0;
-      }
-    }
-  CommandLineArguments_DEBUG("Set argument: " << cs->Argument << " to " << value);
-  if ( cs->Variable )
-    {
-    kwsys_stl::string var = "1";
-    if ( value )
-      {
-      var = value;
-      }
-    switch ( cs->VariableType )
-      {
-    case CommandLineArguments::INT_TYPE:
-      this->PopulateVariable(static_cast<int*>(cs->Variable), var);
-      break;
-    case CommandLineArguments::DOUBLE_TYPE:
-      this->PopulateVariable(static_cast<double*>(cs->Variable), var);
-      break;
-    case CommandLineArguments::STRING_TYPE:
-      this->PopulateVariable(static_cast<char**>(cs->Variable), var);
-      break;
-    case CommandLineArguments::STL_STRING_TYPE:
-      this->PopulateVariable(static_cast<kwsys_stl::string*>(cs->Variable), var);
-      break;
-    case CommandLineArguments::BOOL_TYPE:
-      this->PopulateVariable(static_cast<bool*>(cs->Variable), var);
-      break;
-    case CommandLineArguments::VECTOR_BOOL_TYPE:
-      this->PopulateVariable(static_cast<kwsys_stl::vector<bool>*>(cs->Variable), var);
-      break;
-    case CommandLineArguments::VECTOR_INT_TYPE:
-      this->PopulateVariable(static_cast<kwsys_stl::vector<int>*>(cs->Variable), var);
-      break;
-    case CommandLineArguments::VECTOR_DOUBLE_TYPE:
-      this->PopulateVariable(static_cast<kwsys_stl::vector<double>*>(cs->Variable), var);
-      break;
-    case CommandLineArguments::VECTOR_STRING_TYPE:
-      this->PopulateVariable(static_cast<kwsys_stl::vector<char*>*>(cs->Variable), var);
-      break;
-    case CommandLineArguments::VECTOR_STL_STRING_TYPE:
-      this->PopulateVariable(static_cast<kwsys_stl::vector<kwsys_stl::string>*>(cs->Variable), var);
-      break;
-    default:
-      kwsys_ios::cerr << "Got unknown variable type: \"" << cs->VariableType << "\"" << kwsys_ios::endl;
-      this->Internals->LastArgument --;
-      return 0;
-      }
-    }
-  return 1;
-}
-
-
-} // namespace KWSYS_NAMESPACE
diff --git a/src/kwsys/CommandLineArguments.hxx.in b/src/kwsys/CommandLineArguments.hxx.in
deleted file mode 100644
index cbf6ee3..0000000
--- a/src/kwsys/CommandLineArguments.hxx.in
+++ /dev/null
@@ -1,286 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef @KWSYS_NAMESPACE at _CommandLineArguments_hxx
-#define @KWSYS_NAMESPACE at _CommandLineArguments_hxx
-
-#include <@KWSYS_NAMESPACE@/Configure.h>
-#include <@KWSYS_NAMESPACE@/Configure.hxx>
-
-#include <@KWSYS_NAMESPACE@/stl/string>
-#include <@KWSYS_NAMESPACE@/stl/vector>
-
-/* Define this macro temporarily to keep the code readable.  */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
-# define kwsys_stl @KWSYS_NAMESPACE at _stl
-#endif
-
-namespace @KWSYS_NAMESPACE@
-{
-
-class CommandLineArgumentsInternal;
-struct CommandLineArgumentsCallbackStructure;
-
-/** \class CommandLineArguments
- * \brief Command line arguments processing code.
- *
- * Find specified arguments with optional options and execute specified methods
- * or set given variables.
- *
- * The two interfaces it knows are callback based and variable based. For
- * callback based, you have to register callback for particular argument using
- * AddCallback method. When that argument is passed, the callback will be
- * called with argument, value, and call data. For boolean (NO_ARGUMENT)
- * arguments, the value is "1". If the callback returns 0 the argument parsing
- * will stop with an error.
- *
- * For the variable interface you associate variable with each argument. When
- * the argument is specified, the variable is set to the specified value casted
- * to the appropriate type. For boolean (NO_ARGUMENT), the value is "1".
- *
- * Both interfaces can be used at the same time. 
- *
- * Possible argument types are:
- *   NO_ARGUMENT     - The argument takes no value             : --A
- *   CONCAT_ARGUMENT - The argument takes value after no space : --Aval
- *   SPACE_ARGUMENT  - The argument takes value after space    : --A val 
- *   EQUAL_ARGUMENT  - The argument takes value after equal    : --A=val
- *   MULTI_ARGUMENT  - The argument takes values after space   : --A val1 val2 val3 ...
- *
- * Example use:
- *
- * kwsys::CommandLineArguments arg;
- * arg.Initialize(argc, argv);
- * typedef kwsys::CommandLineArguments argT;
- * arg.AddArgument("--something", argT::EQUAL_ARGUMENT, &some_variable, 
- *                 "This is help string for --something");
- * if ( !arg.Parse() )
- *   {
- *   kwsys_ios::cerr << "Problem parsing arguments" << kwsys_ios::endl;
- *   res = 1;
- *   }
- * 
- */
-
-class @KWSYS_NAMESPACE at _EXPORT CommandLineArguments
-{
-public:
-  CommandLineArguments();
-  ~CommandLineArguments();
-
-  /**
-   * Various argument types.
-   */
-  enum ArgumentTypeEnum { 
-    NO_ARGUMENT,
-    CONCAT_ARGUMENT,
-    SPACE_ARGUMENT,
-    EQUAL_ARGUMENT,
-    MULTI_ARGUMENT
-  };
-
-  /**
-   * Various variable types. When using the variable interface, this specifies
-   * what type the variable is.
-   */
-  enum VariableTypeEnum {
-    NO_VARIABLE_TYPE = 0, // The variable is not specified
-    INT_TYPE,             // The variable is integer (int)
-    BOOL_TYPE,            // The variable is boolean (bool)
-    DOUBLE_TYPE,          // The variable is float (double)
-    STRING_TYPE,          // The variable is string (char*)
-    STL_STRING_TYPE,      // The variable is string (char*)
-    VECTOR_INT_TYPE,             // The variable is integer (int)
-    VECTOR_BOOL_TYPE,            // The variable is boolean (bool)
-    VECTOR_DOUBLE_TYPE,          // The variable is float (double)
-    VECTOR_STRING_TYPE,          // The variable is string (char*)
-    VECTOR_STL_STRING_TYPE,      // The variable is string (char*)
-    LAST_VARIABLE_TYPE
-  };
-
-  /**
-   * Prototypes for callbacks for callback interface.
-   */
-  typedef int(*CallbackType)(const char* argument, const char* value, 
-    void* call_data);
-  typedef int(*ErrorCallbackType)(const char* argument, void* client_data);
-
-  /**
-   * Initialize internal data structures. This should be called before parsing.
-   */
-  void Initialize(int argc, const char* const argv[]);
-  void Initialize(int argc, char* argv[]);
-
-  /**
-   * Initialize internal data structure and pass arguments one by one. This is
-   * convenience method for use from scripting languages where argc and argv
-   * are not available.
-   */
-  void Initialize();
-  void ProcessArgument(const char* arg);
-
-  /**
-   * This method will parse arguments and call appropriate methods.
-   */
-  int Parse();
-
-  /**
-   * This method will add a callback for a specific argument. The arguments to
-   * it are argument, argument type, callback method, and call data. The
-   * argument help specifies the help string used with this option. The
-   * callback and call_data can be skipped.
-   */
-  void AddCallback(const char* argument, ArgumentTypeEnum type, 
-    CallbackType callback, void* call_data, const char* help);
-
-  /**
-   * Add handler for argument which is going to set the variable to the
-   * specified value. If the argument is specified, the option is casted to the
-   * appropriate type.
-   */
-  void AddArgument(const char* argument, ArgumentTypeEnum type,
-    bool* variable, const char* help);
-  void AddArgument(const char* argument, ArgumentTypeEnum type,
-    int* variable, const char* help);
-  void AddArgument(const char* argument, ArgumentTypeEnum type, 
-    double* variable, const char* help);
-  void AddArgument(const char* argument, ArgumentTypeEnum type, 
-    char** variable, const char* help);
-  void AddArgument(const char* argument, ArgumentTypeEnum type,
-    kwsys_stl::string* variable, const char* help);
-
-  /**
-   * Add handler for argument which is going to set the variable to the
-   * specified value. If the argument is specified, the option is casted to the
-   * appropriate type. This will handle the multi argument values.
-   */
-  void AddArgument(const char* argument, ArgumentTypeEnum type,
-    kwsys_stl::vector<bool>* variable, const char* help);
-  void AddArgument(const char* argument, ArgumentTypeEnum type,
-    kwsys_stl::vector<int>* variable, const char* help);
-  void AddArgument(const char* argument, ArgumentTypeEnum type, 
-    kwsys_stl::vector<double>* variable, const char* help);
-  void AddArgument(const char* argument, ArgumentTypeEnum type, 
-    kwsys_stl::vector<char*>* variable, const char* help);
-  void AddArgument(const char* argument, ArgumentTypeEnum type,
-    kwsys_stl::vector<kwsys_stl::string>* variable, const char* help);
-
-  /**
-   * Add handler for boolean argument. The argument does not take any option
-   * and if it is specified, the value of the variable is true/1, otherwise it
-   * is false/0.
-   */
-  void AddBooleanArgument(const char* argument,
-    bool* variable, const char* help);
-  void AddBooleanArgument(const char* argument,
-    int* variable, const char* help);
-  void AddBooleanArgument(const char* argument,
-    double* variable, const char* help);
-  void AddBooleanArgument(const char* argument,
-    char** variable, const char* help);
-  void AddBooleanArgument(const char* argument,
-    kwsys_stl::string* variable, const char* help);
-
-  /**
-   * Set the callbacks for error handling.
-   */
-  void SetClientData(void* client_data);
-  void SetUnknownArgumentCallback(ErrorCallbackType callback);
-
-  /**
-   * Get remaining arguments. It allocates space for argv, so you have to call
-   * delete[] on it.
-   */
-  void GetRemainingArguments(int* argc, char*** argv);
-  void DeleteRemainingArguments(int argc, char*** argv);
-
-  /**
-   * If StoreUnusedArguments is set to true, then all unknown arguments will be
-   * stored and the user can access the modified argc, argv without known
-   * arguments.
-   */
-  void StoreUnusedArguments(bool val) { this->StoreUnusedArgumentsFlag = val; }
-  void GetUnusedArguments(int* argc, char*** argv);
-
-  /**
-   * Return string containing help. If the argument is specified, only return
-   * help for that argument.
-   */
-  const char* GetHelp() { return this->Help.c_str(); }
-  const char* GetHelp(const char* arg);
-
-  /**
-   * Get / Set the help line length. This length is used when generating the
-   * help page. Default length is 80.
-   */
-  void SetLineLength(unsigned int);
-  unsigned int GetLineLength();
-
-  /**
-   * Get the executable name (argv0). This is only available when using
-   * Initialize with argc/argv.
-   */
-  const char* GetArgv0();
-
-  /**
-   * Get index of the last argument parsed. This is the last argument that was
-   * parsed ok in the original argc/argv list.
-   */
-  unsigned int GetLastArgument();
-
-protected:
-  void GenerateHelp();
-
-  //! This is internal method that registers variable with argument
-  void AddArgument(const char* argument, ArgumentTypeEnum type,
-    VariableTypeEnum vtype, void* variable, const char* help);
-
-  bool GetMatchedArguments(kwsys_stl::vector<kwsys_stl::string>* matches,
-    const kwsys_stl::string& arg);
-
-  //! Populate individual variables
-  bool PopulateVariable(CommandLineArgumentsCallbackStructure* cs,
-    const char* value);
-
-  //! Populate individual variables of type ...
-  void PopulateVariable(bool* variable, const kwsys_stl::string& value);
-  void PopulateVariable(int* variable, const kwsys_stl::string& value);
-  void PopulateVariable(double* variable, const kwsys_stl::string& value);
-  void PopulateVariable(char** variable, const kwsys_stl::string& value);
-  void PopulateVariable(kwsys_stl::string* variable, const kwsys_stl::string& value);
-  void PopulateVariable(kwsys_stl::vector<bool>* variable, const kwsys_stl::string& value);
-  void PopulateVariable(kwsys_stl::vector<int>* variable, const kwsys_stl::string& value);
-  void PopulateVariable(kwsys_stl::vector<double>* variable, const kwsys_stl::string& value);
-  void PopulateVariable(kwsys_stl::vector<char*>* variable, const kwsys_stl::string& value);
-  void PopulateVariable(kwsys_stl::vector<kwsys_stl::string>* variable, const kwsys_stl::string& value);
-
-  typedef CommandLineArgumentsInternal Internal;
-  Internal* Internals;
-  kwsys_stl::string Help;
-
-  unsigned int LineLength;
-
-  bool StoreUnusedArgumentsFlag;
-};
-
-} // namespace @KWSYS_NAMESPACE@
-
-/* Undefine temporary macro.  */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
-# undef kwsys_stl
-#endif
-
-#endif
-
-
-
-
-
diff --git a/src/kwsys/Configure.hxx.in b/src/kwsys/Configure.hxx.in
deleted file mode 100644
index 8f5ace2..0000000
--- a/src/kwsys/Configure.hxx.in
+++ /dev/null
@@ -1,179 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef @KWSYS_NAMESPACE at _Configure_hxx
-#define @KWSYS_NAMESPACE at _Configure_hxx
-
-/* Include C configuration.  */
-#include <@KWSYS_NAMESPACE@/Configure.h>
-
-/* Whether ANSI C++ stream headers are to be used.  */
-#define @KWSYS_NAMESPACE at _IOS_USE_ANSI @KWSYS_IOS_USE_ANSI@
-
-/* Whether ANSI C++ streams are in std namespace.  */
-#define @KWSYS_NAMESPACE at _IOS_HAVE_STD @KWSYS_IOS_HAVE_STD@
-
-/* Whether ANSI C++ <sstream> header is to be used.  */
-#define @KWSYS_NAMESPACE at _IOS_USE_SSTREAM @KWSYS_IOS_USE_SSTREAM@
-
-/* Whether old C++ <strstream.h> header is to be used.  */
-#define @KWSYS_NAMESPACE at _IOS_USE_STRSTREAM_H @KWSYS_IOS_USE_STRSTREAM_H@
-
-/* Whether old C++ <strstrea.h> header is to be used.  */
-#define @KWSYS_NAMESPACE at _IOS_USE_STRSTREA_H @KWSYS_IOS_USE_STRSTREA_H@
-
-/* Whether C++ streams support the ios::binary openmode.  */
-#define @KWSYS_NAMESPACE at _IOS_HAVE_BINARY @KWSYS_IOS_HAVE_BINARY@
-
-/* Whether STL is in std namespace.  */
-#define @KWSYS_NAMESPACE at _STL_HAVE_STD @KWSYS_STL_HAVE_STD@
-
-/* Whether wstring is available.  */
-#define @KWSYS_NAMESPACE at _STL_HAS_WSTRING @KWSYS_STL_HAS_WSTRING@
-
-/* Whether the STL string has operator<< for ostream.  */
-#define @KWSYS_NAMESPACE at _STL_STRING_HAVE_OSTREAM @KWSYS_STL_STRING_HAVE_OSTREAM@
-
-/* Whether the STL string has operator>> for istream.  */
-#define @KWSYS_NAMESPACE at _STL_STRING_HAVE_ISTREAM @KWSYS_STL_STRING_HAVE_ISTREAM@
-
-/* Whether the STL string has operator!= for char*.  */
-#define @KWSYS_NAMESPACE at _STL_STRING_HAVE_NEQ_CHAR @KWSYS_STL_STRING_HAVE_NEQ_CHAR@
-
-/* Define the stl namespace macro.  */
-#if @KWSYS_NAMESPACE at _STL_HAVE_STD
-# define @KWSYS_NAMESPACE at _stl std
-#else
-# define @KWSYS_NAMESPACE at _stl
-#endif
-
-/* Define the ios namespace macro.  */
-#if @KWSYS_NAMESPACE at _IOS_HAVE_STD
-# define @KWSYS_NAMESPACE at _ios_namespace std
-#else
-# define @KWSYS_NAMESPACE at _ios_namespace
-#endif
-#if @KWSYS_NAMESPACE at _IOS_USE_SSTREAM
-# define @KWSYS_NAMESPACE at _ios @KWSYS_NAMESPACE at _ios_namespace
-#else
-# define @KWSYS_NAMESPACE at _ios @KWSYS_NAMESPACE at _ios
-#endif
-
-/* Define the ios::binary openmode macro.  */
-#if @KWSYS_NAMESPACE at _IOS_HAVE_BINARY
-# define @KWSYS_NAMESPACE at _ios_binary @KWSYS_NAMESPACE at _ios::ios::binary
-#else
-# define @KWSYS_NAMESPACE at _ios_binary 0
-#endif
-
-/* Whether the cstddef header is available.  */
-#define @KWSYS_NAMESPACE at _CXX_HAS_CSTDDEF @KWSYS_CXX_HAS_CSTDDEF@
-
-/* Whether the compiler supports null template arguments.  */
-#define @KWSYS_NAMESPACE at _CXX_HAS_NULL_TEMPLATE_ARGS @KWSYS_CXX_HAS_NULL_TEMPLATE_ARGS@
-
-/* Define the null template arguments macro.  */
-#if @KWSYS_NAMESPACE at _CXX_HAS_NULL_TEMPLATE_ARGS
-# define @KWSYS_NAMESPACE at _CXX_NULL_TEMPLATE_ARGS <>
-#else
-# define @KWSYS_NAMESPACE at _CXX_NULL_TEMPLATE_ARGS
-#endif
-
-/* Whether the compiler supports member templates.  */
-#define @KWSYS_NAMESPACE at _CXX_HAS_MEMBER_TEMPLATES @KWSYS_CXX_HAS_MEMBER_TEMPLATES@
-
-/* Whether the compiler supports argument dependent lookup.  */
-#define @KWSYS_NAMESPACE at _CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP @KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP@
-
-/* Whether the compiler supports standard full specialization syntax.  */
-#define @KWSYS_NAMESPACE at _CXX_HAS_FULL_SPECIALIZATION @KWSYS_CXX_HAS_FULL_SPECIALIZATION@
-
-/* Define the specialization definition macro.  */
-#if @KWSYS_NAMESPACE at _CXX_HAS_FULL_SPECIALIZATION
-# define @KWSYS_NAMESPACE at _CXX_DEFINE_SPECIALIZATION template <>
-#else
-# define @KWSYS_NAMESPACE at _CXX_DEFINE_SPECIALIZATION
-#endif
-
-/* Define typename keyword macro for use in declarations.  */
-#if defined(_MSC_VER) && _MSC_VER < 1300
-# define @KWSYS_NAMESPACE at _CXX_DECL_TYPENAME
-#else
-# define @KWSYS_NAMESPACE at _CXX_DECL_TYPENAME typename
-#endif
-
-/* Whether the stl has iterator_traits.  */
-#define @KWSYS_NAMESPACE at _STL_HAS_ITERATOR_TRAITS @KWSYS_STL_HAS_ITERATOR_TRAITS@
-
-/* Whether the stl has iterator_category.  */
-#define @KWSYS_NAMESPACE at _STL_HAS_ITERATOR_CATEGORY @KWSYS_STL_HAS_ITERATOR_CATEGORY@
-
-/* Whether the stl has __iterator_category.  */
-#define @KWSYS_NAMESPACE at _STL_HAS___ITERATOR_CATEGORY @KWSYS_STL_HAS___ITERATOR_CATEGORY@
-
-/* Whether the stl allocator is the standard template.  */
-#define @KWSYS_NAMESPACE at _STL_HAS_ALLOCATOR_TEMPLATE @KWSYS_STL_HAS_ALLOCATOR_TEMPLATE@
-
-/* Whether the stl allocator is not a template.  */
-#define @KWSYS_NAMESPACE at _STL_HAS_ALLOCATOR_NONTEMPLATE @KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE@
-
-/* Whether the stl allocator has rebind.  */
-#define @KWSYS_NAMESPACE at _STL_HAS_ALLOCATOR_REBIND @KWSYS_STL_HAS_ALLOCATOR_REBIND@
-
-/* Whether the stl allocator has a size argument for max_size.  */
-#define @KWSYS_NAMESPACE at _STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT @KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT@
-
-/* Whether the stl containers support allocator objects.  */
-#define @KWSYS_NAMESPACE at _STL_HAS_ALLOCATOR_OBJECTS @KWSYS_STL_HAS_ALLOCATOR_OBJECTS@
-
-/* Whether struct stat has the st_mtim member for high resolution times.  */
-#define @KWSYS_NAMESPACE at _STAT_HAS_ST_MTIM @KWSYS_STAT_HAS_ST_MTIM@
-
-/* If building a C++ file in kwsys itself, give the source file
-   access to the macros without a configured namespace.  */
-#if defined(KWSYS_NAMESPACE)
-# if !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
-#  define kwsys_stl @KWSYS_NAMESPACE at _stl
-#  define kwsys_ios @KWSYS_NAMESPACE at _ios
-#  define kwsys     @KWSYS_NAMESPACE@
-#  define kwsys_ios_binary @KWSYS_NAMESPACE at _ios_binary
-# endif
-# define KWSYS_NAME_IS_KWSYS            @KWSYS_NAMESPACE at _NAME_IS_KWSYS
-# define KWSYS_STL_HAVE_STD             @KWSYS_NAMESPACE at _STL_HAVE_STD
-# define KWSYS_IOS_HAVE_STD             @KWSYS_NAMESPACE at _IOS_HAVE_STD
-# define KWSYS_IOS_USE_ANSI             @KWSYS_NAMESPACE at _IOS_USE_ANSI
-# define KWSYS_IOS_USE_SSTREAM          @KWSYS_NAMESPACE at _IOS_USE_SSTREAM
-# define KWSYS_IOS_USE_STRSTREAM_H      @KWSYS_NAMESPACE at _IOS_USE_STRSTREAM_H
-# define KWSYS_IOS_USE_STRSTREA_H       @KWSYS_NAMESPACE at _IOS_USE_STRSTREA_H
-# define KWSYS_IOS_HAVE_BINARY          @KWSYS_NAMESPACE at _IOS_HAVE_BINARY
-# define KWSYS_STAT_HAS_ST_MTIM         @KWSYS_NAMESPACE at _STAT_HAS_ST_MTIM
-# define KWSYS_CXX_HAS_CSTDDEF          @KWSYS_NAMESPACE at _CXX_HAS_CSTDDEF
-# define KWSYS_STL_STRING_HAVE_OSTREAM  @KWSYS_NAMESPACE at _STL_STRING_HAVE_OSTREAM
-# define KWSYS_STL_STRING_HAVE_ISTREAM  @KWSYS_NAMESPACE at _STL_STRING_HAVE_ISTREAM
-# define KWSYS_STL_STRING_HAVE_NEQ_CHAR @KWSYS_NAMESPACE at _STL_STRING_HAVE_NEQ_CHAR
-# define KWSYS_CXX_NULL_TEMPLATE_ARGS   @KWSYS_NAMESPACE at _CXX_NULL_TEMPLATE_ARGS
-# define KWSYS_CXX_HAS_MEMBER_TEMPLATES @KWSYS_NAMESPACE at _CXX_HAS_MEMBER_TEMPLATES
-# define KWSYS_CXX_HAS_FULL_SPECIALIZATION @KWSYS_NAMESPACE at _CXX_HAS_FULL_SPECIALIZATION
-# define KWSYS_CXX_DEFINE_SPECIALIZATION @KWSYS_NAMESPACE at _CXX_DEFINE_SPECIALIZATION
-# define KWSYS_CXX_DECL_TYPENAME        @KWSYS_NAMESPACE at _CXX_DECL_TYPENAME
-# define KWSYS_STL_HAS_ALLOCATOR_REBIND @KWSYS_NAMESPACE at _STL_HAS_ALLOCATOR_REBIND
-# define KWSYS_STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT @KWSYS_NAMESPACE at _STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
-# define KWSYS_CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP @KWSYS_NAMESPACE at _CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
-# define KWSYS_STL_HAS_ITERATOR_TRAITS @KWSYS_NAMESPACE at _STL_HAS_ITERATOR_TRAITS
-# define KWSYS_STL_HAS_ITERATOR_CATEGORY @KWSYS_NAMESPACE at _STL_HAS_ITERATOR_CATEGORY
-# define KWSYS_STL_HAS___ITERATOR_CATEGORY @KWSYS_NAMESPACE at _STL_HAS___ITERATOR_CATEGORY
-# define KWSYS_STL_HAS_ALLOCATOR_TEMPLATE @KWSYS_NAMESPACE at _STL_HAS_ALLOCATOR_TEMPLATE
-# define KWSYS_STL_HAS_ALLOCATOR_NONTEMPLATE @KWSYS_NAMESPACE at _STL_HAS_ALLOCATOR_NONTEMPLATE
-# define KWSYS_STL_HAS_ALLOCATOR_OBJECTS @KWSYS_NAMESPACE at _STL_HAS_ALLOCATOR_OBJECTS
-# define KWSYS_STL_HAS_WSTRING          @KWSYS_NAMESPACE at _STL_HAS_WSTRING
-#endif
-
-#endif
diff --git a/src/kwsys/Directory.cxx b/src/kwsys/Directory.cxx
deleted file mode 100644
index 741bcba..0000000
--- a/src/kwsys/Directory.cxx
+++ /dev/null
@@ -1,253 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#include "kwsysPrivate.h"
-#include KWSYS_HEADER(Directory.hxx)
-
-#include KWSYS_HEADER(Configure.hxx)
-
-#include KWSYS_HEADER(Encoding.hxx)
-
-#include KWSYS_HEADER(stl/string)
-#include KWSYS_HEADER(stl/vector)
-
-// Work-around CMake dependency scanning limitation.  This must
-// duplicate the above list of headers.
-#if 0
-# include "Directory.hxx.in"
-# include "Configure.hxx.in"
-# include "Encoding.hxx.in"
-# include "kwsys_stl.hxx.in"
-# include "kwsys_stl_string.hxx.in"
-# include "kwsys_stl_vector.hxx.in"
-#endif
-
-namespace KWSYS_NAMESPACE
-{
-
-//----------------------------------------------------------------------------
-class DirectoryInternals
-{
-public:
-  // Array of Files
-  kwsys_stl::vector<kwsys_stl::string> Files;
-
-  // Path to Open'ed directory
-  kwsys_stl::string Path;
-};
-
-//----------------------------------------------------------------------------
-Directory::Directory()
-{
-  this->Internal = new DirectoryInternals;
-}
-
-//----------------------------------------------------------------------------
-Directory::~Directory()
-{
-  delete this->Internal;
-}
-
-//----------------------------------------------------------------------------
-unsigned long Directory::GetNumberOfFiles() const
-{
-  return static_cast<unsigned long>(this->Internal->Files.size());
-}
-
-//----------------------------------------------------------------------------
-const char* Directory::GetFile(unsigned long dindex) const
-{
-  if ( dindex >= this->Internal->Files.size() )
-    {
-    return 0;
-    }
-  return this->Internal->Files[dindex].c_str();
-}
-
-//----------------------------------------------------------------------------
-const char* Directory::GetPath() const
-{
-  return this->Internal->Path.c_str();
-}
-
-//----------------------------------------------------------------------------
-void Directory::Clear()
-{
-  this->Internal->Path.resize(0);
-  this->Internal->Files.clear();
-}
-
-} // namespace KWSYS_NAMESPACE
-
-// First microsoft compilers
-
-#if defined(_MSC_VER) || defined(__WATCOMC__)
-#include <windows.h>
-#include <io.h>
-#include <ctype.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-namespace KWSYS_NAMESPACE
-{
-
-bool Directory::Load(const kwsys_stl::string& name)
-{
-  this->Clear();
-#if _MSC_VER < 1300
-  long srchHandle;
-#else
-  intptr_t srchHandle;
-#endif
-  char* buf;
-  size_t n = name.size();
-  if ( *name.rbegin() == '/' || *name.rbegin() == '\\' )
-    {
-    buf = new char[n + 1 + 1];
-    sprintf(buf, "%s*", name.c_str());
-    }
-  else
-    {
-    // Make sure the slashes in the wildcard suffix are consistent with the
-    // rest of the path
-    buf = new char[n + 2 + 1];
-    if ( name.find('\\') != name.npos )
-      {
-      sprintf(buf, "%s\\*", name.c_str());
-      }
-    else
-      {
-      sprintf(buf, "%s/*", name.c_str());
-      }
-    }
-  struct _wfinddata_t data;      // data of current file
-
-  // Now put them into the file array
-  srchHandle = _wfindfirst((wchar_t*)Encoding::ToWide(buf).c_str(), &data);
-  delete [] buf;
-
-  if ( srchHandle == -1 )
-    {
-    return 0;
-    }
-
-  // Loop through names
-  do
-    {
-    this->Internal->Files.push_back(Encoding::ToNarrow(data.name));
-    }
-  while ( _wfindnext(srchHandle, &data) != -1 );
-  this->Internal->Path = name;
-  return _findclose(srchHandle) != -1;
-}
-
-unsigned long Directory::GetNumberOfFilesInDirectory(const kwsys_stl::string& name)
-{
-#if _MSC_VER < 1300
-  long srchHandle;
-#else
-  intptr_t srchHandle;
-#endif
-  char* buf;
-  size_t n = name.size();
-  if ( *name.rbegin() == '/' )
-    {
-    buf = new char[n + 1 + 1];
-    sprintf(buf, "%s*", name.c_str());
-    }
-  else
-    {
-    buf = new char[n + 2 + 1];
-    sprintf(buf, "%s/*", name.c_str());
-    }
-  struct _wfinddata_t data;      // data of current file
-
-  // Now put them into the file array
-  srchHandle = _wfindfirst((wchar_t*)Encoding::ToWide(buf).c_str(), &data);
-  delete [] buf;
-
-  if ( srchHandle == -1 )
-    {
-    return 0;
-    }
-
-  // Loop through names
-  unsigned long count = 0;
-  do
-    {
-    count++;
-    }
-  while ( _wfindnext(srchHandle, &data) != -1 );
-  _findclose(srchHandle);
-  return count;
-}
-
-} // namespace KWSYS_NAMESPACE
-
-#else
-
-// Now the POSIX style directory access
-
-#include <sys/types.h>
-#include <dirent.h>
-
-/* There is a problem with the Portland compiler, large file
-support and glibc/Linux system headers: 
-http://www.pgroup.com/userforum/viewtopic.php?
-p=1992&sid=f16167f51964f1a68fe5041b8eb213b6
-*/
-#if defined(__PGI) && defined(__USE_FILE_OFFSET64)
-# define dirent dirent64
-#endif
-
-namespace KWSYS_NAMESPACE
-{
-
-bool Directory::Load(const kwsys_stl::string& name)
-{
-  this->Clear();
-   
-  DIR* dir = opendir(name.c_str());
-
-  if (!dir)
-    {
-    return 0;
-    }
-
-  for (dirent* d = readdir(dir); d; d = readdir(dir) )
-    {
-    this->Internal->Files.push_back(d->d_name);
-    }
-  this->Internal->Path = name;
-  closedir(dir);
-  return 1;
-}
-
-unsigned long Directory::GetNumberOfFilesInDirectory(const kwsys_stl::string& name)
-{
-  DIR* dir = opendir(name.c_str());
-
-  unsigned long count = 0;
-  for (dirent* d = readdir(dir); d; d = readdir(dir) )
-    {
-    count++;
-    }
-  closedir(dir);
-  return count;
-}
-
-} // namespace KWSYS_NAMESPACE
-
-#endif
diff --git a/src/kwsys/Directory.hxx.in b/src/kwsys/Directory.hxx.in
deleted file mode 100644
index 1bcf90e..0000000
--- a/src/kwsys/Directory.hxx.in
+++ /dev/null
@@ -1,91 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef @KWSYS_NAMESPACE at _Directory_hxx
-#define @KWSYS_NAMESPACE at _Directory_hxx
-
-#include <@KWSYS_NAMESPACE@/Configure.h>
-#include <@KWSYS_NAMESPACE@/stl/string>
-
-/* Define these macros temporarily to keep the code readable.  */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
-# define kwsys_stl @KWSYS_NAMESPACE at _stl
-#endif
-
-namespace @KWSYS_NAMESPACE@
-{
-
-class DirectoryInternals;
-
-/** \class Directory
- * \brief Portable directory/filename traversal.
- *
- * Directory provides a portable way of finding the names of the files
- * in a system directory.
- *
- * Directory currently works with Windows and Unix operating systems.
- */
-class @KWSYS_NAMESPACE at _EXPORT Directory
-{
-public:
-  Directory();
-  ~Directory();
-
-  /**
-   * Load the specified directory and load the names of the files
-   * in that directory. 0 is returned if the directory can not be
-   * opened, 1 if it is opened.
-   */
-  bool Load(const kwsys_stl::string&);
-
-  /**
-   * Return the number of files in the current directory.
-   */
-  unsigned long GetNumberOfFiles() const;
-
-  /**
-   * Return the number of files in the specified directory.
-   * A higher performance static method.
-   */
-  static unsigned long GetNumberOfFilesInDirectory(const kwsys_stl::string&);
-
-  /**
-   * Return the file at the given index, the indexing is 0 based
-   */
-  const char* GetFile(unsigned long) const;
-
-  /**
-   * Return the path to Open'ed directory
-   */
-  const char* GetPath() const;
-
-  /**
-   * Clear the internal structure. Used internally at beginning of Load(...)
-   * to clear the cache.
-   */
-  void Clear();
-
-private:
-  // Private implementation details.
-  DirectoryInternals* Internal;
-
-  Directory(const Directory&);  // Not implemented.
-  void operator=(const Directory&);  // Not implemented.
-}; // End Class: Directory
-
-} // namespace @KWSYS_NAMESPACE@
-
-/* Undefine temporary macros.  */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
-# undef kwsys_stl
-#endif
-
-#endif
diff --git a/src/kwsys/DynamicLoader.cxx b/src/kwsys/DynamicLoader.cxx
deleted file mode 100644
index 66c7d57..0000000
--- a/src/kwsys/DynamicLoader.cxx
+++ /dev/null
@@ -1,527 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#include "kwsysPrivate.h"
-#include KWSYS_HEADER(DynamicLoader.hxx)
-
-#include KWSYS_HEADER(Configure.hxx)
-
-// Work-around CMake dependency scanning limitation.  This must
-// duplicate the above list of headers.
-#if 0
-# include "DynamicLoader.hxx.in"
-# include "Configure.hxx.in"
-#endif
-
-// This file is actually 3 different implementations.
-// 1. HP machines which uses shl_load
-// 2. Mac OS X 10.2.x and earlier which uses NSLinkModule
-// 3. Windows which uses LoadLibrary
-// 4. Most unix systems (including Mac OS X 10.3 and later) which use dlopen
-// (default) Each part of the ifdef contains a complete implementation for
-// the static methods of DynamicLoader.
-
-// ---------------------------------------------------------------
-// 1. Implementation for HPUX  machines
-#ifdef __hpux
-#include <errno.h>
-#include <dl.h>
-#define DYNAMICLOADER_DEFINED 1
-
-namespace KWSYS_NAMESPACE
-{
-
-//----------------------------------------------------------------------------
-DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const kwsys_stl::string& libname )
-{
-  return shl_load(libname.c_str(), BIND_DEFERRED | DYNAMIC_PATH, 0L);
-}
-
-//----------------------------------------------------------------------------
-int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
-{
-  return !shl_unload(lib);
-}
-
-//----------------------------------------------------------------------------
-DynamicLoader::SymbolPointer
-DynamicLoader::GetSymbolAddress(DynamicLoader::LibraryHandle lib, const kwsys_stl::string& sym)
-{
-  void* addr;
-  int status;
-
-  /* TYPE_PROCEDURE Look for a function or procedure. (This used to be default)
-   * TYPE_DATA      Look for a symbol in the data segment (for example, variables).
-   * TYPE_UNDEFINED Look for any symbol.
-   */
-  status = shl_findsym (&lib, sym.c_str(), TYPE_UNDEFINED, &addr);
-  void* result = (status < 0) ? (void*)0 : addr;
-
-  // Hack to cast pointer-to-data to pointer-to-function.
-  return *reinterpret_cast<DynamicLoader::SymbolPointer*>(&result);
-}
-
-const char* DynamicLoader::LastError()
-{
-  // TODO: Need implementation with errno/strerror
-  /* If successful, shl_findsym returns an integer (int) value zero. If
-   * shl_findsym cannot find sym, it returns -1 and sets errno to zero.
-   * If any other errors occur, shl_findsym returns -1 and sets errno to one
-   * of these values (defined in <errno.h>):
-   * ENOEXEC
-   * A format error was detected in the specified library.
-   * ENOSYM
-   * A symbol on which sym depends could not be found.
-   * EINVAL
-   * The specified handle is invalid.
-   */
-
-  if(  errno == ENOEXEC
-    || errno == ENOSYM
-    || errno == EINVAL )
-    {
-    return strerror(errno);
-    }
-  // else
-  return 0;
-}
-
-} // namespace KWSYS_NAMESPACE
-
-#endif //__hpux
-
-
-// ---------------------------------------------------------------
-// 2. Implementation for Mac OS X 10.2.x and earlier
-#ifdef __APPLE__
-#if MAC_OS_X_VERSION_MAX_ALLOWED < 1030
-#include <string.h> // for strlen
-#include <mach-o/dyld.h>
-#define DYNAMICLOADER_DEFINED 1
-
-namespace KWSYS_NAMESPACE
-{
-
-//----------------------------------------------------------------------------
-DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const kwsys_stl::string& libname )
-{
-  NSObjectFileImageReturnCode rc;
-  NSObjectFileImage image = 0;
-
-  rc = NSCreateObjectFileImageFromFile(libname.c_str(), &image);
-  // rc == NSObjectFileImageInappropriateFile when trying to load a dylib file
-  if( rc != NSObjectFileImageSuccess )
-    {
-    return 0;
-    }
-  NSModule handle = NSLinkModule(image, libname.c_str(),
-    NSLINKMODULE_OPTION_BINDNOW|NSLINKMODULE_OPTION_RETURN_ON_ERROR);
-  NSDestroyObjectFileImage(image);
-  return handle;
-}
-
-//----------------------------------------------------------------------------
-int DynamicLoader::CloseLibrary( DynamicLoader::LibraryHandle lib)
-{
-  // NSUNLINKMODULE_OPTION_KEEP_MEMORY_MAPPED
-  // With  this  option  the memory for the module is not deallocated
-  // allowing pointers into the module to still be valid.
-  // You should use this option instead if your code experience some problems
-  // reported against Panther 10.3.9 (fixed in Tiger 10.4.2 and up)
-  bool success = NSUnLinkModule(lib, NSUNLINKMODULE_OPTION_NONE);
-  return success;
-}
-
-//----------------------------------------------------------------------------
-DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
-  DynamicLoader::LibraryHandle lib, const kwsys_stl::string& sym)
-{
-  void *result=0;
-  // Need to prepend symbols with '_' on Apple-gcc compilers
-  size_t len = sym.size();
-  char *rsym = new char[len + 1 + 1];
-  strcpy(rsym, "_");
-  strcat(rsym+1, sym.c_str());
-
-  NSSymbol symbol = NSLookupSymbolInModule(lib, rsym);
-  if(symbol)
-    {
-    result = NSAddressOfSymbol(symbol);
-    }
-
-  delete[] rsym;
-  // Hack to cast pointer-to-data to pointer-to-function.
-  return *reinterpret_cast<DynamicLoader::SymbolPointer*>(&result);
-}
-
-//----------------------------------------------------------------------------
-const char* DynamicLoader::LastError()
-{
-  return 0;
-}
-
-} // namespace KWSYS_NAMESPACE
-
-#endif // MAC_OS_X_VERSION_MAX_ALLOWED < 1030
-#endif // __APPLE__
-
-// ---------------------------------------------------------------
-// 3. Implementation for Windows win32 code but not cygwin
-#if defined(_WIN32) && !defined(__CYGWIN__)
-#include <windows.h>
-#define DYNAMICLOADER_DEFINED 1
-
-namespace KWSYS_NAMESPACE
-{
-
-//----------------------------------------------------------------------------
-DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const kwsys_stl::string& libname)
-{
-  DynamicLoader::LibraryHandle lh;
-  int length = MultiByteToWideChar(CP_UTF8, 0, libname.c_str(), -1, NULL, 0);
-  wchar_t* wchars = new wchar_t[length+1];
-  wchars[0] = '\0';
-  MultiByteToWideChar(CP_UTF8, 0, libname.c_str(), -1, wchars, length);
-  lh = LoadLibraryW(wchars);
-  delete [] wchars;
-  return lh;
-}
-
-//----------------------------------------------------------------------------
-int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
-{
-  return (int)FreeLibrary(lib);
-}
-
-//----------------------------------------------------------------------------
-DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
-  DynamicLoader::LibraryHandle lib, const kwsys_stl::string& sym)
-{
-  // TODO: The calling convention affects the name of the symbol.  We
-  // should have a tool to help get the symbol with the desired
-  // calling convention.  Currently we assume cdecl.
-  //
-  // Borland:
-  //   __cdecl    = "_func" (default)
-  //   __fastcall = "@_func"
-  //   __stdcall  = "func"
-  //
-  // Watcom:
-  //   __cdecl    = "_func"
-  //   __fastcall = "@_func at X"
-  //   __stdcall  = "_func at X"
-  //   __watcall  = "func_" (default)
-  //
-  // MSVC:
-  //   __cdecl    = "func" (default)
-  //   __fastcall = "@_func at X"
-  //   __stdcall  = "_func at X"
-  //
-  // Note that the "@X" part of the name above is the total size (in
-  // bytes) of the arguments on the stack.
-  void *result;
-#if defined(__BORLANDC__) || defined(__WATCOMC__)
-  // Need to prepend symbols with '_'
-  size_t len = sym.size();
-  char *rsym = new char[len + 1 + 1];
-  strcpy(rsym, "_");
-  strcat(rsym, sym.c_str());
-#else
-  const char *rsym = sym.c_str();
-#endif
-  result = (void*)GetProcAddress(lib, rsym);
-#if defined(__BORLANDC__) || defined(__WATCOMC__)
-  delete[] rsym;
-#endif
-  // Hack to cast pointer-to-data to pointer-to-function.
-#ifdef __WATCOMC__
-  return *(DynamicLoader::SymbolPointer*)(&result);
-#else
-  return *reinterpret_cast<DynamicLoader::SymbolPointer*>(&result);
-#endif
-}
-
-//----------------------------------------------------------------------------
-const char* DynamicLoader::LastError()
-{
-  LPVOID lpMsgBuf=NULL;
-
-  FormatMessage(
-    FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
-    NULL,
-    GetLastError(),
-    MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
-    (LPTSTR) &lpMsgBuf,
-    0,
-    NULL
-    );
-
-  if(!lpMsgBuf)
-    {
-    return NULL;
-    }
-
-  static char* str = 0;
-  delete [] str;
-  str = strcpy(new char[strlen((char*)lpMsgBuf)+1], (char*)lpMsgBuf);
-  // Free the buffer.
-  LocalFree( lpMsgBuf );
-  return str;
-}
-
-} // namespace KWSYS_NAMESPACE
-
-#endif //_WIN32
-
-// ---------------------------------------------------------------
-// 4. Implementation for BeOS
-#if defined __BEOS__
-
-#include <string.h> // for strerror()
-
-#include <be/kernel/image.h>
-#include <be/support/Errors.h>
-
-#define DYNAMICLOADER_DEFINED 1
-
-namespace KWSYS_NAMESPACE
-{
-
-static image_id last_dynamic_err = B_OK;
-
-//----------------------------------------------------------------------------
-DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const kwsys_stl::string& libname )
-{
-  // image_id's are integers, errors are negative. Add one just in case we
-  //  get a valid image_id of zero (is that even possible?).
-  image_id rc = load_add_on(libname.c_str());
-  if (rc < 0)
-    {
-    last_dynamic_err = rc;
-    return 0;
-    }
-
-  return rc+1;
-}
-
-//----------------------------------------------------------------------------
-int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
-{
-  if (!lib)
-    {
-      last_dynamic_err = B_BAD_VALUE;
-      return 0;
-    }
-  else
-    {
-    // The function dlclose() returns 0 on success, and non-zero on error.
-    status_t rc = unload_add_on(lib-1);
-    if (rc != B_OK)
-      {
-      last_dynamic_err = rc;
-      return 0;
-      }
-    }
-
-  return 1;
-}
-
-//----------------------------------------------------------------------------
-DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
-  DynamicLoader::LibraryHandle lib, const kwsys_stl::string& sym)
-{
-  // Hack to cast pointer-to-data to pointer-to-function.
-  union 
-  {
-    void* pvoid;
-    DynamicLoader::SymbolPointer psym;
-  } result;
-
-  result.psym = NULL;
-
-  if (!lib)
-    {
-      last_dynamic_err = B_BAD_VALUE;
-    }
-  else
-    {
-    // !!! FIXME: BeOS can do function-only lookups...does this ever
-    // !!! FIXME:  actually _want_ a data symbol lookup, or was this union
-    // !!! FIXME:  a leftover of dlsym()? (s/ANY/TEXT for functions only).
-    status_t rc = get_image_symbol(lib-1,sym.c_str(),B_SYMBOL_TYPE_ANY,&result.pvoid);
-    if (rc != B_OK)
-      {
-      last_dynamic_err = rc;
-      result.psym = NULL;
-      }
-    }
-  return result.psym;
-}
-
-//----------------------------------------------------------------------------
-const char* DynamicLoader::LastError()
-{
-  const char *retval = strerror(last_dynamic_err);
-  last_dynamic_err = B_OK;
-  return retval;
-}
-
-} // namespace KWSYS_NAMESPACE
-#endif
-
-// ---------------------------------------------------------------
-// 5. Implementation for systems without dynamic libs
-// __gnu_blrts__ is IBM BlueGene/L
-// __LIBCATAMOUNT__ is defined on Catamount on Cray compute nodes
-#if defined(__gnu_blrts__) || defined(__LIBCATAMOUNT__) || defined(__CRAYXT_COMPUTE_LINUX_TARGET)
-#include <string.h> // for strerror()
-#define DYNAMICLOADER_DEFINED 1
-
-namespace KWSYS_NAMESPACE
-{
-
-//----------------------------------------------------------------------------
-DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const kwsys_stl::string& libname )
-{
-  return 0;
-}
-
-//----------------------------------------------------------------------------
-int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
-{
-  if (!lib)
-    {
-    return 0;
-    }
-
-  return 1;
-}
-
-//----------------------------------------------------------------------------
-DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
-    DynamicLoader::LibraryHandle lib, const kwsys_stl::string& sym)
-{
-  return 0;
-}
-
-//----------------------------------------------------------------------------
-const char* DynamicLoader::LastError()
-  {
-  return "General error";
-  }
-
-} // namespace KWSYS_NAMESPACE
-#endif
-
-#ifdef __MINT__
-#define DYNAMICLOADER_DEFINED 1
-#define _GNU_SOURCE /* for program_invocation_name */
-#include <string.h>
-#include <malloc.h>
-#include <errno.h>
-#include <dld.h>
-
-namespace KWSYS_NAMESPACE
-{
-
-//----------------------------------------------------------------------------
-DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const kwsys_stl::string& libname )
-{
-  char *name = (char *)calloc(1, libname.size() + 1);
-  dld_init(program_invocation_name);
-  strncpy(name, libname.c_str(), libname.size());
-  dld_link(libname.c_str());
-  return (void *)name;
-}
-
-//----------------------------------------------------------------------------
-int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
-{
-  dld_unlink_by_file((char *)lib, 0);
-  free(lib);
-  return 0;
-}
-
-//----------------------------------------------------------------------------
-DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
-  DynamicLoader::LibraryHandle lib, const kwsys_stl::string& sym)
-{
-  // Hack to cast pointer-to-data to pointer-to-function.
-  union
-  {
-    void* pvoid;
-    DynamicLoader::SymbolPointer psym;
-  } result;
-  result.pvoid = dld_get_symbol(sym.c_str());
-  return result.psym;
-}
-
-//----------------------------------------------------------------------------
-const char* DynamicLoader::LastError()
-{
-  return dld_strerror(dld_errno);
-}
-
-} // namespace KWSYS_NAMESPACE
-#endif
-
-// ---------------------------------------------------------------
-// 6. Implementation for default UNIX machines.
-// if nothing has been defined then use this
-#ifndef DYNAMICLOADER_DEFINED
-#define DYNAMICLOADER_DEFINED 1
-// Setup for most unix machines
-#include <dlfcn.h>
-
-namespace KWSYS_NAMESPACE
-{
-
-//----------------------------------------------------------------------------
-DynamicLoader::LibraryHandle DynamicLoader::OpenLibrary(const kwsys_stl::string& libname )
-{
-  return dlopen(libname.c_str(), RTLD_LAZY);
-}
-
-//----------------------------------------------------------------------------
-int DynamicLoader::CloseLibrary(DynamicLoader::LibraryHandle lib)
-{
-  if (lib)
-    {
-    // The function dlclose() returns 0 on success, and non-zero on error.
-    return !dlclose(lib);
-    }
-  // else
-  return 0;
-}
-
-//----------------------------------------------------------------------------
-DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
-  DynamicLoader::LibraryHandle lib, const kwsys_stl::string& sym)
-{
-  // Hack to cast pointer-to-data to pointer-to-function.
-  union 
-  {
-    void* pvoid;
-    DynamicLoader::SymbolPointer psym;
-  } result;
-  result.pvoid = dlsym(lib, sym.c_str());
-  return result.psym;
-}
-
-//----------------------------------------------------------------------------
-const char* DynamicLoader::LastError()
-{
-  return dlerror();
-}
-
-} // namespace KWSYS_NAMESPACE
-
-#endif
diff --git a/src/kwsys/DynamicLoader.hxx.in b/src/kwsys/DynamicLoader.hxx.in
deleted file mode 100644
index 75811ab..0000000
--- a/src/kwsys/DynamicLoader.hxx.in
+++ /dev/null
@@ -1,112 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef @KWSYS_NAMESPACE at _DynamicLoader_hxx
-#define @KWSYS_NAMESPACE at _DynamicLoader_hxx
-
-#include <@KWSYS_NAMESPACE@/Configure.h>
-#include <@KWSYS_NAMESPACE@/stl/string>
-
-#if defined(__hpux)
-  #include <dl.h>
-#elif defined(_WIN32) && !defined(__CYGWIN__)
-  #include <windows.h>
-#elif defined(__APPLE__)
-  #include <AvailabilityMacros.h>
-  #if MAC_OS_X_VERSION_MAX_ALLOWED < 1030
-    #include <mach-o/dyld.h>
-  #endif
-#elif defined(__BEOS__)
-  #include <be/kernel/image.h>
-#endif
-
-/* Define these macros temporarily to keep the code readable.  */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
-# define kwsys_stl @KWSYS_NAMESPACE at _stl
-#endif
-
-namespace @KWSYS_NAMESPACE@
-{
-/** \class DynamicLoader
- * \brief Portable loading of dynamic libraries or dll's.
- *
- * DynamicLoader provides a portable interface to loading dynamic
- * libraries or dll's into a process.
- *
- * Directory currently works with Windows, Apple, HP-UX and Unix (POSIX)
- * operating systems
- *
- * \warning dlopen on *nix system works the following way:
- * If filename contains a slash ("/"), then it is interpreted as a (relative
- * or absolute) pathname.  Otherwise, the dynamic linker searches for the
- * library as follows : see ld.so(8) for further details):
- * Whereas this distinction does not exist on Win32. Therefore ideally you
- * should be doing full path to garantee to have a consistent way of dealing
- * with dynamic loading of shared library.
- *
- * \warning the Cygwin implementation do not use the Win32 HMODULE. Put extra
- * condition so that we can include the correct declaration (POSIX)
- */
-
-class @KWSYS_NAMESPACE at _EXPORT DynamicLoader
-{
-public:
-// Ugly stuff for library handles
-// They are different on several different OS's
-#if defined(__hpux)
-  typedef shl_t LibraryHandle;
-#elif defined(_WIN32) && !defined(__CYGWIN__)
-  typedef HMODULE LibraryHandle;
-#elif defined(__APPLE__)
-  #if MAC_OS_X_VERSION_MAX_ALLOWED < 1030
-    typedef NSModule LibraryHandle;
-  #else
-    typedef void* LibraryHandle;
-  #endif
-#elif defined(__BEOS__)
-  typedef image_id LibraryHandle;
-#else  // POSIX
-  typedef void* LibraryHandle;
-#endif
-
-  // Return type from DynamicLoader::GetSymbolAddress.
-  typedef void (*SymbolPointer)();
-
-  /** Load a dynamic library into the current process.
-   * The returned LibraryHandle can be used to access the symbols in the
-   * library. */
-  static LibraryHandle OpenLibrary(const kwsys_stl::string&);
-
-  /** Attempt to detach a dynamic library from the
-   * process.  A value of true is returned if it is sucessful. */
-  static int CloseLibrary(LibraryHandle);
-
-  /** Find the address of the symbol in the given library. */
-  static SymbolPointer GetSymbolAddress(LibraryHandle, const kwsys_stl::string&);
-
-  /** Return the default module prefix for the current platform.  */
-  static const char* LibPrefix() { return "@KWSYS_DynamicLoader_PREFIX@"; }
-
-  /** Return the default module suffix for the current platform.  */
-  static const char* LibExtension() { return "@KWSYS_DynamicLoader_SUFFIX@"; }
-
-  /** Return the last error produced from a calls made on this class. */
-  static const char* LastError();
-}; // End Class: DynamicLoader
-
-} // namespace @KWSYS_NAMESPACE@
-
-/* Undefine temporary macros.  */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
-# undef kwsys_stl
-#endif
-
-#endif
diff --git a/src/kwsys/Encoding.hxx.in b/src/kwsys/Encoding.hxx.in
deleted file mode 100644
index aba4175..0000000
--- a/src/kwsys/Encoding.hxx.in
+++ /dev/null
@@ -1,87 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef @KWSYS_NAMESPACE at _Encoding_hxx
-#define @KWSYS_NAMESPACE at _Encoding_hxx
-
-#include <@KWSYS_NAMESPACE@/Configure.hxx>
-#include <@KWSYS_NAMESPACE@/stl/string>
-#include <@KWSYS_NAMESPACE@/stl/vector>
-
-/* Define these macros temporarily to keep the code readable.  */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
-# define kwsys_stl @KWSYS_NAMESPACE at _stl
-#endif
-
-namespace @KWSYS_NAMESPACE@
-{
-class @KWSYS_NAMESPACE at _EXPORT Encoding
-{
-public:
-
-  // Container class for argc/argv.
-  class CommandLineArguments
-  {
-    public:
-      // On Windows, get the program command line arguments
-      // in this Encoding module's 8 bit encoding.
-      // On other platforms the given argc/argv is used, and
-      // to be consistent, should be the argc/argv from main().
-      static CommandLineArguments Main(int argc, char const* const* argv);
-
-      // Construct CommandLineArguments with the given
-      // argc/argv.  It is assumed that the string is already
-      // in the encoding used by this module.
-      CommandLineArguments(int argc, char const* const* argv);
-
-      // Construct CommandLineArguments with the given
-      // argc and wide argv.  This is useful if wmain() is used.
-      CommandLineArguments(int argc, wchar_t const* const* argv);
-      ~CommandLineArguments();
-      CommandLineArguments(const CommandLineArguments&);
-      CommandLineArguments& operator=(const CommandLineArguments&);
-
-      int argc() const;
-      char const* const* argv() const;
-
-    protected:
-      std::vector<char*> argv_;
-  };
-
-  /**
-   * Convert between char and wchar_t
-   */
-
-#if @KWSYS_NAMESPACE at _STL_HAS_WSTRING
-
-  // Convert a narrow string to a wide string.
-  // On Windows, UTF-8 is assumed, and on other platforms,
-  // the current locale is assumed.
-  static kwsys_stl::wstring ToWide(const kwsys_stl::string& str);
-  static kwsys_stl::wstring ToWide(const char* str);
-
-  // Convert a wide string to a narrow string.
-  // On Windows, UTF-8 is assumed, and on other platforms,
-  // the current locale is assumed.
-  static kwsys_stl::string ToNarrow(const kwsys_stl::wstring& str);
-  static kwsys_stl::string ToNarrow(const wchar_t* str);
-
-#endif // @KWSYS_NAMESPACE at _STL_HAS_WSTRING
-
-}; // class Encoding
-} // namespace @KWSYS_NAMESPACE@
-
-/* Undefine temporary macros.  */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
-# undef kwsys_stl
-#endif
-
-#endif
diff --git a/src/kwsys/EncodingC.c b/src/kwsys/EncodingC.c
index cda78e2..32b9bff 100644
--- a/src/kwsys/EncodingC.c
+++ b/src/kwsys/EncodingC.c
@@ -44,9 +44,12 @@ wchar_t* kwsysEncoding_DupToWide(const char* str)
   size_t length = kwsysEncoding_mbstowcs(NULL, str, 0) + 1;
   if(length > 0)
     {
-    ret = malloc((length)*sizeof(wchar_t));
-    ret[0] = 0;
-    kwsysEncoding_mbstowcs(ret, str, length);
+    ret = (wchar_t*)malloc((length)*sizeof(wchar_t));
+    if(ret)
+      {
+      ret[0] = 0;
+      kwsysEncoding_mbstowcs(ret, str, length);
+      }
     }
   return ret;
 }
@@ -71,9 +74,12 @@ char* kwsysEncoding_DupToNarrow(const wchar_t* str)
   size_t length = kwsysEncoding_wcstombs(0, str, 0) + 1;
   if(length > 0)
     {
-    ret = malloc(length);
-    ret[0] = 0;
-    kwsysEncoding_wcstombs(ret, str, length);
+    ret = (char*)malloc(length);
+    if(ret)
+      {
+      ret[0] = 0;
+      kwsysEncoding_wcstombs(ret, str, length);
+      }
     }
   return ret;
 }
diff --git a/src/kwsys/EncodingCXX.cxx b/src/kwsys/EncodingCXX.cxx
deleted file mode 100644
index 251a56d..0000000
--- a/src/kwsys/EncodingCXX.cxx
+++ /dev/null
@@ -1,184 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-
-#ifdef __osf__
-#  define _OSF_SOURCE
-#  define _POSIX_C_SOURCE 199506L
-#  define _XOPEN_SOURCE_EXTENDED
-#endif
-
-#include "kwsysPrivate.h"
-#include KWSYS_HEADER(Encoding.hxx)
-#include KWSYS_HEADER(Encoding.h)
-#include KWSYS_HEADER(stl/vector)
-
-// Work-around CMake dependency scanning limitation.  This must
-// duplicate the above list of headers.
-#if 0
-# include "Encoding.hxx.in"
-# include "Encoding.h.in"
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-
-#ifdef _MSC_VER
-# pragma warning (disable: 4786)
-#endif
-
-// Windows API.
-#if defined(_WIN32)
-# include <windows.h>
-#endif
-
-namespace KWSYS_NAMESPACE
-{
-
-Encoding::CommandLineArguments
-Encoding::CommandLineArguments::Main(int argc, char const* const* argv)
-{
-#ifdef _WIN32
-  (void) argc;
-  (void) argv;
-
-  int ac;
-  LPWSTR* w_av = CommandLineToArgvW(GetCommandLineW(), &ac);
-
-  std::vector<std::string> av1(ac);
-  std::vector<char const*> av2(ac);
-  for(int i=0; i<ac; i++)
-    {
-    av1[i] = ToNarrow(w_av[i]);
-    av2[i] = av1[i].c_str();
-    }
-  LocalFree(w_av);
-  return CommandLineArguments(ac, &av2[0]);
-#else
-  return CommandLineArguments(argc, argv);
-#endif
-}
-
-Encoding::CommandLineArguments::CommandLineArguments(int ac,
-                                                     char const* const* av)
-{
-  this->argv_.resize(ac+1);
-  for(int i=0; i<ac; i++)
-    {
-    this->argv_[i] = strdup(av[i]);
-    }
-  this->argv_[ac] = 0;
-}
-
-Encoding::CommandLineArguments::CommandLineArguments(int ac,
-                                                     wchar_t const* const* av)
-{
-  this->argv_.resize(ac+1);
-  for(int i=0; i<ac; i++)
-    {
-    this->argv_[i] = kwsysEncoding_DupToNarrow(av[i]);
-    }
-  this->argv_[ac] = 0;
-}
-
-Encoding::CommandLineArguments::~CommandLineArguments()
-{
-  for(size_t i=0; i<this->argv_.size(); i++)
-    {
-    free(argv_[i]);
-    }
-}
-
-Encoding::CommandLineArguments::
-  CommandLineArguments(const CommandLineArguments& other)
-{
-  this->argv_.resize(other.argv_.size());
-  for(size_t i=0; i<this->argv_.size(); i++)
-    {
-    this->argv_[i] = other.argv_[i] ? strdup(other.argv_[i]) : 0;
-    }
-}
-
-Encoding::CommandLineArguments&
-Encoding::CommandLineArguments::operator=(const CommandLineArguments& other)
-{
-  if(this != &other)
-    {
-    size_t i;
-    for(i=0; i<this->argv_.size(); i++)
-      {
-      free(this->argv_[i]);
-      }
-
-    this->argv_.resize(other.argv_.size());
-    for(i=0; i<this->argv_.size(); i++)
-      {
-      this->argv_[i] = other.argv_[i] ? strdup(other.argv_[i]) : 0;
-      }
-    }
-
-  return *this;
-}
-
-int Encoding::CommandLineArguments::argc() const
-{
-  return static_cast<int>(this->argv_.size() - 1);
-}
-
-char const* const* Encoding::CommandLineArguments::argv() const
-{
-  return &this->argv_[0];
-}
-
-#if KWSYS_STL_HAS_WSTRING
-
-kwsys_stl::wstring Encoding::ToWide(const kwsys_stl::string& str)
-{
-  return ToWide(str.c_str());
-}
-
-kwsys_stl::string Encoding::ToNarrow(const kwsys_stl::wstring& str)
-{
-  return ToNarrow(str.c_str());
-}
-
-kwsys_stl::wstring Encoding::ToWide(const char* cstr)
-{
-  kwsys_stl::wstring wstr;
-  size_t length = kwsysEncoding_mbstowcs(0, cstr, 0) + 1;
-  if(length > 0)
-    {
-    kwsys_stl::vector<wchar_t> wchars(length);
-    if(kwsysEncoding_mbstowcs(&wchars[0], cstr, length) > 0)
-      {
-      wstr = &wchars[0];
-      }
-    }
-  return wstr;
-}
-
-kwsys_stl::string Encoding::ToNarrow(const wchar_t* wcstr)
-{
-  kwsys_stl::string str;
-  size_t length = kwsysEncoding_wcstombs(0, wcstr, 0) + 1;
-  if(length > 0)
-    {
-    std::vector<char> chars(length);
-    if(kwsysEncoding_wcstombs(&chars[0], wcstr, length) > 0)
-      {
-      str = &chars[0];
-      }
-    }
-  return str;
-}
-#endif // KWSYS_STL_HAS_WSTRING
-
-} // namespace KWSYS_NAMESPACE
diff --git a/src/kwsys/ExtraTest.cmake.in b/src/kwsys/ExtraTest.cmake.in
deleted file mode 100644
index e8c0a1c..0000000
--- a/src/kwsys/ExtraTest.cmake.in
+++ /dev/null
@@ -1 +0,0 @@
-MESSAGE("*** This message is generated by message inside a file that is included in DartTestfile.txt ***")
diff --git a/src/kwsys/FStream.cxx b/src/kwsys/FStream.cxx
deleted file mode 100644
index 018652c..0000000
--- a/src/kwsys/FStream.cxx
+++ /dev/null
@@ -1,76 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#include "kwsysPrivate.h"
-#include KWSYS_HEADER(FStream.hxx)
-
-// Work-around CMake dependency scanning limitation.  This must
-// duplicate the above list of headers.
-#if 0
-# include "FStream.hxx.in"
-#endif
-
-namespace KWSYS_NAMESPACE
-{
-namespace FStream
-{
-
-BOM ReadBOM(std::istream& in)
-{
-  if(!in.good())
-    {
-    return BOM_None;
-    }
-  unsigned long orig = in.tellg();
-  unsigned char bom[4];
-  in.read(reinterpret_cast<char*>(bom), 2);
-  if(!in.good())
-    {
-    in.seekg(orig);
-    return BOM_None;
-    }
-  if(bom[0] == 0xEF && bom[1] == 0xBB)
-    {
-    in.read(reinterpret_cast<char*>(bom+2), 1);
-    if(in.good() && bom[2] == 0xBF)
-      {
-      return BOM_UTF8;
-      }
-    }
-  else if(bom[0] == 0xFE && bom[1] == 0xFF)
-    {
-    return BOM_UTF16BE;
-    }
-  else if(bom[0] == 0x00 && bom[1] == 0x00)
-    {
-    in.read(reinterpret_cast<char*>(bom+2), 2);
-    if(in.good() && bom[2] == 0xFE && bom[3] == 0xFF)
-      {
-      return BOM_UTF32BE;
-      }
-    }
-  else if(bom[0] == 0xFF && bom[1] == 0xFE)
-    {
-    unsigned long p = in.tellg();
-    in.read(reinterpret_cast<char*>(bom+2), 2);
-    if(in.good() && bom[2] == 0x00 && bom[3] == 0x00)
-      {
-      return BOM_UTF32LE;
-      }
-    in.seekg(p);
-    return BOM_UTF16LE;
-    }
-  in.seekg(orig);
-  return BOM_None;
-}
-
-} // FStream namespace
-} //KWSYS_NAMESPACE
diff --git a/src/kwsys/FStream.hxx.in b/src/kwsys/FStream.hxx.in
deleted file mode 100644
index 45425ff..0000000
--- a/src/kwsys/FStream.hxx.in
+++ /dev/null
@@ -1,188 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef @KWSYS_NAMESPACE at _FStream_hxx
-#define @KWSYS_NAMESPACE at _FStream_hxx
-
-#include <@KWSYS_NAMESPACE@/ios/fstream>
-#include <@KWSYS_NAMESPACE@/Encoding.hxx>
-
-namespace @KWSYS_NAMESPACE@
-{
-#if defined(_MSC_VER) && _MSC_VER >= 1400
-  template<typename CharType,typename Traits>
-  class basic_filebuf : public std::basic_filebuf<CharType,Traits>
-  {
-    public:
-      typedef std::basic_filebuf<CharType,Traits> my_base_type;
-      basic_filebuf *open(char const *s,std::ios_base::openmode mode)
-      {
-        return static_cast<basic_filebuf*>(
-          my_base_type::open(Encoding::ToWide(s).c_str(), mode)
-          );
-      }
-  };
-
-  template<typename CharType,typename Traits = std::char_traits<CharType> >
-  class basic_ifstream : public std::basic_istream<CharType,Traits>
-  {
-  public:
-    typedef basic_filebuf<CharType,Traits> internal_buffer_type;
-    typedef std::basic_istream<CharType,Traits> internal_stream_type;
-
-    basic_ifstream() : internal_stream_type(new internal_buffer_type())
-    {
-      buf_ = static_cast<internal_buffer_type *>(internal_stream_type::rdbuf());
-    }
-    explicit basic_ifstream(char const *file_name,
-                            std::ios_base::openmode mode = std::ios_base::in)
-      : internal_stream_type(new internal_buffer_type())
-    {
-      buf_ = static_cast<internal_buffer_type *>(internal_stream_type::rdbuf());
-      open(file_name,mode);
-    }
-    void open(char const *file_name,std::ios_base::openmode mode = std::ios_base::in)
-    {
-      if(!buf_->open(file_name,mode | std::ios_base::in))
-        {
-        this->setstate(std::ios_base::failbit);
-        }
-      else
-        {
-        this->clear();
-        }
-    }
-    bool is_open()
-    {
-      return buf_->is_open();
-    }
-    bool is_open() const
-    {
-      return buf_->is_open();
-    }
-    void close()
-    {
-      if(!buf_->close())
-        {
-        this->setstate(std::ios_base::failbit);
-        }
-      else
-      {
-        this->clear();
-      }
-    }
-
-    internal_buffer_type *rdbuf() const
-    {
-      return buf_;
-    }
-
-    ~basic_ifstream()
-    {
-      buf_->close();
-      delete buf_;
-    }
-
-  private:
-    internal_buffer_type* buf_;
-};
-
-template<typename CharType,typename Traits = std::char_traits<CharType> >
-class basic_ofstream : public std::basic_ostream<CharType,Traits>
-{
-  public:
-  typedef basic_filebuf<CharType,Traits> internal_buffer_type;
-  typedef std::basic_ostream<CharType,Traits> internal_stream_type;
-
-  basic_ofstream() : internal_stream_type(new internal_buffer_type())
-  {
-  buf_ = static_cast<internal_buffer_type *>(internal_stream_type::rdbuf());
-  }
-  explicit basic_ofstream(char const *file_name,std::ios_base::openmode mode = std::ios_base::out) :
-  internal_stream_type(new internal_buffer_type())
-  {
-    buf_ = static_cast<internal_buffer_type *>(internal_stream_type::rdbuf());
-    open(file_name,mode);
-  }
-  void open(char const *file_name,std::ios_base::openmode mode = std::ios_base::out)
-  {
-    if(!buf_->open(file_name,mode | std::ios_base::out))
-    {
-    this->setstate(std::ios_base::failbit);
-    }
-    else
-    {
-    this->clear();
-    }
-  }
-  bool is_open()
-  {
-    return buf_->is_open();
-  }
-  bool is_open() const
-  {
-    return buf_->is_open();
-  }
-  void close()
-  {
-    if(!buf_->close())
-      {
-      this->setstate(std::ios_base::failbit);
-      }
-    else
-      {
-      this->clear();
-      }
-  }
-
-  internal_buffer_type *rdbuf() const
-  {
-    return buf_.get();
-  }
-  ~basic_ofstream()
-  {
-    buf_->close();
-    delete buf_;
-  }
-
-  private:
-  internal_buffer_type* buf_;
-};
-
-  typedef basic_ifstream<char> ifstream;
-  typedef basic_ofstream<char> ofstream;
-
-#else
-  using @KWSYS_NAMESPACE at _ios_namespace::ofstream;
-  using @KWSYS_NAMESPACE at _ios_namespace::ifstream;
-#endif
-
-  namespace FStream
-  {
-    enum BOM
-    {
-      BOM_None,
-      BOM_UTF8,
-      BOM_UTF16BE,
-      BOM_UTF16LE,
-      BOM_UTF32BE,
-      BOM_UTF32LE
-    };
-
-    // Read a BOM, if one exists.
-    // If a BOM exists, the stream is advanced to after the BOM.
-    // This function requires a seekable stream (but not a relative
-    // seekable stream).
-    BOM ReadBOM(std::istream& in);
-  }
-}
-
-#endif
diff --git a/src/kwsys/FundamentalType.h.in b/src/kwsys/FundamentalType.h.in
deleted file mode 100644
index ff20063..0000000
--- a/src/kwsys/FundamentalType.h.in
+++ /dev/null
@@ -1,146 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef @KWSYS_NAMESPACE at _FundamentalType_h
-#define @KWSYS_NAMESPACE at _FundamentalType_h
-
-#include <@KWSYS_NAMESPACE@/Configure.h>
-
-/* Redefine all public interface symbol names to be in the proper
-   namespace.  These macros are used internally to kwsys only, and are
-   not visible to user code.  Use kwsysHeaderDump.pl to reproduce
-   these macros after making changes to the interface.  */
-#if !defined(KWSYS_NAMESPACE)
-# define kwsys_ns(x) @KWSYS_NAMESPACE@##x
-# define kwsysEXPORT @KWSYS_NAMESPACE at _EXPORT
-#endif
-
-#if !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
-# define kwsysFundamentalType        kwsys_ns(FundamentalType)
-# define kwsysFundamentalType_Int8   kwsys_ns(FundamentalType_Int8)
-# define kwsysFundamentalType_UInt8  kwsys_ns(FundamentalType_UInt8)
-# define kwsysFundamentalType_Int16  kwsys_ns(FundamentalType_Int16)
-# define kwsysFundamentalType_UInt16 kwsys_ns(FundamentalType_UInt16)
-# define kwsysFundamentalType_Int32  kwsys_ns(FundamentalType_Int32)
-# define kwsysFundamentalType_UInt32 kwsys_ns(FundamentalType_UInt32)
-# define kwsysFundamentalType_Int64  kwsys_ns(FundamentalType_Int64)
-# define kwsysFundamentalType_UInt64 kwsys_ns(FundamentalType_UInt64)
-#endif
-
-/* The size of fundamental types.  Types that do not exist have size 0.  */
- at KWSYS_C_CODE_SIZEOF_CHAR@
- at KWSYS_C_CODE_SIZEOF_SHORT@
- at KWSYS_C_CODE_SIZEOF_INT@
- at KWSYS_C_CODE_SIZEOF_LONG@
- at KWSYS_C_CODE_SIZEOF_LONG_LONG@
- at KWSYS_C_CODE_SIZEOF___INT64@
-
-/* Whether types "long long" and "__int64" are enabled.  If a type is
-   enabled then it is a unique fundamental type.  */
-#define @KWSYS_NAMESPACE at _USE_LONG_LONG @KWSYS_USE_LONG_LONG@
-#define @KWSYS_NAMESPACE at _USE___INT64 @KWSYS_USE___INT64@
-
-/* Whether type "char" is signed (it may be signed or unsigned).  */
-#define @KWSYS_NAMESPACE at _CHAR_IS_SIGNED @KWSYS_CHAR_IS_SIGNED@
-
-#if defined(__cplusplus)
-extern "C"
-{
-#endif
-
-/* Select an 8-bit integer type.  */
-#if @KWSYS_NAMESPACE at _SIZEOF_CHAR == 1
-typedef signed char kwsysFundamentalType_Int8;
-typedef unsigned char kwsysFundamentalType_UInt8;
-#else
-# error "No native data type can represent an 8-bit integer."
-#endif
-
-/* Select a 16-bit integer type.  */
-#if @KWSYS_NAMESPACE at _SIZEOF_SHORT == 2
-typedef short kwsysFundamentalType_Int16;
-typedef unsigned short kwsysFundamentalType_UInt16;
-#elif @KWSYS_NAMESPACE at _SIZEOF_INT == 2
-typedef int kwsysFundamentalType_Int16;
-typedef unsigned int kwsysFundamentalType_UInt16;
-#else
-# error "No native data type can represent a 16-bit integer."
-#endif
-
-/* Select a 32-bit integer type.  */
-#if @KWSYS_NAMESPACE at _SIZEOF_INT == 4
-typedef int kwsysFundamentalType_Int32;
-typedef unsigned int kwsysFundamentalType_UInt32;
-#elif @KWSYS_NAMESPACE at _SIZEOF_LONG == 4
-typedef long kwsysFundamentalType_Int32;
-typedef unsigned long kwsysFundamentalType_UInt32;
-#else
-# error "No native data type can represent a 32-bit integer."
-#endif
-
-/* Select a 64-bit integer type.  */
-#if @KWSYS_NAMESPACE at _SIZEOF_LONG == 8
-typedef signed long   kwsysFundamentalType_Int64;
-typedef unsigned long kwsysFundamentalType_UInt64;
-/* Whether UInt64 can be converted to double.  */
-# define @KWSYS_NAMESPACE at _CAN_CONVERT_UI64_TO_DOUBLE 1
-#elif @KWSYS_NAMESPACE at _USE_LONG_LONG && @KWSYS_NAMESPACE at _SIZEOF_LONG_LONG == 8
-typedef signed long long   kwsysFundamentalType_Int64;
-typedef unsigned long long kwsysFundamentalType_UInt64;
-/* Whether UInt64 can be converted to double.  */
-# define @KWSYS_NAMESPACE at _CAN_CONVERT_UI64_TO_DOUBLE 1
-#elif @KWSYS_NAMESPACE at _USE___INT64 && @KWSYS_NAMESPACE at _SIZEOF___INT64 == 8
-typedef signed __int64   kwsysFundamentalType_Int64;
-typedef unsigned __int64 kwsysFundamentalType_UInt64;
-/* Whether UInt64 can be converted to double.  */
-# define @KWSYS_NAMESPACE at _CAN_CONVERT_UI64_TO_DOUBLE @KWSYS_CAN_CONVERT_UI64_TO_DOUBLE@
-#else
-# error "No native data type can represent a 64-bit integer."
-#endif
-
-#if defined(__cplusplus)
-} /* extern "C" */
-#endif
-
-/* If we are building a kwsys .c or .cxx file, let it use these macros.
-   Otherwise, undefine them to keep the namespace clean.  */
-#if !defined(KWSYS_NAMESPACE)
-# undef kwsys_ns
-# undef kwsysEXPORT
-# if !defined(KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
-#  undef kwsysFundamentalType
-#  undef kwsysFundamentalType_Int8
-#  undef kwsysFundamentalType_UInt8
-#  undef kwsysFundamentalType_Int16
-#  undef kwsysFundamentalType_UInt16
-#  undef kwsysFundamentalType_Int32
-#  undef kwsysFundamentalType_UInt32
-#  undef kwsysFundamentalType_Int64
-#  undef kwsysFundamentalType_UInt64
-# endif
-#endif
-
-/* If building a C or C++ file in kwsys itself, give the source file
-   access to the configured macros without a configured namespace.  */
-#if defined(KWSYS_NAMESPACE)
-# define KWSYS_SIZEOF_CHAR @KWSYS_NAMESPACE at _SIZEOF_CHAR
-# define KWSYS_SIZEOF_SHORT @KWSYS_NAMESPACE at _SIZEOF_SHORT
-# define KWSYS_SIZEOF_INT @KWSYS_NAMESPACE at _SIZEOF_INT
-# define KWSYS_SIZEOF_LONG @KWSYS_NAMESPACE at _SIZEOF_LONG
-# define KWSYS_SIZEOF_LONG_LONG @KWSYS_NAMESPACE at _SIZEOF_LONG_LONG
-# define KWSYS_SIZEOF___INT64 @KWSYS_NAMESPACE at _SIZEOF___INT64
-# define KWSYS_USE_LONG_LONG @KWSYS_NAMESPACE at _USE_LONG_LONG
-# define KWSYS_USE___INT64 @KWSYS_NAMESPACE at _USE___INT64
-# define KWSYS_CHAR_IS_SIGNED @KWSYS_NAMESPACE at _CHAR_IS_SIGNED
-# define KWSYS_CAN_CONVERT_UI64_TO_DOUBLE @KWSYS_NAMESPACE at _CAN_CONVERT_UI64_TO_DOUBLE
-#endif
-
-#endif
diff --git a/src/kwsys/Glob.cxx b/src/kwsys/Glob.cxx
deleted file mode 100644
index 5a96aed..0000000
--- a/src/kwsys/Glob.cxx
+++ /dev/null
@@ -1,513 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#include "kwsysPrivate.h"
-#include KWSYS_HEADER(Glob.hxx)
-
-#include KWSYS_HEADER(Configure.hxx)
-
-#include KWSYS_HEADER(RegularExpression.hxx)
-#include KWSYS_HEADER(SystemTools.hxx)
-#include KWSYS_HEADER(Directory.hxx)
-#include KWSYS_HEADER(stl/string)
-#include KWSYS_HEADER(stl/vector)
-
-// Work-around CMake dependency scanning limitation.  This must
-// duplicate the above list of headers.
-#if 0
-# include "Glob.hxx.in"
-# include "Directory.hxx.in"
-# include "Configure.hxx.in"
-# include "RegularExpression.hxx.in"
-# include "SystemTools.hxx.in"
-# include "kwsys_stl.hxx.in"
-# include "kwsys_stl_string.hxx.in"
-#endif
-
-#include <ctype.h>
-#include <stdio.h>
-#include <string.h>
-namespace KWSYS_NAMESPACE
-{
-#if defined(_WIN32) || defined(__APPLE__) || defined(__CYGWIN__)
-// On Windows and apple, no difference between lower and upper case
-# define KWSYS_GLOB_CASE_INDEPENDENT
-#endif
-
-#if defined(_WIN32) || defined(__CYGWIN__)
-// Handle network paths
-# define KWSYS_GLOB_SUPPORT_NETWORK_PATHS
-#endif
-
-//----------------------------------------------------------------------------
-class GlobInternals
-{
-public:
-  kwsys_stl::vector<kwsys_stl::string> Files;
-  kwsys_stl::vector<kwsys::RegularExpression> Expressions;
-};
-
-//----------------------------------------------------------------------------
-Glob::Glob()
-{
-  this->Internals = new GlobInternals;
-  this->Recurse = false;
-  this->Relative = "";
-
-  this->RecurseThroughSymlinks = true;
-    // RecurseThroughSymlinks is true by default for backwards compatibility,
-    // not because it's a good idea...
-  this->FollowedSymlinkCount = 0;
-}
-
-//----------------------------------------------------------------------------
-Glob::~Glob()
-{
-  delete this->Internals;
-}
-
-//----------------------------------------------------------------------------
-kwsys_stl::vector<kwsys_stl::string>& Glob::GetFiles()
-{
-  return this->Internals->Files;
-}
-
-//----------------------------------------------------------------------------
-kwsys_stl::string Glob::PatternToRegex(const kwsys_stl::string& pattern,
-                                       bool require_whole_string,
-                                       bool preserve_case)
-{
-  // Incrementally build the regular expression from the pattern.
-  kwsys_stl::string regex = require_whole_string? "^" : "";
-  kwsys_stl::string::const_iterator pattern_first = pattern.begin();
-  kwsys_stl::string::const_iterator pattern_last = pattern.end();
-  for(kwsys_stl::string::const_iterator i = pattern_first;
-      i != pattern_last; ++i)
-    {
-    int c = *i;
-    if(c == '*')
-      {
-      // A '*' (not between brackets) matches any string.
-      // We modify this to not match slashes since the orignal glob
-      // pattern documentation was meant for matching file name
-      // components separated by slashes.
-      regex += "[^/]*";
-      }
-    else if(c == '?')
-      {
-      // A '?' (not between brackets) matches any single character.
-      // We modify this to not match slashes since the orignal glob
-      // pattern documentation was meant for matching file name
-      // components separated by slashes.
-      regex += "[^/]";
-      }
-    else if(c == '[')
-      {
-      // Parse out the bracket expression.  It begins just after the
-      // opening character.
-      kwsys_stl::string::const_iterator bracket_first = i+1;
-      kwsys_stl::string::const_iterator bracket_last = bracket_first;
-
-      // The first character may be complementation '!' or '^'.
-      if(bracket_last != pattern_last &&
-         (*bracket_last == '!' || *bracket_last == '^'))
-        {
-        ++bracket_last;
-        }
-
-      // If the next character is a ']' it is included in the brackets
-      // because the bracket string may not be empty.
-      if(bracket_last != pattern_last && *bracket_last == ']')
-        {
-        ++bracket_last;
-        }
-
-      // Search for the closing ']'.
-      while(bracket_last != pattern_last && *bracket_last != ']')
-        {
-        ++bracket_last;
-        }
-
-      // Check whether we have a complete bracket string.
-      if(bracket_last == pattern_last)
-        {
-        // The bracket string did not end, so it was opened simply by
-        // a '[' that is supposed to be matched literally.
-        regex += "\\[";
-        }
-      else
-        {
-        // Convert the bracket string to its regex equivalent.
-        kwsys_stl::string::const_iterator k = bracket_first;
-
-        // Open the regex block.
-        regex += "[";
-
-        // A regex range complement uses '^' instead of '!'.
-        if(k != bracket_last && *k == '!')
-          {
-          regex += "^";
-          ++k;
-          }
-
-        // Convert the remaining characters.
-        for(; k != bracket_last; ++k)
-          {
-          // Backslashes must be escaped.
-          if(*k == '\\')
-            {
-            regex += "\\";
-            }
-
-          // Store this character.
-          regex += *k;
-          }
-
-        // Close the regex block.
-        regex += "]";
-
-        // Jump to the end of the bracket string.
-        i = bracket_last;
-        }
-      }
-    else
-      {
-      // A single character matches itself.
-      int ch = c;
-      if(!(('a' <= ch && ch <= 'z') ||
-           ('A' <= ch && ch <= 'Z') ||
-           ('0' <= ch && ch <= '9')))
-        {
-        // Escape the non-alphanumeric character.
-        regex += "\\";
-        }
-#if defined(KWSYS_GLOB_CASE_INDEPENDENT)
-      else
-        {
-        // On case-insensitive systems file names are converted to lower
-        // case before matching.
-        if(!preserve_case)
-          {
-          ch = tolower(ch);
-          }
-        }
-#endif
-      (void)preserve_case;
-      // Store the character.
-      regex.append(1, static_cast<char>(ch));
-      }
-    }
-
-  if(require_whole_string)
-    {
-    regex += "$";
-    }
-  return regex;
-}
-
-//----------------------------------------------------------------------------
-void Glob::RecurseDirectory(kwsys_stl::string::size_type start,
-  const kwsys_stl::string& dir)
-{
-  kwsys::Directory d;
-  if ( !d.Load(dir) )
-    {
-    return;
-    }
-  unsigned long cc;
-  kwsys_stl::string fullname;
-  kwsys_stl::string realname;
-  kwsys_stl::string fname;
-  for ( cc = 0; cc < d.GetNumberOfFiles(); cc ++ )
-    {
-    fname = d.GetFile(cc);
-    if ( fname == "." || fname == ".." )
-      {
-      continue;
-      }
-
-    if ( start == 0 )
-      {
-      realname = dir + fname;
-      }
-    else
-      {
-      realname = dir + "/" + fname;
-      }
-
-#if defined( KWSYS_GLOB_CASE_INDEPENDENT )
-    // On Windows and apple, no difference between lower and upper case
-    fname = kwsys::SystemTools::LowerCase(fname);
-#endif
-
-    if ( start == 0 )
-      {
-      fullname = dir + fname;
-      }
-    else
-      {
-      fullname = dir + "/" + fname;
-      }
-
-    bool isDir = kwsys::SystemTools::FileIsDirectory(realname);
-    bool isSymLink = kwsys::SystemTools::FileIsSymlink(realname);
-
-    if ( isDir && (!isSymLink || this->RecurseThroughSymlinks) )
-      {
-      if (isSymLink)
-        {
-        ++this->FollowedSymlinkCount;
-        }
-      this->RecurseDirectory(start+1, realname);
-      }
-    else
-      {
-      if ( !this->Internals->Expressions.empty() &&
-           this->Internals->Expressions.rbegin()->find(fname) )
-        {
-        this->AddFile(this->Internals->Files, realname);
-        }
-      }
-    }
-}
-
-//----------------------------------------------------------------------------
-void Glob::ProcessDirectory(kwsys_stl::string::size_type start,
-  const kwsys_stl::string& dir)
-{
-  //kwsys_ios::cout << "ProcessDirectory: " << dir << kwsys_ios::endl;
-  bool last = ( start == this->Internals->Expressions.size()-1 );
-  if ( last && this->Recurse )
-    {
-    this->RecurseDirectory(start, dir);
-    return;
-    }
-
-  if ( start >= this->Internals->Expressions.size() )
-    {
-    return;
-    }
-
-  kwsys::Directory d;
-  if ( !d.Load(dir) )
-    {
-    return;
-    }
-  unsigned long cc;
-  kwsys_stl::string fullname;
-  kwsys_stl::string realname;
-  kwsys_stl::string fname;
-  for ( cc = 0; cc < d.GetNumberOfFiles(); cc ++ )
-    {
-    fname = d.GetFile(cc);
-    if ( fname == "." || fname == ".." )
-      {
-      continue;
-      }
-
-    if ( start == 0 )
-      {
-      realname = dir + fname;
-      }
-    else
-      {
-      realname = dir + "/" + fname;
-      }
-
-#if defined(KWSYS_GLOB_CASE_INDEPENDENT)
-    // On case-insensitive file systems convert to lower case for matching.
-    fname = kwsys::SystemTools::LowerCase(fname);
-#endif
-
-    if ( start == 0 )
-      {
-      fullname = dir + fname;
-      }
-    else
-      {
-      fullname = dir + "/" + fname;
-      }
-
-    //kwsys_ios::cout << "Look at file: " << fname << kwsys_ios::endl;
-    //kwsys_ios::cout << "Match: "
-    // << this->Internals->TextExpressions[start].c_str() << kwsys_ios::endl;
-    //kwsys_ios::cout << "Full name: " << fullname << kwsys_ios::endl;
-
-    if ( !last &&
-      !kwsys::SystemTools::FileIsDirectory(realname) )
-      {
-      continue;
-      }
-
-    if ( this->Internals->Expressions[start].find(fname) )
-      {
-      if ( last )
-        {
-        this->AddFile(this->Internals->Files, realname);
-        }
-      else
-        {
-        this->ProcessDirectory(start+1, realname + "/");
-        }
-      }
-    }
-}
-
-//----------------------------------------------------------------------------
-bool Glob::FindFiles(const kwsys_stl::string& inexpr)
-{
-  kwsys_stl::string cexpr;
-  kwsys_stl::string::size_type cc;
-  kwsys_stl::string expr = inexpr;
-
-  this->Internals->Expressions.clear();
-  this->Internals->Files.clear();
-
-  if ( !kwsys::SystemTools::FileIsFullPath(expr) )
-    {
-    expr = kwsys::SystemTools::GetCurrentWorkingDirectory();
-    expr += "/" + inexpr;
-    }
-  kwsys_stl::string fexpr = expr;
-
-  kwsys_stl::string::size_type skip = 0;
-  kwsys_stl::string::size_type last_slash = 0;
-  for ( cc = 0; cc < expr.size(); cc ++ )
-    {
-    if ( cc > 0 && expr[cc] == '/' && expr[cc-1] != '\\' )
-      {
-      last_slash = cc;
-      }
-    if ( cc > 0 &&
-      (expr[cc] == '[' || expr[cc] == '?' || expr[cc] == '*') &&
-      expr[cc-1] != '\\' )
-      {
-      break;
-      }
-    }
-  if ( last_slash > 0 )
-    {
-    //kwsys_ios::cout << "I can skip: " << fexpr.substr(0, last_slash)
-    // << kwsys_ios::endl;
-    skip = last_slash;
-    }
-  if ( skip == 0 )
-    {
-#if defined( KWSYS_GLOB_SUPPORT_NETWORK_PATHS )
-    // Handle network paths
-    if ( expr[0] == '/' && expr[1] == '/' )
-      {
-      int cnt = 0;
-      for ( cc = 2; cc < expr.size(); cc ++ )
-        {
-        if ( expr[cc] == '/' )
-          {
-          cnt ++;
-          if ( cnt == 2 )
-            {
-            break;
-            }
-          }
-        }
-      skip = int(cc + 1);
-      }
-    else
-#endif
-      // Handle drive letters on Windows
-      if ( expr[1] == ':' && expr[0] != '/' )
-        {
-        skip = 2;
-        }
-    }
-
-  if ( skip > 0 )
-    {
-    expr = expr.substr(skip);
-    }
-
-  cexpr = "";
-  for ( cc = 0; cc < expr.size(); cc ++ )
-    {
-    int ch = expr[cc];
-    if ( ch == '/' )
-      {
-      if ( !cexpr.empty() )
-        {
-        this->AddExpression(cexpr);
-        }
-      cexpr = "";
-      }
-    else
-      {
-      cexpr.append(1, static_cast<char>(ch));
-      }
-    }
-  if ( !cexpr.empty() )
-    {
-    this->AddExpression(cexpr);
-    }
-
-  // Handle network paths
-  if ( skip > 0 )
-    {
-    this->ProcessDirectory(0, fexpr.substr(0, skip) + "/");
-    }
-  else
-    {
-    this->ProcessDirectory(0, "/");
-    }
-  return true;
-}
-
-//----------------------------------------------------------------------------
-void Glob::AddExpression(const kwsys_stl::string& expr)
-{
-  this->Internals->Expressions.push_back(
-    kwsys::RegularExpression(
-      this->PatternToRegex(expr)));
-}
-
-//----------------------------------------------------------------------------
-void Glob::SetRelative(const char* dir)
-{
-  if ( !dir )
-    {
-    this->Relative = "";
-    return;
-    }
-  this->Relative = dir;
-}
-
-//----------------------------------------------------------------------------
-const char* Glob::GetRelative()
-{
-  if ( this->Relative.empty() )
-    {
-    return 0;
-    }
-  return this->Relative.c_str();
-}
-
-//----------------------------------------------------------------------------
-void Glob::AddFile(kwsys_stl::vector<kwsys_stl::string>& files, const kwsys_stl::string& file)
-{
-  if ( !this->Relative.empty() )
-    {
-    files.push_back(kwsys::SystemTools::RelativePath(this->Relative, file));
-    }
-  else
-    {
-    files.push_back(file);
-    }
-}
-
-} // namespace KWSYS_NAMESPACE
-
diff --git a/src/kwsys/Glob.hxx.in b/src/kwsys/Glob.hxx.in
deleted file mode 100644
index d8b8491..0000000
--- a/src/kwsys/Glob.hxx.in
+++ /dev/null
@@ -1,117 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef @KWSYS_NAMESPACE at _Glob_hxx
-#define @KWSYS_NAMESPACE at _Glob_hxx
-
-#include <@KWSYS_NAMESPACE@/Configure.h>
-#include <@KWSYS_NAMESPACE@/Configure.hxx>
-
-#include <@KWSYS_NAMESPACE@/stl/string>
-#include <@KWSYS_NAMESPACE@/stl/vector>
-
-/* Define this macro temporarily to keep the code readable.  */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
-# define kwsys_stl @KWSYS_NAMESPACE at _stl
-#endif
-
-namespace @KWSYS_NAMESPACE@
-{
-
-class GlobInternals;
-
-/** \class Glob
- * \brief Portable globbing searches.
- *
- * Globbing expressions are much simpler than regular
- * expressions. This class will search for files using
- * globbing expressions.
- *
- * Finds all files that match a given globbing expression.
- */
-class @KWSYS_NAMESPACE at _EXPORT Glob
-{
-public:
-  Glob();
-  ~Glob();
-
-  //! Find all files that match the pattern.
-  bool FindFiles(const kwsys_stl::string& inexpr);
-
-  //! Return the list of files that matched.
-  kwsys_stl::vector<kwsys_stl::string>& GetFiles();
-
-  //! Set recurse to true to match subdirectories.
-  void RecurseOn() { this->SetRecurse(true); }
-  void RecurseOff() { this->SetRecurse(false); }
-  void SetRecurse(bool i) { this->Recurse = i; }
-  bool GetRecurse() { return this->Recurse; }
-
-  //! Set recurse through symlinks to true if recursion should traverse the
-  // linked-to directories
-  void RecurseThroughSymlinksOn() { this->SetRecurseThroughSymlinks(true); }
-  void RecurseThroughSymlinksOff() { this->SetRecurseThroughSymlinks(false); }
-  void SetRecurseThroughSymlinks(bool i) { this->RecurseThroughSymlinks = i; }
-  bool GetRecurseThroughSymlinks() { return this->RecurseThroughSymlinks; }
-
-  //! Get the number of symlinks followed through recursion
-  unsigned int GetFollowedSymlinkCount() { return this->FollowedSymlinkCount; }
-
-  //! Set relative to true to only show relative path to files.
-  void SetRelative(const char* dir);
-  const char* GetRelative();
-
-  /** Convert the given globbing pattern to a regular expression.
-      There is no way to quote meta-characters.  The
-      require_whole_string argument specifies whether the regex is
-      automatically surrounded by "^" and "$" to match the whole
-      string.  This is on by default because patterns always match
-      whole strings, but may be disabled to support concatenating
-      expressions more easily (regex1|regex2|etc).  */
-  static kwsys_stl::string PatternToRegex(const kwsys_stl::string& pattern,
-                                          bool require_whole_string = true,
-                                          bool preserve_case = false);
-
-protected:
-  //! Process directory
-  void ProcessDirectory(kwsys_stl::string::size_type start,
-    const kwsys_stl::string& dir);
-
-  //! Process last directory, but only when recurse flags is on. That is
-  // effectively like saying: /path/to/file/**/file
-  void RecurseDirectory(kwsys_stl::string::size_type start,
-    const kwsys_stl::string& dir);
-
-  //! Add regular expression
-  void AddExpression(const kwsys_stl::string& expr);
-
-  //! Add a file to the list
-  void AddFile(kwsys_stl::vector<kwsys_stl::string>& files, const kwsys_stl::string& file);
-
-  GlobInternals* Internals;
-  bool Recurse;
-  kwsys_stl::string Relative;
-  bool RecurseThroughSymlinks;
-  unsigned int FollowedSymlinkCount;
-
-private:
-  Glob(const Glob&);  // Not implemented.
-  void operator=(const Glob&);  // Not implemented.
-};
-
-} // namespace @KWSYS_NAMESPACE@
-
-/* Undefine temporary macro.  */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
-# undef kwsys_stl
-#endif
-
-#endif
diff --git a/src/kwsys/IOStream.cxx b/src/kwsys/IOStream.cxx
deleted file mode 100644
index a31f8c8..0000000
--- a/src/kwsys/IOStream.cxx
+++ /dev/null
@@ -1,282 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#include "kwsysPrivate.h"
-#include KWSYS_HEADER(Configure.hxx)
-
-// Configure the implementation for the current streams library.
-#if !KWSYS_IOS_USE_ANSI
-# define ios_base ios
-# if defined(__HP_aCC)
-#  define protected public
-#  include <iostream.h> // Hack access to some private stream methods.
-#  undef protected
-# endif
-#endif
-
-// Include the streams library.
-#include KWSYS_HEADER(ios/iostream)
-#include KWSYS_HEADER(IOStream.hxx)
-
-// Work-around CMake dependency scanning limitation.  This must
-// duplicate the above list of headers.
-#if 0
-# include "Configure.hxx.in"
-# include "kwsys_ios_iostream.hxx.in"
-# include "IOStream.hxx.in"
-#endif
-
-// Implement the rest of this file only if it is needed.
-#if KWSYS_IOS_NEED_OPERATORS_LL
-
-# include <stdio.h>  // sscanf, sprintf
-# include <string.h> // memchr
-
-# if defined(_MAX_INT_DIG)
-#  define KWSYS_IOS_INT64_MAX_DIG _MAX_INT_DIG
-# else
-#  define KWSYS_IOS_INT64_MAX_DIG 32
-# endif
-
-namespace KWSYS_NAMESPACE
-{
-
-// Scan an input stream for an integer value.
-static int IOStreamScanStream(kwsys_ios::istream& is, char* buffer)
-{
-  // Prepare to write to buffer.
-  char* out = buffer;
-  char* end = buffer + KWSYS_IOS_INT64_MAX_DIG - 1;
-
-  // Look for leading sign.
-  if(is.peek() == '+') { *out++ = '+'; is.ignore(); }
-  else if(is.peek() == '-') { *out++ = '-'; is.ignore(); }
-
-  // Determine the base.  If not specified in the stream, try to
-  // detect it from the input.  A leading 0x means hex, and a leading
-  // 0 alone means octal.
-  int base = 0;
-  int flags = is.flags() & kwsys_ios::ios_base::basefield;
-  if(flags == kwsys_ios::ios_base::oct) { base = 8; }
-  else if(flags == kwsys_ios::ios_base::dec) { base = 10; }
-  else if(flags == kwsys_ios::ios_base::hex) { base = 16; }
-  bool foundDigit = false;
-  bool foundNonZero = false;
-  if(is.peek() == '0')
-    {
-    foundDigit = true;
-    is.ignore();
-    if((is.peek() == 'x' || is.peek() == 'X') && (base == 0 || base == 16))
-      {
-      base = 16;
-      foundDigit = false;
-      is.ignore();
-      }
-    else if (base == 0)
-      {
-      base = 8;
-      }
-    }
-
-  // Determine the range of digits allowed for this number.
-  const char* digits = "0123456789abcdefABCDEF";
-  int maxDigitIndex = 10;
-  if(base == 8)
-    {
-    maxDigitIndex = 8;
-    }
-  else if(base == 16)
-    {
-    maxDigitIndex = 10+6+6;
-    }
-
-  // Scan until an invalid digit is found.
-  for(;is.peek() != EOF; is.ignore())
-    {
-    if(memchr(digits, *out = (char)is.peek(), maxDigitIndex) != 0)
-      {
-      if((foundNonZero || *out != '0') && out < end)
-        {
-        ++out;
-        foundNonZero = true;
-        }
-      foundDigit = true;
-      }
-    else
-      {
-      break;
-      }
-    }
-
-  // Correct the buffer contents for degenerate cases.
-  if(foundDigit && !foundNonZero)
-    {
-    *out++ = '0';
-    }
-  else if (!foundDigit)
-    {
-    out = buffer;
-    }
-
-  // Terminate the string in the buffer.
-  *out = '\0';
-
-  return base;
-}
-
-// Read an integer value from an input stream.
-template <class T>
-kwsys_ios::istream&
-IOStreamScanTemplate(kwsys_ios::istream& is, T& value, char type)
-{
-  int state = kwsys_ios::ios_base::goodbit;
-
-  // Skip leading whitespace.
-# if KWSYS_IOS_USE_ANSI
-  kwsys_ios::istream::sentry okay(is);
-# else
-  is.eatwhite();
-  kwsys_ios::istream& okay = is;
-# endif
-
-  if(okay)
-    {
-#   if KWSYS_IOS_USE_ANSI
-    try {
-#   endif
-    // Copy the string to a buffer and construct the format string.
-    char buffer[KWSYS_IOS_INT64_MAX_DIG];
-#   if defined(_MSC_VER)
-    char format[] = "%I64_";
-    const int typeIndex = 4;
-#   else
-    char format[] = "%ll_";
-    const int typeIndex = 3;
-#   endif
-    switch(IOStreamScanStream(is, buffer))
-      {
-      case 8: format[typeIndex] = 'o'; break;
-      case 0: // Default to decimal if not told otherwise.
-      case 10: format[typeIndex] = type; break;
-      case 16: format[typeIndex] = 'x'; break;
-      };
-
-    // Use sscanf to parse the number from the buffer.
-    T result;
-    int success = (sscanf(buffer, format, &result) == 1)?1:0;
-
-    // Set flags for resulting state.
-    if(is.peek() == EOF) { state |= kwsys_ios::ios_base::eofbit; }
-    if(!success) { state |= kwsys_ios::ios_base::failbit; }
-    else { value = result; }
-#   if KWSYS_IOS_USE_ANSI
-    } catch(...) { state |= kwsys_ios::ios_base::badbit; }
-#   endif
-    }
-
-# if KWSYS_IOS_USE_ANSI
-  is.setstate(kwsys_ios::ios_base::iostate(state));
-# else
-  is.clear(state);
-# endif
-  return is;
-}
-
-// Print an integer value to an output stream.
-template <class T>
-kwsys_ios::ostream&
-IOStreamPrintTemplate(kwsys_ios::ostream& os, T value, char type)
-{
-# if KWSYS_IOS_USE_ANSI
-  kwsys_ios::ostream::sentry okay(os);
-# else
-  kwsys_ios::ostream& okay = os;
-# endif
-  if(okay)
-    {
-#   if KWSYS_IOS_USE_ANSI
-    try {
-#   endif
-    // Construct the format string.
-    char format[8];
-    char* f = format;
-    *f++ = '%';
-    if(os.flags() & kwsys_ios::ios_base::showpos) { *f++ = '+'; }
-    if(os.flags() & kwsys_ios::ios_base::showbase) { *f++ = '#'; }
-#   if defined(_MSC_VER)
-    *f++ = 'I'; *f++ = '6'; *f++ = '4';
-#   else
-    *f++ = 'l'; *f++ = 'l';
-#   endif
-    long bflags = os.flags() & kwsys_ios::ios_base::basefield;
-    if(bflags == kwsys_ios::ios_base::oct) { *f++ = 'o'; }
-    else if(bflags != kwsys_ios::ios_base::hex) { *f++ = type; }
-    else if(os.flags() & kwsys_ios::ios_base::uppercase) { *f++ = 'X'; }
-    else { *f++ = 'x'; }
-    *f = '\0';
-
-    // Use sprintf to print to a buffer and then write the
-    // buffer to the stream.
-    char buffer[2*KWSYS_IOS_INT64_MAX_DIG];
-    sprintf(buffer, format, value);
-    os << buffer;
-#   if KWSYS_IOS_USE_ANSI
-    } catch(...) { os.clear(os.rdstate() | kwsys_ios::ios_base::badbit); }
-#   endif
-    }
-  return os;
-}
-
-# if !KWSYS_IOS_HAS_ISTREAM_LONG_LONG
-// Implement input stream operator for IOStreamSLL.
-kwsys_ios::istream& IOStreamScan(kwsys_ios::istream& is, IOStreamSLL& value)
-{
-  return IOStreamScanTemplate(is, value, 'd');
-}
-
-// Implement input stream operator for IOStreamULL.
-kwsys_ios::istream& IOStreamScan(kwsys_ios::istream& is, IOStreamULL& value)
-{
-  return IOStreamScanTemplate(is, value, 'u');
-}
-# endif
-
-# if !KWSYS_IOS_HAS_OSTREAM_LONG_LONG
-// Implement output stream operator for IOStreamSLL.
-kwsys_ios::ostream& IOStreamPrint(kwsys_ios::ostream& os, IOStreamSLL value)
-{
-  return IOStreamPrintTemplate(os, value, 'd');
-}
-
-// Implement output stream operator for IOStreamULL.
-kwsys_ios::ostream& IOStreamPrint(kwsys_ios::ostream& os, IOStreamULL value)
-{
-  return IOStreamPrintTemplate(os, value, 'u');
-}
-# endif
-
-} // namespace KWSYS_NAMESPACE
-
-#else
-
-namespace KWSYS_NAMESPACE
-{
-
-// Create one public symbol in this object file to avoid warnings from
-// archivers.
-void IOStreamSymbolToAvoidWarning();
-void IOStreamSymbolToAvoidWarning()
-{
-}
-
-} // namespace KWSYS_NAMESPACE
-
-#endif // KWSYS_IOS_NEED_OPERATORS_LL
diff --git a/src/kwsys/IOStream.hxx.in b/src/kwsys/IOStream.hxx.in
deleted file mode 100644
index 2eeedf2..0000000
--- a/src/kwsys/IOStream.hxx.in
+++ /dev/null
@@ -1,142 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef @KWSYS_NAMESPACE at _IOStream_hxx
-#define @KWSYS_NAMESPACE at _IOStream_hxx
-
-#include <@KWSYS_NAMESPACE@/ios/iosfwd>
-
-/* Define these macros temporarily to keep the code readable.  */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
-# define kwsysEXPORT @KWSYS_NAMESPACE at _EXPORT
-# define kwsys_ios @KWSYS_NAMESPACE at _ios
-#endif
-
-/* Whether istream supports long long.  */
-#define @KWSYS_NAMESPACE at _IOS_HAS_ISTREAM_LONG_LONG @KWSYS_IOS_HAS_ISTREAM_LONG_LONG@
-
-/* Whether ostream supports long long.  */
-#define @KWSYS_NAMESPACE at _IOS_HAS_OSTREAM_LONG_LONG @KWSYS_IOS_HAS_OSTREAM_LONG_LONG@
-
-/* Determine whether we need to define the streaming operators for
-   long long or __int64.  */
-#if @KWSYS_USE_LONG_LONG@
-# if !@KWSYS_NAMESPACE at _IOS_HAS_ISTREAM_LONG_LONG || \
-     !@KWSYS_NAMESPACE at _IOS_HAS_OSTREAM_LONG_LONG
-# define @KWSYS_NAMESPACE at _IOS_NEED_OPERATORS_LL 1
-  namespace @KWSYS_NAMESPACE@
-  {
-    typedef long long IOStreamSLL;
-    typedef unsigned long long IOStreamULL;
-  }
-# endif
-#elif defined(_MSC_VER) && _MSC_VER < 1300
-# define @KWSYS_NAMESPACE at _IOS_NEED_OPERATORS_LL 1
-  namespace @KWSYS_NAMESPACE@
-  {
-    typedef __int64 IOStreamSLL;
-    typedef unsigned __int64 IOStreamULL;
-  }
-#endif
-#if !defined(@KWSYS_NAMESPACE at _IOS_NEED_OPERATORS_LL)
-# define @KWSYS_NAMESPACE at _IOS_NEED_OPERATORS_LL 0
-#endif
-
-#if @KWSYS_NAMESPACE at _IOS_NEED_OPERATORS_LL
-# if !@KWSYS_NAMESPACE at _IOS_HAS_ISTREAM_LONG_LONG
-
-/* Input stream operator implementation functions.  */
-namespace @KWSYS_NAMESPACE@
-{
-kwsysEXPORT kwsys_ios::istream& IOStreamScan(kwsys_ios::istream&,
-                                             IOStreamSLL&);
-kwsysEXPORT kwsys_ios::istream& IOStreamScan(kwsys_ios::istream&,
-                                             IOStreamULL&);
-}
-
-/* Provide input stream operator for long long.  */
-#  if !defined(@KWSYS_NAMESPACE at _IOS_NO_ISTREAM_LONG_LONG) && \
-      !defined(KWSYS_IOS_ISTREAM_LONG_LONG_DEFINED)
-#   define KWSYS_IOS_ISTREAM_LONG_LONG_DEFINED
-#   define @KWSYS_NAMESPACE at _IOS_ISTREAM_LONG_LONG_DEFINED
-inline kwsys_ios::istream&
-operator>>(kwsys_ios::istream& is, @KWSYS_NAMESPACE@::IOStreamSLL& value)
-{
-  return @KWSYS_NAMESPACE@::IOStreamScan(is, value);
-}
-#  endif
-
-/* Provide input stream operator for unsigned long long.  */
-#  if !defined(@KWSYS_NAMESPACE at _IOS_NO_ISTREAM_UNSIGNED_LONG_LONG) && \
-      !defined(KWSYS_IOS_ISTREAM_UNSIGNED_LONG_LONG_DEFINED)
-#   define KWSYS_IOS_ISTREAM_UNSIGNED_LONG_LONG_DEFINED
-#   define @KWSYS_NAMESPACE at _IOS_ISTREAM_UNSIGNED_LONG_LONG_DEFINED
-inline kwsys_ios::istream&
-operator>>(kwsys_ios::istream& is, @KWSYS_NAMESPACE@::IOStreamULL& value)
-{
-  return @KWSYS_NAMESPACE@::IOStreamScan(is, value);
-}
-#  endif
-# endif /* !@KWSYS_NAMESPACE at _IOS_HAS_ISTREAM_LONG_LONG */
-
-# if !@KWSYS_NAMESPACE at _IOS_HAS_OSTREAM_LONG_LONG
-
-/* Output stream operator implementation functions.  */
-namespace @KWSYS_NAMESPACE@
-{
-kwsysEXPORT kwsys_ios::ostream& IOStreamPrint(kwsys_ios::ostream&,
-                                              IOStreamSLL);
-kwsysEXPORT kwsys_ios::ostream& IOStreamPrint(kwsys_ios::ostream&,
-                                              IOStreamULL);
-}
-
-/* Provide output stream operator for long long.  */
-#  if !defined(@KWSYS_NAMESPACE at _IOS_NO_OSTREAM_LONG_LONG) && \
-      !defined(KWSYS_IOS_OSTREAM_LONG_LONG_DEFINED)
-#   define KWSYS_IOS_OSTREAM_LONG_LONG_DEFINED
-#   define @KWSYS_NAMESPACE at _IOS_OSTREAM_LONG_LONG_DEFINED
-inline kwsys_ios::ostream&
-operator<<(kwsys_ios::ostream& os, @KWSYS_NAMESPACE@::IOStreamSLL value)
-{
-  return @KWSYS_NAMESPACE@::IOStreamPrint(os, value);
-}
-#  endif
-
-/* Provide output stream operator for unsigned long long.  */
-#  if !defined(@KWSYS_NAMESPACE at _IOS_NO_OSTREAM_UNSIGNED_LONG_LONG) && \
-      !defined(KWSYS_IOS_OSTREAM_UNSIGNED_LONG_LONG_DEFINED)
-#   define KWSYS_IOS_OSTREAM_UNSIGNED_LONG_LONG_DEFINED
-#   define @KWSYS_NAMESPACE at _IOS_OSTREAM_UNSIGNED_LONG_LONG_DEFINED
-inline kwsys_ios::ostream&
-operator<<(kwsys_ios::ostream& os, @KWSYS_NAMESPACE@::IOStreamULL value)
-{
-  return @KWSYS_NAMESPACE@::IOStreamPrint(os, value);
-}
-#  endif
-# endif /* !@KWSYS_NAMESPACE at _IOS_HAS_OSTREAM_LONG_LONG */
-#endif /* @KWSYS_NAMESPACE at _IOS_NEED_OPERATORS_LL */
-
-/* Undefine temporary macros.  */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
-# undef kwsysEXPORT
-# undef kwsys_ios
-#endif
-
-/* If building a C++ file in kwsys itself, give the source file
-   access to the macros without a configured namespace.  */
-#if defined(KWSYS_NAMESPACE)
-# define KWSYS_IOS_HAS_ISTREAM_LONG_LONG @KWSYS_NAMESPACE at _IOS_HAS_ISTREAM_LONG_LONG
-# define KWSYS_IOS_HAS_OSTREAM_LONG_LONG @KWSYS_NAMESPACE at _IOS_HAS_OSTREAM_LONG_LONG
-# define KWSYS_IOS_NEED_OPERATORS_LL     @KWSYS_NAMESPACE at _IOS_NEED_OPERATORS_LL
-#endif
-
-#endif
-
diff --git a/src/kwsys/MD5.c b/src/kwsys/MD5.c
deleted file mode 100644
index a147057..0000000
--- a/src/kwsys/MD5.c
+++ /dev/null
@@ -1,523 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#include "kwsysPrivate.h"
-#include KWSYS_HEADER(MD5.h)
-
-/* Work-around CMake dependency scanning limitation.  This must
-   duplicate the above list of headers.  */
-#if 0
-# include "MD5.h.in"
-#endif
-
-#include <stddef.h>    /* size_t */
-#include <stdlib.h>    /* malloc, free */
-#include <string.h>    /* memcpy, strlen */
-
-/*--------------------------------------------------------------------------*/
-
-/* This MD5 implementation has been taken from a third party.  Slight
-   modifications to the arrangement of the code have been made to put
-   it in a single source file instead of a separate header and
-   implementation file.  */
-
-#if defined(__clang__)
-# pragma clang diagnostic push
-# pragma clang diagnostic ignored "-Wcast-align"
-#endif
-
-/*
-  Copyright (C) 1999, 2000, 2002 Aladdin Enterprises.  All rights reserved.
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
-  L. Peter Deutsch
-  ghost at aladdin.com
-
- */
-/*
-  Independent implementation of MD5 (RFC 1321).
-
-  This code implements the MD5 Algorithm defined in RFC 1321, whose
-  text is available at
-        http://www.ietf.org/rfc/rfc1321.txt
-  The code is derived from the text of the RFC, including the test suite
-  (section A.5) but excluding the rest of Appendix A.  It does not include
-  any code or documentation that is identified in the RFC as being
-  copyrighted.
-
-  The original and principal author of md5.c is L. Peter Deutsch
-  <ghost at aladdin.com>.  Other authors are noted in the change history
-  that follows (in reverse chronological order):
-
-  2002-04-13 lpd Clarified derivation from RFC 1321; now handles byte order
-        either statically or dynamically; added missing #include <string.h>
-        in library.
-  2002-03-11 lpd Corrected argument list for main(), and added int return
-        type, in test program and T value program.
-  2002-02-21 lpd Added missing #include <stdio.h> in test program.
-  2000-07-03 lpd Patched to eliminate warnings about "constant is
-        unsigned in ANSI C, signed in traditional"; made test program
-        self-checking.
-  1999-11-04 lpd Edited comments slightly for automatic TOC extraction.
-  1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5).
-  1999-05-03 lpd Original version.
- */
-
-/*
- * This package supports both compile-time and run-time determination of CPU
- * byte order.  If ARCH_IS_BIG_ENDIAN is defined as 0, the code will be
- * compiled to run only on little-endian CPUs; if ARCH_IS_BIG_ENDIAN is
- * defined as non-zero, the code will be compiled to run only on big-endian
- * CPUs; if ARCH_IS_BIG_ENDIAN is not defined, the code will be compiled to
- * run on either big- or little-endian CPUs, but will run slightly less
- * efficiently on either one than if ARCH_IS_BIG_ENDIAN is defined.
- */
-
-typedef unsigned char md5_byte_t; /* 8-bit byte */
-typedef unsigned int md5_word_t; /* 32-bit word */
-
-/* Define the state of the MD5 Algorithm. */
-typedef struct md5_state_s {
-    md5_word_t count[2];        /* message length in bits, lsw first */
-    md5_word_t abcd[4];         /* digest buffer */
-    md5_byte_t buf[64];         /* accumulate block */
-} md5_state_t;
-
-#undef BYTE_ORDER       /* 1 = big-endian, -1 = little-endian, 0 = unknown */
-#ifdef ARCH_IS_BIG_ENDIAN
-#  define BYTE_ORDER (ARCH_IS_BIG_ENDIAN ? 1 : -1)
-#else
-#  define BYTE_ORDER 0
-#endif
-
-#define T_MASK ((md5_word_t)~0)
-#define T1 /* 0xd76aa478 */ (T_MASK ^ 0x28955b87)
-#define T2 /* 0xe8c7b756 */ (T_MASK ^ 0x173848a9)
-#define T3    0x242070db
-#define T4 /* 0xc1bdceee */ (T_MASK ^ 0x3e423111)
-#define T5 /* 0xf57c0faf */ (T_MASK ^ 0x0a83f050)
-#define T6    0x4787c62a
-#define T7 /* 0xa8304613 */ (T_MASK ^ 0x57cfb9ec)
-#define T8 /* 0xfd469501 */ (T_MASK ^ 0x02b96afe)
-#define T9    0x698098d8
-#define T10 /* 0x8b44f7af */ (T_MASK ^ 0x74bb0850)
-#define T11 /* 0xffff5bb1 */ (T_MASK ^ 0x0000a44e)
-#define T12 /* 0x895cd7be */ (T_MASK ^ 0x76a32841)
-#define T13    0x6b901122
-#define T14 /* 0xfd987193 */ (T_MASK ^ 0x02678e6c)
-#define T15 /* 0xa679438e */ (T_MASK ^ 0x5986bc71)
-#define T16    0x49b40821
-#define T17 /* 0xf61e2562 */ (T_MASK ^ 0x09e1da9d)
-#define T18 /* 0xc040b340 */ (T_MASK ^ 0x3fbf4cbf)
-#define T19    0x265e5a51
-#define T20 /* 0xe9b6c7aa */ (T_MASK ^ 0x16493855)
-#define T21 /* 0xd62f105d */ (T_MASK ^ 0x29d0efa2)
-#define T22    0x02441453
-#define T23 /* 0xd8a1e681 */ (T_MASK ^ 0x275e197e)
-#define T24 /* 0xe7d3fbc8 */ (T_MASK ^ 0x182c0437)
-#define T25    0x21e1cde6
-#define T26 /* 0xc33707d6 */ (T_MASK ^ 0x3cc8f829)
-#define T27 /* 0xf4d50d87 */ (T_MASK ^ 0x0b2af278)
-#define T28    0x455a14ed
-#define T29 /* 0xa9e3e905 */ (T_MASK ^ 0x561c16fa)
-#define T30 /* 0xfcefa3f8 */ (T_MASK ^ 0x03105c07)
-#define T31    0x676f02d9
-#define T32 /* 0x8d2a4c8a */ (T_MASK ^ 0x72d5b375)
-#define T33 /* 0xfffa3942 */ (T_MASK ^ 0x0005c6bd)
-#define T34 /* 0x8771f681 */ (T_MASK ^ 0x788e097e)
-#define T35    0x6d9d6122
-#define T36 /* 0xfde5380c */ (T_MASK ^ 0x021ac7f3)
-#define T37 /* 0xa4beea44 */ (T_MASK ^ 0x5b4115bb)
-#define T38    0x4bdecfa9
-#define T39 /* 0xf6bb4b60 */ (T_MASK ^ 0x0944b49f)
-#define T40 /* 0xbebfbc70 */ (T_MASK ^ 0x4140438f)
-#define T41    0x289b7ec6
-#define T42 /* 0xeaa127fa */ (T_MASK ^ 0x155ed805)
-#define T43 /* 0xd4ef3085 */ (T_MASK ^ 0x2b10cf7a)
-#define T44    0x04881d05
-#define T45 /* 0xd9d4d039 */ (T_MASK ^ 0x262b2fc6)
-#define T46 /* 0xe6db99e5 */ (T_MASK ^ 0x1924661a)
-#define T47    0x1fa27cf8
-#define T48 /* 0xc4ac5665 */ (T_MASK ^ 0x3b53a99a)
-#define T49 /* 0xf4292244 */ (T_MASK ^ 0x0bd6ddbb)
-#define T50    0x432aff97
-#define T51 /* 0xab9423a7 */ (T_MASK ^ 0x546bdc58)
-#define T52 /* 0xfc93a039 */ (T_MASK ^ 0x036c5fc6)
-#define T53    0x655b59c3
-#define T54 /* 0x8f0ccc92 */ (T_MASK ^ 0x70f3336d)
-#define T55 /* 0xffeff47d */ (T_MASK ^ 0x00100b82)
-#define T56 /* 0x85845dd1 */ (T_MASK ^ 0x7a7ba22e)
-#define T57    0x6fa87e4f
-#define T58 /* 0xfe2ce6e0 */ (T_MASK ^ 0x01d3191f)
-#define T59 /* 0xa3014314 */ (T_MASK ^ 0x5cfebceb)
-#define T60    0x4e0811a1
-#define T61 /* 0xf7537e82 */ (T_MASK ^ 0x08ac817d)
-#define T62 /* 0xbd3af235 */ (T_MASK ^ 0x42c50dca)
-#define T63    0x2ad7d2bb
-#define T64 /* 0xeb86d391 */ (T_MASK ^ 0x14792c6e)
-
-
-static void
-md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/)
-{
-    md5_word_t
-        a = pms->abcd[0], b = pms->abcd[1],
-        c = pms->abcd[2], d = pms->abcd[3];
-    md5_word_t t;
-#if BYTE_ORDER > 0
-    /* Define storage only for big-endian CPUs. */
-    md5_word_t X[16];
-#else
-    /* Define storage for little-endian or both types of CPUs. */
-    md5_word_t xbuf[16];
-    const md5_word_t *X;
-#endif
-
-    {
-#if BYTE_ORDER == 0
-        /*
-         * Determine dynamically whether this is a big-endian or
-         * little-endian machine, since we can use a more efficient
-         * algorithm on the latter.
-         */
-        static const int w = 1;
-
-        if (*((const md5_byte_t *)&w)) /* dynamic little-endian */
-#endif
-#if BYTE_ORDER <= 0             /* little-endian */
-        {
-            /*
-             * On little-endian machines, we can process properly aligned
-             * data without copying it.
-             */
-            if (!((data - (const md5_byte_t *)0) & 3)) {
-                /* data are properly aligned */
-                X = (const md5_word_t *)data;
-            } else {
-                /* not aligned */
-                memcpy(xbuf, data, 64);
-                X = xbuf;
-            }
-        }
-#endif
-#if BYTE_ORDER == 0
-        else                    /* dynamic big-endian */
-#endif
-#if BYTE_ORDER >= 0             /* big-endian */
-        {
-            /*
-             * On big-endian machines, we must arrange the bytes in the
-             * right order.
-             */
-            const md5_byte_t *xp = data;
-            int i;
-
-#  if BYTE_ORDER == 0
-            X = xbuf;           /* (dynamic only) */
-#  else
-#    define xbuf X              /* (static only) */
-#  endif
-            for (i = 0; i < 16; ++i, xp += 4)
-              xbuf[i] = (md5_word_t)(xp[0] + (xp[1] << 8) +
-                                     (xp[2] << 16) + (xp[3] << 24));
-        }
-#endif
-    }
-
-#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
-
-    /* Round 1. */
-    /* Let [abcd k s i] denote the operation
-       a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */
-#define F(x, y, z) (((x) & (y)) | (~(x) & (z)))
-#define SET(a, b, c, d, k, s, Ti)\
-  t = a + F(b,c,d) + X[k] + Ti;\
-  a = ROTATE_LEFT(t, s) + b
-    /* Do the following 16 operations. */
-    SET(a, b, c, d,  0,  7,  T1);
-    SET(d, a, b, c,  1, 12,  T2);
-    SET(c, d, a, b,  2, 17,  T3);
-    SET(b, c, d, a,  3, 22,  T4);
-    SET(a, b, c, d,  4,  7,  T5);
-    SET(d, a, b, c,  5, 12,  T6);
-    SET(c, d, a, b,  6, 17,  T7);
-    SET(b, c, d, a,  7, 22,  T8);
-    SET(a, b, c, d,  8,  7,  T9);
-    SET(d, a, b, c,  9, 12, T10);
-    SET(c, d, a, b, 10, 17, T11);
-    SET(b, c, d, a, 11, 22, T12);
-    SET(a, b, c, d, 12,  7, T13);
-    SET(d, a, b, c, 13, 12, T14);
-    SET(c, d, a, b, 14, 17, T15);
-    SET(b, c, d, a, 15, 22, T16);
-#undef SET
-
-     /* Round 2. */
-     /* Let [abcd k s i] denote the operation
-          a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */
-#define G(x, y, z) (((x) & (z)) | ((y) & ~(z)))
-#define SET(a, b, c, d, k, s, Ti)\
-  t = a + G(b,c,d) + X[k] + Ti;\
-  a = ROTATE_LEFT(t, s) + b
-     /* Do the following 16 operations. */
-    SET(a, b, c, d,  1,  5, T17);
-    SET(d, a, b, c,  6,  9, T18);
-    SET(c, d, a, b, 11, 14, T19);
-    SET(b, c, d, a,  0, 20, T20);
-    SET(a, b, c, d,  5,  5, T21);
-    SET(d, a, b, c, 10,  9, T22);
-    SET(c, d, a, b, 15, 14, T23);
-    SET(b, c, d, a,  4, 20, T24);
-    SET(a, b, c, d,  9,  5, T25);
-    SET(d, a, b, c, 14,  9, T26);
-    SET(c, d, a, b,  3, 14, T27);
-    SET(b, c, d, a,  8, 20, T28);
-    SET(a, b, c, d, 13,  5, T29);
-    SET(d, a, b, c,  2,  9, T30);
-    SET(c, d, a, b,  7, 14, T31);
-    SET(b, c, d, a, 12, 20, T32);
-#undef SET
-
-     /* Round 3. */
-     /* Let [abcd k s t] denote the operation
-          a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */
-#define H(x, y, z) ((x) ^ (y) ^ (z))
-#define SET(a, b, c, d, k, s, Ti)\
-  t = a + H(b,c,d) + X[k] + Ti;\
-  a = ROTATE_LEFT(t, s) + b
-     /* Do the following 16 operations. */
-    SET(a, b, c, d,  5,  4, T33);
-    SET(d, a, b, c,  8, 11, T34);
-    SET(c, d, a, b, 11, 16, T35);
-    SET(b, c, d, a, 14, 23, T36);
-    SET(a, b, c, d,  1,  4, T37);
-    SET(d, a, b, c,  4, 11, T38);
-    SET(c, d, a, b,  7, 16, T39);
-    SET(b, c, d, a, 10, 23, T40);
-    SET(a, b, c, d, 13,  4, T41);
-    SET(d, a, b, c,  0, 11, T42);
-    SET(c, d, a, b,  3, 16, T43);
-    SET(b, c, d, a,  6, 23, T44);
-    SET(a, b, c, d,  9,  4, T45);
-    SET(d, a, b, c, 12, 11, T46);
-    SET(c, d, a, b, 15, 16, T47);
-    SET(b, c, d, a,  2, 23, T48);
-#undef SET
-
-     /* Round 4. */
-     /* Let [abcd k s t] denote the operation
-          a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */
-#define I(x, y, z) ((y) ^ ((x) | ~(z)))
-#define SET(a, b, c, d, k, s, Ti)\
-  t = a + I(b,c,d) + X[k] + Ti;\
-  a = ROTATE_LEFT(t, s) + b
-     /* Do the following 16 operations. */
-    SET(a, b, c, d,  0,  6, T49);
-    SET(d, a, b, c,  7, 10, T50);
-    SET(c, d, a, b, 14, 15, T51);
-    SET(b, c, d, a,  5, 21, T52);
-    SET(a, b, c, d, 12,  6, T53);
-    SET(d, a, b, c,  3, 10, T54);
-    SET(c, d, a, b, 10, 15, T55);
-    SET(b, c, d, a,  1, 21, T56);
-    SET(a, b, c, d,  8,  6, T57);
-    SET(d, a, b, c, 15, 10, T58);
-    SET(c, d, a, b,  6, 15, T59);
-    SET(b, c, d, a, 13, 21, T60);
-    SET(a, b, c, d,  4,  6, T61);
-    SET(d, a, b, c, 11, 10, T62);
-    SET(c, d, a, b,  2, 15, T63);
-    SET(b, c, d, a,  9, 21, T64);
-#undef SET
-
-     /* Then perform the following additions. (That is increment each
-        of the four registers by the value it had before this block
-        was started.) */
-    pms->abcd[0] += a;
-    pms->abcd[1] += b;
-    pms->abcd[2] += c;
-    pms->abcd[3] += d;
-}
-
-/* Initialize the algorithm. */
-static void md5_init(md5_state_t *pms)
-{
-    pms->count[0] = pms->count[1] = 0;
-    pms->abcd[0] = 0x67452301;
-    pms->abcd[1] = /*0xefcdab89*/ T_MASK ^ 0x10325476;
-    pms->abcd[2] = /*0x98badcfe*/ T_MASK ^ 0x67452301;
-    pms->abcd[3] = 0x10325476;
-}
-
-/* Append a string to the message. */
-static void md5_append(md5_state_t *pms, const md5_byte_t *data, size_t nbytes)
-{
-    const md5_byte_t *p = data;
-    size_t left = nbytes;
-    size_t offset = (pms->count[0] >> 3) & 63;
-    md5_word_t nbits = (md5_word_t)(nbytes << 3);
-
-    if (nbytes <= 0)
-        return;
-
-    /* Update the message length. */
-    pms->count[1] += (md5_word_t)(nbytes >> 29);
-    pms->count[0] += nbits;
-    if (pms->count[0] < nbits)
-        pms->count[1]++;
-
-    /* Process an initial partial block. */
-    if (offset) {
-        size_t copy = (offset + nbytes > 64 ? 64 - offset : nbytes);
-
-        memcpy(pms->buf + offset, p, copy);
-        if (offset + copy < 64)
-            return;
-        p += copy;
-        left -= copy;
-        md5_process(pms, pms->buf);
-    }
-
-    /* Process full blocks. */
-    for (; left >= 64; p += 64, left -= 64)
-        md5_process(pms, p);
-
-    /* Process a final partial block. */
-    if (left)
-        memcpy(pms->buf, p, left);
-}
-
-/* Finish the message and return the digest. */
-static void md5_finish(md5_state_t *pms, md5_byte_t digest[16])
-{
-    static const md5_byte_t pad[64] = {
-        0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-    };
-    md5_byte_t data[8];
-    int i;
-
-    /* Save the length before padding. */
-    for (i = 0; i < 8; ++i)
-        data[i] = (md5_byte_t)(pms->count[i >> 2] >> ((i & 3) << 3));
-    /* Pad to 56 bytes mod 64. */
-    md5_append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1);
-    /* Append the length. */
-    md5_append(pms, data, 8);
-    for (i = 0; i < 16; ++i)
-        digest[i] = (md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3));
-}
-
-#if defined(__clang__)
-# pragma clang diagnostic pop
-#endif
-
-/*--------------------------------------------------------------------------*/
-/* Wrap up the MD5 state in our opaque structure.  */
-struct kwsysMD5_s
-{
-  md5_state_t md5_state;
-};
-
-/*--------------------------------------------------------------------------*/
-kwsysMD5* kwsysMD5_New(void)
-{
-  /* Allocate a process control structure.  */
-  kwsysMD5* md5 = (kwsysMD5*)malloc(sizeof(kwsysMD5));
-  if(!md5)
-    {
-    return 0;
-    }
-  return md5;
-}
-
-/*--------------------------------------------------------------------------*/
-void kwsysMD5_Delete(kwsysMD5* md5)
-{
-  /* Make sure we have an instance.  */
-  if(!md5)
-    {
-    return;
-    }
-
-  /* Free memory.  */
-  free(md5);
-}
-
-/*--------------------------------------------------------------------------*/
-void kwsysMD5_Initialize(kwsysMD5* md5)
-{
-  md5_init(&md5->md5_state);
-}
-
-/*--------------------------------------------------------------------------*/
-void kwsysMD5_Append(kwsysMD5* md5, unsigned char const* data, int length)
-{
-  size_t dlen;
-  if(length < 0)
-    {
-    dlen = strlen((char const*)data);
-    }
-  else
-    {
-    dlen = (size_t)length;
-    }
-  md5_append(&md5->md5_state, (md5_byte_t const*)data, dlen);
-}
-
-/*--------------------------------------------------------------------------*/
-void kwsysMD5_Finalize(kwsysMD5* md5, unsigned char digest[16])
-{
-  md5_finish(&md5->md5_state, (md5_byte_t*)digest);
-}
-
-/*--------------------------------------------------------------------------*/
-void kwsysMD5_FinalizeHex(kwsysMD5* md5, char buffer[32])
-{
-  unsigned char digest[16];
-  kwsysMD5_Finalize(md5, digest);
-  kwsysMD5_DigestToHex(digest, buffer);
-}
-
-/*--------------------------------------------------------------------------*/
-void kwsysMD5_DigestToHex(unsigned char const digest[16], char buffer[32])
-{
-  /* Map from 4-bit index to hexadecimal representation.  */
-  static char const hex[16] =
-    {'0', '1', '2', '3', '4', '5', '6', '7',
-     '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
-
-  /* Map each 4-bit block separately.  */
-  char* out = buffer;
-  int i;
-  for(i=0; i < 16; ++i)
-    {
-    *out++ = hex[digest[i] >> 4];
-    *out++ = hex[digest[i] & 0xF];
-    }
-}
diff --git a/src/kwsys/MD5.h.in b/src/kwsys/MD5.h.in
deleted file mode 100644
index 3334431..0000000
--- a/src/kwsys/MD5.h.in
+++ /dev/null
@@ -1,107 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef @KWSYS_NAMESPACE at _MD5_h
-#define @KWSYS_NAMESPACE at _MD5_h
-
-#include <@KWSYS_NAMESPACE@/Configure.h>
-
-/* Redefine all public interface symbol names to be in the proper
-   namespace.  These macros are used internally to kwsys only, and are
-   not visible to user code.  Use kwsysHeaderDump.pl to reproduce
-   these macros after making changes to the interface.  */
-#if !defined(KWSYS_NAMESPACE)
-# define kwsys_ns(x) @KWSYS_NAMESPACE@##x
-# define kwsysEXPORT @KWSYS_NAMESPACE at _EXPORT
-#endif
-#if !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
-# define kwsysMD5                 kwsys_ns(MD5)
-# define kwsysMD5_s               kwsys_ns(MD5_s)
-# define kwsysMD5_New             kwsys_ns(MD5_New)
-# define kwsysMD5_Delete          kwsys_ns(MD5_Delete)
-# define kwsysMD5_Initialize      kwsys_ns(MD5_Initialize)
-# define kwsysMD5_Append          kwsys_ns(MD5_Append)
-# define kwsysMD5_Finalize        kwsys_ns(MD5_Finalize)
-# define kwsysMD5_FinalizeHex     kwsys_ns(MD5_FinalizeHex)
-# define kwsysMD5_DigestToHex     kwsys_ns(MD5_DigestToHex)
-#endif
-
-#if defined(__cplusplus)
-extern "C"
-{
-#endif
-
-/**
- * MD5 state data structure.
- */
-typedef struct kwsysMD5_s kwsysMD5;
-
-/**
- * Create a new MD5 instance.  The returned instance is not initialized.
- */
-kwsysEXPORT kwsysMD5* kwsysMD5_New(void);
-
-/**
- * Delete an old MD5 instance.
- */
-kwsysEXPORT void kwsysMD5_Delete(kwsysMD5* md5);
-
-/**
- * Initialize a new MD5 digest.
- */
-kwsysEXPORT void kwsysMD5_Initialize(kwsysMD5* md5);
-
-/**
- * Append data to an MD5 digest.  If the given length is negative,
- * data will be read up to but not including a terminating null.
- */
-kwsysEXPORT void kwsysMD5_Append(kwsysMD5* md5, unsigned char const* data,
-                                 int length);
-
-/**
- * Finalize a MD5 digest and get the 16-byte hash value.
- */
-kwsysEXPORT void kwsysMD5_Finalize(kwsysMD5* md5, unsigned char digest[16]);
-
-/**
- * Finalize a MD5 digest and get the 32-bit hexadecimal representation.
- */
-kwsysEXPORT void kwsysMD5_FinalizeHex(kwsysMD5* md5, char buffer[32]);
-
-/**
- * Convert a MD5 digest 16-byte value to a 32-byte hexadecimal representation.
- */
-kwsysEXPORT void kwsysMD5_DigestToHex(unsigned char const digest[16],
-                                      char buffer[32]);
-
-#if defined(__cplusplus)
-} /* extern "C" */
-#endif
-
-/* If we are building a kwsys .c or .cxx file, let it use these macros.
-   Otherwise, undefine them to keep the namespace clean.  */
-#if !defined(KWSYS_NAMESPACE)
-# undef kwsys_ns
-# undef kwsysEXPORT
-# if !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
-#  undef kwsysMD5
-#  undef kwsysMD5_s
-#  undef kwsysMD5_New
-#  undef kwsysMD5_Delete
-#  undef kwsysMD5_Initialize
-#  undef kwsysMD5_Append
-#  undef kwsysMD5_Finalize
-#  undef kwsysMD5_FinalizeHex
-#  undef kwsysMD5_DigestToHex
-# endif
-#endif
-
-#endif
diff --git a/src/kwsys/Process.h.in b/src/kwsys/Process.h.in
index c5995ea..c5ebc97 100644
--- a/src/kwsys/Process.h.in
+++ b/src/kwsys/Process.h.in
@@ -23,57 +23,60 @@
 # define kwsysEXPORT @KWSYS_NAMESPACE at _EXPORT
 #endif
 #if !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
-# define kwsysProcess                     kwsys_ns(Process)
-# define kwsysProcess_s                   kwsys_ns(Process_s)
-# define kwsysProcess_New                 kwsys_ns(Process_New)
-# define kwsysProcess_Delete              kwsys_ns(Process_Delete)
-# define kwsysProcess_SetCommand          kwsys_ns(Process_SetCommand)
-# define kwsysProcess_AddCommand          kwsys_ns(Process_AddCommand)
-# define kwsysProcess_SetTimeout          kwsys_ns(Process_SetTimeout)
-# define kwsysProcess_SetWorkingDirectory kwsys_ns(Process_SetWorkingDirectory)
-# define kwsysProcess_SetPipeFile         kwsys_ns(Process_SetPipeFile)
-# define kwsysProcess_SetPipeNative       kwsys_ns(Process_SetPipeNative)
-# define kwsysProcess_SetPipeShared       kwsys_ns(Process_SetPipeShared)
-# define kwsysProcess_Option_Detach       kwsys_ns(Process_Option_Detach)
-# define kwsysProcess_Option_HideWindow   kwsys_ns(Process_Option_HideWindow)
-# define kwsysProcess_Option_Verbatim     kwsys_ns(Process_Option_Verbatim)
-# define kwsysProcess_GetOption           kwsys_ns(Process_GetOption)
-# define kwsysProcess_SetOption           kwsys_ns(Process_SetOption)
-# define kwsysProcess_Option_e            kwsys_ns(Process_Option_e)
-# define kwsysProcess_State_Starting      kwsys_ns(Process_State_Starting)
-# define kwsysProcess_State_Error         kwsys_ns(Process_State_Error)
-# define kwsysProcess_State_Exception     kwsys_ns(Process_State_Exception)
-# define kwsysProcess_State_Executing     kwsys_ns(Process_State_Executing)
-# define kwsysProcess_State_Exited        kwsys_ns(Process_State_Exited)
-# define kwsysProcess_State_Expired       kwsys_ns(Process_State_Expired)
-# define kwsysProcess_State_Killed        kwsys_ns(Process_State_Killed)
-# define kwsysProcess_State_Disowned      kwsys_ns(Process_State_Disowned)
-# define kwsysProcess_GetState            kwsys_ns(Process_GetState)
-# define kwsysProcess_State_e             kwsys_ns(Process_State_e)
-# define kwsysProcess_Exception_None      kwsys_ns(Process_Exception_None)
-# define kwsysProcess_Exception_Fault     kwsys_ns(Process_Exception_Fault)
-# define kwsysProcess_Exception_Illegal   kwsys_ns(Process_Exception_Illegal)
-# define kwsysProcess_Exception_Interrupt kwsys_ns(Process_Exception_Interrupt)
-# define kwsysProcess_Exception_Numerical kwsys_ns(Process_Exception_Numerical)
-# define kwsysProcess_Exception_Other     kwsys_ns(Process_Exception_Other)
-# define kwsysProcess_GetExitException    kwsys_ns(Process_GetExitException)
-# define kwsysProcess_Exception_e         kwsys_ns(Process_Exception_e)
-# define kwsysProcess_GetExitCode         kwsys_ns(Process_GetExitCode)
-# define kwsysProcess_GetExitValue        kwsys_ns(Process_GetExitValue)
-# define kwsysProcess_GetErrorString      kwsys_ns(Process_GetErrorString)
-# define kwsysProcess_GetExceptionString  kwsys_ns(Process_GetExceptionString)
-# define kwsysProcess_Execute             kwsys_ns(Process_Execute)
-# define kwsysProcess_Disown              kwsys_ns(Process_Disown)
-# define kwsysProcess_WaitForData         kwsys_ns(Process_WaitForData)
-# define kwsysProcess_Pipes_e             kwsys_ns(Process_Pipes_e)
-# define kwsysProcess_Pipe_None           kwsys_ns(Process_Pipe_None)
-# define kwsysProcess_Pipe_STDIN          kwsys_ns(Process_Pipe_STDIN)
-# define kwsysProcess_Pipe_STDOUT         kwsys_ns(Process_Pipe_STDOUT)
-# define kwsysProcess_Pipe_STDERR         kwsys_ns(Process_Pipe_STDERR)
-# define kwsysProcess_Pipe_Timeout        kwsys_ns(Process_Pipe_Timeout)
-# define kwsysProcess_Pipe_Handle         kwsys_ns(Process_Pipe_Handle)
-# define kwsysProcess_WaitForExit         kwsys_ns(Process_WaitForExit)
-# define kwsysProcess_Kill                kwsys_ns(Process_Kill)
+# define kwsysProcess                           kwsys_ns(Process)
+# define kwsysProcess_s                         kwsys_ns(Process_s)
+# define kwsysProcess_New                       kwsys_ns(Process_New)
+# define kwsysProcess_Delete                    kwsys_ns(Process_Delete)
+# define kwsysProcess_SetCommand                kwsys_ns(Process_SetCommand)
+# define kwsysProcess_AddCommand                kwsys_ns(Process_AddCommand)
+# define kwsysProcess_SetTimeout                kwsys_ns(Process_SetTimeout)
+# define kwsysProcess_SetWorkingDirectory       kwsys_ns(Process_SetWorkingDirectory)
+# define kwsysProcess_SetPipeFile               kwsys_ns(Process_SetPipeFile)
+# define kwsysProcess_SetPipeNative             kwsys_ns(Process_SetPipeNative)
+# define kwsysProcess_SetPipeShared             kwsys_ns(Process_SetPipeShared)
+# define kwsysProcess_Option_Detach             kwsys_ns(Process_Option_Detach)
+# define kwsysProcess_Option_HideWindow         kwsys_ns(Process_Option_HideWindow)
+# define kwsysProcess_Option_MergeOutput        kwsys_ns(Process_Option_MergeOutput)
+# define kwsysProcess_Option_Verbatim           kwsys_ns(Process_Option_Verbatim)
+# define kwsysProcess_Option_CreateProcessGroup kwsys_ns(Process_Option_CreateProcessGroup)
+# define kwsysProcess_GetOption                 kwsys_ns(Process_GetOption)
+# define kwsysProcess_SetOption                 kwsys_ns(Process_SetOption)
+# define kwsysProcess_Option_e                  kwsys_ns(Process_Option_e)
+# define kwsysProcess_State_Starting            kwsys_ns(Process_State_Starting)
+# define kwsysProcess_State_Error               kwsys_ns(Process_State_Error)
+# define kwsysProcess_State_Exception           kwsys_ns(Process_State_Exception)
+# define kwsysProcess_State_Executing           kwsys_ns(Process_State_Executing)
+# define kwsysProcess_State_Exited              kwsys_ns(Process_State_Exited)
+# define kwsysProcess_State_Expired             kwsys_ns(Process_State_Expired)
+# define kwsysProcess_State_Killed              kwsys_ns(Process_State_Killed)
+# define kwsysProcess_State_Disowned            kwsys_ns(Process_State_Disowned)
+# define kwsysProcess_GetState                  kwsys_ns(Process_GetState)
+# define kwsysProcess_State_e                   kwsys_ns(Process_State_e)
+# define kwsysProcess_Exception_None            kwsys_ns(Process_Exception_None)
+# define kwsysProcess_Exception_Fault           kwsys_ns(Process_Exception_Fault)
+# define kwsysProcess_Exception_Illegal         kwsys_ns(Process_Exception_Illegal)
+# define kwsysProcess_Exception_Interrupt       kwsys_ns(Process_Exception_Interrupt)
+# define kwsysProcess_Exception_Numerical       kwsys_ns(Process_Exception_Numerical)
+# define kwsysProcess_Exception_Other           kwsys_ns(Process_Exception_Other)
+# define kwsysProcess_GetExitException          kwsys_ns(Process_GetExitException)
+# define kwsysProcess_Exception_e               kwsys_ns(Process_Exception_e)
+# define kwsysProcess_GetExitCode               kwsys_ns(Process_GetExitCode)
+# define kwsysProcess_GetExitValue              kwsys_ns(Process_GetExitValue)
+# define kwsysProcess_GetErrorString            kwsys_ns(Process_GetErrorString)
+# define kwsysProcess_GetExceptionString        kwsys_ns(Process_GetExceptionString)
+# define kwsysProcess_Execute                   kwsys_ns(Process_Execute)
+# define kwsysProcess_Disown                    kwsys_ns(Process_Disown)
+# define kwsysProcess_WaitForData               kwsys_ns(Process_WaitForData)
+# define kwsysProcess_Pipes_e                   kwsys_ns(Process_Pipes_e)
+# define kwsysProcess_Pipe_None                 kwsys_ns(Process_Pipe_None)
+# define kwsysProcess_Pipe_STDIN                kwsys_ns(Process_Pipe_STDIN)
+# define kwsysProcess_Pipe_STDOUT               kwsys_ns(Process_Pipe_STDOUT)
+# define kwsysProcess_Pipe_STDERR               kwsys_ns(Process_Pipe_STDERR)
+# define kwsysProcess_Pipe_Timeout              kwsys_ns(Process_Pipe_Timeout)
+# define kwsysProcess_Pipe_Handle               kwsys_ns(Process_Pipe_Handle)
+# define kwsysProcess_WaitForExit               kwsys_ns(Process_WaitForExit)
+# define kwsysProcess_Interrupt                 kwsys_ns(Process_Interrupt)
+# define kwsysProcess_Kill                      kwsys_ns(Process_Kill)
 #endif
 
 #if defined(__cplusplus)
@@ -186,12 +189,27 @@ kwsysEXPORT void kwsysProcess_SetPipeNative(kwsysProcess* cp, int pipe,
  *         0 = No (default)
  *         1 = Yes
  *
+ *  kwsysProcess_Option_MergeOutput = Whether to merge stdout/stderr.
+ *                                    No content will be returned as stderr.
+ *                                    Any actual stderr will be on stdout.
+ *         0 = No (default)
+ *         1 = Yes
+ *
  *  kwsysProcess_Option_Verbatim = Whether SetCommand and AddCommand
  *                                 should treat the first argument
  *                                 as a verbatim command line
  *                                 and ignore the rest of the arguments.
  *         0 = No (default)
  *         1 = Yes
+ *
+ *  kwsysProcess_Option_CreateProcessGroup = Whether to place the process in a
+ *                                           new process group.  This is
+ *                                           useful if you want to send Ctrl+C
+ *                                           to the process.  On UNIX, also
+ *                                           places the process in a new
+ *                                           session.
+ *         0 = No (default)
+ *         1 = Yes
  */
 kwsysEXPORT int kwsysProcess_GetOption(kwsysProcess* cp, int optionId);
 kwsysEXPORT void kwsysProcess_SetOption(kwsysProcess* cp, int optionId,
@@ -200,7 +218,9 @@ enum kwsysProcess_Option_e
 {
   kwsysProcess_Option_HideWindow,
   kwsysProcess_Option_Detach,
-  kwsysProcess_Option_Verbatim
+  kwsysProcess_Option_MergeOutput,
+  kwsysProcess_Option_Verbatim,
+  kwsysProcess_Option_CreateProcessGroup
 };
 
 /**
@@ -355,6 +375,17 @@ enum kwsysProcess_Pipes_e
 kwsysEXPORT int kwsysProcess_WaitForExit(kwsysProcess* cp, double* timeout);
 
 /**
+ * Interrupt the process group for the child process that is currently
+ * running by sending it the appropriate operating-system specific signal.
+ * The caller should call WaitForExit after this returns to wait for the
+ * child to terminate.
+ *
+ * WARNING:  If you didn't specify kwsysProcess_Option_CreateProcessGroup,
+ * you will interrupt your own process group.
+ */
+kwsysEXPORT void kwsysProcess_Interrupt(kwsysProcess* cp);
+
+/**
  * Forcefully terminate the child process that is currently running.
  * The caller should call WaitForExit after this returns to wait for
  * the child to terminate.
@@ -384,7 +415,9 @@ kwsysEXPORT void kwsysProcess_Kill(kwsysProcess* cp);
 #  undef kwsysProcess_SetPipeShared
 #  undef kwsysProcess_Option_Detach
 #  undef kwsysProcess_Option_HideWindow
+#  undef kwsysProcess_Option_MergeOutput
 #  undef kwsysProcess_Option_Verbatim
+#  undef kwsysProcess_Option_CreateProcessGroup
 #  undef kwsysProcess_GetOption
 #  undef kwsysProcess_SetOption
 #  undef kwsysProcess_Option_e
@@ -421,6 +454,7 @@ kwsysEXPORT void kwsysProcess_Kill(kwsysProcess* cp);
 #  undef kwsysProcess_Pipe_Timeout
 #  undef kwsysProcess_Pipe_Handle
 #  undef kwsysProcess_WaitForExit
+#  undef kwsysProcess_Interrupt
 #  undef kwsysProcess_Kill
 # endif
 #endif
diff --git a/src/kwsys/ProcessUNIX.c b/src/kwsys/ProcessUNIX.c
index ca9d424..6d9b109 100644
--- a/src/kwsys/ProcessUNIX.c
+++ b/src/kwsys/ProcessUNIX.c
@@ -88,7 +88,7 @@ typedef ssize_t kwsysProcess_ssize_t;
 typedef int kwsysProcess_ssize_t;
 #endif
 
-#if defined(__BEOS__) && !defined(__ZETA__) 
+#if defined(__BEOS__) && !defined(__ZETA__)
 /* BeOS 5 doesn't have usleep(), but it has snooze(), which is identical. */
 # include <be/kernel/OS.h>
 static inline void kwsysProcess_usleep(unsigned int msec)
@@ -151,13 +151,14 @@ typedef struct kwsysProcessCreateInformation_s
 } kwsysProcessCreateInformation;
 
 /*--------------------------------------------------------------------------*/
+static void kwsysProcessVolatileFree(volatile void* p);
 static int kwsysProcessInitialize(kwsysProcess* cp);
 static void kwsysProcessCleanup(kwsysProcess* cp, int error);
 static void kwsysProcessCleanupDescriptor(int* pfd);
 static void kwsysProcessClosePipes(kwsysProcess* cp);
 static int kwsysProcessSetNonBlocking(int fd);
 static int kwsysProcessCreate(kwsysProcess* cp, int prIndex,
-                              kwsysProcessCreateInformation* si, int* readEnd);
+                              kwsysProcessCreateInformation* si);
 static void kwsysProcessDestroy(kwsysProcess* cp);
 static int kwsysProcessSetupOutputPipeFile(int* p, const char* name);
 static int kwsysProcessSetupOutputPipeNative(int* p, int des[2]);
@@ -197,20 +198,26 @@ struct kwsysProcess_s
 {
   /* The command lines to execute.  */
   char*** Commands;
-  int NumberOfCommands;
+  volatile int NumberOfCommands;
 
   /* Descriptors for the read ends of the child's output pipes and
      the signal pipe. */
   int PipeReadEnds[KWSYSPE_PIPE_COUNT];
 
+  /* Descriptors for the child's ends of the pipes.
+     Used temporarily during process creation.  */
+  int PipeChildStd[3];
+
   /* Write descriptor for child termination signal pipe.  */
   int SignalPipe;
 
   /* Buffer for pipe data.  */
   char PipeBuffer[KWSYSPE_PIPE_BUFFER_SIZE];
 
-  /* Process IDs returned by the calls to fork.  */
-  pid_t* ForkPIDs;
+  /* Process IDs returned by the calls to fork.  Everything is volatile
+     because the signal handler accesses them.  You must be very careful
+     when reaping PIDs or modifying this array to avoid race conditions.  */
+  volatile pid_t* volatile ForkPIDs;
 
   /* Flag for whether the children were terminated by a faild select.  */
   int SelectError;
@@ -230,6 +237,12 @@ struct kwsysProcess_s
   /* Whether to treat command lines as verbatim.  */
   int Verbatim;
 
+  /* Whether to merge stdout/stderr of the child.  */
+  int MergeOutput;
+
+  /* Whether to create the process in a new process group.  */
+  volatile sig_atomic_t CreateProcessGroup;
+
   /* Time at which the child started.  Negative for no timeout.  */
   kwsysProcessTime StartTime;
 
@@ -250,8 +263,9 @@ struct kwsysProcess_s
   /* The number of children still executing.  */
   int CommandsLeft;
 
-  /* The current status of the child process. */
-  int State;
+  /* The current status of the child process.  Must be atomic because
+     the signal handler checks this to avoid a race.  */
+  volatile sig_atomic_t State;
 
   /* The exceptional behavior that terminated the child process, if
    * any.  */
@@ -264,7 +278,7 @@ struct kwsysProcess_s
   int ExitValue;
 
   /* Whether the process was killed.  */
-  int Killed;
+  volatile sig_atomic_t Killed;
 
   /* Buffer for error message in case of failure.  */
   char ErrorMessage[KWSYSPE_PIPE_BUFFER_SIZE+1];
@@ -547,7 +561,7 @@ int kwsysProcess_SetPipeFile(kwsysProcess* cp, int prPipe, const char* file)
     }
   if(file)
     {
-    *pfile = malloc(strlen(file)+1);
+    *pfile = (char*)malloc(strlen(file)+1);
     if(!*pfile)
       {
       return 0;
@@ -640,7 +654,10 @@ int kwsysProcess_GetOption(kwsysProcess* cp, int optionId)
   switch(optionId)
     {
     case kwsysProcess_Option_Detach: return cp->OptionDetach;
+    case kwsysProcess_Option_MergeOutput: return cp->MergeOutput;
     case kwsysProcess_Option_Verbatim: return cp->Verbatim;
+    case kwsysProcess_Option_CreateProcessGroup:
+      return cp->CreateProcessGroup;
     default: return 0;
     }
 }
@@ -656,7 +673,10 @@ void kwsysProcess_SetOption(kwsysProcess* cp, int optionId, int value)
   switch(optionId)
     {
     case kwsysProcess_Option_Detach: cp->OptionDetach = value; break;
+    case kwsysProcess_Option_MergeOutput: cp->MergeOutput = value; break;
     case kwsysProcess_Option_Verbatim: cp->Verbatim = value; break;
+    case kwsysProcess_Option_CreateProcessGroup:
+      cp->CreateProcessGroup = value; break;
     default: break;
     }
 }
@@ -717,7 +737,6 @@ const char* kwsysProcess_GetExceptionString(kwsysProcess* cp)
 void kwsysProcess_Execute(kwsysProcess* cp)
 {
   int i;
-  kwsysProcessCreateInformation si = {-1, -1, -1, {-1, -1}};
 
   /* Do not execute a second copy simultaneously.  */
   if(!cp || cp->State == kwsysProcess_State_Executing)
@@ -785,7 +804,50 @@ void kwsysProcess_Execute(kwsysProcess* cp)
       }
     }
 
-  /* Setup the stderr pipe to be shared by all processes.  */
+  /* Setup the stdin pipe for the first process.  */
+  if(cp->PipeFileSTDIN)
+    {
+    /* Open a file for the child's stdin to read.  */
+    cp->PipeChildStd[0] = open(cp->PipeFileSTDIN, O_RDONLY);
+    if(cp->PipeChildStd[0] < 0)
+      {
+      kwsysProcessCleanup(cp, 1);
+      return;
+      }
+
+    /* Set close-on-exec flag on the pipe's end.  */
+    if(fcntl(cp->PipeChildStd[0], F_SETFD, FD_CLOEXEC) < 0)
+      {
+      kwsysProcessCleanup(cp, 1);
+      return;
+      }
+    }
+  else if(cp->PipeSharedSTDIN)
+    {
+    cp->PipeChildStd[0] = 0;
+    }
+  else if(cp->PipeNativeSTDIN[0] >= 0)
+    {
+    cp->PipeChildStd[0] = cp->PipeNativeSTDIN[0];
+
+    /* Set close-on-exec flag on the pipe's ends.  The read end will
+       be dup2-ed into the stdin descriptor after the fork but before
+       the exec.  */
+    if((fcntl(cp->PipeNativeSTDIN[0], F_SETFD, FD_CLOEXEC) < 0) ||
+       (fcntl(cp->PipeNativeSTDIN[1], F_SETFD, FD_CLOEXEC) < 0))
+      {
+      kwsysProcessCleanup(cp, 1);
+      return;
+      }
+    }
+  else
+    {
+    cp->PipeChildStd[0] = -1;
+    }
+
+  /* Create the output pipe for the last process.
+     We always create this so the pipe can be passed to select even if
+     it will report closed immediately.  */
   {
   /* Create the pipe.  */
   int p[2];
@@ -796,15 +858,14 @@ void kwsysProcess_Execute(kwsysProcess* cp)
     }
 
   /* Store the pipe.  */
-  cp->PipeReadEnds[KWSYSPE_PIPE_STDERR] = p[0];
-  si.StdErr = p[1];
+  cp->PipeReadEnds[KWSYSPE_PIPE_STDOUT] = p[0];
+  cp->PipeChildStd[1] = p[1];
 
   /* Set close-on-exec flag on the pipe's ends.  */
   if((fcntl(p[0], F_SETFD, FD_CLOEXEC) < 0) ||
      (fcntl(p[1], F_SETFD, FD_CLOEXEC) < 0))
     {
     kwsysProcessCleanup(cp, 1);
-    kwsysProcessCleanupDescriptor(&si.StdErr);
     return;
     }
 
@@ -813,41 +874,93 @@ void kwsysProcess_Execute(kwsysProcess* cp)
   if(!kwsysProcessSetNonBlocking(p[0]))
     {
     kwsysProcessCleanup(cp, 1);
-    kwsysProcessCleanupDescriptor(&si.StdErr);
     return;
     }
   }
 
-  /* Replace the stderr pipe with a file if requested.  In this case
-     the select call will report that stderr is closed immediately.  */
-  if(cp->PipeFileSTDERR)
+  if (cp->PipeFileSTDOUT)
     {
-    if(!kwsysProcessSetupOutputPipeFile(&si.StdErr, cp->PipeFileSTDERR))
+    /* Use a file for stdout.  */
+    if(!kwsysProcessSetupOutputPipeFile(&cp->PipeChildStd[1],
+                                        cp->PipeFileSTDOUT))
       {
       kwsysProcessCleanup(cp, 1);
-      kwsysProcessCleanupDescriptor(&si.StdErr);
       return;
       }
     }
+  else if (cp->PipeSharedSTDOUT)
+    {
+    /* Use the parent stdout.  */
+    kwsysProcessCleanupDescriptor(&cp->PipeChildStd[1]);
+    cp->PipeChildStd[1] = 1;
+    }
+  else if (cp->PipeNativeSTDOUT[1] >= 0)
+    {
+    /* Use the given descriptor for stdout.  */
+    if(!kwsysProcessSetupOutputPipeNative(&cp->PipeChildStd[1],
+                                          cp->PipeNativeSTDOUT))
+      {
+      kwsysProcessCleanup(cp, 1);
+      return;
+      }
+    }
+
+  /* Create stderr pipe to be shared by all processes in the pipeline.
+     We always create this so the pipe can be passed to select even if
+     it will report closed immediately.  */
+  {
+  /* Create the pipe.  */
+  int p[2];
+  if(pipe(p KWSYSPE_VMS_NONBLOCK) < 0)
+    {
+    kwsysProcessCleanup(cp, 1);
+    return;
+    }
+
+  /* Store the pipe.  */
+  cp->PipeReadEnds[KWSYSPE_PIPE_STDERR] = p[0];
+  cp->PipeChildStd[2] = p[1];
 
-  /* Replace the stderr pipe with the parent's if requested.  In this
-     case the select call will report that stderr is closed
-     immediately.  */
-  if(cp->PipeSharedSTDERR)
+  /* Set close-on-exec flag on the pipe's ends.  */
+  if((fcntl(p[0], F_SETFD, FD_CLOEXEC) < 0) ||
+     (fcntl(p[1], F_SETFD, FD_CLOEXEC) < 0))
     {
-    kwsysProcessCleanupDescriptor(&si.StdErr);
-    si.StdErr = 2;
+    kwsysProcessCleanup(cp, 1);
+    return;
     }
 
-  /* Replace the stderr pipe with the native pipe provided if any.  In
-     this case the select call will report that stderr is closed
-     immediately.  */
-  if(cp->PipeNativeSTDERR[1] >= 0)
+  /* Set to non-blocking in case select lies, or for the polling
+     implementation.  */
+  if(!kwsysProcessSetNonBlocking(p[0]))
     {
-    if(!kwsysProcessSetupOutputPipeNative(&si.StdErr, cp->PipeNativeSTDERR))
+    kwsysProcessCleanup(cp, 1);
+    return;
+    }
+  }
+
+  if (cp->PipeFileSTDERR)
+    {
+    /* Use a file for stderr.  */
+    if(!kwsysProcessSetupOutputPipeFile(&cp->PipeChildStd[2],
+                                        cp->PipeFileSTDERR))
+      {
+      kwsysProcessCleanup(cp, 1);
+      return;
+      }
+    }
+  else if (cp->PipeSharedSTDERR)
+    {
+    /* Use the parent stderr.  */
+    kwsysProcessCleanupDescriptor(&cp->PipeChildStd[2]);
+    cp->PipeChildStd[2] = 2;
+    }
+  else if (cp->PipeNativeSTDERR[1] >= 0)
+    {
+    /* Use the given handle for stderr.  */
+    if(!kwsysProcessSetupOutputPipeNative(&cp->PipeChildStd[2],
+                                          cp->PipeNativeSTDERR))
       {
       kwsysProcessCleanup(cp, 1);
-      kwsysProcessCleanupDescriptor(&si.StdErr);
       return;
       }
     }
@@ -859,54 +972,85 @@ void kwsysProcess_Execute(kwsysProcess* cp)
 
   /* Create the pipeline of processes.  */
   {
-  int readEnd = -1;
-  int failed = 0;
+  kwsysProcessCreateInformation si = {-1, -1, -1, {-1, -1}};
+  int nextStdIn = cp->PipeChildStd[0];
   for(i=0; i < cp->NumberOfCommands; ++i)
     {
-    if(!kwsysProcessCreate(cp, i, &si, &readEnd))
-      {
-      failed = 1;
-      }
-
-    /* Set the output pipe of the last process to be non-blocking in
-       case select lies, or for the polling implementation.  */
-    if(i == (cp->NumberOfCommands-1) && !kwsysProcessSetNonBlocking(readEnd))
+    /* Setup the process's pipes.  */
+    si.StdIn = nextStdIn;
+    if (i == cp->NumberOfCommands-1)
       {
-      failed = 1;
+      nextStdIn = -1;
+      si.StdOut = cp->PipeChildStd[1];
       }
-
-    if(failed)
+    else
       {
-      kwsysProcessCleanup(cp, 1);
-
-      /* Release resources that may have been allocated for this
-         process before an error occurred.  */
-      kwsysProcessCleanupDescriptor(&readEnd);
-      if(si.StdIn != 0)
-        {
-        kwsysProcessCleanupDescriptor(&si.StdIn);
-        }
-      if(si.StdOut != 1)
+      /* Create a pipe to sit between the children.  */
+      int p[2] = {-1,-1};
+      if(pipe(p KWSYSPE_VMS_NONBLOCK) < 0)
         {
-        kwsysProcessCleanupDescriptor(&si.StdOut);
+        if (nextStdIn != cp->PipeChildStd[0])
+          {
+          kwsysProcessCleanupDescriptor(&nextStdIn);
+          }
+        kwsysProcessCleanup(cp, 1);
+        return;
         }
-      if(si.StdErr != 2)
+
+      /* Set close-on-exec flag on the pipe's ends.  */
+      if((fcntl(p[0], F_SETFD, FD_CLOEXEC) < 0) ||
+         (fcntl(p[1], F_SETFD, FD_CLOEXEC) < 0))
         {
-        kwsysProcessCleanupDescriptor(&si.StdErr);
+        close(p[0]);
+        close(p[1]);
+        if (nextStdIn != cp->PipeChildStd[0])
+          {
+          kwsysProcessCleanupDescriptor(&nextStdIn);
+          }
+        kwsysProcessCleanup(cp, 1);
+        return;
         }
+      nextStdIn = p[0];
+      si.StdOut = p[1];
+      }
+    si.StdErr = cp->MergeOutput? cp->PipeChildStd[1] : cp->PipeChildStd[2];
+
+    {
+    int res = kwsysProcessCreate(cp, i, &si);
+
+    /* Close our copies of pipes used between children.  */
+    if (si.StdIn != cp->PipeChildStd[0])
+      {
+      kwsysProcessCleanupDescriptor(&si.StdIn);
+      }
+    if (si.StdOut != cp->PipeChildStd[1])
+      {
+      kwsysProcessCleanupDescriptor(&si.StdOut);
+      }
+    if (si.StdErr != cp->PipeChildStd[2] && !cp->MergeOutput)
+      {
+      kwsysProcessCleanupDescriptor(&si.StdErr);
+      }
+
+    if(!res)
+      {
       kwsysProcessCleanupDescriptor(&si.ErrorPipe[0]);
       kwsysProcessCleanupDescriptor(&si.ErrorPipe[1]);
+      if (nextStdIn != cp->PipeChildStd[0])
+        {
+        kwsysProcessCleanupDescriptor(&nextStdIn);
+        }
+      kwsysProcessCleanup(cp, 1);
       return;
       }
     }
-  /* Save a handle to the output pipe for the last process.  */
-  cp->PipeReadEnds[KWSYSPE_PIPE_STDOUT] = readEnd;
+    }
   }
 
-  /* The parent process does not need the output pipe write ends.  */
-  if(si.StdErr != 2)
+  /* The parent process does not need the child's pipe ends.  */
+  for (i=0; i < 3; ++i)
     {
-    kwsysProcessCleanupDescriptor(&si.StdErr);
+    kwsysProcessCleanupDescriptor(&cp->PipeChildStd[i]);
     }
 
   /* Restore the working directory. */
@@ -1357,6 +1501,45 @@ int kwsysProcess_WaitForExit(kwsysProcess* cp, double* userTimeout)
 }
 
 /*--------------------------------------------------------------------------*/
+void kwsysProcess_Interrupt(kwsysProcess* cp)
+{
+  int i;
+  /* Make sure we are executing a process.  */
+  if(!cp || cp->State != kwsysProcess_State_Executing || cp->TimeoutExpired ||
+     cp->Killed)
+    {
+    return;
+    }
+
+  /* Interrupt the children.  */
+  if (cp->CreateProcessGroup)
+    {
+    if(cp->ForkPIDs)
+      {
+      for(i=0; i < cp->NumberOfCommands; ++i)
+        {
+        /* Make sure the PID is still valid. */
+        if(cp->ForkPIDs[i])
+          {
+          /* The user created a process group for this process.  The group ID
+             is the process ID for the original process in the group.  */
+          kill(-cp->ForkPIDs[i], SIGINT);
+          }
+        }
+      }
+    }
+  else
+    {
+    /* No process group was created.  Kill our own process group.
+       NOTE:  While one could argue that we could call kill(cp->ForkPIDs[i],
+       SIGINT) as a way to still interrupt the process even though it's not in
+       a special group, this is not an option on Windows.  Therefore, we kill
+       the current process group for consistency with Windows.  */
+    kill(0, SIGINT);
+    }
+}
+
+/*--------------------------------------------------------------------------*/
 void kwsysProcess_Kill(kwsysProcess* cp)
 {
   int i;
@@ -1406,14 +1589,36 @@ void kwsysProcess_Kill(kwsysProcess* cp)
 }
 
 /*--------------------------------------------------------------------------*/
+/* Call the free() function with a pointer to volatile without causing
+   compiler warnings.  */
+static void kwsysProcessVolatileFree(volatile void* p)
+{
+  /* clang has made it impossible to free memory that points to volatile
+     without first using special pragmas to disable a warning...  */
+#if defined(__clang__)
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wcast-qual"
+#endif
+  free((void*)p); /* The cast will silence most compilers, but not clang.  */
+#if defined(__clang__)
+# pragma clang diagnostic pop
+#endif
+}
+
+/*--------------------------------------------------------------------------*/
 /* Initialize a process control structure for kwsysProcess_Execute.  */
 static int kwsysProcessInitialize(kwsysProcess* cp)
 {
   int i;
+  volatile pid_t* oldForkPIDs;
   for(i=0; i < KWSYSPE_PIPE_COUNT; ++i)
     {
     cp->PipeReadEnds[i] = -1;
     }
+  for(i=0; i < 3; ++i)
+    {
+    cp->PipeChildStd[i] = -1;
+    }
   cp->SignalPipe = -1;
   cp->SelectError = 0;
   cp->StartTime.tv_sec = -1;
@@ -1434,16 +1639,21 @@ static int kwsysProcessInitialize(kwsysProcess* cp)
   cp->ErrorMessage[0] = 0;
   strcpy(cp->ExitExceptionString, "No exception");
 
-  if(cp->ForkPIDs)
+  oldForkPIDs = cp->ForkPIDs;
+  cp->ForkPIDs = (volatile pid_t*)malloc(
+    sizeof(volatile pid_t)*(size_t)(cp->NumberOfCommands));
+  if(oldForkPIDs)
     {
-    free(cp->ForkPIDs);
+    kwsysProcessVolatileFree(oldForkPIDs);
     }
-  cp->ForkPIDs = (pid_t*)malloc(sizeof(pid_t)*(size_t)(cp->NumberOfCommands));
   if(!cp->ForkPIDs)
     {
     return 0;
     }
-  memset(cp->ForkPIDs, 0, sizeof(pid_t)*(size_t)(cp->NumberOfCommands));
+  for(i=0; i < cp->NumberOfCommands; ++i)
+    {
+    cp->ForkPIDs[i] = 0; /* can't use memset due to volatile */
+    }
 
   if(cp->CommandExitCodes)
     {
@@ -1468,7 +1678,7 @@ static int kwsysProcessInitialize(kwsysProcess* cp)
     cp->RealWorkingDirectoryLength = 4096;
 #endif
     cp->RealWorkingDirectory =
-      malloc((size_t)(cp->RealWorkingDirectoryLength));
+      (char*)malloc((size_t)(cp->RealWorkingDirectoryLength));
     if(!cp->RealWorkingDirectory)
       {
       return 0;
@@ -1534,7 +1744,7 @@ static void kwsysProcessCleanup(kwsysProcess* cp, int error)
   /* Free memory.  */
   if(cp->ForkPIDs)
     {
-    free(cp->ForkPIDs);
+    kwsysProcessVolatileFree(cp->ForkPIDs);
     cp->ForkPIDs = 0;
     }
   if(cp->RealWorkingDirectory)
@@ -1548,13 +1758,17 @@ static void kwsysProcessCleanup(kwsysProcess* cp, int error)
     {
     kwsysProcessCleanupDescriptor(&cp->PipeReadEnds[i]);
     }
+  for(i=0; i < 3; ++i)
+    {
+    kwsysProcessCleanupDescriptor(&cp->PipeChildStd[i]);
+    }
 }
 
 /*--------------------------------------------------------------------------*/
 /* Close the given file descriptor if it is open.  Reset its value to -1.  */
 static void kwsysProcessCleanupDescriptor(int* pfd)
 {
-  if(pfd && *pfd >= 0)
+  if(pfd && *pfd > 2)
     {
     /* Keep trying to close until it is not interrupted by a
      * signal.  */
@@ -1615,109 +1829,51 @@ int decc$set_child_standard_streams(int fd1, int fd2, int fd3);
 
 /*--------------------------------------------------------------------------*/
 static int kwsysProcessCreate(kwsysProcess* cp, int prIndex,
-                              kwsysProcessCreateInformation* si, int* readEnd)
+                              kwsysProcessCreateInformation* si)
 {
-  /* Setup the process's stdin.  */
-  if(prIndex > 0)
-    {
-    si->StdIn = *readEnd;
-    *readEnd = 0;
-    }
-  else if(cp->PipeFileSTDIN)
-    {
-    /* Open a file for the child's stdin to read.  */
-    si->StdIn = open(cp->PipeFileSTDIN, O_RDONLY);
-    if(si->StdIn < 0)
-      {
-      return 0;
-      }
-
-    /* Set close-on-exec flag on the pipe's end.  */
-    if(fcntl(si->StdIn, F_SETFD, FD_CLOEXEC) < 0)
-      {
-      return 0;
-      }
-    }
-  else if(cp->PipeSharedSTDIN)
-    {
-    si->StdIn = 0;
-    }
-  else if(cp->PipeNativeSTDIN[0] >= 0)
-    {
-    si->StdIn = cp->PipeNativeSTDIN[0];
+  sigset_t mask, old_mask;
+  int pgidPipe[2];
+  char tmp;
+  ssize_t readRes;
 
-    /* Set close-on-exec flag on the pipe's ends.  The read end will
-       be dup2-ed into the stdin descriptor after the fork but before
-       the exec.  */
-    if((fcntl(cp->PipeNativeSTDIN[0], F_SETFD, FD_CLOEXEC) < 0) ||
-       (fcntl(cp->PipeNativeSTDIN[1], F_SETFD, FD_CLOEXEC) < 0))
-      {
-      return 0;
-      }
-    }
-  else
-    {
-    si->StdIn = -1;
-    }
-
-  /* Setup the process's stdout.  */
-  {
-  /* Create the pipe.  */
-  int p[2];
-  if(pipe(p KWSYSPE_VMS_NONBLOCK) < 0)
+  /* Create the error reporting pipe.  */
+  if(pipe(si->ErrorPipe) < 0)
     {
     return 0;
     }
-  *readEnd = p[0];
-  si->StdOut = p[1];
 
-  /* Set close-on-exec flag on the pipe's ends.  */
-  if((fcntl(p[0], F_SETFD, FD_CLOEXEC) < 0) ||
-     (fcntl(p[1], F_SETFD, FD_CLOEXEC) < 0))
+  /* Create a pipe for detecting that the child process has created a process
+     group and session.  */
+  if(pipe(pgidPipe) < 0)
     {
+    kwsysProcessCleanupDescriptor(&si->ErrorPipe[0]);
+    kwsysProcessCleanupDescriptor(&si->ErrorPipe[1]);
     return 0;
     }
-  }
 
-  /* Replace the stdout pipe with a file if requested.  In this case
-     the select call will report that stdout is closed immediately.  */
-  if(prIndex == cp->NumberOfCommands-1 && cp->PipeFileSTDOUT)
-    {
-    if(!kwsysProcessSetupOutputPipeFile(&si->StdOut, cp->PipeFileSTDOUT))
-      {
-      return 0;
-      }
-    }
-
-  /* Replace the stdout pipe with the parent's if requested.  In this
-     case the select call will report that stderr is closed
-     immediately.  */
-  if(prIndex == cp->NumberOfCommands-1 && cp->PipeSharedSTDOUT)
-    {
-    kwsysProcessCleanupDescriptor(&si->StdOut);
-    si->StdOut = 1;
-    }
-
-  /* Replace the stdout pipe with the native pipe provided if any.  In
-     this case the select call will report that stdout is closed
-     immediately.  */
-  if(prIndex == cp->NumberOfCommands-1 && cp->PipeNativeSTDOUT[1] >= 0)
-    {
-    if(!kwsysProcessSetupOutputPipeNative(&si->StdOut, cp->PipeNativeSTDOUT))
-      {
-      return 0;
-      }
-    }
-
-  /* Create the error reporting pipe.  */
-  if(pipe(si->ErrorPipe) < 0)
+  /* Set close-on-exec flag on the pipe's write end.  */
+  if(fcntl(si->ErrorPipe[1], F_SETFD, FD_CLOEXEC) < 0 ||
+     fcntl(pgidPipe[1], F_SETFD, FD_CLOEXEC) < 0)
     {
+    kwsysProcessCleanupDescriptor(&si->ErrorPipe[0]);
+    kwsysProcessCleanupDescriptor(&si->ErrorPipe[1]);
+    kwsysProcessCleanupDescriptor(&pgidPipe[0]);
+    kwsysProcessCleanupDescriptor(&pgidPipe[1]);
     return 0;
     }
 
-  /* Set close-on-exec flag on the error pipe's write end.  */
-  if(fcntl(si->ErrorPipe[1], F_SETFD, FD_CLOEXEC) < 0)
+  /* Block SIGINT / SIGTERM while we start.  The purpose is so that our signal
+     handler doesn't get called from the child process after the fork and
+     before the exec, and subsequently start kill()'ing PIDs from ForkPIDs. */
+  sigemptyset(&mask);
+  sigaddset(&mask, SIGINT);
+  sigaddset(&mask, SIGTERM);
+  if(sigprocmask(SIG_BLOCK, &mask, &old_mask) < 0)
     {
+    kwsysProcessCleanupDescriptor(&si->ErrorPipe[0]);
+    kwsysProcessCleanupDescriptor(&si->ErrorPipe[1]);
+    kwsysProcessCleanupDescriptor(&pgidPipe[0]);
+    kwsysProcessCleanupDescriptor(&pgidPipe[1]);
     return 0;
     }
 
@@ -1725,13 +1881,19 @@ static int kwsysProcessCreate(kwsysProcess* cp, int prIndex,
 #if defined(__VMS)
   /* VMS needs vfork and execvp to be in the same function because
      they use setjmp/longjmp to run the child startup code in the
-     parent!  TODO: OptionDetach.  */
+     parent!  TODO: OptionDetach.  Also
+     TODO:  CreateProcessGroup.  */
   cp->ForkPIDs[prIndex] = vfork();
 #else
   cp->ForkPIDs[prIndex] = kwsysProcessFork(cp, si);
 #endif
   if(cp->ForkPIDs[prIndex] < 0)
     {
+    sigprocmask(SIG_SETMASK, &old_mask, 0);
+    kwsysProcessCleanupDescriptor(&si->ErrorPipe[0]);
+    kwsysProcessCleanupDescriptor(&si->ErrorPipe[1]);
+    kwsysProcessCleanupDescriptor(&pgidPipe[0]);
+    kwsysProcessCleanupDescriptor(&pgidPipe[1]);
     return 0;
     }
 
@@ -1741,8 +1903,10 @@ static int kwsysProcessCreate(kwsysProcess* cp, int prIndex,
     /* Specify standard pipes for child process.  */
     decc$set_child_standard_streams(si->StdIn, si->StdOut, si->StdErr);
 #else
-    /* Close the read end of the error reporting pipe.  */
+    /* Close the read end of the error reporting / process group
+       setup pipe.  */
     close(si->ErrorPipe[0]);
+    close(pgidPipe[0]);
 
     /* Setup the stdin, stdout, and stderr pipes.  */
     if(si->StdIn > 0)
@@ -1770,11 +1934,25 @@ static int kwsysProcessCreate(kwsysProcess* cp, int prIndex,
 
     /* Restore all default signal handlers. */
     kwsysProcessRestoreDefaultSignalHandlers();
+
+    /* Now that we have restored default signal handling and created the
+       process group, restore mask.  */
+    sigprocmask(SIG_SETMASK, &old_mask, 0);
+
+    /* Create new process group.  We use setsid instead of setpgid to avoid
+       the child getting hung up on signals like SIGTTOU.  (In the real world,
+       this has been observed where "git svn" ends up calling the "resize"
+       program which opens /dev/tty.  */
+    if(cp->CreateProcessGroup && setsid() < 0)
+      {
+      kwsysProcessChildErrorExit(si->ErrorPipe[1]);
+      }
 #endif
 
     /* Execute the real process.  If successful, this does not return.  */
     execvp(cp->Commands[prIndex][0], cp->Commands[prIndex]);
     /* TODO: What does VMS do if the child fails to start?  */
+    /* TODO: On VMS, how do we put the process in a new group?  */
 
     /* Failure.  Report error to parent and terminate.  */
     kwsysProcessChildErrorExit(si->ErrorPipe[1]);
@@ -1785,12 +1963,34 @@ static int kwsysProcessCreate(kwsysProcess* cp, int prIndex,
   decc$set_child_standard_streams(0, 1, 2);
 #endif
 
+  /* We are done with the error reporting pipe and process group setup pipe
+     write end.  */
+  kwsysProcessCleanupDescriptor(&si->ErrorPipe[1]);
+  kwsysProcessCleanupDescriptor(&pgidPipe[1]);
+
+  /* Make sure the child is in the process group before we proceed.  This
+     avoids race conditions with calls to the kill function that we make for
+     signalling process groups.  */
+  while((readRes = read(pgidPipe[0], &tmp, 1)) > 0);
+  if(readRes < 0)
+    {
+    sigprocmask(SIG_SETMASK, &old_mask, 0);
+    kwsysProcessCleanupDescriptor(&si->ErrorPipe[0]);
+    kwsysProcessCleanupDescriptor(&pgidPipe[0]);
+    return 0;
+    }
+  kwsysProcessCleanupDescriptor(&pgidPipe[0]);
+
+  /* Unmask signals.  */
+  if(sigprocmask(SIG_SETMASK, &old_mask, 0) < 0)
+    {
+    kwsysProcessCleanupDescriptor(&si->ErrorPipe[0]);
+    return 0;
+    }
+
   /* A child has been created.  */
   ++cp->CommandsLeft;
 
-  /* We are done with the error reporting pipe write end.  */
-  kwsysProcessCleanupDescriptor(&si->ErrorPipe[1]);
-
   /* Block until the child's exec call succeeds and closes the error
      pipe or writes data to the pipe to report an error.  */
   {
@@ -1819,19 +2019,6 @@ static int kwsysProcessCreate(kwsysProcess* cp, int prIndex,
     }
   }
 
-  /* Successfully created this child process.  */
-  if(prIndex > 0 || si->StdIn > 0)
-    {
-    /* The parent process does not need the input pipe read end.  */
-    kwsysProcessCleanupDescriptor(&si->StdIn);
-    }
-
-  /* The parent process does not need the output pipe write ends.  */
-  if(si->StdOut != 1)
-    {
-    kwsysProcessCleanupDescriptor(&si->StdOut);
-    }
-
   return 1;
 }
 
@@ -1841,6 +2028,17 @@ static void kwsysProcessDestroy(kwsysProcess* cp)
   /* A child process has terminated.  Reap it if it is one handled by
      this object.  */
   int i;
+  /* Temporarily disable signals that access ForkPIDs.  We don't want them to
+     read a reaped PID, and writes to ForkPIDs are not atomic.  */
+  sigset_t mask, old_mask;
+  sigemptyset(&mask);
+  sigaddset(&mask, SIGINT);
+  sigaddset(&mask, SIGTERM);
+  if(sigprocmask(SIG_BLOCK, &mask, &old_mask) < 0)
+    {
+    return;
+    }
+
   for(i=0; i < cp->NumberOfCommands; ++i)
     {
     if(cp->ForkPIDs[i])
@@ -1874,6 +2072,9 @@ static void kwsysProcessDestroy(kwsysProcess* cp)
         }
       }
     }
+
+  /* Re-enable signals.  */
+  sigprocmask(SIG_SETMASK, &old_mask, 0);
 }
 
 /*--------------------------------------------------------------------------*/
@@ -1902,7 +2103,7 @@ static int kwsysProcessSetupOutputPipeFile(int* p, const char* name)
 
   /* Assign the replacement descriptor.  */
   *p = fout;
-  return 1;  
+  return 1;
 }
 
 /*--------------------------------------------------------------------------*/
@@ -2546,19 +2747,23 @@ typedef struct kwsysProcessInstances_s
 } kwsysProcessInstances;
 static kwsysProcessInstances kwsysProcesses;
 
-/* The old SIGCHLD handler.  */
+/* The old SIGCHLD / SIGINT / SIGTERM handlers.  */
 static struct sigaction kwsysProcessesOldSigChldAction;
+static struct sigaction kwsysProcessesOldSigIntAction;
+static struct sigaction kwsysProcessesOldSigTermAction;
 
 /*--------------------------------------------------------------------------*/
 static void kwsysProcessesUpdate(kwsysProcessInstances* newProcesses)
 {
-  /* Block SIGCHLD while we update the set of pipes to check.
+  /* Block signals while we update the set of pipes to check.
      TODO: sigprocmask is undefined for threaded apps.  See
      pthread_sigmask.  */
   sigset_t newset;
   sigset_t oldset;
   sigemptyset(&newset);
   sigaddset(&newset, SIGCHLD);
+  sigaddset(&newset, SIGINT);
+  sigaddset(&newset, SIGTERM);
   sigprocmask(SIG_BLOCK, &newset, &oldset);
 
   /* Store the new set in that seen by the signal handler.  */
@@ -2650,21 +2855,36 @@ static int kwsysProcessesAdd(kwsysProcess* cp)
     {
     /* Install our handler for SIGCHLD.  Repeat call until it is not
        interrupted.  */
-    struct sigaction newSigChldAction;
-    memset(&newSigChldAction, 0, sizeof(struct sigaction));
+    struct sigaction newSigAction;
+    memset(&newSigAction, 0, sizeof(struct sigaction));
 #if KWSYSPE_USE_SIGINFO
-    newSigChldAction.sa_sigaction = kwsysProcessesSignalHandler;
-    newSigChldAction.sa_flags = SA_NOCLDSTOP | SA_SIGINFO;
+    newSigAction.sa_sigaction = kwsysProcessesSignalHandler;
+    newSigAction.sa_flags = SA_NOCLDSTOP | SA_SIGINFO;
 # ifdef SA_RESTART
-    newSigChldAction.sa_flags |= SA_RESTART;
+    newSigAction.sa_flags |= SA_RESTART;
 # endif
 #else
-    newSigChldAction.sa_handler = kwsysProcessesSignalHandler;
-    newSigChldAction.sa_flags = SA_NOCLDSTOP;
+    newSigAction.sa_handler = kwsysProcessesSignalHandler;
+    newSigAction.sa_flags = SA_NOCLDSTOP;
 #endif
-    while((sigaction(SIGCHLD, &newSigChldAction,
+    sigemptyset(&newSigAction.sa_mask);
+    while((sigaction(SIGCHLD, &newSigAction,
                      &kwsysProcessesOldSigChldAction) < 0) &&
           (errno == EINTR));
+
+    /* Install our handler for SIGINT / SIGTERM.  Repeat call until
+       it is not interrupted.  */
+    sigemptyset(&newSigAction.sa_mask);
+    sigaddset(&newSigAction.sa_mask, SIGTERM);
+    while((sigaction(SIGINT, &newSigAction,
+                     &kwsysProcessesOldSigIntAction) < 0) &&
+          (errno == EINTR));
+
+    sigemptyset(&newSigAction.sa_mask);
+    sigaddset(&newSigAction.sa_mask, SIGINT);
+    while((sigaction(SIGTERM, &newSigAction,
+                     &kwsysProcessesOldSigIntAction) < 0) &&
+          (errno == EINTR));
     }
   }
 
@@ -2698,10 +2918,14 @@ static void kwsysProcessesRemove(kwsysProcess* cp)
     /* If this was the last process, disable the signal handler.  */
     if(newProcesses.Count == 0)
       {
-      /* Restore the SIGCHLD handler.  Repeat call until it is not
+      /* Restore the signal handlers.  Repeat call until it is not
          interrupted.  */
       while((sigaction(SIGCHLD, &kwsysProcessesOldSigChldAction, 0) < 0) &&
             (errno == EINTR));
+      while((sigaction(SIGINT, &kwsysProcessesOldSigIntAction, 0) < 0) &&
+            (errno == EINTR));
+      while((sigaction(SIGTERM, &kwsysProcessesOldSigTermAction, 0) < 0) &&
+            (errno == EINTR));
 
       /* Free the table of process pointers since it is now empty.
          This is safe because the signal handler has been removed.  */
@@ -2727,39 +2951,108 @@ static void kwsysProcessesSignalHandler(int signum
 #endif
   )
 {
-  (void)signum;
+  int i, j, procStatus, old_errno = errno;
 #if KWSYSPE_USE_SIGINFO
   (void)info;
   (void)ucontext;
 #endif
 
   /* Signal all process objects that a child has terminated.  */
-  {
-  int i;
-  for(i=0; i < kwsysProcesses.Count; ++i)
+  switch(signum)
     {
-    /* Set the pipe in a signalled state.  */
-    char buf = 1;
-    kwsysProcess* cp = kwsysProcesses.Processes[i];
-    kwsysProcess_ssize_t status=
-      read(cp->PipeReadEnds[KWSYSPE_PIPE_SIGNAL], &buf, 1);
-    (void)status;
-    status=write(cp->SignalPipe, &buf, 1);
-    (void)status;
+    case SIGCHLD:
+      for(i=0; i < kwsysProcesses.Count; ++i)
+        {
+        /* Set the pipe in a signalled state.  */
+        char buf = 1;
+        kwsysProcess* cp = kwsysProcesses.Processes[i];
+        kwsysProcess_ssize_t pipeStatus=
+          read(cp->PipeReadEnds[KWSYSPE_PIPE_SIGNAL], &buf, 1);
+        (void)pipeStatus;
+        pipeStatus=write(cp->SignalPipe, &buf, 1);
+        (void)pipeStatus;
+        }
+      break;
+    case SIGINT:
+    case SIGTERM:
+      /* Signal child processes that are running in new process groups.  */
+      for(i=0; i < kwsysProcesses.Count; ++i)
+        {
+        kwsysProcess* cp = kwsysProcesses.Processes[i];
+        /* Check Killed to avoid data race condition when killing.
+           Check State to avoid data race condition in kwsysProcessCleanup
+           when there is an error (it leaves a reaped PID).  */
+        if(cp->CreateProcessGroup && !cp->Killed &&
+           cp->State != kwsysProcess_State_Error && cp->ForkPIDs)
+          {
+          for(j=0; j < cp->NumberOfCommands; ++j)
+            {
+            /* Make sure the PID is still valid. */
+            if(cp->ForkPIDs[j])
+              {
+              /* The user created a process group for this process.  The group ID
+                 is the process ID for the original process in the group.  */
+              kill(-cp->ForkPIDs[j], SIGINT);
+              }
+            }
+          }
+        }
+
+      /* Wait for all processes to terminate.  */
+      while(wait(&procStatus) >= 0 || errno != ECHILD)
+        {
+        }
+
+      /* Terminate the process, which is now in an inconsistent state
+         because we reaped all the PIDs that it may have been reaping
+         or may have reaped in the future.  Reraise the signal so that
+         the proper exit code is returned.  */
+      {
+      /* Install default signal handler.  */
+      struct sigaction defSigAction;
+      sigset_t unblockSet;
+      memset(&defSigAction, 0, sizeof(defSigAction));
+      defSigAction.sa_handler = SIG_DFL;
+      sigemptyset(&defSigAction.sa_mask);
+      while((sigaction(signum, &defSigAction, 0) < 0) &&
+            (errno == EINTR));
+      /* Unmask the signal.  */
+      sigemptyset(&unblockSet);
+      sigaddset(&unblockSet, signum);
+      sigprocmask(SIG_UNBLOCK, &unblockSet, 0);
+      /* Raise the signal again.  */
+      raise(signum);
+      /* We shouldn't get here... but if we do... */
+      _exit(1);
+      }
+      /* break omitted to silence unreachable code clang compiler warning.  */
     }
-  }
 
 #if !KWSYSPE_USE_SIGINFO
-  /* Re-Install our handler for SIGCHLD.  Repeat call until it is not
-     interrupted.  */
+  /* Re-Install our handler.  Repeat call until it is not interrupted.  */
   {
-  struct sigaction newSigChldAction;
-  memset(&newSigChldAction, 0, sizeof(struct sigaction));
+  struct sigaction newSigAction;
+  struct sigaction &oldSigAction;
+  memset(&newSigAction, 0, sizeof(struct sigaction));
   newSigChldAction.sa_handler = kwsysProcessesSignalHandler;
   newSigChldAction.sa_flags = SA_NOCLDSTOP;
-  while((sigaction(SIGCHLD, &newSigChldAction,
-                   &kwsysProcessesOldSigChldAction) < 0) &&
+  sigemptyset(&newSigAction.sa_mask);
+  switch(signum)
+    {
+    case SIGCHLD: oldSigAction = &kwsysProcessesOldSigChldAction; break;
+    case SIGINT:
+      sigaddset(&newSigAction.sa_mask, SIGTERM);
+      oldSigAction = &kwsysProcessesOldSigIntAction; break;
+    case SIGTERM:
+      sigaddset(&newSigAction.sa_mask, SIGINT);
+      oldSigAction = &kwsysProcessesOldSigTermAction; break;
+    default: return 0;
+    }
+  while((sigaction(signum, &newSigAction,
+                   oldSigAction) < 0) &&
         (errno == EINTR));
   }
 #endif
+
+  errno = old_errno;
 }
diff --git a/src/kwsys/ProcessWin32.c b/src/kwsys/ProcessWin32.c
index ef71f26..1f8749f 100644
--- a/src/kwsys/ProcessWin32.c
+++ b/src/kwsys/ProcessWin32.c
@@ -11,14 +11,12 @@
 ============================================================================*/
 #include "kwsysPrivate.h"
 #include KWSYS_HEADER(Process.h)
-#include KWSYS_HEADER(System.h)
 #include KWSYS_HEADER(Encoding.h)
 
 /* Work-around CMake dependency scanning limitation.  This must
    duplicate the above list of headers.  */
 #if 0
 # include "Process.h.in"
-# include "System.h.in"
 # include "Encoding_c.h.in"
 #endif
 
@@ -94,6 +92,11 @@ typedef struct kwsysProcessCreateInformation_s
 {
   /* Windows child startup control data.  */
   STARTUPINFOW StartupInfo;
+
+  /* Original handles before making inherited duplicates.  */
+  HANDLE hStdInput;
+  HANDLE hStdOutput;
+  HANDLE hStdError;
 } kwsysProcessCreateInformation;
 
 
@@ -106,23 +109,16 @@ static DWORD WINAPI kwsysProcessPipeThreadWake(LPVOID ptd);
 static void kwsysProcessPipeThreadWakePipe(kwsysProcess* cp,
                                            kwsysProcessPipeData* td);
 static int kwsysProcessInitialize(kwsysProcess* cp);
-static int kwsysProcessCreate(kwsysProcess* cp, int index,
-                              kwsysProcessCreateInformation* si,
-                              PHANDLE readEnd);
+static DWORD kwsysProcessCreate(kwsysProcess* cp, int index,
+                                kwsysProcessCreateInformation* si);
 static void kwsysProcessDestroy(kwsysProcess* cp, int event);
-static int kwsysProcessSetupOutputPipeFile(PHANDLE handle, const char* name);
-static int kwsysProcessSetupSharedPipe(DWORD nStdHandle, PHANDLE handle);
-static int kwsysProcessSetupPipeNative(PHANDLE handle, HANDLE p[2],
-                                       int isWrite);
+static DWORD kwsysProcessSetupOutputPipeFile(PHANDLE handle,
+                                             const char* name);
+static void kwsysProcessSetupSharedPipe(DWORD nStdHandle, PHANDLE handle);
+static void kwsysProcessSetupPipeNative(HANDLE native, PHANDLE handle);
 static void kwsysProcessCleanupHandle(PHANDLE h);
-static void kwsysProcessCleanupHandleSafe(PHANDLE h, DWORD nStdHandle);
-static void kwsysProcessCleanup(kwsysProcess* cp, int error);
+static void kwsysProcessCleanup(kwsysProcess* cp, DWORD error);
 static void kwsysProcessCleanErrorMessage(kwsysProcess* cp);
-static int kwsysProcessComputeCommandLength(kwsysProcess* cp,
-                                            char const* const* command);
-static void kwsysProcessComputeCommandLine(kwsysProcess* cp,
-                                           char const* const* command,
-                                           char* cmd);
 static int kwsysProcessGetTimeoutTime(kwsysProcess* cp, double* userTimeout,
                                       kwsysProcessTime* timeoutTime);
 static int kwsysProcessGetTimeoutLeft(kwsysProcessTime* timeoutTime,
@@ -138,6 +134,13 @@ static kwsysProcessTime kwsysProcessTimeSubtract(kwsysProcessTime in1, kwsysProc
 static void kwsysProcessSetExitException(kwsysProcess* cp, int code);
 static void kwsysProcessKillTree(int pid);
 static void kwsysProcessDisablePipeThreads(kwsysProcess* cp);
+static int kwsysProcessesInitialize(void);
+static int kwsysTryEnterCreateProcessSection(void);
+static void kwsysLeaveCreateProcessSection(void);
+static int kwsysProcessesAdd(HANDLE hProcess, DWORD dwProcessId,
+                             int newProcessGroup);
+static void kwsysProcessesRemove(HANDLE hProcess);
+static BOOL WINAPI kwsysCtrlHandler(DWORD dwCtrlType);
 
 /*--------------------------------------------------------------------------*/
 /* A structure containing synchronization data for each thread.  */
@@ -224,6 +227,12 @@ struct kwsysProcess_s
   /* Whether to treat command lines as verbatim.  */
   int Verbatim;
 
+  /* Whether to merge stdout/stderr of the child.  */
+  int MergeOutput;
+
+  /* Whether to create the process in a new process group.  */
+  int CreateProcessGroup;
+
   /* Mutex to protect the shared index used by threads to report data.  */
   HANDLE SharedIndexMutex;
 
@@ -306,6 +315,10 @@ struct kwsysProcess_s
   /* Real working directory of our own process.  */
   DWORD RealWorkingDirectoryLength;
   wchar_t* RealWorkingDirectory;
+
+  /* Own handles for the child's ends of the pipes in the parent process.
+     Used temporarily during process creation.  */
+  HANDLE PipeChildStd[3];
 };
 
 /*--------------------------------------------------------------------------*/
@@ -319,6 +332,16 @@ kwsysProcess* kwsysProcess_New(void)
   /* Windows version number data.  */
   OSVERSIONINFO osv;
 
+  /* Initialize list of processes before we get any farther.  It's especially
+     important that the console Ctrl handler be added BEFORE starting the
+     first process.  This prevents the risk of an orphaned process being
+     started by the main thread while the default Ctrl handler is in
+     progress.  */
+  if(!kwsysProcessesInitialize())
+    {
+    return 0;
+    }
+
   /* Allocate a process control structure.  */
   cp = (kwsysProcess*)malloc(sizeof(kwsysProcess));
   if(!cp)
@@ -340,7 +363,11 @@ kwsysProcess* kwsysProcess_New(void)
   osv.dwOSVersionInfoSize = sizeof(osv);
 #ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
 # pragma warning (push)
-# pragma warning (disable:4996)
+# ifdef __INTEL_COMPILER
+#  pragma warning (disable:1478)
+# else
+#  pragma warning (disable:4996)
+# endif
 #endif
   GetVersionEx(&osv);
 #ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
@@ -442,6 +469,10 @@ kwsysProcess* kwsysProcess_New(void)
       return 0;
       }
     }
+  for(i=0; i < 3; ++i)
+    {
+    cp->PipeChildStd[i] = INVALID_HANDLE_VALUE;
+    }
 
   return cp;
 }
@@ -585,37 +616,69 @@ int kwsysProcess_AddCommand(kwsysProcess* cp, char const* const* command)
     }
   }
 
-  /* We need to construct a single string representing the command
-     and its arguments.  We will surround each argument containing
-     spaces with double-quotes.  Inside a double-quoted argument, we
-     need to escape double-quotes and all backslashes before them.
-     We also need to escape backslashes at the end of an argument
-     because they come before the closing double-quote for the
-     argument.  */
-  {
-  /* First determine the length of the final string.  */
-  int length = kwsysProcessComputeCommandLength(cp, command);
-
-  /* Allocate enough space for the command.  We do not need an extra
-     byte for the terminating null because we allocated a space for
-     the first argument that we will not use.  */
-  char* new_cmd = malloc(length);
-  if(!new_cmd)
+  if (cp->Verbatim)
     {
-    /* Out of memory.  */
+    /* Copy the verbatim command line into the buffer.  */
+    newCommands[cp->NumberOfCommands] = kwsysEncoding_DupToWide(*command);
+    }
+  else
+    {
+    /* Encode the arguments so CommandLineToArgvW can decode
+       them from the command line string in the child.  */
+    char buffer[32768]; /* CreateProcess max command-line length.  */
+    char* end = buffer + sizeof(buffer);
+    char* out = buffer;
+    char const* const* a;
+    for (a = command; *a; ++a)
+      {
+      int quote = !**a; /* Quote the empty string.  */
+      int slashes = 0;
+      char const* c;
+      if (a != command && out != end) { *out++ = ' '; }
+      for (c = *a; !quote && *c; ++c)
+        { quote = (*c == ' ' || *c == '\t'); }
+      if (quote && out != end) { *out++ = '"'; }
+      for (c = *a; *c; ++c)
+        {
+        if (*c == '\\')
+          {
+          ++slashes;
+          }
+        else
+          {
+          if (*c == '"')
+            {
+            // Add n+1 backslashes to total 2n+1 before internal '"'.
+            while(slashes-- >= 0 && out != end) { *out++ = '\\'; }
+            }
+          slashes = 0;
+          }
+        if (out != end) { *out++ = *c; }
+        }
+      if (quote)
+        {
+        // Add n backslashes to total 2n before ending '"'.
+        while (slashes-- > 0 && out != end) { *out++ = '\\'; }
+        if (out != end) { *out++ = '"'; }
+        }
+      }
+    if(out != end)
+      {
+      *out = '\0';
+      newCommands[cp->NumberOfCommands] = kwsysEncoding_DupToWide(buffer);
+      }
+    else
+      {
+      newCommands[cp->NumberOfCommands] = 0;
+      }
+    }
+  if (!newCommands[cp->NumberOfCommands])
+    {
+    /* Out of memory or command line too long.  */
     free(newCommands);
     return 0;
     }
 
-  /* Construct the command line in the allocated buffer.  */
-  kwsysProcessComputeCommandLine(cp, command,
-                                 new_cmd);
-
-  newCommands[cp->NumberOfCommands] = kwsysEncoding_DupToWide(new_cmd);
-  free(new_cmd);
-  }
-
-
   /* Save the new array of commands.  */
   free(cp->Commands);
   cp->Commands = newCommands;
@@ -792,7 +855,10 @@ int kwsysProcess_GetOption(kwsysProcess* cp, int optionId)
     {
     case kwsysProcess_Option_Detach: return cp->OptionDetach;
     case kwsysProcess_Option_HideWindow: return cp->HideWindow;
+    case kwsysProcess_Option_MergeOutput: return cp->MergeOutput;
     case kwsysProcess_Option_Verbatim: return cp->Verbatim;
+    case kwsysProcess_Option_CreateProcessGroup:
+      return cp->CreateProcessGroup;
     default: return 0;
     }
 }
@@ -809,7 +875,10 @@ void kwsysProcess_SetOption(kwsysProcess* cp, int optionId, int value)
     {
     case kwsysProcess_Option_Detach: cp->OptionDetach = value; break;
     case kwsysProcess_Option_HideWindow: cp->HideWindow = value; break;
+    case kwsysProcess_Option_MergeOutput: cp->MergeOutput = value; break;
     case kwsysProcess_Option_Verbatim: cp->Verbatim = value; break;
+    case kwsysProcess_Option_CreateProcessGroup:
+      cp->CreateProcessGroup = value; break;
     default: break;
     }
 }
@@ -871,9 +940,6 @@ void kwsysProcess_Execute(kwsysProcess* cp)
 {
   int i;
 
-  /* Child startup control data.  */
-  kwsysProcessCreateInformation si;
-
   /* Do not execute a second time.  */
   if(!cp || cp->State == kwsysProcess_State_Executing)
     {
@@ -904,123 +970,222 @@ void kwsysProcess_Execute(kwsysProcess* cp)
     if(!GetCurrentDirectoryW(cp->RealWorkingDirectoryLength,
                             cp->RealWorkingDirectory))
       {
-      kwsysProcessCleanup(cp, 1);
+      kwsysProcessCleanup(cp, GetLastError());
       return;
       }
     SetCurrentDirectoryW(cp->WorkingDirectory);
     }
 
-  /* Initialize startup info data.  */
-  ZeroMemory(&si, sizeof(si));
-  si.StartupInfo.cb = sizeof(si.StartupInfo);
-
-  /* Decide whether a child window should be shown.  */
-  si.StartupInfo.dwFlags |= STARTF_USESHOWWINDOW;
-  si.StartupInfo.wShowWindow =
-    (unsigned short)(cp->HideWindow?SW_HIDE:SW_SHOWDEFAULT);
-
-  /* Connect the child's output pipes to the threads.  */
-  si.StartupInfo.dwFlags |= STARTF_USESTDHANDLES;
 
-  /* Create stderr pipe to be shared by all processes in the pipeline.
-     Neither end is directly inherited.  */
-  if(!CreatePipe(&cp->Pipe[KWSYSPE_PIPE_STDERR].Read,
-                 &cp->Pipe[KWSYSPE_PIPE_STDERR].Write, 0, 0))
+  /* Setup the stdin pipe for the first process.  */
+  if(cp->PipeFileSTDIN)
     {
-    kwsysProcessCleanup(cp, 1);
-    return;
+    /* Create a handle to read a file for stdin.  */
+    wchar_t* wstdin = kwsysEncoding_DupToWide(cp->PipeFileSTDIN);
+    DWORD error;
+    cp->PipeChildStd[0] =
+      CreateFileW(wstdin, GENERIC_READ|GENERIC_WRITE,
+                  FILE_SHARE_READ|FILE_SHARE_WRITE,
+                  0, OPEN_EXISTING, 0, 0);
+    error = GetLastError(); /* Check now in case free changes this.  */
+    free(wstdin);
+    if(cp->PipeChildStd[0] == INVALID_HANDLE_VALUE)
+      {
+      kwsysProcessCleanup(cp, error);
+      return;
+      }
+    }
+  else if(cp->PipeSharedSTDIN)
+    {
+    /* Share this process's stdin with the child.  */
+    kwsysProcessSetupSharedPipe(STD_INPUT_HANDLE, &cp->PipeChildStd[0]);
+    }
+  else if(cp->PipeNativeSTDIN[0])
+    {
+    /* Use the provided native pipe.  */
+    kwsysProcessSetupPipeNative(cp->PipeNativeSTDIN[0], &cp->PipeChildStd[0]);
+    }
+  else
+    {
+    /* Explicitly give the child no stdin.  */
+    cp->PipeChildStd[0] = INVALID_HANDLE_VALUE;
     }
 
-  /* Create an inherited duplicate of the write end, but do not
-     close the non-inherited version.  We need to keep it open
-     to use in waking up the pipe threads.  */
-  if(!DuplicateHandle(GetCurrentProcess(), cp->Pipe[KWSYSPE_PIPE_STDERR].Write,
-                      GetCurrentProcess(), &si.StartupInfo.hStdError,
-                      0, TRUE, DUPLICATE_SAME_ACCESS))
+  /* Create the output pipe for the last process.
+     We always create this so the pipe thread can run even if we
+     do not end up giving the write end to the child below.  */
+  if(!CreatePipe(&cp->Pipe[KWSYSPE_PIPE_STDOUT].Read,
+                 &cp->Pipe[KWSYSPE_PIPE_STDOUT].Write, 0, 0))
     {
-    kwsysProcessCleanup(cp, 1);
-    kwsysProcessCleanupHandle(&si.StartupInfo.hStdError);
+    kwsysProcessCleanup(cp, GetLastError());
     return;
     }
 
-  /* Replace the stderr pipe with a file if requested.  In this case
-     the pipe thread will still run but never report data.  */
-  if(cp->PipeFileSTDERR)
+  if(cp->PipeFileSTDOUT)
     {
-    if(!kwsysProcessSetupOutputPipeFile(&si.StartupInfo.hStdError,
-                                        cp->PipeFileSTDERR))
+    /* Use a file for stdout.  */
+    DWORD error = kwsysProcessSetupOutputPipeFile(&cp->PipeChildStd[1],
+                                                  cp->PipeFileSTDOUT);
+    if(error)
       {
-      kwsysProcessCleanup(cp, 1);
-      kwsysProcessCleanupHandle(&si.StartupInfo.hStdError);
+      kwsysProcessCleanup(cp, error);
       return;
       }
     }
-
-  /* Replace the stderr pipe with the parent process's if requested.
-     In this case the pipe thread will still run but never report
-     data.  */
-  if(cp->PipeSharedSTDERR)
+  else if(cp->PipeSharedSTDOUT)
+    {
+    /* Use the parent stdout.  */
+    kwsysProcessSetupSharedPipe(STD_OUTPUT_HANDLE, &cp->PipeChildStd[1]);
+    }
+  else if(cp->PipeNativeSTDOUT[1])
     {
-    if(!kwsysProcessSetupSharedPipe(STD_ERROR_HANDLE,
-                                    &si.StartupInfo.hStdError))
+    /* Use the given handle for stdout.  */
+    kwsysProcessSetupPipeNative(cp->PipeNativeSTDOUT[1], &cp->PipeChildStd[1]);
+    }
+  else
+    {
+    /* Use our pipe for stdout.  Duplicate the handle since our waker
+       thread will use the original.  Do not make it inherited yet.  */
+    if(!DuplicateHandle(GetCurrentProcess(),
+                        cp->Pipe[KWSYSPE_PIPE_STDOUT].Write,
+                        GetCurrentProcess(), &cp->PipeChildStd[1],
+                        0, FALSE, DUPLICATE_SAME_ACCESS))
       {
-      kwsysProcessCleanup(cp, 1);
-      kwsysProcessCleanupHandleSafe(&si.StartupInfo.hStdError,
-                                    STD_ERROR_HANDLE);
+      kwsysProcessCleanup(cp, GetLastError());
       return;
       }
     }
 
-  /* Replace the stderr pipe with the native pipe provided if any.  In
-     this case the pipe thread will still run but never report
-     data.  */
-  if(cp->PipeNativeSTDERR[1])
+  /* Create stderr pipe to be shared by all processes in the pipeline.
+     We always create this so the pipe thread can run even if we do not
+     end up giving the write end to the child below.  */
+  if(!CreatePipe(&cp->Pipe[KWSYSPE_PIPE_STDERR].Read,
+                 &cp->Pipe[KWSYSPE_PIPE_STDERR].Write, 0, 0))
     {
-    if(!kwsysProcessSetupPipeNative(&si.StartupInfo.hStdError,
-                                    cp->PipeNativeSTDERR, 1))
+    kwsysProcessCleanup(cp, GetLastError());
+    return;
+    }
+
+  if(cp->PipeFileSTDERR)
+    {
+    /* Use a file for stderr.  */
+    DWORD error = kwsysProcessSetupOutputPipeFile(&cp->PipeChildStd[2],
+                                                  cp->PipeFileSTDERR);
+    if(error)
       {
-      kwsysProcessCleanup(cp, 1);
-      kwsysProcessCleanupHandleSafe(&si.StartupInfo.hStdError,
-                                    STD_ERROR_HANDLE);
+      kwsysProcessCleanup(cp, error);
+      return;
+      }
+    }
+  else if(cp->PipeSharedSTDERR)
+    {
+    /* Use the parent stderr.  */
+    kwsysProcessSetupSharedPipe(STD_ERROR_HANDLE, &cp->PipeChildStd[2]);
+    }
+  else if(cp->PipeNativeSTDERR[1])
+    {
+    /* Use the given handle for stderr.  */
+    kwsysProcessSetupPipeNative(cp->PipeNativeSTDERR[1], &cp->PipeChildStd[2]);
+    }
+  else
+    {
+    /* Use our pipe for stderr.  Duplicate the handle since our waker
+       thread will use the original.  Do not make it inherited yet.  */
+    if(!DuplicateHandle(GetCurrentProcess(),
+                        cp->Pipe[KWSYSPE_PIPE_STDERR].Write,
+                        GetCurrentProcess(), &cp->PipeChildStd[2],
+                        0, FALSE, DUPLICATE_SAME_ACCESS))
+      {
+      kwsysProcessCleanup(cp, GetLastError());
       return;
       }
     }
 
   /* Create the pipeline of processes.  */
   {
-  HANDLE readEnd = 0;
+  /* Child startup control data.  */
+  kwsysProcessCreateInformation si;
+  HANDLE nextStdInput = cp->PipeChildStd[0];
+
+  /* Initialize startup info data.  */
+  ZeroMemory(&si, sizeof(si));
+  si.StartupInfo.cb = sizeof(si.StartupInfo);
+
+  /* Decide whether a child window should be shown.  */
+  si.StartupInfo.dwFlags |= STARTF_USESHOWWINDOW;
+  si.StartupInfo.wShowWindow =
+    (unsigned short)(cp->HideWindow?SW_HIDE:SW_SHOWDEFAULT);
+
+  /* Connect the child's output pipes to the threads.  */
+  si.StartupInfo.dwFlags |= STARTF_USESTDHANDLES;
+
   for(i=0; i < cp->NumberOfCommands; ++i)
     {
-    if(kwsysProcessCreate(cp, i, &si, &readEnd))
+    /* Setup the process's pipes.  */
+    si.hStdInput = nextStdInput;
+    if (i == cp->NumberOfCommands-1)
+      {
+      /* The last child gets the overall stdout.  */
+      nextStdInput = INVALID_HANDLE_VALUE;
+      si.hStdOutput = cp->PipeChildStd[1];
+      }
+    else
+      {
+      /* Create a pipe to sit between the children.  */
+      HANDLE p[2] = {INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE};
+      if (!CreatePipe(&p[0], &p[1], 0, 0))
+        {
+        DWORD error = GetLastError();
+        if (nextStdInput != cp->PipeChildStd[0])
+          {
+          kwsysProcessCleanupHandle(&nextStdInput);
+          }
+        kwsysProcessCleanup(cp, error);
+        return;
+        }
+      nextStdInput = p[0];
+      si.hStdOutput = p[1];
+      }
+    si.hStdError = cp->MergeOutput? cp->PipeChildStd[1] : cp->PipeChildStd[2];
+
+    {
+    DWORD error = kwsysProcessCreate(cp, i, &si);
+
+    /* Close our copies of pipes used between children.  */
+    if (si.hStdInput != cp->PipeChildStd[0])
+      {
+      kwsysProcessCleanupHandle(&si.hStdInput);
+      }
+    if (si.hStdOutput != cp->PipeChildStd[1])
+      {
+      kwsysProcessCleanupHandle(&si.hStdOutput);
+      }
+    if (si.hStdError != cp->PipeChildStd[2] && !cp->MergeOutput)
+      {
+      kwsysProcessCleanupHandle(&si.hStdError);
+      }
+    if (!error)
       {
       cp->ProcessEvents[i+1] = cp->ProcessInformation[i].hProcess;
       }
     else
       {
-      kwsysProcessCleanup(cp, 1);
-
-      /* Release resources that may have been allocated for this
-         process before an error occurred.  */
-      kwsysProcessCleanupHandle(&readEnd);
-      kwsysProcessCleanupHandleSafe(&si.StartupInfo.hStdInput,
-                                    STD_INPUT_HANDLE);
-      kwsysProcessCleanupHandleSafe(&si.StartupInfo.hStdOutput,
-                                    STD_OUTPUT_HANDLE);
-      kwsysProcessCleanupHandleSafe(&si.StartupInfo.hStdError,
-                                    STD_ERROR_HANDLE);
+      if (nextStdInput != cp->PipeChildStd[0])
+        {
+        kwsysProcessCleanupHandle(&nextStdInput);
+        }
+      kwsysProcessCleanup(cp, error);
       return;
       }
     }
-
-  /* Save a handle to the output pipe for the last process.  */
-  cp->Pipe[KWSYSPE_PIPE_STDOUT].Read = readEnd;
+    }
   }
 
-  /* Close the inherited handles to the stderr pipe shared by all
-     processes in the pipeline.  The stdout and stdin pipes are not
-     shared among all children and are therefore closed by
-     kwsysProcessCreate after each child is created.  */
-  kwsysProcessCleanupHandleSafe(&si.StartupInfo.hStdError, STD_ERROR_HANDLE);
+  /* The parent process does not need the child's pipe ends.  */
+  for (i=0; i < 3; ++i)
+    {
+    kwsysProcessCleanupHandle(&cp->PipeChildStd[i]);
+    }
 
   /* Restore the working directory.  */
   if(cp->RealWorkingDirectory)
@@ -1325,6 +1490,52 @@ int kwsysProcess_WaitForExit(kwsysProcess* cp, double* userTimeout)
 }
 
 /*--------------------------------------------------------------------------*/
+void kwsysProcess_Interrupt(kwsysProcess* cp)
+{
+  int i;
+  /* Make sure we are executing a process.  */
+  if(!cp || cp->State != kwsysProcess_State_Executing || cp->TimeoutExpired ||
+     cp->Killed)
+    {
+    KWSYSPE_DEBUG((stderr, "interrupt: child not executing\n"));
+    return;
+    }
+
+  /* Skip actually interrupting the child if it has already terminated.  */
+  if(cp->Terminated)
+    {
+    KWSYSPE_DEBUG((stderr, "interrupt: child already terminated\n"));
+    return;
+    }
+
+  /* Interrupt the children.  */
+  if (cp->CreateProcessGroup)
+    {
+    if(cp->ProcessInformation)
+      {
+      for(i=0; i < cp->NumberOfCommands; ++i)
+        {
+        /* Make sure the process handle isn't closed (e.g. from disowning). */
+        if(cp->ProcessInformation[i].hProcess)
+          {
+          /* The user created a process group for this process.  The group ID
+             is the process ID for the original process in the group.  Note
+             that we have to use Ctrl+Break: Ctrl+C is not allowed for process
+             groups.  */
+          GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT,
+                                   cp->ProcessInformation[i].dwProcessId);
+          }
+        }
+      }
+    }
+  else
+    {
+    /* No process group was created.  Kill our own process group...  */
+    GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT, 0);
+    }
+}
+
+/*--------------------------------------------------------------------------*/
 void kwsysProcess_Kill(kwsysProcess* cp)
 {
   int i;
@@ -1352,7 +1563,8 @@ void kwsysProcess_Kill(kwsysProcess* cp)
   for(i=0; i < cp->NumberOfCommands; ++i)
     {
     kwsysProcessKillTree(cp->ProcessInformation[i].dwProcessId);
-    // close the handle if we kill it
+    /* Remove from global list of processes and close handles.  */
+    kwsysProcessesRemove(cp->ProcessInformation[i].hProcess);
     kwsysProcessCleanupHandle(&cp->ProcessInformation[i].hThread);
     kwsysProcessCleanupHandle(&cp->ProcessInformation[i].hProcess);
     }
@@ -1539,162 +1751,129 @@ int kwsysProcessInitialize(kwsysProcess* cp)
         }
       }
     }
+  {
+  int i;
+  for (i=0; i < 3; ++i)
+    {
+    cp->PipeChildStd[i] = INVALID_HANDLE_VALUE;
+    }
+  }
 
   return 1;
 }
 
 /*--------------------------------------------------------------------------*/
-int kwsysProcessCreate(kwsysProcess* cp, int index,
-                       kwsysProcessCreateInformation* si,
-                       PHANDLE readEnd)
+static DWORD kwsysProcessCreateChildHandle(PHANDLE out, HANDLE in, int isStdIn)
 {
-  /* Setup the process's stdin.  */
-  if(*readEnd)
-    {
-    /* Create an inherited duplicate of the read end from the output
-       pipe of the previous process.  This also closes the
-       non-inherited version. */
-    if(!DuplicateHandle(GetCurrentProcess(), *readEnd,
-                        GetCurrentProcess(), readEnd,
-                        0, TRUE, (DUPLICATE_CLOSE_SOURCE |
-                                  DUPLICATE_SAME_ACCESS)))
-      {
-      return 0;
-      }
-    si->StartupInfo.hStdInput = *readEnd;
+  DWORD flags;
 
-    /* This function is done with this handle.  */
-    *readEnd = 0;
-    }
-  else if(cp->PipeFileSTDIN)
+  /* Check whether the handle is valid for this process.  */
+  if (in != INVALID_HANDLE_VALUE && GetHandleInformation(in, &flags))
     {
-    /* Create a handle to read a file for stdin.  */
-    wchar_t* wstdin = kwsysEncoding_DupToWide(cp->PipeFileSTDIN);
-    HANDLE fin = CreateFileW(wstdin, GENERIC_READ|GENERIC_WRITE,
-                            FILE_SHARE_READ|FILE_SHARE_WRITE,
-                            0, OPEN_EXISTING, 0, 0);
-    free(wstdin);
-    if(fin == INVALID_HANDLE_VALUE)
+    /* Use the handle as-is if it is already inherited.  */
+    if (flags & HANDLE_FLAG_INHERIT)
       {
-      return 0;
-      }
-    /* Create an inherited duplicate of the handle.  This also closes
-       the non-inherited version.  */
-    if(!DuplicateHandle(GetCurrentProcess(), fin,
-                        GetCurrentProcess(), &fin,
-                        0, TRUE, (DUPLICATE_CLOSE_SOURCE |
-                                  DUPLICATE_SAME_ACCESS)))
-      {
-      return 0;
+      *out = in;
+      return ERROR_SUCCESS;
       }
-    si->StartupInfo.hStdInput = fin;
-    }
-  else if(cp->PipeSharedSTDIN)
-    {
-    /* Share this process's stdin with the child.  */
-    if(!kwsysProcessSetupSharedPipe(STD_INPUT_HANDLE,
-                                    &si->StartupInfo.hStdInput))
+
+    /* Create an inherited copy of this handle.  */
+    if (DuplicateHandle(GetCurrentProcess(), in, GetCurrentProcess(), out,
+                        0, TRUE, DUPLICATE_SAME_ACCESS))
       {
-      return 0;
+      return ERROR_SUCCESS;
       }
-    }
-  else if(cp->PipeNativeSTDIN[0])
-    {
-    /* Use the provided native pipe.  */
-    if(!kwsysProcessSetupPipeNative(&si->StartupInfo.hStdInput,
-                                    cp->PipeNativeSTDIN, 0))
+    else
       {
-      return 0;
+      return GetLastError();
       }
     }
   else
     {
-    /* Explicitly give the child no stdin.  */
-    si->StartupInfo.hStdInput = INVALID_HANDLE_VALUE;
+    /* The given handle is not valid for this process.  Some child
+       processes may break if they do not have a valid standard handle,
+       so open NUL to give to the child.  */
+    SECURITY_ATTRIBUTES sa;
+    ZeroMemory(&sa, sizeof(sa));
+    sa.nLength = (DWORD)sizeof(sa);
+    sa.bInheritHandle = 1;
+    *out = CreateFileW(L"NUL",
+                       (isStdIn ? GENERIC_READ :
+                        (GENERIC_WRITE | FILE_READ_ATTRIBUTES)),
+                       FILE_SHARE_READ|FILE_SHARE_WRITE,
+                       &sa, OPEN_EXISTING, 0, 0);
+    return (*out != INVALID_HANDLE_VALUE) ? ERROR_SUCCESS : GetLastError();
     }
+}
 
-  /* Setup the process's stdout.  */
-  {
-  DWORD maybeClose = DUPLICATE_CLOSE_SOURCE;
-  HANDLE writeEnd;
+/*--------------------------------------------------------------------------*/
+DWORD kwsysProcessCreate(kwsysProcess* cp, int index,
+                         kwsysProcessCreateInformation* si)
+{
+  DWORD creationFlags;
+  DWORD error = ERROR_SUCCESS;
 
-  /* Create the output pipe for this process.  Neither end is directly
-     inherited.  */
-  if(!CreatePipe(readEnd, &writeEnd, 0, 0))
+  /* Check if we are currently exiting.  */
+  if (!kwsysTryEnterCreateProcessSection())
     {
-    return 0;
+    /* The Ctrl handler is currently working on exiting our process.  Rather
+    than return an error code, which could cause incorrect conclusions to be
+    reached by the caller, we simply hang.  (For example, a CMake try_run
+    configure step might cause the project to configure wrong.)  */
+    Sleep(INFINITE);
     }
 
-  /* Create an inherited duplicate of the write end.  Close the
-     non-inherited version unless this is the last process.  Save the
-     non-inherited write end of the last process.  */
-  if(index == cp->NumberOfCommands-1)
+  /* Create the child in a suspended state so we can wait until all
+     children have been created before running any one.  */
+  creationFlags = CREATE_SUSPENDED;
+  if (cp->CreateProcessGroup)
     {
-    cp->Pipe[KWSYSPE_PIPE_STDOUT].Write = writeEnd;
-    maybeClose = 0;
+    creationFlags |= CREATE_NEW_PROCESS_GROUP;
     }
-  if(!DuplicateHandle(GetCurrentProcess(), writeEnd,
-                      GetCurrentProcess(), &writeEnd,
-                      0, TRUE, (maybeClose | DUPLICATE_SAME_ACCESS)))
-    {
-    return 0;
-    }
-  si->StartupInfo.hStdOutput = writeEnd;
-  }
 
-  /* Replace the stdout pipe with a file if requested.  In this case
-     the pipe thread will still run but never report data.  */
-  if(index == cp->NumberOfCommands-1 && cp->PipeFileSTDOUT)
+  /* Create inherited copies of the handles.  */
+  (error = kwsysProcessCreateChildHandle(&si->StartupInfo.hStdInput,
+                                          si->hStdInput, 1)) ||
+  (error = kwsysProcessCreateChildHandle(&si->StartupInfo.hStdOutput,
+                                          si->hStdOutput, 0)) ||
+  (error = kwsysProcessCreateChildHandle(&si->StartupInfo.hStdError,
+                                          si->hStdError, 0)) ||
+  /* Create the process.  */
+  (!CreateProcessW(0, cp->Commands[index], 0, 0, TRUE, creationFlags, 0,
+                  0, &si->StartupInfo, &cp->ProcessInformation[index]) &&
+    (error = GetLastError()));
+
+  /* Close the inherited copies of the handles. */
+  if (si->StartupInfo.hStdInput != si->hStdInput)
     {
-    if(!kwsysProcessSetupOutputPipeFile(&si->StartupInfo.hStdOutput,
-                                        cp->PipeFileSTDOUT))
-      {
-      return 0;
-      }
+    kwsysProcessCleanupHandle(&si->StartupInfo.hStdInput);
     }
-
-  /* Replace the stdout pipe of the last child with the parent
-     process's if requested.  In this case the pipe thread will still
-     run but never report data.  */
-  if(index == cp->NumberOfCommands-1 && cp->PipeSharedSTDOUT)
+  if (si->StartupInfo.hStdOutput != si->hStdOutput)
     {
-    if(!kwsysProcessSetupSharedPipe(STD_OUTPUT_HANDLE,
-                                    &si->StartupInfo.hStdOutput))
-      {
-      return 0;
-      }
+    kwsysProcessCleanupHandle(&si->StartupInfo.hStdOutput);
     }
-
-  /* Replace the stdout pipe with the native pipe provided if any.  In
-     this case the pipe thread will still run but never report
-     data.  */
-  if(index == cp->NumberOfCommands-1 && cp->PipeNativeSTDOUT[1])
+  if (si->StartupInfo.hStdError != si->hStdError)
     {
-    if(!kwsysProcessSetupPipeNative(&si->StartupInfo.hStdOutput,
-                                    cp->PipeNativeSTDOUT, 1))
-      {
-      return 0;
-      }
+    kwsysProcessCleanupHandle(&si->StartupInfo.hStdError);
     }
 
-  /* Create the child in a suspended state so we can wait until all
-     children have been created before running any one.  */
-  if(!CreateProcessW(0, cp->Commands[index], 0, 0, TRUE, CREATE_SUSPENDED, 0,
-                    0, &si->StartupInfo, &cp->ProcessInformation[index]))
+  /* Add the process to the global list of processes. */
+  if (!error &&
+      !kwsysProcessesAdd(cp->ProcessInformation[index].hProcess,
+      cp->ProcessInformation[index].dwProcessId, cp->CreateProcessGroup))
     {
-    return 0;
+    /* This failed for some reason.  Kill the suspended process. */
+    TerminateProcess(cp->ProcessInformation[index].hProcess, 1);
+    /* And clean up... */
+    kwsysProcessCleanupHandle(&cp->ProcessInformation[index].hProcess);
+    kwsysProcessCleanupHandle(&cp->ProcessInformation[index].hThread);
+    strcpy(cp->ErrorMessage, "kwsysProcessesAdd function failed");
+    error = ERROR_NOT_ENOUGH_MEMORY; /* Most likely reason.  */
     }
 
-  /* Successfully created this child process.  Close the current
-     process's copies of the inherited stdout and stdin handles.  The
-     stderr handle is shared among all children and is closed by
-     kwsysProcess_Execute after all children have been created.  */
-  kwsysProcessCleanupHandleSafe(&si->StartupInfo.hStdInput,
-                                STD_INPUT_HANDLE);
-  kwsysProcessCleanupHandleSafe(&si->StartupInfo.hStdOutput,
-                                STD_OUTPUT_HANDLE);
-
-  return 1;
+  /* If the console Ctrl handler is waiting for us, this will release it... */
+  kwsysLeaveCreateProcessSection();
+  return error;
 }
 
 /*--------------------------------------------------------------------------*/
@@ -1716,6 +1895,9 @@ void kwsysProcessDestroy(kwsysProcess* cp, int event)
   GetExitCodeProcess(cp->ProcessInformation[index].hProcess,
                      &cp->CommandExitCodes[index]);
 
+  /* Remove from global list of processes.  */
+  kwsysProcessesRemove(cp->ProcessInformation[index].hProcess);
+
   /* Close the process handle for the terminated process.  */
   kwsysProcessCleanupHandle(&cp->ProcessInformation[index].hProcess);
 
@@ -1750,125 +1932,51 @@ void kwsysProcessDestroy(kwsysProcess* cp, int event)
 }
 
 /*--------------------------------------------------------------------------*/
-int kwsysProcessSetupOutputPipeFile(PHANDLE phandle, const char* name)
+DWORD kwsysProcessSetupOutputPipeFile(PHANDLE phandle, const char* name)
 {
   HANDLE fout;
   wchar_t* wname;
+  DWORD error;
   if(!name)
     {
-    return 1;
+    return ERROR_INVALID_PARAMETER;
     }
 
-  /* Close the existing inherited handle.  */
+  /* Close the existing handle.  */
   kwsysProcessCleanupHandle(phandle);
 
   /* Create a handle to write a file for the pipe.  */
   wname = kwsysEncoding_DupToWide(name);
   fout = CreateFileW(wname, GENERIC_WRITE, FILE_SHARE_READ, 0,
                     CREATE_ALWAYS, 0, 0);
+  error = GetLastError();
   free(wname);
   if(fout == INVALID_HANDLE_VALUE)
     {
-    return 0;
-    }
-
-  /* Create an inherited duplicate of the handle.  This also closes
-     the non-inherited version.  */
-  if(!DuplicateHandle(GetCurrentProcess(), fout,
-                      GetCurrentProcess(), &fout,
-                      0, TRUE, (DUPLICATE_CLOSE_SOURCE |
-                                DUPLICATE_SAME_ACCESS)))
-    {
-    return 0;
+    return error;
     }
 
   /* Assign the replacement handle.  */
   *phandle = fout;
-  return 1;
+  return ERROR_SUCCESS;
 }
 
 /*--------------------------------------------------------------------------*/
-int kwsysProcessSetupSharedPipe(DWORD nStdHandle, PHANDLE handle)
+void kwsysProcessSetupSharedPipe(DWORD nStdHandle, PHANDLE handle)
 {
-  /* Check whether the handle to be shared is already inherited.  */
-  DWORD flags;
-  int inherited = 0;
-  if(GetHandleInformation(GetStdHandle(nStdHandle), &flags) &&
-     (flags & HANDLE_FLAG_INHERIT))
-    {
-    inherited = 1;
-    }
-
-  /* Cleanup the previous handle.  */
+  /* Close the existing handle.  */
   kwsysProcessCleanupHandle(handle);
-
-  /* If the standard handle is not inherited then duplicate it to
-     create an inherited copy.  Do not close the original handle when
-     duplicating!  */
-  if(inherited)
-    {
-    *handle = GetStdHandle(nStdHandle);
-    return 1;
-    }
-  else if(DuplicateHandle(GetCurrentProcess(), GetStdHandle(nStdHandle),
-                          GetCurrentProcess(), handle,
-                          0, TRUE, DUPLICATE_SAME_ACCESS))
-    {
-    return 1;
-    }
-  else
-    {
-    /* The given standard handle is not valid for this process.  Some
-       child processes may break if they do not have a valid standard
-       pipe, so give the child an empty pipe.  For the stdin pipe we
-       want to close the write end and give the read end to the child.
-       For stdout and stderr we want to close the read end and give
-       the write end to the child.  */
-    int child_end = (nStdHandle == STD_INPUT_HANDLE)? 0:1;
-    int parent_end = (nStdHandle == STD_INPUT_HANDLE)? 1:0;
-    HANDLE emptyPipe[2];
-    if(!CreatePipe(&emptyPipe[0], &emptyPipe[1], 0, 0))
-      {
-      return 0;
-      }
-
-    /* Close the non-inherited end so the pipe will be broken
-       immediately.  */
-    CloseHandle(emptyPipe[parent_end]);
-
-    /* Create an inherited duplicate of the handle.  This also
-       closes the non-inherited version.  */
-    if(!DuplicateHandle(GetCurrentProcess(), emptyPipe[child_end],
-                        GetCurrentProcess(), &emptyPipe[child_end],
-                        0, TRUE, (DUPLICATE_CLOSE_SOURCE |
-                                  DUPLICATE_SAME_ACCESS)))
-      {
-      return 0;
-      }
-
-    /* Give the inherited handle to the child.  */
-    *handle = emptyPipe[child_end];
-    return 1;
-    }
+  /* Store the new standard handle.  */
+  *handle = GetStdHandle(nStdHandle);
 }
 
 /*--------------------------------------------------------------------------*/
-int kwsysProcessSetupPipeNative(PHANDLE handle, HANDLE p[2], int isWrite)
+void kwsysProcessSetupPipeNative(HANDLE native, PHANDLE handle)
 {
-  /* Close the existing inherited handle.  */
+  /* Close the existing handle.  */
   kwsysProcessCleanupHandle(handle);
-
-  /* Create an inherited duplicate of the handle.  This also closes
-     the non-inherited version.  */
-  if(!DuplicateHandle(GetCurrentProcess(), p[isWrite? 1:0],
-                      GetCurrentProcess(), handle,
-                      0, TRUE, (DUPLICATE_CLOSE_SOURCE |
-                                DUPLICATE_SAME_ACCESS)))
-    {
-    return 0;
-    }
-
-  return 1;
+  /* Store the new given handle.  */
+  *handle = native;
 }
 
 /*--------------------------------------------------------------------------*/
@@ -1876,30 +1984,20 @@ int kwsysProcessSetupPipeNative(PHANDLE handle, HANDLE p[2], int isWrite)
 /* Close the given handle if it is open.  Reset its value to 0.  */
 void kwsysProcessCleanupHandle(PHANDLE h)
 {
-  if(h && *h)
-    {
-    CloseHandle(*h);
-    *h = 0;
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-
-/* Close the given handle if it is open and not a standard handle.
-   Reset its value to 0.  */
-void kwsysProcessCleanupHandleSafe(PHANDLE h, DWORD nStdHandle)
-{
-  if(h && *h && (*h != GetStdHandle(nStdHandle)))
+  if(h && *h && *h != INVALID_HANDLE_VALUE &&
+     *h != GetStdHandle(STD_INPUT_HANDLE) &&
+     *h != GetStdHandle(STD_OUTPUT_HANDLE) &&
+     *h != GetStdHandle(STD_ERROR_HANDLE))
     {
     CloseHandle(*h);
-    *h = 0;
+    *h = INVALID_HANDLE_VALUE;
     }
 }
 
 /*--------------------------------------------------------------------------*/
 
 /* Close all handles created by kwsysProcess_Execute.  */
-void kwsysProcessCleanup(kwsysProcess* cp, int error)
+void kwsysProcessCleanup(kwsysProcess* cp, DWORD error)
 {
   int i;
   /* If this is an error case, report the error.  */
@@ -1909,21 +2007,27 @@ void kwsysProcessCleanup(kwsysProcess* cp, int error)
     if(cp->ErrorMessage[0] == 0)
       {
       /* Format the error message.  */
-      DWORD original = GetLastError();
       wchar_t err_msg[KWSYSPE_PIPE_BUFFER_SIZE];
       DWORD length = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM |
-                                   FORMAT_MESSAGE_IGNORE_INSERTS, 0, original,
+                                   FORMAT_MESSAGE_IGNORE_INSERTS, 0, error,
                                    MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
                                    err_msg, KWSYSPE_PIPE_BUFFER_SIZE, 0);
-      WideCharToMultiByte(CP_UTF8, 0, err_msg, -1, cp->ErrorMessage,
-                          KWSYSPE_PIPE_BUFFER_SIZE, NULL, NULL);
       if(length < 1)
         {
         /* FormatMessage failed.  Use a default message.  */
         _snprintf(cp->ErrorMessage, KWSYSPE_PIPE_BUFFER_SIZE,
                   "Process execution failed with error 0x%X.  "
                   "FormatMessage failed with error 0x%X",
-                  original, GetLastError());
+                  error, GetLastError());
+        }
+      if(!WideCharToMultiByte(CP_UTF8, 0, err_msg, -1, cp->ErrorMessage,
+                              KWSYSPE_PIPE_BUFFER_SIZE, NULL, NULL))
+        {
+        /* WideCharToMultiByte failed.  Use a default message.  */
+        _snprintf(cp->ErrorMessage, KWSYSPE_PIPE_BUFFER_SIZE,
+                  "Process execution failed with error 0x%X.  "
+                  "WideCharToMultiByte failed with error 0x%X",
+                  error, GetLastError());
         }
       }
 
@@ -1946,6 +2050,8 @@ void kwsysProcessCleanup(kwsysProcess* cp, int error)
         }
       for(i=0; i < cp->NumberOfCommands; ++i)
         {
+        /* Remove from global list of processes and close handles.  */
+        kwsysProcessesRemove(cp->ProcessInformation[i].hProcess);
         kwsysProcessCleanupHandle(&cp->ProcessInformation[i].hThread);
         kwsysProcessCleanupHandle(&cp->ProcessInformation[i].hProcess);
         }
@@ -1982,6 +2088,10 @@ void kwsysProcessCleanup(kwsysProcess* cp, int error)
     kwsysProcessCleanupHandle(&cp->Pipe[i].Read);
     cp->Pipe[i].Closed = 0;
     }
+  for(i=0; i < 3; ++i)
+    {
+    kwsysProcessCleanupHandle(&cp->PipeChildStd[i]);
+    }
 }
 
 /*--------------------------------------------------------------------------*/
@@ -2006,66 +2116,6 @@ void kwsysProcessCleanErrorMessage(kwsysProcess* cp)
 }
 
 /*--------------------------------------------------------------------------*/
-int kwsysProcessComputeCommandLength(kwsysProcess* cp,
-                                     char const* const* command)
-{
-  int length = 0;
-  if(cp->Verbatim)
-    {
-    /* Treat the first argument as a verbatim command line.  Use its
-       length directly and add space for the null-terminator.  */
-    length = (int)strlen(*command)+1;
-    }
-  else
-    {
-    /* Compute the length of the command line when it is converted to
-       a single string.  Space for the null-terminator is allocated by
-       the whitespace character allocated for the first argument that
-       will not be used.  */
-    char const* const* arg;
-    for(arg = command; *arg; ++arg)
-      {
-      /* Add the length of this argument.  It already includes room
-         for a separating space or terminating null.  */
-      length += kwsysSystem_Shell_GetArgumentSizeForWindows(*arg, 0);
-      }
-    }
-
-  return length;
-}
-
-/*--------------------------------------------------------------------------*/
-void kwsysProcessComputeCommandLine(kwsysProcess* cp,
-                                    char const* const* command,
-                                    char* cmd)
-{
-  if(cp->Verbatim)
-    {
-    /* Copy the verbatim command line into the buffer.  */
-    strcpy(cmd, *command);
-    }
-  else
-    {
-    /* Construct the command line in the allocated buffer.  */
-    char const* const* arg;
-    for(arg = command; *arg; ++arg)
-      {
-      /* Add the separating space if this is not the first argument.  */
-      if(arg != command)
-        {
-        *cmd++ = ' ';
-        }
-
-      /* Add the current argument.  */
-      cmd = kwsysSystem_Shell_GetArgumentForWindows(*arg, cmd, 0);
-      }
-
-    /* Add the terminating null character to the command line.  */
-    *cmd = 0;
-    }
-}
-
-/*--------------------------------------------------------------------------*/
 /* Get the time at which either the process or user timeout will
    expire.  Returns 1 if the user timeout is first, and 0 otherwise.  */
 int kwsysProcessGetTimeoutTime(kwsysProcess* cp, double* userTimeout,
@@ -2382,7 +2432,11 @@ static kwsysProcess_List* kwsysProcess_List_New(void)
   osv.dwOSVersionInfoSize = sizeof(osv);
 #ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
 # pragma warning (push)
-# pragma warning (disable:4996)
+# ifdef __INTEL_COMPILER
+#  pragma warning (disable:1478)
+# else
+#  pragma warning (disable:4996)
+# endif
 #endif
   GetVersionEx(&osv);
 #ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
@@ -2734,3 +2788,230 @@ static void kwsysProcessDisablePipeThreads(kwsysProcess* cp)
     ReleaseSemaphore(cp->Pipe[cp->CurrentIndex].Reader.Go, 1, 0);
     }
 }
+
+/*--------------------------------------------------------------------------*/
+/* Global set of executing processes for use by the Ctrl handler.
+   This global instance will be zero-initialized by the compiler.
+
+   Note that the console Ctrl handler runs on a background thread and so
+   everything it does must be thread safe.  Here, we track the hProcess
+   HANDLEs directly instead of kwsysProcess instances, so that we don't have
+   to make kwsysProcess thread safe.  */
+typedef struct kwsysProcessInstance_s
+{
+  HANDLE hProcess;
+  DWORD dwProcessId;
+  int NewProcessGroup; /* Whether the process was created in a new group.  */
+} kwsysProcessInstance;
+
+typedef struct kwsysProcessInstances_s
+{
+  /* Whether we have initialized key fields below, like critical sections.  */
+  int Initialized;
+
+  /* Ctrl handler runs on a different thread, so we must sync access.  */
+  CRITICAL_SECTION Lock;
+
+  int Exiting;
+  size_t Count;
+  size_t Size;
+  kwsysProcessInstance* Processes;
+} kwsysProcessInstances;
+static kwsysProcessInstances kwsysProcesses;
+
+/*--------------------------------------------------------------------------*/
+/* Initialize critial section and set up console Ctrl handler.  You MUST call
+   this before using any other kwsysProcesses* functions below.  */
+static int kwsysProcessesInitialize(void)
+{
+  /* Initialize everything if not done already.  */
+  if(!kwsysProcesses.Initialized)
+    {
+    InitializeCriticalSection(&kwsysProcesses.Lock);
+
+    /* Set up console ctrl handler.  */
+    if(!SetConsoleCtrlHandler(kwsysCtrlHandler, TRUE))
+      {
+      return 0;
+      }
+
+    kwsysProcesses.Initialized = 1;
+    }
+  return 1;
+}
+
+/*--------------------------------------------------------------------------*/
+/* The Ctrl handler waits on the global list of processes.  To prevent an
+   orphaned process, do not create a new process if the Ctrl handler is
+   already running.  Do so by using this function to check if it is ok to
+   create a process.  */
+static int kwsysTryEnterCreateProcessSection(void)
+{
+  /* Enter main critical section; this means creating a process and the Ctrl
+     handler are mutually exclusive.  */
+  EnterCriticalSection(&kwsysProcesses.Lock);
+  /* Indicate to the caller if they can create a process.  */
+  if(kwsysProcesses.Exiting)
+    {
+    LeaveCriticalSection(&kwsysProcesses.Lock);
+    return 0;
+    }
+  else
+    {
+    return 1;
+    }
+}
+
+/*--------------------------------------------------------------------------*/
+/* Matching function on successful kwsysTryEnterCreateProcessSection return.
+   Make sure you called kwsysProcessesAdd if applicable before calling this.*/
+static void kwsysLeaveCreateProcessSection(void)
+{
+  LeaveCriticalSection(&kwsysProcesses.Lock);
+}
+
+/*--------------------------------------------------------------------------*/
+/* Add new process to global process list.  The Ctrl handler will wait for
+   the process to exit before it returns.  Do not close the process handle
+   until after calling kwsysProcessesRemove.  The newProcessGroup parameter
+   must be set if the process was created with CREATE_NEW_PROCESS_GROUP.  */
+static int kwsysProcessesAdd(HANDLE hProcess, DWORD dwProcessid,
+                             int newProcessGroup)
+{
+  if(!kwsysProcessesInitialize() || !hProcess ||
+      hProcess == INVALID_HANDLE_VALUE)
+    {
+    return 0;
+    }
+
+  /* Enter the critical section. */
+  EnterCriticalSection(&kwsysProcesses.Lock);
+
+  /* Make sure there is enough space for the new process handle.  */
+  if(kwsysProcesses.Count == kwsysProcesses.Size)
+    {
+    size_t newSize;
+    kwsysProcessInstance *newArray;
+    /* Start with enough space for a small number of process handles
+       and double the size each time more is needed.  */
+    newSize = kwsysProcesses.Size? kwsysProcesses.Size*2 : 4;
+
+    /* Try allocating the new block of memory.  */
+    if(newArray = (kwsysProcessInstance*)malloc(
+       newSize*sizeof(kwsysProcessInstance)))
+      {
+      /* Copy the old process handles to the new memory.  */
+      if(kwsysProcesses.Count > 0)
+        {
+        memcpy(newArray, kwsysProcesses.Processes,
+               kwsysProcesses.Count * sizeof(kwsysProcessInstance));
+        }
+      }
+    else
+      {
+      /* Failed to allocate memory for the new process handle set.  */
+      LeaveCriticalSection(&kwsysProcesses.Lock);
+      return 0;
+      }
+
+    /* Free original array. */
+    free(kwsysProcesses.Processes);
+
+    /* Update original structure with new allocation. */
+    kwsysProcesses.Size = newSize;
+    kwsysProcesses.Processes = newArray;
+    }
+
+  /* Append the new process information to the set.  */
+  kwsysProcesses.Processes[kwsysProcesses.Count].hProcess = hProcess;
+  kwsysProcesses.Processes[kwsysProcesses.Count].dwProcessId = dwProcessid;
+  kwsysProcesses.Processes[kwsysProcesses.Count++].NewProcessGroup =
+    newProcessGroup;
+
+  /* Leave critical section and return success. */
+  LeaveCriticalSection(&kwsysProcesses.Lock);
+
+  return 1;
+}
+
+/*--------------------------------------------------------------------------*/
+/* Removes process to global process list.  */
+static void kwsysProcessesRemove(HANDLE hProcess)
+{
+  size_t i;
+
+  if (!hProcess || hProcess == INVALID_HANDLE_VALUE)
+    {
+    return;
+    }
+
+  EnterCriticalSection(&kwsysProcesses.Lock);
+
+  /* Find the given process in the set.  */
+  for(i=0; i < kwsysProcesses.Count; ++i)
+    {
+    if(kwsysProcesses.Processes[i].hProcess == hProcess)
+      {
+      break;
+      }
+    }
+  if(i < kwsysProcesses.Count)
+    {
+    /* Found it!  Remove the process from the set.  */
+    --kwsysProcesses.Count;
+    for(; i < kwsysProcesses.Count; ++i)
+      {
+      kwsysProcesses.Processes[i] = kwsysProcesses.Processes[i+1];
+      }
+
+    /* If this was the last process, free the array.  */
+    if(kwsysProcesses.Count == 0)
+      {
+      kwsysProcesses.Size = 0;
+      free(kwsysProcesses.Processes);
+      kwsysProcesses.Processes = 0;
+      }
+    }
+
+  LeaveCriticalSection(&kwsysProcesses.Lock);
+}
+
+/*--------------------------------------------------------------------------*/
+static BOOL WINAPI kwsysCtrlHandler(DWORD dwCtrlType)
+{
+  size_t i;
+  (void)dwCtrlType;
+  /* Enter critical section.  */
+  EnterCriticalSection(&kwsysProcesses.Lock);
+
+  /* Set flag indicating that we are exiting.  */
+  kwsysProcesses.Exiting = 1;
+
+  /* If some of our processes were created in a new process group, we must
+     manually interrupt them.  They won't otherwise receive a Ctrl+C/Break. */
+  for(i=0; i < kwsysProcesses.Count; ++i)
+    {
+    if(kwsysProcesses.Processes[i].NewProcessGroup)
+      {
+      DWORD groupId = kwsysProcesses.Processes[i].dwProcessId;
+      if(groupId)
+        {
+        GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT, groupId);
+        }
+      }
+    }
+
+  /* Wait for each child process to exit.  This is the key step that prevents
+     us from leaving several orphaned children processes running in the
+     background when the user presses Ctrl+C.  */
+  for(i=0; i < kwsysProcesses.Count; ++i)
+    {
+    WaitForSingleObject(kwsysProcesses.Processes[i].hProcess, INFINITE);
+    }
+
+  /* Leave critical section.  */
+  LeaveCriticalSection(&kwsysProcesses.Lock);
+
+  /* Continue on to default Ctrl handler (which calls ExitProcess).  */
+  return FALSE;
+}
diff --git a/src/kwsys/README.txt b/src/kwsys/README.txt
index ba03f8d..b8191f7 100644
--- a/src/kwsys/README.txt
+++ b/src/kwsys/README.txt
@@ -8,3 +8,5 @@ details.
 You are probably reading this file in the source tree of a surrounding
 project.  In that case, see "../README.kwsys" for details of using
 KWSys in your project.
+
+See CONTRIBUTING.rst for instructions to contribute KWSys changes.
diff --git a/src/kwsys/RegularExpression.cxx b/src/kwsys/RegularExpression.cxx
deleted file mode 100644
index 598e7ca..0000000
--- a/src/kwsys/RegularExpression.cxx
+++ /dev/null
@@ -1,1244 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-//
-// Copyright (C) 1991 Texas Instruments Incorporated.
-//
-// Permission is granted to any individual or institution to use, copy, modify
-// and distribute this software, provided that this complete copyright and
-// permission notice is maintained, intact, in all copies and supporting
-// documentation.
-//
-// Texas Instruments Incorporated provides this software "as is" without
-// express or implied warranty.
-//
-//
-// Created: MNF 06/13/89  Initial Design and Implementation
-// Updated: LGO 08/09/89  Inherit from Generic
-// Updated: MBN 09/07/89  Added conditional exception handling
-// Updated: MBN 12/15/89  Sprinkled "const" qualifiers all over the place!
-// Updated: DLS 03/22/91  New lite version
-//
-
-#include "kwsysPrivate.h"
-#include KWSYS_HEADER(RegularExpression.hxx)
-
-// Work-around CMake dependency scanning limitation.  This must
-// duplicate the above list of headers.
-#if 0
-# include "RegularExpression.hxx.in"
-#endif
-
-#include <stdio.h>
-#include <string.h>
-
-namespace KWSYS_NAMESPACE
-{
-
-// RegularExpression -- Copies the given regular expression.
-RegularExpression::RegularExpression (const RegularExpression& rxp) {
-  if ( !rxp.program )
-    {
-    this->program = 0;
-    return;
-    }
-  int ind;
-  this->progsize = rxp.progsize;                // Copy regular expression size
-  this->program = new char[this->progsize];     // Allocate storage
-  for(ind=this->progsize; ind-- != 0;)          // Copy regular expresion
-    this->program[ind] = rxp.program[ind];
-  this->startp[0] = rxp.startp[0];              // Copy pointers into last
-  this->endp[0] = rxp.endp[0];                  // Successful "find" operation
-  this->regmust = rxp.regmust;                  // Copy field
-  if (rxp.regmust != 0) {
-    char* dum = rxp.program;
-    ind = 0;
-    while (dum != rxp.regmust) {
-      ++dum;
-      ++ind;
-    }
-    this->regmust = this->program + ind;
-  }
-  this->regstart = rxp.regstart;                // Copy starting index
-  this->reganch = rxp.reganch;                  // Copy remaining private data
-  this->regmlen = rxp.regmlen;                  // Copy remaining private data
-}
-
-// operator= -- Copies the given regular expression.
-RegularExpression& RegularExpression::operator= (const RegularExpression& rxp)
-{
-  if(this == &rxp)
-    {
-    return *this;
-    }
-  if ( !rxp.program )
-    {
-    this->program = 0;
-    return *this;
-    }
-  int ind;
-  this->progsize = rxp.progsize;                // Copy regular expression size
-  delete [] this->program;
-  this->program = new char[this->progsize];     // Allocate storage
-  for(ind=this->progsize; ind-- != 0;)          // Copy regular expresion
-    this->program[ind] = rxp.program[ind];
-  this->startp[0] = rxp.startp[0];              // Copy pointers into last
-  this->endp[0] = rxp.endp[0];                  // Successful "find" operation
-  this->regmust = rxp.regmust;                  // Copy field
-  if (rxp.regmust != 0) {
-    char* dum = rxp.program;
-    ind = 0;
-    while (dum != rxp.regmust) {
-      ++dum;
-      ++ind;
-    }
-    this->regmust = this->program + ind;
-  }
-  this->regstart = rxp.regstart;                // Copy starting index
-  this->reganch = rxp.reganch;                  // Copy remaining private data
-  this->regmlen = rxp.regmlen;                  // Copy remaining private data
-
-  return *this;
-}
-
-// operator== -- Returns true if two regular expressions have the same
-// compiled program for pattern matching.
-bool RegularExpression::operator== (const RegularExpression& rxp) const {
-  if (this != &rxp) {                           // Same address?
-    int ind = this->progsize;                   // Get regular expression size
-    if (ind != rxp.progsize)                    // If different size regexp
-      return false;                             // Return failure
-    while(ind-- != 0)                           // Else while still characters
-      if(this->program[ind] != rxp.program[ind]) // If regexp are different
-        return false;                            // Return failure
-  }
-  return true;                                  // Else same, return success
-}
-
-
-// deep_equal -- Returns true if have the same compiled regular expressions
-// and the same start and end pointers.
-
-bool RegularExpression::deep_equal (const RegularExpression& rxp) const {
-  int ind = this->progsize;                     // Get regular expression size
-  if (ind != rxp.progsize)                      // If different size regexp
-    return false;                               // Return failure
-  while(ind-- != 0)                             // Else while still characters
-    if(this->program[ind] != rxp.program[ind])  // If regexp are different
-      return false;                             // Return failure
-  return (this->startp[0] == rxp.startp[0] &&   // Else if same start/end ptrs,
-          this->endp[0] == rxp.endp[0]);        // Return true
-}
-
-// The remaining code in this file is derived from the  regular expression code
-// whose  copyright statement appears  below.  It has been  changed to work
-// with the class concepts of C++ and COOL.
-
-/*
- * compile and find
- *
- *      Copyright (c) 1986 by University of Toronto.
- *      Written by Henry Spencer.  Not derived from licensed software.
- *
- *      Permission is granted to anyone to use this software for any
- *      purpose on any computer system, and to redistribute it freely,
- *      subject to the following restrictions:
- *
- *      1. The author is not responsible for the consequences of use of
- *              this software, no matter how awful, even if they arise
- *              from defects in it.
- *
- *      2. The origin of this software must not be misrepresented, either
- *              by explicit claim or by omission.
- *
- *      3. Altered versions must be plainly marked as such, and must not
- *              be misrepresented as being the original software.
- *
- * Beware that some of this code is subtly aware of the way operator
- * precedence is structured in regular expressions.  Serious changes in
- * regular-expression syntax might require a total rethink.
- */
-
-/*
- * The "internal use only" fields in regexp.h are present to pass info from
- * compile to execute that permits the execute phase to run lots faster on
- * simple cases.  They are:
- *
- * regstart     char that must begin a match; '\0' if none obvious
- * reganch      is the match anchored (at beginning-of-line only)?
- * regmust      string (pointer into program) that match must include, or NULL
- * regmlen      length of regmust string
- *
- * Regstart and reganch permit very fast decisions on suitable starting points
- * for a match, cutting down the work a lot.  Regmust permits fast rejection
- * of lines that cannot possibly match.  The regmust tests are costly enough
- * that compile() supplies a regmust only if the r.e. contains something
- * potentially expensive (at present, the only such thing detected is * or +
- * at the start of the r.e., which can involve a lot of backup).  Regmlen is
- * supplied because the test in find() needs it and compile() is computing
- * it anyway.
- */
-
-/*
- * Structure for regexp "program".  This is essentially a linear encoding
- * of a nondeterministic finite-state machine (aka syntax charts or
- * "railroad normal form" in parsing technology).  Each node is an opcode
- * plus a "next" pointer, possibly plus an operand.  "Next" pointers of
- * all nodes except BRANCH implement concatenation; a "next" pointer with
- * a BRANCH on both ends of it is connecting two alternatives.  (Here we
- * have one of the subtle syntax dependencies:  an individual BRANCH (as
- * opposed to a collection of them) is never concatenated with anything
- * because of operator precedence.)  The operand of some types of node is
- * a literal string; for others, it is a node leading into a sub-FSM.  In
- * particular, the operand of a BRANCH node is the first node of the branch.
- * (NB this is *not* a tree structure:  the tail of the branch connects
- * to the thing following the set of BRANCHes.)  The opcodes are:
- */
-
-// definition   number  opnd?   meaning
-#define END     0               // no   End of program.
-#define BOL     1               // no   Match "" at beginning of line.
-#define EOL     2               // no   Match "" at end of line.
-#define ANY     3               // no   Match any one character.
-#define ANYOF   4               // str  Match any character in this string.
-#define ANYBUT  5               // str  Match any character not in this
-                                // string.
-#define BRANCH  6               // node Match this alternative, or the
-                                // next...
-#define BACK    7               // no   Match "", "next" ptr points backward.
-#define EXACTLY 8               // str  Match this string.
-#define NOTHING 9               // no   Match empty string.
-#define STAR    10              // node Match this (simple) thing 0 or more
-                                // times.
-#define PLUS    11              // node Match this (simple) thing 1 or more
-                                // times.
-#define OPEN    20              // no   Mark this point in input as start of
-                                // #n.
-// OPEN+1 is number 1, etc.
-#define CLOSE   30              // no   Analogous to OPEN.
-
-/*
- * Opcode notes:
- *
- * BRANCH       The set of branches constituting a single choice are hooked
- *              together with their "next" pointers, since precedence prevents
- *              anything being concatenated to any individual branch.  The
- *              "next" pointer of the last BRANCH in a choice points to the
- *              thing following the whole choice.  This is also where the
- *              final "next" pointer of each individual branch points; each
- *              branch starts with the operand node of a BRANCH node.
- *
- * BACK         Normal "next" pointers all implicitly point forward; BACK
- *              exists to make loop structures possible.
- *
- * STAR,PLUS    '?', and complex '*' and '+', are implemented as circular
- *              BRANCH structures using BACK.  Simple cases (one character
- *              per match) are implemented with STAR and PLUS for speed
- *              and to minimize recursive plunges.
- *
- * OPEN,CLOSE   ...are numbered at compile time.
- */
-
-/*
- * A node is one char of opcode followed by two chars of "next" pointer.
- * "Next" pointers are stored as two 8-bit pieces, high order first.  The
- * value is a positive offset from the opcode of the node containing it.
- * An operand, if any, simply follows the node.  (Note that much of the
- * code generation knows about this implicit relationship.)
- *
- * Using two bytes for the "next" pointer is vast overkill for most things,
- * but allows patterns to get big without disasters.
- */
-
-#define OP(p)           (*(p))
-#define NEXT(p)         (((*((p)+1)&0377)<<8) + (*((p)+2)&0377))
-#define OPERAND(p)      ((p) + 3)
-
-const unsigned char MAGIC = 0234;
-/*
- * Utility definitions.
- */
-
-#define UCHARAT(p)      (reinterpret_cast<const unsigned char*>(p))[0]
-
-
-#define FAIL(m) { regerror(m); return(0); }
-#define ISMULT(c)       ((c) == '*' || (c) == '+' || (c) == '?')
-#define META    "^$.[()|?+*\\"
-
-
-/*
- * Flags to be passed up and down.
- */
-#define HASWIDTH        01      // Known never to match null string.
-#define SIMPLE          02      // Simple enough to be STAR/PLUS operand.
-#define SPSTART         04      // Starts with * or +.
-#define WORST           0       // Worst case.
-
-
-
-/////////////////////////////////////////////////////////////////////////
-//
-//  COMPILE AND ASSOCIATED FUNCTIONS
-//
-/////////////////////////////////////////////////////////////////////////
-
-
-/*
- * Global work variables for compile().
- */
-static const char* regparse;    // Input-scan pointer.
-static       int   regnpar;     // () count.
-static       char  regdummy;
-static       char* regcode;     // Code-emit pointer; &regdummy = don't.
-static       long  regsize;     // Code size.
-
-/*
- * Forward declarations for compile()'s friends.
- */
-// #ifndef static
-// #define      static  static
-// #endif
-static       char* reg (int, int*);
-static       char* regbranch (int*);
-static       char* regpiece (int*);
-static       char* regatom (int*);
-static       char* regnode (char);
-static const char* regnext (const char*);
-static       char* regnext (char*);
-static void        regc (char);
-static void        reginsert (char, char*);
-static void        regtail (char*, const char*);
-static void        regoptail (char*, const char*);
-
-#ifdef STRCSPN
-static int strcspn ();
-#endif
-
-
-
-/*
- * We can't allocate space until we know how big the compiled form will be,
- * but we can't compile it (and thus know how big it is) until we've got a
- * place to put the code.  So we cheat:  we compile it twice, once with code
- * generation turned off and size counting turned on, and once "for real".
- * This also means that we don't allocate space until we are sure that the
- * thing really will compile successfully, and we never have to move the
- * code and thus invalidate pointers into it.  (Note that it has to be in
- * one piece because free() must be able to free it all.)
- *
- * Beware that the optimization-preparation code in here knows about some
- * of the structure of the compiled regexp.
- */
-
-
-// compile -- compile a regular expression into internal code
-// for later pattern matching.
-
-bool RegularExpression::compile (const char* exp) {
-    const char* scan;
-    const char* longest;
-    size_t      len;
-    int         flags;
-
-    if (exp == 0) {
-      //RAISE Error, SYM(RegularExpression), SYM(No_Expr),
-      printf ("RegularExpression::compile(): No expression supplied.\n");
-      return false;
-    }
-
-    // First pass: determine size, legality.
-    regparse = exp;
-    regnpar = 1;
-    regsize = 0L;
-    regcode = ®dummy;
-    regc(static_cast<char>(MAGIC));
-    if(!reg(0, &flags))
-      {
-        printf ("RegularExpression::compile(): Error in compile.\n");
-        return false;
-      }
-    this->startp[0] = this->endp[0] = this->searchstring = 0;
-
-    // Small enough for pointer-storage convention?
-    if (regsize >= 32767L) {    // Probably could be 65535L.
-      //RAISE Error, SYM(RegularExpression), SYM(Expr_Too_Big),
-      printf ("RegularExpression::compile(): Expression too big.\n");
-      return false;
-    }
-
-    // Allocate space.
-//#ifndef WIN32
-    if (this->program != 0) delete [] this->program;
-//#endif
-    this->program = new char[regsize];
-    this->progsize = static_cast<int>(regsize);
-
-    if (this->program == 0) {
-      //RAISE Error, SYM(RegularExpression), SYM(Out_Of_Memory),
-      printf ("RegularExpression::compile(): Out of memory.\n");
-      return false;
-    }
-
-    // Second pass: emit code.
-    regparse = exp;
-    regnpar = 1;
-    regcode = this->program;
-    regc(static_cast<char>(MAGIC));
-    reg(0, &flags);
-
-    // Dig out information for optimizations.
-    this->regstart = '\0';              // Worst-case defaults.
-    this->reganch = 0;
-    this->regmust = 0;
-    this->regmlen = 0;
-    scan = this->program + 1;   // First BRANCH.
-    if (OP(regnext(scan)) == END) {     // Only one top-level choice.
-        scan = OPERAND(scan);
-
-        // Starting-point info.
-        if (OP(scan) == EXACTLY)
-            this->regstart = *OPERAND(scan);
-        else if (OP(scan) == BOL)
-            this->reganch++;
-
-         //
-         // If there's something expensive in the r.e., find the longest
-         // literal string that must appear and make it the regmust.  Resolve
-         // ties in favor of later strings, since the regstart check works
-         // with the beginning of the r.e. and avoiding duplication
-         // strengthens checking.  Not a strong reason, but sufficient in the
-         // absence of others.
-         //
-        if (flags & SPSTART) {
-            longest = 0;
-            len = 0;
-            for (; scan != 0; scan = regnext(scan))
-                if (OP(scan) == EXACTLY && strlen(OPERAND(scan)) >= len) {
-                    longest = OPERAND(scan);
-                    len = strlen(OPERAND(scan));
-                }
-            this->regmust = longest;
-            this->regmlen = len;
-        }
-    }
-    return true;
-}
-
-
-/*
- - reg - regular expression, i.e. main body or parenthesized thing
- *
- * Caller must absorb opening parenthesis.
- *
- * Combining parenthesis handling with the base level of regular expression
- * is a trifle forced, but the need to tie the tails of the branches to what
- * follows makes it hard to avoid.
- */
-static char* reg (int paren, int *flagp) {
-    char* ret;
-    char* br;
-    char* ender;
-    int   parno =0;
-    int   flags;
-
-    *flagp = HASWIDTH;          // Tentatively.
-
-    // Make an OPEN node, if parenthesized.
-    if (paren) {
-        if (regnpar >=  RegularExpression::NSUBEXP) {
-          //RAISE Error, SYM(RegularExpression), SYM(Too_Many_Parens),
-          printf ("RegularExpression::compile(): Too many parentheses.\n");
-          return 0;
-        }
-        parno = regnpar;
-        regnpar++;
-        ret = regnode(static_cast<char>(OPEN + parno));
-    }
-    else
-        ret = 0;
-
-    // Pick up the branches, linking them together.
-    br = regbranch(&flags);
-    if (br == 0)
-        return (0);
-    if (ret != 0)
-        regtail(ret, br);       // OPEN -> first.
-    else
-        ret = br;
-    if (!(flags & HASWIDTH))
-        *flagp &= ~HASWIDTH;
-    *flagp |= flags & SPSTART;
-    while (*regparse == '|') {
-        regparse++;
-        br = regbranch(&flags);
-        if (br == 0)
-            return (0);
-        regtail(ret, br);       // BRANCH -> BRANCH.
-        if (!(flags & HASWIDTH))
-            *flagp &= ~HASWIDTH;
-        *flagp |= flags & SPSTART;
-      }
-
-    // Make a closing node, and hook it on the end.
-    ender = regnode(static_cast<char>((paren) ? CLOSE + parno : END));
-    regtail(ret, ender);
-
-    // Hook the tails of the branches to the closing node.
-    for (br = ret; br != 0; br = regnext(br))
-        regoptail(br, ender);
-
-    // Check for proper termination.
-    if (paren && *regparse++ != ')') {
-        //RAISE Error, SYM(RegularExpression), SYM(Unmatched_Parens),
-        printf ("RegularExpression::compile(): Unmatched parentheses.\n");
-        return 0;
-    }
-    else if (!paren && *regparse != '\0') {
-        if (*regparse == ')') {
-            //RAISE Error, SYM(RegularExpression), SYM(Unmatched_Parens),
-            printf ("RegularExpression::compile(): Unmatched parentheses.\n");
-            return 0;
-        }
-        else {
-            //RAISE Error, SYM(RegularExpression), SYM(Internal_Error),
-            printf ("RegularExpression::compile(): Internal error.\n");
-            return 0;
-        }
-        // NOTREACHED
-    }
-    return (ret);
-}
-
-
-/*
- - regbranch - one alternative of an | operator
- *
- * Implements the concatenation operator.
- */
-static char* regbranch (int *flagp) {
-    char* ret;
-    char* chain;
-    char* latest;
-    int   flags;
-
-    *flagp = WORST;             // Tentatively.
-
-    ret = regnode(BRANCH);
-    chain = 0;
-    while (*regparse != '\0' && *regparse != '|' && *regparse != ')') {
-        latest = regpiece(&flags);
-        if (latest == 0)
-            return (0);
-        *flagp |= flags & HASWIDTH;
-        if (chain == 0) // First piece.
-            *flagp |= flags & SPSTART;
-        else
-            regtail(chain, latest);
-        chain = latest;
-    }
-    if (chain == 0)             // Loop ran zero times.
-        regnode(NOTHING);
-
-    return (ret);
-}
-
-
-/*
- - regpiece - something followed by possible [*+?]
- *
- * Note that the branching code sequences used for ? and the general cases
- * of * and + are somewhat optimized:  they use the same NOTHING node as
- * both the endmarker for their branch list and the body of the last branch.
- * It might seem that this node could be dispensed with entirely, but the
- * endmarker role is not redundant.
- */
-static char* regpiece (int *flagp) {
-    char* ret;
-    char  op;
-    char* next;
-    int   flags;
-
-    ret = regatom(&flags);
-    if (ret == 0)
-        return (0);
-
-    op = *regparse;
-    if (!ISMULT(op)) {
-        *flagp = flags;
-        return (ret);
-    }
-
-    if (!(flags & HASWIDTH) && op != '?') {
-        //RAISE Error, SYM(RegularExpression), SYM(Empty_Operand),
-        printf ("RegularExpression::compile() : *+ operand could be empty.\n");
-        return 0;
-    }
-    *flagp = (op != '+') ? (WORST | SPSTART) : (WORST | HASWIDTH);
-
-    if (op == '*' && (flags & SIMPLE))
-        reginsert(STAR, ret);
-    else if (op == '*') {
-        // Emit x* as (x&|), where & means "self".
-        reginsert(BRANCH, ret); // Either x
-        regoptail(ret, regnode(BACK));  // and loop
-        regoptail(ret, ret);    // back
-        regtail(ret, regnode(BRANCH));  // or
-        regtail(ret, regnode(NOTHING)); // null.
-    }
-    else if (op == '+' && (flags & SIMPLE))
-        reginsert(PLUS, ret);
-    else if (op == '+') {
-        // Emit x+ as x(&|), where & means "self".
-        next = regnode(BRANCH); // Either
-        regtail(ret, next);
-        regtail(regnode(BACK), ret);    // loop back
-        regtail(next, regnode(BRANCH)); // or
-        regtail(ret, regnode(NOTHING)); // null.
-    }
-    else if (op == '?') {
-        // Emit x? as (x|)
-        reginsert(BRANCH, ret); // Either x
-        regtail(ret, regnode(BRANCH));  // or
-        next = regnode(NOTHING);// null.
-        regtail(ret, next);
-        regoptail(ret, next);
-    }
-    regparse++;
-    if (ISMULT(*regparse)) {
-        //RAISE Error, SYM(RegularExpression), SYM(Nested_Operand),
-        printf ("RegularExpression::compile(): Nested *?+.\n");
-        return 0;
-    }
-    return (ret);
-}
-
-
-/*
- - regatom - the lowest level
- *
- * Optimization:  gobbles an entire sequence of ordinary characters so that
- * it can turn them into a single node, which is smaller to store and
- * faster to run.  Backslashed characters are exceptions, each becoming a
- * separate node; the code is simpler that way and it's not worth fixing.
- */
-static char* regatom (int *flagp) {
-    char* ret;
-    int   flags;
-
-    *flagp = WORST;             // Tentatively.
-
-    switch (*regparse++) {
-        case '^':
-            ret = regnode(BOL);
-            break;
-        case '$':
-            ret = regnode(EOL);
-            break;
-        case '.':
-            ret = regnode(ANY);
-            *flagp |= HASWIDTH | SIMPLE;
-            break;
-        case '[':{
-                int    rxpclass;
-                int    rxpclassend;
-
-                if (*regparse == '^') { // Complement of range.
-                    ret = regnode(ANYBUT);
-                    regparse++;
-                }
-                else
-                    ret = regnode(ANYOF);
-                if (*regparse == ']' || *regparse == '-')
-                    regc(*regparse++);
-                while (*regparse != '\0' && *regparse != ']') {
-                    if (*regparse == '-') {
-                        regparse++;
-                        if (*regparse == ']' || *regparse == '\0')
-                            regc('-');
-                        else {
-                            rxpclass = UCHARAT(regparse - 2) + 1;
-                            rxpclassend = UCHARAT(regparse);
-                            if (rxpclass > rxpclassend + 1) {
-                               //RAISE Error, SYM(RegularExpression), SYM(Invalid_Range),
-                               printf ("RegularExpression::compile(): Invalid range in [].\n");
-                               return 0;
-                            }
-                            for (; rxpclass <= rxpclassend; rxpclass++)
-                              regc(static_cast<char>(rxpclass));
-                            regparse++;
-                        }
-                    }
-                    else
-                        regc(*regparse++);
-                }
-                regc('\0');
-                if (*regparse != ']') {
-                    //RAISE Error, SYM(RegularExpression), SYM(Unmatched_Bracket),
-                    printf ("RegularExpression::compile(): Unmatched [].\n");
-                    return 0;
-                }
-                regparse++;
-                *flagp |= HASWIDTH | SIMPLE;
-            }
-            break;
-        case '(':
-            ret = reg(1, &flags);
-            if (ret == 0)
-                return (0);
-            *flagp |= flags & (HASWIDTH | SPSTART);
-            break;
-        case '\0':
-        case '|':
-        case ')':
-            //RAISE Error, SYM(RegularExpression), SYM(Internal_Error),
-            printf ("RegularExpression::compile(): Internal error.\n"); // Never here
-            return 0;
-        case '?':
-        case '+':
-        case '*':
-            //RAISE Error, SYM(RegularExpression), SYM(No_Operand),
-            printf ("RegularExpression::compile(): ?+* follows nothing.\n");
-            return 0;
-        case '\\':
-            if (*regparse == '\0') {
-                //RAISE Error, SYM(RegularExpression), SYM(Trailing_Backslash),
-                printf ("RegularExpression::compile(): Trailing backslash.\n");
-                return 0;
-            }
-            ret = regnode(EXACTLY);
-            regc(*regparse++);
-            regc('\0');
-            *flagp |= HASWIDTH | SIMPLE;
-            break;
-        default:{
-                int    len;
-                char   ender;
-
-                regparse--;
-                len = int(strcspn(regparse, META));
-                if (len <= 0) {
-                    //RAISE Error, SYM(RegularExpression), SYM(Internal_Error),
-                    printf ("RegularExpression::compile(): Internal error.\n");
-                    return 0;
-                }
-                ender = *(regparse + len);
-                if (len > 1 && ISMULT(ender))
-                    len--;      // Back off clear of ?+* operand.
-                *flagp |= HASWIDTH;
-                if (len == 1)
-                    *flagp |= SIMPLE;
-                ret = regnode(EXACTLY);
-                while (len > 0) {
-                    regc(*regparse++);
-                    len--;
-                }
-                regc('\0');
-            }
-            break;
-    }
-    return (ret);
-}
-
-
-/*
- - regnode - emit a node
-   Location.
- */
-static char* regnode (char op) {
-    char* ret;
-    char* ptr;
-
-    ret = regcode;
-    if (ret == &regdummy) {
-        regsize += 3;
-        return (ret);
-    }
-
-    ptr = ret;
-    *ptr++ = op;
-    *ptr++ = '\0';              // Null "next" pointer.
-    *ptr++ = '\0';
-    regcode = ptr;
-
-    return (ret);
-}
-
-
-/*
- - regc - emit (if appropriate) a byte of code
- */
-static void regc (char b) {
-    if (regcode != &regdummy)
-        *regcode++ = b;
-    else
-        regsize++;
-}
-
-
-/*
- - reginsert - insert an operator in front of already-emitted operand
- *
- * Means relocating the operand.
- */
-static void reginsert (char op, char* opnd) {
-    char* src;
-    char* dst;
-    char* place;
-
-    if (regcode == &regdummy) {
-        regsize += 3;
-        return;
-    }
-
-    src = regcode;
-    regcode += 3;
-    dst = regcode;
-    while (src > opnd)
-        *--dst = *--src;
-
-    place = opnd;               // Op node, where operand used to be.
-    *place++ = op;
-    *place++ = '\0';
-    *place = '\0';
-}
-
-
-/*
- - regtail - set the next-pointer at the end of a node chain
- */
-static void regtail (char* p, const char* val) {
-    char* scan;
-    char* temp;
-    int   offset;
-
-    if (p == &regdummy)
-        return;
-
-    // Find last node.
-    scan = p;
-    for (;;) {
-        temp = regnext(scan);
-        if (temp == 0)
-            break;
-        scan = temp;
-    }
-
-    if (OP(scan) == BACK)
-        offset = int(scan - val);
-    else
-        offset = int(val - scan);
-    *(scan + 1) = static_cast<char>((offset >> 8) & 0377);
-    *(scan + 2) = static_cast<char>(offset & 0377);
-}
-
-
-/*
- - regoptail - regtail on operand of first argument; nop if operandless
- */
-static void regoptail (char* p, const char* val) {
-    // "Operandless" and "op != BRANCH" are synonymous in practice.
-    if (p == 0 || p == &regdummy || OP(p) != BRANCH)
-        return;
-    regtail(OPERAND(p), val);
-}
-
-
-
-////////////////////////////////////////////////////////////////////////
-// 
-//  find and friends
-// 
-////////////////////////////////////////////////////////////////////////
-
-
-/*
- * Global work variables for find().
- */
-static const char*  reginput;   // String-input pointer.
-static const char*  regbol;     // Beginning of input, for ^ check.
-static const char* *regstartp;  // Pointer to startp array.
-static const char* *regendp;    // Ditto for endp.
-
-/*
- * Forwards.
- */
-static int regtry (const char*, const char* *,
-                   const char* *, const char*);
-static int regmatch (const char*);
-static int regrepeat (const char*);
-
-#ifdef DEBUG
-int          regnarrate = 0;
-void         regdump ();
-static char* regprop ();
-#endif
-
-// find -- Matches the regular expression to the given string.
-// Returns true if found, and sets start and end indexes accordingly.
-
-bool RegularExpression::find (const char* string) {
-    const char* s;
-
-    this->searchstring = string;
-
-    if (!this->program)
-      {
-      return false;
-      }
-
-    // Check validity of program.
-    if (UCHARAT(this->program) != MAGIC) {
-        //RAISE Error, SYM(RegularExpression), SYM(Internal_Error),
-        printf ("RegularExpression::find(): Compiled regular expression corrupted.\n");
-        return 0;
-    }
-
-    // If there is a "must appear" string, look for it.
-    if (this->regmust != 0) {
-        s = string;
-        while ((s = strchr(s, this->regmust[0])) != 0) {
-            if (strncmp(s, this->regmust, this->regmlen) == 0)
-                break;          // Found it.
-            s++;
-        }
-        if (s == 0)             // Not present.
-            return (0);
-    }
-
-    // Mark beginning of line for ^ .
-    regbol = string;
-
-    // Simplest case:  anchored match need be tried only once.
-    if (this->reganch)
-        return (regtry(string, this->startp, this->endp, this->program) != 0);
-
-    // Messy cases:  unanchored match.
-    s = string;
-    if (this->regstart != '\0')
-        // We know what char it must start with.
-        while ((s = strchr(s, this->regstart)) != 0) {
-            if (regtry(s, this->startp, this->endp, this->program))
-                return (1);
-            s++;
-
-        }
-    else
-        // We don't -- general case.
-        do {
-            if (regtry(s, this->startp, this->endp, this->program))
-                return (1);
-        } while (*s++ != '\0');
-
-    // Failure.
-    return (0);
-}
-
-
-/*
- - regtry - try match at specific point
-   0 failure, 1 success
- */
-static int regtry (const char* string, const char* *start,
-                   const char* *end, const char* prog) {
-                   int    i;
-                   const char* *sp1;
-                   const char* *ep;
-
-    reginput = string;
-    regstartp = start;
-    regendp = end;
-
-    sp1 = start;
-    ep = end;
-    for (i = RegularExpression::NSUBEXP; i > 0; i--) {
-        *sp1++ = 0;
-        *ep++ = 0;
-    }
-    if (regmatch(prog + 1)) {
-        start[0] = string;
-        end[0] = reginput;
-        return (1);
-    }
-    else
-        return (0);
-}
-
-
-/*
- - regmatch - main matching routine
- *
- * Conceptually the strategy is simple:  check to see whether the current
- * node matches, call self recursively to see whether the rest matches,
- * and then act accordingly.  In practice we make some effort to avoid
- * recursion, in particular by going through "ordinary" nodes (that don't
- * need to know whether the rest of the match failed) by a loop instead of
- * by recursion.
- * 0 failure, 1 success
- */
-static int regmatch (const char* prog) {
-    const char* scan;  // Current node.
-    const char* next;  // Next node.
-
-    scan = prog;
-
-    while (scan != 0) {
-
-        next = regnext(scan);
-
-        switch (OP(scan)) {
-            case BOL:
-                if (reginput != regbol)
-                    return (0);
-                break;
-            case EOL:
-                if (*reginput != '\0')
-                    return (0);
-                break;
-            case ANY:
-                if (*reginput == '\0')
-                    return (0);
-                reginput++;
-                break;
-            case EXACTLY:{
-                    size_t len;
-                    const char* opnd;
-
-                    opnd = OPERAND(scan);
-                    // Inline the first character, for speed.
-                    if (*opnd != *reginput)
-                        return (0);
-                    len = strlen(opnd);
-                    if (len > 1 && strncmp(opnd, reginput, len) != 0)
-                        return (0);
-                    reginput += len;
-                }
-                break;
-            case ANYOF:
-                if (*reginput == '\0' || strchr(OPERAND(scan), *reginput) == 0)
-                    return (0);
-                reginput++;
-                break;
-            case ANYBUT:
-                if (*reginput == '\0' || strchr(OPERAND(scan), *reginput) != 0)
-                    return (0);
-                reginput++;
-                break;
-            case NOTHING:
-                break;
-            case BACK:
-                break;
-            case OPEN + 1:
-            case OPEN + 2:
-            case OPEN + 3:
-            case OPEN + 4:
-            case OPEN + 5:
-            case OPEN + 6:
-            case OPEN + 7:
-            case OPEN + 8:
-            case OPEN + 9:{
-                    int    no;
-                    const char* save;
-
-                    no = OP(scan) - OPEN;
-                    save = reginput;
-
-                    if (regmatch(next)) {
-
-                        //
-                        // Don't set startp if some later invocation of the
-                        // same parentheses already has.
-                        //
-                        if (regstartp[no] == 0)
-                            regstartp[no] = save;
-                        return (1);
-                    }
-                    else
-                        return (0);
-                }
-//              break;
-            case CLOSE + 1:
-            case CLOSE + 2:
-            case CLOSE + 3:
-            case CLOSE + 4:
-            case CLOSE + 5:
-            case CLOSE + 6:
-            case CLOSE + 7:
-            case CLOSE + 8:
-            case CLOSE + 9:{
-                    int    no;
-                    const char* save;
-
-                    no = OP(scan) - CLOSE;
-                    save = reginput;
-
-                    if (regmatch(next)) {
-
-                        //
-                        // Don't set endp if some later invocation of the
-                        // same parentheses already has.
-                        //
-                        if (regendp[no] == 0)
-                            regendp[no] = save;
-                        return (1);
-                    }
-                    else
-                        return (0);
-                }
-//              break;
-            case BRANCH:{
-
-              const char* save;
-
-                    if (OP(next) != BRANCH)     // No choice.
-                        next = OPERAND(scan);   // Avoid recursion.
-                    else {
-                        do {
-                            save = reginput;
-                            if (regmatch(OPERAND(scan)))
-                                return (1);
-                            reginput = save;
-                            scan = regnext(scan);
-                        } while (scan != 0 && OP(scan) == BRANCH);
-                        return (0);
-                        // NOTREACHED
-                    }
-                }
-                break;
-            case STAR:
-            case PLUS:{
-                    char   nextch;
-                    int        no;
-                    const char* save;
-                    int        min_no;
-
-                    //
-                    // Lookahead to avoid useless match attempts when we know
-                    // what character comes next.
-                    //
-                    nextch = '\0';
-                    if (OP(next) == EXACTLY)
-                        nextch = *OPERAND(next);
-                    min_no = (OP(scan) == STAR) ? 0 : 1;
-                    save = reginput;
-                    no = regrepeat(OPERAND(scan));
-                    while (no >= min_no) {
-                        // If it could work, try it.
-                        if (nextch == '\0' || *reginput == nextch)
-                            if (regmatch(next))
-                                return (1);
-                        // Couldn't or didn't -- back up.
-                        no--;
-                        reginput = save + no;
-                    }
-                    return (0);
-                }
-//              break;
-            case END:
-                return (1);     // Success!
-
-            default:
-                //RAISE Error, SYM(RegularExpression), SYM(Internal_Error),
-                printf ("RegularExpression::find(): Internal error -- memory corrupted.\n");
-                return 0;
-        }
-        scan = next;
-    }
-
-    //
-    //  We get here only if there's trouble -- normally "case END" is the
-    //  terminating point.
-    //
-    //RAISE Error, SYM(RegularExpression), SYM(Internal_Error),
-    printf ("RegularExpression::find(): Internal error -- corrupted pointers.\n");
-    return (0);
-}
-
-
-/*
- - regrepeat - repeatedly match something simple, report how many
- */
-static int regrepeat (const char* p) {
-    int         count = 0;
-    const char* scan;
-    const char* opnd;
-
-    scan = reginput;
-    opnd = OPERAND(p);
-    switch (OP(p)) {
-        case ANY:
-            count = int(strlen(scan));
-            scan += count;
-            break;
-        case EXACTLY:
-            while (*opnd == *scan) {
-                count++;
-                scan++;
-            }
-            break;
-        case ANYOF:
-            while (*scan != '\0' && strchr(opnd, *scan) != 0) {
-                count++;
-                scan++;
-            }
-            break;
-        case ANYBUT:
-            while (*scan != '\0' && strchr(opnd, *scan) == 0) {
-                count++;
-                scan++;
-            }
-            break;
-        default:                // Oh dear.  Called inappropriately.
-            //RAISE Error, SYM(RegularExpression), SYM(Internal_Error),
-            printf ("cm RegularExpression::find(): Internal error.\n");
-            return 0;
-    }
-    reginput = scan;
-    return (count);
-}
-
-
-/*
- - regnext - dig the "next" pointer out of a node
- */
-static const char* regnext (const char* p) {
-    int offset;
-
-    if (p == &regdummy)
-        return (0);
-
-    offset = NEXT(p);
-    if (offset == 0)
-        return (0);
-
-    if (OP(p) == BACK)
-        return (p - offset);
-    else
-        return (p + offset);
-}
-
-static char* regnext (char* p) {
-    int offset;
-
-    if (p == &regdummy)
-        return (0);
-
-    offset = NEXT(p);
-    if (offset == 0)
-        return (0);
-
-    if (OP(p) == BACK)
-        return (p - offset);
-    else
-        return (p + offset);
-}
-
-} // namespace KWSYS_NAMESPACE
diff --git a/src/kwsys/RegularExpression.hxx.in b/src/kwsys/RegularExpression.hxx.in
deleted file mode 100644
index 502fbe2..0000000
--- a/src/kwsys/RegularExpression.hxx.in
+++ /dev/null
@@ -1,453 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-// Original Copyright notice:
-// Copyright (C) 1991 Texas Instruments Incorporated.
-//
-// Permission is granted to any individual or institution to use, copy, modify,
-// and distribute this software, provided that this complete copyright and
-// permission notice is maintained, intact, in all copies and supporting
-// documentation.
-//
-// Texas Instruments Incorporated provides this software "as is" without
-// express or implied warranty.
-//
-// Created: MNF 06/13/89  Initial Design and Implementation
-// Updated: LGO 08/09/89  Inherit from Generic
-// Updated: MBN 09/07/89  Added conditional exception handling
-// Updated: MBN 12/15/89  Sprinkled "const" qualifiers all over the place!
-// Updated: DLS 03/22/91  New lite version
-//
-
-#ifndef @KWSYS_NAMESPACE at _RegularExpression_hxx
-#define @KWSYS_NAMESPACE at _RegularExpression_hxx
-
-#include <@KWSYS_NAMESPACE@/Configure.h>
-#include <@KWSYS_NAMESPACE@/Configure.hxx>
-
-#include <@KWSYS_NAMESPACE@/stl/string>
-
-/* Define this macro temporarily to keep the code readable.  */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
-# define kwsys_stl @KWSYS_NAMESPACE at _stl
-#endif
-
-/* Disable useless Borland warnings.  KWSys tries not to force things
-   on its includers, but there is no choice here.  */
-#if defined(__BORLANDC__)
-# pragma warn -8027 /* function not inlined.  */
-#endif
-
-namespace @KWSYS_NAMESPACE@
-{
-
-/** \class RegularExpression
- * \brief Implements pattern matching with regular expressions.
- *
- * This is the header file for the regular expression class.  An object of
- * this class contains a regular expression, in a special "compiled" format.
- * This compiled format consists of several slots all kept as the objects
- * private data.  The RegularExpression class provides a convenient way to
- * represent regular expressions.  It makes it easy to search for the same
- * regular expression in many different strings without having to compile a
- * string to regular expression format more than necessary.
- *
- * This class implements pattern matching via regular expressions.
- * A regular expression allows a programmer to specify  complex
- * patterns  that  can  be searched for and matched against the
- * character string of a string object. In its simplest form, a
- * regular  expression  is  a  sequence  of  characters used to
- * search for exact character matches. However, many times  the
- * exact  sequence to be found is not known, or only a match at
- * the beginning or end of a string is desired. The RegularExpression regu-
- * lar  expression  class implements regular expression pattern
- * matching as is found and implemented in many  UNIX  commands
- * and utilities.
- *
- * Example: The perl code
- * 
- *    $filename =~ m"([a-z]+)\.cc";
- *    print $1;
- *    
- * Is written as follows in C++
- *
- *    RegularExpression re("([a-z]+)\\.cc");
- *    re.find(filename);
- *    cerr << re.match(1);
- *
- *
- * The regular expression class provides a convenient mechanism
- * for  specifying  and  manipulating  regular expressions. The
- * regular expression object allows specification of such  pat-
- * terns  by using the following regular expression metacharac-
- * ters:
- *
- *  ^        Matches at beginning of a line
- *
- *  $        Matches at end of a line
- *
- * .         Matches any single character
- *
- * [ ]       Matches any character(s) inside the brackets
- *
- * [^ ]      Matches any character(s) not inside the brackets
- *
- *  -        Matches any character in range on either side of a dash
- *
- *  *        Matches preceding pattern zero or more times
- *
- *  +        Matches preceding pattern one or more times
- *
- *  ?        Matches preceding pattern zero or once only
- *
- * ()        Saves a matched expression and uses it in a  later match
- *
- * Note that more than one of these metacharacters can be  used
- * in  a  single  regular expression in order to create complex
- * search patterns. For example, the pattern [^ab1-9]  says  to
- * match  any  character  sequence that does not begin with the
- * characters "ab"  followed  by  numbers  in  the  series  one
- * through nine.
- *
- * There are three constructors for RegularExpression.  One just creates an
- * empty RegularExpression object.  Another creates a RegularExpression
- * object and initializes it with a regular expression that is given in the
- * form of a char*.  The third takes a reference to a RegularExpression
- * object as an argument and creates an object initialized with the
- * information from the given RegularExpression object.
- *
- * The  find  member function  finds   the  first  occurence   of  the regualr
- * expression of that object in the string given to find as an argument.  Find
- * returns a boolean, and  if true,  mutates  the private  data appropriately.
- * Find sets pointers to the beginning and end of  the thing last  found, they
- * are pointers into the actual string  that was searched.   The start and end
- * member functions return indicies  into the searched string that  correspond
- * to the beginning   and  end pointers  respectively.   The    compile member
- * function takes a char* and puts the  compiled version of the char* argument
- * into the object's private data fields.  The == and  != operators only check
- * the  to see  if   the compiled  regular  expression   is the same, and  the
- * deep_equal functions also checks  to see if the  start and end pointers are
- * the same.  The is_valid  function returns false if  program is set to NULL,
- * (i.e. there is no valid compiled exression).  The set_invalid function sets
- * the  program to NULL  (Warning: this deletes the compiled  expression). The
- * following examples may help clarify regular expression usage:
- *
- *   *  The regular expression  "^hello" matches  a "hello"  only at  the
- *      beginning of a  line.  It would match "hello  there" but not "hi,
- *      hello there".
- *
- *   *  The regular expression "long$" matches a  "long"  only at the end
- *      of a line. It would match "so long\0", but not "long ago".
- *
- *   *  The regular expression "t..t..g"  will match anything that  has a
- *      "t" then any two characters, another "t", any  two characters and
- *      then a "g".   It will match  "testing", or "test again" but would
- *      not match "toasting"
- *
- *   *  The regular  expression "[1-9ab]" matches any  number one through
- *      nine, and the characters  "a" and  "b".  It would match "hello 1"
- *      or "begin", but would not match "no-match".
- *
- *   *  The  regular expression "[^1-9ab]"  matches any character that is
- *      not a number one  through nine, or  an "a" or "b".   It would NOT
- *      match "hello 1" or "begin", but would match "no-match".
- *
- *   *  The regular expression "br* " matches  something that begins with
- *      a "b", is followed by zero or more "r"s, and ends in a space.  It
- *      would match "brrrrr ", and "b ", but would not match "brrh ".
- *
- *   *  The regular expression "br+ " matches something  that begins with
- *      a "b", is followed by one or more "r"s, and ends in  a space.  It
- *      would match "brrrrr ",  and  "br ", but would not  match "b  " or
- *      "brrh ".
- *
- *   *  The regular expression "br? " matches  something that begins with
- *      a "b", is followed by zero or one "r"s, and ends in  a space.  It
- *      would  match  "br ", and "b  ", but would not match  "brrrr "  or
- *      "brrh ".
- *
- *   *  The regular expression "(..p)b" matches  something ending with pb
- *      and beginning with whatever the two characters before the first p
- *      encounterd in the line were.  It would find  "repb" in "rep drepa
- *      qrepb".  The regular expression "(..p)a"  would find "repa qrepb"
- *      in "rep drepa qrepb"
- *
- *   *  The regular expression "d(..p)" matches something ending  with p,
- *      beginning with d, and having  two characters  in between that are
- *      the same as the two characters before  the first p  encounterd in
- *      the line.  It would match "drepa qrepb" in "rep drepa qrepb".
- *
- */
-class @KWSYS_NAMESPACE at _EXPORT RegularExpression 
-{
-public:
-  /**
-   * Instantiate RegularExpression with program=NULL.
-   */
-  inline RegularExpression ();        
-
-  /**
-   * Instantiate RegularExpression with compiled char*.
-   */
-  inline RegularExpression (char const*);
-
-  /**
-   * Instantiate RegularExpression as a copy of another regular expression.
-   */
-  RegularExpression (RegularExpression const&);
-
-  /**
-   * Instantiate RegularExpression with compiled string.
-   */
-  inline RegularExpression (kwsys_stl::string const&);
-
-  /**
-   * Destructor.
-   */
-  inline ~RegularExpression();
-
-  /**
-   * Compile a regular expression into internal code
-   * for later pattern matching.
-   */
-  bool compile (char const*);
-
-  /**
-   * Compile a regular expression into internal code
-   * for later pattern matching.
-   */
-  inline bool compile (kwsys_stl::string const&);
-
-  /**
-   * Matches the regular expression to the given string.
-   * Returns true if found, and sets start and end indexes accordingly.
-   */
-  bool find (char const*);
-
-  /**
-   * Matches the regular expression to the given std string.
-   * Returns true if found, and sets start and end indexes accordingly.
-   */
-  inline bool find (kwsys_stl::string const&);
-
-  /**
-   * Index to start of first find.
-   */
-  inline kwsys_stl::string::size_type start() const;
-
-  /**
-   * Index to end of first find.
-   */
-  inline kwsys_stl::string::size_type end() const;
-
-  /**
-   * Copy the given regular expression.
-   */
-  RegularExpression& operator= (const RegularExpression& rxp);
-
-  /**
-   * Returns true if two regular expressions have the same
-   * compiled program for pattern matching.
-   */
-  bool operator== (RegularExpression const&) const;
-
-  /**
-   * Returns true if two regular expressions have different
-   * compiled program for pattern matching.
-   */
-  inline bool operator!= (RegularExpression const&) const;
-
-  /**
-   * Returns true if have the same compiled regular expressions
-   * and the same start and end pointers.
-   */
-  bool deep_equal (RegularExpression const&) const;
-  
-  /**
-   * True if the compiled regexp is valid.
-   */
-  inline bool is_valid() const;
-
-  /**
-   * Marks the regular expression as invalid.
-   */
-  inline void set_invalid();            
-
-  /**
-   * Destructor.
-   */
-  // awf added
-  kwsys_stl::string::size_type start(int n) const;
-  kwsys_stl::string::size_type end(int n) const;
-  kwsys_stl::string match(int n) const;
-  
-  enum { NSUBEXP = 10 };
-private: 
-  const char* startp[NSUBEXP];
-  const char* endp[NSUBEXP];
-  char  regstart;                       // Internal use only
-  char  reganch;                        // Internal use only
-  const char* regmust;                  // Internal use only
-  kwsys_stl::string::size_type regmlen;                // Internal use only
-  char* program;   
-  int   progsize;
-  const char* searchstring;
-};
-
-/**
- * Create an empty regular expression.
- */
-inline RegularExpression::RegularExpression () 
-{ 
-  this->program = 0;
-}
-
-/**
- * Creates a regular expression from string s, and
- * compiles s.
- */
-inline RegularExpression::RegularExpression (const char* s) 
-{  
-  this->program = 0;
-  if ( s )
-    {
-    this->compile(s);
-    }
-}
-
-/**
- * Creates a regular expression from string s, and
- * compiles s.
- */
-inline RegularExpression::RegularExpression (const kwsys_stl::string& s)
-{
-  this->program = 0;
-  this->compile(s);
-}
-
-/**
- * Destroys and frees space allocated for the regular expression.
- */
-inline RegularExpression::~RegularExpression () 
-{
-//#ifndef WIN32
-  delete [] this->program;
-//#endif
-}
-
-/**
- * Compile a regular expression into internal code
- * for later pattern matching.
- */
-inline bool RegularExpression::compile (kwsys_stl::string const& s)
-{
-  return this->compile(s.c_str());
-}
-
-/**
- * Matches the regular expression to the given std string.
- * Returns true if found, and sets start and end indexes accordingly.
- */
-inline bool RegularExpression::find (kwsys_stl::string const& s)
-{
-  return this->find(s.c_str());
-}
-
-/**
- * Set the start position for the regular expression.
- */
-inline kwsys_stl::string::size_type RegularExpression::start () const 
-{
-  return static_cast<kwsys_stl::string::size_type>(
-    this->startp[0] - searchstring);
-}
-
-
-/**
- * Returns the start/end index of the last item found.
- */
-inline kwsys_stl::string::size_type RegularExpression::end () const 
-{
-  return static_cast<kwsys_stl::string::size_type>(
-    this->endp[0] - searchstring);
-}
-
-/**
- * Returns true if two regular expressions have different
- * compiled program for pattern matching.
- */
-inline bool RegularExpression::operator!= (const RegularExpression& r) const 
-{
-  return(!(*this == r));
-}
-
-/**
- * Returns true if a valid regular expression is compiled
- * and ready for pattern matching.
- */
-inline bool RegularExpression::is_valid () const 
-{
-  return (this->program != 0);
-}
-
-
-inline void RegularExpression::set_invalid () 
-{
-//#ifndef WIN32
-  delete [] this->program;
-//#endif
-  this->program = 0;
-}
-
-/**
- * Return start index of nth submatch. start(0) is the start of the full match.
- */
-inline kwsys_stl::string::size_type RegularExpression::start(int n) const
-{
-  return static_cast<kwsys_stl::string::size_type>(
-    this->startp[n] - searchstring);
-}
-
-
-/**
- * Return end index of nth submatch. end(0) is the end of the full match.
- */
-inline kwsys_stl::string::size_type RegularExpression::end(int n) const
-{
-  return static_cast<kwsys_stl::string::size_type>(
-    this->endp[n] - searchstring);
-}
-
-/**
- * Return nth submatch as a string.
- */
-inline kwsys_stl::string RegularExpression::match(int n) const
-{
-  if (this->startp[n]==0)
-    {
-    return kwsys_stl::string("");
-    }
-  else
-    {
-    return kwsys_stl::string(this->startp[n],
-                             static_cast<kwsys_stl::string::size_type>(
-                               this->endp[n] - this->startp[n]));
-    }
-}
-
-} // namespace @KWSYS_NAMESPACE@
-
-/* Undefine temporary macro.  */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
-# undef kwsys_stl
-#endif
-
-#endif
diff --git a/src/kwsys/SharedForward.h.in b/src/kwsys/SharedForward.h.in
deleted file mode 100644
index 7ff29b4..0000000
--- a/src/kwsys/SharedForward.h.in
+++ /dev/null
@@ -1,922 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef @KWSYS_NAMESPACE at _SharedForward_h
-#define @KWSYS_NAMESPACE at _SharedForward_h
-
-/*
-  This header is used to create a forwarding executable sets up the
-  shared library search path and replaces itself with a real
-  executable.  This is useful when creating installations on UNIX with
-  shared libraries that will run from any install directory.  Typical
-  usage:
-
-  #if defined(CMAKE_INTDIR)
-  # define CONFIG_DIR_PRE CMAKE_INTDIR "/"
-  # define CONFIG_DIR_POST "/" CMAKE_INTDIR
-  #else
-  # define CONFIG_DIR_PRE ""
-  # define CONFIG_DIR_POST ""
-  #endif
-  #define @KWSYS_NAMESPACE at _SHARED_FORWARD_DIR_BUILD "/path/to/foo-build/bin"
-  #define @KWSYS_NAMESPACE at _SHARED_FORWARD_PATH_BUILD "." CONFIG_DIR_POST
-  #define @KWSYS_NAMESPACE at _SHARED_FORWARD_PATH_INSTALL "../lib/foo-1.2"
-  #define @KWSYS_NAMESPACE at _SHARED_FORWARD_EXE_BUILD CONFIG_DIR_PRE "foo-real"
-  #define @KWSYS_NAMESPACE at _SHARED_FORWARD_EXE_INSTALL "../lib/foo-1.2/foo-real"
-  #define @KWSYS_NAMESPACE at _SHARED_FORWARD_OPTION_COMMAND "--command"
-  #define @KWSYS_NAMESPACE at _SHARED_FORWARD_OPTION_PRINT "--print"
-  #define @KWSYS_NAMESPACE at _SHARED_FORWARD_OPTION_LDD "--ldd"
-  #if defined(CMAKE_INTDIR)
-  # define @KWSYS_NAMESPACE at _SHARED_FORWARD_CONFIG_NAME CMAKE_INTDIR
-  #endif
-  #include <@KWSYS_NAMESPACE@/SharedForward.h>
-  int main(int argc, char** argv)
-  {
-    return @KWSYS_NAMESPACE at _shared_forward_to_real(argc, argv);
-  }
-
-  Specify search and executable paths relative to the forwarding
-  executable location or as full paths.  Include no trailing slash.
-  In the case of a multi-configuration build, when CMAKE_INTDIR is
-  defined, the DIR_BUILD setting should point at the directory above
-  the executable (the one containing the per-configuration
-  subdirectory specified by CMAKE_INTDIR).  Then PATH_BUILD entries
-  and EXE_BUILD should be specified relative to this location and use
-  CMAKE_INTDIR as necessary.  In the above example imagine appending
-  the PATH_BUILD or EXE_BUILD setting to the DIR_BUILD setting.  The
-  result should form a valid path with per-configuration subdirectory.
-
-  Additional paths may be specified in the PATH_BUILD and PATH_INSTALL
-  variables by using comma-separated strings.    For example:
-
-  #define @KWSYS_NAMESPACE at _SHARED_FORWARD_PATH_BUILD \
-          "." CONFIG_DIR_POST, "/path/to/bar-build" CONFIG_DIR_POST
-  #define @KWSYS_NAMESPACE at _SHARED_FORWARD_PATH_INSTALL \
-          "../lib/foo-1.2", "../lib/bar-4.5"
-
-  See the comments below for specific explanations of each macro.
-*/
-
-/*--------------------------------------------------------------------------*/
-
-/* Full path to the directory in which this executable is built.  Do
-   not include a trailing slash.  */
-#if !defined(@KWSYS_NAMESPACE at _SHARED_FORWARD_DIR_BUILD)
-# error "Must define @KWSYS_NAMESPACE at _SHARED_FORWARD_DIR_BUILD"
-#endif
-#if !defined(KWSYS_SHARED_FORWARD_DIR_BUILD)
-# define KWSYS_SHARED_FORWARD_DIR_BUILD @KWSYS_NAMESPACE at _SHARED_FORWARD_DIR_BUILD
-#endif
-
-/* Library search path for build tree.  */
-#if !defined(@KWSYS_NAMESPACE at _SHARED_FORWARD_PATH_BUILD)
-# error "Must define @KWSYS_NAMESPACE at _SHARED_FORWARD_PATH_BUILD"
-#endif
-#if !defined(KWSYS_SHARED_FORWARD_PATH_BUILD)
-# define KWSYS_SHARED_FORWARD_PATH_BUILD @KWSYS_NAMESPACE at _SHARED_FORWARD_PATH_BUILD
-#endif
-
-/* Library search path for install tree.  */
-#if !defined(@KWSYS_NAMESPACE at _SHARED_FORWARD_PATH_INSTALL)
-# error "Must define @KWSYS_NAMESPACE at _SHARED_FORWARD_PATH_INSTALL"
-#endif
-#if !defined(KWSYS_SHARED_FORWARD_PATH_INSTALL)
-# define KWSYS_SHARED_FORWARD_PATH_INSTALL @KWSYS_NAMESPACE at _SHARED_FORWARD_PATH_INSTALL
-#endif
-
-/* The real executable to which to forward in the build tree.  */
-#if !defined(@KWSYS_NAMESPACE at _SHARED_FORWARD_EXE_BUILD)
-# error "Must define @KWSYS_NAMESPACE at _SHARED_FORWARD_EXE_BUILD"
-#endif
-#if !defined(KWSYS_SHARED_FORWARD_EXE_BUILD)
-# define KWSYS_SHARED_FORWARD_EXE_BUILD @KWSYS_NAMESPACE at _SHARED_FORWARD_EXE_BUILD
-#endif
-
-/* The real executable to which to forward in the install tree.  */
-#if !defined(@KWSYS_NAMESPACE at _SHARED_FORWARD_EXE_INSTALL)
-# error "Must define @KWSYS_NAMESPACE at _SHARED_FORWARD_EXE_INSTALL"
-#endif
-#if !defined(KWSYS_SHARED_FORWARD_EXE_INSTALL)
-# define KWSYS_SHARED_FORWARD_EXE_INSTALL @KWSYS_NAMESPACE at _SHARED_FORWARD_EXE_INSTALL
-#endif
-
-/* The configuration name with which this executable was built (Debug/Release). */
-#if defined(@KWSYS_NAMESPACE at _SHARED_FORWARD_CONFIG_NAME)
-# define KWSYS_SHARED_FORWARD_CONFIG_NAME @KWSYS_NAMESPACE at _SHARED_FORWARD_CONFIG_NAME
-#else
-# undef KWSYS_SHARED_FORWARD_CONFIG_NAME
-#endif
-
-/* Create command line option to replace executable.  */
-#if defined(@KWSYS_NAMESPACE at _SHARED_FORWARD_OPTION_COMMAND)
-# if !defined(KWSYS_SHARED_FORWARD_OPTION_COMMAND)
-#  define KWSYS_SHARED_FORWARD_OPTION_COMMAND @KWSYS_NAMESPACE at _SHARED_FORWARD_OPTION_COMMAND
-# endif
-#else
-# undef KWSYS_SHARED_FORWARD_OPTION_COMMAND
-#endif
-
-/* Create command line option to print environment setting and exit.  */
-#if defined(@KWSYS_NAMESPACE at _SHARED_FORWARD_OPTION_PRINT)
-# if !defined(KWSYS_SHARED_FORWARD_OPTION_PRINT)
-#  define KWSYS_SHARED_FORWARD_OPTION_PRINT @KWSYS_NAMESPACE at _SHARED_FORWARD_OPTION_PRINT
-# endif
-#else
-# undef KWSYS_SHARED_FORWARD_OPTION_PRINT
-#endif
-
-/* Create command line option to run ldd or equivalent.  */
-#if defined(@KWSYS_NAMESPACE at _SHARED_FORWARD_OPTION_LDD)
-# if !defined(KWSYS_SHARED_FORWARD_OPTION_LDD)
-#  define KWSYS_SHARED_FORWARD_OPTION_LDD @KWSYS_NAMESPACE at _SHARED_FORWARD_OPTION_LDD
-# endif
-#else
-# undef KWSYS_SHARED_FORWARD_OPTION_LDD
-#endif
-
-/*--------------------------------------------------------------------------*/
-/* Include needed system headers.  */
-
-#include <stddef.h> /* size_t */
-#include <limits.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <stdio.h>
-
-#if defined(_WIN32) && !defined(__CYGWIN__)
-# include <io.h>
-# include <windows.h>
-# include <process.h>
-# define KWSYS_SHARED_FORWARD_ESCAPE_ARGV /* re-escape argv for execvp */
-#else
-# include <unistd.h>
-# include <sys/stat.h>
-#endif
-
-/*--------------------------------------------------------------------------*/
-/* Configuration for this platform.  */
-
-/* The path separator for this platform.  */
-#if defined(_WIN32) && !defined(__CYGWIN__)
-# define KWSYS_SHARED_FORWARD_PATH_SEP ';'
-# define KWSYS_SHARED_FORWARD_PATH_SLASH '\\'
-#else
-# define KWSYS_SHARED_FORWARD_PATH_SEP ':'
-# define KWSYS_SHARED_FORWARD_PATH_SLASH '/'
-#endif
-static const char kwsys_shared_forward_path_sep[2] = {KWSYS_SHARED_FORWARD_PATH_SEP, 0};
-static const char kwsys_shared_forward_path_slash[2] = {KWSYS_SHARED_FORWARD_PATH_SLASH, 0};
-
-/* The maximum length of a file name.  */
-#if defined(PATH_MAX)
-# define KWSYS_SHARED_FORWARD_MAXPATH PATH_MAX
-#elif defined(MAXPATHLEN)
-# define KWSYS_SHARED_FORWARD_MAXPATH MAXPATHLEN
-#else
-# define KWSYS_SHARED_FORWARD_MAXPATH 16384
-#endif
-
-/* Select the environment variable holding the shared library runtime
-   search path for this platform and build configuration.  Also select
-   ldd command equivalent.  */
-
-/* Linux */
-#if defined(__linux)
-# define KWSYS_SHARED_FORWARD_LDD "ldd"
-# define KWSYS_SHARED_FORWARD_LDD_N 1
-# define KWSYS_SHARED_FORWARD_LDPATH "LD_LIBRARY_PATH"
-
-/* FreeBSD */
-#elif defined(__FreeBSD__)
-# define KWSYS_SHARED_FORWARD_LDD "ldd"
-# define KWSYS_SHARED_FORWARD_LDD_N 1
-# define KWSYS_SHARED_FORWARD_LDPATH "LD_LIBRARY_PATH"
-
-/* OpenBSD */
-#elif defined(__OpenBSD__)
-# define KWSYS_SHARED_FORWARD_LDD "ldd"
-# define KWSYS_SHARED_FORWARD_LDD_N 1
-# define KWSYS_SHARED_FORWARD_LDPATH "LD_LIBRARY_PATH"
-
-/* OSX */
-#elif defined(__APPLE__)
-# define KWSYS_SHARED_FORWARD_LDD "otool", "-L"
-# define KWSYS_SHARED_FORWARD_LDD_N 2
-# define KWSYS_SHARED_FORWARD_LDPATH "DYLD_LIBRARY_PATH"
-
-/* AIX */
-#elif defined(_AIX)
-# define KWSYS_SHARED_FORWARD_LDD "dump", "-H"
-# define KWSYS_SHARED_FORWARD_LDD_N 2
-# define KWSYS_SHARED_FORWARD_LDPATH "LIBPATH"
-
-/* SUN */
-#elif defined(__sun)
-# define KWSYS_SHARED_FORWARD_LDD "ldd"
-# define KWSYS_SHARED_FORWARD_LDD_N 1
-# include <sys/isa_defs.h>
-# if defined(_ILP32)
-#  define KWSYS_SHARED_FORWARD_LDPATH "LD_LIBRARY_PATH"
-# elif defined(_LP64)
-#  define KWSYS_SHARED_FORWARD_LDPATH "LD_LIBRARY_PATH_64"
-# endif
-
-/* HP-UX */
-#elif defined(__hpux)
-# define KWSYS_SHARED_FORWARD_LDD "chatr"
-# define KWSYS_SHARED_FORWARD_LDD_N 1
-# if defined(__LP64__)
-#  define KWSYS_SHARED_FORWARD_LDPATH "LD_LIBRARY_PATH"
-# else
-#  define KWSYS_SHARED_FORWARD_LDPATH "SHLIB_PATH"
-# endif
-
-/* SGI MIPS */
-#elif defined(__sgi) && defined(_MIPS_SIM)
-# define KWSYS_SHARED_FORWARD_LDD "ldd"
-# define KWSYS_SHARED_FORWARD_LDD_N 1
-# if _MIPS_SIM == _ABIO32
-#  define KWSYS_SHARED_FORWARD_LDPATH "LD_LIBRARY_PATH"
-# elif _MIPS_SIM == _ABIN32
-#  define KWSYS_SHARED_FORWARD_LDPATH "LD_LIBRARYN32_PATH"
-# elif _MIPS_SIM == _ABI64
-#  define KWSYS_SHARED_FORWARD_LDPATH "LD_LIBRARY64_PATH"
-# endif
-
-/* Cygwin */
-#elif defined(__CYGWIN__)
-# define KWSYS_SHARED_FORWARD_LDD "cygcheck" /* TODO: cygwin 1.7 has ldd */
-# define KWSYS_SHARED_FORWARD_LDD_N 1
-# define KWSYS_SHARED_FORWARD_LDPATH "PATH"
-
-/* Windows */
-#elif defined(_WIN32)
-# define KWSYS_SHARED_FORWARD_LDPATH "PATH"
-
-/* Guess on this unknown system.  */
-#else
-# define KWSYS_SHARED_FORWARD_LDD "ldd"
-# define KWSYS_SHARED_FORWARD_LDD_N 1
-# define KWSYS_SHARED_FORWARD_LDPATH "LD_LIBRARY_PATH"
-#endif
-
-#ifdef KWSYS_SHARED_FORWARD_ESCAPE_ARGV
-/*--------------------------------------------------------------------------*/
-typedef struct kwsys_sf_arg_info_s
-{
-  const char* arg;
-  int size;
-  int quote;
-} kwsys_sf_arg_info;
-
-/*--------------------------------------------------------------------------*/
-static kwsys_sf_arg_info kwsys_sf_get_arg_info(const char* in)
-{
-  /* Initialize information.  */
-  kwsys_sf_arg_info info;
-
-  /* String iterator.  */
-  const char* c;
-
-  /* Keep track of how many backslashes have been encountered in a row.  */
-  int windows_backslashes = 0;
-
-  /* Start with the length of the original argument, plus one for
-     either a terminating null or a separating space.  */
-  info.arg = in;
-  info.size = (int)strlen(in) + 1;
-  info.quote = 0;
-
-  /* Scan the string for characters that require escaping or quoting.  */
-  for(c=in; *c; ++c)
-    {
-    /* Check whether this character needs quotes.  */
-    if(strchr(" \t?'#&<>|^", *c))
-      {
-      info.quote = 1;
-      }
-
-    /* On Windows only backslashes and double-quotes need escaping.  */
-    if(*c == '\\')
-      {
-      /* Found a backslash.  It may need to be escaped later.  */
-      ++windows_backslashes;
-      }
-    else if(*c == '"')
-      {
-      /* Found a double-quote.  We need to escape it and all
-         immediately preceding backslashes.  */
-      info.size += windows_backslashes + 1;
-      windows_backslashes = 0;
-      }
-    else
-      {
-      /* Found another character.  This eliminates the possibility
-         that any immediately preceding backslashes will be
-         escaped.  */
-      windows_backslashes = 0;
-      }
-    }
-
-  /* Check whether the argument needs surrounding quotes.  */
-  if(info.quote)
-    {
-    /* Surrounding quotes are needed.  Allocate space for them.  */
-    info.size += 2;
-
-    /* We must escape all ending backslashes when quoting on windows.  */
-    info.size += windows_backslashes;
-    }
-
-  return info;
-}
-
-/*--------------------------------------------------------------------------*/
-static char* kwsys_sf_get_arg(kwsys_sf_arg_info info, char* out)
-{
-  /* String iterator.  */
-  const char* c;
-
-  /* Keep track of how many backslashes have been encountered in a row.  */
-  int windows_backslashes = 0;
-
-  /* Whether the argument must be quoted.  */
-  if(info.quote)
-    {
-    /* Add the opening quote for this argument.  */
-    *out++ = '"';
-    }
-
-  /* Scan the string for characters that require escaping or quoting.  */
-  for(c=info.arg; *c; ++c)
-    {
-    /* On Windows only backslashes and double-quotes need escaping.  */
-    if(*c == '\\')
-      {
-      /* Found a backslash.  It may need to be escaped later.  */
-      ++windows_backslashes;
-      }
-    else if(*c == '"')
-      {
-      /* Found a double-quote.  Escape all immediately preceding
-         backslashes.  */
-      while(windows_backslashes > 0)
-        {
-        --windows_backslashes;
-        *out++ = '\\';
-        }
-
-      /* Add the backslash to escape the double-quote.  */
-      *out++ = '\\';
-      }
-    else
-      {
-      /* We encountered a normal character.  This eliminates any
-         escaping needed for preceding backslashes.  */
-      windows_backslashes = 0;
-      }
-
-    /* Store this character.  */
-    *out++ = *c;
-    }
-
-  if(info.quote)
-    {
-    /* Add enough backslashes to escape any trailing ones.  */
-    while(windows_backslashes > 0)
-      {
-      --windows_backslashes;
-      *out++ = '\\';
-      }
-
-    /* Add the closing quote for this argument.  */
-    *out++ = '"';
-    }
-
-  /* Store a terminating null without incrementing.  */
-  *out = 0;
-
-  return out;
-}
-#endif
-
-/*--------------------------------------------------------------------------*/
-/* Function to convert a logical or relative path to a physical full path.  */
-static int kwsys_shared_forward_realpath(const char* in_path, char* out_path)
-{
-#if defined(_WIN32) && !defined(__CYGWIN__)
-  /* Implementation for Windows.  */
-  DWORD n = GetFullPathNameA(in_path, KWSYS_SHARED_FORWARD_MAXPATH,
-                            out_path, 0);
-  return n > 0 && n <= KWSYS_SHARED_FORWARD_MAXPATH;
-#else
-  /* Implementation for UNIX.  */
-  return realpath(in_path, out_path) != 0;
-#endif
-}
-
-/*--------------------------------------------------------------------------*/
-static int kwsys_shared_forward_samepath(const char* file1, const char* file2)
-{
-#if defined(_WIN32)
-  int result = 0;
-  HANDLE h1 = CreateFileA(file1, GENERIC_READ, FILE_SHARE_READ, NULL,
-                         OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
-  HANDLE h2 = CreateFileA(file2, GENERIC_READ, FILE_SHARE_READ, NULL,
-                         OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
-  if(h1 != INVALID_HANDLE_VALUE && h2 != INVALID_HANDLE_VALUE)
-    {
-    BY_HANDLE_FILE_INFORMATION fi1;
-    BY_HANDLE_FILE_INFORMATION fi2;
-    GetFileInformationByHandle(h1, &fi1);
-    GetFileInformationByHandle(h2, &fi2);
-    result = (fi1.dwVolumeSerialNumber == fi2.dwVolumeSerialNumber &&
-              fi1.nFileIndexHigh == fi2.nFileIndexHigh &&
-              fi1.nFileIndexLow == fi2.nFileIndexLow);
-    }
-   CloseHandle(h1);
-   CloseHandle(h2);
-   return result;
-#else
-  struct stat fs1, fs2;
-  return (stat(file1, &fs1) == 0 && stat(file2, &fs2) == 0 &&
-          memcmp(&fs2.st_dev, &fs1.st_dev, sizeof(fs1.st_dev)) == 0 &&
-          memcmp(&fs2.st_ino, &fs1.st_ino, sizeof(fs1.st_ino)) == 0 &&
-          fs2.st_size == fs1.st_size);
-#endif
-}
-
-/*--------------------------------------------------------------------------*/
-/* Function to report a system error message.  */
-static void kwsys_shared_forward_strerror(char* message)
-{
-#if defined(_WIN32) && !defined(__CYGWIN__)
-  /* Implementation for Windows.  */
-  DWORD original = GetLastError();
-  DWORD length = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM |
-                               FORMAT_MESSAGE_IGNORE_INSERTS, 0, original,
-                               MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-                               message, KWSYS_SHARED_FORWARD_MAXPATH, 0);
-  if(length < 1 || length > KWSYS_SHARED_FORWARD_MAXPATH)
-    {
-    /* FormatMessage failed.  Use a default message.  */
-    _snprintf(message, KWSYS_SHARED_FORWARD_MAXPATH,
-              "Error 0x%X (FormatMessage failed with error 0x%X)",
-              original, GetLastError());
-    }
-#else
-  /* Implementation for UNIX.  */
-  strcpy(message, strerror(errno));
-#endif
-}
-
-/*--------------------------------------------------------------------------*/
-/* Functions to execute a child process.  */
-static void kwsys_shared_forward_execvp(const char* cmd,
-                                        char const* const* argv)
-{
-#ifdef KWSYS_SHARED_FORWARD_ESCAPE_ARGV
-  /* Count the number of arguments.  */
-  int argc = 0;
-  {
-  char const* const* argvc;
-  for(argvc = argv; *argvc; ++argvc,++argc) {}
-  }
-
-  /* Create the escaped arguments.  */
-  {
-  char** nargv = (char**)malloc((argc+1) * sizeof(char*));
-  int i;
-  for(i=0; i < argc; ++i)
-    {
-    kwsys_sf_arg_info info = kwsys_sf_get_arg_info(argv[i]);
-    nargv[i] = (char*)malloc(info.size);
-    kwsys_sf_get_arg(info, nargv[i]);
-    }
-  nargv[argc] = 0;
-
-  /* Replace the command line to be used.  */
-  argv = (char const* const*)nargv;
-  }
-#endif
-
-  /* Invoke the child process.  */
-#if defined(_MSC_VER)
-  _execvp(cmd, argv);
-#elif defined(__MINGW32__) && !defined(__MINGW64__)
-  execvp(cmd, argv);
-#else
-  execvp(cmd, (char* const*)argv);
-#endif
-}
-
-/*--------------------------------------------------------------------------*/
-/* Function to get the directory containing the given file or directory.  */
-static void kwsys_shared_forward_dirname(const char* begin, char* result)
-{
-  /* Find the location of the last slash.  */
-  int last_slash_index = -1;
-  const char* end = begin + strlen(begin);
-  for(;begin <= end && last_slash_index < 0; --end)
-    {
-    if(*end == '/' || *end == '\\')
-      {
-      last_slash_index = (int)(end-begin);
-      }
-    }
-
-  /* Handle each case of the index of the last slash.  */
-  if(last_slash_index < 0)
-    {
-    /* No slashes.  */
-    strcpy(result, ".");
-    }
-  else if(last_slash_index == 0)
-    {
-    /* Only one leading slash.  */
-    strcpy(result, kwsys_shared_forward_path_slash);
-    }
-#if defined(_WIN32)
-  else if(last_slash_index == 2 && begin[1] == ':')
-    {
-    /* Only one leading drive letter and slash.  */
-    strncpy(result, begin, (size_t)last_slash_index);
-    result[last_slash_index] = KWSYS_SHARED_FORWARD_PATH_SLASH;
-    result[last_slash_index+1] = 0;
-    }
-#endif
-  else
-    {
-    /* A non-leading slash.  */
-    strncpy(result, begin, (size_t)last_slash_index);
-    result[last_slash_index] = 0;
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/* Function to check if a file exists and is executable.  */
-static int kwsys_shared_forward_is_executable(const char* f)
-{
-#if defined(_MSC_VER)
-# define KWSYS_SHARED_FORWARD_ACCESS _access
-#else
-# define KWSYS_SHARED_FORWARD_ACCESS access
-#endif
-#if defined(X_OK)
-# define KWSYS_SHARED_FORWARD_ACCESS_OK X_OK
-#else
-# define KWSYS_SHARED_FORWARD_ACCESS_OK 04
-#endif
-  if(KWSYS_SHARED_FORWARD_ACCESS(f, KWSYS_SHARED_FORWARD_ACCESS_OK) == 0)
-    {
-    return 1;
-    }
-  else
-    {
-    return 0;
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/* Function to locate the executable currently running.  */
-static int kwsys_shared_forward_self_path(const char* argv0, char* result)
-{
-  /* Check whether argv0 has a slash.  */
-  int has_slash = 0;
-  const char* p = argv0;
-  for(;*p && !has_slash; ++p)
-    {
-    if(*p == '/' || *p == '\\')
-      {
-      has_slash = 1;
-      }
-    }
-
-  if(has_slash)
-    {
-    /* There is a slash.  Use the dirname of the given location.  */
-    kwsys_shared_forward_dirname(argv0, result);
-    return 1;
-    }
-  else
-    {
-    /* There is no slash.  Search the PATH for the executable.  */
-    const char* path = getenv("PATH");
-    const char* begin = path;
-    const char* end = begin + (begin?strlen(begin):0);
-    const char* first = begin;
-    while(first != end)
-      {
-      /* Store the end of this path entry.  */
-      const char* last;
-
-      /* Skip all path separators.  */
-      for(;*first && *first == KWSYS_SHARED_FORWARD_PATH_SEP; ++first);
-
-      /* Find the next separator.  */
-      for(last = first;*last && *last != KWSYS_SHARED_FORWARD_PATH_SEP; ++last);
-
-      /* If we got a non-empty directory, look for the executable there.  */
-      if(first < last)
-        {
-        /* Determine the length without trailing slash.  */
-        size_t length = (size_t)(last-first);
-        if(*(last-1) == '/' || *(last-1) == '\\')
-          {
-          --length;
-          }
-
-        /* Construct the name of the executable in this location.  */
-        strncpy(result, first, length);
-        result[length] = KWSYS_SHARED_FORWARD_PATH_SLASH;
-        strcpy(result+(length)+1, argv0);
-
-        /* Check if it exists and is executable.  */
-        if(kwsys_shared_forward_is_executable(result))
-          {
-          /* Found it.  */
-          result[length] = 0;
-          return 1;
-          }
-        }
-
-      /* Move to the next directory in the path.  */
-      first = last;
-      }
-    }
-
-  /* We could not find the executable.  */
-  return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-/* Function to convert a specified path to a full path.  If it is not
-   already full, it is taken relative to the self path.  */
-static int kwsys_shared_forward_fullpath(const char* self_path,
-                                         const char* in_path,
-                                         char* result,
-                                         const char* desc)
-{
-  /* Check the specified path type.  */
-  if(in_path[0] == '/')
-    {
-    /* Already a full path.  */
-    strcpy(result, in_path);
-    }
-#if defined(_WIN32)
-  else if(in_path[0] && in_path[1] == ':')
-    {
-    /* Already a full path.  */
-    strcpy(result, in_path);
-    }
-#endif
-  else
-    {
-    /* Relative to self path.  */
-    char temp_path[KWSYS_SHARED_FORWARD_MAXPATH];
-    strcpy(temp_path, self_path);
-    strcat(temp_path, kwsys_shared_forward_path_slash);
-    strcat(temp_path, in_path);
-    if(!kwsys_shared_forward_realpath(temp_path, result))
-      {
-      if(desc)
-        {
-        char msgbuf[KWSYS_SHARED_FORWARD_MAXPATH];
-        kwsys_shared_forward_strerror(msgbuf);
-        fprintf(stderr, "Error converting %s \"%s\" to real path: %s\n",
-                desc, temp_path, msgbuf);
-        }
-      return 0;
-      }
-    }
-  return 1;
-}
-
-/*--------------------------------------------------------------------------*/
-/* Function to compute the library search path and executable name
-   based on the self path.  */
-static int kwsys_shared_forward_get_settings(const char* self_path,
-                                             char* ldpath, char* exe)
-{
-  /* Possible search paths.  */
-  static const char* search_path_build[] = {KWSYS_SHARED_FORWARD_PATH_BUILD, 0};
-  static const char* search_path_install[] = {KWSYS_SHARED_FORWARD_PATH_INSTALL, 0};
-
-  /* Chosen paths.  */
-  const char** search_path;
-  const char* exe_path;
-
-  /* Get the real name of the build and self paths.  */
-#if defined(KWSYS_SHARED_FORWARD_CONFIG_NAME)
-  char build_path[] = KWSYS_SHARED_FORWARD_DIR_BUILD "/" KWSYS_SHARED_FORWARD_CONFIG_NAME;
-  char self_path_logical[KWSYS_SHARED_FORWARD_MAXPATH];
-#else
-  char build_path[] = KWSYS_SHARED_FORWARD_DIR_BUILD;
-  const char* self_path_logical = self_path;
-#endif
-  char build_path_real[KWSYS_SHARED_FORWARD_MAXPATH];
-  char self_path_real[KWSYS_SHARED_FORWARD_MAXPATH];
-  if(!kwsys_shared_forward_realpath(self_path, self_path_real))
-    {
-    char msgbuf[KWSYS_SHARED_FORWARD_MAXPATH];
-    kwsys_shared_forward_strerror(msgbuf);
-    fprintf(stderr, "Error converting self path \"%s\" to real path: %s\n",
-            self_path, msgbuf);
-    return 0;
-    }
-
-  /* Check whether we are running in the build tree or an install tree.  */
-  if(kwsys_shared_forward_realpath(build_path, build_path_real) &&
-     kwsys_shared_forward_samepath(self_path_real, build_path_real))
-    {
-    /* Running in build tree.  Use the build path and exe.  */
-    search_path = search_path_build;
-#if defined(_WIN32)
-    exe_path = KWSYS_SHARED_FORWARD_EXE_BUILD ".exe";
-#else
-    exe_path = KWSYS_SHARED_FORWARD_EXE_BUILD;
-#endif
-
-#if defined(KWSYS_SHARED_FORWARD_CONFIG_NAME)
-    /* Remove the configuration directory from self_path.  */
-    kwsys_shared_forward_dirname(self_path, self_path_logical);
-#endif
-    }
-  else
-    {
-    /* Running in install tree.  Use the install path and exe.  */
-    search_path = search_path_install;
-#if defined(_WIN32)
-    exe_path = KWSYS_SHARED_FORWARD_EXE_INSTALL ".exe";
-#else
-    exe_path = KWSYS_SHARED_FORWARD_EXE_INSTALL;
-#endif
-
-#if defined(KWSYS_SHARED_FORWARD_CONFIG_NAME)
-    /* Use the original self path directory.  */
-    strcpy(self_path_logical, self_path);
-#endif
-    }
-
-  /* Construct the runtime search path.  */
-  {
-  const char** dir;
-  for(dir = search_path; *dir; ++dir)
-    {
-    /* Add separator between path components.  */
-    if(dir != search_path)
-      {
-      strcat(ldpath, kwsys_shared_forward_path_sep);
-      }
-
-    /* Add this path component.  */
-    if(!kwsys_shared_forward_fullpath(self_path_logical, *dir,
-                                      ldpath+strlen(ldpath),
-                                      "runtime path entry"))
-      {
-      return 0;
-      }
-    }
-  }
-
-  /* Construct the executable location.  */
-  if(!kwsys_shared_forward_fullpath(self_path_logical, exe_path, exe,
-                                    "executable file"))
-    {
-    return 0;
-    }
-  return 1;
-}
-
-/*--------------------------------------------------------------------------*/
-/* Function to print why execution of a command line failed.  */
-static void kwsys_shared_forward_print_failure(char const* const* argv)
-{
-  char msg[KWSYS_SHARED_FORWARD_MAXPATH];
-  char const* const* arg = argv;
-  kwsys_shared_forward_strerror(msg);
-  fprintf(stderr, "Error running");
-  for(; *arg; ++arg)
-    {
-    fprintf(stderr, " \"%s\"", *arg);
-    }
-  fprintf(stderr, ": %s\n", msg);
-}
-
-/* Static storage space to store the updated environment variable.  */
-static char kwsys_shared_forward_ldpath[KWSYS_SHARED_FORWARD_MAXPATH*16] = KWSYS_SHARED_FORWARD_LDPATH "=";
-
-/*--------------------------------------------------------------------------*/
-/* Main driver function to be called from main.  */
-static int @KWSYS_NAMESPACE at _shared_forward_to_real(int argc, char** argv_in)
-{
-  char const** argv = (char const**)argv_in;
-  /* Get the directory containing this executable.  */
-  char self_path[KWSYS_SHARED_FORWARD_MAXPATH];
-  if(kwsys_shared_forward_self_path(argv[0], self_path))
-    {
-    /* Found this executable.  Use it to get the library directory.  */
-    char exe[KWSYS_SHARED_FORWARD_MAXPATH];
-    if(kwsys_shared_forward_get_settings(self_path,
-                                         kwsys_shared_forward_ldpath, exe))
-      {
-      /* Append the old runtime search path.  */
-      const char* old_ldpath = getenv(KWSYS_SHARED_FORWARD_LDPATH);
-      if(old_ldpath)
-        {
-        strcat(kwsys_shared_forward_ldpath, kwsys_shared_forward_path_sep);
-        strcat(kwsys_shared_forward_ldpath, old_ldpath);
-        }
-
-      /* Store the environment variable.  */
-      putenv(kwsys_shared_forward_ldpath);
-
-#if defined(KWSYS_SHARED_FORWARD_OPTION_COMMAND)
-      /* Look for the command line replacement option.  */
-      if(argc > 1 && strcmp(argv[1], KWSYS_SHARED_FORWARD_OPTION_COMMAND) == 0)
-        {
-        if(argc > 2)
-          {
-          /* Use the command line given.  */
-          strcpy(exe, argv[2]);
-          argv += 2;
-          argc -= 2;
-          }
-        else
-          {
-          /* The option was not given an executable.  */
-          fprintf(stderr, "Option " KWSYS_SHARED_FORWARD_OPTION_COMMAND
-                  " must be followed by a command line.\n");
-          return 1;
-          }
-        }
-#endif
-
-#if defined(KWSYS_SHARED_FORWARD_OPTION_PRINT)
-      /* Look for the print command line option.  */
-      if(argc > 1 && strcmp(argv[1], KWSYS_SHARED_FORWARD_OPTION_PRINT) == 0)
-        {
-        fprintf(stdout, "%s\n", kwsys_shared_forward_ldpath);
-        fprintf(stdout, "%s\n", exe);
-        return 0;
-        }
-#endif
-
-#if defined(KWSYS_SHARED_FORWARD_OPTION_LDD)
-      /* Look for the ldd command line option.  */
-      if(argc > 1 && strcmp(argv[1], KWSYS_SHARED_FORWARD_OPTION_LDD) == 0)
-        {
-# if defined(KWSYS_SHARED_FORWARD_LDD)
-        /* Use the named ldd-like executable and arguments.  */
-        char const* ldd_argv[] = {KWSYS_SHARED_FORWARD_LDD, 0, 0};
-        ldd_argv[KWSYS_SHARED_FORWARD_LDD_N] = exe;
-        kwsys_shared_forward_execvp(ldd_argv[0], ldd_argv);
-
-        /* Report why execution failed.  */
-        kwsys_shared_forward_print_failure(ldd_argv);
-        return 1;
-# else
-        /* We have no ldd-like executable available on this platform.  */
-        fprintf(stderr, "No ldd-like tool is known to this executable.\n");
-        return 1;
-# endif
-        }
-#endif
-
-      /* Replace this process with the real executable.  */
-      argv[0] = exe;
-      kwsys_shared_forward_execvp(argv[0], argv);
-
-      /* Report why execution failed.  */
-      kwsys_shared_forward_print_failure(argv);
-      }
-    else
-      {
-      /* Could not convert self path to the library directory.  */
-      }
-    }
-  else
-    {
-    /* Could not find this executable.  */
-    fprintf(stderr, "Error locating executable \"%s\".\n", argv[0]);
-    }
-
-  /* Avoid unused argument warning.  */
-  (void)argc;
-
-  /* Exit with failure.  */
-  return 1;
-}
-
-#else
-# error "@KWSYS_NAMESPACE@/SharedForward.h should be included only once."
-#endif
diff --git a/src/kwsys/String.c b/src/kwsys/String.c
deleted file mode 100644
index ed4a6c5..0000000
--- a/src/kwsys/String.c
+++ /dev/null
@@ -1,115 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifdef KWSYS_STRING_C
-/*
-All code in this source file is conditionally compiled to work-around
-template definition auto-search on VMS.  Other source files in this
-directory that use the stl string cause the compiler to load this
-source to try to get the definition of the string template.  This
-condition blocks the compiler from seeing the symbols defined here.
-*/
-#include "kwsysPrivate.h"
-#include KWSYS_HEADER(String.h)
-
-/* Work-around CMake dependency scanning limitation.  This must
-   duplicate the above list of headers.  */
-#if 0
-# include "String.h.in"
-#endif
-
-/* Select an implementation for strcasecmp.  */
-#if defined(_MSC_VER)
-# define KWSYS_STRING_USE_STRICMP
-# include <string.h>
-#elif defined(__GNUC__)
-# define KWSYS_STRING_USE_STRCASECMP
-# include <strings.h>
-#else
-/* Table to convert upper case letters to lower case and leave all
-   other characters alone.  */
-static char kwsysString_strcasecmp_tolower[] =
-{
-  '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
-  '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
-  '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
-  '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
-  '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
-  '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
-  '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
-  '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
-  '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
-  '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
-  '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
-  '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
-  '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
-  '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
-  '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
-  '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177',
-  '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
-  '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
-  '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
-  '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
-  '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247',
-  '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257',
-  '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267',
-  '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277',
-  '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307',
-  '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317',
-  '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327',
-  '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337',
-  '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
-  '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
-  '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
-  '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377'
-};
-#endif
-
-/*--------------------------------------------------------------------------*/
-int kwsysString_strcasecmp(const char* lhs, const char* rhs)
-{
-#if defined(KWSYS_STRING_USE_STRICMP)
-  return _stricmp(lhs, rhs);
-#elif defined(KWSYS_STRING_USE_STRCASECMP)
-  return strcasecmp(lhs, rhs);
-#else
-  const char* const lower = kwsysString_strcasecmp_tolower;
-  unsigned char const* us1 = (unsigned char const*)lhs;
-  unsigned char const* us2 = (unsigned char const*)rhs;
-  int result;
-  while((result = lower[*us1] - lower[*us2++], result == 0) && *us1++)
-    {
-    }
-  return result;
-#endif
-}
-
-/*--------------------------------------------------------------------------*/
-int kwsysString_strncasecmp(const char* lhs, const char* rhs, size_t n)
-{
-#if defined(KWSYS_STRING_USE_STRICMP)
-  return _strnicmp(lhs, rhs, n);
-#elif defined(KWSYS_STRING_USE_STRCASECMP)
-  return strncasecmp(lhs, rhs, n);
-#else
-  const char* const lower = kwsysString_strcasecmp_tolower;
-  unsigned char const* us1 = (unsigned char const*)lhs;
-  unsigned char const* us2 = (unsigned char const*)rhs;
-  int result = 0;
-  while(n && (result = lower[*us1] - lower[*us2++], result == 0) && *us1++)
-    {
-    --n;
-    }
-  return result;
-#endif
-}
-
-#endif /* KWSYS_STRING_C */
diff --git a/src/kwsys/String.h.in b/src/kwsys/String.h.in
deleted file mode 100644
index f5bab6e..0000000
--- a/src/kwsys/String.h.in
+++ /dev/null
@@ -1,67 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef @KWSYS_NAMESPACE at _String_h
-#define @KWSYS_NAMESPACE at _String_h
-
-#include <@KWSYS_NAMESPACE@/Configure.h>
-
-#include <stddef.h> /* size_t */
-
-/* Redefine all public interface symbol names to be in the proper
-   namespace.  These macros are used internally to kwsys only, and are
-   not visible to user code.  Use kwsysHeaderDump.pl to reproduce
-   these macros after making changes to the interface.  */
-#if !defined(KWSYS_NAMESPACE)
-# define kwsys_ns(x) @KWSYS_NAMESPACE@##x
-# define kwsysEXPORT @KWSYS_NAMESPACE at _EXPORT
-#endif
-#if !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
-# define kwsysString_strcasecmp                kwsys_ns(String_strcasecmp)
-# define kwsysString_strncasecmp               kwsys_ns(String_strncasecmp)
-#endif
-
-#if defined(__cplusplus)
-extern "C"
-{
-#endif
-
-/**
- * Compare two strings ignoring the case of the characters.  The
- * integer returned is negative, zero, or positive if the first string
- * is found to be less than, equal to, or greater than the second
- * string, respectively.
- */
-kwsysEXPORT int kwsysString_strcasecmp(const char* lhs, const char* rhs);
-
-/**
- * Identical to String_strcasecmp except that only the first n
- * characters are considered.
- */
-kwsysEXPORT int kwsysString_strncasecmp(const char* lhs, const char* rhs,
-                                        size_t n);
-
-#if defined(__cplusplus)
-} /* extern "C" */
-#endif
-
-/* If we are building a kwsys .c or .cxx file, let it use these macros.
-   Otherwise, undefine them to keep the namespace clean.  */
-#if !defined(KWSYS_NAMESPACE)
-# undef kwsys_ns
-# undef kwsysEXPORT
-# if !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
-#  undef kwsysString_strcasecmp
-#  undef kwsysString_strncasecmp
-# endif
-#endif
-
-#endif
diff --git a/src/kwsys/String.hxx.in b/src/kwsys/String.hxx.in
deleted file mode 100644
index 4386c9e..0000000
--- a/src/kwsys/String.hxx.in
+++ /dev/null
@@ -1,65 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef @KWSYS_NAMESPACE at _String_hxx
-#define @KWSYS_NAMESPACE at _String_hxx
-
-#include <@KWSYS_NAMESPACE@/stl/string>
-
-namespace @KWSYS_NAMESPACE@
-{
-
-/** \class String
- * \brief Short-name version of the STL basic_string class template.
- *
- * The standard library "string" type is actually a typedef for
- * "basic_string<..long argument list..>".  This string class is
- * simply a subclass of this type with the same interface so that the
- * name is shorter in debugging symbols and error messages.
- */
-class String: public @KWSYS_NAMESPACE at _stl::string
-{
-  /** The original string type.  */
-  typedef @KWSYS_NAMESPACE at _stl::string stl_string;
-
-public:
-
-  /** String member types.  */
-  typedef stl_string::value_type             value_type;
-  typedef stl_string::pointer                pointer;
-  typedef stl_string::reference              reference;
-  typedef stl_string::const_reference        const_reference;
-  typedef stl_string::size_type              size_type;
-  typedef stl_string::difference_type        difference_type;
-  typedef stl_string::iterator               iterator;
-  typedef stl_string::const_iterator         const_iterator;
-  typedef stl_string::reverse_iterator       reverse_iterator;
-  typedef stl_string::const_reverse_iterator const_reverse_iterator;
-
-  /** String constructors.  */
-  String(): stl_string() {}
-  String(const value_type* s): stl_string(s) {}
-  String(const value_type* s, size_type n): stl_string(s, n) {}
-  String(const stl_string& s, size_type pos=0, size_type n=npos):
-    stl_string(s, pos, n) {}
-}; // End Class: String
-
-#if defined(__WATCOMC__)
-inline bool operator<(String const& l, String const& r)
-  {
-  return (static_cast<@KWSYS_NAMESPACE at _stl::string const&>(l) <
-          static_cast<@KWSYS_NAMESPACE at _stl::string const&>(r));
-  }
-#endif
-
-} // namespace @KWSYS_NAMESPACE@
-
-#endif
diff --git a/src/kwsys/System.c b/src/kwsys/System.c
index 1ee26fa..ccc7e81 100644
--- a/src/kwsys/System.c
+++ b/src/kwsys/System.c
@@ -20,8 +20,8 @@
 
 #include <stddef.h> /* ptrdiff_t */
 #include <stdlib.h> /* malloc, free */
-#include <string.h> /* strlen */
-#include <ctype.h>  /* isalpha */
+#include <string.h> /* memcpy */
+#include <ctype.h>  /* isspace */
 
 #include <stdio.h>
 
@@ -31,587 +31,6 @@ typedef ptrdiff_t kwsysSystem_ptrdiff_t;
 typedef int kwsysSystem_ptrdiff_t;
 #endif
 
-/*
-
-Notes:
-
-Make variable replacements open a can of worms.  Sometimes they should
-be quoted and sometimes not.  Sometimes their replacement values are
-already quoted.
-
-VS variables cause problems.  In order to pass the referenced value
-with spaces the reference must be quoted.  If the variable value ends
-in a backslash then it will escape the ending quote!  In order to make
-the ending backslash appear we need this:
-
-  "$(InputDir)\"
-
-However if there is not a trailing backslash then this will put a
-quote in the value so we need:
-
-  "$(InputDir)"
-
-Make variable references are platform specific so we should probably
-just NOT quote them and let the listfile author deal with it.
-
-*/
-
-/*
-TODO: For windows echo:
-
-To display a pipe (|) or redirection character (< or >) when using the
-echo command, use a caret character immediately before the pipe or
-redirection character (for example, ^>, ^<, or ^| ). If you need to
-use the caret character itself (^), use two in a row (^^).
-*/
-
-/*--------------------------------------------------------------------------*/
-static int kwsysSystem_Shell__CharIsWhitespace(char c)
-{
-  return ((c == ' ') || (c == '\t'));
-}
-
-/*--------------------------------------------------------------------------*/
-static int kwsysSystem_Shell__CharNeedsQuotesOnUnix(char c)
-{
-  return ((c == '\'') || (c == '`') || (c == ';') || (c == '#') ||
-          (c == '&') || (c == '$') || (c == '(') || (c == ')') ||
-          (c == '~') || (c == '<') || (c == '>') || (c == '|') ||
-          (c == '*') || (c == '^') || (c == '\\'));
-}
-
-/*--------------------------------------------------------------------------*/
-static int kwsysSystem_Shell__CharNeedsQuotesOnWindows(char c)
-{
-  return ((c == '\'') || (c == '#') || (c == '&') ||
-          (c == '<') || (c == '>') || (c == '|') || (c == '^'));
-}
-
-/*--------------------------------------------------------------------------*/
-static int kwsysSystem_Shell__CharNeedsQuotes(char c, int isUnix, int flags)
-{
-  /* On Windows the built-in command shell echo never needs quotes.  */
-  if(!isUnix && (flags & kwsysSystem_Shell_Flag_EchoWindows))
-    {
-    return 0;
-    }
-
-  /* On all platforms quotes are needed to preserve whitespace.  */
-  if(kwsysSystem_Shell__CharIsWhitespace(c))
-    {
-    return 1;
-    }
-
-  if(isUnix)
-    {
-    /* On UNIX several special characters need quotes to preserve them.  */
-    if(kwsysSystem_Shell__CharNeedsQuotesOnUnix(c))
-      {
-      return 1;
-      }
-    }
-  else
-    {
-    /* On Windows several special characters need quotes to preserve them.  */
-    if(kwsysSystem_Shell__CharNeedsQuotesOnWindows(c))
-      {
-      return 1;
-      }
-    }
-  return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-static int kwsysSystem_Shell__CharIsMakeVariableName(char c)
-{
-  return c && (c == '_' || isalpha(((int)c)));
-}
-
-/*--------------------------------------------------------------------------*/
-static const char* kwsysSystem_Shell__SkipMakeVariables(const char* c)
-{
-  while(*c == '$' && *(c+1) == '(')
-    {
-    const char* skip = c+2;
-    while(kwsysSystem_Shell__CharIsMakeVariableName(*skip))
-      {
-      ++skip;
-      }
-    if(*skip == ')')
-      {
-      c = skip+1;
-      }
-    else
-      {
-      break;
-      }
-    }
-  return c;
-}
-
-/*
-Allowing make variable replacements opens a can of worms.  Sometimes
-they should be quoted and sometimes not.  Sometimes their replacement
-values are already quoted or contain escapes.
-
-Some Visual Studio variables cause problems.  In order to pass the
-referenced value with spaces the reference must be quoted.  If the
-variable value ends in a backslash then it will escape the ending
-quote!  In order to make the ending backslash appear we need this:
-
-  "$(InputDir)\"
-
-However if there is not a trailing backslash then this will put a
-quote in the value so we need:
-
-  "$(InputDir)"
-
-This macro decides whether we quote an argument just because it
-contains a make variable reference.  This should be replaced with a
-flag later when we understand applications of this better.
-*/
-#define KWSYS_SYSTEM_SHELL_QUOTE_MAKE_VARIABLES 0
-
-/*--------------------------------------------------------------------------*/
-static int kwsysSystem_Shell__ArgumentNeedsQuotes(const char* in, int isUnix,
-                                                  int flags)
-{
-  /* The empty string needs quotes.  */
-  if(!*in)
-    {
-    return 1;
-    }
-
-  /* Scan the string for characters that require quoting.  */
-  {
-  const char* c;
-  for(c=in; *c; ++c)
-    {
-    /* Look for $(MAKEVAR) syntax if requested.  */
-    if(flags & kwsysSystem_Shell_Flag_AllowMakeVariables)
-      {
-#if KWSYS_SYSTEM_SHELL_QUOTE_MAKE_VARIABLES
-      const char* skip = kwsysSystem_Shell__SkipMakeVariables(c);
-      if(skip != c)
-        {
-        /* We need to quote make variable references to preserve the
-           string with contents substituted in its place.  */
-        return 1;
-        }
-#else
-      /* Skip over the make variable references if any are present.  */
-      c = kwsysSystem_Shell__SkipMakeVariables(c);
-
-      /* Stop if we have reached the end of the string.  */
-      if(!*c)
-        {
-        break;
-        }
-#endif
-      }
-
-    /* Check whether this character needs quotes.  */
-    if(kwsysSystem_Shell__CharNeedsQuotes(*c, isUnix, flags))
-      {
-      return 1;
-      }
-    }
-  }
-
-  /* On Windows some single character arguments need quotes.  */
-  if(!isUnix && *in && !*(in+1))
-    {
-    char c = *in;
-    if((c == '?') || (c == '&') || (c == '^') || (c == '|') || (c == '#'))
-      {
-      return 1;
-      }
-    }
-
-  return 0;
-}
-
-/*--------------------------------------------------------------------------*/
-static int kwsysSystem_Shell__GetArgumentSize(const char* in,
-                                              int isUnix, int flags)
-{
-  /* Start with the length of the original argument, plus one for
-     either a terminating null or a separating space.  */
-  int size = (int)strlen(in) + 1;
-
-  /* String iterator.  */
-  const char* c;
-
-  /* Keep track of how many backslashes have been encountered in a row.  */
-  int windows_backslashes = 0;
-
-  /* Scan the string for characters that require escaping or quoting.  */
-  for(c=in; *c; ++c)
-    {
-    /* Look for $(MAKEVAR) syntax if requested.  */
-    if(flags & kwsysSystem_Shell_Flag_AllowMakeVariables)
-      {
-      /* Skip over the make variable references if any are present.  */
-      c = kwsysSystem_Shell__SkipMakeVariables(c);
-
-      /* Stop if we have reached the end of the string.  */
-      if(!*c)
-        {
-        break;
-        }
-      }
-
-    /* Check whether this character needs escaping for the shell.  */
-    if(isUnix)
-      {
-      /* On Unix a few special characters need escaping even inside a
-         quoted argument.  */
-      if(*c == '\\' || *c == '"' || *c == '`' || *c == '$')
-        {
-        /* This character needs a backslash to escape it.  */
-        ++size;
-        }
-      }
-    else if(flags & kwsysSystem_Shell_Flag_EchoWindows)
-      {
-      /* On Windows the built-in command shell echo never needs escaping.  */
-      }
-    else
-      {
-      /* On Windows only backslashes and double-quotes need escaping.  */
-      if(*c == '\\')
-        {
-        /* Found a backslash.  It may need to be escaped later.  */
-        ++windows_backslashes;
-        }
-      else if(*c == '"')
-        {
-        /* Found a double-quote.  We need to escape it and all
-           immediately preceding backslashes.  */
-        size += windows_backslashes + 1;
-        windows_backslashes = 0;
-        }
-      else
-        {
-        /* Found another character.  This eliminates the possibility
-           that any immediately preceding backslashes will be
-           escaped.  */
-        windows_backslashes = 0;
-        }
-      }
-
-    /* Check whether this character needs escaping for a make tool.  */
-    if(*c == '$')
-      {
-      if(flags & kwsysSystem_Shell_Flag_Make)
-        {
-        /* In Makefiles a dollar is written $$ so we need one extra
-           character.  */
-        ++size;
-        }
-      else if(flags & kwsysSystem_Shell_Flag_VSIDE)
-        {
-        /* In a VS IDE a dollar is written "$" so we need two extra
-           characters.  */
-        size += 2;
-        }
-      }
-    else if(*c == '#')
-      {
-      if((flags & kwsysSystem_Shell_Flag_Make) &&
-         (flags & kwsysSystem_Shell_Flag_WatcomWMake))
-        {
-        /* In Watcom WMake makefiles a pound is written $# so we need
-           one extra character.  */
-        ++size;
-        }
-      }
-    else if(*c == '%')
-      {
-      if((flags & kwsysSystem_Shell_Flag_VSIDE) ||
-         ((flags & kwsysSystem_Shell_Flag_Make) &&
-          ((flags & kwsysSystem_Shell_Flag_MinGWMake) ||
-           (flags & kwsysSystem_Shell_Flag_NMake))))
-        {
-        /* In the VS IDE, NMake, or MinGW make a percent is written %%
-           so we need one extra characters.  */
-        size += 1;
-        }
-      }
-    else if(*c == ';')
-      {
-      if(flags & kwsysSystem_Shell_Flag_VSIDE)
-        {
-        /* In a VS IDE a semicolon is written ";" so we need two extra
-           characters.  */
-        size += 2;
-        }
-      }
-    }
-
-  /* Check whether the argument needs surrounding quotes.  */
-  if(kwsysSystem_Shell__ArgumentNeedsQuotes(in, isUnix, flags))
-    {
-    /* Surrounding quotes are needed.  Allocate space for them.  */
-    if((flags & kwsysSystem_Shell_Flag_WatcomQuote) && (isUnix))
-      {
-        size += 2;
-      }
-    size += 2;
-
-    /* We must escape all ending backslashes when quoting on windows.  */
-    size += windows_backslashes;
-    }
-
-  return size;
-}
-
-/*--------------------------------------------------------------------------*/
-static char* kwsysSystem_Shell__GetArgument(const char* in, char* out,
-                                            int isUnix, int flags)
-{
-  /* String iterator.  */
-  const char* c;
-
-  /* Keep track of how many backslashes have been encountered in a row.  */
-  int windows_backslashes = 0;
-
-  /* Whether the argument must be quoted.  */
-  int needQuotes = kwsysSystem_Shell__ArgumentNeedsQuotes(in, isUnix, flags);
-  if(needQuotes)
-    {
-    /* Add the opening quote for this argument.  */
-    if(flags & kwsysSystem_Shell_Flag_WatcomQuote)
-      {
-      if(isUnix)
-        {
-        *out++ = '"';
-        }
-      *out++ = '\'';
-      }
-    else
-      {
-      *out++ = '"';
-      }
-    }
-
-  /* Scan the string for characters that require escaping or quoting.  */
-  for(c=in; *c; ++c)
-    {
-    /* Look for $(MAKEVAR) syntax if requested.  */
-    if(flags & kwsysSystem_Shell_Flag_AllowMakeVariables)
-      {
-      const char* skip = kwsysSystem_Shell__SkipMakeVariables(c);
-      if(skip != c)
-        {
-        /* Copy to the end of the make variable references.  */
-        while(c != skip)
-          {
-          *out++ = *c++;
-          }
-
-        /* The make variable reference eliminates any escaping needed
-           for preceding backslashes.  */
-        windows_backslashes = 0;
-
-        /* Stop if we have reached the end of the string.  */
-        if(!*c)
-          {
-          break;
-          }
-        }
-      }
-
-    /* Check whether this character needs escaping for the shell.  */
-    if(isUnix)
-      {
-      /* On Unix a few special characters need escaping even inside a
-         quoted argument.  */
-      if(*c == '\\' || *c == '"' || *c == '`' || *c == '$')
-        {
-        /* This character needs a backslash to escape it.  */
-        *out++ = '\\';
-        }
-      }
-    else if(flags & kwsysSystem_Shell_Flag_EchoWindows)
-      {
-      /* On Windows the built-in command shell echo never needs escaping.  */
-      }
-    else
-      {
-      /* On Windows only backslashes and double-quotes need escaping.  */
-      if(*c == '\\')
-        {
-        /* Found a backslash.  It may need to be escaped later.  */
-        ++windows_backslashes;
-        }
-      else if(*c == '"')
-        {
-        /* Found a double-quote.  Escape all immediately preceding
-           backslashes.  */
-        while(windows_backslashes > 0)
-          {
-          --windows_backslashes;
-          *out++ = '\\';
-          }
-
-        /* Add the backslash to escape the double-quote.  */
-        *out++ = '\\';
-        }
-      else
-        {
-        /* We encountered a normal character.  This eliminates any
-           escaping needed for preceding backslashes.  */
-        windows_backslashes = 0;
-        }
-      }
-
-    /* Check whether this character needs escaping for a make tool.  */
-    if(*c == '$')
-      {
-      if(flags & kwsysSystem_Shell_Flag_Make)
-        {
-        /* In Makefiles a dollar is written $$.  The make tool will
-           replace it with just $ before passing it to the shell.  */
-        *out++ = '$';
-        *out++ = '$';
-        }
-      else if(flags & kwsysSystem_Shell_Flag_VSIDE)
-        {
-        /* In a VS IDE a dollar is written "$".  If this is written in
-           an un-quoted argument it starts a quoted segment, inserts
-           the $ and ends the segment.  If it is written in a quoted
-           argument it ends quoting, inserts the $ and restarts
-           quoting.  Either way the $ is isolated from surrounding
-           text to avoid looking like a variable reference.  */
-        *out++ = '"';
-        *out++ = '$';
-        *out++ = '"';
-        }
-      else
-        {
-        /* Otherwise a dollar is written just $. */
-        *out++ = '$';
-        }
-      }
-    else if(*c == '#')
-      {
-      if((flags & kwsysSystem_Shell_Flag_Make) &&
-         (flags & kwsysSystem_Shell_Flag_WatcomWMake))
-        {
-        /* In Watcom WMake makefiles a pound is written $#.  The make
-           tool will replace it with just # before passing it to the
-           shell.  */
-        *out++ = '$';
-        *out++ = '#';
-        }
-      else
-        {
-        /* Otherwise a pound is written just #. */
-        *out++ = '#';
-        }
-      }
-    else if(*c == '%')
-      {
-      if((flags & kwsysSystem_Shell_Flag_VSIDE) ||
-         ((flags & kwsysSystem_Shell_Flag_Make) &&
-          ((flags & kwsysSystem_Shell_Flag_MinGWMake) ||
-           (flags & kwsysSystem_Shell_Flag_NMake))))
-        {
-        /* In the VS IDE, NMake, or MinGW make a percent is written %%.  */
-        *out++ = '%';
-        *out++ = '%';
-        }
-      else
-        {
-        /* Otherwise a percent is written just %. */
-        *out++ = '%';
-        }
-      }
-    else if(*c == ';')
-      {
-      if(flags & kwsysSystem_Shell_Flag_VSIDE)
-        {
-        /* In a VS IDE a semicolon is written ";".  If this is written
-           in an un-quoted argument it starts a quoted segment,
-           inserts the ; and ends the segment.  If it is written in a
-           quoted argument it ends quoting, inserts the ; and restarts
-           quoting.  Either way the ; is isolated.  */
-        *out++ = '"';
-        *out++ = ';';
-        *out++ = '"';
-        }
-      else
-        {
-        /* Otherwise a semicolon is written just ;. */
-        *out++ = ';';
-        }
-      }
-    else
-      {
-      /* Store this character.  */
-      *out++ = *c;
-      }
-    }
-
-  if(needQuotes)
-    {
-    /* Add enough backslashes to escape any trailing ones.  */
-    while(windows_backslashes > 0)
-      {
-      --windows_backslashes;
-      *out++ = '\\';
-      }
-
-    /* Add the closing quote for this argument.  */
-    if(flags & kwsysSystem_Shell_Flag_WatcomQuote)
-      {
-      *out++ = '\'';
-      if(isUnix)
-        {
-        *out++ = '"';
-        }
-      }
-    else
-      {
-      *out++ = '"';
-      }
-    }
-
-  /* Store a terminating null without incrementing.  */
-  *out = 0;
-
-  return out;
-}
-
-/*--------------------------------------------------------------------------*/
-char* kwsysSystem_Shell_GetArgumentForWindows(const char* in,
-                                              char* out,
-                                              int flags)
-{
-  return kwsysSystem_Shell__GetArgument(in, out, 0, flags);
-}
-
-/*--------------------------------------------------------------------------*/
-char* kwsysSystem_Shell_GetArgumentForUnix(const char* in,
-                                           char* out,
-                                           int flags)
-{
-  return kwsysSystem_Shell__GetArgument(in, out, 1, flags);
-}
-
-/*--------------------------------------------------------------------------*/
-int kwsysSystem_Shell_GetArgumentSizeForWindows(const char* in, int flags)
-{
-  return kwsysSystem_Shell__GetArgumentSize(in, 0, flags);
-}
-
-/*--------------------------------------------------------------------------*/
-int kwsysSystem_Shell_GetArgumentSizeForUnix(const char* in, int flags)
-{
-  return kwsysSystem_Shell__GetArgumentSize(in, 1, flags);
-}
-
 /*--------------------------------------------------------------------------*/
 static int kwsysSystem__AppendByte(char* local,
                                    char** begin, char** end,
diff --git a/src/kwsys/System.h.in b/src/kwsys/System.h.in
index f21bf0d..3f3d3f4 100644
--- a/src/kwsys/System.h.in
+++ b/src/kwsys/System.h.in
@@ -24,28 +24,6 @@
 #endif
 #if !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
 # define kwsysSystem_Parse_CommandForUnix             kwsys_ns(System_Parse_CommandForUnix)
-# define kwsysSystem_Shell_GetArgumentForWindows      kwsys_ns(System_Shell_GetArgumentForWindows)
-# define kwsysSystem_Shell_GetArgumentForUnix         kwsys_ns(System_Shell_GetArgumentForUnix)
-# define kwsysSystem_Shell_GetArgumentSizeForWindows  kwsys_ns(System_Shell_GetArgumentSizeForWindows)
-# define kwsysSystem_Shell_GetArgumentSizeForUnix     kwsys_ns(System_Shell_GetArgumentSizeForUnix)
-# define kwsysSystem_Shell_Flag_e                     kwsys_ns(System_Shell_Flag_e)
-# define kwsysSystem_Shell_Flag_Make                  kwsys_ns(System_Shell_Flag_Make)
-# define kwsysSystem_Shell_Flag_VSIDE                 kwsys_ns(System_Shell_Flag_VSIDE)
-# define kwsysSystem_Shell_Flag_EchoWindows           kwsys_ns(System_Shell_Flag_EchoWindows)
-# define kwsysSystem_Shell_Flag_WatcomWMake           kwsys_ns(System_Shell_Flag_WatcomWMake)
-# define kwsysSystem_Shell_Flag_MinGWMake             kwsys_ns(System_Shell_Flag_MinGWMake)
-# define kwsysSystem_Shell_Flag_NMake                 kwsys_ns(System_Shell_Flag_NMake)
-# define kwsysSystem_Shell_Flag_AllowMakeVariables    kwsys_ns(System_Shell_Flag_AllowMakeVariables)
-# define kwsysSystem_Shell_Flag_WatcomQuote           kwsys_ns(System_Shell_Flag_WatcomQuote)
-#endif
-
-#ifdef __VMS
-#define @KWSYS_NAMESPACE at System_Shell_GetArgumentForUnix \
-   @KWSYS_NAMESPACE at System_Shell_UnixGA
-#define @KWSYS_NAMESPACE at System_Shell_GetArgumentSizeForUnix \
-   @KWSYS_NAMESPACE at System_Shell_UnixGAS
-#define @KWSYS_NAMESPACE at System_Shell_GetArgumentForWindows \
-   @KWSYS_NAMESPACE at System_Shell_WindowsGA
 #endif
 
 #if defined(__cplusplus)
@@ -54,69 +32,6 @@ extern "C"
 #endif
 
 /**
- * Transform the given command line argument for use in a Windows or
- * Unix shell.  Returns a pointer to the end of the command line
- * argument in the provided output buffer.  Flags may be passed to
- * modify the generated quoting and escape sequences to work under
- * alternative environments.
- */
-kwsysEXPORT char* kwsysSystem_Shell_GetArgumentForWindows(const char* in,
-                                                          char* out,
-                                                          int flags);
-kwsysEXPORT char* kwsysSystem_Shell_GetArgumentForUnix(const char* in,
-                                                       char* out,
-                                                       int flags);
-
-/**
- * Compute the size of the buffer required to store the output from
- * kwsysSystem_Shell_GetArgumentForWindows or
- * kwsysSystem_Shell_GetArgumentForUnix.  The flags passed must be
- * identical between the two calls.
- */
-kwsysEXPORT int kwsysSystem_Shell_GetArgumentSizeForWindows(const char* in,
-                                                            int flags);
-kwsysEXPORT int kwsysSystem_Shell_GetArgumentSizeForUnix(const char* in,
-                                                         int flags);
-
-/**
- * Flags to pass to kwsysSystem_Shell_GetArgumentForWindows or
- * kwsysSystem_Shell_GetArgumentForUnix.  These modify the generated
- * quoting and escape sequences to work under alternative
- * environments.
- */
-enum kwsysSystem_Shell_Flag_e
-{
-  /** The target shell is in a makefile.  */
-  kwsysSystem_Shell_Flag_Make               = (1<<0),
-
-  /** The target shell is in a VS project file.  Do not use with
-      Shell_Flag_Make.  */
-  kwsysSystem_Shell_Flag_VSIDE              = (1<<1),
-
-  /** In a windows shell the argument is being passed to "echo".  */
-  kwsysSystem_Shell_Flag_EchoWindows        = (1<<2),
-
-  /** The target shell is in a Watcom WMake makefile.  */
-  kwsysSystem_Shell_Flag_WatcomWMake        = (1<<3),
-
-  /** The target shell is in a MinGW Make makefile.  */
-  kwsysSystem_Shell_Flag_MinGWMake          = (1<<4),
-
-  /** The target shell is in a NMake makefile.  */
-  kwsysSystem_Shell_Flag_NMake              = (1<<5),
-
-  /** Make variable reference syntax $(MAKEVAR) should not be escaped
-      to allow a build tool to replace it.  Replacement values
-      containing spaces, quotes, backslashes, or other
-      non-alphanumeric characters that have significance to some makes
-      or shells produce undefined behavior.  */
-  kwsysSystem_Shell_Flag_AllowMakeVariables = (1<<6),
-
-  /** The target shell quoting uses extra single Quotes for Watcom tools.  */
-  kwsysSystem_Shell_Flag_WatcomQuote        = (1<<7)
-};
-
-/**
  * Parse a unix-style command line string into separate arguments.
  *
  * On success, returns a pointer to an array of pointers to individual
@@ -148,19 +63,6 @@ kwsysEXPORT char** kwsysSystem_Parse_CommandForUnix(const char* command,
 # undef kwsysEXPORT
 # if !defined(KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
 #  undef kwsysSystem_Parse_CommandForUnix
-#  undef kwsysSystem_Shell_GetArgumentForWindows
-#  undef kwsysSystem_Shell_GetArgumentForUnix
-#  undef kwsysSystem_Shell_GetArgumentSizeForWindows
-#  undef kwsysSystem_Shell_GetArgumentSizeForUnix
-#  undef kwsysSystem_Shell_Flag_e
-#  undef kwsysSystem_Shell_Flag_Make
-#  undef kwsysSystem_Shell_Flag_VSIDE
-#  undef kwsysSystem_Shell_Flag_EchoWindows
-#  undef kwsysSystem_Shell_Flag_WatcomWMake
-#  undef kwsysSystem_Shell_Flag_MinGWMake
-#  undef kwsysSystem_Shell_Flag_NMake
-#  undef kwsysSystem_Shell_Flag_AllowMakeVariables
-#  undef kwsysSystem_Shell_Flag_WatcomQuote
 # endif
 #endif
 
diff --git a/src/kwsys/SystemInformation.cxx b/src/kwsys/SystemInformation.cxx
deleted file mode 100644
index 3e1a1ab..0000000
--- a/src/kwsys/SystemInformation.cxx
+++ /dev/null
@@ -1,5374 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-
-#if defined(_WIN32)
-# define NOMINMAX // use our min,max
-# if !defined(_WIN32_WINNT) && !(defined(_MSC_VER) && _MSC_VER < 1300)
-#  define _WIN32_WINNT 0x0501
-# endif
-# include <winsock.h> // WSADATA, include before sys/types.h
-#endif
-
-#if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE)
-# define _GNU_SOURCE
-#endif
-
-// TODO:
-// We need an alternative implementation for many functions in this file
-// when USE_ASM_INSTRUCTIONS gets defined as 0.
-//
-// Consider using these on Win32/Win64 for some of them:
-//
-// IsProcessorFeaturePresent
-// http://msdn.microsoft.com/en-us/library/ms724482(VS.85).aspx
-//
-// GetProcessMemoryInfo
-// http://msdn.microsoft.com/en-us/library/ms683219(VS.85).aspx
-
-#include "kwsysPrivate.h"
-#include KWSYS_HEADER(stl/string)
-#include KWSYS_HEADER(stl/vector)
-#include KWSYS_HEADER(ios/iosfwd)
-#include KWSYS_HEADER(SystemInformation.hxx)
-#include KWSYS_HEADER(Process.h)
-#include KWSYS_HEADER(ios/iostream)
-#include KWSYS_HEADER(ios/sstream)
-#include KWSYS_HEADER(ios/fstream)
-
-// Work-around CMake dependency scanning limitation.  This must
-// duplicate the above list of headers.
-#if 0
-# include "SystemInformation.hxx.in"
-# include "Process.h.in"
-# include "Configure.hxx.in"
-# include "kwsys_stl.hxx.in"
-# include "kwsys_stl_vector.in"
-# include "kwsys_stl_iosfwd.in"
-# include "kwsys_ios_sstream.h.in"
-# include "kwsys_ios_iostream.h.in"
-# include "kwsys_ios_fstream.h.in"
-#endif
-
-#if defined(_WIN32)
-# include <windows.h>
-# if defined(_MSC_VER) && _MSC_VER >= 1800
-#  define KWSYS_WINDOWS_DEPRECATED_GetVersionEx
-# endif
-# include <errno.h>
-# if defined(KWSYS_SYS_HAS_PSAPI)
-#  include <psapi.h>
-# endif
-# if !defined(siginfo_t)
-typedef int siginfo_t;
-# endif
-#else
-# include <sys/types.h>
-# include <sys/time.h>
-# include <sys/utsname.h> // int uname(struct utsname *buf);
-# include <sys/resource.h> // getrlimit
-# include <unistd.h>
-# include <signal.h>
-# include <fcntl.h>
-# include <errno.h> // extern int errno;
-#endif
-
-#ifdef __FreeBSD__
-# include <sys/sysctl.h>
-# include <fenv.h>
-# include <sys/socket.h>
-# include <netdb.h>
-# include <netinet/in.h>
-# if defined(KWSYS_SYS_HAS_IFADDRS_H)
-#  include <ifaddrs.h>
-#  define KWSYS_SYSTEMINFORMATION_IMPLEMENT_FQDN
-# endif
-#endif
-
-#if defined(__OpenBSD__) || defined(__NetBSD__)
-# include <sys/param.h>
-# include <sys/sysctl.h>
-#endif
-
-#if defined(KWSYS_SYS_HAS_MACHINE_CPU_H)
-# include <machine/cpu.h>
-#endif
-
-#if defined(__DragonFly__)
-# include <sys/sysctl.h>
-#endif
-
-#ifdef __APPLE__
-# include <sys/sysctl.h>
-# include <mach/vm_statistics.h>
-# include <mach/host_info.h>
-# include <mach/mach.h>
-# include <mach/mach_types.h>
-# include <fenv.h>
-# include <sys/socket.h>
-# include <netdb.h>
-# include <netinet/in.h>
-# if defined(KWSYS_SYS_HAS_IFADDRS_H)
-#  include <ifaddrs.h>
-#  define KWSYS_SYSTEMINFORMATION_IMPLEMENT_FQDN
-# endif
-# if !(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0 >= 1050)
-#  undef KWSYS_SYSTEMINFORMATION_HAS_BACKTRACE
-# endif
-#endif
-
-#ifdef __linux
-# include <fenv.h>
-# include <sys/socket.h>
-# include <netdb.h>
-# include <netinet/in.h>
-# if defined(KWSYS_SYS_HAS_IFADDRS_H)
-#  include <ifaddrs.h>
-#  if !defined(__LSB_VERSION__) /* LSB has no getifaddrs */
-#   define KWSYS_SYSTEMINFORMATION_IMPLEMENT_FQDN
-#  endif
-# endif
-# if defined(KWSYS_CXX_HAS_RLIMIT64)
-typedef struct rlimit64 ResourceLimitType;
-#  define GetResourceLimit getrlimit64
-# else
-typedef struct rlimit ResourceLimitType;
-#  define GetResourceLimit getrlimit
-# endif
-#elif defined( __hpux )
-# include <sys/param.h>
-# include <sys/pstat.h>
-# if defined(KWSYS_SYS_HAS_MPCTL_H)
-#  include <sys/mpctl.h>
-# endif
-#endif
-
-#ifdef __HAIKU__
-# include <OS.h>
-#endif
-
-#if defined(KWSYS_SYSTEMINFORMATION_HAS_BACKTRACE)
-# include <execinfo.h>
-# if defined(KWSYS_SYSTEMINFORMATION_HAS_CPP_DEMANGLE)
-#  include <cxxabi.h>
-# endif
-# if defined(KWSYS_SYSTEMINFORMATION_HAS_SYMBOL_LOOKUP)
-#  include <dlfcn.h>
-# endif
-#else
-# undef KWSYS_SYSTEMINFORMATION_HAS_CPP_DEMANGLE
-# undef KWSYS_SYSTEMINFORMATION_HAS_SYMBOL_LOOKUP
-#endif
-
-#include <memory.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h> // int isdigit(int c);
-
-#if defined(KWSYS_USE_LONG_LONG)
-# if defined(KWSYS_IOS_HAS_OSTREAM_LONG_LONG)
-#  define iostreamLongLong(x) (x)
-# else
-#  define iostreamLongLong(x) ((long)x)
-# endif
-#elif defined(KWSYS_USE___INT64)
-# if defined(KWSYS_IOS_HAS_OSTREAM___INT64)
-#  define iostreamLongLong(x) (x)
-# else
-#  define iostreamLongLong(x) ((long)x)
-# endif
-#else
-# error "No Long Long"
-#endif
-
-#if defined(KWSYS_CXX_HAS_ATOLL)
-# define atoLongLong atoll
-#else
-# if defined(KWSYS_CXX_HAS__ATOI64)
-#  define atoLongLong _atoi64
-# elif defined(KWSYS_CXX_HAS_ATOL)
-#  define atoLongLong atol
-# else
-#  define atoLongLong atoi
-# endif
-#endif
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(_WIN64)
-#define USE_ASM_INSTRUCTIONS 1
-#else
-#define USE_ASM_INSTRUCTIONS 0
-#endif
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1400)
-#include <intrin.h>
-#define USE_CPUID_INTRINSICS 1
-#else
-#define USE_CPUID_INTRINSICS 0
-#endif
-
-#if USE_ASM_INSTRUCTIONS || USE_CPUID_INTRINSICS || defined(KWSYS_CXX_HAS_BORLAND_ASM_CPUID)
-# define USE_CPUID 1
-#else
-# define USE_CPUID 0
-#endif
-
-#if USE_CPUID
-
-#define CPUID_AWARE_COMPILER
-
-/**
- * call CPUID instruction
- *
- * Will return false if the instruction failed.
- */
-static bool call_cpuid(int select, int result[4])
-{
-#if USE_CPUID_INTRINSICS
-  __cpuid(result, select);
-  return true;
-#else
-  int tmp[4];
-#if defined(_MSC_VER)
-  // Use SEH to determine CPUID presence
-  __try {
-    _asm {
-#ifdef CPUID_AWARE_COMPILER
-      ; we must push/pop the registers <<CPUID>> writes to, as the
-      ; optimiser does not know about <<CPUID>>, and so does not expect
-      ; these registers to change.
-      push eax
-      push ebx
-      push ecx
-      push edx
-#endif
-      ; <<CPUID>>
-      mov eax, select
-#ifdef CPUID_AWARE_COMPILER
-      cpuid
-#else
-      _asm _emit 0x0f
-      _asm _emit 0xa2
-#endif
-      mov tmp[0 * TYPE int], eax
-      mov tmp[1 * TYPE int], ebx
-      mov tmp[2 * TYPE int], ecx
-      mov tmp[3 * TYPE int], edx
-
-#ifdef CPUID_AWARE_COMPILER
-      pop edx
-      pop ecx
-      pop ebx
-      pop eax
-#endif
-      }
-    }
-  __except(1)
-    {
-    return false;
-    }
-
-    memcpy(result, tmp, sizeof(tmp));
-#elif defined(KWSYS_CXX_HAS_BORLAND_ASM_CPUID)
-  unsigned int a, b, c, d;
-  __asm {
-    mov EAX, select;
-    cpuid
-    mov a, EAX;
-    mov b, EBX;
-    mov c, ECX;
-    mov d, EDX;
-  }
-
-  result[0] = a;
-  result[1] = b;
-  result[2] = c;
-  result[3] = d;
-#endif
-
-  // The cpuid instruction succeeded.
-  return true;
-#endif
-}
-#endif
-
-
-namespace KWSYS_NAMESPACE
-{
-template<typename T>
-T min(T a, T b){ return a<b ? a : b; }
-
-extern "C" { typedef void (*SigAction)(int,siginfo_t*,void*); }
-
-//  Define SystemInformationImplementation class
-typedef  void (*DELAY_FUNC)(unsigned int uiMS);
-
-class SystemInformationImplementation
-{
-public:
-  typedef SystemInformation::LongLong LongLong;
-  SystemInformationImplementation ();
-  ~SystemInformationImplementation ();
-
-  const char * GetVendorString();
-  const char * GetVendorID();
-  kwsys_stl::string GetTypeID();
-  kwsys_stl::string GetFamilyID();
-  kwsys_stl::string GetModelID();
-  kwsys_stl::string GetModelName();
-  kwsys_stl::string GetSteppingCode();
-  const char * GetExtendedProcessorName();
-  const char * GetProcessorSerialNumber();
-  int GetProcessorCacheSize();
-  unsigned int GetLogicalProcessorsPerPhysical();
-  float GetProcessorClockFrequency();
-  int GetProcessorAPICID();
-  int GetProcessorCacheXSize(long int);
-  bool DoesCPUSupportFeature(long int);
-
-  const char * GetOSName();
-  const char * GetHostname();
-  int GetFullyQualifiedDomainName(kwsys_stl::string &fqdn);
-  const char * GetOSRelease();
-  const char * GetOSVersion();
-  const char * GetOSPlatform();
-
-  bool Is64Bits();
-
-  unsigned int GetNumberOfLogicalCPU(); // per physical cpu
-  unsigned int GetNumberOfPhysicalCPU();
-
-  bool DoesCPUSupportCPUID();
-
-  // Retrieve memory information in megabyte.
-  size_t GetTotalVirtualMemory();
-  size_t GetAvailableVirtualMemory();
-  size_t GetTotalPhysicalMemory();
-  size_t GetAvailablePhysicalMemory();
-
-  LongLong GetProcessId();
-
-  // Retrieve memory information in kib
-  LongLong GetHostMemoryTotal();
-  LongLong GetHostMemoryAvailable(const char *envVarName);
-  LongLong GetHostMemoryUsed();
-
-  LongLong GetProcMemoryAvailable(
-        const char *hostLimitEnvVarName,
-        const char *procLimitEnvVarName);
-  LongLong GetProcMemoryUsed();
-
-  // enable/disable stack trace signal handler.
-  static
-  void SetStackTraceOnError(int enable);
-
-  // get current stack
-  static
-  kwsys_stl::string GetProgramStack(int firstFrame, int wholePath);
-
-  /** Run the different checks */
-  void RunCPUCheck();
-  void RunOSCheck();
-  void RunMemoryCheck();
-
-public:
-  typedef struct tagID
-    {
-    int Type;
-    int Family;
-    int Model;
-    int Revision;
-    int ExtendedFamily;
-    int ExtendedModel;
-    kwsys_stl::string ProcessorName;
-    kwsys_stl::string Vendor;
-    kwsys_stl::string SerialNumber;
-    kwsys_stl::string ModelName;
-    } ID;
-
-  typedef struct tagCPUPowerManagement
-    {
-    bool HasVoltageID;
-    bool HasFrequencyID;
-    bool HasTempSenseDiode;
-    } CPUPowerManagement;
-
-  typedef struct tagCPUExtendedFeatures
-    {
-    bool Has3DNow;
-    bool Has3DNowPlus;
-    bool SupportsMP;
-    bool HasMMXPlus;
-    bool HasSSEMMX;
-    bool SupportsHyperthreading;
-    unsigned int LogicalProcessorsPerPhysical;
-    int APIC_ID;
-    CPUPowerManagement PowerManagement;
-    } CPUExtendedFeatures;
-
-  typedef struct CPUtagFeatures
-    {
-    bool HasFPU;
-    bool HasTSC;
-    bool HasMMX;
-    bool HasSSE;
-    bool HasSSEFP;
-    bool HasSSE2;
-    bool HasIA64;
-    bool HasAPIC;
-    bool HasCMOV;
-    bool HasMTRR;
-    bool HasACPI;
-    bool HasSerial;
-    bool HasThermal;
-    int CPUSpeed;
-    int L1CacheSize;
-    int L2CacheSize;
-    int L3CacheSize;
-    CPUExtendedFeatures ExtendedFeatures;
-    } CPUFeatures;
-
-  enum Manufacturer
-    {
-    AMD, Intel, NSC, UMC, Cyrix, NexGen, IDT, Rise, Transmeta, Sun, IBM,
-    Motorola, HP, UnknownManufacturer
-    };
-
-protected:
-  // Functions.
-  bool RetrieveCPUFeatures();
-  bool RetrieveCPUIdentity();
-  bool RetrieveCPUCacheDetails();
-  bool RetrieveClassicalCPUCacheDetails();
-  bool RetrieveCPUClockSpeed();
-  bool RetrieveClassicalCPUClockSpeed();
-  bool RetrieveCPUExtendedLevelSupport(int);
-  bool RetrieveExtendedCPUFeatures();
-  bool RetrieveProcessorSerialNumber();
-  bool RetrieveCPUPowerManagement();
-  bool RetrieveClassicalCPUIdentity();
-  bool RetrieveExtendedCPUIdentity();
-
-  Manufacturer  ChipManufacturer;
-  CPUFeatures   Features;
-  ID            ChipID;
-  float         CPUSpeedInMHz;
-  unsigned int  NumberOfLogicalCPU;
-  unsigned int  NumberOfPhysicalCPU;
-
-  int CPUCount();
-  unsigned char LogicalCPUPerPhysicalCPU();
-  unsigned char GetAPICId();
-  bool IsHyperThreadingSupported();
-  static LongLong GetCyclesDifference(DELAY_FUNC, unsigned int);
-
-  // For Linux and Cygwin, /proc/cpuinfo formats are slightly different
-  bool RetreiveInformationFromCpuInfoFile();
-  kwsys_stl::string ExtractValueFromCpuInfoFile(kwsys_stl::string buffer,
-                                          const char* word, size_t init=0);
-
-  bool QueryLinuxMemory();
-  bool QueryCygwinMemory();
-
-  static void Delay (unsigned int);
-  static void DelayOverhead (unsigned int);
-
-  void FindManufacturer(const kwsys_stl::string &family = "");
-
-  // For Mac
-  bool ParseSysCtl();
-  int CallSwVers(const char *arg, kwsys_stl::string &ver);
-  void TrimNewline(kwsys_stl::string&);
-  kwsys_stl::string ExtractValueFromSysCtl(const char* word);
-  kwsys_stl::string SysCtlBuffer;
-
-  // For Solaris
-  bool QuerySolarisMemory();
-  bool QuerySolarisProcessor();
-  kwsys_stl::string ParseValueFromKStat(const char* arguments);
-  kwsys_stl::string RunProcess(kwsys_stl::vector<const char*> args);
-
-  //For Haiku OS
-  bool QueryHaikuInfo();
-
-  //For QNX
-  bool QueryQNXMemory();
-  bool QueryQNXProcessor();
-
-  //For OpenBSD, FreeBSD, NetBSD, DragonFly
-  bool QueryBSDMemory();
-  bool QueryBSDProcessor();
-
-  //For HP-UX
-  bool QueryHPUXMemory();
-  bool QueryHPUXProcessor();
-
-  //For Microsoft Windows
-  bool QueryWindowsMemory();
-
-  //For AIX
-  bool QueryAIXMemory();
-
-  bool QueryProcessorBySysconf();
-  bool QueryProcessor();
-
-  // Evaluate the memory information.
-  bool QueryMemoryBySysconf();
-  bool QueryMemory();
-  size_t TotalVirtualMemory;
-  size_t AvailableVirtualMemory;
-  size_t TotalPhysicalMemory;
-  size_t AvailablePhysicalMemory;
-
-  size_t CurrentPositionInFile;
-
-  // Operating System information
-  bool QueryOSInformation();
-  kwsys_stl::string OSName;
-  kwsys_stl::string Hostname;
-  kwsys_stl::string OSRelease;
-  kwsys_stl::string OSVersion;
-  kwsys_stl::string OSPlatform;
-};
-
-
-SystemInformation::SystemInformation()
-{
-  this->Implementation = new SystemInformationImplementation;
-}
-
-SystemInformation::~SystemInformation()
-{
-  delete this->Implementation;
-}
-
-const char * SystemInformation::GetVendorString()
-{
-  return this->Implementation->GetVendorString();
-}
-
-const char * SystemInformation::GetVendorID()
-{
-  return this->Implementation->GetVendorID();
-}
-
-kwsys_stl::string SystemInformation::GetTypeID()
-{
-  return this->Implementation->GetTypeID();
-}
-
-kwsys_stl::string SystemInformation::GetFamilyID()
-{
-  return this->Implementation->GetFamilyID();
-}
-
-kwsys_stl::string SystemInformation::GetModelID()
-{
-  return this->Implementation->GetModelID();
-}
-
-kwsys_stl::string SystemInformation::GetModelName()
-{
-  return this->Implementation->GetModelName();
-}
-
-kwsys_stl::string SystemInformation::GetSteppingCode()
-{
-  return this->Implementation->GetSteppingCode();
-}
-
-const char * SystemInformation::GetExtendedProcessorName()
-{
-  return this->Implementation->GetExtendedProcessorName();
-}
-
-const char * SystemInformation::GetProcessorSerialNumber()
-{
-  return this->Implementation->GetProcessorSerialNumber();
-}
-
-int SystemInformation::GetProcessorCacheSize()
-{
-  return this->Implementation->GetProcessorCacheSize();
-}
-
-unsigned int SystemInformation::GetLogicalProcessorsPerPhysical()
-{
-  return this->Implementation->GetLogicalProcessorsPerPhysical();
-}
-
-float SystemInformation::GetProcessorClockFrequency()
-{
-  return this->Implementation->GetProcessorClockFrequency();
-}
-
-int SystemInformation::GetProcessorAPICID()
-{
-  return this->Implementation->GetProcessorAPICID();
-}
-
-int SystemInformation::GetProcessorCacheXSize(long int l)
-{
-  return this->Implementation->GetProcessorCacheXSize(l);
-}
-
-bool SystemInformation::DoesCPUSupportFeature(long int i)
-{
-  return this->Implementation->DoesCPUSupportFeature(i);
-}
-
-kwsys_stl::string SystemInformation::GetCPUDescription()
-{
-  kwsys_ios::ostringstream oss;
-  oss
-    << this->GetNumberOfPhysicalCPU()
-    << " core ";
-  if (this->GetModelName().empty())
-    {
-    oss
-      << this->GetProcessorClockFrequency()
-      << " MHz "
-      << this->GetVendorString()
-      << " "
-      << this->GetExtendedProcessorName();
-    }
-  else
-    {
-    oss << this->GetModelName();
-    }
-
-  // remove extra spaces
-  kwsys_stl::string tmp=oss.str();
-  size_t pos;
-  while( (pos=tmp.find("  "))!=kwsys_stl::string::npos)
-    {
-    tmp.replace(pos,2," ");
-    }
-
-  return tmp;
-}
-
-const char * SystemInformation::GetOSName()
-{
-  return this->Implementation->GetOSName();
-}
-
-const char * SystemInformation::GetHostname()
-{
-  return this->Implementation->GetHostname();
-}
-
-kwsys_stl::string SystemInformation::GetFullyQualifiedDomainName()
-{
-  kwsys_stl::string fqdn;
-  this->Implementation->GetFullyQualifiedDomainName(fqdn);
-  return fqdn;
-}
-
-const char * SystemInformation::GetOSRelease()
-{
-  return this->Implementation->GetOSRelease();
-}
-
-const char * SystemInformation::GetOSVersion()
-{
-  return this->Implementation->GetOSVersion();
-}
-
-const char * SystemInformation::GetOSPlatform()
-{
-  return this->Implementation->GetOSPlatform();
-}
-
-int SystemInformation::GetOSIsWindows()
-{
-#if defined(_WIN32)
-  return 1;
-#else
-  return 0;
-#endif
-}
-
-int SystemInformation::GetOSIsLinux()
-{
-#if defined(__linux)
-  return 1;
-#else
-  return 0;
-#endif
-}
-
-int SystemInformation::GetOSIsApple()
-{
-#if defined(__APPLE__)
-  return 1;
-#else
-  return 0;
-#endif
-}
-
-kwsys_stl::string SystemInformation::GetOSDescription()
-{
-  kwsys_ios::ostringstream oss;
-  oss
-    << this->GetOSName()
-    << " "
-    << this->GetOSRelease()
-    << " "
-    << this->GetOSVersion();
-
-  return oss.str();
-}
-
-bool SystemInformation::Is64Bits()
-{
-  return this->Implementation->Is64Bits();
-}
-
-unsigned int SystemInformation::GetNumberOfLogicalCPU() // per physical cpu
-{
-  return this->Implementation->GetNumberOfLogicalCPU();
-}
-
-unsigned int SystemInformation::GetNumberOfPhysicalCPU()
-{
-  return this->Implementation->GetNumberOfPhysicalCPU();
-}
-
-bool SystemInformation::DoesCPUSupportCPUID()
-{
-  return this->Implementation->DoesCPUSupportCPUID();
-}
-
-// Retrieve memory information in megabyte.
-size_t SystemInformation::GetTotalVirtualMemory()
-{
-  return this->Implementation->GetTotalVirtualMemory();
-}
-
-size_t SystemInformation::GetAvailableVirtualMemory()
-{
-  return this->Implementation->GetAvailableVirtualMemory();
-}
-
-size_t SystemInformation::GetTotalPhysicalMemory()
-{
-  return this->Implementation->GetTotalPhysicalMemory();
-}
-
-size_t SystemInformation::GetAvailablePhysicalMemory()
-{
-  return this->Implementation->GetAvailablePhysicalMemory();
-}
-
-kwsys_stl::string SystemInformation::GetMemoryDescription(
-      const char *hostLimitEnvVarName,
-      const char *procLimitEnvVarName)
-{
-  kwsys_ios::ostringstream oss;
-  oss
-    << "Host Total: "
-    << iostreamLongLong(this->GetHostMemoryTotal())
-    << " KiB, Host Available: "
-    << iostreamLongLong(this->GetHostMemoryAvailable(hostLimitEnvVarName))
-    << " KiB, Process Available: "
-    << iostreamLongLong(
-         this->GetProcMemoryAvailable(hostLimitEnvVarName,procLimitEnvVarName))
-    << " KiB";
-  return oss.str();
-}
-
-// host memory info in units of KiB.
-SystemInformation::LongLong SystemInformation::GetHostMemoryTotal()
-{
-  return this->Implementation->GetHostMemoryTotal();
-}
-
-SystemInformation::LongLong
-SystemInformation::GetHostMemoryAvailable(const char *hostLimitEnvVarName)
-{
-  return this->Implementation->GetHostMemoryAvailable(hostLimitEnvVarName);
-}
-
-SystemInformation::LongLong SystemInformation::GetHostMemoryUsed()
-{
-  return this->Implementation->GetHostMemoryUsed();
-}
-
-// process memory info in units of KiB.
-SystemInformation::LongLong
-SystemInformation::GetProcMemoryAvailable(
-        const char *hostLimitEnvVarName,
-        const char *procLimitEnvVarName)
-{
-  return this->Implementation->GetProcMemoryAvailable(
-          hostLimitEnvVarName,
-          procLimitEnvVarName);
-}
-
-SystemInformation::LongLong SystemInformation::GetProcMemoryUsed()
-{
-  return this->Implementation->GetProcMemoryUsed();
-}
-
-SystemInformation::LongLong SystemInformation::GetProcessId()
-{
-  return this->Implementation->GetProcessId();
-}
-
-void SystemInformation::SetStackTraceOnError(int enable)
-{
-  SystemInformationImplementation::SetStackTraceOnError(enable);
-}
-
-kwsys_stl::string SystemInformation::GetProgramStack(int firstFrame, int wholePath)
-{
-  return SystemInformationImplementation::GetProgramStack(firstFrame, wholePath);
-}
-
-/** Run the different checks */
-void SystemInformation::RunCPUCheck()
-{
-  this->Implementation->RunCPUCheck();
-}
-
-void SystemInformation::RunOSCheck()
-{
-  this->Implementation->RunOSCheck();
-}
-
-void SystemInformation::RunMemoryCheck()
-{
-  this->Implementation->RunMemoryCheck();
-}
-
-
-// --------------------------------------------------------------
-// SystemInformationImplementation starts here
-
-#define STORE_TLBCACHE_INFO(x,y)  x = (x < y) ? y : x
-#define TLBCACHE_INFO_UNITS      (15)
-#define CLASSICAL_CPU_FREQ_LOOP    10000000
-#define RDTSC_INSTRUCTION      _asm _emit 0x0f _asm _emit 0x31
-
-#define MMX_FEATURE            0x00000001
-#define MMX_PLUS_FEATURE       0x00000002
-#define SSE_FEATURE            0x00000004
-#define SSE2_FEATURE           0x00000008
-#define AMD_3DNOW_FEATURE      0x00000010
-#define AMD_3DNOW_PLUS_FEATURE 0x00000020
-#define IA64_FEATURE           0x00000040
-#define MP_CAPABLE             0x00000080
-#define HYPERTHREAD_FEATURE    0x00000100
-#define SERIALNUMBER_FEATURE   0x00000200
-#define APIC_FEATURE           0x00000400
-#define SSE_FP_FEATURE         0x00000800
-#define SSE_MMX_FEATURE        0x00001000
-#define CMOV_FEATURE           0x00002000
-#define MTRR_FEATURE           0x00004000
-#define L1CACHE_FEATURE        0x00008000
-#define L2CACHE_FEATURE        0x00010000
-#define L3CACHE_FEATURE        0x00020000
-#define ACPI_FEATURE           0x00040000
-#define THERMALMONITOR_FEATURE 0x00080000
-#define TEMPSENSEDIODE_FEATURE 0x00100000
-#define FREQUENCYID_FEATURE    0x00200000
-#define VOLTAGEID_FREQUENCY    0x00400000
-
-// Status Flag
-#define HT_NOT_CAPABLE           0
-#define HT_ENABLED               1
-#define HT_DISABLED              2
-#define HT_SUPPORTED_NOT_ENABLED 3
-#define HT_CANNOT_DETECT         4
-
-// EDX[28]  Bit 28 is set if HT is supported
-#define HT_BIT             0x10000000
-
-// EAX[11:8] Bit 8-11 contains family processor ID.
-#define FAMILY_ID          0x0F00
-#define PENTIUM4_ID        0x0F00
-// EAX[23:20] Bit 20-23 contains extended family processor ID
-#define EXT_FAMILY_ID      0x0F00000
-// EBX[23:16] Bit 16-23 in ebx contains the number of logical
-#define NUM_LOGICAL_BITS   0x00FF0000
-// processors per physical processor when execute cpuid with
-// eax set to 1
-// EBX[31:24] Bits 24-31 (8 bits) return the 8-bit unique
-#define INITIAL_APIC_ID_BITS  0xFF000000
-// initial APIC ID for the processor this code is running on.
-// Default value = 0xff if HT is not supported
-
-// Hide implementation details in an anonymous namespace.
-namespace {
-// *****************************************************************************
-#if defined(__linux) || defined(__APPLE__)
-int LoadLines(
-      FILE *file,
-      kwsys_stl::vector<kwsys_stl::string> &lines)
-{
-  // Load each line in the given file into a the vector.
-  int nRead=0;
-  const int bufSize=1024;
-  char buf[bufSize]={'\0'};
-  while (!feof(file) && !ferror(file))
-    {
-    errno=0;
-    if (fgets(buf,bufSize,file) == 0)
-      {
-      if (ferror(file) && (errno==EINTR))
-        {
-        clearerr(file);
-        }
-      continue;
-      }
-    char *pBuf=buf;
-    while(*pBuf)
-      {
-      if (*pBuf=='\n') *pBuf='\0';
-      pBuf+=1;
-      }
-    lines.push_back(buf);
-    ++nRead;
-    }
-  if (ferror(file))
-    {
-    return 0;
-    }
-  return nRead;
-}
-
-# if defined(__linux)
-// *****************************************************************************
-int LoadLines(
-      const char *fileName,
-      kwsys_stl::vector<kwsys_stl::string> &lines)
-{
-  FILE *file=fopen(fileName,"r");
-  if (file==0)
-    {
-    return 0;
-    }
-  int nRead=LoadLines(file,lines);
-  fclose(file);
-  return nRead;
-}
-# endif
-
-// ****************************************************************************
-template<typename T>
-int NameValue(
-      kwsys_stl::vector<kwsys_stl::string> &lines,
-      kwsys_stl::string name, T &value)
-{
-  size_t nLines=lines.size();
-  for (size_t i=0; i<nLines; ++i)
-    {
-    size_t at=lines[i].find(name);
-    if (at==kwsys_stl::string::npos)
-      {
-      continue;
-      }
-    kwsys_ios::istringstream is(lines[i].substr(at+name.size()));
-    is >> value;
-    return 0;
-    }
-  return -1;
-}
-#endif
-
-#if defined(__linux)
-// ****************************************************************************
-template<typename T>
-int GetFieldsFromFile(
-      const char *fileName,
-      const char **fieldNames,
-      T *values)
-{
-  kwsys_stl::vector<kwsys_stl::string> fields;
-  if (!LoadLines(fileName,fields))
-    {
-    return -1;
-    }
-  int i=0;
-  while (fieldNames[i]!=NULL)
-    {
-    int ierr=NameValue(fields,fieldNames[i],values[i]);
-    if (ierr)
-      {
-      return -(i+2);
-      }
-    i+=1;
-    }
-  return 0;
-}
-
-// ****************************************************************************
-template<typename T>
-int GetFieldFromFile(
-      const char *fileName,
-      const char *fieldName,
-      T &value)
-{
-  const char *fieldNames[2]={fieldName,NULL};
-  T values[1]={T(0)};
-  int ierr=GetFieldsFromFile(fileName,fieldNames,values);
-  if (ierr)
-    {
-    return ierr;
-    }
-  value=values[0];
-  return 0;
-}
-#endif
-
-// ****************************************************************************
-#if defined(__APPLE__)
-template<typename T>
-int GetFieldsFromCommand(
-      const char *command,
-      const char **fieldNames,
-      T *values)
-{
-  FILE *file=popen(command,"r");
-  if (file==0)
-    {
-    return -1;
-    }
-  kwsys_stl::vector<kwsys_stl::string> fields;
-  int nl=LoadLines(file,fields);
-  pclose(file);
-  if (nl==0)
-    {
-    return -1;
-    }
-  int i=0;
-  while (fieldNames[i]!=NULL)
-    {
-    int ierr=NameValue(fields,fieldNames[i],values[i]);
-    if (ierr)
-      {
-      return -(i+2);
-      }
-    i+=1;
-    }
-  return 0;
-}
-#endif
-
-// ****************************************************************************
-#if !defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
-void StacktraceSignalHandler(
-      int sigNo,
-      siginfo_t *sigInfo,
-      void * /*sigContext*/)
-{
-#if defined(__linux) || defined(__APPLE__)
-  kwsys_ios::ostringstream oss;
-  oss
-     << kwsys_ios::endl
-     << "=========================================================" << kwsys_ios::endl
-     << "Process id " << getpid() << " ";
-  switch (sigNo)
-    {
-    case SIGINT:
-      oss << "Caught SIGINT";
-      break;
-
-    case SIGTERM:
-      oss << "Caught SIGTERM";
-      break;
-
-    case SIGABRT:
-      oss << "Caught SIGABRT";
-      break;
-
-    case SIGFPE:
-      oss
-        << "Caught SIGFPE at "
-        << (sigInfo->si_addr==0?"0x":"")
-        << sigInfo->si_addr
-        <<  " ";
-      switch (sigInfo->si_code)
-        {
-# if defined(FPE_INTDIV)
-        case FPE_INTDIV:
-          oss << "integer division by zero";
-          break;
-# endif
-
-# if defined(FPE_INTOVF)
-        case FPE_INTOVF:
-          oss << "integer overflow";
-          break;
-# endif
-
-        case FPE_FLTDIV:
-          oss << "floating point divide by zero";
-          break;
-
-        case FPE_FLTOVF:
-          oss << "floating point overflow";
-          break;
-
-        case FPE_FLTUND:
-          oss << "floating point underflow";
-          break;
-
-        case FPE_FLTRES:
-          oss << "floating point inexact result";
-          break;
-
-        case FPE_FLTINV:
-          oss << "floating point invalid operation";
-          break;
-
-#if defined(FPE_FLTSUB)
-        case FPE_FLTSUB:
-          oss << "floating point subscript out of range";
-          break;
-#endif
-
-        default:
-          oss << "code " << sigInfo->si_code;
-          break;
-        }
-      break;
-
-    case SIGSEGV:
-      oss
-        << "Caught SIGSEGV at "
-        << (sigInfo->si_addr==0?"0x":"")
-        << sigInfo->si_addr
-        <<  " ";
-      switch (sigInfo->si_code)
-        {
-        case SEGV_MAPERR:
-          oss << "address not mapped to object";
-          break;
-
-        case SEGV_ACCERR:
-          oss << "invalid permission for mapped object";
-          break;
-
-        default:
-          oss << "code " << sigInfo->si_code;
-          break;
-        }
-      break;
-
-    case SIGBUS:
-      oss
-        << "Caught SIGBUS at "
-        << (sigInfo->si_addr==0?"0x":"")
-        << sigInfo->si_addr
-        <<  " ";
-      switch (sigInfo->si_code)
-        {
-        case BUS_ADRALN:
-          oss << "invalid address alignment";
-          break;
-
-# if defined(BUS_ADRERR)
-        case BUS_ADRERR:
-          oss << "nonexistent physical address";
-          break;
-# endif
-
-# if defined(BUS_OBJERR)
-        case BUS_OBJERR:
-          oss << "object-specific hardware error";
-          break;
-# endif
-
-# if defined(BUS_MCEERR_AR)
-        case BUS_MCEERR_AR:
-          oss << "Hardware memory error consumed on a machine check; action required.";
-          break;
-# endif
-
-# if defined(BUS_MCEERR_AO)
-        case BUS_MCEERR_AO:
-          oss << "Hardware memory error detected in process but not consumed; action optional.";
-          break;
-# endif
-
-        default:
-          oss << "code " << sigInfo->si_code;
-          break;
-        }
-      break;
-
-    case SIGILL:
-      oss
-        << "Caught SIGILL at "
-        << (sigInfo->si_addr==0?"0x":"")
-        << sigInfo->si_addr
-        <<  " ";
-      switch (sigInfo->si_code)
-        {
-        case ILL_ILLOPC:
-          oss << "illegal opcode";
-          break;
-
-# if defined(ILL_ILLOPN)
-        case ILL_ILLOPN:
-          oss << "illegal operand";
-          break;
-# endif
-
-# if defined(ILL_ILLADR)
-        case ILL_ILLADR:
-          oss << "illegal addressing mode.";
-          break;
-# endif
-
-        case ILL_ILLTRP:
-          oss << "illegal trap";
-
-        case ILL_PRVOPC:
-          oss << "privileged opcode";
-          break;
-
-# if defined(ILL_PRVREG)
-        case ILL_PRVREG:
-          oss << "privileged register";
-          break;
-# endif
-
-# if defined(ILL_COPROC)
-        case ILL_COPROC:
-          oss << "co-processor error";
-          break;
-# endif
-
-# if defined(ILL_BADSTK)
-        case ILL_BADSTK:
-          oss << "internal stack error";
-          break;
-# endif
-
-        default:
-          oss << "code " << sigInfo->si_code;
-          break;
-        }
-      break;
-
-    default:
-      oss << "Caught " << sigNo << " code " << sigInfo->si_code;
-      break;
-    }
-  oss
-    << kwsys_ios::endl
-    << "Program Stack:" << kwsys_ios::endl
-    << SystemInformationImplementation::GetProgramStack(2,0)
-    << "=========================================================" << kwsys_ios::endl;
-  kwsys_ios::cerr << oss.str() << kwsys_ios::endl;
-
-  // restore the previously registered handlers
-  // and abort
-  SystemInformationImplementation::SetStackTraceOnError(0);
-  abort();
-#else
-  // avoid warning C4100
-  (void)sigNo;
-  (void)sigInfo;
-#endif
-}
-#endif
-
-#if defined(KWSYS_SYSTEMINFORMATION_HAS_BACKTRACE)
-#define safes(_arg)((_arg)?(_arg):"???")
-
-// Description:
-// A container for symbol properties. Each instance
-// must be Initialized.
-class SymbolProperties
-{
-public:
-  SymbolProperties();
-
-  // Description:
-  // The SymbolProperties instance must be initialized by
-  // passing a stack address.
-  void Initialize(void *address);
-
-  // Description:
-  // Get the symbol's stack address.
-  void *GetAddress() const { return this->Address; }
-
-  // Description:
-  // If not set paths will be removed. eg, from a binary
-  // or source file.
-  void SetReportPath(int rp){ this->ReportPath=rp; }
-
-  // Description:
-  // Set/Get the name of the binary file that the symbol
-  // is found in.
-  void SetBinary(const char *binary)
-    { this->Binary=safes(binary); }
-
-  kwsys_stl::string GetBinary() const;
-
-  // Description:
-  // Set the name of the function that the symbol is found in.
-  // If c++ demangling is supported it will be demangled.
-  void SetFunction(const char *function)
-    { this->Function=this->Demangle(function); }
-
-  kwsys_stl::string GetFunction() const
-    { return this->Function; }
-
-  // Description:
-  // Set/Get the name of the source file where the symbol
-  // is defined.
-  void SetSourceFile(const char *sourcefile)
-    { this->SourceFile=safes(sourcefile); }
-
-  kwsys_stl::string GetSourceFile() const
-    { return this->GetFileName(this->SourceFile); }
-
-  // Description:
-  // Set/Get the line number where the symbol is defined
-  void SetLineNumber(long linenumber){ this->LineNumber=linenumber; }
-  long GetLineNumber() const { return this->LineNumber; }
-
-  // Description:
-  // Set the address where the biinary image is mapped
-  // into memory.
-  void SetBinaryBaseAddress(void *address)
-    { this->BinaryBaseAddress=address; }
-
-private:
-  void *GetRealAddress() const
-    { return (void*)((char*)this->Address-(char*)this->BinaryBaseAddress); }
-
-  kwsys_stl::string GetFileName(const kwsys_stl::string &path) const;
-  kwsys_stl::string Demangle(const char *symbol) const;
-
-private:
-  kwsys_stl::string Binary;
-  void *BinaryBaseAddress;
-  void *Address;
-  kwsys_stl::string SourceFile;
-  kwsys_stl::string Function;
-  long LineNumber;
-  int ReportPath;
-};
-
-// --------------------------------------------------------------------------
-kwsys_ios::ostream &operator<<(
-      kwsys_ios::ostream &os,
-      const SymbolProperties &sp)
-{
-#if defined(KWSYS_SYSTEMINFORMATION_HAS_SYMBOL_LOOKUP)
-  os
-    << kwsys_ios::hex << sp.GetAddress() << " : "
-    << sp.GetFunction()
-    << " [(" << sp.GetBinary() << ") "
-    << sp.GetSourceFile() << ":"
-    << kwsys_ios::dec << sp.GetLineNumber() << "]";
-#elif defined(KWSYS_SYSTEMINFORMATION_HAS_BACKTRACE)
-  void *addr = sp.GetAddress();
-  char **syminfo = backtrace_symbols(&addr,1);
-  os << safes(syminfo[0]);
-  free(syminfo);
-#else
-  (void)os;
-  (void)sp;
-#endif
-  return os;
-}
-
-// --------------------------------------------------------------------------
-SymbolProperties::SymbolProperties()
-{
-  // not using an initializer list
-  // to avoid some PGI compiler warnings
-  this->SetBinary("???");
-  this->SetBinaryBaseAddress(NULL);
-  this->Address = NULL;
-  this->SetSourceFile("???");
-  this->SetFunction("???");
-  this->SetLineNumber(-1);
-  this->SetReportPath(0);
-  // avoid PGI compiler warnings
-  this->GetRealAddress();
-  this->GetFunction();
-  this->GetSourceFile();
-  this->GetLineNumber();
-}
-
-// --------------------------------------------------------------------------
-kwsys_stl::string SymbolProperties::GetFileName(const kwsys_stl::string &path) const
-{
-  kwsys_stl::string file(path);
-  if (!this->ReportPath)
-    {
-    size_t at = file.rfind("/");
-    if (at!=kwsys_stl::string::npos)
-      {
-      file = file.substr(at+1,kwsys_stl::string::npos);
-      }
-    }
-  return file;
-}
-
-// --------------------------------------------------------------------------
-kwsys_stl::string SymbolProperties::GetBinary() const
-{
-// only linux has proc fs
-#if defined(__linux__)
-  if (this->Binary=="/proc/self/exe")
-    {
-    kwsys_stl::string binary;
-    char buf[1024]={'\0'};
-    ssize_t ll=0;
-    if ((ll=readlink("/proc/self/exe",buf,1024))>0)
-      {
-      buf[ll]='\0';
-      binary=buf;
-      }
-    else
-      {
-      binary="/proc/self/exe";
-      }
-    return this->GetFileName(binary);
-    }
-#endif
-  return this->GetFileName(this->Binary);
-}
-
-// --------------------------------------------------------------------------
-kwsys_stl::string SymbolProperties::Demangle(const char *symbol) const
-{
-  kwsys_stl::string result = safes(symbol);
-#if defined(KWSYS_SYSTEMINFORMATION_HAS_CPP_DEMANGLE)
-  int status = 0;
-  size_t bufferLen = 1024;
-  char *buffer = (char*)malloc(1024);
-  char *demangledSymbol =
-    abi::__cxa_demangle(symbol, buffer, &bufferLen, &status);
-  if (!status)
-    {
-    result = demangledSymbol;
-    }
-  free(buffer);
-#else
-  (void)symbol;
-#endif
-  return result;
-}
-
-// --------------------------------------------------------------------------
-void SymbolProperties::Initialize(void *address)
-{
-  this->Address = address;
-#if defined(KWSYS_SYSTEMINFORMATION_HAS_SYMBOL_LOOKUP)
-  // first fallback option can demangle c++ functions
-  Dl_info info;
-  int ierr=dladdr(this->Address,&info);
-  if (ierr && info.dli_sname && info.dli_saddr)
-    {
-    this->SetBinary(info.dli_fname);
-    this->SetFunction(info.dli_sname);
-    }
-#else
-  // second fallback use builtin backtrace_symbols
-  // to decode the bactrace.
-#endif
-}
-#endif // don't define this class if we're not using it
-
-} // anonymous namespace
-
-
-SystemInformationImplementation::SystemInformationImplementation()
-{
-  this->TotalVirtualMemory = 0;
-  this->AvailableVirtualMemory = 0;
-  this->TotalPhysicalMemory = 0;
-  this->AvailablePhysicalMemory = 0;
-  this->CurrentPositionInFile = 0;
-  this->ChipManufacturer = UnknownManufacturer;
-  memset(&this->Features, 0, sizeof(CPUFeatures));
-  this->ChipID.Type = 0;
-  this->ChipID.Family = 0;
-  this->ChipID.Model = 0;
-  this->ChipID.Revision = 0;
-  this->ChipID.ExtendedFamily = 0;
-  this->ChipID.ExtendedModel = 0;
-  this->CPUSpeedInMHz = 0;
-  this->NumberOfLogicalCPU = 0;
-  this->NumberOfPhysicalCPU = 0;
-  this->OSName = "";
-  this->Hostname = "";
-  this->OSRelease = "";
-  this->OSVersion = "";
-  this->OSPlatform = "";
-}
-
-SystemInformationImplementation::~SystemInformationImplementation()
-{
-}
-
-void SystemInformationImplementation::RunCPUCheck()
-{
-#ifdef WIN32
-  // Check to see if this processor supports CPUID.
-  bool supportsCPUID = DoesCPUSupportCPUID();
-
-  if (supportsCPUID)
-    {
-    // Retrieve the CPU details.
-    RetrieveCPUIdentity();
-    this->FindManufacturer();
-    RetrieveCPUFeatures();
-    }
-
-  // These two may be called without support for the CPUID instruction.
-  // (But if the instruction is there, they should be called *after*
-  // the above call to RetrieveCPUIdentity... that's why the two if
-  // blocks exist with the same "if (supportsCPUID)" logic...
-  //
-  if (!RetrieveCPUClockSpeed())
-    {
-    RetrieveClassicalCPUClockSpeed();
-    }
-
-  if (supportsCPUID)
-    {
-    // Retrieve cache information.
-    if (!RetrieveCPUCacheDetails())
-      {
-      RetrieveClassicalCPUCacheDetails();
-      }
-
-    // Retrieve the extended CPU details.
-    if (!RetrieveExtendedCPUIdentity())
-      {
-      RetrieveClassicalCPUIdentity();
-      }
-
-    RetrieveExtendedCPUFeatures();
-    RetrieveCPUPowerManagement();
-
-    // Now attempt to retrieve the serial number (if possible).
-    RetrieveProcessorSerialNumber();
-    }
-
-  this->CPUCount();
-
-#elif defined(__APPLE__)
-  this->ParseSysCtl();
-#elif defined (__SVR4) && defined (__sun)
-  this->QuerySolarisProcessor();
-#elif defined(__HAIKU__)
-  this->QueryHaikuInfo();
-#elif defined(__QNX__)
-  this->QueryQNXProcessor();
-#elif defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
-  this->QueryBSDProcessor();
-#elif defined(__hpux)
-  this->QueryHPUXProcessor();
-#elif defined(__linux) || defined(__CYGWIN__)
-  this->RetreiveInformationFromCpuInfoFile();
-#else
-  this->QueryProcessor();
-#endif
-}
-
-void SystemInformationImplementation::RunOSCheck()
-{
-  this->QueryOSInformation();
-}
-
-void SystemInformationImplementation::RunMemoryCheck()
-{
-#if defined(__APPLE__)
-  this->ParseSysCtl();
-#elif defined (__SVR4) && defined (__sun)
-  this->QuerySolarisMemory();
-#elif defined(__HAIKU__)
-  this->QueryHaikuInfo();
-#elif defined(__QNX__)
-  this->QueryQNXMemory();
-#elif defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
-  this->QueryBSDMemory();
-#elif defined(__CYGWIN__)
-  this->QueryCygwinMemory();
-#elif defined(_WIN32)
-  this->QueryWindowsMemory();
-#elif defined(__hpux)
-  this->QueryHPUXMemory();
-#elif defined(__linux)
-  this->QueryLinuxMemory();
-#elif defined(_AIX)
-  this->QueryAIXMemory();
-#else
-  this->QueryMemory();
-#endif
-}
-
-/** Get the vendor string */
-const char * SystemInformationImplementation::GetVendorString()
-{
-  return this->ChipID.Vendor.c_str();
-}
-
-/** Get the OS Name */
-const char * SystemInformationImplementation::GetOSName()
-{
-  return this->OSName.c_str();
-}
-
-/** Get the hostname */
-const char* SystemInformationImplementation::GetHostname()
-{
-  if (this->Hostname.empty())
-    {
-    this->Hostname="localhost";
-#if defined(_WIN32)
-    WORD wVersionRequested;
-    WSADATA wsaData;
-    char name[255];
-    wVersionRequested = MAKEWORD(2,0);
-    if ( WSAStartup( wVersionRequested, &wsaData ) == 0 )
-      {
-      gethostname(name,sizeof(name));
-      WSACleanup( );
-      }
-    this->Hostname = name;
-#else
-    struct utsname unameInfo;
-    int errorFlag = uname(&unameInfo);
-    if(errorFlag == 0)
-      {
-      this->Hostname = unameInfo.nodename;
-      }
-#endif
-    }
-  return this->Hostname.c_str();
-}
-
-/** Get the FQDN */
-int SystemInformationImplementation::GetFullyQualifiedDomainName(
-      kwsys_stl::string &fqdn)
-{
-  // in the event of absolute failure return localhost.
-  fqdn="localhost";
-
-#if defined(_WIN32)
-  int ierr;
-  // TODO - a more robust implementation for windows, see comments
-  // in unix implementation.
-  WSADATA wsaData;
-  WORD ver=MAKEWORD(2,0);
-  ierr=WSAStartup(ver,&wsaData);
-  if (ierr)
-    {
-    return -1;
-    }
-
-  char base[256]={'\0'};
-  ierr=gethostname(base,256);
-  if (ierr)
-    {
-    WSACleanup();
-    return -2;
-    }
-  fqdn=base;
-
-  HOSTENT *hent=gethostbyname(base);
-  if (hent)
-    {
-    fqdn=hent->h_name;
-    }
-
-  WSACleanup();
-  return 0;
-
-#elif defined(KWSYS_SYSTEMINFORMATION_IMPLEMENT_FQDN)
-  // gethostname typical returns an alias for loopback interface
-  // we want the fully qualified domain name. Because there are
-  // any number of interfaces on this system we look for the
-  // first of these that contains the name returned by gethostname
-  // and is longer. failing that we return gethostname and indicate
-  // with a failure code. Return of a failure code is not necessarilly
-  // an indication of an error. for instance gethostname may return
-  // the fully qualified domain name, or there may not be one if the
-  // system lives on a private network such as in the case of a cluster
-  // node.
-
-  int ierr=0;
-  char base[NI_MAXHOST];
-  ierr=gethostname(base,NI_MAXHOST);
-  if (ierr)
-    {
-    return -1;
-    }
-  size_t baseSize=strlen(base);
-  fqdn=base;
-
-  struct ifaddrs *ifas;
-  struct ifaddrs *ifa;
-  ierr=getifaddrs(&ifas);
-  if (ierr)
-    {
-    return -2;
-    }
-
-  for (ifa=ifas; ifa!=NULL; ifa=ifa->ifa_next)
-    {
-    int fam = ifa->ifa_addr? ifa->ifa_addr->sa_family : -1;
-    if ((fam==AF_INET) || (fam==AF_INET6))
-      {
-      char host[NI_MAXHOST]={'\0'};
-
-      const size_t addrlen
-        = (fam==AF_INET?sizeof(struct sockaddr_in):sizeof(struct sockaddr_in6));
-
-      ierr=getnameinfo(
-            ifa->ifa_addr,
-            static_cast<socklen_t>(addrlen),
-            host,
-            NI_MAXHOST,
-            NULL,
-            0,
-            NI_NAMEREQD);
-      if (ierr)
-        {
-        // don't report the failure now since we may succeed on another
-        // interface. If all attempts fail then return the failure code.
-        ierr=-3;
-        continue;
-        }
-
-      kwsys_stl::string candidate=host;
-      if ((candidate.find(base)!=kwsys_stl::string::npos) && baseSize<candidate.size())
-        {
-        // success, stop now.
-        ierr=0;
-        fqdn=candidate;
-        break;
-        }
-      }
-    }
-  freeifaddrs(ifas);
-
-  return ierr;
-#else
-  /* TODO: Implement on more platforms.  */
-  fqdn=this->GetHostname();
-  return -1;
-#endif
-}
-
-/** Get the OS release */
-const char* SystemInformationImplementation::GetOSRelease()
-{
-  return this->OSRelease.c_str();
-}
-
-/** Get the OS version */
-const char* SystemInformationImplementation::GetOSVersion()
-{
-  return this->OSVersion.c_str();
-}
-
-/** Get the OS platform */
-const char* SystemInformationImplementation::GetOSPlatform()
-{
-  return this->OSPlatform.c_str();
-}
-
-/** Get the vendor ID */
-const char * SystemInformationImplementation::GetVendorID()
-{
-  // Return the vendor ID.
-  switch (this->ChipManufacturer)
-    {
-    case Intel:
-      return "Intel Corporation";
-    case AMD:
-      return "Advanced Micro Devices";
-    case NSC:
-      return "National Semiconductor";
-    case Cyrix:
-      return "Cyrix Corp., VIA Inc.";
-    case NexGen:
-      return "NexGen Inc., Advanced Micro Devices";
-    case IDT:
-      return "IDT\\Centaur, Via Inc.";
-    case UMC:
-      return "United Microelectronics Corp.";
-    case Rise:
-      return "Rise";
-    case Transmeta:
-      return "Transmeta";
-    case Sun:
-      return "Sun Microelectronics";
-    case IBM:
-      return "IBM";
-    case Motorola:
-      return "Motorola";
-    case HP:
-      return "Hewlett-Packard";
-    default:
-      return "Unknown Manufacturer";
-    }
-}
-
-/** Return the type ID of the CPU */
-kwsys_stl::string SystemInformationImplementation::GetTypeID()
-{
-  kwsys_ios::ostringstream str;
-  str << this->ChipID.Type;
-  return str.str();
-}
-
-/** Return the family of the CPU present */
-kwsys_stl::string SystemInformationImplementation::GetFamilyID()
-{
-  kwsys_ios::ostringstream str;
-  str << this->ChipID.Family;
-  return str.str();
-}
-
-// Return the model of CPU present */
-kwsys_stl::string SystemInformationImplementation::GetModelID()
-{
-  kwsys_ios::ostringstream str;
-  str << this->ChipID.Model;
-  return str.str();
-}
-
-// Return the model name of CPU present */
-kwsys_stl::string SystemInformationImplementation::GetModelName()
-{
-  return this->ChipID.ModelName;
-}
-
-/** Return the stepping code of the CPU present. */
-kwsys_stl::string SystemInformationImplementation::GetSteppingCode()
-{
-  kwsys_ios::ostringstream str;
-  str << this->ChipID.Revision;
-  return str.str();
-}
-
-/** Return the stepping code of the CPU present. */
-const char * SystemInformationImplementation::GetExtendedProcessorName()
-{
-  return this->ChipID.ProcessorName.c_str();
-}
-
-/** Return the serial number of the processor
- *  in hexadecimal: xxxx-xxxx-xxxx-xxxx-xxxx-xxxx. */
-const char * SystemInformationImplementation::GetProcessorSerialNumber()
-{
-  return this->ChipID.SerialNumber.c_str();
-}
-
-/** Return the logical processors per physical */
-unsigned int SystemInformationImplementation::GetLogicalProcessorsPerPhysical()
-{
-  return this->Features.ExtendedFeatures.LogicalProcessorsPerPhysical;
-}
-
-/** Return the processor clock frequency. */
-float SystemInformationImplementation::GetProcessorClockFrequency()
-{
-  return this->CPUSpeedInMHz;
-}
-
-/**  Return the APIC ID. */
-int SystemInformationImplementation::GetProcessorAPICID()
-{
-  return this->Features.ExtendedFeatures.APIC_ID;
-}
-
-/** Return the L1 cache size. */
-int SystemInformationImplementation::GetProcessorCacheSize()
-{
-  return this->Features.L1CacheSize;
-}
-
-/** Return the chosen cache size. */
-int SystemInformationImplementation::GetProcessorCacheXSize(long int dwCacheID)
-{
-  switch (dwCacheID)
-    {
-    case L1CACHE_FEATURE:
-      return this->Features.L1CacheSize;
-    case L2CACHE_FEATURE:
-      return this->Features.L2CacheSize;
-    case L3CACHE_FEATURE:
-      return this->Features.L3CacheSize;
-    }
-  return -1;
-}
-
-
-bool SystemInformationImplementation::DoesCPUSupportFeature(long int dwFeature)
-{
-  bool bHasFeature = false;
-
-  // Check for MMX instructions.
-  if (((dwFeature & MMX_FEATURE) != 0) && this->Features.HasMMX) bHasFeature = true;
-
-  // Check for MMX+ instructions.
-  if (((dwFeature & MMX_PLUS_FEATURE) != 0) && this->Features.ExtendedFeatures.HasMMXPlus) bHasFeature = true;
-
-  // Check for SSE FP instructions.
-  if (((dwFeature & SSE_FEATURE) != 0) && this->Features.HasSSE) bHasFeature = true;
-
-  // Check for SSE FP instructions.
-  if (((dwFeature & SSE_FP_FEATURE) != 0) && this->Features.HasSSEFP) bHasFeature = true;
-
-  // Check for SSE MMX instructions.
-  if (((dwFeature & SSE_MMX_FEATURE) != 0) && this->Features.ExtendedFeatures.HasSSEMMX) bHasFeature = true;
-
-  // Check for SSE2 instructions.
-  if (((dwFeature & SSE2_FEATURE) != 0) && this->Features.HasSSE2) bHasFeature = true;
-
-  // Check for 3DNow! instructions.
-  if (((dwFeature & AMD_3DNOW_FEATURE) != 0) && this->Features.ExtendedFeatures.Has3DNow) bHasFeature = true;
-
-  // Check for 3DNow+ instructions.
-  if (((dwFeature & AMD_3DNOW_PLUS_FEATURE) != 0) && this->Features.ExtendedFeatures.Has3DNowPlus) bHasFeature = true;
-
-  // Check for IA64 instructions.
-  if (((dwFeature & IA64_FEATURE) != 0) && this->Features.HasIA64) bHasFeature = true;
-
-  // Check for MP capable.
-  if (((dwFeature & MP_CAPABLE) != 0) && this->Features.ExtendedFeatures.SupportsMP) bHasFeature = true;
-
-  // Check for a serial number for the processor.
-  if (((dwFeature & SERIALNUMBER_FEATURE) != 0) && this->Features.HasSerial) bHasFeature = true;
-
-  // Check for a local APIC in the processor.
-  if (((dwFeature & APIC_FEATURE) != 0) && this->Features.HasAPIC) bHasFeature = true;
-
-  // Check for CMOV instructions.
-  if (((dwFeature & CMOV_FEATURE) != 0) && this->Features.HasCMOV) bHasFeature = true;
-
-  // Check for MTRR instructions.
-  if (((dwFeature & MTRR_FEATURE) != 0) && this->Features.HasMTRR) bHasFeature = true;
-
-  // Check for L1 cache size.
-  if (((dwFeature & L1CACHE_FEATURE) != 0) && (this->Features.L1CacheSize != -1)) bHasFeature = true;
-
-  // Check for L2 cache size.
-  if (((dwFeature & L2CACHE_FEATURE) != 0) && (this->Features.L2CacheSize != -1)) bHasFeature = true;
-
-  // Check for L3 cache size.
-  if (((dwFeature & L3CACHE_FEATURE) != 0) && (this->Features.L3CacheSize != -1)) bHasFeature = true;
-
-  // Check for ACPI capability.
-  if (((dwFeature & ACPI_FEATURE) != 0) && this->Features.HasACPI) bHasFeature = true;
-
-  // Check for thermal monitor support.
-  if (((dwFeature & THERMALMONITOR_FEATURE) != 0) && this->Features.HasThermal) bHasFeature = true;
-
-  // Check for temperature sensing diode support.
-  if (((dwFeature & TEMPSENSEDIODE_FEATURE) != 0) && this->Features.ExtendedFeatures.PowerManagement.HasTempSenseDiode) bHasFeature = true;
-
-  // Check for frequency ID support.
-  if (((dwFeature & FREQUENCYID_FEATURE) != 0) && this->Features.ExtendedFeatures.PowerManagement.HasFrequencyID) bHasFeature = true;
-
-  // Check for voltage ID support.
-  if (((dwFeature & VOLTAGEID_FREQUENCY) != 0) && this->Features.ExtendedFeatures.PowerManagement.HasVoltageID) bHasFeature = true;
-
-  return bHasFeature;
-}
-
-
-void SystemInformationImplementation::Delay(unsigned int uiMS)
-{
-#ifdef WIN32
-  LARGE_INTEGER Frequency, StartCounter, EndCounter;
-  __int64 x;
-
-  // Get the frequency of the high performance counter.
-  if (!QueryPerformanceFrequency (&Frequency)) return;
-  x = Frequency.QuadPart / 1000 * uiMS;
-
-  // Get the starting position of the counter.
-  QueryPerformanceCounter (&StartCounter);
-
-  do {
-    // Get the ending position of the counter.
-    QueryPerformanceCounter (&EndCounter);
-    } while (EndCounter.QuadPart - StartCounter.QuadPart < x);
-#endif
-  (void)uiMS;
-}
-
-
-bool SystemInformationImplementation::DoesCPUSupportCPUID()
-{
-#if USE_CPUID
-  int dummy[4] = { 0, 0, 0, 0 };
-
-#if USE_ASM_INSTRUCTIONS
-  return call_cpuid(0, dummy);
-#else
-  call_cpuid(0, dummy);
-  return dummy[0] || dummy[1] || dummy[2] || dummy[3];
-#endif
-#else
-  // Assume no cpuid instruction.
-  return false;
-#endif
-}
-
-
-bool SystemInformationImplementation::RetrieveCPUFeatures()
-{
-#if USE_CPUID
-  int cpuinfo[4] = { 0, 0, 0, 0 };
-
-  if (!call_cpuid(1, cpuinfo))
-    {
-    return false;
-    }
-
-  // Retrieve the features of CPU present.
-  this->Features.HasFPU =     ((cpuinfo[3] & 0x00000001) != 0);    // FPU Present --> Bit 0
-  this->Features.HasTSC =     ((cpuinfo[3] & 0x00000010) != 0);    // TSC Present --> Bit 4
-  this->Features.HasAPIC =    ((cpuinfo[3] & 0x00000200) != 0);    // APIC Present --> Bit 9
-  this->Features.HasMTRR =    ((cpuinfo[3] & 0x00001000) != 0);    // MTRR Present --> Bit 12
-  this->Features.HasCMOV =    ((cpuinfo[3] & 0x00008000) != 0);    // CMOV Present --> Bit 15
-  this->Features.HasSerial =  ((cpuinfo[3] & 0x00040000) != 0);    // Serial Present --> Bit 18
-  this->Features.HasACPI =    ((cpuinfo[3] & 0x00400000) != 0);    // ACPI Capable --> Bit 22
-  this->Features.HasMMX =     ((cpuinfo[3] & 0x00800000) != 0);    // MMX Present --> Bit 23
-  this->Features.HasSSE =     ((cpuinfo[3] & 0x02000000) != 0);    // SSE Present --> Bit 25
-  this->Features.HasSSE2 =    ((cpuinfo[3] & 0x04000000) != 0);    // SSE2 Present --> Bit 26
-  this->Features.HasThermal = ((cpuinfo[3] & 0x20000000) != 0);    // Thermal Monitor Present --> Bit 29
-  this->Features.HasIA64 =    ((cpuinfo[3] & 0x40000000) != 0);    // IA64 Present --> Bit 30
-
-#if USE_ASM_INSTRUCTIONS
-  // Retrieve extended SSE capabilities if SSE is available.
-  if (this->Features.HasSSE) {
-
-    // Attempt to __try some SSE FP instructions.
-    __try
-      {
-      // Perform: orps xmm0, xmm0
-      _asm
-        {
-        _emit 0x0f
-        _emit 0x56
-        _emit 0xc0
-        }
-
-      // SSE FP capable processor.
-      this->Features.HasSSEFP = true;
-      }
-    __except(1)
-      {
-      // bad instruction - processor or OS cannot handle SSE FP.
-      this->Features.HasSSEFP = false;
-      }
-    }
-  else
-    {
-    // Set the advanced SSE capabilities to not available.
-    this->Features.HasSSEFP = false;
-    }
-#else
-  this->Features.HasSSEFP = false;
-#endif
-
-  // Retrieve Intel specific extended features.
-  if (this->ChipManufacturer == Intel)
-    {
-    this->Features.ExtendedFeatures.SupportsHyperthreading =  ((cpuinfo[3] &  0x10000000) != 0);  // Intel specific: Hyperthreading --> Bit 28
-    this->Features.ExtendedFeatures.LogicalProcessorsPerPhysical = (this->Features.ExtendedFeatures.SupportsHyperthreading) ? ((cpuinfo[1] & 0x00FF0000) >> 16) : 1;
-
-    if ((this->Features.ExtendedFeatures.SupportsHyperthreading) && (this->Features.HasAPIC))
-      {
-      // Retrieve APIC information if there is one present.
-      this->Features.ExtendedFeatures.APIC_ID = ((cpuinfo[1] & 0xFF000000) >> 24);
-      }
-    }
-
-  return true;
-
-#else
-  return false;
-#endif
-}
-
-
-/** Find the manufacturer given the vendor id */
-void SystemInformationImplementation::FindManufacturer(const kwsys_stl::string& family)
-{
-  if (this->ChipID.Vendor == "GenuineIntel")       this->ChipManufacturer = Intel;        // Intel Corp.
-  else if (this->ChipID.Vendor == "UMC UMC UMC ")  this->ChipManufacturer = UMC;          // United Microelectronics Corp.
-  else if (this->ChipID.Vendor == "AuthenticAMD")  this->ChipManufacturer = AMD;          // Advanced Micro Devices
-  else if (this->ChipID.Vendor == "AMD ISBETTER")  this->ChipManufacturer = AMD;          // Advanced Micro Devices (1994)
-  else if (this->ChipID.Vendor == "CyrixInstead")  this->ChipManufacturer = Cyrix;        // Cyrix Corp., VIA Inc.
-  else if (this->ChipID.Vendor == "NexGenDriven")  this->ChipManufacturer = NexGen;        // NexGen Inc. (now AMD)
-  else if (this->ChipID.Vendor == "CentaurHauls")  this->ChipManufacturer = IDT;          // IDT/Centaur (now VIA)
-  else if (this->ChipID.Vendor == "RiseRiseRise")  this->ChipManufacturer = Rise;        // Rise
-  else if (this->ChipID.Vendor == "GenuineTMx86")  this->ChipManufacturer = Transmeta;      // Transmeta
-  else if (this->ChipID.Vendor == "TransmetaCPU")  this->ChipManufacturer = Transmeta;      // Transmeta
-  else if (this->ChipID.Vendor == "Geode By NSC")  this->ChipManufacturer = NSC;          // National Semiconductor
-  else if (this->ChipID.Vendor == "Sun")           this->ChipManufacturer = Sun;          // Sun Microelectronics
-  else if (this->ChipID.Vendor == "IBM")           this->ChipManufacturer = IBM;          // IBM Microelectronics
-  else if (this->ChipID.Vendor == "Hewlett-Packard") this->ChipManufacturer = HP;         // Hewlett-Packard
-  else if (this->ChipID.Vendor == "Motorola")      this->ChipManufacturer = Motorola;          // Motorola Microelectronics
-  else if (family.substr(0, 7) == "PA-RISC")       this->ChipManufacturer = HP;           // Hewlett-Packard
-  else                                             this->ChipManufacturer = UnknownManufacturer;  // Unknown manufacturer
-}
-
-
-/** */
-bool SystemInformationImplementation::RetrieveCPUIdentity()
-{
-#if USE_CPUID
-  int localCPUVendor[4];
-  int localCPUSignature[4];
-
-  if (!call_cpuid(0, localCPUVendor))
-    {
-    return false;
-    }
-  if (!call_cpuid(1, localCPUSignature))
-    {
-    return false;
-    }
-
-  // Process the returned information.
-  //    ; eax = 0 --> eax: maximum value of CPUID instruction.
-  //    ;        ebx: part 1 of 3; CPU signature.
-  //    ;        edx: part 2 of 3; CPU signature.
-  //    ;        ecx: part 3 of 3; CPU signature.
-  char vbuf[13];
-  memcpy (&(vbuf[0]), &(localCPUVendor[1]), sizeof (int));
-  memcpy (&(vbuf[4]), &(localCPUVendor[3]), sizeof (int));
-  memcpy (&(vbuf[8]), &(localCPUVendor[2]), sizeof (int));
-  vbuf[12] = '\0';
-  this->ChipID.Vendor = vbuf;
-
-  // Retrieve the family of CPU present.
-  //    ; eax = 1 --> eax: CPU ID - bits 31..16 - unused, bits 15..12 - type, bits 11..8 - family, bits 7..4 - model, bits 3..0 - mask revision
-  //    ;        ebx: 31..24 - default APIC ID, 23..16 - logical processor ID, 15..8 - CFLUSH chunk size , 7..0 - brand ID
-  //    ;        edx: CPU feature flags
-  this->ChipID.ExtendedFamily = ((localCPUSignature[0] & 0x0FF00000) >> 20);  // Bits 27..20 Used
-  this->ChipID.ExtendedModel =  ((localCPUSignature[0] & 0x000F0000) >> 16);  // Bits 19..16 Used
-  this->ChipID.Type =           ((localCPUSignature[0] & 0x0000F000) >> 12);  // Bits 15..12 Used
-  this->ChipID.Family =         ((localCPUSignature[0] & 0x00000F00) >> 8);    // Bits 11..8 Used
-  this->ChipID.Model =          ((localCPUSignature[0] & 0x000000F0) >> 4);    // Bits 7..4 Used
-  this->ChipID.Revision =       ((localCPUSignature[0] & 0x0000000F) >> 0);    // Bits 3..0 Used
-
-  return true;
-
-#else
-  return false;
-#endif
-}
-
-
-/** */
-bool SystemInformationImplementation::RetrieveCPUCacheDetails()
-{
-#if USE_CPUID
-  int L1Cache[4] = { 0, 0, 0, 0 };
-  int L2Cache[4] = { 0, 0, 0, 0 };
-
-  // Check to see if what we are about to do is supported...
-  if (RetrieveCPUExtendedLevelSupport (0x80000005))
-    {
-    if (!call_cpuid(0x80000005, L1Cache))
-      {
-      return false;
-      }
-    // Save the L1 data cache size (in KB) from ecx: bits 31..24 as well as data cache size from edx: bits 31..24.
-    this->Features.L1CacheSize = ((L1Cache[2] & 0xFF000000) >> 24);
-    this->Features.L1CacheSize += ((L1Cache[3] & 0xFF000000) >> 24);
-    }
-  else
-    {
-    // Store -1 to indicate the cache could not be queried.
-    this->Features.L1CacheSize = -1;
-    }
-
-  // Check to see if what we are about to do is supported...
-  if (RetrieveCPUExtendedLevelSupport (0x80000006))
-    {
-    if (!call_cpuid(0x80000006, L2Cache))
-      {
-      return false;
-      }
-    // Save the L2 unified cache size (in KB) from ecx: bits 31..16.
-    this->Features.L2CacheSize = ((L2Cache[2] & 0xFFFF0000) >> 16);
-    }
-  else
-    {
-    // Store -1 to indicate the cache could not be queried.
-    this->Features.L2CacheSize = -1;
-    }
-
-  // Define L3 as being not present as we cannot test for it.
-  this->Features.L3CacheSize = -1;
-
-#endif
-
-  // Return failure if we cannot detect either cache with this method.
-  return ((this->Features.L1CacheSize == -1) && (this->Features.L2CacheSize == -1)) ? false : true;
-}
-
-
-/** */
-bool SystemInformationImplementation::RetrieveClassicalCPUCacheDetails()
-{
-#if USE_CPUID
-  int TLBCode = -1, TLBData = -1, L1Code = -1, L1Data = -1, L1Trace = -1, L2Unified = -1, L3Unified = -1;
-  int TLBCacheData[4] = { 0, 0, 0, 0 };
-  int TLBPassCounter = 0;
-  int TLBCacheUnit = 0;
-
-
-  do {
-    if (!call_cpuid(2, TLBCacheData))
-      {
-      return false;
-      }
-
-    int bob = ((TLBCacheData[0] & 0x00FF0000) >> 16);
-    (void)bob;
-    // Process the returned TLB and cache information.
-    for (int nCounter = 0; nCounter < TLBCACHE_INFO_UNITS; nCounter ++)
-      {
-      // First of all - decide which unit we are dealing with.
-      switch (nCounter)
-        {
-        // eax: bits 8..15 : bits 16..23 : bits 24..31
-        case 0: TLBCacheUnit = ((TLBCacheData[0] & 0x0000FF00) >> 8); break;
-        case 1: TLBCacheUnit = ((TLBCacheData[0] & 0x00FF0000) >> 16); break;
-        case 2: TLBCacheUnit = ((TLBCacheData[0] & 0xFF000000) >> 24); break;
-
-        // ebx: bits 0..7 : bits 8..15 : bits 16..23 : bits 24..31
-        case 3: TLBCacheUnit = ((TLBCacheData[1] & 0x000000FF) >> 0); break;
-        case 4: TLBCacheUnit = ((TLBCacheData[1] & 0x0000FF00) >> 8); break;
-        case 5: TLBCacheUnit = ((TLBCacheData[1] & 0x00FF0000) >> 16); break;
-        case 6: TLBCacheUnit = ((TLBCacheData[1] & 0xFF000000) >> 24); break;
-
-        // ecx: bits 0..7 : bits 8..15 : bits 16..23 : bits 24..31
-        case 7: TLBCacheUnit = ((TLBCacheData[2] & 0x000000FF) >> 0); break;
-        case 8: TLBCacheUnit = ((TLBCacheData[2] & 0x0000FF00) >> 8); break;
-        case 9: TLBCacheUnit = ((TLBCacheData[2] & 0x00FF0000) >> 16); break;
-        case 10: TLBCacheUnit = ((TLBCacheData[2] & 0xFF000000) >> 24); break;
-
-        // edx: bits 0..7 : bits 8..15 : bits 16..23 : bits 24..31
-        case 11: TLBCacheUnit = ((TLBCacheData[3] & 0x000000FF) >> 0); break;
-        case 12: TLBCacheUnit = ((TLBCacheData[3] & 0x0000FF00) >> 8); break;
-        case 13: TLBCacheUnit = ((TLBCacheData[3] & 0x00FF0000) >> 16); break;
-        case 14: TLBCacheUnit = ((TLBCacheData[3] & 0xFF000000) >> 24); break;
-
-        // Default case - an error has occured.
-        default: return false;
-        }
-
-      // Now process the resulting unit to see what it means....
-      switch (TLBCacheUnit)
-        {
-        case 0x00: break;
-        case 0x01: STORE_TLBCACHE_INFO (TLBCode, 4); break;
-        case 0x02: STORE_TLBCACHE_INFO (TLBCode, 4096); break;
-        case 0x03: STORE_TLBCACHE_INFO (TLBData, 4); break;
-        case 0x04: STORE_TLBCACHE_INFO (TLBData, 4096); break;
-        case 0x06: STORE_TLBCACHE_INFO (L1Code, 8); break;
-        case 0x08: STORE_TLBCACHE_INFO (L1Code, 16); break;
-        case 0x0a: STORE_TLBCACHE_INFO (L1Data, 8); break;
-        case 0x0c: STORE_TLBCACHE_INFO (L1Data, 16); break;
-        case 0x10: STORE_TLBCACHE_INFO (L1Data, 16); break;      // <-- FIXME: IA-64 Only
-        case 0x15: STORE_TLBCACHE_INFO (L1Code, 16); break;      // <-- FIXME: IA-64 Only
-        case 0x1a: STORE_TLBCACHE_INFO (L2Unified, 96); break;    // <-- FIXME: IA-64 Only
-        case 0x22: STORE_TLBCACHE_INFO (L3Unified, 512); break;
-        case 0x23: STORE_TLBCACHE_INFO (L3Unified, 1024); break;
-        case 0x25: STORE_TLBCACHE_INFO (L3Unified, 2048); break;
-        case 0x29: STORE_TLBCACHE_INFO (L3Unified, 4096); break;
-        case 0x39: STORE_TLBCACHE_INFO (L2Unified, 128); break;
-        case 0x3c: STORE_TLBCACHE_INFO (L2Unified, 256); break;
-        case 0x40: STORE_TLBCACHE_INFO (L2Unified, 0); break;    // <-- FIXME: No integrated L2 cache (P6 core) or L3 cache (P4 core).
-        case 0x41: STORE_TLBCACHE_INFO (L2Unified, 128); break;
-        case 0x42: STORE_TLBCACHE_INFO (L2Unified, 256); break;
-        case 0x43: STORE_TLBCACHE_INFO (L2Unified, 512); break;
-        case 0x44: STORE_TLBCACHE_INFO (L2Unified, 1024); break;
-        case 0x45: STORE_TLBCACHE_INFO (L2Unified, 2048); break;
-        case 0x50: STORE_TLBCACHE_INFO (TLBCode, 4096); break;
-        case 0x51: STORE_TLBCACHE_INFO (TLBCode, 4096); break;
-        case 0x52: STORE_TLBCACHE_INFO (TLBCode, 4096); break;
-        case 0x5b: STORE_TLBCACHE_INFO (TLBData, 4096); break;
-        case 0x5c: STORE_TLBCACHE_INFO (TLBData, 4096); break;
-        case 0x5d: STORE_TLBCACHE_INFO (TLBData, 4096); break;
-        case 0x66: STORE_TLBCACHE_INFO (L1Data, 8); break;
-        case 0x67: STORE_TLBCACHE_INFO (L1Data, 16); break;
-        case 0x68: STORE_TLBCACHE_INFO (L1Data, 32); break;
-        case 0x70: STORE_TLBCACHE_INFO (L1Trace, 12); break;
-        case 0x71: STORE_TLBCACHE_INFO (L1Trace, 16); break;
-        case 0x72: STORE_TLBCACHE_INFO (L1Trace, 32); break;
-        case 0x77: STORE_TLBCACHE_INFO (L1Code, 16); break;      // <-- FIXME: IA-64 Only
-        case 0x79: STORE_TLBCACHE_INFO (L2Unified, 128); break;
-        case 0x7a: STORE_TLBCACHE_INFO (L2Unified, 256); break;
-        case 0x7b: STORE_TLBCACHE_INFO (L2Unified, 512); break;
-        case 0x7c: STORE_TLBCACHE_INFO (L2Unified, 1024); break;
-        case 0x7e: STORE_TLBCACHE_INFO (L2Unified, 256); break;
-        case 0x81: STORE_TLBCACHE_INFO (L2Unified, 128); break;
-        case 0x82: STORE_TLBCACHE_INFO (L2Unified, 256); break;
-        case 0x83: STORE_TLBCACHE_INFO (L2Unified, 512); break;
-        case 0x84: STORE_TLBCACHE_INFO (L2Unified, 1024); break;
-        case 0x85: STORE_TLBCACHE_INFO (L2Unified, 2048); break;
-        case 0x88: STORE_TLBCACHE_INFO (L3Unified, 2048); break;  // <-- FIXME: IA-64 Only
-        case 0x89: STORE_TLBCACHE_INFO (L3Unified, 4096); break;  // <-- FIXME: IA-64 Only
-        case 0x8a: STORE_TLBCACHE_INFO (L3Unified, 8192); break;  // <-- FIXME: IA-64 Only
-        case 0x8d: STORE_TLBCACHE_INFO (L3Unified, 3096); break;  // <-- FIXME: IA-64 Only
-        case 0x90: STORE_TLBCACHE_INFO (TLBCode, 262144); break;  // <-- FIXME: IA-64 Only
-        case 0x96: STORE_TLBCACHE_INFO (TLBCode, 262144); break;  // <-- FIXME: IA-64 Only
-        case 0x9b: STORE_TLBCACHE_INFO (TLBCode, 262144); break;  // <-- FIXME: IA-64 Only
-
-        // Default case - an error has occured.
-        default: return false;
-        }
-      }
-
-    // Increment the TLB pass counter.
-    TLBPassCounter ++;
-    } while ((TLBCacheData[0] & 0x000000FF) > TLBPassCounter);
-
-  // Ok - we now have the maximum TLB, L1, L2, and L3 sizes...
-  if ((L1Code == -1) && (L1Data == -1) && (L1Trace == -1))
-    {
-    this->Features.L1CacheSize = -1;
-    }
-  else if ((L1Code == -1) && (L1Data == -1) && (L1Trace != -1))
-    {
-    this->Features.L1CacheSize = L1Trace;
-    }
-  else if ((L1Code != -1) && (L1Data == -1))
-    {
-    this->Features.L1CacheSize = L1Code;
-    }
-  else if ((L1Code == -1) && (L1Data != -1))
-    {
-    this->Features.L1CacheSize = L1Data;
-    }
-  else if ((L1Code != -1) && (L1Data != -1))
-    {
-    this->Features.L1CacheSize = L1Code + L1Data;
-    }
-  else
-    {
-    this->Features.L1CacheSize = -1;
-    }
-
-  // Ok - we now have the maximum TLB, L1, L2, and L3 sizes...
-  if (L2Unified == -1)
-    {
-    this->Features.L2CacheSize = -1;
-    }
-  else
-    {
-    this->Features.L2CacheSize = L2Unified;
-    }
-
-  // Ok - we now have the maximum TLB, L1, L2, and L3 sizes...
-  if (L3Unified == -1)
-    {
-    this->Features.L3CacheSize = -1;
-    }
-  else
-    {
-    this->Features.L3CacheSize = L3Unified;
-    }
-
-  return true;
-
-#else
-  return false;
-#endif
-}
-
-
-/** */
-bool SystemInformationImplementation::RetrieveCPUClockSpeed()
-{
-  bool retrieved = false;
-
-#if defined(_WIN32)
-  unsigned int uiRepetitions = 1;
-  unsigned int uiMSecPerRepetition = 50;
-  __int64  i64Total = 0;
-  __int64 i64Overhead = 0;
-
-  // Check if the TSC implementation works at all
-  if (this->Features.HasTSC &&
-      GetCyclesDifference(SystemInformationImplementation::Delay,
-                          uiMSecPerRepetition) > 0)
-    {
-    for (unsigned int nCounter = 0; nCounter < uiRepetitions; nCounter ++)
-      {
-      i64Total += GetCyclesDifference (SystemInformationImplementation::Delay,
-                                       uiMSecPerRepetition);
-      i64Overhead +=
-        GetCyclesDifference (SystemInformationImplementation::DelayOverhead,
-                             uiMSecPerRepetition);
-      }
-
-    // Calculate the MHz speed.
-    i64Total -= i64Overhead;
-    i64Total /= uiRepetitions;
-    i64Total /= uiMSecPerRepetition;
-    i64Total /= 1000;
-
-    // Save the CPU speed.
-    this->CPUSpeedInMHz = (float) i64Total;
-
-    retrieved = true;
-    }
-
-  // If RDTSC is not supported, we fallback to trying to read this value
-  // from the registry:
-  if (!retrieved)
-    {
-    HKEY hKey = NULL;
-    LONG err = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
-      L"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0", 0,
-      KEY_READ, &hKey);
-
-    if (ERROR_SUCCESS == err)
-      {
-      DWORD dwType = 0;
-      DWORD data = 0;
-      DWORD dwSize = sizeof(DWORD);
-
-      err = RegQueryValueExW(hKey, L"~MHz", 0,
-        &dwType, (LPBYTE) &data, &dwSize);
-
-      if (ERROR_SUCCESS == err)
-        {
-        this->CPUSpeedInMHz = (float) data;
-        retrieved = true;
-        }
-
-      RegCloseKey(hKey);
-      hKey = NULL;
-      }
-    }
-#endif
-
-  return retrieved;
-}
-
-
-/** */
-bool SystemInformationImplementation::RetrieveClassicalCPUClockSpeed()
-{
-#if USE_ASM_INSTRUCTIONS
-  LARGE_INTEGER liStart, liEnd, liCountsPerSecond;
-  double dFrequency, dDifference;
-
-  // Attempt to get a starting tick count.
-  QueryPerformanceCounter (&liStart);
-
-  __try
-    {
-    _asm
-      {
-      mov eax, 0x80000000
-      mov ebx, CLASSICAL_CPU_FREQ_LOOP
-      Timer_Loop:
-      bsf ecx,eax
-      dec ebx
-      jnz Timer_Loop
-      }
-    }
-  __except(1)
-    {
-    return false;
-    }
-
-  // Attempt to get a starting tick count.
-  QueryPerformanceCounter (&liEnd);
-
-  // Get the difference...  NB: This is in seconds....
-  QueryPerformanceFrequency (&liCountsPerSecond);
-  dDifference = (((double) liEnd.QuadPart - (double) liStart.QuadPart) / (double) liCountsPerSecond.QuadPart);
-
-  // Calculate the clock speed.
-  if (this->ChipID.Family == 3)
-    {
-    // 80386 processors....  Loop time is 115 cycles!
-    dFrequency = (((CLASSICAL_CPU_FREQ_LOOP * 115) / dDifference) / 1000000);
-    }
-  else if (this->ChipID.Family == 4)
-    {
-    // 80486 processors....  Loop time is 47 cycles!
-    dFrequency = (((CLASSICAL_CPU_FREQ_LOOP * 47) / dDifference) / 1000000);
-    }
-  else if (this->ChipID.Family == 5)
-    {
-    // Pentium processors....  Loop time is 43 cycles!
-    dFrequency = (((CLASSICAL_CPU_FREQ_LOOP * 43) / dDifference) / 1000000);
-    }
-
-  // Save the clock speed.
-  this->Features.CPUSpeed = (int) dFrequency;
-
-  return true;
-
-#else
-  return false;
-#endif
-}
-
-
-/** */
-bool SystemInformationImplementation::RetrieveCPUExtendedLevelSupport(int CPULevelToCheck)
-{
-  int cpuinfo[4] = { 0, 0, 0, 0 };
-
-  // The extended CPUID is supported by various vendors starting with the following CPU models:
-  //
-  //    Manufacturer & Chip Name      |    Family     Model    Revision
-  //
-  //    AMD K6, K6-2                  |       5       6      x
-  //    Cyrix GXm, Cyrix III "Joshua" |       5       4      x
-  //    IDT C6-2                      |       5       8      x
-  //    VIA Cyrix III                 |       6       5      x
-  //    Transmeta Crusoe              |       5       x      x
-  //    Intel Pentium 4               |       f       x      x
-  //
-
-  // We check to see if a supported processor is present...
-  if (this->ChipManufacturer == AMD)
-    {
-    if (this->ChipID.Family < 5) return false;
-    if ((this->ChipID.Family == 5) && (this->ChipID.Model < 6)) return false;
-    }
-  else if (this->ChipManufacturer == Cyrix)
-    {
-    if (this->ChipID.Family < 5) return false;
-    if ((this->ChipID.Family == 5) && (this->ChipID.Model < 4)) return false;
-    if ((this->ChipID.Family == 6) && (this->ChipID.Model < 5)) return false;
-    }
-  else if (this->ChipManufacturer == IDT)
-    {
-    if (this->ChipID.Family < 5) return false;
-    if ((this->ChipID.Family == 5) && (this->ChipID.Model < 8)) return false;
-    }
-  else if (this->ChipManufacturer == Transmeta)
-    {
-    if (this->ChipID.Family < 5) return false;
-    }
-  else if (this->ChipManufacturer == Intel)
-    {
-    if (this->ChipID.Family < 0xf)
-      {
-      return false;
-      }
-    }
-
-#if USE_CPUID
-  if (!call_cpuid(0x80000000, cpuinfo))
-    {
-    return false;
-    }
-#endif
-
-  // Now we have to check the level wanted vs level returned...
-  int nLevelWanted = (CPULevelToCheck & 0x7FFFFFFF);
-  int nLevelReturn = (cpuinfo[0] & 0x7FFFFFFF);
-
-  // Check to see if the level provided is supported...
-  if (nLevelWanted > nLevelReturn)
-    {
-    return false;
-    }
-
-  return true;
-}
-
-
-/** */
-bool SystemInformationImplementation::RetrieveExtendedCPUFeatures()
-{
-
-  // Check that we are not using an Intel processor as it does not support this.
-  if (this->ChipManufacturer == Intel)
-    {
-    return false;
-    }
-
-  // Check to see if what we are about to do is supported...
-  if (!RetrieveCPUExtendedLevelSupport(static_cast<int>(0x80000001)))
-    {
-    return false;
-    }
-
-#if USE_CPUID
-  int localCPUExtendedFeatures[4] = { 0, 0, 0, 0 };
-
-  if (!call_cpuid(0x80000001, localCPUExtendedFeatures))
-    {
-    return false;
-    }
-
-  // Retrieve the extended features of CPU present.
-  this->Features.ExtendedFeatures.Has3DNow =     ((localCPUExtendedFeatures[3] & 0x80000000) != 0);  // 3DNow Present --> Bit 31.
-  this->Features.ExtendedFeatures.Has3DNowPlus = ((localCPUExtendedFeatures[3] & 0x40000000) != 0);  // 3DNow+ Present -- > Bit 30.
-  this->Features.ExtendedFeatures.HasSSEMMX =    ((localCPUExtendedFeatures[3] & 0x00400000) != 0);  // SSE MMX Present --> Bit 22.
-  this->Features.ExtendedFeatures.SupportsMP =   ((localCPUExtendedFeatures[3] & 0x00080000) != 0);  // MP Capable -- > Bit 19.
-
-  // Retrieve AMD specific extended features.
-  if (this->ChipManufacturer == AMD)
-    {
-    this->Features.ExtendedFeatures.HasMMXPlus = ((localCPUExtendedFeatures[3] & 0x00400000) != 0);  // AMD specific: MMX-SSE --> Bit 22
-    }
-
-  // Retrieve Cyrix specific extended features.
-  if (this->ChipManufacturer == Cyrix)
-    {
-    this->Features.ExtendedFeatures.HasMMXPlus = ((localCPUExtendedFeatures[3] & 0x01000000) != 0);  // Cyrix specific: Extended MMX --> Bit 24
-    }
-
-  return true;
-
-#else
-  return false;
-#endif
-}
-
-
-/** */
-bool SystemInformationImplementation::RetrieveProcessorSerialNumber()
-{
-  // Check to see if the processor supports the processor serial number.
-  if (!this->Features.HasSerial)
-    {
-    return false;
-    }
-
-#if USE_CPUID
-  int SerialNumber[4];
-
-  if (!call_cpuid(3, SerialNumber))
-    {
-    return false;
-    }
-
-  // Process the returned information.
-  //    ; eax = 3 --> ebx: top 32 bits are the processor signature bits --> NB: Transmeta only ?!?
-  //    ;        ecx: middle 32 bits are the processor signature bits
-  //    ;        edx: bottom 32 bits are the processor signature bits
-  char sn[128];
-  sprintf (sn, "%.2x%.2x-%.2x%.2x-%.2x%.2x-%.2x%.2x-%.2x%.2x-%.2x%.2x",
-       ((SerialNumber[1] & 0xff000000) >> 24),
-       ((SerialNumber[1] & 0x00ff0000) >> 16),
-       ((SerialNumber[1] & 0x0000ff00) >> 8),
-       ((SerialNumber[1] & 0x000000ff) >> 0),
-       ((SerialNumber[2] & 0xff000000) >> 24),
-       ((SerialNumber[2] & 0x00ff0000) >> 16),
-       ((SerialNumber[2] & 0x0000ff00) >> 8),
-       ((SerialNumber[2] & 0x000000ff) >> 0),
-       ((SerialNumber[3] & 0xff000000) >> 24),
-       ((SerialNumber[3] & 0x00ff0000) >> 16),
-       ((SerialNumber[3] & 0x0000ff00) >> 8),
-       ((SerialNumber[3] & 0x000000ff) >> 0));
-  this->ChipID.SerialNumber = sn;
-  return true;
-
-#else
-  return false;
-#endif
-}
-
-
-/** */
-bool SystemInformationImplementation::RetrieveCPUPowerManagement()
-{
-  // Check to see if what we are about to do is supported...
-  if (!RetrieveCPUExtendedLevelSupport(static_cast<int>(0x80000007)))
-    {
-    this->Features.ExtendedFeatures.PowerManagement.HasFrequencyID = false;
-    this->Features.ExtendedFeatures.PowerManagement.HasVoltageID = false;
-    this->Features.ExtendedFeatures.PowerManagement.HasTempSenseDiode = false;
-    return false;
-    }
-
-#if USE_CPUID
-  int localCPUPowerManagement[4] = { 0, 0, 0, 0 };
-
-  if (!call_cpuid(0x80000007, localCPUPowerManagement))
-    {
-    return false;
-    }
-
-  // Check for the power management capabilities of the CPU.
-  this->Features.ExtendedFeatures.PowerManagement.HasTempSenseDiode =  ((localCPUPowerManagement[3] & 0x00000001) != 0);
-  this->Features.ExtendedFeatures.PowerManagement.HasFrequencyID =     ((localCPUPowerManagement[3] & 0x00000002) != 0);
-  this->Features.ExtendedFeatures.PowerManagement.HasVoltageID =       ((localCPUPowerManagement[3] & 0x00000004) != 0);
-
-  return true;
-
-#else
-  return false;
-#endif
-}
-
-#if USE_CPUID
-// Used only in USE_CPUID implementation below.
-static void SystemInformationStripLeadingSpace(kwsys_stl::string& str)
-{
-  // Because some manufacturers have leading white space - we have to post-process the name.
-  kwsys_stl::string::size_type pos = str.find_first_not_of(" ");
-  if(pos != kwsys_stl::string::npos)
-    {
-    str = str.substr(pos);
-    }
-}
-#endif
-
-/** */
-bool SystemInformationImplementation::RetrieveExtendedCPUIdentity()
-{
-  // Check to see if what we are about to do is supported...
-  if (!RetrieveCPUExtendedLevelSupport(static_cast<int>(0x80000002)))
-    return false;
-  if (!RetrieveCPUExtendedLevelSupport(static_cast<int>(0x80000003)))
-    return false;
-  if (!RetrieveCPUExtendedLevelSupport(static_cast<int>(0x80000004)))
-    return false;
-
-#if USE_CPUID
-  int CPUExtendedIdentity[12];
-
-  if (!call_cpuid(0x80000002, CPUExtendedIdentity))
-    {
-    return false;
-    }
-  if (!call_cpuid(0x80000003, CPUExtendedIdentity + 4))
-    {
-    return false;
-    }
-  if (!call_cpuid(0x80000004, CPUExtendedIdentity + 8))
-    {
-    return false;
-    }
-
-  // Process the returned information.
-  char nbuf[49];
-  memcpy (&(nbuf[0]), &(CPUExtendedIdentity[0]), sizeof (int));
-  memcpy (&(nbuf[4]), &(CPUExtendedIdentity[1]), sizeof (int));
-  memcpy (&(nbuf[8]), &(CPUExtendedIdentity[2]), sizeof (int));
-  memcpy (&(nbuf[12]), &(CPUExtendedIdentity[3]), sizeof (int));
-  memcpy (&(nbuf[16]), &(CPUExtendedIdentity[4]), sizeof (int));
-  memcpy (&(nbuf[20]), &(CPUExtendedIdentity[5]), sizeof (int));
-  memcpy (&(nbuf[24]), &(CPUExtendedIdentity[6]), sizeof (int));
-  memcpy (&(nbuf[28]), &(CPUExtendedIdentity[7]), sizeof (int));
-  memcpy (&(nbuf[32]), &(CPUExtendedIdentity[8]), sizeof (int));
-  memcpy (&(nbuf[36]), &(CPUExtendedIdentity[9]), sizeof (int));
-  memcpy (&(nbuf[40]), &(CPUExtendedIdentity[10]), sizeof (int));
-  memcpy (&(nbuf[44]), &(CPUExtendedIdentity[11]), sizeof (int));
-  nbuf[48] = '\0';
-  this->ChipID.ProcessorName = nbuf;
-  this->ChipID.ModelName = nbuf;
-
-  // Because some manufacturers have leading white space - we have to post-process the name.
-  SystemInformationStripLeadingSpace(this->ChipID.ProcessorName);
-  return true;
-#else
-  return false;
-#endif
-}
-
-
-/** */
-bool SystemInformationImplementation::RetrieveClassicalCPUIdentity()
-{
-  // Start by decided which manufacturer we are using....
-  switch (this->ChipManufacturer)
-    {
-    case Intel:
-      // Check the family / model / revision to determine the CPU ID.
-      switch (this->ChipID.Family) {
-        case 3:
-          this->ChipID.ProcessorName =  "Newer i80386 family";
-          break;
-        case 4:
-          switch (this->ChipID.Model) {
-            case 0: this->ChipID.ProcessorName = "i80486DX-25/33"; break;
-            case 1: this->ChipID.ProcessorName = "i80486DX-50"; break;
-            case 2: this->ChipID.ProcessorName = "i80486SX"; break;
-            case 3: this->ChipID.ProcessorName = "i80486DX2"; break;
-            case 4: this->ChipID.ProcessorName = "i80486SL"; break;
-            case 5: this->ChipID.ProcessorName = "i80486SX2"; break;
-            case 7: this->ChipID.ProcessorName = "i80486DX2 WriteBack"; break;
-            case 8: this->ChipID.ProcessorName = "i80486DX4"; break;
-            case 9: this->ChipID.ProcessorName = "i80486DX4 WriteBack"; break;
-            default: this->ChipID.ProcessorName = "Unknown 80486 family"; return false;
-            }
-          break;
-        case 5:
-          switch (this->ChipID.Model)
-            {
-            case 0: this->ChipID.ProcessorName = "P5 A-Step"; break;
-            case 1: this->ChipID.ProcessorName = "P5"; break;
-            case 2: this->ChipID.ProcessorName = "P54C"; break;
-            case 3: this->ChipID.ProcessorName = "P24T OverDrive"; break;
-            case 4: this->ChipID.ProcessorName = "P55C"; break;
-            case 7: this->ChipID.ProcessorName = "P54C"; break;
-            case 8: this->ChipID.ProcessorName = "P55C (0.25micron)"; break;
-            default: this->ChipID.ProcessorName = "Unknown Pentium family"; return false;
-            }
-          break;
-        case 6:
-          switch (this->ChipID.Model)
-            {
-            case 0: this->ChipID.ProcessorName = "P6 A-Step"; break;
-            case 1: this->ChipID.ProcessorName = "P6"; break;
-            case 3: this->ChipID.ProcessorName = "Pentium II (0.28 micron)"; break;
-            case 5: this->ChipID.ProcessorName = "Pentium II (0.25 micron)"; break;
-            case 6: this->ChipID.ProcessorName = "Pentium II With On-Die L2 Cache"; break;
-            case 7: this->ChipID.ProcessorName = "Pentium III (0.25 micron)"; break;
-            case 8: this->ChipID.ProcessorName = "Pentium III (0.18 micron) With 256 KB On-Die L2 Cache "; break;
-            case 0xa: this->ChipID.ProcessorName = "Pentium III (0.18 micron) With 1 Or 2 MB On-Die L2 Cache "; break;
-            case 0xb: this->ChipID.ProcessorName = "Pentium III (0.13 micron) With 256 Or 512 KB On-Die L2 Cache "; break;
-            case 23: this->ChipID.ProcessorName =  "Intel(R) Core(TM)2 Duo CPU     T9500  @ 2.60GHz"; break;
-            default: this->ChipID.ProcessorName = "Unknown P6 family"; return false;
-            }
-          break;
-        case 7:
-          this->ChipID.ProcessorName = "Intel Merced (IA-64)";
-          break;
-        case 0xf:
-          // Check the extended family bits...
-          switch (this->ChipID.ExtendedFamily)
-            {
-            case 0:
-              switch (this->ChipID.Model)
-                {
-                case 0: this->ChipID.ProcessorName = "Pentium IV (0.18 micron)"; break;
-                case 1: this->ChipID.ProcessorName = "Pentium IV (0.18 micron)"; break;
-                case 2: this->ChipID.ProcessorName = "Pentium IV (0.13 micron)"; break;
-                default: this->ChipID.ProcessorName = "Unknown Pentium 4 family"; return false;
-                }
-              break;
-            case 1:
-              this->ChipID.ProcessorName = "Intel McKinley (IA-64)";
-              break;
-            default:
-              this->ChipID.ProcessorName = "Pentium";
-            }
-          break;
-        default:
-          this->ChipID.ProcessorName = "Unknown Intel family";
-          return false;
-        }
-      break;
-
-    case AMD:
-      // Check the family / model / revision to determine the CPU ID.
-      switch (this->ChipID.Family)
-        {
-        case 4:
-          switch (this->ChipID.Model)
-            {
-            case 3: this->ChipID.ProcessorName = "80486DX2"; break;
-            case 7: this->ChipID.ProcessorName = "80486DX2 WriteBack"; break;
-            case 8: this->ChipID.ProcessorName = "80486DX4"; break;
-            case 9: this->ChipID.ProcessorName = "80486DX4 WriteBack"; break;
-            case 0xe: this->ChipID.ProcessorName = "5x86"; break;
-            case 0xf: this->ChipID.ProcessorName = "5x86WB"; break;
-            default: this->ChipID.ProcessorName = "Unknown 80486 family"; return false;
-            }
-          break;
-        case 5:
-          switch (this->ChipID.Model)
-            {
-            case 0: this->ChipID.ProcessorName = "SSA5 (PR75, PR90 =  PR100)"; break;
-            case 1: this->ChipID.ProcessorName = "5k86 (PR120 =  PR133)"; break;
-            case 2: this->ChipID.ProcessorName = "5k86 (PR166)"; break;
-            case 3: this->ChipID.ProcessorName = "5k86 (PR200)"; break;
-            case 6: this->ChipID.ProcessorName = "K6 (0.30 micron)"; break;
-            case 7: this->ChipID.ProcessorName = "K6 (0.25 micron)"; break;
-            case 8: this->ChipID.ProcessorName = "K6-2"; break;
-            case 9: this->ChipID.ProcessorName = "K6-III"; break;
-            case 0xd: this->ChipID.ProcessorName = "K6-2+ or K6-III+ (0.18 micron)"; break;
-            default: this->ChipID.ProcessorName = "Unknown 80586 family"; return false;
-            }
-          break;
-        case 6:
-          switch (this->ChipID.Model)
-            {
-            case 1: this->ChipID.ProcessorName = "Athlon- (0.25 micron)"; break;
-            case 2: this->ChipID.ProcessorName = "Athlon- (0.18 micron)"; break;
-            case 3: this->ChipID.ProcessorName = "Duron- (SF core)"; break;
-            case 4: this->ChipID.ProcessorName = "Athlon- (Thunderbird core)"; break;
-            case 6: this->ChipID.ProcessorName = "Athlon- (Palomino core)"; break;
-            case 7: this->ChipID.ProcessorName = "Duron- (Morgan core)"; break;
-            case 8:
-              if (this->Features.ExtendedFeatures.SupportsMP)
-                this->ChipID.ProcessorName = "Athlon - MP (Thoroughbred core)";
-              else this->ChipID.ProcessorName = "Athlon - XP (Thoroughbred core)";
-              break;
-            default: this->ChipID.ProcessorName = "Unknown K7 family"; return false;
-            }
-          break;
-        default:
-          this->ChipID.ProcessorName = "Unknown AMD family";
-          return false;
-        }
-      break;
-
-    case Transmeta:
-      switch (this->ChipID.Family)
-        {
-        case 5:
-          switch (this->ChipID.Model)
-            {
-            case 4: this->ChipID.ProcessorName = "Crusoe TM3x00 and TM5x00"; break;
-            default: this->ChipID.ProcessorName = "Unknown Crusoe family"; return false;
-            }
-          break;
-        default:
-          this->ChipID.ProcessorName = "Unknown Transmeta family";
-          return false;
-        }
-      break;
-
-    case Rise:
-      switch (this->ChipID.Family)
-        {
-        case 5:
-          switch (this->ChipID.Model)
-            {
-            case 0: this->ChipID.ProcessorName = "mP6 (0.25 micron)"; break;
-            case 2: this->ChipID.ProcessorName = "mP6 (0.18 micron)"; break;
-            default: this->ChipID.ProcessorName = "Unknown Rise family"; return false;
-            }
-          break;
-        default:
-          this->ChipID.ProcessorName = "Unknown Rise family";
-          return false;
-        }
-      break;
-
-    case UMC:
-      switch (this->ChipID.Family)
-        {
-        case 4:
-          switch (this->ChipID.Model)
-            {
-            case 1: this->ChipID.ProcessorName = "U5D"; break;
-            case 2: this->ChipID.ProcessorName = "U5S"; break;
-            default: this->ChipID.ProcessorName = "Unknown UMC family"; return false;
-            }
-          break;
-        default:
-          this->ChipID.ProcessorName = "Unknown UMC family";
-          return false;
-        }
-      break;
-
-    case IDT:
-      switch (this->ChipID.Family)
-        {
-        case 5:
-          switch (this->ChipID.Model)
-            {
-            case 4: this->ChipID.ProcessorName = "C6"; break;
-            case 8: this->ChipID.ProcessorName = "C2"; break;
-            case 9: this->ChipID.ProcessorName = "C3"; break;
-            default: this->ChipID.ProcessorName = "Unknown IDT\\Centaur family"; return false;
-            }
-          break;
-        case 6:
-          switch (this->ChipID.Model)
-            {
-            case 6: this->ChipID.ProcessorName = "VIA Cyrix III - Samuel"; break;
-            default: this->ChipID.ProcessorName = "Unknown IDT\\Centaur family"; return false;
-            }
-          break;
-        default:
-          this->ChipID.ProcessorName = "Unknown IDT\\Centaur family";
-          return false;
-        }
-      break;
-
-    case Cyrix:
-      switch (this->ChipID.Family)
-        {
-        case 4:
-          switch (this->ChipID.Model)
-            {
-            case 4: this->ChipID.ProcessorName = "MediaGX GX =  GXm"; break;
-            case 9: this->ChipID.ProcessorName = "5x86"; break;
-            default: this->ChipID.ProcessorName = "Unknown Cx5x86 family"; return false;
-            }
-          break;
-        case 5:
-          switch (this->ChipID.Model)
-            {
-            case 2: this->ChipID.ProcessorName = "Cx6x86"; break;
-            case 4: this->ChipID.ProcessorName = "MediaGX GXm"; break;
-            default: this->ChipID.ProcessorName = "Unknown Cx6x86 family"; return false;
-            }
-          break;
-        case 6:
-          switch (this->ChipID.Model)
-            {
-            case 0: this->ChipID.ProcessorName = "6x86MX"; break;
-            case 5: this->ChipID.ProcessorName = "Cyrix M2 Core"; break;
-            case 6: this->ChipID.ProcessorName = "WinChip C5A Core"; break;
-            case 7: this->ChipID.ProcessorName = "WinChip C5B\\C5C Core"; break;
-            case 8: this->ChipID.ProcessorName = "WinChip C5C-T Core"; break;
-            default: this->ChipID.ProcessorName = "Unknown 6x86MX\\Cyrix III family"; return false;
-            }
-          break;
-        default:
-          this->ChipID.ProcessorName = "Unknown Cyrix family";
-          return false;
-        }
-      break;
-
-    case NexGen:
-      switch (this->ChipID.Family)
-        {
-        case 5:
-          switch (this->ChipID.Model)
-            {
-            case 0: this->ChipID.ProcessorName = "Nx586 or Nx586FPU"; break;
-            default: this->ChipID.ProcessorName = "Unknown NexGen family"; return false;
-            }
-          break;
-        default:
-          this->ChipID.ProcessorName = "Unknown NexGen family";
-          return false;
-        }
-      break;
-
-    case NSC:
-      this->ChipID.ProcessorName = "Cx486SLC \\ DLC \\ Cx486S A-Step";
-      break;
-    default:
-      this->ChipID.ProcessorName = "Unknown family"; // We cannot identify the processor.
-      return false;
-    }
-
-  return true;
-}
-
-
-/** Extract a value from the CPUInfo file */
-kwsys_stl::string SystemInformationImplementation::ExtractValueFromCpuInfoFile(kwsys_stl::string buffer,const char* word,size_t init)
-{
-  size_t pos = buffer.find(word,init);
-  if(pos != buffer.npos)
-    {
-    this->CurrentPositionInFile = pos;
-    pos = buffer.find(":",pos);
-    size_t pos2 = buffer.find("\n",pos);
-    if(pos!=buffer.npos && pos2!=buffer.npos)
-      {
-      // It may happen that the beginning matches, but this is still not the requested key.
-      // An example is looking for "cpu" when "cpu family" comes first. So we check that
-      // we have only spaces from here to pos, otherwise we search again.
-      for(size_t i=this->CurrentPositionInFile+strlen(word); i < pos; ++i)
-        {
-        if(buffer[i] != ' ' && buffer[i] != '\t')
-          {
-          return this->ExtractValueFromCpuInfoFile(buffer, word, pos2);
-          }
-        }
-      return buffer.substr(pos+2,pos2-pos-2);
-      }
-    }
-  this->CurrentPositionInFile = buffer.npos;
-  return "";
-}
-
-/** Query for the cpu status */
-bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
-{
-  this->NumberOfLogicalCPU = 0;
-  this->NumberOfPhysicalCPU = 0;
-  kwsys_stl::string buffer;
-
-  FILE *fd = fopen("/proc/cpuinfo", "r" );
-  if ( !fd )
-    {
-    kwsys_ios::cout << "Problem opening /proc/cpuinfo" << kwsys_ios::endl;
-    return false;
-    }
-
-  size_t fileSize = 0;
-  while(!feof(fd))
-    {
-    buffer += static_cast<char>(fgetc(fd));
-    fileSize++;
-    }
-  fclose( fd );
-  buffer.resize(fileSize-2);
-  // Number of logical CPUs (combination of multiple processors, multi-core
-  // and hyperthreading)
-  size_t pos = buffer.find("processor\t");
-  while(pos != buffer.npos)
-    {
-    this->NumberOfLogicalCPU++;
-    pos = buffer.find("processor\t",pos+1);
-    }
-
-#ifdef __linux
-  // Find the largest physical id.
-  int maxId = -1;
-  kwsys_stl::string idc =
-                       this->ExtractValueFromCpuInfoFile(buffer,"physical id");
-  while(this->CurrentPositionInFile != buffer.npos)
-    {
-      int id = atoi(idc.c_str());
-      if(id > maxId)
-      {
-       maxId=id;
-      }
-    idc = this->ExtractValueFromCpuInfoFile(buffer,"physical id",
-                                            this->CurrentPositionInFile+1);
-    }
-  // Physical ids returned by Linux don't distinguish cores.
-  // We want to record the total number of cores in this->NumberOfPhysicalCPU
-  // (checking only the first proc)
-  kwsys_stl::string cores =
-                        this->ExtractValueFromCpuInfoFile(buffer,"cpu cores");
-  int numberOfCoresPerCPU=atoi(cores.c_str());
-  if (maxId > 0)
-    {
-    this->NumberOfPhysicalCPU=static_cast<unsigned int>(
-      numberOfCoresPerCPU*(maxId+1));
-    }
-  else
-    {
-    // Linux Sparc: get cpu count
-    this->NumberOfPhysicalCPU=
-            atoi(this->ExtractValueFromCpuInfoFile(buffer,"ncpus active").c_str());
-    }
-
-#else // __CYGWIN__
-  // does not have "physical id" entries, neither "cpu cores"
-  // this has to be fixed for hyper-threading.
-  kwsys_stl::string cpucount =
-    this->ExtractValueFromCpuInfoFile(buffer,"cpu count");
-  this->NumberOfPhysicalCPU=
-    this->NumberOfLogicalCPU = atoi(cpucount.c_str());
-#endif
-  // gotta have one, and if this is 0 then we get a / by 0n
-  // better to have a bad answer than a crash
-  if(this->NumberOfPhysicalCPU <= 0)
-    {
-    this->NumberOfPhysicalCPU = 1;
-    }
-  // LogicalProcessorsPerPhysical>1 => hyperthreading.
-  this->Features.ExtendedFeatures.LogicalProcessorsPerPhysical=
-      this->NumberOfLogicalCPU/this->NumberOfPhysicalCPU;
-
-  // CPU speed (checking only the first processor)
-  kwsys_stl::string CPUSpeed = this->ExtractValueFromCpuInfoFile(buffer,"cpu MHz");
-  if(!CPUSpeed.empty())
-    {
-    this->CPUSpeedInMHz = static_cast<float>(atof(CPUSpeed.c_str()));
-    }
-#ifdef __linux
-  else
-    {
-    // Linux Sparc: CPU speed is in Hz and encoded in hexadecimal
-    CPUSpeed = this->ExtractValueFromCpuInfoFile(buffer,"Cpu0ClkTck");
-    this->CPUSpeedInMHz = static_cast<float>(
-                                 strtoull(CPUSpeed.c_str(),0,16))/1000000.0f;
-    }
-#endif
-
-  // Chip family
-  kwsys_stl::string familyStr =
-    this->ExtractValueFromCpuInfoFile(buffer,"cpu family");
-  if(familyStr.empty())
-    {
-    familyStr = this->ExtractValueFromCpuInfoFile(buffer,"CPU architecture");
-    }
-  this->ChipID.Family = atoi(familyStr.c_str());
-
-  // Chip Vendor
-  this->ChipID.Vendor = this->ExtractValueFromCpuInfoFile(buffer,"vendor_id");
-  this->FindManufacturer(familyStr);
-
-  // second try for setting family
-  if (this->ChipID.Family == 0 && this->ChipManufacturer == HP)
-    {
-    if (familyStr == "PA-RISC 1.1a")
-      this->ChipID.Family = 0x11a;
-    else if (familyStr == "PA-RISC 2.0")
-      this->ChipID.Family = 0x200;
-    // If you really get CMake to work on a machine not belonging to
-    // any of those families I owe you a dinner if you get it to
-    // contribute nightly builds regularly.
-    }
-
-  // Chip Model
-  this->ChipID.Model = atoi(this->ExtractValueFromCpuInfoFile(buffer,"model").c_str());
-  if(!this->RetrieveClassicalCPUIdentity())
-    {
-    // Some platforms (e.g. PA-RISC) tell us their CPU name here.
-    // Note: x86 does not.
-    kwsys_stl::string cpuname = this->ExtractValueFromCpuInfoFile(buffer,"cpu");
-    if(!cpuname.empty())
-      {
-      this->ChipID.ProcessorName = cpuname;
-      }
-    }
-
-  // Chip revision
-  kwsys_stl::string cpurev = this->ExtractValueFromCpuInfoFile(buffer,"stepping");
-  if(cpurev.empty())
-    {
-    cpurev = this->ExtractValueFromCpuInfoFile(buffer,"CPU revision");
-    }
-  this->ChipID.Revision = atoi(cpurev.c_str());
-
-  // Chip Model Name
-  this->ChipID.ModelName = this->ExtractValueFromCpuInfoFile(buffer,"model name").c_str();
-
-  // L1 Cache size
-  // Different architectures may show different names for the caches.
-  // Sum up everything we find.
-  kwsys_stl::vector<const char*> cachename;
-  cachename.clear();
-
-  cachename.push_back("cache size"); // e.g. x86
-  cachename.push_back("I-cache"); // e.g. PA-RISC
-  cachename.push_back("D-cache"); // e.g. PA-RISC
-
-  this->Features.L1CacheSize = 0;
-  for (size_t index = 0; index < cachename.size(); index ++)
-    {
-    kwsys_stl::string cacheSize = this->ExtractValueFromCpuInfoFile(buffer,cachename[index]);
-    if (!cacheSize.empty())
-      {
-      pos = cacheSize.find(" KB");
-      if(pos!=cacheSize.npos)
-        {
-        cacheSize = cacheSize.substr(0,pos);
-        }
-      this->Features.L1CacheSize += atoi(cacheSize.c_str());
-      }
-    }
-
-  // processor feature flags (probably x86 specific)
-  kwsys_stl::string cpuflags = this->ExtractValueFromCpuInfoFile(buffer,"flags");
-  if(!cpurev.empty())
-    {
-    // now we can match every flags as space + flag + space
-    cpuflags = " " + cpuflags + " ";
-    if ((cpuflags.find(" fpu ")!=kwsys_stl::string::npos))
-      {
-      this->Features.HasFPU = true;
-      }
-    if ((cpuflags.find(" tsc ")!=kwsys_stl::string::npos))
-      {
-      this->Features.HasTSC = true;
-      }
-    if ((cpuflags.find(" mmx ")!=kwsys_stl::string::npos))
-      {
-      this->Features.HasMMX = true;
-      }
-    if ((cpuflags.find(" sse ")!=kwsys_stl::string::npos))
-      {
-      this->Features.HasSSE = true;
-      }
-    if ((cpuflags.find(" sse2 ")!=kwsys_stl::string::npos))
-      {
-      this->Features.HasSSE2 = true;
-      }
-    if ((cpuflags.find(" apic ")!=kwsys_stl::string::npos))
-      {
-      this->Features.HasAPIC = true;
-      }
-    if ((cpuflags.find(" cmov ")!=kwsys_stl::string::npos))
-      {
-      this->Features.HasCMOV = true;
-      }
-    if ((cpuflags.find(" mtrr ")!=kwsys_stl::string::npos))
-      {
-      this->Features.HasMTRR = true;
-      }
-    if ((cpuflags.find(" acpi ")!=kwsys_stl::string::npos))
-      {
-      this->Features.HasACPI = true;
-      }
-    if ((cpuflags.find(" 3dnow ")!=kwsys_stl::string::npos))
-      {
-      this->Features.ExtendedFeatures.Has3DNow = true;
-      }
-    }
-
-  return true;
-}
-
-bool SystemInformationImplementation::QueryProcessorBySysconf()
-{
-#if defined(_SC_NPROC_ONLN) && !defined(_SC_NPROCESSORS_ONLN)
-// IRIX names this slightly different
-# define _SC_NPROCESSORS_ONLN _SC_NPROC_ONLN
-#endif
-
-#ifdef _SC_NPROCESSORS_ONLN
-  long c = sysconf(_SC_NPROCESSORS_ONLN);
-  if (c <= 0)
-    {
-    return false;
-    }
-
-  this->NumberOfPhysicalCPU = static_cast<unsigned int>(c);
-  this->NumberOfLogicalCPU = this->NumberOfPhysicalCPU;
-
-  return true;
-#else
-  return false;
-#endif
-}
-
-bool SystemInformationImplementation::QueryProcessor()
-{
-  return this->QueryProcessorBySysconf();
-}
-
-/**
-Get total system RAM in units of KiB.
-*/
-SystemInformation::LongLong
-SystemInformationImplementation::GetHostMemoryTotal()
-{
-#if defined(_WIN32)
-# if defined(_MSC_VER) && _MSC_VER < 1300
-  MEMORYSTATUS stat;
-  stat.dwLength = sizeof(stat);
-  GlobalMemoryStatus(&stat);
-  return stat.dwTotalPhys/1024;
-# else
-  MEMORYSTATUSEX statex;
-  statex.dwLength=sizeof(statex);
-  GlobalMemoryStatusEx(&statex);
-  return statex.ullTotalPhys/1024;
-# endif
-#elif defined(__linux)
-  SystemInformation::LongLong memTotal=0;
-  int ierr=GetFieldFromFile("/proc/meminfo","MemTotal:",memTotal);
-  if (ierr)
-    {
-    return -1;
-    }
-  return memTotal;
-#elif defined(__APPLE__)
-  uint64_t mem;
-  size_t len = sizeof(mem);
-  int ierr=sysctlbyname("hw.memsize", &mem, &len, NULL, 0);
-  if (ierr)
-    {
-    return -1;
-    }
-  return mem/1024;
-#else
-  return 0;
-#endif
-}
-
-/**
-Get total system RAM in units of KiB. This may differ from the
-host total if a host-wide resource limit is applied.
-*/
-SystemInformation::LongLong
-SystemInformationImplementation::GetHostMemoryAvailable(const char *hostLimitEnvVarName)
-{
-  SystemInformation::LongLong memTotal=this->GetHostMemoryTotal();
-
-  // the following mechanism is provided for systems that
-  // apply resource limits across groups of processes.
-  // this is of use on certain SMP systems (eg. SGI UV)
-  // where the host has a large amount of ram but a given user's
-  // access to it is severly restricted. The system will
-  // apply a limit across a set of processes. Units are in KiB.
-  if (hostLimitEnvVarName)
-    {
-    const char *hostLimitEnvVarValue=getenv(hostLimitEnvVarName);
-    if (hostLimitEnvVarValue)
-      {
-      SystemInformation::LongLong hostLimit=atoLongLong(hostLimitEnvVarValue);
-      if (hostLimit>0)
-        {
-        memTotal=min(hostLimit,memTotal);
-        }
-      }
-    }
-
-  return memTotal;
-}
-
-/**
-Get total system RAM in units of KiB. This may differ from the
-host total if a per-process resource limit is applied.
-*/
-SystemInformation::LongLong
-SystemInformationImplementation::GetProcMemoryAvailable(
-        const char *hostLimitEnvVarName,
-        const char *procLimitEnvVarName)
-{
-  SystemInformation::LongLong memAvail
-    = this->GetHostMemoryAvailable(hostLimitEnvVarName);
-
-  // the following mechanism is provide for systems where rlimits
-  // are not employed. Units are in KiB.
-  if (procLimitEnvVarName)
-    {
-    const char *procLimitEnvVarValue=getenv(procLimitEnvVarName);
-    if (procLimitEnvVarValue)
-      {
-      SystemInformation::LongLong procLimit=atoLongLong(procLimitEnvVarValue);
-      if (procLimit>0)
-        {
-        memAvail=min(procLimit,memAvail);
-        }
-      }
-    }
-
-#if defined(__linux)
-  int ierr;
-  ResourceLimitType rlim;
-  ierr=GetResourceLimit(RLIMIT_DATA,&rlim);
-  if ((ierr==0) && (rlim.rlim_cur != RLIM_INFINITY))
-    {
-    memAvail=min((SystemInformation::LongLong)rlim.rlim_cur/1024,memAvail);
-    }
-
-  ierr=GetResourceLimit(RLIMIT_AS,&rlim);
-  if ((ierr==0) && (rlim.rlim_cur != RLIM_INFINITY))
-    {
-    memAvail=min((SystemInformation::LongLong)rlim.rlim_cur/1024,memAvail);
-    }
-#elif defined(__APPLE__)
-  struct rlimit rlim;
-  int ierr;
-  ierr=getrlimit(RLIMIT_DATA,&rlim);
-  if ((ierr==0) && (rlim.rlim_cur != RLIM_INFINITY))
-    {
-    memAvail=min((SystemInformation::LongLong)rlim.rlim_cur/1024,memAvail);
-    }
-
-  ierr=getrlimit(RLIMIT_RSS,&rlim);
-  if ((ierr==0) && (rlim.rlim_cur != RLIM_INFINITY))
-    {
-    memAvail=min((SystemInformation::LongLong)rlim.rlim_cur/1024,memAvail);
-    }
-#endif
-
-  return memAvail;
-}
-
-/**
-Get RAM used by all processes in the host, in units of KiB.
-*/
-SystemInformation::LongLong
-SystemInformationImplementation::GetHostMemoryUsed()
-{
-#if defined(_WIN32)
-# if defined(_MSC_VER) && _MSC_VER < 1300
-  MEMORYSTATUS stat;
-  stat.dwLength = sizeof(stat);
-  GlobalMemoryStatus(&stat);
-  return (stat.dwTotalPhys - stat.dwAvailPhys)/1024;
-# else
-  MEMORYSTATUSEX statex;
-  statex.dwLength=sizeof(statex);
-  GlobalMemoryStatusEx(&statex);
-  return (statex.ullTotalPhys - statex.ullAvailPhys)/1024;
-# endif
-#elif defined(__linux)
-  const char *names[3]={"MemTotal:","MemFree:",NULL};
-  SystemInformation::LongLong values[2]={SystemInformation::LongLong(0)};
-  int ierr=GetFieldsFromFile("/proc/meminfo",names,values);
-  if (ierr)
-    {
-    return ierr;
-    }
-  SystemInformation::LongLong &memTotal=values[0];
-  SystemInformation::LongLong &memFree=values[1];
-  return memTotal - memFree;
-#elif defined(__APPLE__)
-  SystemInformation::LongLong psz=getpagesize();
-  if (psz<1)
-    {
-    return -1;
-    }
-  const char *names[4]={"Pages active:","Pages inactive:","Pages wired down:",NULL};
-  SystemInformation::LongLong values[3]={SystemInformation::LongLong(0)};
-  int ierr=GetFieldsFromCommand("vm_stat", names, values);
-  if (ierr)
-    {
-    return -1;
-    }
-  SystemInformation::LongLong &vmActive=values[0];
-  SystemInformation::LongLong &vmInactive=values[1];
-  SystemInformation::LongLong &vmWired=values[2];
-  return ((vmActive+vmInactive+vmWired)*psz)/1024;
-#else
-  return 0;
-#endif
-}
-
-/**
-Get system RAM used by the process associated with the given
-process id in units of KiB.
-*/
-SystemInformation::LongLong
-SystemInformationImplementation::GetProcMemoryUsed()
-{
-#if defined(_WIN32) && defined(KWSYS_SYS_HAS_PSAPI)
-  long pid=GetCurrentProcessId();
-  HANDLE hProc;
-  hProc=OpenProcess(
-      PROCESS_QUERY_INFORMATION|PROCESS_VM_READ,
-      false,
-      pid);
-  if (hProc==0)
-    {
-    return -1;
-    }
-  PROCESS_MEMORY_COUNTERS pmc;
-  int ok=GetProcessMemoryInfo(hProc,&pmc,sizeof(pmc));
-  CloseHandle(hProc);
-  if (!ok)
-    {
-    return -2;
-    }
-  return pmc.WorkingSetSize/1024;
-#elif defined(__linux)
-  SystemInformation::LongLong memUsed=0;
-  int ierr=GetFieldFromFile("/proc/self/status","VmRSS:",memUsed);
-  if (ierr)
-    {
-    return -1;
-    }
-  return memUsed;
-#elif defined(__APPLE__)
-  SystemInformation::LongLong memUsed=0;
-  pid_t pid=getpid();
-  kwsys_ios::ostringstream oss;
-  oss << "ps -o rss= -p " << pid;
-  FILE *file=popen(oss.str().c_str(),"r");
-  if (file==0)
-    {
-    return -1;
-    }
-  oss.str("");
-  while (!feof(file) && !ferror(file))
-    {
-    char buf[256]={'\0'};
-    errno=0;
-    size_t nRead=fread(buf,1,256,file);
-    if (ferror(file) && (errno==EINTR))
-      {
-      clearerr(file);
-      }
-    if (nRead) oss << buf;
-    }
-  int ierr=ferror(file);
-  pclose(file);
-  if (ierr)
-    {
-    return -2;
-    }
-  kwsys_ios::istringstream iss(oss.str());
-  iss >> memUsed;
-  return memUsed;
-#else
-  return 0;
-#endif
-}
-
-/**
-Get the process id of the running process.
-*/
-SystemInformation::LongLong
-SystemInformationImplementation::GetProcessId()
-{
-#if defined(_WIN32)
-  return GetCurrentProcessId();
-#elif defined(__linux) || defined(__APPLE__)
-  return getpid();
-#else
-  return -1;
-#endif
-}
-
-/**
-return current program stack in a string
-demangle cxx symbols if possible.
-*/
-kwsys_stl::string SystemInformationImplementation::GetProgramStack(
-      int firstFrame,
-      int wholePath)
-{
-  kwsys_stl::string programStack = ""
-#if !defined(KWSYS_SYSTEMINFORMATION_HAS_BACKTRACE)
-    "WARNING: The stack could not be examined "
-    "because backtrace is not supported.\n"
-#elif !defined(KWSYS_SYSTEMINFORMATION_HAS_DEBUG_BUILD)
-    "WARNING: The stack trace will not use advanced "
-    "capabilities because this is a release build.\n"
-#else
-# if !defined(KWSYS_SYSTEMINFORMATION_HAS_SYMBOL_LOOKUP)
-    "WARNING: Function names will not be demangled because "
-    "dladdr is not available.\n"
-# endif
-# if !defined(KWSYS_SYSTEMINFORMATION_HAS_CPP_DEMANGLE)
-    "WARNING: Function names will not be demangled "
-    "because cxxabi is not available.\n"
-# endif
-#endif
-    ;
-
-  kwsys_ios::ostringstream oss;
-#if defined(KWSYS_SYSTEMINFORMATION_HAS_BACKTRACE)
-  void *stackSymbols[256];
-  int nFrames=backtrace(stackSymbols,256);
-  for (int i=firstFrame; i<nFrames; ++i)
-    {
-    SymbolProperties symProps;
-    symProps.SetReportPath(wholePath);
-    symProps.Initialize(stackSymbols[i]);
-    oss << symProps << kwsys_ios::endl;
-    }
-#else
-  (void)firstFrame;
-  (void)wholePath;
-#endif
-  programStack += oss.str();
-
-  return programStack;
-}
-
-
-/**
-when set print stack trace in response to common signals.
-*/
-void SystemInformationImplementation::SetStackTraceOnError(int enable)
-{
-#if !defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
-  static int saOrigValid=0;
-  static struct sigaction saABRTOrig;
-  static struct sigaction saSEGVOrig;
-  static struct sigaction saTERMOrig;
-  static struct sigaction saINTOrig;
-  static struct sigaction saILLOrig;
-  static struct sigaction saBUSOrig;
-  static struct sigaction saFPEOrig;
-
-
-  if (enable && !saOrigValid)
-    {
-    // save the current actions
-    sigaction(SIGABRT,0,&saABRTOrig);
-    sigaction(SIGSEGV,0,&saSEGVOrig);
-    sigaction(SIGTERM,0,&saTERMOrig);
-    sigaction(SIGINT,0,&saINTOrig);
-    sigaction(SIGILL,0,&saILLOrig);
-    sigaction(SIGBUS,0,&saBUSOrig);
-    sigaction(SIGFPE,0,&saFPEOrig);
-
-    // enable read, disable write
-    saOrigValid=1;
-
-    // install ours
-    struct sigaction sa;
-    sa.sa_sigaction=(SigAction)StacktraceSignalHandler;
-    sa.sa_flags=SA_SIGINFO|SA_RESETHAND;
-# ifdef SA_RESTART
-    sa.sa_flags|=SA_RESTART;
-# endif
-    sigemptyset(&sa.sa_mask);
-
-    sigaction(SIGABRT,&sa,0);
-    sigaction(SIGSEGV,&sa,0);
-    sigaction(SIGTERM,&sa,0);
-    sigaction(SIGINT,&sa,0);
-    sigaction(SIGILL,&sa,0);
-    sigaction(SIGBUS,&sa,0);
-    sigaction(SIGFPE,&sa,0);
-    }
-  else
-  if (!enable && saOrigValid)
-    {
-    // restore previous actions
-    sigaction(SIGABRT,&saABRTOrig,0);
-    sigaction(SIGSEGV,&saSEGVOrig,0);
-    sigaction(SIGTERM,&saTERMOrig,0);
-    sigaction(SIGINT,&saINTOrig,0);
-    sigaction(SIGILL,&saILLOrig,0);
-    sigaction(SIGBUS,&saBUSOrig,0);
-    sigaction(SIGFPE,&saFPEOrig,0);
-
-    // enable write, disable read
-    saOrigValid=0;
-    }
-#else
-  // avoid warning C4100
-  (void)enable;
-#endif
-}
-
-bool SystemInformationImplementation::QueryWindowsMemory()
-{
-#if defined(_WIN32)
-# if defined(_MSC_VER) && _MSC_VER < 1300
-  MEMORYSTATUS ms;
-  unsigned long tv, tp, av, ap;
-  ms.dwLength = sizeof(ms);
-  GlobalMemoryStatus(&ms);
-#  define MEM_VAL(value) dw##value
-# else
-  MEMORYSTATUSEX ms;
-  DWORDLONG tv, tp, av, ap;
-  ms.dwLength = sizeof(ms);
-  if (0 == GlobalMemoryStatusEx(&ms))
-  {
-    return 0;
-  }
-#  define MEM_VAL(value) ull##value
-# endif
-  tv = ms.MEM_VAL(TotalVirtual);
-  tp = ms.MEM_VAL(TotalPhys);
-  av = ms.MEM_VAL(AvailVirtual);
-  ap = ms.MEM_VAL(AvailPhys);
-  this->TotalVirtualMemory = tv>>10>>10;
-  this->TotalPhysicalMemory = tp>>10>>10;
-  this->AvailableVirtualMemory = av>>10>>10;
-  this->AvailablePhysicalMemory = ap>>10>>10;
-  return true;
-#else
-  return false;
-#endif
-}
-
-bool SystemInformationImplementation::QueryLinuxMemory()
-{
-#if defined(__linux)
-  unsigned long tv=0;
-  unsigned long tp=0;
-  unsigned long av=0;
-  unsigned long ap=0;
-
-  char buffer[1024]; // for reading lines
-
-  int linuxMajor = 0;
-  int linuxMinor = 0;
-
-  // Find the Linux kernel version first
-  struct utsname unameInfo;
-  int errorFlag = uname(&unameInfo);
-  if( errorFlag!=0 )
-    {
-    kwsys_ios::cout << "Problem calling uname(): " << strerror(errno) << kwsys_ios::endl;
-    return false;
-    }
-
-  if( strlen(unameInfo.release)>=3 )
-    {
-    // release looks like "2.6.3-15mdk-i686-up-4GB"
-    char majorChar=unameInfo.release[0];
-    char minorChar=unameInfo.release[2];
-
-    if( isdigit(majorChar) )
-      {
-      linuxMajor=majorChar-'0';
-      }
-
-    if( isdigit(minorChar) )
-      {
-      linuxMinor=minorChar-'0';
-      }
-    }
-
-  FILE *fd = fopen("/proc/meminfo", "r" );
-  if ( !fd )
-    {
-    kwsys_ios::cout << "Problem opening /proc/meminfo" << kwsys_ios::endl;
-    return false;
-    }
-
-  if( linuxMajor>=3 || ( (linuxMajor>=2) && (linuxMinor>=6) ) )
-    {
-    // new /proc/meminfo format since kernel 2.6.x
-    // Rigorously, this test should check from the developping version 2.5.x
-    // that introduced the new format...
-
-    enum { mMemTotal, mMemFree, mBuffers, mCached, mSwapTotal, mSwapFree };
-    const char* format[6] =
-      { "MemTotal:%lu kB", "MemFree:%lu kB", "Buffers:%lu kB",
-        "Cached:%lu kB", "SwapTotal:%lu kB", "SwapFree:%lu kB" };
-    bool have[6] = { false, false, false, false, false, false };
-    unsigned long value[6];
-    int count = 0;
-    while(fgets(buffer, static_cast<int>(sizeof(buffer)), fd))
-      {
-      for(int i=0; i < 6; ++i)
-        {
-        if(!have[i] && sscanf(buffer, format[i], &value[i]) == 1)
-          {
-          have[i] = true;
-          ++count;
-          }
-        }
-      }
-    if(count == 6)
-      {
-      this->TotalPhysicalMemory = value[mMemTotal] / 1024;
-      this->AvailablePhysicalMemory =
-        (value[mMemFree] + value[mBuffers] + value[mCached]) / 1024;
-      this->TotalVirtualMemory = value[mSwapTotal] / 1024;
-      this->AvailableVirtualMemory = value[mSwapFree] / 1024;
-      }
-    else
-      {
-      kwsys_ios::cout << "Problem parsing /proc/meminfo" << kwsys_ios::endl;
-      fclose(fd);
-      return false;
-      }
-    }
-  else
-    {
-    // /proc/meminfo format for kernel older than 2.6.x
-
-    unsigned long temp;
-    unsigned long cachedMem;
-    unsigned long buffersMem;
-    // Skip "total: used:..."
-    char *r=fgets(buffer, static_cast<int>(sizeof(buffer)), fd);
-    int status=0;
-    if(r==buffer)
-      {
-      status+=fscanf(fd, "Mem: %lu %lu %lu %lu %lu %lu\n",
-                     &tp, &temp, &ap, &temp, &buffersMem, &cachedMem);
-      }
-    if(status==6)
-      {
-      status+=fscanf(fd, "Swap: %lu %lu %lu\n", &tv, &temp, &av);
-      }
-    if(status==9)
-      {
-      this->TotalVirtualMemory = tv>>10>>10;
-      this->TotalPhysicalMemory = tp>>10>>10;
-      this->AvailableVirtualMemory = av>>10>>10;
-      this->AvailablePhysicalMemory = (ap+buffersMem+cachedMem)>>10>>10;
-      }
-    else
-      {
-      kwsys_ios::cout << "Problem parsing /proc/meminfo" << kwsys_ios::endl;
-      fclose(fd);
-      return false;
-      }
-    }
-  fclose( fd );
-
-  return true;
-#else
-  return false;
-#endif
-}
-
-bool SystemInformationImplementation::QueryCygwinMemory()
-{
-#ifdef __CYGWIN__
-  // _SC_PAGE_SIZE does return the mmap() granularity on Cygwin,
-  // see http://cygwin.com/ml/cygwin/2006-06/msg00350.html
-  // Therefore just use 4096 as the page size of Windows.
-  long m = sysconf(_SC_PHYS_PAGES);
-  if (m < 0)
-    {
-    return false;
-    }
-  this->TotalPhysicalMemory = m >> 8;
-  return true;
-#else
-  return false;
-#endif
-}
-
-bool SystemInformationImplementation::QueryAIXMemory()
-{
-#if defined(_AIX) && defined(_SC_AIX_REALMEM)
-  long c = sysconf(_SC_AIX_REALMEM);
-  if (c <= 0)
-    {
-    return false;
-    }
-
-  this->TotalPhysicalMemory = c / 1024;
-
-  return true;
-#else
-  return false;
-#endif
-}
-
-bool SystemInformationImplementation::QueryMemoryBySysconf()
-{
-#if defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE)
-  // Assume the mmap() granularity as returned by _SC_PAGESIZE is also
-  // the system page size. The only known system where this isn't true
-  // is Cygwin.
-  long p = sysconf(_SC_PHYS_PAGES);
-  long m = sysconf(_SC_PAGESIZE);
-
-  if (p < 0 || m < 0)
-    {
-    return false;
-    }
-
-  // assume pagesize is a power of 2 and smaller 1 MiB
-  size_t pagediv = (1024 * 1024 / m);
-
-  this->TotalPhysicalMemory = p;
-  this->TotalPhysicalMemory /= pagediv;
-
-#if defined(_SC_AVPHYS_PAGES)
-  p = sysconf(_SC_AVPHYS_PAGES);
-  if (p < 0)
-    {
-    return false;
-    }
-
-  this->AvailablePhysicalMemory = p;
-  this->AvailablePhysicalMemory /= pagediv;
-#endif
-
-  return true;
-#else
-  return false;
-#endif
-}
-
-/** Query for the memory status */
-bool SystemInformationImplementation::QueryMemory()
-{
-  return this->QueryMemoryBySysconf();
-}
-
-/** */
-size_t SystemInformationImplementation::GetTotalVirtualMemory()
-{
-  return this->TotalVirtualMemory;
-}
-
-/** */
-size_t SystemInformationImplementation::GetAvailableVirtualMemory()
-{
-  return this->AvailableVirtualMemory;
-}
-
-size_t SystemInformationImplementation::GetTotalPhysicalMemory()
-{
-  return this->TotalPhysicalMemory;
-}
-
-/** */
-size_t SystemInformationImplementation::GetAvailablePhysicalMemory()
-{
-  return this->AvailablePhysicalMemory;
-}
-
-/** Get Cycle differences */
-SystemInformation::LongLong
-SystemInformationImplementation::GetCyclesDifference (DELAY_FUNC DelayFunction,
-                                                  unsigned int uiParameter)
-{
-#if defined(_MSC_VER) && (_MSC_VER >= 1400)
-  unsigned __int64 stamp1, stamp2;
-
-  stamp1 = __rdtsc();
-  DelayFunction(uiParameter);
-  stamp2 = __rdtsc();
-
-  return stamp2 - stamp1;
-#elif USE_ASM_INSTRUCTIONS
-
-  unsigned int edx1, eax1;
-  unsigned int edx2, eax2;
-
-  // Calculate the frequency of the CPU instructions.
-  __try {
-    _asm {
-      push uiParameter ; push parameter param
-      mov ebx, DelayFunction ; store func in ebx
-
-      RDTSC_INSTRUCTION
-
-      mov esi, eax ; esi = eax
-      mov edi, edx ; edi = edx
-
-      call ebx ; call the delay functions
-
-      RDTSC_INSTRUCTION
-
-      pop ebx
-
-      mov edx2, edx      ; edx2 = edx
-      mov eax2, eax      ; eax2 = eax
-
-      mov edx1, edi      ; edx2 = edi
-      mov eax1, esi      ; eax2 = esi
-    }
-  }
-  __except(1)
-    {
-    return -1;
-    }
-
-  return ((((__int64) edx2 << 32) + eax2) - (((__int64) edx1 << 32) + eax1));
-
-#else
-  (void)DelayFunction;
-  (void)uiParameter;
-  return -1;
-#endif
-}
-
-
-/** Compute the delay overhead */
-void SystemInformationImplementation::DelayOverhead(unsigned int uiMS)
-{
-#if defined(_WIN32)
-  LARGE_INTEGER Frequency, StartCounter, EndCounter;
-  __int64 x;
-
-  // Get the frequency of the high performance counter.
-  if(!QueryPerformanceFrequency (&Frequency))
-    {
-    return;
-    }
-  x = Frequency.QuadPart / 1000 * uiMS;
-
-  // Get the starting position of the counter.
-  QueryPerformanceCounter (&StartCounter);
-
-  do {
-    // Get the ending position of the counter.
-    QueryPerformanceCounter (&EndCounter);
-  } while (EndCounter.QuadPart - StartCounter.QuadPart == x);
-#endif
-  (void)uiMS;
-}
-
-/** Return the number of logical CPU per physical CPUs Works only for windows */
-unsigned char SystemInformationImplementation::LogicalCPUPerPhysicalCPU(void)
-{
-#ifdef __APPLE__
-  size_t len = 4;
-  int cores_per_package = 0;
-  int err = sysctlbyname("machdep.cpu.cores_per_package", &cores_per_package, &len, NULL, 0);
-  if (err != 0)
-    {
-      return 1; // That name was not found, default to 1
-    }
-  return static_cast<unsigned char>(cores_per_package);
-#else
-  int Regs[4] = { 0, 0, 0, 0 };
-#if USE_CPUID
-  if (!this->IsHyperThreadingSupported())
-    {
-    return static_cast<unsigned char>(1);  // HT not supported
-    }
-  call_cpuid(1, Regs);
-#endif
-  return static_cast<unsigned char> ((Regs[1] & NUM_LOGICAL_BITS) >> 16);
-#endif
-}
-
-
-/** Works only for windows */
-bool SystemInformationImplementation::IsHyperThreadingSupported()
-{
-  if (this->Features.ExtendedFeatures.SupportsHyperthreading)
-    {
-    return true;
-    }
-
-#if USE_CPUID
-  int Regs[4] = { 0, 0, 0, 0 },
-             VendorId[4] = { 0, 0, 0, 0 };
-  // Get vendor id string
-  if (!call_cpuid(0, VendorId))
-    {
-    return false;
-    }
-  // eax contains family processor type
-  // edx has info about the availability of hyper-Threading
-  if (!call_cpuid(1, Regs))
-    {
-    return false;
-    }
-
-  if (((Regs[0] & FAMILY_ID) == PENTIUM4_ID) || (Regs[0] & EXT_FAMILY_ID))
-    {
-    if (VendorId[1] == 0x756e6547) // 'uneG'
-      {
-      if (VendorId[3] == 0x49656e69) // 'Ieni'
-        {
-        if (VendorId[2] == 0x6c65746e) // 'letn'
-          {
-          // Genuine Intel with hyper-Threading technology
-          this->Features.ExtendedFeatures.SupportsHyperthreading = ((Regs[3] & HT_BIT) != 0);
-          return this->Features.ExtendedFeatures.SupportsHyperthreading;
-          }
-        }
-      }
-    }
-#endif
-
-  return 0;    // Not genuine Intel processor
-}
-
-
-/** Return the APIC Id. Works only for windows. */
-unsigned char SystemInformationImplementation::GetAPICId()
-{
-  int Regs[4] = { 0, 0, 0, 0 };
-
-#if USE_CPUID
-  if (!this->IsHyperThreadingSupported())
-    {
-    return static_cast<unsigned char>(-1);  // HT not supported
-    } // Logical processor = 1
-  call_cpuid(1, Regs);
-#endif
-
-  return static_cast<unsigned char>((Regs[1] & INITIAL_APIC_ID_BITS) >> 24);
-}
-
-
-/** Count the number of CPUs. Works only on windows. */
-int SystemInformationImplementation::CPUCount()
-{
-#if defined(_WIN32)
-  unsigned char StatusFlag  = 0;
-  SYSTEM_INFO info;
-
-  this->NumberOfPhysicalCPU = 0;
-  this->NumberOfLogicalCPU = 0;
-  info.dwNumberOfProcessors = 0;
-  GetSystemInfo (&info);
-
-  // Number of physical processors in a non-Intel system
-  // or in a 32-bit Intel system with Hyper-Threading technology disabled
-  this->NumberOfPhysicalCPU = (unsigned char) info.dwNumberOfProcessors;
-
-  if (this->IsHyperThreadingSupported())
-    {
-    unsigned char HT_Enabled = 0;
-    this->NumberOfLogicalCPU = this->LogicalCPUPerPhysicalCPU();
-    if (this->NumberOfLogicalCPU >= 1)    // >1 Doesn't mean HT is enabled in the BIOS
-      {
-      HANDLE hCurrentProcessHandle;
-#ifndef _WIN64
-# define DWORD_PTR DWORD
-#endif
-      DWORD_PTR  dwProcessAffinity;
-      DWORD_PTR  dwSystemAffinity;
-      DWORD  dwAffinityMask;
-
-      // Calculate the appropriate  shifts and mask based on the
-      // number of logical processors.
-      unsigned int i = 1;
-      unsigned char PHY_ID_MASK  = 0xFF;
-      //unsigned char PHY_ID_SHIFT = 0;
-
-      while (i < this->NumberOfLogicalCPU)
-        {
-        i *= 2;
-         PHY_ID_MASK  <<= 1;
-         // PHY_ID_SHIFT++;
-        }
-
-      hCurrentProcessHandle = GetCurrentProcess();
-      GetProcessAffinityMask(hCurrentProcessHandle, &dwProcessAffinity,
-                                                  &dwSystemAffinity);
-
-      // Check if available process affinity mask is equal to the
-      // available system affinity mask
-      if (dwProcessAffinity != dwSystemAffinity)
-        {
-        StatusFlag = HT_CANNOT_DETECT;
-        this->NumberOfPhysicalCPU = (unsigned char)-1;
-        return StatusFlag;
-        }
-
-      dwAffinityMask = 1;
-      while (dwAffinityMask != 0 && dwAffinityMask <= dwProcessAffinity)
-        {
-        // Check if this CPU is available
-        if (dwAffinityMask & dwProcessAffinity)
-          {
-          if (SetProcessAffinityMask(hCurrentProcessHandle,
-                                     dwAffinityMask))
-            {
-            unsigned char APIC_ID, LOG_ID;
-            Sleep(0); // Give OS time to switch CPU
-
-            APIC_ID = GetAPICId();
-            LOG_ID  = APIC_ID & ~PHY_ID_MASK;
-
-            if (LOG_ID != 0)
-              {
-              HT_Enabled = 1;
-              }
-            }
-          }
-        dwAffinityMask = dwAffinityMask << 1;
-        }
-      // Reset the processor affinity
-      SetProcessAffinityMask(hCurrentProcessHandle, dwProcessAffinity);
-
-      if (this->NumberOfLogicalCPU == 1)  // Normal P4 : HT is disabled in hardware
-        {
-        StatusFlag = HT_DISABLED;
-        }
-      else
-        {
-        if (HT_Enabled)
-          {
-          // Total physical processors in a Hyper-Threading enabled system.
-          this->NumberOfPhysicalCPU /= (this->NumberOfLogicalCPU);
-          StatusFlag = HT_ENABLED;
-          }
-        else
-          {
-          StatusFlag = HT_SUPPORTED_NOT_ENABLED;
-          }
-        }
-      }
-    }
-  else
-    {
-    // Processors do not have Hyper-Threading technology
-    StatusFlag = HT_NOT_CAPABLE;
-    this->NumberOfLogicalCPU = 1;
-    }
-  return StatusFlag;
-#else
-  return 0;
-#endif
-}
-
-
-/** Return the number of logical CPUs on the system */
-unsigned int SystemInformationImplementation::GetNumberOfLogicalCPU()
-{
-  return this->NumberOfLogicalCPU;
-}
-
-
-/** Return the number of physical CPUs on the system */
-unsigned int SystemInformationImplementation::GetNumberOfPhysicalCPU()
-{
-  return this->NumberOfPhysicalCPU;
-}
-
-
-/** For Mac use sysctlbyname calls to find system info */
-bool SystemInformationImplementation::ParseSysCtl()
-{
-#if defined(__APPLE__)
-  char retBuf[128];
-  int err = 0;
-  uint64_t value = 0;
-  size_t len = sizeof(value);
-  sysctlbyname("hw.memsize", &value, &len, NULL, 0);
-  this->TotalPhysicalMemory = static_cast< size_t >( value/1048576 );
-
-  // Parse values for Mac
-  this->AvailablePhysicalMemory = 0;
-  vm_statistics_data_t  vmstat;
-  mach_msg_type_number_t count = HOST_VM_INFO_COUNT;
-  if ( host_statistics(mach_host_self(), HOST_VM_INFO,
-                       (host_info_t) &vmstat, &count) == KERN_SUCCESS )
-    {
-    len = sizeof(value);
-    err = sysctlbyname("hw.pagesize", &value, &len, NULL, 0);
-    int64_t available_memory = vmstat.free_count * value;
-    this->AvailablePhysicalMemory = static_cast< size_t >( available_memory / 1048576 );
-    }
-
-#ifdef VM_SWAPUSAGE
-  // Virtual memory.
-  int mib[2] = { CTL_VM, VM_SWAPUSAGE };
-  size_t miblen = sizeof(mib) / sizeof(mib[0]);
-  struct xsw_usage swap;
-  len = sizeof(swap);
-  err = sysctl(mib, miblen, &swap, &len, NULL, 0);
-  if (err == 0)
-    {
-    this->AvailableVirtualMemory = static_cast< size_t >( swap.xsu_avail/1048576 );
-    this->TotalVirtualMemory = static_cast< size_t >( swap.xsu_total/1048576 );
-    }
-#else
-   this->AvailableVirtualMemory = 0;
-   this->TotalVirtualMemory = 0;
-#endif
-
-// CPU Info
-  len = sizeof(this->NumberOfPhysicalCPU);
-  sysctlbyname("hw.physicalcpu", &this->NumberOfPhysicalCPU, &len, NULL, 0);
-  len = sizeof(this->NumberOfLogicalCPU);
-  sysctlbyname("hw.logicalcpu", &this->NumberOfLogicalCPU, &len, NULL, 0);
-  this->Features.ExtendedFeatures.LogicalProcessorsPerPhysical =
-    this->LogicalCPUPerPhysicalCPU();
-
-  len = sizeof(value);
-  sysctlbyname("hw.cpufrequency", &value, &len, NULL, 0);
-  this->CPUSpeedInMHz = static_cast< float >( value )/ 1000000;
-
-
-  // Chip family
-  len = sizeof(this->ChipID.Family);
-  //Seems only the intel chips will have this name so if this fails it is
-  //probably a PPC machine
-  err = sysctlbyname("machdep.cpu.family",
-                     &this->ChipID.Family, &len, NULL, 0);
-  if (err != 0) // Go back to names we know but are less descriptive
-    {
-    this->ChipID.Family = 0;
-    ::memset(retBuf, 0, 128);
-    len = 32;
-    err = sysctlbyname("hw.machine", &retBuf, &len, NULL, 0);
-    kwsys_stl::string machineBuf(retBuf);
-    if (machineBuf.find_first_of("Power") != kwsys_stl::string::npos)
-      {
-      this->ChipID.Vendor = "IBM";
-      len = sizeof(this->ChipID.Family);
-      err = sysctlbyname("hw.cputype", &this->ChipID.Family, &len, NULL, 0);
-      len = sizeof(this->ChipID.Model);
-      err = sysctlbyname("hw.cpusubtype", &this->ChipID.Model, &len, NULL, 0);
-      this->FindManufacturer();
-      }
-    }
-  else  // Should be an Intel Chip.
-    {
-    len = sizeof(this->ChipID.Family);
-    err =
-      sysctlbyname("machdep.cpu.family", &this->ChipID.Family, &len, NULL, 0);
-
-    ::memset(retBuf, 0, 128);
-    len = 128;
-    err = sysctlbyname("machdep.cpu.vendor", retBuf, &len, NULL, 0);
-    // Chip Vendor
-    this->ChipID.Vendor = retBuf;
-    this->FindManufacturer();
-
-    // Chip Model
-    len = sizeof(value);
-    err = sysctlbyname("machdep.cpu.model", &value, &len, NULL, 0);
-    this->ChipID.Model = static_cast< int >( value );
-
-    // Chip Stepping
-    len = sizeof(value);
-    value = 0;
-    err = sysctlbyname("machdep.cpu.stepping", &value, &len, NULL, 0);
-    if (!err)
-      {
-      this->ChipID.Revision = static_cast< int >( value );
-      }
-
-    // feature string
-    char *buf = 0;
-    size_t allocSize = 128;
-
-    err = 0;
-    len = 0;
-
-    // sysctlbyname() will return with err==0 && len==0 if the buffer is too small
-    while (err == 0 && len == 0)
-      {
-      delete[] buf;
-      allocSize *= 2;
-      buf = new char[allocSize];
-      if (!buf)
-        {
-        break;
-        }
-      buf[0] = ' ';
-      len = allocSize - 2; // keep space for leading and trailing space
-      err = sysctlbyname("machdep.cpu.features", buf + 1, &len, NULL, 0);
-      }
-    if (!err && buf && len)
-      {
-      // now we can match every flags as space + flag + space
-      buf[len + 1] = ' ';
-      kwsys_stl::string cpuflags(buf, len + 2);
-
-      if ((cpuflags.find(" FPU ")!=kwsys_stl::string::npos))
-        {
-        this->Features.HasFPU = true;
-        }
-      if ((cpuflags.find(" TSC ")!=kwsys_stl::string::npos))
-        {
-        this->Features.HasTSC = true;
-        }
-      if ((cpuflags.find(" MMX ")!=kwsys_stl::string::npos))
-        {
-        this->Features.HasMMX = true;
-        }
-      if ((cpuflags.find(" SSE ")!=kwsys_stl::string::npos))
-        {
-        this->Features.HasSSE = true;
-        }
-      if ((cpuflags.find(" SSE2 ")!=kwsys_stl::string::npos))
-        {
-        this->Features.HasSSE2 = true;
-        }
-      if ((cpuflags.find(" APIC ")!=kwsys_stl::string::npos))
-        {
-        this->Features.HasAPIC = true;
-        }
-      if ((cpuflags.find(" CMOV ")!=kwsys_stl::string::npos))
-        {
-        this->Features.HasCMOV = true;
-        }
-      if ((cpuflags.find(" MTRR ")!=kwsys_stl::string::npos))
-        {
-        this->Features.HasMTRR = true;
-        }
-      if ((cpuflags.find(" ACPI ")!=kwsys_stl::string::npos))
-        {
-        this->Features.HasACPI = true;
-        }
-      }
-    delete[] buf;
-    }
-
-  // brand string
-  ::memset(retBuf, 0, sizeof(retBuf));
-  len = sizeof(retBuf);
-  err = sysctlbyname("machdep.cpu.brand_string", retBuf, &len, NULL, 0);
-  if (!err)
-    {
-    this->ChipID.ProcessorName = retBuf;
-    this->ChipID.ModelName = retBuf;
-    }
-
-  // Cache size
-  len = sizeof(value);
-  err = sysctlbyname("hw.l1icachesize", &value, &len, NULL, 0);
-  this->Features.L1CacheSize = static_cast< int >( value );
-  len = sizeof(value);
-  err = sysctlbyname("hw.l2cachesize", &value, &len, NULL, 0);
-  this->Features.L2CacheSize = static_cast< int >( value );
-
-  return true;
-#else
-  return false;
-#endif
-}
-
-
-/** Extract a value from sysctl command */
-kwsys_stl::string SystemInformationImplementation::ExtractValueFromSysCtl(const char* word)
-{
-  size_t pos = this->SysCtlBuffer.find(word);
-  if(pos != this->SysCtlBuffer.npos)
-    {
-    pos = this->SysCtlBuffer.find(": ",pos);
-    size_t pos2 = this->SysCtlBuffer.find("\n",pos);
-    if(pos!=this->SysCtlBuffer.npos && pos2!=this->SysCtlBuffer.npos)
-      {
-      return this->SysCtlBuffer.substr(pos+2,pos2-pos-2);
-      }
-    }
-  return "";
-}
-
-
-/** Run a given process */
-kwsys_stl::string SystemInformationImplementation::RunProcess(kwsys_stl::vector<const char*> args)
-{
-  kwsys_stl::string buffer = "";
-
-  // Run the application
-  kwsysProcess* gp = kwsysProcess_New();
-  kwsysProcess_SetCommand(gp, &*args.begin());
-  kwsysProcess_SetOption(gp,kwsysProcess_Option_HideWindow,1);
-
-  kwsysProcess_Execute(gp);
-
-  char* data = NULL;
-  int length;
-  double timeout = 255;
-  int pipe; // pipe id as returned by kwsysProcess_WaitForData()
-
-  while( ( pipe = kwsysProcess_WaitForData(gp,&data,&length,&timeout),
-           (pipe == kwsysProcess_Pipe_STDOUT || pipe == kwsysProcess_Pipe_STDERR) ) ) // wait for 1s
-    {
-      buffer.append(data, length);
-    }
-  kwsysProcess_WaitForExit(gp, 0);
-
-  int result = 0;
-  switch(kwsysProcess_GetState(gp))
-    {
-    case kwsysProcess_State_Exited:
-      {
-      result = kwsysProcess_GetExitValue(gp);
-      } break;
-    case kwsysProcess_State_Error:
-      {
-      kwsys_ios::cerr << "Error: Could not run " << args[0] << ":\n";
-      kwsys_ios::cerr << kwsysProcess_GetErrorString(gp) << "\n";
-      } break;
-    case kwsysProcess_State_Exception:
-      {
-      kwsys_ios::cerr << "Error: " << args[0]
-                << " terminated with an exception: "
-                << kwsysProcess_GetExceptionString(gp) << "\n";
-      } break;
-    case kwsysProcess_State_Starting:
-    case kwsysProcess_State_Executing:
-    case kwsysProcess_State_Expired:
-    case kwsysProcess_State_Killed:
-      {
-      // Should not get here.
-      kwsys_ios::cerr << "Unexpected ending state after running " << args[0]
-                << kwsys_ios::endl;
-      } break;
-    }
-  kwsysProcess_Delete(gp);
-  if(result)
-    {
-    kwsys_ios::cerr << "Error " << args[0] << " returned :" << result << "\n";
-    }
-  return buffer;
-}
-
-
-kwsys_stl::string SystemInformationImplementation::ParseValueFromKStat(const char* arguments)
-{
-  kwsys_stl::vector<const char*> args;
-  args.clear();
-  args.push_back("kstat");
-  args.push_back("-p");
-
-  kwsys_stl::string command = arguments;
-  size_t start = command.npos;
-  size_t pos = command.find(' ',0);
-  while(pos!=command.npos)
-    {
-    bool inQuotes = false;
-    // Check if we are between quotes
-    size_t b0 = command.find('"',0);
-    size_t b1 = command.find('"',b0+1);
-    while(b0 != command.npos && b1 != command.npos && b1>b0)
-      {
-      if(pos>b0 && pos<b1)
-        {
-        inQuotes = true;
-        break;
-        }
-      b0 = command.find('"',b1+1);
-      b1 = command.find('"',b0+1);
-      }
-
-    if(!inQuotes)
-      {
-      kwsys_stl::string arg = command.substr(start+1,pos-start-1);
-
-      // Remove the quotes if any
-      size_t quotes = arg.find('"');
-      while(quotes != arg.npos)
-        {
-        arg.erase(quotes,1);
-        quotes = arg.find('"');
-        }
-      args.push_back(arg.c_str());
-      start = pos;
-      }
-    pos = command.find(' ',pos+1);
-    }
-  kwsys_stl::string lastArg = command.substr(start+1,command.size()-start-1);
-  args.push_back(lastArg.c_str());
-
-  args.push_back(0);
-
-  kwsys_stl::string buffer = this->RunProcess(args);
-
-  kwsys_stl::string value = "";
-  for(size_t i=buffer.size()-1;i>0;i--)
-    {
-    if(buffer[i] == ' ' || buffer[i] == '\t')
-      {
-      break;
-      }
-    if(buffer[i] != '\n' && buffer[i] != '\r')
-      {
-      kwsys_stl::string val = value;
-      value = buffer[i];
-      value += val;
-      }
-    }
-  return value;
-}
-
-/** Querying for system information from Solaris */
-bool SystemInformationImplementation::QuerySolarisMemory()
-{
-#if defined (__SVR4) && defined (__sun)
-  // Solaris allows querying this value by sysconf, but if this is
-  // a 32 bit process on a 64 bit host the returned memory will be
-  // limited to 4GiB. So if this is a 32 bit process or if the sysconf
-  // method fails use the kstat interface.
-#if SIZEOF_VOID_P == 8
-  if (this->QueryMemoryBySysconf())
-    {
-    return true;
-    }
-#endif
-
-  char* tail;
-  unsigned long totalMemory =
-       strtoul(this->ParseValueFromKStat("-s physmem").c_str(),&tail,0);
-  this->TotalPhysicalMemory = totalMemory/128;
-
-  return true;
-#else
-  return false;
-#endif
-}
-
-bool SystemInformationImplementation::QuerySolarisProcessor()
-{
-  if (!this->QueryProcessorBySysconf())
-    {
-    return false;
-    }
-
-  // Parse values
-  this->CPUSpeedInMHz = static_cast<float>(atoi(this->ParseValueFromKStat("-s clock_MHz").c_str()));
-
-  // Chip family
-  this->ChipID.Family = 0;
-
-  // Chip Model
-  this->ChipID.ProcessorName = this->ParseValueFromKStat("-s cpu_type");
-  this->ChipID.Model = 0;
-
-  // Chip Vendor
-  if (this->ChipID.ProcessorName != "i386")
-    {
-    this->ChipID.Vendor = "Sun";
-    this->FindManufacturer();
-    }
-
-  return true;
-}
-
-
-/** Querying for system information from Haiku OS */
-bool SystemInformationImplementation::QueryHaikuInfo()
-{
-#if defined(__HAIKU__)
-
-  // CPU count
-  system_info info;
-  get_system_info(&info);
-  this->NumberOfPhysicalCPU = info.cpu_count;
-
-  // CPU speed
-  uint32 topologyNodeCount = 0;
-  cpu_topology_node_info* topology = 0;
-  get_cpu_topology_info(0, &topologyNodeCount);
-  if (topologyNodeCount != 0)
-    topology = new cpu_topology_node_info[topologyNodeCount];
-  get_cpu_topology_info(topology, &topologyNodeCount);
-
-  for (uint32 i = 0; i < topologyNodeCount; i++) {
-    if (topology[i].type == B_TOPOLOGY_CORE) {
-      this->CPUSpeedInMHz = topology[i].data.core.default_frequency /
-        1000000.0f;
-      break;
-    }
-  }
-
-  delete[] topology;
-
-  // Physical Memory
-  this->TotalPhysicalMemory = (info.max_pages * B_PAGE_SIZE) / (1024 * 1024) ;
-  this->AvailablePhysicalMemory = this->TotalPhysicalMemory -
-    ((info.used_pages * B_PAGE_SIZE) / (1024 * 1024));
-
-
-  // NOTE: get_system_info_etc is currently a private call so just set to 0
-  // until it becomes public
-  this->TotalVirtualMemory = 0;
-  this->AvailableVirtualMemory = 0;
-
-  // Retrieve cpuid_info union for cpu 0
-  cpuid_info cpu_info;
-  get_cpuid(&cpu_info, 0, 0);
-
-  // Chip Vendor
-  // Use a temporary buffer so that we can add NULL termination to the string
-  char vbuf[13];
-  strncpy(vbuf, cpu_info.eax_0.vendor_id, 12);
-  vbuf[12] = '\0';
-  this->ChipID.Vendor = vbuf;
-
-  this->FindManufacturer();
-
-  // Retrieve cpuid_info union for cpu 0 this time using a register value of 1
-  get_cpuid(&cpu_info, 1, 0);
-
-  this->NumberOfLogicalCPU = cpu_info.eax_1.logical_cpus;
-
-  // Chip type
-  this->ChipID.Type = cpu_info.eax_1.type;
-
-  // Chip family
-  this->ChipID.Family = cpu_info.eax_1.family;
-
-  // Chip Model
-  this->ChipID.Model = cpu_info.eax_1.model;
-
-  // Chip Revision
-  this->ChipID.Revision = cpu_info.eax_1.stepping;
-
-  // Chip Extended Family
-  this->ChipID.ExtendedFamily = cpu_info.eax_1.extended_family;
-
-  // Chip Extended Model
-  this->ChipID.ExtendedModel = cpu_info.eax_1.extended_model;
-
-  // Get ChipID.ProcessorName from other information already gathered
-  this->RetrieveClassicalCPUIdentity();
-
-  // Cache size
-  this->Features.L1CacheSize = 0;
-  this->Features.L2CacheSize = 0;
-
-  return true;
-
-#else
-  return false;
-#endif
-}
-
-bool SystemInformationImplementation::QueryQNXMemory()
-{
-#if defined(__QNX__)
-  kwsys_stl::string buffer;
-  kwsys_stl::vector<const char*> args;
-  args.clear();
-
-  args.push_back("showmem");
-  args.push_back("-S");
-  args.push_back(0);
-  buffer = this->RunProcess(args);
-  args.clear();
-
-  size_t pos = buffer.find("System RAM:");
-  if (pos == buffer.npos)
-    return false;
-  pos = buffer.find(":", pos);
-  size_t pos2 = buffer.find("M (", pos);
-  if (pos2 == buffer.npos)
-    return false;
-
-  pos++;
-  while (buffer[pos] == ' ')
-    pos++;
-
-  this->TotalPhysicalMemory = atoi(buffer.substr(pos, pos2 - pos).c_str());
-  return true;
-#endif
-  return false;
-}
-
-bool SystemInformationImplementation::QueryBSDMemory()
-{
-#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
-  int ctrl[2] = { CTL_HW, HW_PHYSMEM };
-#if defined(HW_PHYSMEM64)
-  int64_t k;
-  ctrl[1] = HW_PHYSMEM64;
-#else
-  int k;
-#endif
-  size_t sz = sizeof(k);
-
-  if (sysctl(ctrl, 2, &k, &sz, NULL, 0) != 0)
-    {
-    return false;
-    }
-
-  this->TotalPhysicalMemory = k>>10>>10;
-
-  return true;
-#else
-  return false;
-#endif
-}
-
-bool SystemInformationImplementation::QueryQNXProcessor()
-{
-#if defined(__QNX__)
-  // the output on my QNX 6.4.1 looks like this:
-  // Processor1: 686 Pentium II Stepping 3 2175MHz FPU
-  kwsys_stl::string buffer;
-  kwsys_stl::vector<const char*> args;
-  args.clear();
-
-  args.push_back("pidin");
-  args.push_back("info");
-  args.push_back(0);
-  buffer = this->RunProcess(args);
-  args.clear();
-
-  size_t pos = buffer.find("Processor1:");
-  if (pos == buffer.npos)
-    return false;
-
-  size_t pos2 = buffer.find("MHz", pos);
-  if (pos2 == buffer.npos)
-    return false;
-
-  size_t pos3 = pos2;
-  while (buffer[pos3] != ' ')
-    --pos3;
-
-  this->CPUSpeedInMHz = atoi(buffer.substr(pos3 + 1, pos2 - pos3 - 1).c_str());
-
-  pos2 = buffer.find(" Stepping", pos);
-  if (pos2 != buffer.npos)
-    {
-    pos2 = buffer.find(" ", pos2 + 1);
-    if (pos2 != buffer.npos && pos2 < pos3)
-      {
-      this->ChipID.Revision = atoi(buffer.substr(pos2 + 1, pos3 - pos2).c_str());
-      }
-    }
-
-  this->NumberOfPhysicalCPU = 0;
-  do
-    {
-    pos = buffer.find("\nProcessor", pos + 1);
-    ++this->NumberOfPhysicalCPU;
-    } while (pos != buffer.npos);
-  this->NumberOfLogicalCPU = 1;
-
-  return true;
-#else
-  return false;
-#endif
-}
-
-bool SystemInformationImplementation::QueryBSDProcessor()
-{
-#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
-  int k;
-  size_t sz = sizeof(k);
-  int ctrl[2] = { CTL_HW, HW_NCPU };
-
-  if (sysctl(ctrl, 2, &k, &sz, NULL, 0) != 0)
-    {
-    return false;
-    }
-
-  this->NumberOfPhysicalCPU = k;
-  this->NumberOfLogicalCPU = this->NumberOfPhysicalCPU;
-
-#if defined(HW_CPUSPEED)
-  ctrl[1] = HW_CPUSPEED;
-
-  if (sysctl(ctrl, 2, &k, &sz, NULL, 0) != 0)
-    {
-    return false;
-    }
-
-  this->CPUSpeedInMHz = (float) k;
-#endif
-
-#if defined(CPU_SSE)
-  ctrl[0] = CTL_MACHDEP;
-  ctrl[1] = CPU_SSE;
-
-  if (sysctl(ctrl, 2, &k, &sz, NULL, 0) != 0)
-    {
-    return false;
-    }
-
-  this->Features.HasSSE = (k > 0);
-#endif
-
-#if defined(CPU_SSE2)
-  ctrl[0] = CTL_MACHDEP;
-  ctrl[1] = CPU_SSE2;
-
-  if (sysctl(ctrl, 2, &k, &sz, NULL, 0) != 0)
-    {
-    return false;
-    }
-
-  this->Features.HasSSE2 = (k > 0);
-#endif
-
-#if defined(CPU_CPUVENDOR)
-  ctrl[0] = CTL_MACHDEP;
-  ctrl[1] = CPU_CPUVENDOR;
-  char vbuf[25];
-  ::memset(vbuf, 0, sizeof(vbuf));
-  sz = sizeof(vbuf) - 1;
-  if (sysctl(ctrl, 2, vbuf, &sz, NULL, 0) != 0)
-    {
-    return false;
-    }
-
-  this->ChipID.Vendor = vbuf;
-  this->FindManufacturer();
-#endif
-
-  return true;
-#else
-  return false;
-#endif
-}
-
-bool SystemInformationImplementation::QueryHPUXMemory()
-{
-#if defined(__hpux)
-  unsigned long tv=0;
-  unsigned long tp=0;
-  unsigned long av=0;
-  unsigned long ap=0;
-  struct pst_static pst;
-  struct pst_dynamic pdy;
-
-  unsigned long ps = 0;
-  if (pstat_getstatic(&pst, sizeof(pst), (size_t) 1, 0) == -1)
-    {
-    return false;
-    }
-
-  ps = pst.page_size;
-  tp =  pst.physical_memory *ps;
-  tv = (pst.physical_memory + pst.pst_maxmem) * ps;
-  if (pstat_getdynamic(&pdy, sizeof(pdy), (size_t) 1, 0) == -1)
-    {
-    return false;
-    }
-
-  ap = tp - pdy.psd_rm * ps;
-  av = tv - pdy.psd_vm;
-  this->TotalVirtualMemory = tv>>10>>10;
-  this->TotalPhysicalMemory = tp>>10>>10;
-  this->AvailableVirtualMemory = av>>10>>10;
-  this->AvailablePhysicalMemory = ap>>10>>10;
-  return true;
-#else
-  return false;
-#endif
-}
-
-bool SystemInformationImplementation::QueryHPUXProcessor()
-{
-#if defined(__hpux)
-# if defined(KWSYS_SYS_HAS_MPCTL_H)
-  int c = mpctl(MPC_GETNUMSPUS_SYS, 0, 0);
-  if (c <= 0)
-    {
-    return false;
-    }
-
-  this->NumberOfPhysicalCPU = c;
-  this->NumberOfLogicalCPU = this->NumberOfPhysicalCPU;
-
-  long t = sysconf(_SC_CPU_VERSION);
-
-  if (t == -1)
-    {
-    return false;
-    }
-
-  switch (t)
-    {
-    case CPU_PA_RISC1_0:
-      this->ChipID.Vendor = "Hewlett-Packard";
-      this->ChipID.Family = 0x100;
-      break;
-    case CPU_PA_RISC1_1:
-      this->ChipID.Vendor = "Hewlett-Packard";
-      this->ChipID.Family = 0x110;
-      break;
-    case CPU_PA_RISC2_0:
-      this->ChipID.Vendor = "Hewlett-Packard";
-      this->ChipID.Family = 0x200;
-      break;
-#  if defined(CPU_HP_INTEL_EM_1_0) || defined(CPU_IA64_ARCHREV_0)
-#   ifdef CPU_HP_INTEL_EM_1_0
-    case CPU_HP_INTEL_EM_1_0:
-#   endif
-#   ifdef CPU_IA64_ARCHREV_0
-    case CPU_IA64_ARCHREV_0:
-#   endif
-      this->ChipID.Vendor = "GenuineIntel";
-      this->Features.HasIA64 = true;
-      break;
-#  endif
-    default:
-      return false;
-    }
-
-  this->FindManufacturer();
-
-  return true;
-# else
-  return false;
-# endif
-#else
-  return false;
-#endif
-}
-
-/** Query the operating system information */
-bool SystemInformationImplementation::QueryOSInformation()
-{
-#if defined(_WIN32)
-
-  this->OSName = "Windows";
-
-  OSVERSIONINFOEXW osvi;
-  BOOL bIsWindows64Bit;
-  BOOL bOsVersionInfoEx;
-  char operatingSystem[256];
-
-  // Try calling GetVersionEx using the OSVERSIONINFOEX structure.
-  ZeroMemory (&osvi, sizeof (OSVERSIONINFOEXW));
-  osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFOEXW);
-#ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
-# pragma warning (push)
-# pragma warning (disable:4996)
-#endif
-  bOsVersionInfoEx = GetVersionExW ((OSVERSIONINFOW*)&osvi);
-  if (!bOsVersionInfoEx)
-    {
-    osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFOW);
-    if (!GetVersionExW((OSVERSIONINFOW*)&osvi))
-      {
-      return false;
-      }
-    }
-#ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
-# pragma warning (pop)
-#endif
-
-  switch (osvi.dwPlatformId)
-    {
-    case VER_PLATFORM_WIN32_NT:
-      // Test for the product.
-      if (osvi.dwMajorVersion <= 4)
-        {
-        this->OSRelease = "NT";
-        }
-      if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0)
-        {
-        this->OSRelease = "2000";
-        }
-      if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1)
-        {
-        this->OSRelease = "XP";
-        }
-      // XP Professional x64
-      if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2)
-        {
-        this->OSRelease = "XP";
-        }
-#ifdef VER_NT_WORKSTATION
-      // Test for product type.
-      if (bOsVersionInfoEx)
-        {
-        if (osvi.wProductType == VER_NT_WORKSTATION)
-          {
-          if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0)
-            {
-            this->OSRelease = "Vista";
-            }
-          if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 1)
-            {
-            this->OSRelease = "7";
-            }
-// VER_SUITE_PERSONAL may not be defined
-#ifdef VER_SUITE_PERSONAL
-          else
-            {
-            if (osvi.wSuiteMask & VER_SUITE_PERSONAL)
-              {
-              this->OSRelease += " Personal";
-              }
-            else
-              {
-              this->OSRelease += " Professional";
-              }
-            }
-#endif
-          }
-        else if (osvi.wProductType == VER_NT_SERVER)
-          {
-          // Check for .NET Server instead of Windows XP.
-          if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1)
-            {
-            this->OSRelease = ".NET";
-            }
-
-          // Continue with the type detection.
-          if (osvi.wSuiteMask & VER_SUITE_DATACENTER)
-            {
-            this->OSRelease += " DataCenter Server";
-            }
-          else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE)
-            {
-            this->OSRelease += " Advanced Server";
-            }
-          else
-            {
-            this->OSRelease += " Server";
-            }
-          }
-
-        sprintf (operatingSystem, "%ls (Build %ld)", osvi.szCSDVersion, osvi.dwBuildNumber & 0xFFFF);
-        this->OSVersion = operatingSystem;
-        }
-      else
-#endif        // VER_NT_WORKSTATION
-        {
-        HKEY hKey;
-        wchar_t szProductType[80];
-        DWORD dwBufLen;
-
-        // Query the registry to retrieve information.
-        RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Control\\ProductOptions", 0, KEY_QUERY_VALUE, &hKey);
-        RegQueryValueExW(hKey, L"ProductType", NULL, NULL, (LPBYTE) szProductType, &dwBufLen);
-        RegCloseKey (hKey);
-
-        if (lstrcmpiW(L"WINNT", szProductType) == 0)
-          {
-          this->OSRelease += " Professional";
-          }
-        if (lstrcmpiW(L"LANMANNT", szProductType) == 0)
-          {
-          // Decide between Windows 2000 Advanced Server and Windows .NET Enterprise Server.
-          if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1)
-            {
-            this->OSRelease += " Standard Server";
-            }
-          else
-            {
-            this->OSRelease += " Server";
-            }
-          }
-        if (lstrcmpiW(L"SERVERNT", szProductType) == 0)
-          {
-          // Decide between Windows 2000 Advanced Server and Windows .NET Enterprise Server.
-          if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1)
-            {
-            this->OSRelease += " Enterprise Server";
-            }
-          else
-            {
-            this->OSRelease += " Advanced Server";
-            }
-          }
-         }
-
-      // Display version, service pack (if any), and build number.
-      if (osvi.dwMajorVersion <= 4)
-        {
-        // NB: NT 4.0 and earlier.
-        sprintf (operatingSystem, "version %ld.%ld %ls (Build %ld)",
-                 osvi.dwMajorVersion,
-                 osvi.dwMinorVersion,
-                 osvi.szCSDVersion,
-                 osvi.dwBuildNumber & 0xFFFF);
-        this->OSVersion = operatingSystem;
-        }
-      else if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1)
-        {
-        // Windows XP and .NET server.
-        typedef BOOL (CALLBACK* LPFNPROC) (HANDLE, BOOL *);
-        HINSTANCE hKernelDLL;
-        LPFNPROC DLLProc;
-
-        // Load the Kernel32 DLL.
-        hKernelDLL = LoadLibraryW(L"kernel32");
-        if (hKernelDLL != NULL)  {
-          // Only XP and .NET Server support IsWOW64Process so... Load dynamically!
-          DLLProc = (LPFNPROC) GetProcAddress (hKernelDLL, "IsWow64Process");
-
-          // If the function address is valid, call the function.
-          if (DLLProc != NULL) (DLLProc) (GetCurrentProcess (), &bIsWindows64Bit);
-          else bIsWindows64Bit = false;
-
-          // Free the DLL module.
-          FreeLibrary (hKernelDLL);
-          }
-        }
-      else
-        {
-        // Windows 2000 and everything else.
-        sprintf (operatingSystem,"%ls (Build %ld)", osvi.szCSDVersion, osvi.dwBuildNumber & 0xFFFF);
-        this->OSVersion = operatingSystem;
-        }
-      break;
-
-    case VER_PLATFORM_WIN32_WINDOWS:
-      // Test for the product.
-      if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0)
-        {
-        this->OSRelease = "95";
-        if(osvi.szCSDVersion[1] == 'C')
-          {
-          this->OSRelease += "OSR 2.5";
-          }
-        else if(osvi.szCSDVersion[1] == 'B')
-          {
-          this->OSRelease += "OSR 2";
-          }
-      }
-
-      if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10)
-        {
-        this->OSRelease = "98";
-        if (osvi.szCSDVersion[1] == 'A' )
-          {
-          this->OSRelease += "SE";
-          }
-        }
-
-      if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90)
-        {
-        this->OSRelease = "Me";
-        }
-      break;
-
-    case VER_PLATFORM_WIN32s:
-      this->OSRelease = "Win32s";
-      break;
-
-    default:
-      this->OSRelease = "Unknown";
-      break;
-  }
-
-  // Get the hostname
-  WORD wVersionRequested;
-  WSADATA wsaData;
-  char name[255];
-  wVersionRequested = MAKEWORD(2,0);
-
-  if ( WSAStartup( wVersionRequested, &wsaData ) == 0 )
-    {
-    gethostname(name,sizeof(name));
-    WSACleanup( );
-    }
-  this->Hostname = name;
-
-  const char* arch = getenv("PROCESSOR_ARCHITECTURE");
-  if(arch)
-    {
-    this->OSPlatform = arch;
-    }
-
-#else
-
-  struct utsname unameInfo;
-  int errorFlag = uname(&unameInfo);
-  if(errorFlag == 0)
-    {
-    this->OSName = unameInfo.sysname;
-    this->Hostname = unameInfo.nodename;
-    this->OSRelease = unameInfo.release;
-    this->OSVersion = unameInfo.version;
-    this->OSPlatform = unameInfo.machine;
-    }
-
-#ifdef __APPLE__
-  this->OSName="Unknown Apple OS";
-  this->OSRelease="Unknown product version";
-  this->OSVersion="Unknown build version";
-
-  this->CallSwVers("-productName",this->OSName);
-  this->CallSwVers("-productVersion",this->OSRelease);
-  this->CallSwVers("-buildVersion",this->OSVersion);
-#endif
-
-#endif
-
-  return true;
-}
-
-int SystemInformationImplementation::CallSwVers(
-      const char *arg,
-      kwsys_stl::string &ver)
-{
-#ifdef __APPLE__
-  kwsys_stl::vector<const char*> args;
-  args.push_back("sw_vers");
-  args.push_back(arg);
-  args.push_back(0);
-  ver = this->RunProcess(args);
-  this->TrimNewline(ver);
-#else
-  // avoid C4100
-  (void)arg;
-  (void)ver;
-#endif
-  return 0;
-}
-
-void SystemInformationImplementation::TrimNewline(kwsys_stl::string& output)
-{
-  // remove \r
-  kwsys_stl::string::size_type pos=0;
-  while((pos = output.find("\r", pos)) != kwsys_stl::string::npos)
-    {
-    output.erase(pos);
-    }
-
-  // remove \n
-  pos = 0;
-  while((pos = output.find("\n", pos)) != kwsys_stl::string::npos)
-    {
-    output.erase(pos);
-    }
-}
-
-
-/** Return true if the machine is 64 bits */
-bool SystemInformationImplementation::Is64Bits()
-{
-  return (sizeof(void*) == 8);
-}
-
-
-} // namespace @KWSYS_NAMESPACE@
diff --git a/src/kwsys/SystemInformation.hxx.in b/src/kwsys/SystemInformation.hxx.in
deleted file mode 100644
index a9fd05d..0000000
--- a/src/kwsys/SystemInformation.hxx.in
+++ /dev/null
@@ -1,159 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef @KWSYS_NAMESPACE at _SystemInformation_h
-#define @KWSYS_NAMESPACE at _SystemInformation_h
-
-
-/* Define these macros temporarily to keep the code readable.  */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
-# define kwsys_stl @KWSYS_NAMESPACE at _stl
-# define kwsys_ios @KWSYS_NAMESPACE at _ios
-#endif
-#include <@KWSYS_NAMESPACE@/stl/string>
-#include <stddef.h> /* size_t */
-
-namespace @KWSYS_NAMESPACE@
-{
-
-// forward declare the implementation class
-class SystemInformationImplementation;
-
-class @KWSYS_NAMESPACE at _EXPORT SystemInformation
-{
-#if @KWSYS_USE_LONG_LONG@
-  typedef long long LongLong;
-#elif @KWSYS_USE___INT64@
-  typedef __int64 LongLong;
-#else
-# error "No Long Long"
-#endif
-  friend class SystemInformationImplementation;
-  SystemInformationImplementation* Implementation;
-public:
-
-  SystemInformation ();
-  ~SystemInformation ();
-
-  const char * GetVendorString();
-  const char * GetVendorID();
-  kwsys_stl::string GetTypeID();
-  kwsys_stl::string GetFamilyID();
-  kwsys_stl::string GetModelID();
-  kwsys_stl::string GetModelName();
-  kwsys_stl::string GetSteppingCode();
-  const char * GetExtendedProcessorName();
-  const char * GetProcessorSerialNumber();
-  int GetProcessorCacheSize();
-  unsigned int GetLogicalProcessorsPerPhysical();
-  float GetProcessorClockFrequency();
-  int GetProcessorAPICID();
-  int GetProcessorCacheXSize(long int);
-  bool DoesCPUSupportFeature(long int);
-
-  // returns an informative general description of the cpu
-  // on this system.
-  kwsys_stl::string GetCPUDescription();
-
-  const char * GetHostname();
-  kwsys_stl::string GetFullyQualifiedDomainName();
-
-  const char * GetOSName();
-  const char * GetOSRelease();
-  const char * GetOSVersion();
-  const char * GetOSPlatform();
-
-  int GetOSIsWindows();
-  int GetOSIsLinux();
-  int GetOSIsApple();
-
-  // returns an informative general description of the os
-  // on this system.
-  kwsys_stl::string GetOSDescription();
-
-  bool Is64Bits();
-
-  unsigned int GetNumberOfLogicalCPU(); // per physical cpu
-  unsigned int GetNumberOfPhysicalCPU();
-
-  bool DoesCPUSupportCPUID();
-
-  // Retrieve id of the current running process
-  LongLong GetProcessId();
-
-  // Retrieve memory information in megabyte.
-  size_t GetTotalVirtualMemory();
-  size_t GetAvailableVirtualMemory();
-  size_t GetTotalPhysicalMemory();
-  size_t GetAvailablePhysicalMemory();
-
-  // returns an informative general description if the installed and
-  // available ram on this system. See the  GetHostMmeoryTotal, and
-  // Get{Host,Proc}MemoryAvailable methods for more information.
-  kwsys_stl::string GetMemoryDescription(
-        const char *hostLimitEnvVarName=NULL,
-        const char *procLimitEnvVarName=NULL);
-
-  // Retrieve amount of physical memory installed on the system in KiB
-  // units.
-  LongLong GetHostMemoryTotal();
-
-  // Get total system RAM in units of KiB available colectivley to all
-  // processes in a process group. An example of a process group
-  // are the processes comprising an mpi program which is running in
-  // parallel. The amount of memory reported may differ from the host
-  // total if a host wide resource limit is applied. Such reource limits
-  // are reported to us via an applicaiton specified environment variable.
-  LongLong GetHostMemoryAvailable(const char *hostLimitEnvVarName=NULL);
-
-  // Get total system RAM in units of KiB available to this process.
-  // This may differ from the host available if a per-process resource
-  // limit is applied. per-process memory limits are applied on unix
-  // system via rlimit API. Resource limits that are not imposed via
-  // rlimit API may be reported to us via an application specified
-  // environment variable.
-  LongLong GetProcMemoryAvailable(
-        const char *hostLimitEnvVarName=NULL,
-        const char *procLimitEnvVarName=NULL);
-
-  // Get the system RAM used by all processes on the host, in units of KiB.
-  LongLong GetHostMemoryUsed();
-
-  // Get system RAM used by this process id in units of KiB.
-  LongLong GetProcMemoryUsed();
-
-  // enable/disable stack trace signal handler. In order to
-  // produce an informative stack trace the application should
-  // be dynamically linked and compiled with debug symbols.
-  static
-  void SetStackTraceOnError(int enable);
-
-  // format and return the current program stack in a string. In
-  // order to produce an informative stack trace the application
-  // should be dynamically linked and compiled with debug symbols.
-  static
-  kwsys_stl::string GetProgramStack(int firstFrame, int wholePath);
-
-  /** Run the different checks */
-  void RunCPUCheck();
-  void RunOSCheck();
-  void RunMemoryCheck();
-};
-
-} // namespace @KWSYS_NAMESPACE@
-
-/* Undefine temporary macros.  */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
-# undef kwsys_stl
-# undef kwsys_ios
-#endif
-
-#endif
diff --git a/src/kwsys/SystemTools.cxx b/src/kwsys/SystemTools.cxx
deleted file mode 100644
index e4c82d8..0000000
--- a/src/kwsys/SystemTools.cxx
+++ /dev/null
@@ -1,5201 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-
-#ifdef __osf__
-#  define _OSF_SOURCE
-#  define _POSIX_C_SOURCE 199506L
-#  define _XOPEN_SOURCE_EXTENDED
-#endif
-
-#include "kwsysPrivate.h"
-#include KWSYS_HEADER(RegularExpression.hxx)
-#include KWSYS_HEADER(SystemTools.hxx)
-#include KWSYS_HEADER(Directory.hxx)
-#include KWSYS_HEADER(FStream.hxx)
-#include KWSYS_HEADER(Encoding.hxx)
-
-#include KWSYS_HEADER(ios/iostream)
-#include KWSYS_HEADER(ios/fstream)
-#include KWSYS_HEADER(ios/sstream)
-
-#include KWSYS_HEADER(stl/set)
-
-// Work-around CMake dependency scanning limitation.  This must
-// duplicate the above list of headers.
-#if 0
-# include "SystemTools.hxx.in"
-# include "Directory.hxx.in"
-# include "FStream.hxx.in"
-# include "Encoding.hxx.in"
-# include "kwsys_ios_iostream.h.in"
-# include "kwsys_ios_fstream.h.in"
-# include "kwsys_ios_sstream.h.in"
-#endif
-
-#ifdef _MSC_VER
-# pragma warning (disable: 4786)
-#endif
-
-#if defined(__sgi) && !defined(__GNUC__)
-# pragma set woff 1375 /* base class destructor not virtual */
-#endif
-
-#include <ctype.h>
-#include <errno.h>
-#ifdef __QNX__
-# include <malloc.h> /* for malloc/free on QNX */
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <time.h>
-
-// support for realpath call
-#ifndef _WIN32
-#include <sys/time.h>
-#include <utime.h>
-#include <limits.h>
-#include <sys/wait.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-#include <pwd.h>
-#ifndef __VMS
-#include <sys/param.h>
-#include <termios.h>
-#endif
-#include <signal.h>    /* sigprocmask */
-#endif
-
-// Windows API.
-#if defined(_WIN32)
-# include <windows.h>
-# ifndef INVALID_FILE_ATTRIBUTES
-#  define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
-# endif
-# if defined(_MSC_VER) && _MSC_VER >= 1800
-#  define KWSYS_WINDOWS_DEPRECATED_GetVersionEx
-# endif
-#elif defined (__CYGWIN__)
-# include <windows.h>
-# undef _WIN32
-#endif
-
-#if !KWSYS_CXX_HAS_ENVIRON_IN_STDLIB_H
-extern char **environ;
-#endif
-
-#ifdef __CYGWIN__
-# include <sys/cygwin.h>
-#endif
-
-// getpwnam doesn't exist on Windows and Cray Xt3/Catamount
-// same for TIOCGWINSZ
-#if defined(_WIN32) || defined (__LIBCATAMOUNT__)
-# undef HAVE_GETPWNAM
-# undef HAVE_TTY_INFO
-#else
-# define HAVE_GETPWNAM 1
-# define HAVE_TTY_INFO 1
-#endif
-
-#define VTK_URL_PROTOCOL_REGEX "([a-zA-Z0-9]*)://(.*)"
-#define VTK_URL_REGEX "([a-zA-Z0-9]*)://(([A-Za-z0-9]+)(:([^:@]+))?@)?([^:@/]+)(:([0-9]+))?/(.+)?"
-
-#ifdef _MSC_VER
-#include <sys/utime.h>
-#else
-#include <utime.h>
-#endif
-
-
-// This is a hack to prevent warnings about these functions being
-// declared but not referenced.
-#if defined(__sgi) && !defined(__GNUC__)
-# include <sys/termios.h>
-namespace KWSYS_NAMESPACE
-{
-class SystemToolsHack
-{
-public:
-  enum
-  {
-    Ref1 = sizeof(cfgetospeed(0)),
-    Ref2 = sizeof(cfgetispeed(0)),
-    Ref3 = sizeof(tcgetattr(0, 0)),
-    Ref4 = sizeof(tcsetattr(0, 0, 0)),
-    Ref5 = sizeof(cfsetospeed(0,0)),
-    Ref6 = sizeof(cfsetispeed(0,0))
-  };
-};
-}
-#endif
-
-#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) ||defined(__BORLANDC__) || defined(__MINGW32__))
-#include <io.h>
-#include <direct.h>
-#define _unlink unlink
-#endif
-
-/* The maximum length of a file name.  */
-#if defined(PATH_MAX)
-# define KWSYS_SYSTEMTOOLS_MAXPATH PATH_MAX
-#elif defined(MAXPATHLEN)
-# define KWSYS_SYSTEMTOOLS_MAXPATH MAXPATHLEN
-#else
-# define KWSYS_SYSTEMTOOLS_MAXPATH 16384
-#endif
-#if defined(__WATCOMC__)
-#include <direct.h>
-#define _mkdir mkdir
-#define _rmdir rmdir
-#define _getcwd getcwd
-#define _chdir chdir
-#endif
-
-#if defined(__BEOS__) && !defined(__ZETA__)
-#include <be/kernel/OS.h>
-#include <be/storage/Path.h>
-
-// BeOS 5 doesn't have usleep(), but it has snooze(), which is identical.
-static inline void usleep(unsigned int msec)
-{
-  ::snooze(msec);
-}
-
-// BeOS 5 also doesn't have realpath(), but its C++ API offers something close.
-static inline char *realpath(const char *path, char *resolved_path)
-{
-  const size_t maxlen = KWSYS_SYSTEMTOOLS_MAXPATH;
-  snprintf(resolved_path, maxlen, "%s", path);
-  BPath normalized(resolved_path, NULL, true);
-  const char *resolved = normalized.Path();
-  if (resolved != NULL)   // NULL == No such file.
-    {
-    if (snprintf(resolved_path, maxlen, "%s", resolved) < maxlen)
-      {
-      return resolved_path;
-      }
-    }
-  return NULL;   // something went wrong.
-}
-#endif
-
-#ifdef _WIN32
-static time_t windows_filetime_to_posix_time(const FILETIME& ft)
-{
-  LARGE_INTEGER date;
-  date.HighPart = ft.dwHighDateTime;
-  date.LowPart = ft.dwLowDateTime;
-
-  // removes the diff between 1970 and 1601
-  date.QuadPart -= ((LONGLONG)(369 * 365 + 89) * 24 * 3600 * 10000000);
-
-  // converts back from 100-nanoseconds to seconds
-  return date.QuadPart / 10000000;
-}
-#endif
-
-#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__))
-
-#include <wctype.h>
-
-inline int Mkdir(const kwsys_stl::string& dir)
-{
-  return _wmkdir(
-    KWSYS_NAMESPACE::SystemTools::ConvertToWindowsExtendedPath(dir).c_str());
-}
-inline int Rmdir(const kwsys_stl::string& dir)
-{
-  return _wrmdir(
-    KWSYS_NAMESPACE::SystemTools::ConvertToWindowsExtendedPath(dir).c_str());
-}
-inline const char* Getcwd(char* buf, unsigned int len)
-{
-  std::vector<wchar_t> w_buf(len);
-  if(_wgetcwd(&w_buf[0], len))
-    {
-    // make sure the drive letter is capital
-    if(wcslen(&w_buf[0]) > 1 && w_buf[1] == L':')
-      {
-      w_buf[0] = towupper(w_buf[0]);
-      }
-    std::string tmp = KWSYS_NAMESPACE::Encoding::ToNarrow(&w_buf[0]);
-    strcpy(buf, tmp.c_str());
-    return buf;
-    }
-  return 0;
-}
-inline int Chdir(const kwsys_stl::string& dir)
-{
-  #if defined(__BORLANDC__)
-  return chdir(dir.c_str());
-  #else
-  return _wchdir(KWSYS_NAMESPACE::Encoding::ToWide(dir).c_str());
-  #endif
-}
-inline void Realpath(const kwsys_stl::string& path, kwsys_stl::string & resolved_path)
-{
-  kwsys_stl::wstring tmp = KWSYS_NAMESPACE::Encoding::ToWide(path);
-  wchar_t *ptemp;
-  wchar_t fullpath[MAX_PATH];
-  if( GetFullPathNameW(tmp.c_str(), sizeof(fullpath)/sizeof(fullpath[0]),
-                       fullpath, &ptemp) )
-    {
-    resolved_path = KWSYS_NAMESPACE::Encoding::ToNarrow(fullpath);
-    KWSYS_NAMESPACE::SystemTools::ConvertToUnixSlashes(resolved_path);
-    }
-  else
-    {
-    resolved_path = path;
-    }
-}
-#else
-#include <sys/types.h>
-#include <fcntl.h>
-#include <unistd.h>
-inline int Mkdir(const kwsys_stl::string& dir)
-{
-  return mkdir(dir.c_str(), 00777);
-}
-inline int Rmdir(const kwsys_stl::string& dir)
-{
-  return rmdir(dir.c_str());
-}
-inline const char* Getcwd(char* buf, unsigned int len)
-{
-  return getcwd(buf, len);
-}
-
-inline int Chdir(const kwsys_stl::string& dir)
-{
-  return chdir(dir.c_str());
-}
-inline void Realpath(const kwsys_stl::string& path, kwsys_stl::string & resolved_path)
-{
-  char resolved_name[KWSYS_SYSTEMTOOLS_MAXPATH];
-
-  char *ret = realpath(path.c_str(), resolved_name);
-  if(ret)
-    {
-    resolved_path = ret;
-    }
-  else
-    {
-    // if path resolution fails, return what was passed in
-    resolved_path = path;
-    }
-}
-#endif
-
-#if !defined(_WIN32) && defined(__COMO__)
-// Hack for como strict mode to avoid defining _SVID_SOURCE or _BSD_SOURCE.
-extern "C"
-{
-extern FILE *popen (__const char *__command, __const char *__modes) __THROW;
-extern int pclose (FILE *__stream) __THROW;
-extern char *realpath (__const char *__restrict __name,
-                       char *__restrict __resolved) __THROW;
-extern char *strdup (__const char *__s) __THROW;
-extern int putenv (char *__string) __THROW;
-}
-#endif
-
-namespace KWSYS_NAMESPACE
-{
-
-double SystemTools::GetTime(void)
-{
-#if defined(_WIN32) && !defined(__CYGWIN__)
-  FILETIME ft;
-  GetSystemTimeAsFileTime(&ft);
-  return (429.4967296*ft.dwHighDateTime
-          + 0.0000001*ft.dwLowDateTime
-          - 11644473600.0);
-#else
-  struct timeval t;
-  gettimeofday(&t, 0);
-  return 1.0*double(t.tv_sec) + 0.000001*double(t.tv_usec);
-#endif
-}
-
-class SystemToolsTranslationMap :
-    public kwsys_stl::map<kwsys_stl::string,kwsys_stl::string>
-{
-};
-
-// adds the elements of the env variable path to the arg passed in
-void SystemTools::GetPath(kwsys_stl::vector<kwsys_stl::string>& path, const char* env)
-{
-#if defined(_WIN32) && !defined(__CYGWIN__)
-  const char pathSep = ';';
-#else
-  const char pathSep = ':';
-#endif
-  if(!env)
-    {
-    env = "PATH";
-    }
-  const char* cpathEnv = SystemTools::GetEnv(env);
-  if ( !cpathEnv )
-    {
-    return;
-    }
-
-  kwsys_stl::string pathEnv = cpathEnv;
-
-  // A hack to make the below algorithm work.
-  if(!pathEnv.empty() && *pathEnv.rbegin() != pathSep)
-    {
-    pathEnv += pathSep;
-    }
-  kwsys_stl::string::size_type start =0;
-  bool done = false;
-  while(!done)
-    {
-    kwsys_stl::string::size_type endpos = pathEnv.find(pathSep, start);
-    if(endpos != kwsys_stl::string::npos)
-      {
-      path.push_back(pathEnv.substr(start, endpos-start));
-      start = endpos+1;
-      }
-    else
-      {
-      done = true;
-      }
-    }
-  for(kwsys_stl::vector<kwsys_stl::string>::iterator i = path.begin();
-      i != path.end(); ++i)
-    {
-    SystemTools::ConvertToUnixSlashes(*i);
-    }
-}
-
-const char* SystemTools::GetEnv(const char* key)
-{
-  return getenv(key);
-}
-
-const char* SystemTools::GetEnv(const kwsys_stl::string& key)
-{
-  return SystemTools::GetEnv(key.c_str());
-}
-
-bool SystemTools::GetEnv(const char* key, kwsys_stl::string& result)
-{
-  const char* v = getenv(key);
-  if(v)
-    {
-    result = v;
-    return true;
-    }
-  else
-    {
-    return false;
-    }
-}
-
-bool SystemTools::GetEnv(const kwsys_stl::string& key, kwsys_stl::string& result)
-{
-  return SystemTools::GetEnv(key.c_str(), result);
-}
-
-//----------------------------------------------------------------------------
-
-#if defined(__CYGWIN__) || defined(__GLIBC__)
-# define KWSYS_PUTENV_NAME  /* putenv("A")  removes A.  */
-#elif defined(_WIN32)
-# define KWSYS_PUTENV_EMPTY /* putenv("A=") removes A. */
-#endif
-
-#if KWSYS_CXX_HAS_UNSETENV
-/* unsetenv("A") removes A from the environment.
-   On older platforms it returns void instead of int.  */
-static int kwsysUnPutEnv(const kwsys_stl::string& env)
-{
-  size_t pos = env.find('=');
-  if(pos != env.npos)
-    {
-    std::string name = env.substr(0, pos);
-    unsetenv(name.c_str());
-    }
-  else
-    {
-    unsetenv(env.c_str());
-    }
-  return 0;
-}
-
-#elif defined(KWSYS_PUTENV_EMPTY) || defined(KWSYS_PUTENV_NAME)
-/* putenv("A=") or putenv("A") removes A from the environment.  */
-static int kwsysUnPutEnv(const kwsys_stl::string& env)
-{
-  int err = 0;
-  size_t pos = env.find('=');
-  size_t const len = pos == env.npos ? env.size() : pos;
-# ifdef KWSYS_PUTENV_EMPTY
-  size_t const sz = len + 2;
-# else
-  size_t const sz = len + 1;
-# endif
-  char local_buf[256];
-  char* buf = sz > sizeof(local_buf) ? (char*)malloc(sz) : local_buf;
-  if(!buf)
-    {
-    return -1;
-    }
-  strncpy(buf, env.c_str(), len);
-# ifdef KWSYS_PUTENV_EMPTY
-  buf[len] = '=';
-  buf[len+1] = 0;
-  if(putenv(buf) < 0)
-    {
-    err = errno;
-    }
-# else
-  buf[len] = 0;
-  if(putenv(buf) < 0 && errno != EINVAL)
-    {
-    err = errno;
-    }
-# endif
-  if(buf != local_buf)
-    {
-    free(buf);
-    }
-  if(err)
-    {
-    errno = err;
-    return -1;
-    }
-  return 0;
-}
-
-#else
-/* Manipulate the "environ" global directly.  */
-static int kwsysUnPutEnv(const kwsys_stl::string& env)
-{
-  size_t pos = env.find('=');
-  size_t const len = pos == env.npos ? env.size() : pos;
-  int in = 0;
-  int out = 0;
-  while(environ[in])
-    {
-    if(strlen(environ[in]) > len &&
-       environ[in][len] == '=' &&
-       strncmp(env.c_str(), environ[in], len) == 0)
-      {
-      ++in;
-      }
-    else
-      {
-      environ[out++] = environ[in++];
-      }
-    }
-  while(out < in)
-    {
-    environ[out++] = 0;
-    }
-  return 0;
-}
-#endif
-
-//----------------------------------------------------------------------------
-
-#if KWSYS_CXX_HAS_SETENV
-
-/* setenv("A", "B", 1) will set A=B in the environment and makes its
-   own copies of the strings.  */
-bool SystemTools::PutEnv(const kwsys_stl::string& env)
-{
-  size_t pos = env.find('=');
-  if(pos != env.npos)
-    {
-    std::string name = env.substr(0, pos);
-    return setenv(name.c_str(), env.c_str() + pos + 1, 1) == 0;
-    }
-  else
-    {
-    return kwsysUnPutEnv(env) == 0;
-    }
-}
-
-bool SystemTools::UnPutEnv(const kwsys_stl::string& env)
-{
-  return kwsysUnPutEnv(env) == 0;
-}
-
-#else
-
-/* putenv("A=B") will set A=B in the environment.  Most putenv implementations
-   put their argument directly in the environment.  They never free the memory
-   on program exit.  Keep an active set of pointers to memory we allocate and
-   pass to putenv, one per environment key.  At program exit remove any
-   environment values that may still reference memory we allocated.  Then free
-   the memory.  This will not affect any environment values we never set.  */
-
-# ifdef __INTEL_COMPILER
-#  pragma warning disable 444 /* base has non-virtual destructor */
-# endif
-
-/* Order by environment key only (VAR from VAR=VALUE).  */
-struct kwsysEnvCompare
-{
-  bool operator() (const char* l, const char* r) const
-    {
-    const char* leq = strchr(l, '=');
-    const char* req = strchr(r, '=');
-    size_t llen = leq? (leq-l) : strlen(l);
-    size_t rlen = req? (req-r) : strlen(r);
-    if(llen == rlen)
-      {
-      return strncmp(l,r,llen) < 0;
-      }
-    else
-      {
-      return strcmp(l,r) < 0;
-      }
-    }
-};
-
-class kwsysEnv: public kwsys_stl::set<const char*, kwsysEnvCompare>
-{
-  class Free
-  {
-    const char* Env;
-  public:
-    Free(const char* env): Env(env) {}
-    ~Free() { free(const_cast<char*>(this->Env)); }
-  };
-public:
-  typedef kwsys_stl::set<const char*, kwsysEnvCompare> derived;
-  ~kwsysEnv()
-    {
-    for(derived::iterator i = this->begin(); i != this->end(); ++i)
-      {
-      kwsysUnPutEnv(*i);
-      free(const_cast<char*>(*i));
-      }
-    }
-  const char* Release(const char* env)
-    {
-    const char* old = 0;
-    derived::iterator i = this->find(env);
-    if(i != this->end())
-      {
-      old = *i;
-      this->erase(i);
-      }
-    return old;
-    }
-  bool Put(const char* env)
-    {
-    Free oldEnv(this->Release(env));
-    static_cast<void>(oldEnv);
-    char* newEnv = strdup(env);
-    this->insert(newEnv);
-    return putenv(newEnv) == 0;
-    }
-  bool UnPut(const char* env)
-    {
-    Free oldEnv(this->Release(env));
-    static_cast<void>(oldEnv);
-    return kwsysUnPutEnv(env) == 0;
-    }
-};
-
-static kwsysEnv kwsysEnvInstance;
-
-bool SystemTools::PutEnv(const kwsys_stl::string& env)
-{
-  return kwsysEnvInstance.Put(env.c_str());
-}
-
-bool SystemTools::UnPutEnv(const kwsys_stl::string& env)
-{
-  return kwsysEnvInstance.UnPut(env.c_str());
-}
-
-#endif
-
-//----------------------------------------------------------------------------
-
-const char* SystemTools::GetExecutableExtension()
-{
-#if defined(_WIN32) || defined(__CYGWIN__) || defined(__VMS)
-  return ".exe";
-#else
-  return "";
-#endif
-}
-
-FILE* SystemTools::Fopen(const kwsys_stl::string& file, const char* mode)
-{
-#ifdef _WIN32
-  return _wfopen(SystemTools::ConvertToWindowsExtendedPath(file).c_str(),
-                 Encoding::ToWide(mode).c_str());
-#else
-  return fopen(file.c_str(), mode);
-#endif
-}
-
-bool SystemTools::MakeDirectory(const char* path)
-{
-  if(!path)
-    {
-    return false;
-    }
-  return SystemTools::MakeDirectory(kwsys_stl::string(path));
-}
-
-bool SystemTools::MakeDirectory(const kwsys_stl::string& path)
-{
-  if(SystemTools::FileExists(path))
-    {
-    return SystemTools::FileIsDirectory(path);
-    }
-  if(path.empty())
-    {
-    return false;
-    }
-  kwsys_stl::string dir = path;
-  SystemTools::ConvertToUnixSlashes(dir);
-
-  kwsys_stl::string::size_type pos = 0;
-  kwsys_stl::string topdir;
-  while((pos = dir.find('/', pos)) != kwsys_stl::string::npos)
-    {
-    topdir = dir.substr(0, pos);
-    Mkdir(topdir);
-    pos++;
-    }
-  topdir = dir;
-  if(Mkdir(topdir) != 0)
-    {
-    // There is a bug in the Borland Run time library which makes MKDIR
-    // return EACCES when it should return EEXISTS
-    // if it is some other error besides directory exists
-    // then return false
-    if( (errno != EEXIST)
-#ifdef __BORLANDC__
-        && (errno != EACCES)
-#endif
-      )
-      {
-      return false;
-      }
-    }
-  return true;
-}
-
-
-// replace replace with with as many times as it shows up in source.
-// write the result into source.
-void SystemTools::ReplaceString(kwsys_stl::string& source,
-                                const kwsys_stl::string& replace,
-                                const kwsys_stl::string& with)
-{
-  // do while hangs if replaceSize is 0
-  if (replace.empty())
-    {
-    return;
-    }
-
-  SystemTools::ReplaceString(source, replace.c_str(), replace.size(), with);
-}
-
-void SystemTools::ReplaceString(kwsys_stl::string& source,
-                                const char* replace,
-                                const char* with)
-{
-  // do while hangs if replaceSize is 0
-  if (!*replace)
-    {
-    return;
-    }
-
-  SystemTools::ReplaceString(source, replace, strlen(replace), with ? with : "");
-}
-
-void SystemTools::ReplaceString(kwsys_stl::string& source,
-                                const char* replace,
-                                size_t replaceSize,
-                                const kwsys_stl::string& with)
-{
-  const char *src = source.c_str();
-  char *searchPos = const_cast<char *>(strstr(src,replace));
-
-  // get out quick if string is not found
-  if (!searchPos)
-    {
-    return;
-    }
-
-  // perform replacements until done
-  char *orig = strdup(src);
-  char *currentPos = orig;
-  searchPos = searchPos - src + orig;
-
-  // initialize the result
-  source.erase(source.begin(),source.end());
-  do
-    {
-    *searchPos = '\0';
-    source += currentPos;
-    currentPos = searchPos + replaceSize;
-    // replace
-    source += with;
-    searchPos = strstr(currentPos,replace);
-    }
-  while (searchPos);
-
-  // copy any trailing text
-  source += currentPos;
-  free(orig);
-}
-
-#if defined(KEY_WOW64_32KEY) && defined(KEY_WOW64_64KEY)
-# define KWSYS_ST_KEY_WOW64_32KEY KEY_WOW64_32KEY
-# define KWSYS_ST_KEY_WOW64_64KEY KEY_WOW64_64KEY
-#else
-# define KWSYS_ST_KEY_WOW64_32KEY 0x0200
-# define KWSYS_ST_KEY_WOW64_64KEY 0x0100
-#endif
-
-#if defined(_WIN32) && !defined(__CYGWIN__)
-static bool SystemToolsParseRegistryKey(const kwsys_stl::string& key,
-                                        HKEY& primaryKey,
-                                        kwsys_stl::string& second,
-                                        kwsys_stl::string& valuename)
-{
-  kwsys_stl::string primary = key;
-
-  size_t start = primary.find('\\');
-  if (start == kwsys_stl::string::npos)
-    {
-    return false;
-    }
-
-  size_t valuenamepos = primary.find(';');
-  if (valuenamepos != kwsys_stl::string::npos)
-    {
-    valuename = primary.substr(valuenamepos+1);
-    }
-
-  second = primary.substr(start+1, valuenamepos-start-1);
-  primary = primary.substr(0, start);
-
-  if (primary == "HKEY_CURRENT_USER")
-    {
-    primaryKey = HKEY_CURRENT_USER;
-    }
-  if (primary == "HKEY_CURRENT_CONFIG")
-    {
-    primaryKey = HKEY_CURRENT_CONFIG;
-    }
-  if (primary == "HKEY_CLASSES_ROOT")
-    {
-    primaryKey = HKEY_CLASSES_ROOT;
-    }
-  if (primary == "HKEY_LOCAL_MACHINE")
-    {
-    primaryKey = HKEY_LOCAL_MACHINE;
-    }
-  if (primary == "HKEY_USERS")
-    {
-    primaryKey = HKEY_USERS;
-    }
-
-  return true;
-}
-
-static DWORD SystemToolsMakeRegistryMode(DWORD mode,
-                                         SystemTools::KeyWOW64 view)
-{
-  // only add the modes when on a system that supports Wow64.
-  static FARPROC wow64p = GetProcAddress(GetModuleHandleW(L"kernel32"),
-                                         "IsWow64Process");
-  if(wow64p == NULL)
-    {
-    return mode;
-    }
-
-  if(view == SystemTools::KeyWOW64_32)
-    {
-    return mode | KWSYS_ST_KEY_WOW64_32KEY;
-    }
-  else if(view == SystemTools::KeyWOW64_64)
-    {
-    return mode | KWSYS_ST_KEY_WOW64_64KEY;
-    }
-  return mode;
-}
-#endif
-
-#if defined(_WIN32) && !defined(__CYGWIN__)
-bool
-SystemTools::GetRegistrySubKeys(const kwsys_stl::string& key,
-                                kwsys_stl::vector<kwsys_stl::string>& subkeys,
-                                KeyWOW64 view)
-{
-  HKEY primaryKey = HKEY_CURRENT_USER;
-  kwsys_stl::string second;
-  kwsys_stl::string valuename;
-  if (!SystemToolsParseRegistryKey(key, primaryKey, second, valuename))
-    {
-    return false;
-    }
-
-  HKEY hKey;
-  if(RegOpenKeyExW(primaryKey,
-                  Encoding::ToWide(second).c_str(),
-                  0,
-                  SystemToolsMakeRegistryMode(KEY_READ, view),
-                  &hKey) != ERROR_SUCCESS)
-    {
-    return false;
-    }
-  else
-    {
-    wchar_t name[1024];
-    DWORD dwNameSize = sizeof(name)/sizeof(name[0]);
-
-    DWORD i = 0;
-    while (RegEnumKeyW(hKey, i, name, dwNameSize) == ERROR_SUCCESS)
-      {
-      subkeys.push_back(Encoding::ToNarrow(name));
-      ++i;
-      }
-
-    RegCloseKey(hKey);
-    }
-
-  return true;
-}
-#else
-bool SystemTools::GetRegistrySubKeys(const kwsys_stl::string&,
-                                     kwsys_stl::vector<kwsys_stl::string>&,
-                                     KeyWOW64)
-{
-  return false;
-}
-#endif
-
-// Read a registry value.
-// Example :
-//      HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.1\InstallPath
-//      =>  will return the data of the "default" value of the key
-//      HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.4;Root
-//      =>  will return the data of the "Root" value of the key
-
-#if defined(_WIN32) && !defined(__CYGWIN__)
-bool SystemTools::ReadRegistryValue(const kwsys_stl::string& key, kwsys_stl::string &value,
-                                    KeyWOW64 view)
-{
-  bool valueset = false;
-  HKEY primaryKey = HKEY_CURRENT_USER;
-  kwsys_stl::string second;
-  kwsys_stl::string valuename;
-  if (!SystemToolsParseRegistryKey(key, primaryKey, second, valuename))
-    {
-    return false;
-    }
-
-  HKEY hKey;
-  if(RegOpenKeyExW(primaryKey,
-                  Encoding::ToWide(second).c_str(),
-                  0,
-                  SystemToolsMakeRegistryMode(KEY_READ, view),
-                  &hKey) != ERROR_SUCCESS)
-    {
-    return false;
-    }
-  else
-    {
-    DWORD dwType, dwSize;
-    dwSize = 1023;
-    wchar_t data[1024];
-    if(RegQueryValueExW(hKey,
-                       Encoding::ToWide(valuename).c_str(),
-                       NULL,
-                       &dwType,
-                       (BYTE *)data,
-                       &dwSize) == ERROR_SUCCESS)
-      {
-      if (dwType == REG_SZ)
-        {
-        value = Encoding::ToNarrow(data);
-        valueset = true;
-        }
-      else if (dwType == REG_EXPAND_SZ)
-        {
-        wchar_t expanded[1024];
-        DWORD dwExpandedSize = sizeof(expanded)/sizeof(expanded[0]);
-        if(ExpandEnvironmentStringsW(data, expanded,
-            dwExpandedSize))
-          {
-          value = Encoding::ToNarrow(expanded);
-          valueset = true;
-          }
-        }
-      }
-
-    RegCloseKey(hKey);
-    }
-
-  return valueset;
-}
-#else
-bool SystemTools::ReadRegistryValue(const kwsys_stl::string&, kwsys_stl::string &,
-                                    KeyWOW64)
-{
-  return false;
-}
-#endif
-
-
-// Write a registry value.
-// Example :
-//      HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.1\InstallPath
-//      =>  will set the data of the "default" value of the key
-//      HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.4;Root
-//      =>  will set the data of the "Root" value of the key
-
-#if defined(_WIN32) && !defined(__CYGWIN__)
-bool SystemTools::WriteRegistryValue(const kwsys_stl::string& key,
-                                     const kwsys_stl::string& value,
-                                     KeyWOW64 view)
-{
-  HKEY primaryKey = HKEY_CURRENT_USER;
-  kwsys_stl::string second;
-  kwsys_stl::string valuename;
-  if (!SystemToolsParseRegistryKey(key, primaryKey, second, valuename))
-    {
-    return false;
-    }
-
-  HKEY hKey;
-  DWORD dwDummy;
-  wchar_t lpClass[] = L"";
-  if(RegCreateKeyExW(primaryKey,
-                    Encoding::ToWide(second).c_str(),
-                    0,
-                    lpClass,
-                    REG_OPTION_NON_VOLATILE,
-                    SystemToolsMakeRegistryMode(KEY_WRITE, view),
-                    NULL,
-                    &hKey,
-                    &dwDummy) != ERROR_SUCCESS)
-    {
-    return false;
-    }
-
-  std::wstring wvalue = Encoding::ToWide(value);
-  if(RegSetValueExW(hKey,
-                   Encoding::ToWide(valuename).c_str(),
-                   0,
-                   REG_SZ,
-                   (CONST BYTE *)wvalue.c_str(),
-                   (DWORD)(sizeof(wchar_t) * (wvalue.size() + 1))) == ERROR_SUCCESS)
-    {
-    return true;
-    }
-  return false;
-}
-#else
-bool SystemTools::WriteRegistryValue(const kwsys_stl::string&, const kwsys_stl::string&, KeyWOW64)
-{
-  return false;
-}
-#endif
-
-// Delete a registry value.
-// Example :
-//      HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.1\InstallPath
-//      =>  will delete the data of the "default" value of the key
-//      HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.4;Root
-//      =>  will delete  the data of the "Root" value of the key
-
-#if defined(_WIN32) && !defined(__CYGWIN__)
-bool SystemTools::DeleteRegistryValue(const kwsys_stl::string& key, KeyWOW64 view)
-{
-  HKEY primaryKey = HKEY_CURRENT_USER;
-  kwsys_stl::string second;
-  kwsys_stl::string valuename;
-  if (!SystemToolsParseRegistryKey(key, primaryKey, second, valuename))
-    {
-    return false;
-    }
-
-  HKEY hKey;
-  if(RegOpenKeyExW(primaryKey,
-                  Encoding::ToWide(second).c_str(),
-                  0,
-                  SystemToolsMakeRegistryMode(KEY_WRITE, view),
-                  &hKey) != ERROR_SUCCESS)
-    {
-    return false;
-    }
-  else
-    {
-    if(RegDeleteValue(hKey,
-                      (LPTSTR)valuename.c_str()) == ERROR_SUCCESS)
-      {
-      RegCloseKey(hKey);
-      return true;
-      }
-    }
-  return false;
-}
-#else
-bool SystemTools::DeleteRegistryValue(const kwsys_stl::string&, KeyWOW64)
-{
-  return false;
-}
-#endif
-
-bool SystemTools::SameFile(const kwsys_stl::string& file1, const kwsys_stl::string& file2)
-{
-#ifdef _WIN32
-  HANDLE hFile1, hFile2;
-
-  hFile1 = CreateFileW( Encoding::ToWide(file1).c_str(),
-                      GENERIC_READ,
-                      FILE_SHARE_READ ,
-                      NULL,
-                      OPEN_EXISTING,
-                      FILE_FLAG_BACKUP_SEMANTICS,
-                      NULL
-    );
-  hFile2 = CreateFileW( Encoding::ToWide(file2).c_str(),
-                      GENERIC_READ,
-                      FILE_SHARE_READ,
-                      NULL,
-                      OPEN_EXISTING,
-                      FILE_FLAG_BACKUP_SEMANTICS,
-                      NULL
-    );
-  if( hFile1 == INVALID_HANDLE_VALUE || hFile2 == INVALID_HANDLE_VALUE)
-    {
-    if(hFile1 != INVALID_HANDLE_VALUE)
-      {
-      CloseHandle(hFile1);
-      }
-    if(hFile2 != INVALID_HANDLE_VALUE)
-      {
-      CloseHandle(hFile2);
-      }
-    return false;
-    }
-
-   BY_HANDLE_FILE_INFORMATION fiBuf1;
-   BY_HANDLE_FILE_INFORMATION fiBuf2;
-   GetFileInformationByHandle( hFile1, &fiBuf1 );
-   GetFileInformationByHandle( hFile2, &fiBuf2 );
-   CloseHandle(hFile1);
-   CloseHandle(hFile2);
-   return (fiBuf1.dwVolumeSerialNumber == fiBuf2.dwVolumeSerialNumber &&
-           fiBuf1.nFileIndexHigh == fiBuf2.nFileIndexHigh &&
-           fiBuf1.nFileIndexLow == fiBuf2.nFileIndexLow);
-#else
-  struct stat fileStat1, fileStat2;
-  if (stat(file1.c_str(), &fileStat1) == 0 && stat(file2.c_str(), &fileStat2) == 0)
-    {
-    // see if the files are the same file
-    // check the device inode and size
-    if(memcmp(&fileStat2.st_dev, &fileStat1.st_dev, sizeof(fileStat1.st_dev)) == 0 &&
-       memcmp(&fileStat2.st_ino, &fileStat1.st_ino, sizeof(fileStat1.st_ino)) == 0 &&
-       fileStat2.st_size == fileStat1.st_size
-      )
-      {
-      return true;
-      }
-    }
-  return false;
-#endif
-}
-
-//----------------------------------------------------------------------------
-bool SystemTools::FileExists(const char* filename)
-{
-  if(!filename)
-    {
-    return false;
-    }
-  return SystemTools::FileExists(kwsys_stl::string(filename));
-}
-
-//----------------------------------------------------------------------------
-bool SystemTools::FileExists(const kwsys_stl::string& filename)
-{
-  if(filename.empty())
-    {
-    return false;
-    }
-#if defined(__CYGWIN__)
-  // Convert filename to native windows path if possible.
-  char winpath[MAX_PATH];
-  if(SystemTools::PathCygwinToWin32(filename.c_str(), winpath))
-    {
-    return (GetFileAttributesA(winpath) != INVALID_FILE_ATTRIBUTES);
-    }
-  return access(filename.c_str(), R_OK) == 0;
-#elif defined(_WIN32)
-  return (GetFileAttributesW(
-            SystemTools::ConvertToWindowsExtendedPath(filename).c_str())
-          != INVALID_FILE_ATTRIBUTES);
-#else
-  return access(filename.c_str(), R_OK) == 0;
-#endif
-}
-
-//----------------------------------------------------------------------------
-bool SystemTools::FileExists(const char* filename, bool isFile)
-{
-  if(SystemTools::FileExists(filename))
-    {
-    // If isFile is set return not FileIsDirectory,
-    // so this will only be true if it is a file
-    return !isFile || !SystemTools::FileIsDirectory(filename);
-    }
-  return false;
-}
-
-//----------------------------------------------------------------------------
-bool SystemTools::FileExists(const kwsys_stl::string& filename, bool isFile)
-{
-  if(SystemTools::FileExists(filename))
-    {
-    // If isFile is set return not FileIsDirectory,
-    // so this will only be true if it is a file
-    return !isFile || !SystemTools::FileIsDirectory(filename);
-    }
-  return false;
-}
-
-//----------------------------------------------------------------------------
-#ifdef __CYGWIN__
-bool SystemTools::PathCygwinToWin32(const char *path, char *win32_path)
-{
-  SystemToolsTranslationMap::iterator i =
-    SystemTools::Cyg2Win32Map->find(path);
-
-  if (i != SystemTools::Cyg2Win32Map->end())
-    {
-    strncpy(win32_path, i->second.c_str(), MAX_PATH);
-    }
-  else
-    {
-    if(cygwin_conv_path(CCP_POSIX_TO_WIN_A, path, win32_path, MAX_PATH) != 0)
-      {
-      win32_path[0] = 0;
-      }
-    SystemToolsTranslationMap::value_type entry(path, win32_path);
-    SystemTools::Cyg2Win32Map->insert(entry);
-    }
-  return win32_path[0] != 0;
-}
-#endif
-
-bool SystemTools::Touch(const kwsys_stl::string& filename, bool create)
-{
-  if(create && !SystemTools::FileExists(filename))
-    {
-    FILE* file = Fopen(filename, "a+b");
-    if(file)
-      {
-      fclose(file);
-      return true;
-      }
-    return false;
-    }
-#if defined(_WIN32) && !defined(__CYGWIN__)
-  HANDLE h = CreateFileW(
-    SystemTools::ConvertToWindowsExtendedPath(filename).c_str(),
-    FILE_WRITE_ATTRIBUTES,
-    FILE_SHARE_WRITE, 0, OPEN_EXISTING,
-    FILE_FLAG_BACKUP_SEMANTICS, 0);
-  if(!h)
-    {
-    return false;
-    }
-  FILETIME mtime;
-  GetSystemTimeAsFileTime(&mtime);
-  if(!SetFileTime(h, 0, 0, &mtime))
-    {
-    CloseHandle(h);
-    return false;
-    }
-  CloseHandle(h);
-#elif KWSYS_CXX_HAS_UTIMENSAT
-  struct timespec times[2] = {{0,UTIME_OMIT},{0,UTIME_NOW}};
-  if(utimensat(AT_FDCWD, filename.c_str(), times, 0) < 0)
-    {
-    return false;
-    }
-#else
-  struct stat st;
-  if(stat(filename.c_str(), &st) < 0)
-    {
-    return false;
-    }
-  struct timeval mtime;
-  gettimeofday(&mtime, 0);
-# if KWSYS_CXX_HAS_UTIMES
-  struct timeval times[2] =
-    {
-#  if KWSYS_STAT_HAS_ST_MTIM
-      {st.st_atim.tv_sec, st.st_atim.tv_nsec/1000}, /* tv_sec, tv_usec */
-#  else
-      {st.st_atime, 0},
-#  endif
-      mtime
-    };
-  if(utimes(filename.c_str(), times) < 0)
-    {
-    return false;
-    }
-# else
-  struct utimbuf times = {st.st_atime, mtime.tv_sec};
-  if(utime(filename.c_str(), &times) < 0)
-    {
-    return false;
-    }
-# endif
-#endif
-  return true;
-}
-
-bool SystemTools::FileTimeCompare(const kwsys_stl::string& f1,
-                                  const kwsys_stl::string& f2,
-                                  int* result)
-{
-  // Default to same time.
-  *result = 0;
-#if !defined(_WIN32) || defined(__CYGWIN__)
-  // POSIX version.  Use stat function to get file modification time.
-  struct stat s1;
-  if(stat(f1.c_str(), &s1) != 0)
-    {
-    return false;
-    }
-  struct stat s2;
-  if(stat(f2.c_str(), &s2) != 0)
-    {
-    return false;
-    }
-# if KWSYS_STAT_HAS_ST_MTIM
-  // Compare using nanosecond resolution.
-  if(s1.st_mtim.tv_sec < s2.st_mtim.tv_sec)
-    {
-    *result = -1;
-    }
-  else if(s1.st_mtim.tv_sec > s2.st_mtim.tv_sec)
-    {
-    *result = 1;
-    }
-  else if(s1.st_mtim.tv_nsec < s2.st_mtim.tv_nsec)
-    {
-    *result = -1;
-    }
-  else if(s1.st_mtim.tv_nsec > s2.st_mtim.tv_nsec)
-    {
-    *result = 1;
-    }
-# else
-  // Compare using 1 second resolution.
-  if(s1.st_mtime < s2.st_mtime)
-    {
-    *result = -1;
-    }
-  else if(s1.st_mtime > s2.st_mtime)
-    {
-    *result = 1;
-    }
-# endif
-#else
-  // Windows version.  Get the modification time from extended file attributes.
-  WIN32_FILE_ATTRIBUTE_DATA f1d;
-  WIN32_FILE_ATTRIBUTE_DATA f2d;
-  if(!GetFileAttributesExW(
-       SystemTools::ConvertToWindowsExtendedPath(f1).c_str(),
-       GetFileExInfoStandard, &f1d))
-    {
-    return false;
-    }
-  if(!GetFileAttributesExW(
-       SystemTools::ConvertToWindowsExtendedPath(f2).c_str(),
-       GetFileExInfoStandard, &f2d))
-    {
-    return false;
-    }
-
-  // Compare the file times using resolution provided by system call.
-  *result = (int)CompareFileTime(&f1d.ftLastWriteTime, &f2d.ftLastWriteTime);
-#endif
-  return true;
-}
-
-
-// Return a capitalized string (i.e the first letter is uppercased, all other
-// are lowercased)
-kwsys_stl::string SystemTools::Capitalized(const kwsys_stl::string& s)
-{
-  kwsys_stl::string n;
-  if(s.empty())
-    {
-    return n;
-    }
-  n.resize(s.size());
-  n[0] = static_cast<kwsys_stl::string::value_type>(toupper(s[0]));
-  for (size_t i = 1; i < s.size(); i++)
-    {
-    n[i] = static_cast<kwsys_stl::string::value_type>(tolower(s[i]));
-    }
-  return n;
-}
-
-// Return capitalized words
-kwsys_stl::string SystemTools::CapitalizedWords(const kwsys_stl::string& s)
-{
-  kwsys_stl::string n(s);
-  for (size_t i = 0; i < s.size(); i++)
-    {
-#if defined(_MSC_VER) && defined (_MT) && defined (_DEBUG)
-    // MS has an assert that will fail if s[i] < 0; setting
-    // LC_CTYPE using setlocale() does *not* help. Painful.
-    if ((int)s[i] >= 0 && isalpha(s[i]) &&
-        (i == 0 || ((int)s[i - 1] >= 0 && isspace(s[i - 1]))))
-#else
-    if (isalpha(s[i]) && (i == 0 || isspace(s[i - 1])))
-#endif
-      {
-      n[i] = static_cast<kwsys_stl::string::value_type>(toupper(s[i]));
-      }
-    }
-  return n;
-}
-
-// Return uncapitalized words
-kwsys_stl::string SystemTools::UnCapitalizedWords(const kwsys_stl::string& s)
-{
-  kwsys_stl::string n(s);
-  for (size_t i = 0; i < s.size(); i++)
-    {
-#if defined(_MSC_VER) && defined (_MT) && defined (_DEBUG)
-    // MS has an assert that will fail if s[i] < 0; setting
-    // LC_CTYPE using setlocale() does *not* help. Painful.
-    if ((int)s[i] >= 0 && isalpha(s[i]) &&
-        (i == 0 || ((int)s[i - 1] >= 0 && isspace(s[i - 1]))))
-#else
-    if (isalpha(s[i]) && (i == 0 || isspace(s[i - 1])))
-#endif
-      {
-      n[i] = static_cast<kwsys_stl::string::value_type>(tolower(s[i]));
-      }
-    }
-  return n;
-}
-
-// only works for words with at least two letters
-kwsys_stl::string SystemTools::AddSpaceBetweenCapitalizedWords(
-  const kwsys_stl::string& s)
-{
-  kwsys_stl::string n;
-  if (!s.empty())
-    {
-    n.reserve(s.size());
-    n += s[0];
-    for (size_t i = 1; i < s.size(); i++)
-      {
-      if (isupper(s[i]) && !isspace(s[i - 1]) && !isupper(s[i - 1]))
-        {
-        n += ' ';
-        }
-      n += s[i];
-      }
-    }
-  return n;
-}
-
-char* SystemTools::AppendStrings(const char* str1, const char* str2)
-{
-  if (!str1)
-    {
-    return SystemTools::DuplicateString(str2);
-    }
-  if (!str2)
-    {
-    return SystemTools::DuplicateString(str1);
-    }
-  size_t len1 = strlen(str1);
-  char *newstr = new char[len1 + strlen(str2) + 1];
-  if (!newstr)
-    {
-    return 0;
-    }
-  strcpy(newstr, str1);
-  strcat(newstr + len1, str2);
-  return newstr;
-}
-
-char* SystemTools::AppendStrings(
-  const char* str1, const char* str2, const char* str3)
-{
-  if (!str1)
-    {
-    return SystemTools::AppendStrings(str2, str3);
-    }
-  if (!str2)
-    {
-    return SystemTools::AppendStrings(str1, str3);
-    }
-  if (!str3)
-    {
-    return SystemTools::AppendStrings(str1, str2);
-    }
-
-  size_t len1 = strlen(str1), len2 = strlen(str2);
-  char *newstr = new char[len1 + len2 + strlen(str3) + 1];
-  if (!newstr)
-    {
-    return 0;
-    }
-  strcpy(newstr, str1);
-  strcat(newstr + len1, str2);
-  strcat(newstr + len1 + len2, str3);
-  return newstr;
-}
-
-// Return a lower case string
-kwsys_stl::string SystemTools::LowerCase(const kwsys_stl::string& s)
-{
-  kwsys_stl::string n;
-  n.resize(s.size());
-  for (size_t i = 0; i < s.size(); i++)
-    {
-    n[i] = static_cast<kwsys_stl::string::value_type>(tolower(s[i]));
-    }
-  return n;
-}
-
-// Return a lower case string
-kwsys_stl::string SystemTools::UpperCase(const kwsys_stl::string& s)
-{
-  kwsys_stl::string n;
-  n.resize(s.size());
-  for (size_t i = 0; i < s.size(); i++)
-    {
-    n[i] = static_cast<kwsys_stl::string::value_type>(toupper(s[i]));
-    }
-  return n;
-}
-
-// Count char in string
-size_t SystemTools::CountChar(const char* str, char c)
-{
-  size_t count = 0;
-
-  if (str)
-    {
-    while (*str)
-      {
-      if (*str == c)
-        {
-        ++count;
-        }
-      ++str;
-      }
-    }
-  return count;
-}
-
-// Remove chars in string
-char* SystemTools::RemoveChars(const char* str, const char *toremove)
-{
-  if (!str)
-    {
-    return NULL;
-    }
-  char *clean_str = new char [strlen(str) + 1];
-  char *ptr = clean_str;
-  while (*str)
-    {
-    const char *str2 = toremove;
-    while (*str2 && *str != *str2)
-      {
-      ++str2;
-      }
-    if (!*str2)
-      {
-      *ptr++ = *str;
-      }
-    ++str;
-    }
-  *ptr = '\0';
-  return clean_str;
-}
-
-// Remove chars in string
-char* SystemTools::RemoveCharsButUpperHex(const char* str)
-{
-  if (!str)
-    {
-    return 0;
-    }
-  char *clean_str = new char [strlen(str) + 1];
-  char *ptr = clean_str;
-  while (*str)
-    {
-    if ((*str >= '0' && *str <= '9') || (*str >= 'A' && *str <= 'F'))
-      {
-      *ptr++ = *str;
-      }
-    ++str;
-    }
-  *ptr = '\0';
-  return clean_str;
-}
-
-// Replace chars in string
-char* SystemTools::ReplaceChars(char* str, const char *toreplace, char replacement)
-{
-  if (str)
-    {
-    char *ptr = str;
-    while (*ptr)
-      {
-      const char *ptr2 = toreplace;
-      while (*ptr2)
-        {
-        if (*ptr == *ptr2)
-          {
-          *ptr = replacement;
-          }
-        ++ptr2;
-        }
-      ++ptr;
-      }
-    }
-  return str;
-}
-
-// Returns if string starts with another string
-bool SystemTools::StringStartsWith(const char* str1, const char* str2)
-{
-  if (!str1 || !str2)
-    {
-    return false;
-    }
-  size_t len1 = strlen(str1), len2 = strlen(str2);
-  return len1 >= len2 && !strncmp(str1, str2, len2) ? true : false;
-}
-
-// Returns if string starts with another string
-bool SystemTools::StringStartsWith(const kwsys_stl::string& str1, const char* str2)
-{
-  if (!str2)
-    {
-    return false;
-    }
-  size_t len1 = str1.size(), len2 = strlen(str2);
-  return len1 >= len2 && !strncmp(str1.c_str(), str2, len2) ? true : false;
-}
-
-// Returns if string ends with another string
-bool SystemTools::StringEndsWith(const char* str1, const char* str2)
-{
-  if (!str1 || !str2)
-    {
-    return false;
-    }
-  size_t len1 = strlen(str1), len2 = strlen(str2);
-  return len1 >= len2 &&  !strncmp(str1 + (len1 - len2), str2, len2) ? true : false;
-}
-
-// Returns if string ends with another string
-bool SystemTools::StringEndsWith(const kwsys_stl::string& str1, const char* str2)
-{
-  if (!str2)
-    {
-    return false;
-    }
-  size_t len1 = str1.size(), len2 = strlen(str2);
-  return len1 >= len2 &&  !strncmp(str1.c_str() + (len1 - len2), str2, len2) ? true : false;
-}
-
-// Returns a pointer to the last occurence of str2 in str1
-const char* SystemTools::FindLastString(const char* str1, const char* str2)
-{
-  if (!str1 || !str2)
-    {
-    return NULL;
-    }
-
-  size_t len1 = strlen(str1), len2 = strlen(str2);
-  if (len1 >= len2)
-    {
-    const char *ptr = str1 + len1 - len2;
-    do
-      {
-      if (!strncmp(ptr, str2, len2))
-        {
-        return ptr;
-        }
-      } while (ptr-- != str1);
-    }
-
-  return NULL;
-}
-
-// Duplicate string
-char* SystemTools::DuplicateString(const char* str)
-{
-  if (str)
-    {
-    char *newstr = new char [strlen(str) + 1];
-    return strcpy(newstr, str);
-    }
-  return NULL;
-}
-
-// Return a cropped string
-kwsys_stl::string SystemTools::CropString(const kwsys_stl::string& s,
-                                          size_t max_len)
-{
-  if (!s.size() || max_len == 0 || max_len >= s.size())
-    {
-    return s;
-    }
-
-  kwsys_stl::string n;
-  n.reserve(max_len);
-
-  size_t middle = max_len / 2;
-
-  n += s.substr(0, middle);
-  n += s.substr(s.size() - (max_len - middle), kwsys_stl::string::npos);
-
-  if (max_len > 2)
-    {
-    n[middle] = '.';
-    if (max_len > 3)
-      {
-      n[middle - 1] = '.';
-      if (max_len > 4)
-        {
-        n[middle + 1] = '.';
-        }
-      }
-    }
-
-  return n;
-}
-
-//----------------------------------------------------------------------------
-kwsys_stl::vector<kwsys::String> SystemTools::SplitString(const kwsys_stl::string& p, char sep, bool isPath)
-{
-  kwsys_stl::string path = p;
-  kwsys_stl::vector<kwsys::String> paths;
-  if(path.empty())
-    {
-    return paths;
-    }
-  if(isPath && path[0] == '/')
-    {
-    path.erase(path.begin());
-    paths.push_back("/");
-    }
-  kwsys_stl::string::size_type pos1 = 0;
-  kwsys_stl::string::size_type pos2 = path.find(sep, pos1+1);
-  while(pos2 != kwsys_stl::string::npos)
-    {
-    paths.push_back(path.substr(pos1, pos2-pos1));
-    pos1 = pos2+1;
-    pos2 = path.find(sep, pos1+1);
-    }
-  paths.push_back(path.substr(pos1, pos2-pos1));
-
-  return paths;
-}
-
-//----------------------------------------------------------------------------
-int SystemTools::EstimateFormatLength(const char *format, va_list ap)
-{
-  if (!format)
-    {
-    return 0;
-    }
-
-  // Quick-hack attempt at estimating the length of the string.
-  // Should never under-estimate.
-
-  // Start with the length of the format string itself.
-
-  size_t length = strlen(format);
-
-  // Increase the length for every argument in the format.
-
-  const char* cur = format;
-  while(*cur)
-    {
-    if(*cur++ == '%')
-      {
-      // Skip "%%" since it doesn't correspond to a va_arg.
-      if(*cur != '%')
-        {
-        while(!int(isalpha(*cur)))
-          {
-          ++cur;
-          }
-        switch (*cur)
-          {
-          case 's':
-          {
-          // Check the length of the string.
-          char* s = va_arg(ap, char*);
-          if(s)
-            {
-            length += strlen(s);
-            }
-          } break;
-          case 'e':
-          case 'f':
-          case 'g':
-          {
-          // Assume the argument contributes no more than 64 characters.
-          length += 64;
-
-          // Eat the argument.
-          static_cast<void>(va_arg(ap, double));
-          } break;
-          default:
-          {
-          // Assume the argument contributes no more than 64 characters.
-          length += 64;
-
-          // Eat the argument.
-          static_cast<void>(va_arg(ap, int));
-          } break;
-          }
-        }
-
-      // Move past the characters just tested.
-      ++cur;
-      }
-    }
-
-  return static_cast<int>(length);
-}
-
-kwsys_stl::string SystemTools::EscapeChars(
-  const char *str,
-  const char *chars_to_escape,
-  char escape_char)
-{
-  kwsys_stl::string n;
-  if (str)
-    {
-    if (!chars_to_escape || !*chars_to_escape)
-      {
-      n.append(str);
-      }
-    else
-      {
-      n.reserve(strlen(str));
-      while (*str)
-        {
-        const char *ptr = chars_to_escape;
-        while (*ptr)
-          {
-          if (*str == *ptr)
-            {
-            n += escape_char;
-            break;
-            }
-          ++ptr;
-          }
-        n += *str;
-        ++str;
-        }
-      }
-    }
-  return n;
-}
-
-#ifdef __VMS
-static void ConvertVMSToUnix(kwsys_stl::string& path)
-{
-  kwsys_stl::string::size_type rootEnd = path.find(":[");
-  kwsys_stl::string::size_type pathEnd = path.find("]");
-  if(rootEnd != path.npos)
-    {
-    kwsys_stl::string root = path.substr(0, rootEnd);
-    kwsys_stl::string pathPart = path.substr(rootEnd+2, pathEnd - rootEnd-2);
-    const char* pathCString = pathPart.c_str();
-    const char* pos0 = pathCString;
-    for (kwsys_stl::string::size_type pos = 0; *pos0; ++ pos )
-      {
-      if ( *pos0 == '.' )
-        {
-        pathPart[pos] = '/';
-        }
-      pos0 ++;
-      }
-    path = "/"+ root + "/" + pathPart;
-    }
-}
-#endif
-
-// convert windows slashes to unix slashes
-void SystemTools::ConvertToUnixSlashes(kwsys_stl::string& path)
-{
-  const char* pathCString = path.c_str();
-  bool hasDoubleSlash = false;
-#ifdef __VMS
-  ConvertVMSToUnix(path);
-#else
-  const char* pos0 = pathCString;
-  const char* pos1 = pathCString+1;
-  for (kwsys_stl::string::size_type pos = 0; *pos0; ++ pos )
-    {
-    // make sure we don't convert an escaped space to a unix slash
-    if ( *pos0 == '\\' && *pos1 != ' ' )
-      {
-      path[pos] = '/';
-      }
-
-    // Also, reuse the loop to check for slash followed by another slash
-    if (*pos1 == '/' && *(pos1+1) == '/' && !hasDoubleSlash)
-      {
-#ifdef _WIN32
-      // However, on windows if the first characters are both slashes,
-      // then keep them that way, so that network paths can be handled.
-      if ( pos > 0)
-        {
-        hasDoubleSlash = true;
-        }
-#else
-      hasDoubleSlash = true;
-#endif
-      }
-
-    pos0 ++;
-    pos1 ++;
-    }
-
-  if ( hasDoubleSlash )
-    {
-    SystemTools::ReplaceString(path, "//", "/");
-    }
-#endif
-  // remove any trailing slash
-  if(!path.empty())
-    {
-    // if there is a tilda ~ then replace it with HOME
-    pathCString = path.c_str();
-    if(pathCString[0] == '~' && (pathCString[1] == '/' || pathCString[1] == '\0'))
-      {
-      const char* homeEnv = SystemTools::GetEnv("HOME");
-      if (homeEnv)
-        {
-        path.replace(0,1,homeEnv);
-        }
-      }
-#ifdef HAVE_GETPWNAM
-    else if(pathCString[0] == '~')
-      {
-      kwsys_stl::string::size_type idx = path.find_first_of("/\0");
-      kwsys_stl::string user = path.substr(1, idx-1);
-      passwd* pw = getpwnam(user.c_str());
-      if(pw)
-        {
-        path.replace(0, idx, pw->pw_dir);
-        }
-      }
-#endif
-    // remove trailing slash if the path is more than
-    // a single /
-    pathCString = path.c_str();
-    size_t size = path.size();
-    if(size > 1 && *path.rbegin() == '/')
-      {
-      // if it is c:/ then do not remove the trailing slash
-      if(!((size == 3 && pathCString[1] == ':')))
-        {
-        path.resize(size - 1);
-        }
-      }
-    }
-}
-
-#ifdef _WIN32
-// Convert local paths to UNC style paths
-kwsys_stl::wstring
-SystemTools::ConvertToWindowsExtendedPath(const kwsys_stl::string &source)
-{
-  kwsys_stl::wstring wsource = Encoding::ToWide(source);
-
-  // Resolve any relative paths
-  DWORD wfull_len;
-
-  /* The +3 is a workaround for a bug in some versions of GetFullPathNameW that
-   * won't return a large enough buffer size if the input is too small */
-  wfull_len = GetFullPathNameW(wsource.c_str(), 0, NULL, NULL) + 3;
-  kwsys_stl::vector<wchar_t> wfull(wfull_len);
-  GetFullPathNameW(wsource.c_str(), wfull_len, &wfull[0], NULL);
-
-  /* This should get the correct size without any extra padding from the
-   * previous size workaround. */
-  wfull_len = static_cast<DWORD>(wcslen(&wfull[0]));
-
-  if(wfull_len >= 2 && isalpha(wfull[0]) && wfull[1] == L':')
-    { /* C:\Foo\bar\FooBar.txt */
-    return L"\\\\?\\" + kwsys_stl::wstring(&wfull[0]);
-    }
-  else if(wfull_len >= 2 && wfull[0] == L'\\' && wfull[1] == L'\\')
-    { /* Starts with \\ */
-    if(wfull_len >= 4 && wfull[2] == L'?' && wfull[3] == L'\\')
-      { /* Starts with \\?\ */
-      if(wfull_len >= 8 && wfull[4] == L'U' && wfull[5] == L'N' &&
-                           wfull[6] == L'C' && wfull[7] == L'\\')
-        { /* \\?\UNC\Foo\bar\FooBar.txt */
-        return kwsys_stl::wstring(&wfull[0]);
-        }
-      else if(wfull_len >= 6 && isalpha(wfull[4]) && wfull[5] == L':')
-        { /* \\?\C:\Foo\bar\FooBar.txt */
-        return kwsys_stl::wstring(&wfull[0]);
-        }
-      else if(wfull_len >= 5)
-        { /* \\?\Foo\bar\FooBar.txt */
-        return L"\\\\?\\UNC\\" + kwsys_stl::wstring(&wfull[4]);
-        }
-      }
-    else if(wfull_len >= 4 && wfull[2] == L'.' && wfull[3] == L'\\')
-      { /* Starts with \\.\ a device name */
-      if(wfull_len >= 6 && isalpha(wfull[4]) && wfull[5] == L':')
-        { /* \\.\C:\Foo\bar\FooBar.txt */
-        return L"\\\\?\\" + kwsys_stl::wstring(&wfull[4]);
-        }
-      else if(wfull_len >= 5)
-        { /* \\.\Foo\bar\ Device name is left unchanged */
-        return kwsys_stl::wstring(&wfull[0]);
-        }
-      }
-    else if(wfull_len >= 3)
-      { /* \\Foo\bar\FooBar.txt */
-      return L"\\\\?\\UNC\\" + kwsys_stl::wstring(&wfull[2]);
-      }
-    }
-
-  // If this case has been reached, then the path is invalid.  Leave it
-  // unchanged
-  return Encoding::ToWide(source);
-}
-#endif
-
-// change // to /, and escape any spaces in the path
-kwsys_stl::string SystemTools::ConvertToUnixOutputPath(const kwsys_stl::string& path)
-{
-  kwsys_stl::string ret = path;
-
-  // remove // except at the beginning might be a cygwin drive
-  kwsys_stl::string::size_type pos=1;
-  while((pos = ret.find("//", pos)) != kwsys_stl::string::npos)
-    {
-    ret.erase(pos, 1);
-    }
-  // escape spaces and () in the path
-  if(ret.find_first_of(" ") != kwsys_stl::string::npos)
-    {
-    kwsys_stl::string result = "";
-    char lastch = 1;
-    for(const char* ch = ret.c_str(); *ch != '\0'; ++ch)
-      {
-        // if it is already escaped then don't try to escape it again
-      if((*ch == ' ') && lastch != '\\')
-        {
-        result += '\\';
-        }
-      result += *ch;
-      lastch = *ch;
-      }
-    ret = result;
-    }
-  return ret;
-}
-
-kwsys_stl::string SystemTools::ConvertToOutputPath(const kwsys_stl::string& path)
-{
-#if defined(_WIN32) && !defined(__CYGWIN__)
-  return SystemTools::ConvertToWindowsOutputPath(path);
-#else
-  return SystemTools::ConvertToUnixOutputPath(path);
-#endif
-}
-
-// remove double slashes not at the start
-kwsys_stl::string SystemTools::ConvertToWindowsOutputPath(const kwsys_stl::string& path)
-{
-  kwsys_stl::string ret;
-  // make it big enough for all of path and double quotes
-  ret.reserve(path.size()+3);
-  // put path into the string
-  ret = path;
-  kwsys_stl::string::size_type pos = 0;
-  // first convert all of the slashes
-  while((pos = ret.find('/', pos)) != kwsys_stl::string::npos)
-    {
-    ret[pos] = '\\';
-    pos++;
-    }
-  // check for really small paths
-  if(ret.size() < 2)
-    {
-    return ret;
-    }
-  // now clean up a bit and remove double slashes
-  // Only if it is not the first position in the path which is a network
-  // path on windows
-  pos = 1; // start at position 1
-  if(ret[0] == '\"')
-    {
-    pos = 2;  // if the string is already quoted then start at 2
-    if(ret.size() < 3)
-      {
-      return ret;
-      }
-    }
-  while((pos = ret.find("\\\\", pos)) != kwsys_stl::string::npos)
-    {
-    ret.erase(pos, 1);
-    }
-  // now double quote the path if it has spaces in it
-  // and is not already double quoted
-  if(ret.find(' ') != kwsys_stl::string::npos
-     && ret[0] != '\"')
-    {
-    ret.insert(static_cast<kwsys_stl::string::size_type>(0),
-               static_cast<kwsys_stl::string::size_type>(1), '\"');
-    ret.append(1, '\"');
-    }
-  return ret;
-}
-
-bool SystemTools::CopyFileIfDifferent(const kwsys_stl::string& source,
-                                      const kwsys_stl::string& destination)
-{
-  // special check for a destination that is a directory
-  // FilesDiffer does not handle file to directory compare
-  if(SystemTools::FileIsDirectory(destination))
-    {
-    kwsys_stl::string new_destination = destination;
-    SystemTools::ConvertToUnixSlashes(new_destination);
-    new_destination += '/';
-    kwsys_stl::string source_name = source;
-    new_destination += SystemTools::GetFilenameName(source_name);
-    if(SystemTools::FilesDiffer(source, new_destination))
-      {
-      return SystemTools::CopyFileAlways(source, destination);
-      }
-    else
-      {
-      // the files are the same so the copy is done return
-      // true
-      return true;
-      }
-    }
-  // source and destination are files so do a copy if they
-  // are different
-  if(SystemTools::FilesDiffer(source, destination))
-    {
-    return SystemTools::CopyFileAlways(source, destination);
-    }
-  // at this point the files must be the same so return true
-  return true;
-}
-
-#define KWSYS_ST_BUFFER 4096
-
-bool SystemTools::FilesDiffer(const kwsys_stl::string& source,
-                              const kwsys_stl::string& destination)
-{
-
-#if defined(_WIN32)
-  WIN32_FILE_ATTRIBUTE_DATA statSource;
-  if (GetFileAttributesExW(
-        SystemTools::ConvertToWindowsExtendedPath(source).c_str(),
-        GetFileExInfoStandard,
-        &statSource) == 0)
-    {
-    return true;
-    }
-
-  WIN32_FILE_ATTRIBUTE_DATA statDestination;
-  if (GetFileAttributesExW(
-        SystemTools::ConvertToWindowsExtendedPath(destination).c_str(),
-        GetFileExInfoStandard,
-        &statDestination) == 0)
-    {
-    return true;
-    }
-
-  if(statSource.nFileSizeHigh != statDestination.nFileSizeHigh ||
-     statSource.nFileSizeLow != statDestination.nFileSizeLow)
-    {
-    return true;
-    }
-
-  if(statSource.nFileSizeHigh == 0 && statSource.nFileSizeLow == 0)
-    {
-    return false;
-    }
-  off_t nleft = ((__int64)statSource.nFileSizeHigh << 32) +
-                statSource.nFileSizeLow;
-
-#else
-
-  struct stat statSource;
-  if (stat(source.c_str(), &statSource) != 0)
-    {
-    return true;
-    }
-
-  struct stat statDestination;
-  if (stat(destination.c_str(), &statDestination) != 0)
-    {
-    return true;
-    }
-
-  if(statSource.st_size != statDestination.st_size)
-    {
-    return true;
-    }
-
-  if(statSource.st_size == 0)
-    {
-    return false;
-    }
-  off_t nleft = statSource.st_size;
-#endif
-
-#if defined(_WIN32)
-  kwsys::ifstream finSource(source.c_str(),
-                            (kwsys_ios::ios::binary |
-                             kwsys_ios::ios::in));
-  kwsys::ifstream finDestination(destination.c_str(),
-                                 (kwsys_ios::ios::binary |
-                                  kwsys_ios::ios::in));
-#else
-  kwsys::ifstream finSource(source.c_str());
-  kwsys::ifstream finDestination(destination.c_str());
-#endif
-  if(!finSource || !finDestination)
-    {
-    return true;
-    }
-
-  // Compare the files a block at a time.
-  char source_buf[KWSYS_ST_BUFFER];
-  char dest_buf[KWSYS_ST_BUFFER];
-  while(nleft > 0)
-    {
-    // Read a block from each file.
-    kwsys_ios::streamsize nnext = (nleft > KWSYS_ST_BUFFER)? KWSYS_ST_BUFFER : static_cast<kwsys_ios::streamsize>(nleft);
-    finSource.read(source_buf, nnext);
-    finDestination.read(dest_buf, nnext);
-
-    // If either failed to read assume they are different.
-    if(static_cast<kwsys_ios::streamsize>(finSource.gcount()) != nnext ||
-       static_cast<kwsys_ios::streamsize>(finDestination.gcount()) != nnext)
-      {
-      return true;
-      }
-
-    // If this block differs the file differs.
-    if(memcmp(static_cast<const void*>(source_buf),
-              static_cast<const void*>(dest_buf),
-              static_cast<size_t>(nnext)) != 0)
-      {
-      return true;
-      }
-
-    // Update the byte count remaining.
-    nleft -= nnext;
-    }
-
-  // No differences found.
-  return false;
-}
-
-
-//----------------------------------------------------------------------------
-/**
- * Copy a file named by "source" to the file named by "destination".
- */
-bool SystemTools::CopyFileAlways(const kwsys_stl::string& source, const kwsys_stl::string& destination)
-{
-  // If files are the same do not copy
-  if ( SystemTools::SameFile(source, destination) )
-    {
-    return true;
-    }
-  mode_t perm = 0;
-  bool perms = SystemTools::GetPermissions(source, perm);
-
-  const int bufferSize = 4096;
-  char buffer[bufferSize];
-
-  // If destination is a directory, try to create a file with the same
-  // name as the source in that directory.
-
-  kwsys_stl::string real_destination = destination;
-  kwsys_stl::string destination_dir;
-  if(SystemTools::FileExists(destination) &&
-     SystemTools::FileIsDirectory(destination))
-    {
-    destination_dir = real_destination;
-    SystemTools::ConvertToUnixSlashes(real_destination);
-    real_destination += '/';
-    kwsys_stl::string source_name = source;
-    real_destination += SystemTools::GetFilenameName(source_name);
-    }
-  else
-    {
-    destination_dir = SystemTools::GetFilenamePath(destination);
-    }
-
-  // Create destination directory
-
-  SystemTools::MakeDirectory(destination_dir);
-
-  // Open files
-#if defined(_WIN32)
-  kwsys::ifstream fin(Encoding::ToNarrow(
-    SystemTools::ConvertToWindowsExtendedPath(source)).c_str(),
-                kwsys_ios::ios::in | kwsys_ios_binary);
-#else
-  kwsys::ifstream fin(source.c_str(),
-                kwsys_ios::ios::in | kwsys_ios_binary);
-#endif
-  if(!fin)
-    {
-    return false;
-    }
-
-  // try and remove the destination file so that read only destination files
-  // can be written to.
-  // If the remove fails continue so that files in read only directories
-  // that do not allow file removal can be modified.
-  SystemTools::RemoveFile(real_destination);
-
-#if defined(_WIN32)
-  kwsys::ofstream fout(Encoding::ToNarrow(
-    SystemTools::ConvertToWindowsExtendedPath(real_destination)).c_str(),
-                     kwsys_ios::ios::out | kwsys_ios::ios::trunc | kwsys_ios_binary);
-#else
-  kwsys::ofstream fout(real_destination.c_str(),
-                     kwsys_ios::ios::out | kwsys_ios::ios::trunc | kwsys_ios_binary);
-#endif
-  if(!fout)
-    {
-    return false;
-    }
-
-  // This copy loop is very sensitive on certain platforms with
-  // slightly broken stream libraries (like HPUX).  Normally, it is
-  // incorrect to not check the error condition on the fin.read()
-  // before using the data, but the fin.gcount() will be zero if an
-  // error occurred.  Therefore, the loop should be safe everywhere.
-  while(fin)
-    {
-    fin.read(buffer, bufferSize);
-    if(fin.gcount())
-      {
-      fout.write(buffer, fin.gcount());
-      }
-    }
-
-  // Make sure the operating system has finished writing the file
-  // before closing it.  This will ensure the file is finished before
-  // the check below.
-  fout.flush();
-
-  fin.close();
-  fout.close();
-
-  if(!fout)
-    {
-    return false;
-    }
-  if ( perms )
-    {
-    if ( !SystemTools::SetPermissions(real_destination, perm) )
-      {
-      return false;
-      }
-    }
-  return true;
-}
-
-//----------------------------------------------------------------------------
-bool SystemTools::CopyAFile(const kwsys_stl::string& source, const kwsys_stl::string& destination,
-                            bool always)
-{
-  if(always)
-    {
-    return SystemTools::CopyFileAlways(source, destination);
-    }
-  else
-    {
-    return SystemTools::CopyFileIfDifferent(source, destination);
-    }
-}
-
-/**
- * Copy a directory content from "source" directory to the directory named by
- * "destination".
- */
-bool SystemTools::CopyADirectory(const kwsys_stl::string& source, const kwsys_stl::string& destination,
-                                 bool always)
-{
-  Directory dir;
-#ifdef _WIN32
-  dir.Load(Encoding::ToNarrow(
-             SystemTools::ConvertToWindowsExtendedPath(source)));
-#else
-  dir.Load(source);
-#endif
-  size_t fileNum;
-  if ( !SystemTools::MakeDirectory(destination) )
-    {
-    return false;
-    }
-  for (fileNum = 0; fileNum <  dir.GetNumberOfFiles(); ++fileNum)
-    {
-    if (strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)),".") &&
-        strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)),".."))
-      {
-      kwsys_stl::string fullPath = source;
-      fullPath += "/";
-      fullPath += dir.GetFile(static_cast<unsigned long>(fileNum));
-      if(SystemTools::FileIsDirectory(fullPath))
-        {
-        kwsys_stl::string fullDestPath = destination;
-        fullDestPath += "/";
-        fullDestPath += dir.GetFile(static_cast<unsigned long>(fileNum));
-        if (!SystemTools::CopyADirectory(fullPath,
-                                         fullDestPath,
-                                         always))
-          {
-          return false;
-          }
-        }
-      else
-        {
-        if(!SystemTools::CopyAFile(fullPath, destination, always))
-          {
-          return false;
-          }
-        }
-      }
-    }
-
-  return true;
-}
-
-
-// return size of file; also returns zero if no file exists
-unsigned long SystemTools::FileLength(const kwsys_stl::string& filename)
-{
-  unsigned long length = 0;
-#ifdef _WIN32
-  WIN32_FILE_ATTRIBUTE_DATA fs;
-  if (GetFileAttributesExW(
-        SystemTools::ConvertToWindowsExtendedPath(filename).c_str(),
-        GetFileExInfoStandard, &fs) != 0)
-    {
-    /* To support the full 64-bit file size, use fs.nFileSizeHigh
-     * and fs.nFileSizeLow to construct the 64 bit size
-
-    length = ((__int64)fs.nFileSizeHigh << 32) + fs.nFileSizeLow;
-     */
-    length = static_cast<unsigned long>(fs.nFileSizeLow);
-    }
-#else
-  struct stat fs;
-  if (stat(filename.c_str(), &fs) == 0)
-    {
-    length = static_cast<unsigned long>(fs.st_size);
-    }
-#endif
-  return length;
-}
-
-int SystemTools::Strucmp(const char *s1, const char *s2)
-{
-  // lifted from Graphvis http://www.graphviz.org
-  while ((*s1 != '\0')
-         && (tolower(*s1) == tolower(*s2)))
-    {
-      s1++;
-      s2++;
-    }
-
-  return tolower(*s1) - tolower(*s2);
-}
-
-// return file's modified time
-long int SystemTools::ModifiedTime(const kwsys_stl::string& filename)
-{
-  long int mt = 0;
-#ifdef _WIN32
-  WIN32_FILE_ATTRIBUTE_DATA fs;
-  if (GetFileAttributesExW(
-        SystemTools::ConvertToWindowsExtendedPath(filename).c_str(),
-                           GetFileExInfoStandard,
-                           &fs) != 0)
-    {
-    mt = windows_filetime_to_posix_time(fs.ftLastWriteTime);
-    }
-#else
-  struct stat fs;
-  if (stat(filename.c_str(), &fs) == 0)
-    {
-    mt = static_cast<long int>(fs.st_mtime);
-    }
-#endif
-  return mt;
-}
-
-// return file's creation time
-long int SystemTools::CreationTime(const kwsys_stl::string& filename)
-{
-  long int ct = 0;
-#ifdef _WIN32
-  WIN32_FILE_ATTRIBUTE_DATA fs;
-  if (GetFileAttributesExW(
-        SystemTools::ConvertToWindowsExtendedPath(filename).c_str(),
-                           GetFileExInfoStandard,
-                           &fs) != 0)
-    {
-    ct = windows_filetime_to_posix_time(fs.ftCreationTime);
-    }
-#else
-  struct stat fs;
-  if (stat(filename.c_str(), &fs) == 0)
-    {
-    ct = fs.st_ctime >= 0 ? static_cast<long int>(fs.st_ctime) : 0;
-    }
-#endif
-  return ct;
-}
-
-bool SystemTools::ConvertDateMacroString(const char *str, time_t *tmt)
-{
-  if (!str || !tmt || strlen(str) > 11)
-    {
-    return false;
-    }
-
-  struct tm tmt2;
-
-  // __DATE__
-  // The compilation date of the current source file. The date is a string
-  // literal of the form Mmm dd yyyy. The month name Mmm is the same as for
-  // dates generated by the library function asctime declared in TIME.H.
-
-  // index:   012345678901
-  // format:  Mmm dd yyyy
-  // example: Dec 19 2003
-
-  static char month_names[] = "JanFebMarAprMayJunJulAugSepOctNovDec";
-
-  char buffer[12];
-  strcpy(buffer, str);
-
-  buffer[3] = 0;
-  char *ptr = strstr(month_names, buffer);
-  if (!ptr)
-    {
-    return false;
-    }
-
-  int month = static_cast<int>((ptr - month_names) / 3);
-  int day = atoi(buffer + 4);
-  int year = atoi(buffer + 7);
-
-  tmt2.tm_isdst = -1;
-  tmt2.tm_hour  = 0;
-  tmt2.tm_min   = 0;
-  tmt2.tm_sec   = 0;
-  tmt2.tm_wday  = 0;
-  tmt2.tm_yday  = 0;
-  tmt2.tm_mday  = day;
-  tmt2.tm_mon   = month;
-  tmt2.tm_year  = year - 1900;
-
-  *tmt = mktime(&tmt2);
-  return true;
-}
-
-bool SystemTools::ConvertTimeStampMacroString(const char *str, time_t *tmt)
-{
-  if (!str || !tmt || strlen(str) > 26)
-    {
-    return false;
-    }
-
-  struct tm tmt2;
-
-  // __TIMESTAMP__
-  // The date and time of the last modification of the current source file,
-  // expressed as a string literal in the form Ddd Mmm Date hh:mm:ss yyyy,
-  /// where Ddd is the abbreviated day of the week and Date is an integer
-  // from 1 to 31.
-
-  // index:   0123456789
-  //                    0123456789
-  //                              0123456789
-  // format:  Ddd Mmm Date hh:mm:ss yyyy
-  // example: Fri Dec 19 14:34:58 2003
-
-  static char month_names[] = "JanFebMarAprMayJunJulAugSepOctNovDec";
-
-  char buffer[27];
-  strcpy(buffer, str);
-
-  buffer[7] = 0;
-  char *ptr = strstr(month_names, buffer + 4);
-  if (!ptr)
-    {
-    return false;
-    }
-
-  int month = static_cast<int>((ptr - month_names) / 3);
-  int day = atoi(buffer + 8);
-  int hour = atoi(buffer + 11);
-  int min = atoi(buffer + 14);
-  int sec = atoi(buffer + 17);
-  int year = atoi(buffer + 20);
-
-  tmt2.tm_isdst = -1;
-  tmt2.tm_hour  = hour;
-  tmt2.tm_min   = min;
-  tmt2.tm_sec   = sec;
-  tmt2.tm_wday  = 0;
-  tmt2.tm_yday  = 0;
-  tmt2.tm_mday  = day;
-  tmt2.tm_mon   = month;
-  tmt2.tm_year  = year - 1900;
-
-  *tmt = mktime(&tmt2);
-  return true;
-}
-
-kwsys_stl::string SystemTools::GetLastSystemError()
-{
-  int e = errno;
-  return strerror(e);
-}
-
-bool SystemTools::RemoveFile(const kwsys_stl::string& source)
-{
-#ifdef _WIN32
-  mode_t mode;
-  if ( !SystemTools::GetPermissions(source, mode) )
-    {
-    return false;
-    }
-  /* Win32 unlink is stupid --- it fails if the file is read-only  */
-  SystemTools::SetPermissions(source, S_IWRITE);
-#endif
-#ifdef _WIN32
-  bool res =
-    _wunlink(SystemTools::ConvertToWindowsExtendedPath(source).c_str()) == 0;
-#else
-  bool res = unlink(source.c_str()) != 0 ? false : true;
-#endif
-#ifdef _WIN32
-  if ( !res )
-    {
-    SystemTools::SetPermissions(source, mode);
-    }
-#endif
-  return res;
-}
-
-bool SystemTools::RemoveADirectory(const kwsys_stl::string& source)
-{
-  // Add write permission to the directory so we can modify its
-  // content to remove files and directories from it.
-  mode_t mode;
-  if(SystemTools::GetPermissions(source, mode))
-    {
-#if defined(_WIN32) && !defined(__CYGWIN__)
-    mode |= S_IWRITE;
-#else
-    mode |= S_IWUSR;
-#endif
-    SystemTools::SetPermissions(source, mode);
-    }
-
-  Directory dir;
-#ifdef _WIN32
-  dir.Load(Encoding::ToNarrow(
-             SystemTools::ConvertToWindowsExtendedPath(source)));
-#else
-  dir.Load(source);
-#endif
-  size_t fileNum;
-  for (fileNum = 0; fileNum <  dir.GetNumberOfFiles(); ++fileNum)
-    {
-    if (strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)),".") &&
-        strcmp(dir.GetFile(static_cast<unsigned long>(fileNum)),".."))
-      {
-      kwsys_stl::string fullPath = source;
-      fullPath += "/";
-      fullPath += dir.GetFile(static_cast<unsigned long>(fileNum));
-      if(SystemTools::FileIsDirectory(fullPath) &&
-        !SystemTools::FileIsSymlink(fullPath))
-        {
-        if (!SystemTools::RemoveADirectory(fullPath))
-          {
-          return false;
-          }
-        }
-      else
-        {
-        if(!SystemTools::RemoveFile(fullPath))
-          {
-          return false;
-          }
-        }
-      }
-    }
-
-  return (Rmdir(source) == 0);
-}
-
-/**
- */
-size_t SystemTools::GetMaximumFilePathLength()
-{
-  return KWSYS_SYSTEMTOOLS_MAXPATH;
-}
-
-/**
- * Find the file the given name.  Searches the given path and then
- * the system search path.  Returns the full path to the file if it is
- * found.  Otherwise, the empty string is returned.
- */
-kwsys_stl::string SystemTools
-::FindName(const kwsys_stl::string& name,
-           const kwsys_stl::vector<kwsys_stl::string>& userPaths,
-           bool no_system_path)
-{
-  // Add the system search path to our path first
-  kwsys_stl::vector<kwsys_stl::string> path;
-  if (!no_system_path)
-    {
-    SystemTools::GetPath(path, "CMAKE_FILE_PATH");
-    SystemTools::GetPath(path);
-    }
-  // now add the additional paths
-  {
-  for(kwsys_stl::vector<kwsys_stl::string>::const_iterator i = userPaths.begin();
-        i != userPaths.end(); ++i)
-    {
-    path.push_back(*i);
-    }
-  }
-  // Add a trailing slash to all paths to aid the search process.
-  {
-  for(kwsys_stl::vector<kwsys_stl::string>::iterator i = path.begin();
-      i != path.end(); ++i)
-    {
-    kwsys_stl::string& p = *i;
-    if(p.empty() || *p.rbegin() != '/')
-      {
-      p += "/";
-      }
-    }
-  }
-  // now look for the file
-  kwsys_stl::string tryPath;
-  for(kwsys_stl::vector<kwsys_stl::string>::const_iterator p = path.begin();
-      p != path.end(); ++p)
-    {
-    tryPath = *p;
-    tryPath += name;
-    if(SystemTools::FileExists(tryPath))
-      {
-      return tryPath;
-      }
-    }
-  // Couldn't find the file.
-  return "";
-}
-
-/**
- * Find the file the given name.  Searches the given path and then
- * the system search path.  Returns the full path to the file if it is
- * found.  Otherwise, the empty string is returned.
- */
-kwsys_stl::string SystemTools
-::FindFile(const kwsys_stl::string& name,
-           const kwsys_stl::vector<kwsys_stl::string>& userPaths,
-           bool no_system_path)
-{
-  kwsys_stl::string tryPath = SystemTools::FindName(name, userPaths, no_system_path);
-  if(!tryPath.empty() && !SystemTools::FileIsDirectory(tryPath))
-    {
-    return SystemTools::CollapseFullPath(tryPath);
-    }
-  // Couldn't find the file.
-  return "";
-}
-
-/**
- * Find the directory the given name.  Searches the given path and then
- * the system search path.  Returns the full path to the directory if it is
- * found.  Otherwise, the empty string is returned.
- */
-kwsys_stl::string SystemTools
-::FindDirectory(const kwsys_stl::string& name,
-                const kwsys_stl::vector<kwsys_stl::string>& userPaths,
-                bool no_system_path)
-{
-  kwsys_stl::string tryPath = SystemTools::FindName(name, userPaths, no_system_path);
-  if(!tryPath.empty() && SystemTools::FileIsDirectory(tryPath))
-    {
-    return SystemTools::CollapseFullPath(tryPath);
-    }
-  // Couldn't find the file.
-  return "";
-}
-
-/**
- * Find the executable with the given name.  Searches the given path and then
- * the system search path.  Returns the full path to the executable if it is
- * found.  Otherwise, the empty string is returned.
- */
-kwsys_stl::string SystemTools::FindProgram(
-  const char* nameIn,
-  const kwsys_stl::vector<kwsys_stl::string>& userPaths,
-  bool no_system_path)
-{
-  if(!nameIn || !*nameIn)
-    {
-    return "";
-    }
-  return SystemTools::FindProgram(kwsys_stl::string(nameIn), userPaths, no_system_path);
-}
-
-kwsys_stl::string SystemTools::FindProgram(
-  const kwsys_stl::string& name,
-  const kwsys_stl::vector<kwsys_stl::string>& userPaths,
-  bool no_system_path)
-{
-  kwsys_stl::vector<kwsys_stl::string> extensions;
-#if defined (_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
-  bool hasExtension = false;
-  // check to see if the name already has a .xxx at
-  // the end of it
-  if(name.size() > 3 && name[name.size()-4] == '.')
-    {
-    hasExtension = true;
-    }
-  // on windows try .com then .exe
-  if(!hasExtension)
-    {
-    extensions.push_back(".com");
-    extensions.push_back(".exe");
-    }
-#endif
-  kwsys_stl::string tryPath;
-
-  // first try with extensions if the os supports them
-  for(kwsys_stl::vector<kwsys_stl::string>::iterator i =
-        extensions.begin(); i != extensions.end(); ++i)
-    {
-    tryPath = name;
-    tryPath += *i;
-    if(SystemTools::FileExists(tryPath) &&
-        !SystemTools::FileIsDirectory(tryPath))
-      {
-      return SystemTools::CollapseFullPath(tryPath);
-      }
-    }
-  // now try just the name
-  tryPath = name;
-  if(SystemTools::FileExists(tryPath) &&
-     !SystemTools::FileIsDirectory(tryPath))
-    {
-    return SystemTools::CollapseFullPath(tryPath);
-    }
-  // now construct the path
-  kwsys_stl::vector<kwsys_stl::string> path;
-  // Add the system search path to our path.
-  if (!no_system_path)
-    {
-    SystemTools::GetPath(path);
-    }
-  // now add the additional paths
-  {
-  for(kwsys_stl::vector<kwsys_stl::string>::const_iterator i =
-        userPaths.begin();  i != userPaths.end(); ++i)
-    {
-    path.push_back(*i);
-    }
-  }
-  // Add a trailing slash to all paths to aid the search process.
-  {
-  for(kwsys_stl::vector<kwsys_stl::string>::iterator i = path.begin();
-      i != path.end(); ++i)
-    {
-    kwsys_stl::string& p = *i;
-    if(p.empty() || *p.rbegin() != '/')
-      {
-      p += "/";
-      }
-    }
-  }
-  // Try each path
-  for(kwsys_stl::vector<kwsys_stl::string>::iterator p = path.begin();
-      p != path.end(); ++p)
-    {
-#ifdef _WIN32
-    // Remove double quotes from the path on windows
-    SystemTools::ReplaceString(*p, "\"", "");
-#endif
-    // first try with extensions
-    for(kwsys_stl::vector<kwsys_stl::string>::iterator ext
-          = extensions.begin(); ext != extensions.end(); ++ext)
-      {
-      tryPath = *p;
-      tryPath += name;
-      tryPath += *ext;
-      if(SystemTools::FileExists(tryPath) &&
-          !SystemTools::FileIsDirectory(tryPath))
-        {
-        return SystemTools::CollapseFullPath(tryPath);
-        }
-      }
-    // now try it without them
-    tryPath = *p;
-    tryPath += name;
-    if(SystemTools::FileExists(tryPath) &&
-       !SystemTools::FileIsDirectory(tryPath))
-      {
-      return SystemTools::CollapseFullPath(tryPath);
-      }
-    }
-  // Couldn't find the program.
-  return "";
-}
-
-kwsys_stl::string SystemTools::FindProgram(
-  const kwsys_stl::vector<kwsys_stl::string>& names,
-  const kwsys_stl::vector<kwsys_stl::string>& path,
-  bool noSystemPath)
-{
-  for(kwsys_stl::vector<kwsys_stl::string>::const_iterator it = names.begin();
-      it != names.end() ; ++it)
-    {
-    // Try to find the program.
-    kwsys_stl::string result = SystemTools::FindProgram(*it,
-                                                  path,
-                                                  noSystemPath);
-    if ( !result.empty() )
-      {
-      return result;
-      }
-    }
-  return "";
-}
-
-/**
- * Find the library with the given name.  Searches the given path and then
- * the system search path.  Returns the full path to the library if it is
- * found.  Otherwise, the empty string is returned.
- */
-kwsys_stl::string SystemTools
-::FindLibrary(const kwsys_stl::string& name,
-              const kwsys_stl::vector<kwsys_stl::string>& userPaths)
-{
-  // See if the executable exists as written.
-  if(SystemTools::FileExists(name) &&
-     !SystemTools::FileIsDirectory(name))
-    {
-    return SystemTools::CollapseFullPath(name);
-    }
-
-  // Add the system search path to our path.
-  kwsys_stl::vector<kwsys_stl::string> path;
-  SystemTools::GetPath(path);
-   // now add the additional paths
-  {
-  for(kwsys_stl::vector<kwsys_stl::string>::const_iterator i = userPaths.begin();
-        i != userPaths.end(); ++i)
-    {
-    path.push_back(*i);
-    }
-  }
-  // Add a trailing slash to all paths to aid the search process.
-  {
-  for(kwsys_stl::vector<kwsys_stl::string>::iterator i = path.begin();
-      i != path.end(); ++i)
-    {
-    kwsys_stl::string& p = *i;
-    if(p.empty() || *p.rbegin() != '/')
-      {
-      p += "/";
-      }
-    }
-  }
-  kwsys_stl::string tryPath;
-  for(kwsys_stl::vector<kwsys_stl::string>::const_iterator p = path.begin();
-      p != path.end(); ++p)
-    {
-#if defined(__APPLE__)
-    tryPath = *p;
-    tryPath += name;
-    tryPath += ".framework";
-    if(SystemTools::FileExists(tryPath)
-       && SystemTools::FileIsDirectory(tryPath))
-      {
-      return SystemTools::CollapseFullPath(tryPath);
-      }
-#endif
-#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__MINGW32__)
-    tryPath = *p;
-    tryPath += name;
-    tryPath += ".lib";
-    if(SystemTools::FileExists(tryPath)
-       && !SystemTools::FileIsDirectory(tryPath))
-      {
-      return SystemTools::CollapseFullPath(tryPath);
-      }
-#else
-    tryPath = *p;
-    tryPath += "lib";
-    tryPath += name;
-    tryPath += ".so";
-    if(SystemTools::FileExists(tryPath)
-       && !SystemTools::FileIsDirectory(tryPath))
-      {
-      return SystemTools::CollapseFullPath(tryPath);
-      }
-    tryPath = *p;
-    tryPath += "lib";
-    tryPath += name;
-    tryPath += ".a";
-    if(SystemTools::FileExists(tryPath)
-       && !SystemTools::FileIsDirectory(tryPath))
-      {
-      return SystemTools::CollapseFullPath(tryPath);
-      }
-    tryPath = *p;
-    tryPath += "lib";
-    tryPath += name;
-    tryPath += ".sl";
-    if(SystemTools::FileExists(tryPath)
-       && !SystemTools::FileIsDirectory(tryPath))
-      {
-      return SystemTools::CollapseFullPath(tryPath);
-      }
-    tryPath = *p;
-    tryPath += "lib";
-    tryPath += name;
-    tryPath += ".dylib";
-    if(SystemTools::FileExists(tryPath)
-       && !SystemTools::FileIsDirectory(tryPath))
-      {
-      return SystemTools::CollapseFullPath(tryPath);
-      }
-    tryPath = *p;
-    tryPath += "lib";
-    tryPath += name;
-    tryPath += ".dll";
-    if(SystemTools::FileExists(tryPath)
-       && !SystemTools::FileIsDirectory(tryPath))
-      {
-      return SystemTools::CollapseFullPath(tryPath);
-      }
-#endif
-    }
-
-  // Couldn't find the library.
-  return "";
-}
-
-kwsys_stl::string SystemTools::GetRealPath(const kwsys_stl::string& path)
-{
-  kwsys_stl::string ret;
-  Realpath(path, ret);
-  return ret;
-}
-
-bool SystemTools::FileIsDirectory(const kwsys_stl::string& inName)
-{
-  if (inName.empty())
-    {
-    return false;
-    }
-  size_t length = inName.size();
-  const char* name = inName.c_str();
-
-  // Remove any trailing slash from the name except in a root component.
-  char local_buffer[KWSYS_SYSTEMTOOLS_MAXPATH];
-  std::string string_buffer;
-  size_t last = length-1;
-  if(last > 0 && (name[last] == '/' || name[last] == '\\')
-    && strcmp(name, "/") != 0 && name[last-1] != ':')
-    {
-    if (last < sizeof(local_buffer))
-      {
-      memcpy(local_buffer, name, last);
-      local_buffer[last] = '\0';
-      name = local_buffer;
-      }
-    else
-      {
-      string_buffer.append(name, last);
-      name = string_buffer.c_str();
-      }
-    }
-
-  // Now check the file node type.
-#if defined( _WIN32 )
-  DWORD attr = GetFileAttributesW(
-    SystemTools::ConvertToWindowsExtendedPath(name).c_str());
-  if (attr != INVALID_FILE_ATTRIBUTES)
-    {
-    return (attr & FILE_ATTRIBUTE_DIRECTORY) != 0;
-#else
-  struct stat fs;
-  if(stat(name, &fs) == 0)
-    {
-    return S_ISDIR(fs.st_mode);
-#endif
-    }
-  else
-    {
-    return false;
-    }
-}
-
-bool SystemTools::FileIsSymlink(const kwsys_stl::string& name)
-{
-#if defined( _WIN32 )
-  (void)name;
-  return false;
-#else
-  struct stat fs;
-  if(lstat(name.c_str(), &fs) == 0)
-    {
-    return S_ISLNK(fs.st_mode);
-    }
-  else
-    {
-    return false;
-    }
-#endif
-}
-
-#if defined(_WIN32) && !defined(__CYGWIN__)
-bool SystemTools::CreateSymlink(const kwsys_stl::string&, const kwsys_stl::string&)
-{
-  return false;
-}
-#else
-bool SystemTools::CreateSymlink(const kwsys_stl::string& origName, const kwsys_stl::string& newName)
-{
-  return symlink(origName.c_str(), newName.c_str()) >= 0;
-}
-#endif
-
-#if defined(_WIN32) && !defined(__CYGWIN__)
-bool SystemTools::ReadSymlink(const kwsys_stl::string&, kwsys_stl::string&)
-{
-  return false;
-}
-#else
-bool SystemTools::ReadSymlink(const kwsys_stl::string& newName,
-                              kwsys_stl::string& origName)
-{
-  char buf[KWSYS_SYSTEMTOOLS_MAXPATH+1];
-  int count =
-    static_cast<int>(readlink(newName.c_str(), buf, KWSYS_SYSTEMTOOLS_MAXPATH));
-  if(count >= 0)
-    {
-    // Add null-terminator.
-    buf[count] = 0;
-    origName = buf;
-    return true;
-    }
-  else
-    {
-    return false;
-    }
-}
-#endif
-
-int SystemTools::ChangeDirectory(const kwsys_stl::string& dir)
-{
-  return Chdir(dir);
-}
-
-kwsys_stl::string SystemTools::GetCurrentWorkingDirectory(bool collapse)
-{
-  char buf[2048];
-  const char* cwd = Getcwd(buf, 2048);
-  kwsys_stl::string path;
-  if ( cwd )
-    {
-    path = cwd;
-    }
-  if(collapse)
-    {
-    return SystemTools::CollapseFullPath(path);
-    }
-  return path;
-}
-
-kwsys_stl::string SystemTools::GetProgramPath(const kwsys_stl::string& in_name)
-{
-  kwsys_stl::string dir, file;
-  SystemTools::SplitProgramPath(in_name, dir, file);
-  return dir;
-}
-
-bool SystemTools::SplitProgramPath(const kwsys_stl::string& in_name,
-                                   kwsys_stl::string& dir,
-                                   kwsys_stl::string& file,
-                                   bool)
-{
-  dir = in_name;
-  file = "";
-  SystemTools::ConvertToUnixSlashes(dir);
-
-  if(!SystemTools::FileIsDirectory(dir))
-    {
-    kwsys_stl::string::size_type slashPos = dir.rfind("/");
-    if(slashPos != kwsys_stl::string::npos)
-      {
-      file = dir.substr(slashPos+1);
-      dir = dir.substr(0, slashPos);
-      }
-    else
-      {
-      file = dir;
-      dir = "";
-      }
-    }
-  if(!(dir.empty()) && !SystemTools::FileIsDirectory(dir))
-    {
-    kwsys_stl::string oldDir = in_name;
-    SystemTools::ConvertToUnixSlashes(oldDir);
-    dir = in_name;
-    return false;
-    }
-  return true;
-}
-
-bool SystemTools::FindProgramPath(const char* argv0,
-                                  kwsys_stl::string& pathOut,
-                                  kwsys_stl::string& errorMsg,
-                                  const char* exeName,
-                                  const char* buildDir,
-                                  const char* installPrefix )
-{
-  kwsys_stl::vector<kwsys_stl::string> failures;
-  kwsys_stl::string self = argv0 ? argv0 : "";
-  failures.push_back(self);
-  SystemTools::ConvertToUnixSlashes(self);
-  self = SystemTools::FindProgram(self);
-  if(!SystemTools::FileExists(self))
-    {
-    if(buildDir)
-      {
-      kwsys_stl::string intdir = ".";
-#ifdef  CMAKE_INTDIR
-      intdir = CMAKE_INTDIR;
-#endif
-      self = buildDir;
-      self += "/bin/";
-      self += intdir;
-      self += "/";
-      self += exeName;
-      self += SystemTools::GetExecutableExtension();
-      }
-    }
-  if(installPrefix)
-    {
-    if(!SystemTools::FileExists(self))
-      {
-      failures.push_back(self);
-      self = installPrefix;
-      self += "/bin/";
-      self +=  exeName;
-      }
-    }
-  if(!SystemTools::FileExists(self))
-    {
-    failures.push_back(self);
-    kwsys_ios::ostringstream msg;
-    msg << "Can not find the command line program ";
-    if (exeName)
-      {
-      msg << exeName;
-      }
-    msg << "\n";
-    if (argv0)
-      {
-      msg << "  argv[0] = \"" << argv0 << "\"\n";
-      }
-    msg << "  Attempted paths:\n";
-    kwsys_stl::vector<kwsys_stl::string>::iterator i;
-    for(i=failures.begin(); i != failures.end(); ++i)
-      {
-      msg << "    \"" << *i << "\"\n";
-      }
-    errorMsg = msg.str();
-    return false;
-    }
-  pathOut = self;
-  return true;
-}
-
-
-kwsys_stl::string SystemTools::CollapseFullPath(const kwsys_stl::string& in_relative)
-{
-  return SystemTools::CollapseFullPath(in_relative, 0);
-}
-
-void SystemTools::AddTranslationPath(const kwsys_stl::string& a, const kwsys_stl::string& b)
-{
-  kwsys_stl::string path_a = a;
-  kwsys_stl::string path_b = b;
-  SystemTools::ConvertToUnixSlashes(path_a);
-  SystemTools::ConvertToUnixSlashes(path_b);
-  // First check this is a directory path, since we don't want the table to
-  // grow too fat
-  if( SystemTools::FileIsDirectory( path_a ) )
-    {
-    // Make sure the path is a full path and does not contain no '..'
-    // Ken--the following code is incorrect. .. can be in a valid path
-    // for example  /home/martink/MyHubba...Hubba/Src
-    if( SystemTools::FileIsFullPath(path_b) && path_b.find("..")
-        == kwsys_stl::string::npos )
-      {
-      // Before inserting make sure path ends with '/'
-      if(!path_a.empty() && *path_a.rbegin() != '/')
-        {
-        path_a += '/';
-        }
-      if(!path_b.empty() && *path_b.rbegin() != '/')
-        {
-        path_b += '/';
-        }
-      if( !(path_a == path_b) )
-        {
-        SystemTools::TranslationMap->insert(
-          SystemToolsTranslationMap::value_type(path_a, path_b));
-        }
-      }
-    }
-}
-
-void SystemTools::AddKeepPath(const kwsys_stl::string& dir)
-{
-  kwsys_stl::string cdir;
-  Realpath(SystemTools::CollapseFullPath(dir).c_str(), cdir);
-  SystemTools::AddTranslationPath(cdir, dir);
-}
-
-void SystemTools::CheckTranslationPath(kwsys_stl::string & path)
-{
-  // Do not translate paths that are too short to have meaningful
-  // translations.
-  if(path.size() < 2)
-    {
-    return;
-    }
-
-  // Always add a trailing slash before translation.  It does not
-  // matter if this adds an extra slash, but we do not want to
-  // translate part of a directory (like the foo part of foo-dir).
-  path += "/";
-
-  // In case a file was specified we still have to go through this:
-  // Now convert any path found in the table back to the one desired:
-  kwsys_stl::map<kwsys_stl::string,kwsys_stl::string>::const_iterator it;
-  for(it  = SystemTools::TranslationMap->begin();
-      it != SystemTools::TranslationMap->end();
-      ++it )
-    {
-    // We need to check of the path is a substring of the other path
-    if(path.find( it->first ) == 0)
-      {
-      path = path.replace( 0, it->first.size(), it->second);
-      }
-    }
-
-  // Remove the trailing slash we added before.
-  path.erase(path.end()-1, path.end());
-}
-
-static void
-SystemToolsAppendComponents(
-  kwsys_stl::vector<kwsys_stl::string>& out_components,
-  kwsys_stl::vector<kwsys_stl::string>::const_iterator first,
-  kwsys_stl::vector<kwsys_stl::string>::const_iterator last)
-{
-  static const kwsys_stl::string up = "..";
-  static const kwsys_stl::string cur = ".";
-  for(kwsys_stl::vector<kwsys_stl::string>::const_iterator i = first;
-      i != last; ++i)
-    {
-    if(*i == up)
-      {
-      if(out_components.size() > 1)
-        {
-        out_components.resize(out_components.size()-1);
-        }
-      }
-    else if(!i->empty() && *i != cur)
-      {
-      out_components.push_back(*i);
-      }
-    }
-}
-
-kwsys_stl::string SystemTools::CollapseFullPath(const kwsys_stl::string& in_path,
-                                                const char* in_base)
-{
-  // Collect the output path components.
-  kwsys_stl::vector<kwsys_stl::string> out_components;
-
-  // Split the input path components.
-  kwsys_stl::vector<kwsys_stl::string> path_components;
-  SystemTools::SplitPath(in_path, path_components);
-
-  // If the input path is relative, start with a base path.
-  if(path_components[0].length() == 0)
-    {
-    kwsys_stl::vector<kwsys_stl::string> base_components;
-    if(in_base)
-      {
-      // Use the given base path.
-      SystemTools::SplitPath(in_base, base_components);
-      }
-    else
-      {
-      // Use the current working directory as a base path.
-      char buf[2048];
-      if(const char* cwd = Getcwd(buf, 2048))
-        {
-        SystemTools::SplitPath(cwd, base_components);
-        }
-      else
-        {
-        base_components.push_back("");
-        }
-      }
-
-    // Append base path components to the output path.
-    out_components.push_back(base_components[0]);
-    SystemToolsAppendComponents(out_components,
-                                base_components.begin()+1,
-                                base_components.end());
-    }
-
-  // Append input path components to the output path.
-  SystemToolsAppendComponents(out_components,
-                              path_components.begin(),
-                              path_components.end());
-
-  // Transform the path back to a string.
-  kwsys_stl::string newPath = SystemTools::JoinPath(out_components);
-
-  // Update the translation table with this potentially new path.  I am not
-  // sure why this line is here, it seems really questionable, but yet I
-  // would put good money that if I remove it something will break, basically
-  // from what I can see it created a mapping from the collapsed path, to be
-  // replaced by the input path, which almost completely does the opposite of
-  // this function, the only thing preventing this from happening a lot is
-  // that if the in_path has a .. in it, then it is not added to the
-  // translation table. So for most calls this either does nothing due to the
-  // ..  or it adds a translation between identical paths as nothing was
-  // collapsed, so I am going to try to comment it out, and see what hits the
-  // fan, hopefully quickly.
-  // Commented out line below:
-  //SystemTools::AddTranslationPath(newPath, in_path);
-
-  SystemTools::CheckTranslationPath(newPath);
-#ifdef _WIN32
-  newPath = SystemTools::GetActualCaseForPath(newPath);
-  SystemTools::ConvertToUnixSlashes(newPath);
-#endif
-  // Return the reconstructed path.
-  return newPath;
-}
-
-kwsys_stl::string SystemTools::CollapseFullPath(const kwsys_stl::string& in_path,
-                                                const kwsys_stl::string& in_base)
-{
-  // Collect the output path components.
-  kwsys_stl::vector<kwsys_stl::string> out_components;
-
-  // Split the input path components.
-  kwsys_stl::vector<kwsys_stl::string> path_components;
-  SystemTools::SplitPath(in_path, path_components);
-
-  // If the input path is relative, start with a base path.
-  if(path_components[0].length() == 0)
-    {
-    kwsys_stl::vector<kwsys_stl::string> base_components;
-    // Use the given base path.
-    SystemTools::SplitPath(in_base, base_components);
-
-    // Append base path components to the output path.
-    out_components.push_back(base_components[0]);
-    SystemToolsAppendComponents(out_components,
-                                base_components.begin()+1,
-                                base_components.end());
-    }
-
-  // Append input path components to the output path.
-  SystemToolsAppendComponents(out_components,
-                              path_components.begin(),
-                              path_components.end());
-
-  // Transform the path back to a string.
-  kwsys_stl::string newPath = SystemTools::JoinPath(out_components);
-
-  // Update the translation table with this potentially new path.  I am not
-  // sure why this line is here, it seems really questionable, but yet I
-  // would put good money that if I remove it something will break, basically
-  // from what I can see it created a mapping from the collapsed path, to be
-  // replaced by the input path, which almost completely does the opposite of
-  // this function, the only thing preventing this from happening a lot is
-  // that if the in_path has a .. in it, then it is not added to the
-  // translation table. So for most calls this either does nothing due to the
-  // ..  or it adds a translation between identical paths as nothing was
-  // collapsed, so I am going to try to comment it out, and see what hits the
-  // fan, hopefully quickly.
-  // Commented out line below:
-  //SystemTools::AddTranslationPath(newPath, in_path);
-
-  SystemTools::CheckTranslationPath(newPath);
-#ifdef _WIN32
-  newPath = SystemTools::GetActualCaseForPath(newPath);
-  SystemTools::ConvertToUnixSlashes(newPath);
-#endif
-  // Return the reconstructed path.
-  return newPath;
-}
-
-// compute the relative path from here to there
-kwsys_stl::string SystemTools::RelativePath(const kwsys_stl::string& local, const kwsys_stl::string& remote)
-{
-  if(!SystemTools::FileIsFullPath(local))
-    {
-    return "";
-    }
-  if(!SystemTools::FileIsFullPath(remote))
-    {
-    return "";
-    }
-
-  kwsys_stl::string l = SystemTools::CollapseFullPath(local);
-  kwsys_stl::string r = SystemTools::CollapseFullPath(remote);
-
-  // split up both paths into arrays of strings using / as a separator
-  kwsys_stl::vector<kwsys::String> localSplit = SystemTools::SplitString(l, '/', true);
-  kwsys_stl::vector<kwsys::String> remoteSplit = SystemTools::SplitString(r, '/', true);
-  kwsys_stl::vector<kwsys::String> commonPath; // store shared parts of path in this array
-  kwsys_stl::vector<kwsys::String> finalPath;  // store the final relative path here
-  // count up how many matching directory names there are from the start
-  unsigned int sameCount = 0;
-  while(
-    ((sameCount <= (localSplit.size()-1)) && (sameCount <= (remoteSplit.size()-1)))
-    &&
-// for windows and apple do a case insensitive string compare
-#if defined(_WIN32) || defined(__APPLE__)
-    SystemTools::Strucmp(localSplit[sameCount].c_str(),
-                         remoteSplit[sameCount].c_str()) == 0
-#else
-    localSplit[sameCount] == remoteSplit[sameCount]
-#endif
-    )
-    {
-    // put the common parts of the path into the commonPath array
-    commonPath.push_back(localSplit[sameCount]);
-    // erase the common parts of the path from the original path arrays
-    localSplit[sameCount] = "";
-    remoteSplit[sameCount] = "";
-    sameCount++;
-    }
-
-  // If there is nothing in common at all then just return the full
-  // path.  This is the case only on windows when the paths have
-  // different drive letters.  On unix two full paths always at least
-  // have the root "/" in common so we will return a relative path
-  // that passes through the root directory.
-  if(sameCount == 0)
-    {
-    return remote;
-    }
-
-  // for each entry that is not common in the local path
-  // add a ../ to the finalpath array, this gets us out of the local
-  // path into the remote dir
-  for(unsigned int i = 0; i < localSplit.size(); ++i)
-    {
-    if(!localSplit[i].empty())
-      {
-      finalPath.push_back("../");
-      }
-    }
-  // for each entry that is not common in the remote path add it
-  // to the final path.
-  for(kwsys_stl::vector<String>::iterator vit = remoteSplit.begin();
-      vit != remoteSplit.end(); ++vit)
-    {
-    if(!vit->empty())
-      {
-      finalPath.push_back(*vit);
-      }
-    }
-  kwsys_stl::string relativePath;     // result string
-  // now turn the array of directories into a unix path by puttint /
-  // between each entry that does not already have one
-  for(kwsys_stl::vector<String>::iterator vit1 = finalPath.begin();
-      vit1 != finalPath.end(); ++vit1)
-    {
-    if(!relativePath.empty() && *relativePath.rbegin() != '/')
-      {
-      relativePath += "/";
-      }
-    relativePath += *vit1;
-    }
-  return relativePath;
-}
-
-#ifdef _WIN32
-static int GetCasePathName(const kwsys_stl::string & pathIn,
-                            kwsys_stl::string & casePath)
-{
-  kwsys_stl::vector<kwsys_stl::string> path_components;
-  SystemTools::SplitPath(pathIn, path_components);
-  if(path_components[0].empty()) // First component always exists.
-    {
-    // Relative paths cannot be converted.
-    casePath = "";
-    return 0;
-    }
-
-  // Start with root component.
-  kwsys_stl::vector<kwsys_stl::string>::size_type idx = 0;
-  casePath = path_components[idx++];
-  const char* sep = "";
-
-  // If network path, fill casePath with server/share so FindFirstFile
-  // will work after that.  Maybe someday call other APIs to get
-  // actual case of servers and shares.
-  if(path_components.size() > 2 && path_components[0] == "//")
-    {
-    casePath += path_components[idx++];
-    casePath += "/";
-    casePath += path_components[idx++];
-    sep = "/";
-    }
-
-  for(; idx < path_components.size(); idx++)
-    {
-    casePath += sep;
-    sep = "/";
-    kwsys_stl::string test_str = casePath;
-    test_str += path_components[idx];
-
-    // If path component contains wildcards, we skip matching
-    // because these filenames are not allowed on windows,
-    // and we do not want to match a different file.
-    if(path_components[idx].find('*') != kwsys_stl::string::npos ||
-       path_components[idx].find('?') != kwsys_stl::string::npos)
-      {
-      casePath = "";
-      return 0;
-      }
-
-    WIN32_FIND_DATAW findData;
-    HANDLE hFind = ::FindFirstFileW(Encoding::ToWide(test_str).c_str(),
-      &findData);
-    if (INVALID_HANDLE_VALUE != hFind)
-      {
-      casePath += Encoding::ToNarrow(findData.cFileName);
-      ::FindClose(hFind);
-      }
-    else
-      {
-      casePath = "";
-      return 0;
-      }
-    }
-  return (int)casePath.size();
-}
-#endif
-
-
-//----------------------------------------------------------------------------
-kwsys_stl::string SystemTools::GetActualCaseForPath(const kwsys_stl::string& p)
-{
-#ifndef _WIN32
-  return p;
-#else
-  kwsys_stl::string casePath = p;
-  // make sure drive letter is always upper case
-  if(casePath.size() > 1 && casePath[1] == ':')
-    {
-    casePath[0] = toupper(casePath[0]);
-    }
-
-  // Check to see if actual case has already been called
-  // for this path, and the result is stored in the LongPathMap
-  SystemToolsTranslationMap::iterator i =
-    SystemTools::LongPathMap->find(casePath);
-  if(i != SystemTools::LongPathMap->end())
-    {
-    return i->second;
-    }
-  int len = GetCasePathName(p, casePath);
-  if(len == 0 || len > MAX_PATH+1)
-    {
-    return p;
-    }
-  (*SystemTools::LongPathMap)[p] = casePath;
-  return casePath;
-#endif
-}
-
-//----------------------------------------------------------------------------
-const char* SystemTools::SplitPathRootComponent(const std::string& p,
-                                                kwsys_stl::string* root)
-{
-  // Identify the root component.
-  const char* c = p.c_str();
-  if((c[0] == '/' && c[1] == '/') || (c[0] == '\\' && c[1] == '\\'))
-    {
-    // Network path.
-    if(root)
-      {
-      *root = "//";
-      }
-    c += 2;
-    }
-  else if(c[0] == '/' || c[0] == '\\')
-    {
-    // Unix path (or Windows path w/out drive letter).
-    if(root)
-      {
-      *root = "/";
-      }
-    c += 1;
-    }
-  else if(c[0] && c[1] == ':' && (c[2] == '/' || c[2] == '\\'))
-    {
-    // Windows path.
-    if(root)
-      {
-      (*root) = "_:/";
-      (*root)[0] = c[0];
-      }
-    c += 3;
-    }
-  else if(c[0] && c[1] == ':')
-    {
-    // Path relative to a windows drive working directory.
-    if(root)
-      {
-      (*root) = "_:";
-      (*root)[0] = c[0];
-      }
-    c += 2;
-    }
-  else if(c[0] == '~')
-    {
-    // Home directory.  The returned root should always have a
-    // trailing slash so that appending components as
-    // c[0]c[1]/c[2]/... works.  The remaining path returned should
-    // skip the first slash if it exists:
-    //
-    //   "~"    : root = "~/" , return ""
-    //   "~/    : root = "~/" , return ""
-    //   "~/x   : root = "~/" , return "x"
-    //   "~u"   : root = "~u/", return ""
-    //   "~u/"  : root = "~u/", return ""
-    //   "~u/x" : root = "~u/", return "x"
-    size_t n = 1;
-    while(c[n] && c[n] != '/')
-      {
-      ++n;
-      }
-    if(root)
-      {
-      root->assign(c, n);
-      *root += '/';
-      }
-    if(c[n] == '/')
-      {
-      ++n;
-      }
-    c += n;
-    }
-  else
-    {
-    // Relative path.
-    if(root)
-      {
-      *root = "";
-      }
-    }
-
-  // Return the remaining path.
-  return c;
-}
-
-//----------------------------------------------------------------------------
-void SystemTools::SplitPath(const std::string& p,
-                            kwsys_stl::vector<kwsys_stl::string>& components,
-                            bool expand_home_dir)
-{
-  const char* c;
-  components.clear();
-
-  // Identify the root component.
-  {
-  kwsys_stl::string root;
-  c = SystemTools::SplitPathRootComponent(p, &root);
-
-  // Expand home directory references if requested.
-  if(expand_home_dir && !root.empty() && root[0] == '~')
-    {
-    kwsys_stl::string homedir;
-    root = root.substr(0, root.size()-1);
-    if(root.size() == 1)
-      {
-#if defined(_WIN32) && !defined(__CYGWIN__)
-      if(const char* userp = getenv("USERPROFILE"))
-        {
-        homedir = userp;
-        }
-      else
-#endif
-      if(const char* h = getenv("HOME"))
-        {
-        homedir = h;
-        }
-      }
-#ifdef HAVE_GETPWNAM
-    else if(passwd* pw = getpwnam(root.c_str()+1))
-      {
-      if(pw->pw_dir)
-        {
-        homedir = pw->pw_dir;
-        }
-      }
-#endif
-    if(!homedir.empty() && (*homedir.rbegin() == '/' ||
-                            *homedir.rbegin() == '\\'))
-      {
-      homedir.resize(homedir.size() - 1);
-      }
-    SystemTools::SplitPath(homedir, components);
-    }
-  else
-    {
-    components.push_back(root);
-    }
-  }
-
-  // Parse the remaining components.
-  const char* first = c;
-  const char* last = first;
-  for(;*last; ++last)
-    {
-    if(*last == '/' || *last == '\\')
-      {
-      // End of a component.  Save it.
-      components.push_back(kwsys_stl::string(first, last));
-      first = last+1;
-      }
-    }
-
-  // Save the last component unless there were no components.
-  if(last != c)
-    {
-    components.push_back(kwsys_stl::string(first, last));
-    }
-}
-
-//----------------------------------------------------------------------------
-kwsys_stl::string
-SystemTools::JoinPath(const kwsys_stl::vector<kwsys_stl::string>& components)
-{
-  return SystemTools::JoinPath(components.begin(), components.end());
-}
-
-//----------------------------------------------------------------------------
-kwsys_stl::string
-SystemTools
-::JoinPath(kwsys_stl::vector<kwsys_stl::string>::const_iterator first,
-           kwsys_stl::vector<kwsys_stl::string>::const_iterator last)
-{
-  // Construct result in a single string.
-  kwsys_stl::string result;
-  size_t len = 0;
-  kwsys_stl::vector<kwsys_stl::string>::const_iterator i;
-  for(i = first; i != last; ++i)
-    {
-    len += 1 + i->size();
-    }
-  result.reserve(len);
-
-  // The first two components do not add a slash.
-  if(first != last)
-    {
-    result.append(*first++);
-    }
-  if(first != last)
-    {
-    result.append(*first++);
-    }
-
-  // All remaining components are always separated with a slash.
-  while(first != last)
-    {
-    result.append("/");
-    result.append((*first++));
-    }
-
-  // Return the concatenated result.
-  return result;
-}
-
-//----------------------------------------------------------------------------
-bool SystemTools::ComparePath(const kwsys_stl::string& c1, const kwsys_stl::string& c2)
-{
-#if defined(_WIN32) || defined(__APPLE__)
-# ifdef _MSC_VER
-  return _stricmp(c1.c_str(), c2.c_str()) == 0;
-# elif defined(__APPLE__) || defined(__GNUC__)
-  return strcasecmp(c1.c_str(), c2.c_str()) == 0;
-#else
-  return SystemTools::Strucmp(c1.c_str(), c2.c_str()) == 0;
-# endif
-#else
-  return c1 == c2;
-#endif
-}
-
-//----------------------------------------------------------------------------
-bool SystemTools::Split(const kwsys_stl::string& str, kwsys_stl::vector<kwsys_stl::string>& lines, char separator)
-{
-  kwsys_stl::string data(str);
-  kwsys_stl::string::size_type lpos = 0;
-  while(lpos < data.length())
-    {
-    kwsys_stl::string::size_type rpos = data.find_first_of(separator, lpos);
-    if(rpos == kwsys_stl::string::npos)
-      {
-      // Line ends at end of string without a newline.
-      lines.push_back(data.substr(lpos));
-      return false;
-      }
-    else
-      {
-      // Line ends in a "\n", remove the character.
-      lines.push_back(data.substr(lpos, rpos-lpos));
-      }
-    lpos = rpos+1;
-    }
-  return true;
-}
-
-//----------------------------------------------------------------------------
-bool SystemTools::Split(const kwsys_stl::string& str, kwsys_stl::vector<kwsys_stl::string>& lines)
-{
-  kwsys_stl::string data(str);
-  kwsys_stl::string::size_type lpos = 0;
-  while(lpos < data.length())
-    {
-    kwsys_stl::string::size_type rpos = data.find_first_of("\n", lpos);
-    if(rpos == kwsys_stl::string::npos)
-      {
-      // Line ends at end of string without a newline.
-      lines.push_back(data.substr(lpos));
-      return false;
-      }
-    if((rpos > lpos) && (data[rpos-1] == '\r'))
-      {
-      // Line ends in a "\r\n" pair, remove both characters.
-      lines.push_back(data.substr(lpos, (rpos-1)-lpos));
-      }
-    else
-      {
-      // Line ends in a "\n", remove the character.
-      lines.push_back(data.substr(lpos, rpos-lpos));
-      }
-    lpos = rpos+1;
-    }
-  return true;
-}
-
-/**
- * Return path of a full filename (no trailing slashes).
- * Warning: returned path is converted to Unix slashes format.
- */
-kwsys_stl::string SystemTools::GetFilenamePath(const kwsys_stl::string& filename)
-{
-  kwsys_stl::string fn = filename;
-  SystemTools::ConvertToUnixSlashes(fn);
-
-  kwsys_stl::string::size_type slash_pos = fn.rfind("/");
-  if(slash_pos != kwsys_stl::string::npos)
-    {
-    kwsys_stl::string  ret = fn.substr(0, slash_pos);
-    if(ret.size() == 2 && ret[1] == ':')
-      {
-      return ret + '/';
-      }
-    if(ret.empty())
-      {
-      return "/";
-      }
-    return ret;
-    }
-  else
-    {
-    return "";
-    }
-}
-
-
-/**
- * Return file name of a full filename (i.e. file name without path).
- */
-kwsys_stl::string SystemTools::GetFilenameName(const kwsys_stl::string& filename)
-{
-#if defined(_WIN32)
-  kwsys_stl::string::size_type slash_pos = filename.find_last_of("/\\");
-#else
-  kwsys_stl::string::size_type slash_pos = filename.rfind('/');
-#endif
-  if(slash_pos != kwsys_stl::string::npos)
-    {
-    return filename.substr(slash_pos + 1);
-    }
-  else
-    {
-    return filename;
-    }
-}
-
-
-/**
- * Return file extension of a full filename (dot included).
- * Warning: this is the longest extension (for example: .tar.gz)
- */
-kwsys_stl::string SystemTools::GetFilenameExtension(const kwsys_stl::string& filename)
-{
-  kwsys_stl::string name = SystemTools::GetFilenameName(filename);
-  kwsys_stl::string::size_type dot_pos = name.find('.');
-  if(dot_pos != kwsys_stl::string::npos)
-    {
-    return name.substr(dot_pos);
-    }
-  else
-    {
-    return "";
-    }
-}
-
-/**
- * Return file extension of a full filename (dot included).
- * Warning: this is the shortest extension (for example: .gz of .tar.gz)
- */
-kwsys_stl::string SystemTools::GetFilenameLastExtension(const kwsys_stl::string& filename)
-{
-  kwsys_stl::string name = SystemTools::GetFilenameName(filename);
-  kwsys_stl::string::size_type dot_pos = name.rfind('.');
-  if(dot_pos != kwsys_stl::string::npos)
-    {
-    return name.substr(dot_pos);
-    }
-  else
-    {
-    return "";
-    }
-}
-
-/**
- * Return file name without extension of a full filename (i.e. without path).
- * Warning: it considers the longest extension (for example: .tar.gz)
- */
-kwsys_stl::string SystemTools::GetFilenameWithoutExtension(const kwsys_stl::string& filename)
-{
-  kwsys_stl::string name = SystemTools::GetFilenameName(filename);
-  kwsys_stl::string::size_type dot_pos = name.find('.');
-  if(dot_pos != kwsys_stl::string::npos)
-    {
-    return name.substr(0, dot_pos);
-    }
-  else
-    {
-    return name;
-    }
-}
-
-
-/**
- * Return file name without extension of a full filename (i.e. without path).
- * Warning: it considers the last extension (for example: removes .gz
- * from .tar.gz)
- */
-kwsys_stl::string
-SystemTools::GetFilenameWithoutLastExtension(const kwsys_stl::string& filename)
-{
-  kwsys_stl::string name = SystemTools::GetFilenameName(filename);
-  kwsys_stl::string::size_type dot_pos = name.rfind('.');
-  if(dot_pos != kwsys_stl::string::npos)
-    {
-    return name.substr(0, dot_pos);
-    }
-  else
-    {
-    return name;
-    }
-}
-
-bool SystemTools::FileHasSignature(const char *filename,
-                                   const char *signature,
-                                   long offset)
-{
-  if (!filename || !signature)
-    {
-    return false;
-    }
-
-  FILE *fp = Fopen(filename, "rb");
-  if (!fp)
-    {
-    return false;
-    }
-
-  fseek(fp, offset, SEEK_SET);
-
-  bool res = false;
-  size_t signature_len = strlen(signature);
-  char *buffer = new char [signature_len];
-
-  if (fread(buffer, 1, signature_len, fp) == signature_len)
-    {
-    res = (!strncmp(buffer, signature, signature_len) ? true : false);
-    }
-
-  delete [] buffer;
-
-  fclose(fp);
-  return res;
-}
-
-SystemTools::FileTypeEnum
-SystemTools::DetectFileType(const char *filename,
-                            unsigned long length,
-                            double percent_bin)
-{
-  if (!filename || percent_bin < 0)
-    {
-    return SystemTools::FileTypeUnknown;
-    }
-
-  FILE *fp = Fopen(filename, "rb");
-  if (!fp)
-    {
-    return SystemTools::FileTypeUnknown;
-    }
-
-  // Allocate buffer and read bytes
-
-  unsigned char *buffer = new unsigned char [length];
-  size_t read_length = fread(buffer, 1, length, fp);
-  fclose(fp);
-  if (read_length == 0)
-    {
-    return SystemTools::FileTypeUnknown;
-    }
-
-  // Loop over contents and count
-
-  size_t text_count = 0;
-
-  const unsigned char *ptr = buffer;
-  const unsigned char *buffer_end = buffer + read_length;
-
-  while (ptr != buffer_end)
-    {
-    if ((*ptr >= 0x20 && *ptr <= 0x7F) ||
-        *ptr == '\n' ||
-        *ptr == '\r' ||
-        *ptr == '\t')
-      {
-      text_count++;
-      }
-    ptr++;
-    }
-
-  delete [] buffer;
-
-  double current_percent_bin =
-    (static_cast<double>(read_length - text_count) /
-     static_cast<double>(read_length));
-
-  if (current_percent_bin >= percent_bin)
-    {
-    return SystemTools::FileTypeBinary;
-    }
-
-  return SystemTools::FileTypeText;
-}
-
-bool SystemTools::LocateFileInDir(const char *filename,
-                                  const char *dir,
-                                  kwsys_stl::string& filename_found,
-                                  int try_filename_dirs)
-{
-  if (!filename || !dir)
-    {
-    return false;
-    }
-
-  // Get the basename of 'filename'
-
-  kwsys_stl::string filename_base = SystemTools::GetFilenameName(filename);
-
-  // Check if 'dir' is really a directory
-  // If win32 and matches something like C:, accept it as a dir
-
-  kwsys_stl::string real_dir;
-  if (!SystemTools::FileIsDirectory(dir))
-    {
-#if defined( _WIN32 )
-    size_t dir_len = strlen(dir);
-    if (dir_len < 2 || dir[dir_len - 1] != ':')
-      {
-#endif
-      real_dir = SystemTools::GetFilenamePath(dir);
-      dir = real_dir.c_str();
-#if defined( _WIN32 )
-      }
-#endif
-    }
-
-  // Try to find the file in 'dir'
-
-  bool res = false;
-  if (!filename_base.empty() && dir)
-    {
-    size_t dir_len = strlen(dir);
-    int need_slash =
-      (dir_len && dir[dir_len - 1] != '/' && dir[dir_len - 1] != '\\');
-
-    kwsys_stl::string temp = dir;
-    if (need_slash)
-      {
-      temp += "/";
-      }
-    temp += filename_base;
-
-    if (SystemTools::FileExists(temp))
-      {
-      res = true;
-      filename_found = temp;
-      }
-
-    // If not found, we can try harder by appending part of the file to
-    // to the directory to look inside.
-    // Example: if we were looking for /foo/bar/yo.txt in /d1/d2, then
-    // try to find yo.txt in /d1/d2/bar, then /d1/d2/foo/bar, etc.
-
-    else if (try_filename_dirs)
-      {
-      kwsys_stl::string filename_dir(filename);
-      kwsys_stl::string filename_dir_base;
-      kwsys_stl::string filename_dir_bases;
-      do
-        {
-        filename_dir = SystemTools::GetFilenamePath(filename_dir);
-        filename_dir_base = SystemTools::GetFilenameName(filename_dir);
-#if defined( _WIN32 )
-        if (filename_dir_base.empty() ||
-            *filename_dir_base.rbegin() == ':')
-#else
-        if (filename_dir_base.empty())
-#endif
-          {
-          break;
-          }
-
-        filename_dir_bases = filename_dir_base + "/" + filename_dir_bases;
-
-        temp = dir;
-        if (need_slash)
-          {
-          temp += "/";
-          }
-        temp += filename_dir_bases;
-
-        res = SystemTools::LocateFileInDir(
-          filename_base.c_str(), temp.c_str(), filename_found, 0);
-
-        } while (!res && !filename_dir_base.empty());
-      }
-    }
-
-  return res;
-}
-
-bool SystemTools::FileIsFullPath(const kwsys_stl::string& in_name)
-{
-  return SystemTools::FileIsFullPath(in_name.c_str(), in_name.size());
-}
-
-bool SystemTools::FileIsFullPath(const char* in_name)
-{
-  return SystemTools::FileIsFullPath(in_name, in_name[0] ? (in_name[1] ? 2 : 1) : 0);
-}
-
-bool SystemTools::FileIsFullPath(const char* in_name, size_t len)
-{
-#if defined(_WIN32) || defined(__CYGWIN__)
-  // On Windows, the name must be at least two characters long.
-  if(len < 2)
-    {
-    return false;
-    }
-  if(in_name[1] == ':')
-    {
-    return true;
-    }
-  if(in_name[0] == '\\')
-    {
-    return true;
-    }
-#else
-  // On UNIX, the name must be at least one character long.
-  if(len < 1)
-    {
-    return false;
-    }
-#endif
-#if !defined(_WIN32)
-  if(in_name[0] == '~')
-    {
-    return true;
-    }
-#endif
-  // On UNIX, the name must begin in a '/'.
-  // On Windows, if the name begins in a '/', then it is a full
-  // network path.
-  if(in_name[0] == '/')
-    {
-    return true;
-    }
-  return false;
-}
-
-bool SystemTools::GetShortPath(const kwsys_stl::string& path, kwsys_stl::string& shortPath)
-{
-#if defined(WIN32) && !defined(__CYGWIN__)
-  const int size = int(path.size()) +1; // size of return
-  char *tempPath = new char[size];  // create a buffer
-  DWORD ret;
-
-  // if the path passed in has quotes around it, first remove the quotes
-  if (!path.empty() && path[0] == '"' && *path.rbegin() == '"')
-    {
-    strcpy(tempPath,path.c_str()+1);
-    tempPath[size-2] = '\0';
-    }
-  else
-    {
-    strcpy(tempPath,path.c_str());
-    }
-
-  kwsys_stl::wstring wtempPath = Encoding::ToWide(tempPath);
-  kwsys_stl::vector<wchar_t> buffer(wtempPath.size()+1);
-  buffer[0] = 0;
-  ret = GetShortPathNameW(wtempPath.c_str(),
-    &buffer[0], static_cast<DWORD>(wtempPath.size()));
-
-  if(buffer[0] == 0 || ret > wtempPath.size())
-    {
-    delete [] tempPath;
-    return false;
-    }
-  else
-    {
-    shortPath = Encoding::ToNarrow(&buffer[0]);
-    delete [] tempPath;
-    return true;
-    }
-#else
-  shortPath = path;
-  return true;
-#endif
-}
-
-void SystemTools::SplitProgramFromArgs(const kwsys_stl::string& path,
-                                       kwsys_stl::string& program, kwsys_stl::string& args)
-{
-  // see if this is a full path to a program
-  // if so then set program to path and args to nothing
-  if(SystemTools::FileExists(path))
-    {
-    program = path;
-    args = "";
-    return;
-    }
-  // Try to find the program in the path, note the program
-  // may have spaces in its name so we have to look for it
-  kwsys_stl::vector<kwsys_stl::string> e;
-  kwsys_stl::string findProg = SystemTools::FindProgram(path, e);
-  if(!findProg.empty())
-    {
-    program = findProg;
-    args = "";
-    return;
-    }
-
-  // Now try and peel off space separated chunks from the end of the string
-  // so the largest path possible is found allowing for spaces in the path
-  kwsys_stl::string dir = path;
-  kwsys_stl::string::size_type spacePos = dir.rfind(' ');
-  while(spacePos != kwsys_stl::string::npos)
-    {
-    kwsys_stl::string tryProg = dir.substr(0, spacePos);
-    // See if the file exists
-    if(SystemTools::FileExists(tryProg))
-      {
-      program = tryProg;
-      // remove trailing spaces from program
-      kwsys_stl::string::size_type pos = program.size()-1;
-      while(program[pos] == ' ')
-        {
-        program.erase(pos);
-        pos--;
-        }
-      args = dir.substr(spacePos, dir.size()-spacePos);
-      return;
-      }
-    // Now try and find the program in the path
-    findProg = SystemTools::FindProgram(tryProg, e);
-    if(!findProg.empty())
-      {
-      program = findProg;
-      // remove trailing spaces from program
-      kwsys_stl::string::size_type pos = program.size()-1;
-      while(program[pos] == ' ')
-        {
-        program.erase(pos);
-        pos--;
-        }
-      args = dir.substr(spacePos, dir.size()-spacePos);
-      return;
-      }
-    // move past the space for the next search
-    spacePos--;
-    spacePos = dir.rfind(' ', spacePos);
-    }
-
-  program = "";
-  args = "";
-}
-
-kwsys_stl::string SystemTools::GetCurrentDateTime(const char* format)
-{
-  char buf[1024];
-  time_t t;
-  time(&t);
-  strftime(buf, sizeof(buf), format, localtime(&t));
-  return kwsys_stl::string(buf);
-}
-
-kwsys_stl::string SystemTools::MakeCidentifier(const kwsys_stl::string& s)
-{
-  kwsys_stl::string str(s);
-  if (str.find_first_of("0123456789") == 0)
-    {
-    str = "_" + str;
-    }
-
-  kwsys_stl::string permited_chars("_"
-                             "abcdefghijklmnopqrstuvwxyz"
-                             "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-                             "0123456789");
-  kwsys_stl::string::size_type pos = 0;
-  while ((pos = str.find_first_not_of(permited_chars, pos)) != kwsys_stl::string::npos)
-    {
-    str[pos] = '_';
-    }
-  return str;
-}
-
-// Due to a buggy stream library on the HP and another on Mac OS X, we
-// need this very carefully written version of getline.  Returns true
-// if any data were read before the end-of-file was reached.
-bool SystemTools::GetLineFromStream(kwsys_ios::istream& is,
-                                    kwsys_stl::string& line,
-                                    bool* has_newline /* = 0 */,
-                                    long sizeLimit /* = -1 */)
-{
-  const int bufferSize = 1024;
-  char buffer[bufferSize];
-  bool haveData = false;
-  bool haveNewline = false;
-
-  // Start with an empty line.
-  line = "";
-
-  long leftToRead = sizeLimit;
-
-  // Early short circuit return if stream is no good. Just return
-  // false and the empty line. (Probably means caller tried to
-  // create a file stream with a non-existent file name...)
-  //
-  if(!is)
-    {
-    if(has_newline)
-      {
-      *has_newline = false;
-      }
-    return false;
-    }
-
-  // If no characters are read from the stream, the end of file has
-  // been reached.  Clear the fail bit just before reading.
-  while(!haveNewline &&
-        leftToRead != 0 &&
-        (is.clear(is.rdstate() & ~kwsys_ios::ios::failbit),
-         is.getline(buffer, bufferSize), is.gcount() > 0))
-    {
-    // We have read at least one byte.
-    haveData = true;
-
-    // If newline character was read the gcount includes the character
-    // but the buffer does not: the end of line has been reached.
-    size_t length = strlen(buffer);
-    if(length < static_cast<size_t>(is.gcount()))
-      {
-      haveNewline = true;
-      }
-
-    // Avoid storing a carriage return character.
-    if(length > 0 && buffer[length-1] == '\r')
-      {
-      buffer[length-1] = 0;
-      }
-
-    // if we read too much then truncate the buffer
-    if (leftToRead > 0)
-      {
-      if (static_cast<long>(length) > leftToRead)
-        {
-        buffer[leftToRead-1] = 0;
-        leftToRead = 0;
-        }
-      else
-        {
-        leftToRead -= static_cast<long>(length);
-        }
-      }
-
-    // Append the data read to the line.
-    line.append(buffer);
-    }
-
-  // Return the results.
-  if(has_newline)
-    {
-    *has_newline = haveNewline;
-    }
-  return haveData;
-}
-
-int SystemTools::GetTerminalWidth()
-{
-  int width = -1;
-#ifdef HAVE_TTY_INFO
-  struct winsize ws;
-  char *columns; /* Unix98 environment variable */
-  if(ioctl(1, TIOCGWINSZ, &ws) != -1 && ws.ws_col>0 && ws.ws_row>0)
-    {
-    width = ws.ws_col;
-    }
-  if(!isatty(STDOUT_FILENO))
-    {
-    width = -1;
-    }
-  columns = getenv("COLUMNS");
-  if(columns && *columns)
-    {
-    long t;
-    char *endptr;
-    t = strtol(columns, &endptr, 0);
-    if(endptr && !*endptr && (t>0) && (t<1000))
-      {
-      width = static_cast<int>(t);
-      }
-    }
-  if ( width < 9 )
-    {
-    width = -1;
-    }
-#endif
-  return width;
-}
-
-bool SystemTools::GetPermissions(const char* file, mode_t& mode)
-{
-  if ( !file )
-    {
-    return false;
-    }
-  return SystemTools::GetPermissions(kwsys_stl::string(file), mode);
-}
-
-bool SystemTools::GetPermissions(const kwsys_stl::string& file, mode_t& mode)
-{
-#if defined(_WIN32)
-  DWORD attr = GetFileAttributesW(
-    SystemTools::ConvertToWindowsExtendedPath(file).c_str());
-  if(attr == INVALID_FILE_ATTRIBUTES)
-    {
-    return false;
-    }
-  if((attr & FILE_ATTRIBUTE_READONLY) != 0)
-    {
-    mode = (_S_IREAD  | (_S_IREAD  >> 3) | (_S_IREAD  >> 6));
-    }
-  else
-    {
-    mode = (_S_IWRITE | (_S_IWRITE >> 3) | (_S_IWRITE >> 6)) |
-           (_S_IREAD  | (_S_IREAD  >> 3) | (_S_IREAD  >> 6));
-    }
-  if((attr & FILE_ATTRIBUTE_DIRECTORY) != 0)
-    {
-    mode |= S_IFDIR | (_S_IEXEC  | (_S_IEXEC  >> 3) | (_S_IEXEC  >> 6));
-    }
-  else
-    {
-    mode |= S_IFREG;
-    }
-  size_t dotPos = file.rfind('.');
-  const char* ext = dotPos == file.npos ? 0 : (file.c_str() + dotPos);
-  if(ext && (Strucmp(ext, ".exe") == 0 ||
-    Strucmp(ext, ".com") == 0 ||
-    Strucmp(ext, ".cmd") == 0 ||
-    Strucmp(ext, ".bat") == 0))
-    {
-    mode |= (_S_IEXEC  | (_S_IEXEC  >> 3) | (_S_IEXEC  >> 6));
-    }
-#else
-  struct stat st;
-  if ( stat(file.c_str(), &st) < 0 )
-    {
-    return false;
-    }
-  mode = st.st_mode;
-#endif
-  return true;
-}
-
-bool SystemTools::SetPermissions(const char* file, mode_t mode)
-{
-  if ( !file )
-    {
-    return false;
-    }
-  return SystemTools::SetPermissions(kwsys_stl::string(file), mode);
-}
-
-bool SystemTools::SetPermissions(const kwsys_stl::string& file, mode_t mode)
-{
-  if ( !SystemTools::FileExists(file) )
-    {
-    return false;
-    }
-#ifdef _WIN32
-  if ( _wchmod(SystemTools::ConvertToWindowsExtendedPath(file).c_str(),
-               mode) < 0 )
-#else
-  if ( chmod(file.c_str(), mode) < 0 )
-#endif
-    {
-    return false;
-    }
-
-  return true;
-}
-
-kwsys_stl::string SystemTools::GetParentDirectory(const kwsys_stl::string& fileOrDir)
-{
-  return SystemTools::GetFilenamePath(fileOrDir);
-}
-
-bool SystemTools::IsSubDirectory(const kwsys_stl::string& cSubdir, const kwsys_stl::string& cDir)
-{
-  if(cDir.empty())
-    {
-    return false;
-    }
-  kwsys_stl::string subdir = cSubdir;
-  kwsys_stl::string dir = cDir;
-  SystemTools::ConvertToUnixSlashes(subdir);
-  SystemTools::ConvertToUnixSlashes(dir);
-  if(subdir.size() > dir.size() && subdir[dir.size()] == '/')
-    {
-    std::string s = subdir.substr(0, dir.size());
-    return SystemTools::ComparePath(s, dir);
-    }
-  return false;
-}
-
-void SystemTools::Delay(unsigned int msec)
-{
-#ifdef _WIN32
-  Sleep(msec);
-#else
-  // The sleep function gives 1 second resolution and the usleep
-  // function gives 1e-6 second resolution but on some platforms has a
-  // maximum sleep time of 1 second.  This could be re-implemented to
-  // use select with masked signals or pselect to mask signals
-  // atomically.  If select is given empty sets and zero as the max
-  // file descriptor but a non-zero timeout it can be used to block
-  // for a precise amount of time.
-  if(msec >= 1000)
-    {
-    sleep(msec / 1000);
-    usleep((msec % 1000) * 1000);
-    }
-  else
-    {
-    usleep(msec * 1000);
-    }
-#endif
-}
-
-kwsys_stl::string SystemTools::GetOperatingSystemNameAndVersion()
-{
-  kwsys_stl::string res;
-
-#ifdef _WIN32
-  char buffer[256];
-
-  OSVERSIONINFOEXA osvi;
-  BOOL bOsVersionInfoEx;
-
-  // Try calling GetVersionEx using the OSVERSIONINFOEX structure.
-  // If that fails, try using the OSVERSIONINFO structure.
-
-  ZeroMemory(&osvi, sizeof(OSVERSIONINFOEXA));
-  osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEXA);
-
-#ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
-# pragma warning (push)
-# pragma warning (disable:4996)
-#endif
-  bOsVersionInfoEx = GetVersionEx((OSVERSIONINFO *)&osvi);
-  if (!bOsVersionInfoEx)
-    {
-    osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-    if (!GetVersionEx((OSVERSIONINFO *)&osvi))
-      {
-      return 0;
-      }
-    }
-#ifdef KWSYS_WINDOWS_DEPRECATED_GetVersionEx
-# pragma warning (pop)
-#endif
-
-  switch (osvi.dwPlatformId)
-    {
-    // Test for the Windows NT product family.
-
-    case VER_PLATFORM_WIN32_NT:
-
-      // Test for the specific product family.
-
-      if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0)
-        {
-#if (_MSC_VER >= 1300)
-        if (osvi.wProductType == VER_NT_WORKSTATION)
-          {
-          res += "Microsoft Windows Vista";
-          }
-        else
-          {
-          res += "Microsoft Windows Server 2008 family";
-          }
-#else
-        res += "Microsoft Windows Vista or Windows Server 2008";
-#endif
-        }
-
-      if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2)
-        {
-        res += "Microsoft Windows Server 2003 family";
-        }
-
-      if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1)
-        {
-        res += "Microsoft Windows XP";
-        }
-
-      if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0)
-        {
-        res += "Microsoft Windows 2000";
-        }
-
-      if (osvi.dwMajorVersion <= 4)
-        {
-        res += "Microsoft Windows NT";
-        }
-
-      // Test for specific product on Windows NT 4.0 SP6 and later.
-
-      if (bOsVersionInfoEx)
-        {
-        // Test for the workstation type.
-
-#if (_MSC_VER >= 1300)
-        if (osvi.wProductType == VER_NT_WORKSTATION)
-          {
-          if (osvi.dwMajorVersion == 4)
-            {
-            res += " Workstation 4.0";
-            }
-          else if (osvi.dwMajorVersion == 5)
-            {
-            if (osvi.wSuiteMask & VER_SUITE_PERSONAL)
-              {
-              res += " Home Edition";
-              }
-            else
-              {
-              res += " Professional";
-              }
-            }
-          }
-
-        // Test for the server type.
-
-        else if (osvi.wProductType == VER_NT_SERVER)
-          {
-          if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2)
-            {
-            if (osvi.wSuiteMask & VER_SUITE_DATACENTER)
-              {
-              res += " Datacenter Edition";
-              }
-            else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE)
-              {
-              res += " Enterprise Edition";
-              }
-            else if (osvi.wSuiteMask == VER_SUITE_BLADE)
-              {
-              res += " Web Edition";
-              }
-            else
-              {
-              res += " Standard Edition";
-              }
-            }
-
-          else if (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0)
-            {
-            if (osvi.wSuiteMask & VER_SUITE_DATACENTER)
-              {
-              res += " Datacenter Server";
-              }
-            else if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE)
-              {
-              res += " Advanced Server";
-              }
-            else
-              {
-              res += " Server";
-              }
-            }
-
-          else if (osvi.dwMajorVersion <= 4)  // Windows NT 4.0
-            {
-            if (osvi.wSuiteMask & VER_SUITE_ENTERPRISE)
-              {
-              res += " Server 4.0, Enterprise Edition";
-              }
-            else
-              {
-              res += " Server 4.0";
-              }
-            }
-          }
-#endif // Visual Studio 7 and up
-        }
-
-      // Test for specific product on Windows NT 4.0 SP5 and earlier
-
-      else
-        {
-        HKEY hKey;
-        #define BUFSIZE 80
-        wchar_t szProductType[BUFSIZE];
-        DWORD dwBufLen=BUFSIZE;
-        LONG lRet;
-
-        lRet = RegOpenKeyExW(
-          HKEY_LOCAL_MACHINE,
-          L"SYSTEM\\CurrentControlSet\\Control\\ProductOptions",
-          0, KEY_QUERY_VALUE, &hKey);
-        if (lRet != ERROR_SUCCESS)
-          {
-          return 0;
-          }
-
-        lRet = RegQueryValueExW(hKey, L"ProductType", NULL, NULL,
-                                (LPBYTE) szProductType, &dwBufLen);
-
-        if ((lRet != ERROR_SUCCESS) || (dwBufLen > BUFSIZE))
-          {
-          return 0;
-          }
-
-        RegCloseKey(hKey);
-
-        if (lstrcmpiW(L"WINNT", szProductType) == 0)
-          {
-          res += " Workstation";
-          }
-        if (lstrcmpiW(L"LANMANNT", szProductType) == 0)
-          {
-          res += " Server";
-          }
-        if (lstrcmpiW(L"SERVERNT", szProductType) == 0)
-          {
-          res += " Advanced Server";
-          }
-
-        res += " ";
-        sprintf(buffer, "%ld", osvi.dwMajorVersion);
-        res += buffer;
-        res += ".";
-        sprintf(buffer, "%ld", osvi.dwMinorVersion);
-        res += buffer;
-        }
-
-      // Display service pack (if any) and build number.
-
-      if (osvi.dwMajorVersion == 4 &&
-          lstrcmpiA(osvi.szCSDVersion, "Service Pack 6") == 0)
-        {
-        HKEY hKey;
-        LONG lRet;
-
-        // Test for SP6 versus SP6a.
-
-        lRet = RegOpenKeyExW(
-          HKEY_LOCAL_MACHINE,
-          L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Hotfix\\Q246009",
-          0, KEY_QUERY_VALUE, &hKey);
-
-        if (lRet == ERROR_SUCCESS)
-          {
-          res += " Service Pack 6a (Build ";
-          sprintf(buffer, "%ld", osvi.dwBuildNumber & 0xFFFF);
-          res += buffer;
-          res += ")";
-          }
-        else // Windows NT 4.0 prior to SP6a
-          {
-          res += " ";
-          res += osvi.szCSDVersion;
-          res += " (Build ";
-          sprintf(buffer, "%ld", osvi.dwBuildNumber & 0xFFFF);
-          res += buffer;
-          res += ")";
-          }
-
-        RegCloseKey(hKey);
-        }
-      else // Windows NT 3.51 and earlier or Windows 2000 and later
-        {
-        res += " ";
-        res += osvi.szCSDVersion;
-        res += " (Build ";
-        sprintf(buffer, "%ld", osvi.dwBuildNumber & 0xFFFF);
-        res += buffer;
-        res += ")";
-        }
-
-      break;
-
-      // Test for the Windows 95 product family.
-
-    case VER_PLATFORM_WIN32_WINDOWS:
-
-      if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0)
-        {
-        res += "Microsoft Windows 95";
-        if (osvi.szCSDVersion[1] == 'C' || osvi.szCSDVersion[1] == 'B')
-          {
-          res += " OSR2";
-          }
-        }
-
-      if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10)
-        {
-        res += "Microsoft Windows 98";
-        if (osvi.szCSDVersion[1] == 'A')
-          {
-          res += " SE";
-          }
-        }
-
-      if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90)
-        {
-        res += "Microsoft Windows Millennium Edition";
-        }
-      break;
-
-    case VER_PLATFORM_WIN32s:
-
-      res +=  "Microsoft Win32s";
-      break;
-    }
-#endif
-
-  return res;
-}
-
-// ----------------------------------------------------------------------
-bool SystemTools::ParseURLProtocol( const kwsys_stl::string& URL,
-                                    kwsys_stl::string& protocol,
-                                    kwsys_stl::string& dataglom )
-{
-  // match 0 entire url
-  // match 1 protocol
-  // match 2 dataglom following protocol://
-  kwsys::RegularExpression urlRe( VTK_URL_PROTOCOL_REGEX );
-
-  if ( ! urlRe.find( URL ) ) return false;
-
-  protocol = urlRe.match( 1 );
-  dataglom = urlRe.match( 2 );
-
-  return true;
-}
-
-// ----------------------------------------------------------------------
-bool SystemTools::ParseURL( const kwsys_stl::string& URL,
-                            kwsys_stl::string& protocol,
-                            kwsys_stl::string& username,
-                            kwsys_stl::string& password,
-                            kwsys_stl::string& hostname,
-                            kwsys_stl::string& dataport,
-                            kwsys_stl::string& database )
-{
-  kwsys::RegularExpression urlRe( VTK_URL_REGEX );
-  if ( ! urlRe.find( URL ) ) return false;
-
-  // match 0 URL
-  // match 1 protocol
-  // match 2 mangled user
-  // match 3 username
-  // match 4 mangled password
-  // match 5 password
-  // match 6 hostname
-  // match 7 mangled port
-  // match 8 dataport
-  // match 9 database name
-
-  protocol = urlRe.match( 1 );
-  username = urlRe.match( 3 );
-  password = urlRe.match( 5 );
-  hostname = urlRe.match( 6 );
-  dataport = urlRe.match( 8 );
-  database = urlRe.match( 9 );
-
-  return true;
-}
-
-// ----------------------------------------------------------------------
-// These must NOT be initialized.  Default initialization to zero is
-// necessary.
-static unsigned int SystemToolsManagerCount;
-SystemToolsTranslationMap *SystemTools::TranslationMap;
-SystemToolsTranslationMap *SystemTools::LongPathMap;
-#ifdef __CYGWIN__
-SystemToolsTranslationMap *SystemTools::Cyg2Win32Map;
-#endif
-
-// SystemToolsManager manages the SystemTools singleton.
-// SystemToolsManager should be included in any translation unit
-// that will use SystemTools or that implements the singleton
-// pattern. It makes sure that the SystemTools singleton is created
-// before and destroyed after all other singletons in CMake.
-
-SystemToolsManager::SystemToolsManager()
-{
-  if(++SystemToolsManagerCount == 1)
-    {
-    SystemTools::ClassInitialize();
-    }
-}
-
-SystemToolsManager::~SystemToolsManager()
-{
-  if(--SystemToolsManagerCount == 0)
-    {
-    SystemTools::ClassFinalize();
-    }
-}
-
-#if defined(__VMS)
-// On VMS we configure the run time C library to be more UNIX like.
-// http://h71000.www7.hp.com/doc/732final/5763/5763pro_004.html
-extern "C" int decc$feature_get_index(char *name);
-extern "C" int decc$feature_set_value(int index, int mode, int value);
-static int SetVMSFeature(char* name, int value)
-{
-  int i;
-  errno = 0;
-  i = decc$feature_get_index(name);
-  return i >= 0 && (decc$feature_set_value(i, 1, value) >= 0 || errno == 0);
-}
-#endif
-
-void SystemTools::ClassInitialize()
-{
-#ifdef __VMS
-  SetVMSFeature("DECC$FILENAME_UNIX_ONLY", 1);
-#endif
-  // Allocate the translation map first.
-  SystemTools::TranslationMap = new SystemToolsTranslationMap;
-  SystemTools::LongPathMap = new SystemToolsTranslationMap;
-#ifdef __CYGWIN__
-  SystemTools::Cyg2Win32Map = new SystemToolsTranslationMap;
-#endif
-
-  // Add some special translation paths for unix.  These are not added
-  // for windows because drive letters need to be maintained.  Also,
-  // there are not sym-links and mount points on windows anyway.
-#if !defined(_WIN32) || defined(__CYGWIN__)
-  // The tmp path is frequently a logical path so always keep it:
-  SystemTools::AddKeepPath("/tmp/");
-
-  // If the current working directory is a logical path then keep the
-  // logical name.
-  if(const char* pwd = getenv("PWD"))
-    {
-    char buf[2048];
-    if(const char* cwd = Getcwd(buf, 2048))
-      {
-      // The current working directory may be a logical path.  Find
-      // the shortest logical path that still produces the correct
-      // physical path.
-      kwsys_stl::string cwd_changed;
-      kwsys_stl::string pwd_changed;
-
-      // Test progressively shorter logical-to-physical mappings.
-      kwsys_stl::string pwd_str = pwd;
-      kwsys_stl::string cwd_str = cwd;
-      kwsys_stl::string pwd_path;
-      Realpath(pwd, pwd_path);
-      while(cwd_str == pwd_path && cwd_str != pwd_str)
-        {
-        // The current pair of paths is a working logical mapping.
-        cwd_changed = cwd_str;
-        pwd_changed = pwd_str;
-
-        // Strip off one directory level and see if the logical
-        // mapping still works.
-        pwd_str = SystemTools::GetFilenamePath(pwd_str);
-        cwd_str = SystemTools::GetFilenamePath(cwd_str);
-        Realpath(pwd_str.c_str(), pwd_path);
-        }
-
-      // Add the translation to keep the logical path name.
-      if(!cwd_changed.empty() && !pwd_changed.empty())
-        {
-        SystemTools::AddTranslationPath(cwd_changed,
-                                        pwd_changed);
-        }
-      }
-    }
-#endif
-}
-
-void SystemTools::ClassFinalize()
-{
-  delete SystemTools::TranslationMap;
-  delete SystemTools::LongPathMap;
-#ifdef __CYGWIN__
-  delete SystemTools::Cyg2Win32Map;
-#endif
-}
-
-
-} // namespace KWSYS_NAMESPACE
-
-#if defined(_MSC_VER) && defined(_DEBUG)
-# include <crtdbg.h>
-# include <stdio.h>
-# include <stdlib.h>
-namespace KWSYS_NAMESPACE
-{
-
-static int SystemToolsDebugReport(int, char* message, int*)
-{
-  fprintf(stderr, "%s", message);
-  fflush(stderr);
-  return 1; // no further reporting required
-}
-
-void SystemTools::EnableMSVCDebugHook()
-{
-  if (getenv("DART_TEST_FROM_DART") ||
-      getenv("DASHBOARD_TEST_FROM_CTEST"))
-    {
-    _CrtSetReportHook(SystemToolsDebugReport);
-    }
-}
-
-} // namespace KWSYS_NAMESPACE
-#else
-namespace KWSYS_NAMESPACE
-{
-void SystemTools::EnableMSVCDebugHook() {}
-} // namespace KWSYS_NAMESPACE
-#endif
diff --git a/src/kwsys/SystemTools.hxx.in b/src/kwsys/SystemTools.hxx.in
deleted file mode 100644
index beb2a7e..0000000
--- a/src/kwsys/SystemTools.hxx.in
+++ /dev/null
@@ -1,959 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef @KWSYS_NAMESPACE at _SystemTools_hxx
-#define @KWSYS_NAMESPACE at _SystemTools_hxx
-
-#include <@KWSYS_NAMESPACE@/ios/iosfwd>
-#include <@KWSYS_NAMESPACE@/stl/string>
-#include <@KWSYS_NAMESPACE@/stl/vector>
-#include <@KWSYS_NAMESPACE@/stl/map>
-
-#include <@KWSYS_NAMESPACE@/Configure.h>
-#include <@KWSYS_NAMESPACE@/String.hxx>
-
-#include <sys/types.h>
-
-// Required for va_list
-#include <stdarg.h>
-// Required for FILE*
-#include <stdio.h>
-#if @KWSYS_NAMESPACE at _STL_HAVE_STD && !defined(va_list)
-// Some compilers move va_list into the std namespace and there is no way to
-// tell that this has been done. Playing with things being included before or
-// after stdarg.h does not solve things because we do not have control over
-// what the user does. This hack solves this problem by moving va_list to our
-// own namespace that is local for kwsys.
-namespace std {} // Required for platforms that do not have std namespace
-namespace @KWSYS_NAMESPACE at _VA_LIST
-{
-  using namespace std;
-  typedef va_list hack_va_list;
-}
-namespace @KWSYS_NAMESPACE@
-{
-  typedef @KWSYS_NAMESPACE at _VA_LIST::hack_va_list va_list;
-}
-#endif // va_list
-
-/* Define these macros temporarily to keep the code readable.  */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
-# define kwsys_stl @KWSYS_NAMESPACE at _stl
-# define kwsys_ios @KWSYS_NAMESPACE at _ios
-#endif
-
-namespace @KWSYS_NAMESPACE@
-{
-
-class SystemToolsTranslationMap;
-/** \class SystemToolsManager
- * \brief Use to make sure SystemTools is initialized before it is used
- * and is the last static object destroyed
- */
-class @KWSYS_NAMESPACE at _EXPORT SystemToolsManager
-{
-public:
-  SystemToolsManager();
-  ~SystemToolsManager();
-};
-
-// This instance will show up in any translation unit that uses
-// SystemTools. It will make sure SystemTools is initialized 
-// before it is used and is the last static object destroyed.
-static SystemToolsManager SystemToolsManagerInstance;
-
-/** \class SystemTools
- * \brief A collection of useful platform-independent system functions.
- */
-class @KWSYS_NAMESPACE at _EXPORT SystemTools
-{
-public:
-
-  /** -----------------------------------------------------------------
-   *               String Manipulation Routines
-   *  -----------------------------------------------------------------
-   */
-
-  /**
-   * Replace symbols in str that are not valid in C identifiers as
-   * defined by the 1999 standard, ie. anything except [A-Za-z0-9_].
-   * They are replaced with `_' and if the first character is a digit
-   * then an underscore is prepended.  Note that this can produce
-   * identifiers that the standard reserves (_[A-Z].* and __.*).
-   */
-  static kwsys_stl::string MakeCidentifier(const kwsys_stl::string& s);
-
-  static kwsys_stl::string MakeCindentifier(const kwsys_stl::string& s)
-  {
-    return MakeCidentifier(s);
-  }
-
-  /**
-   * Replace replace all occurences of the string in the source string.
-   */
-  static void ReplaceString(kwsys_stl::string& source,
-                            const char* replace,
-                            const char* with);
-  static void ReplaceString(kwsys_stl::string& source,
-                            const kwsys_stl::string& replace,
-                            const kwsys_stl::string& with);
-
-  /**
-   * Return a capitalized string (i.e the first letter is uppercased,
-   * all other are lowercased).
-   */
-  static kwsys_stl::string Capitalized(const kwsys_stl::string&);
-  
-  /**
-   * Return a 'capitalized words' string (i.e the first letter of each word
-   * is uppercased all other are left untouched though).
-   */
-  static kwsys_stl::string CapitalizedWords(const kwsys_stl::string&);
-  
-  /**
-   * Return a 'uncapitalized words' string (i.e the first letter of each word
-   * is lowercased all other are left untouched though).
-   */
-  static kwsys_stl::string UnCapitalizedWords(const kwsys_stl::string&);
-  
-  /**
-   * Return a lower case string
-   */
-  static kwsys_stl::string LowerCase(const kwsys_stl::string&);
-  
-  /**
-   * Return a lower case string
-   */
-  static kwsys_stl::string UpperCase(const kwsys_stl::string&);
-  
-  /**
-   * Count char in string
-   */
-  static size_t CountChar(const char* str, char c);
-  
-  /**
-   * Remove some characters from a string.
-   * Return a pointer to the new resulting string (allocated with 'new')
-   */
-  static char* RemoveChars(const char* str, const char *toremove);
-
-  /**
-   * Remove remove all but 0->9, A->F characters from a string.
-   * Return a pointer to the new resulting string (allocated with 'new')
-   */
-  static char* RemoveCharsButUpperHex(const char* str);
-  
-  /**
-   * Replace some characters by another character in a string (in-place)
-   * Return a pointer to string
-   */
-  static char* ReplaceChars(char* str, const char *toreplace,char replacement);
-  
-  /**
-   * Returns true if str1 starts (respectively ends) with str2
-   */
-  static bool StringStartsWith(const char* str1, const char* str2);
-  static bool StringStartsWith(const kwsys_stl::string& str1, const char* str2);
-  static bool StringEndsWith(const char* str1, const char* str2);
-  static bool StringEndsWith(const kwsys_stl::string& str1, const char* str2);
-
-  /**
-   * Returns a pointer to the last occurence of str2 in str1
-   */
-  static const char* FindLastString(const char* str1, const char* str2);
-  
-  /**
-   * Make a duplicate of the string similar to the strdup C function
-   * but use new to create the 'new' string, so one can use
-   * 'delete' to remove it. Returns 0 if the input is empty.
-   */
-  static char* DuplicateString(const char* str);
-  
-  /**
-   * Return the string cropped to a given length by removing chars in the
-   * center of the string and replacing them with an ellipsis (...)
-   */
-  static kwsys_stl::string CropString(const kwsys_stl::string&,size_t max_len);
-  
-  /** split a path by separator into an array of strings, default is /.
-      If isPath is true then the string is treated like a path and if
-      s starts with a / then the first element of the returned array will
-      be /, so /foo/bar will be [/, foo, bar]
-  */  
-  static kwsys_stl::vector<String> SplitString(const kwsys_stl::string& s, char separator = '/',
-                                               bool isPath = false);
-  /**
-   * Perform a case-independent string comparison
-   */
-  static int Strucmp(const char *s1, const char *s2);
-
-  /** 
-   * Convert a string in __DATE__ or __TIMESTAMP__ format into a time_t.
-   * Return false on error, true on success
-   */
-  static bool ConvertDateMacroString(const char *str, time_t *tmt);
-  static bool ConvertTimeStampMacroString(const char *str, time_t *tmt);
-
-  /**
-   * Split a string on its newlines into multiple lines
-   * Return false only if the last line stored had no newline
-   */
-  static bool Split(const kwsys_stl::string& s, kwsys_stl::vector<kwsys_stl::string>& l);
-  static bool Split(const kwsys_stl::string& s, kwsys_stl::vector<kwsys_stl::string>& l, char separator);
-  
-  /** 
-   * Return string with space added between capitalized words
-   * (i.e. EatMyShorts becomes Eat My Shorts )
-   * (note that IEatShorts becomes IEat Shorts) 
-   */
-  static kwsys_stl::string AddSpaceBetweenCapitalizedWords(
-    const kwsys_stl::string&);
-
-  /**
-   * Append two or more strings and produce new one.
-   * Programmer must 'delete []' the resulting string, which was allocated
-   * with 'new'.
-   * Return 0 if inputs are empty or there was an error
-   */
-  static char* AppendStrings(
-    const char* str1, const char* str2);
-  static char* AppendStrings(
-    const char* str1, const char* str2, const char* str3);
-
-  /**
-   * Estimate the length of the string that will be produced
-   * from printing the given format string and arguments.  The
-   * returned length will always be at least as large as the string
-   * that will result from printing.
-   * WARNING: since va_arg is called to iterate of the argument list,
-   * you will not be able to use this 'ap' anymore from the beginning.
-   * It's up to you to call va_end though.
-   */
-  static int EstimateFormatLength(const char *format, va_list ap);
-
-  /**
-   * Escape specific characters in 'str'.
-   */
-  static kwsys_stl::string EscapeChars(
-    const char *str, const char *chars_to_escape, char escape_char = '\\');
-
-  /** -----------------------------------------------------------------
-   *               Filename Manipulation Routines
-   *  -----------------------------------------------------------------
-   */
-
-  /**
-   * Replace Windows file system slashes with Unix-style slashes.
-   */
-  static void ConvertToUnixSlashes(kwsys_stl::string& path);
-
-#ifdef _WIN32
-  /**
-   * Convert the path to an extended length path to avoid MAX_PATH length
-   * limitations on Windows. If the input is a local path the result will be
-   * prefixed with \\?\; if the input is instead a network path, the result
-   * will be prefixed with \\?\UNC\. All output will also be converted to
-   * absolute paths with Windows-style backslashes.
-   **/
-  static kwsys_stl::wstring ConvertToWindowsExtendedPath(const kwsys_stl::string&);
-#endif
-
-  /**
-   * For windows this calls ConvertToWindowsOutputPath and for unix
-   * it calls ConvertToUnixOutputPath
-   */
-  static kwsys_stl::string ConvertToOutputPath(const kwsys_stl::string&);
-
-  /**
-   * Convert the path to a string that can be used in a unix makefile.
-   * double slashes are removed, and spaces are escaped.
-   */
-  static kwsys_stl::string ConvertToUnixOutputPath(const kwsys_stl::string&);
-
-  /**
-   * Convert the path to string that can be used in a windows project or
-   * makefile.   Double slashes are removed if they are not at the start of
-   * the string, the slashes are converted to windows style backslashes, and
-   * if there are spaces in the string it is double quoted.
-   */
-  static kwsys_stl::string ConvertToWindowsOutputPath(const kwsys_stl::string&);
-
-  /**
-   * Return true if a file exists in the current directory.
-   * If isFile = true, then make sure the file is a file and 
-   * not a directory.  If isFile = false, then return true
-   * if it is a file or a directory.
-   */
-  static bool FileExists(const char* filename, bool isFile);
-  static bool FileExists(const kwsys_stl::string& filename, bool isFile);
-  static bool FileExists(const char* filename);
-  static bool FileExists(const kwsys_stl::string& filename);
-
-  /**
-   * Converts Cygwin path to Win32 path. Uses dictionary container for
-   * caching and calls to cygwin_conv_to_win32_path from Cygwin dll
-   * for actual translation.  Returns true on success, else false.
-   */
-#ifdef __CYGWIN__
-  static bool PathCygwinToWin32(const char *path, char *win32_path);
-#endif
-
-  /**
-   * Return file length
-   */
-  static unsigned long FileLength(const kwsys_stl::string& filename);
-
-  /**
-     Change the modification time or create a file
-  */
-  static bool Touch(const kwsys_stl::string& filename, bool create);
-  
-  /**
-   *  Compare file modification times.
-   *  Return true for successful comparison and false for error.
-   *  When true is returned, result has -1, 0, +1 for
-   *  f1 older, same, or newer than f2.
-   */
-  static bool FileTimeCompare(const kwsys_stl::string& f1,
-                              const kwsys_stl::string& f2,
-                              int* result);
-
-  /**
-   *  Get the file extension (including ".") needed for an executable
-   *  on the current platform ("" for unix, ".exe" for Windows).
-   */
-  static const char* GetExecutableExtension();
-
-  /**
-   *  Given a path that exists on a windows machine, return the
-   *  actuall case of the path as it was created.  If the file
-   *  does not exist path is returned unchanged.  This does nothing
-   *  on unix but return path.
-   */
-  static kwsys_stl::string GetActualCaseForPath(const kwsys_stl::string& path);
-
-  /**
-   * Given the path to a program executable, get the directory part of
-   * the path with the file stripped off.  If there is no directory
-   * part, the empty string is returned.
-   */
-  static kwsys_stl::string GetProgramPath(const kwsys_stl::string&);
-  static bool SplitProgramPath(const kwsys_stl::string& in_name,
-                               kwsys_stl::string& dir,
-                               kwsys_stl::string& file,
-                               bool errorReport = true);
-
-  /**
-   *  Given argv[0] for a unix program find the full path to a running
-   *  executable.  argv0 can be null for windows WinMain programs
-   *  in this case GetModuleFileName will be used to find the path
-   *  to the running executable.  If argv0 is not a full path,
-   *  then this will try to find the full path.  If the path is not
-   *  found false is returned, if found true is returned.  An error
-   *  message of the attempted paths is stored in errorMsg.  
-   *  exeName is the name of the executable.
-   *  buildDir is a possibly null path to the build directory.
-   *  installPrefix is a possibly null pointer to the install directory.
-   */
-  static bool FindProgramPath(const char* argv0,
-                              kwsys_stl::string& pathOut,
-                              kwsys_stl::string& errorMsg,
-                              const char* exeName = 0,
-                              const char* buildDir = 0,
-                              const char* installPrefix = 0);
-
-  /**
-   * Given a path to a file or directory, convert it to a full path.
-   * This collapses away relative paths relative to the cwd argument
-   * (which defaults to the current working directory).  The full path
-   * is returned.
-   */
-  static kwsys_stl::string CollapseFullPath(const kwsys_stl::string& in_relative);
-  static kwsys_stl::string CollapseFullPath(const kwsys_stl::string& in_relative,
-                                            const char* in_base);
-  static kwsys_stl::string CollapseFullPath(const kwsys_stl::string& in_relative,
-                                            const kwsys_stl::string& in_base);
-
-  /** 
-   * Get the real path for a given path, removing all symlinks.  In
-   * the event of an error (non-existent path, permissions issue,
-   * etc.) the original path is returned.
-   */
-  static kwsys_stl::string GetRealPath(const kwsys_stl::string& path);
-
-  /**
-   * Split a path name into its root component and the rest of the
-   * path.  The root component is one of the following:
-   *    "/"   = UNIX full path
-   *    "c:/" = Windows full path (can be any drive letter)
-   *    "c:"  = Windows drive-letter relative path (can be any drive letter)
-   *    "//"  = Network path
-   *    "~/"  = Home path for current user
-   *    "~u/" = Home path for user 'u'
-   *    ""    = Relative path
-   *
-   * A pointer to the rest of the path after the root component is
-   * returned.  The root component is stored in the "root" string if
-   * given.
-   */
-  static const char* SplitPathRootComponent(const std::string& p,
-                                            kwsys_stl::string* root=0);
-
-  /**
-   * Split a path name into its basic components.  The first component
-   * always exists and is the root returned by SplitPathRootComponent.
-   * The remaining components form the path.  If there is a trailing
-   * slash then the last component is the empty string.  The
-   * components can be recombined as "c[0]c[1]/c[2]/.../c[n]" to
-   * produce the original path.  Home directory references are
-   * automatically expanded if expand_home_dir is true and this
-   * platform supports them.
-   */
-  static void SplitPath(const std::string& p,
-                        kwsys_stl::vector<kwsys_stl::string>& components,
-                        bool expand_home_dir = true);
-
-  /**
-   * Join components of a path name into a single string.  See
-   * SplitPath for the format of the components.
-   */
-  static kwsys_stl::string JoinPath(
-    const kwsys_stl::vector<kwsys_stl::string>& components);
-  static kwsys_stl::string JoinPath(
-    kwsys_stl::vector<kwsys_stl::string>::const_iterator first,
-    kwsys_stl::vector<kwsys_stl::string>::const_iterator last);
-
-  /**
-   * Compare a path or components of a path.
-   */
-  static bool ComparePath(const kwsys_stl::string& c1, const kwsys_stl::string& c2);
-
-
-  /**
-   * Return path of a full filename (no trailing slashes)
-   */
-  static kwsys_stl::string GetFilenamePath(const kwsys_stl::string&);
-
-  /**
-   * Return file name of a full filename (i.e. file name without path)
-   */
-  static kwsys_stl::string GetFilenameName(const kwsys_stl::string&);
-
-  /**
-   * Split a program from its arguments and handle spaces in the paths
-   */
-  static void SplitProgramFromArgs(
-    const kwsys_stl::string& path,
-    kwsys_stl::string& program, kwsys_stl::string& args);
-
-  /**
-   * Return longest file extension of a full filename (dot included)
-   */
-  static kwsys_stl::string GetFilenameExtension(const kwsys_stl::string&);
-
-  /**
-   * Return shortest file extension of a full filename (dot included)
-   */
-  static kwsys_stl::string GetFilenameLastExtension(
-    const kwsys_stl::string& filename);
-  
-  /**
-   * Return file name without extension of a full filename
-   */
-  static kwsys_stl::string GetFilenameWithoutExtension(
-    const kwsys_stl::string&);
-  
-  /**
-   * Return file name without its last (shortest) extension
-   */
-  static kwsys_stl::string GetFilenameWithoutLastExtension(
-    const kwsys_stl::string&);
-  
-  /**
-   * Return whether the path represents a full path (not relative)
-   */
-  static bool FileIsFullPath(const kwsys_stl::string&);
-  static bool FileIsFullPath(const char*);
-  
-  /**
-   * For windows return the short path for the given path,
-   * Unix just a pass through
-   */
-  static bool GetShortPath(const kwsys_stl::string& path, kwsys_stl::string& result);
-  
-  /**
-   * Read line from file. Make sure to get everything. Due to a buggy stream
-   * library on the HP and another on Mac OS X, we need this very carefully
-   * written version of getline. Returns true if any data were read before the
-   * end-of-file was reached. If the has_newline argument is specified, it will
-   * be true when the line read had a newline character.
-   */
-  static bool GetLineFromStream(kwsys_ios::istream& istr, 
-                                kwsys_stl::string& line,
-                                bool* has_newline=0,
-                                long sizeLimit=-1);
-
-  /**
-   * Get the parent directory of the directory or file
-   */
-  static kwsys_stl::string GetParentDirectory(const kwsys_stl::string& fileOrDir);
-
-  /**
-   * Check if the given file or directory is in subdirectory of dir
-   */
-  static bool IsSubDirectory(const kwsys_stl::string& fileOrDir, const kwsys_stl::string& dir);
-
-  /** -----------------------------------------------------------------
-   *               File Manipulation Routines
-   *  -----------------------------------------------------------------
-   */
-
-  /**
-   * Open a file considering unicode.
-   */
-  static FILE* Fopen(const kwsys_stl::string& file, const char* mode);
-
-  /**
-   * Make a new directory if it is not there.  This function
-   * can make a full path even if none of the directories existed
-   * prior to calling this function.  
-   */
-  static bool MakeDirectory(const char* path);
-  static bool MakeDirectory(const kwsys_stl::string& path);
-
-  /**
-   * Copy the source file to the destination file only
-   * if the two files differ.
-   */
-  static bool CopyFileIfDifferent(const kwsys_stl::string& source,
-                                  const kwsys_stl::string& destination);
-
-  /**
-   * Compare the contents of two files.  Return true if different
-   */
-  static bool FilesDiffer(const kwsys_stl::string& source, const kwsys_stl::string& destination);
-
-  /**
-   * Return true if the two files are the same file
-   */
-  static bool SameFile(const kwsys_stl::string& file1, const kwsys_stl::string& file2);
-
-  /**
-   * Copy a file.
-   */
-  static bool CopyFileAlways(const kwsys_stl::string& source, const kwsys_stl::string& destination);
-
-  /**
-   * Copy a file.  If the "always" argument is true the file is always
-   * copied.  If it is false, the file is copied only if it is new or
-   * has changed.
-   */
-  static bool CopyAFile(const kwsys_stl::string& source, const kwsys_stl::string& destination,
-                        bool always = true);
-
-  /**
-   * Copy content directory to another directory with all files and
-   * subdirectories.  If the "always" argument is true all files are
-   * always copied.  If it is false, only files that have changed or
-   * are new are copied.
-   */
-  static bool CopyADirectory(const kwsys_stl::string& source, const kwsys_stl::string& destination,
-                             bool always = true);
-  
-  /**
-   * Remove a file
-   */
-  static bool RemoveFile(const kwsys_stl::string& source);
-  
-  /**
-   * Remove a directory
-   */
-  static bool RemoveADirectory(const kwsys_stl::string& source);
-
-  /**
-   * Get the maximum full file path length
-   */
-  static size_t GetMaximumFilePathLength();
-
-  /**
-   * Find a file in the system PATH, with optional extra paths
-   */
-  static kwsys_stl::string FindFile(
-    const kwsys_stl::string& name,
-    const kwsys_stl::vector<kwsys_stl::string>& path = 
-    kwsys_stl::vector<kwsys_stl::string>(),
-    bool no_system_path = false);
-
-  /**
-   * Find a directory in the system PATH, with optional extra paths
-   */
-  static kwsys_stl::string FindDirectory(
-    const kwsys_stl::string& name,
-    const kwsys_stl::vector<kwsys_stl::string>& path = 
-    kwsys_stl::vector<kwsys_stl::string>(),
-    bool no_system_path = false);
-
-  /**
-   * Find an executable in the system PATH, with optional extra paths
-   */
-  static kwsys_stl::string FindProgram(
-    const char* name,
-    const kwsys_stl::vector<kwsys_stl::string>& path =
-    kwsys_stl::vector<kwsys_stl::string>(),
-    bool no_system_path = false);
-  static kwsys_stl::string FindProgram(
-    const kwsys_stl::string& name,
-    const kwsys_stl::vector<kwsys_stl::string>& path =
-    kwsys_stl::vector<kwsys_stl::string>(),
-    bool no_system_path = false);
-  static kwsys_stl::string FindProgram(
-    const kwsys_stl::vector<kwsys_stl::string>& names,
-    const kwsys_stl::vector<kwsys_stl::string>& path =
-    kwsys_stl::vector<kwsys_stl::string>(),
-    bool no_system_path = false);
-
-  /**
-   * Find a library in the system PATH, with optional extra paths
-   */
-  static kwsys_stl::string FindLibrary(
-    const kwsys_stl::string& name,
-    const kwsys_stl::vector<kwsys_stl::string>& path);
-  
-  /**
-   * Return true if the file is a directory
-   */
-  static bool FileIsDirectory(const kwsys_stl::string& name);
-  
-  /**
-   * Return true if the file is a symlink
-   */
-  static bool FileIsSymlink(const kwsys_stl::string& name);
-  
-  /**
-   * Return true if the file has a given signature (first set of bytes)
-   */
-  static bool FileHasSignature(
-    const char* filename, const char *signature, long offset = 0);
-
-  /**
-   * Attempt to detect and return the type of a file.
-   * Up to 'length' bytes are read from the file, if more than 'percent_bin' %
-   * of the bytes are non-textual elements, the file is considered binary,
-   * otherwise textual. Textual elements are bytes in the ASCII [0x20, 0x7E]
-   * range, but also \\n, \\r, \\t.
-   * The algorithm is simplistic, and should probably check for usual file
-   * extensions, 'magic' signature, unicode, etc.
-   */
-  enum FileTypeEnum 
-  { 
-    FileTypeUnknown,
-    FileTypeBinary,
-    FileTypeText
-  };
-  static SystemTools::FileTypeEnum DetectFileType(
-    const char* filename, 
-    unsigned long length = 256, 
-    double percent_bin = 0.05);
-
-  /**
-   * Create a symbolic link if the platform supports it.  Returns whether
-   * creation succeded.
-   */
-  static bool CreateSymlink(const kwsys_stl::string& origName, const kwsys_stl::string& newName);
-
-  /**
-   * Read the contents of a symbolic link.  Returns whether reading
-   * succeded.
-   */
-  static bool ReadSymlink(const kwsys_stl::string& newName, kwsys_stl::string& origName);
-
-  /**
-   * Try to locate the file 'filename' in the directory 'dir'.
-   * If 'filename' is a fully qualified filename, the basename of the file is
-   * used to check for its existence in 'dir'.
-   * If 'dir' is not a directory, GetFilenamePath() is called on 'dir' to
-   * get its directory first (thus, you can pass a filename as 'dir', as
-   * a convenience).
-   * 'filename_found' is assigned the fully qualified name/path of the file
-   * if it is found (not touched otherwise).
-   * If 'try_filename_dirs' is true, try to find the file using the
-   * components of its path, i.e. if we are looking for c:/foo/bar/bill.txt, 
-   * first look for bill.txt in 'dir', then in 'dir'/bar, then in 'dir'/foo/bar
-   * etc.
-   * Return true if the file was found, false otherwise.
-   */
-  static bool LocateFileInDir(const char *filename, 
-                              const char *dir, 
-                              kwsys_stl::string& filename_found,
-                              int try_filename_dirs = 0);
-
-  /** compute the relative path from local to remote.  local must 
-      be a directory.  remote can be a file or a directory.  
-      Both remote and local must be full paths.  Basically, if
-      you are in directory local and you want to access the file in remote
-      what is the relative path to do that.  For example:
-      /a/b/c/d to /a/b/c1/d1 -> ../../c1/d1
-      from /usr/src to /usr/src/test/blah/foo.cpp -> test/blah/foo.cpp
-  */
-  static kwsys_stl::string RelativePath(const kwsys_stl::string& local, const kwsys_stl::string& remote);
-
-  /**
-   * Return file's modified time
-   */
-  static long int ModifiedTime(const kwsys_stl::string& filename);
-
-  /**
-   * Return file's creation time (Win32: works only for NTFS, not FAT)
-   */
-  static long int CreationTime(const kwsys_stl::string& filename);
-
-  #if defined( _MSC_VER )
-  typedef unsigned short mode_t;
-  #endif
-
-  /**
-   * Get and set permissions of the file.
-   */
-  static bool GetPermissions(const char* file, mode_t& mode);
-  static bool GetPermissions(const kwsys_stl::string& file, mode_t& mode);
-  static bool SetPermissions(const char* file, mode_t mode);
-  static bool SetPermissions(const kwsys_stl::string& file, mode_t mode);
-
-  /** -----------------------------------------------------------------
-   *               Time Manipulation Routines
-   *  -----------------------------------------------------------------
-   */
-
-  /** Get current time in seconds since Posix Epoch (Jan 1, 1970).  */
-  static double GetTime();
-
-  /**
-   * Get current date/time
-   */
-  static kwsys_stl::string GetCurrentDateTime(const char* format);
-
-  /** -----------------------------------------------------------------
-   *               Registry Manipulation Routines
-   *  -----------------------------------------------------------------
-   */
-
-  /**
-   * Specify access to the 32-bit or 64-bit application view of
-   * registry values.  The default is to match the currently running
-   * binary type.
-   */
-  enum KeyWOW64 { KeyWOW64_Default, KeyWOW64_32, KeyWOW64_64 };
-
-  /**
-   * Get a list of subkeys.
-   */
-  static bool GetRegistrySubKeys(const kwsys_stl::string& key,
-                                 kwsys_stl::vector<kwsys_stl::string>& subkeys,
-                                 KeyWOW64 view = KeyWOW64_Default);
-
-  /**
-   * Read a registry value
-   */
-  static bool ReadRegistryValue(const kwsys_stl::string& key, kwsys_stl::string &value,
-                                KeyWOW64 view = KeyWOW64_Default);
-
-  /**
-   * Write a registry value
-   */
-  static bool WriteRegistryValue(const kwsys_stl::string& key, const kwsys_stl::string& value,
-                                 KeyWOW64 view = KeyWOW64_Default);
-
-  /**
-   * Delete a registry value
-   */
-  static bool DeleteRegistryValue(const kwsys_stl::string& key,
-                                  KeyWOW64 view = KeyWOW64_Default);
-
-  /** -----------------------------------------------------------------
-   *               Environment Manipulation Routines
-   *  -----------------------------------------------------------------
-   */
-
-  /**
-   *  Add the paths from the environment variable PATH to the
-   *  string vector passed in.  If env is set then the value
-   *  of env will be used instead of PATH.
-   */
-  static void GetPath(kwsys_stl::vector<kwsys_stl::string>& path,
-                      const char* env=0);
-
-  /**
-   * Read an environment variable
-   */
-  static const char* GetEnv(const char* key);
-  static const char* GetEnv(const kwsys_stl::string& key);
-  static bool GetEnv(const char* key, kwsys_stl::string& result);
-  static bool GetEnv(const kwsys_stl::string& key, kwsys_stl::string& result);
-
-  /** Put a string into the environment
-      of the form var=value */
-  static bool PutEnv(const kwsys_stl::string& env);
-
-  /** Remove a string from the environment.
-      Input is of the form "var" or "var=value" (value is ignored). */
-  static bool UnPutEnv(const kwsys_stl::string& env);
-
-  /**
-   * Get current working directory CWD
-   */
-  static kwsys_stl::string GetCurrentWorkingDirectory(bool collapse =true);
-
-  /**
-   * Change directory to the directory specified
-   */
-  static int ChangeDirectory(const kwsys_stl::string& dir);
-
-  /**
-   * Get the result of strerror(errno)
-   */
-  static kwsys_stl::string GetLastSystemError();
-
-  /**
-   * When building DEBUG with MSVC, this enables a hook that prevents
-   * error dialogs from popping up if the program is being run from
-   * DART.
-   */
-  static void EnableMSVCDebugHook();
-
-  /**
-   * Get the width of the terminal window. The code may or may not work, so
-   * make sure you have some resonable defaults prepared if the code returns
-   * some bogus size.
-   */
-  static int GetTerminalWidth();
-
-  /**
-   * Add an entry in the path translation table.
-   */
-  static void AddTranslationPath(const kwsys_stl::string& dir, const kwsys_stl::string& refdir);
-
-  /**
-   * If dir is different after CollapseFullPath is called,
-   * Then insert it into the path translation table
-   */
-  static void AddKeepPath(const kwsys_stl::string& dir);
-
-  /**
-   * Update path by going through the Path Translation table;
-   */
-  static void CheckTranslationPath(kwsys_stl::string & path);
-
-  /**
-   * Delay the execution for a specified amount of time specified
-   * in miliseconds
-   */
-  static void Delay(unsigned int msec);
-
-  /**
-   * Get the operating system name and version
-   * This is implemented for Win32 only for the moment
-   */
-  static kwsys_stl::string GetOperatingSystemNameAndVersion();
-
-  /** -----------------------------------------------------------------
-   *               URL Manipulation Routines
-   *  -----------------------------------------------------------------
-   */
-
-  /**
-   * Parse a character string :
-   *       protocol://dataglom
-   * and fill protocol as appropriate.
-   * Return false if the URL does not have the required form, true otherwise.
-   */
-   static bool ParseURLProtocol( const kwsys_stl::string& URL,
-                                 kwsys_stl::string& protocol,
-                                 kwsys_stl::string& dataglom );
-
-  /**
-   * Parse a string (a URL without protocol prefix) with the form:
-   *  protocol://[[username[':'password]'@']hostname[':'dataport]]'/'[datapath]
-   * and fill protocol, username, password, hostname, dataport, and datapath
-   * when values are found.
-   * Return true if the string matches the format; false otherwise.
-   */
-  static bool ParseURL( const kwsys_stl::string& URL,
-                        kwsys_stl::string& protocol, 
-                        kwsys_stl::string& username, 
-                        kwsys_stl::string& password, 
-                        kwsys_stl::string& hostname, 
-                        kwsys_stl::string& dataport, 
-                        kwsys_stl::string& datapath );
-
-private:
-  /**
-   * Allocate the stl map that serve as the Path Translation table.
-   */
-  static void ClassInitialize();
-
-  /**
-   * Deallocate the stl map that serve as the Path Translation table.
-   */
-  static void ClassFinalize();
-
-  /**
-   * This method prevents warning on SGI
-   */
-  SystemToolsManager* GetSystemToolsManager()
-    {
-    return &SystemToolsManagerInstance;
-    }
-
-  /**
-   * Actual implementation of ReplaceString.
-   */
-  static void ReplaceString(kwsys_stl::string& source,
-                            const char* replace,
-                            size_t replaceSize,
-                            const kwsys_stl::string& with);
-
-  /**
-   * Actual implementation of FileIsFullPath.
-   */
-  static bool FileIsFullPath(const char*, size_t);
-
-  /**
-   * Find a filename (file or directory) in the system PATH, with
-   * optional extra paths.
-   */
-  static kwsys_stl::string FindName(
-    const kwsys_stl::string& name,
-    const kwsys_stl::vector<kwsys_stl::string>& path = 
-    kwsys_stl::vector<kwsys_stl::string>(),
-    bool no_system_path = false);
-
-
-  /**
-   * Path translation table from dir to refdir
-   * Each time 'dir' will be found it will be replace by 'refdir'
-   */
-  static SystemToolsTranslationMap *TranslationMap;
-  static SystemToolsTranslationMap *LongPathMap;
-#ifdef __CYGWIN__
-  static SystemToolsTranslationMap *Cyg2Win32Map;
-#endif
-  friend class SystemToolsManager;
-};
-
-} // namespace @KWSYS_NAMESPACE@
-
-/* Undefine temporary macros.  */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
-# undef kwsys_stl
-# undef kwsys_ios
-#endif
-
-#endif
diff --git a/src/kwsys/Terminal.c b/src/kwsys/Terminal.c
deleted file mode 100644
index e13003f..0000000
--- a/src/kwsys/Terminal.c
+++ /dev/null
@@ -1,433 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#include "kwsysPrivate.h"
-#include KWSYS_HEADER(Terminal.h)
-
-/* Work-around CMake dependency scanning limitation.  This must
-   duplicate the above list of headers.  */
-#if 0
-# include "Terminal.h.in"
-#endif
-
-/*--------------------------------------------------------------------------*/
-/* Configure support for this platform.  */
-#if defined(_WIN32) || defined(__CYGWIN__)
-# define KWSYS_TERMINAL_SUPPORT_CONSOLE
-#endif
-#if !defined(_WIN32)
-# define KWSYS_TERMINAL_ISATTY_WORKS
-#endif
-
-/*--------------------------------------------------------------------------*/
-/* Include needed system APIs.  */
-
-#include <stdlib.h> /* getenv */
-#include <string.h> /* strcmp */
-#include <stdarg.h> /* va_list */
-
-#if defined(KWSYS_TERMINAL_SUPPORT_CONSOLE)
-# include <windows.h> /* SetConsoleTextAttribute */
-# include <io.h>      /* _get_osfhandle */
-#endif
-
-#if defined(KWSYS_TERMINAL_ISATTY_WORKS)
-# include <unistd.h> /* isatty */
-#else
-# include <sys/stat.h> /* fstat */
-#endif
-
-/*--------------------------------------------------------------------------*/
-static int kwsysTerminalStreamIsVT100(FILE* stream, int default_vt100,
-                                      int default_tty);
-static void kwsysTerminalSetVT100Color(FILE* stream, int color);
-#if defined(KWSYS_TERMINAL_SUPPORT_CONSOLE)
-static HANDLE kwsysTerminalGetStreamHandle(FILE* stream);
-static void kwsysTerminalSetConsoleColor(HANDLE hOut,
-                                         CONSOLE_SCREEN_BUFFER_INFO* hOutInfo,
-                                         FILE* stream,
-                                         int color);
-#endif
-
-/*--------------------------------------------------------------------------*/
-void kwsysTerminal_cfprintf(int color, FILE* stream, const char* format, ...)
-{
-  /* Setup the stream with the given color if possible.  */
-  int pipeIsConsole = 0;
-  int pipeIsVT100 = 0;
-  int default_vt100 = color & kwsysTerminal_Color_AssumeVT100;
-  int default_tty = color & kwsysTerminal_Color_AssumeTTY;
-#if defined(KWSYS_TERMINAL_SUPPORT_CONSOLE)
-  CONSOLE_SCREEN_BUFFER_INFO hOutInfo;
-  HANDLE hOut = kwsysTerminalGetStreamHandle(stream);
-  if(GetConsoleScreenBufferInfo(hOut, &hOutInfo))
-    {
-    pipeIsConsole = 1;
-    kwsysTerminalSetConsoleColor(hOut, &hOutInfo, stream, color);
-    }
-#endif
-  if(!pipeIsConsole && kwsysTerminalStreamIsVT100(stream,
-                                                  default_vt100, default_tty))
-    {
-    pipeIsVT100 = 1;
-    kwsysTerminalSetVT100Color(stream, color);
-    }
-
-  /* Format the text into the stream.  */
-  {
-  va_list var_args;
-  va_start(var_args, format);
-  vfprintf(stream, format, var_args);
-  va_end(var_args);
-  }
-
-  /* Restore the normal color state for the stream.  */
-#if defined(KWSYS_TERMINAL_SUPPORT_CONSOLE)
-  if(pipeIsConsole)
-    {
-    kwsysTerminalSetConsoleColor(hOut, &hOutInfo, stream,
-                                 kwsysTerminal_Color_Normal);
-    }
-#endif
-  if(pipeIsVT100)
-    {
-    kwsysTerminalSetVT100Color(stream, kwsysTerminal_Color_Normal);
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-/* Detect cases when a stream is definitely not interactive.  */
-#if !defined(KWSYS_TERMINAL_ISATTY_WORKS)
-static int kwsysTerminalStreamIsNotInteractive(FILE* stream)
-{
-  /* The given stream is definitely not interactive if it is a regular
-     file.  */
-  struct stat stream_stat;
-  if(fstat(fileno(stream), &stream_stat) == 0)
-    {
-    if(stream_stat.st_mode & S_IFREG)
-      {
-      return 1;
-      }
-    }
-  return 0;
-}
-#endif
-
-/*--------------------------------------------------------------------------*/
-/* List of terminal names known to support VT100 color escape sequences.  */
-static const char* kwsysTerminalVT100Names[] =
-{
-  "Eterm",
-  "ansi",
-  "color-xterm",
-  "con132x25",
-  "con132x30",
-  "con132x43",
-  "con132x60",
-  "con80x25",
-  "con80x28",
-  "con80x30",
-  "con80x43",
-  "con80x50",
-  "con80x60",
-  "cons25",
-  "console",
-  "cygwin",
-  "dtterm",
-  "eterm-color",
-  "gnome",
-  "gnome-256color",
-  "konsole",
-  "konsole-256color",
-  "kterm",
-  "linux",
-  "msys",
-  "linux-c",
-  "mach-color",
-  "mlterm",
-  "putty",
-  "putty-256color",
-  "rxvt",
-  "rxvt-256color",
-  "rxvt-cygwin",
-  "rxvt-cygwin-native",
-  "rxvt-unicode",
-  "rxvt-unicode-256color",
-  "screen",
-  "screen-256color",
-  "screen-256color-bce",
-  "screen-bce",
-  "screen-w",
-  "screen.linux",
-  "vt100",
-  "xterm",
-  "xterm-16color",
-  "xterm-256color",
-  "xterm-88color",
-  "xterm-color",
-  "xterm-debian",
-  0
-};
-
-/*--------------------------------------------------------------------------*/
-/* Detect whether a stream is displayed in a VT100-compatible terminal.  */
-static int kwsysTerminalStreamIsVT100(FILE* stream, int default_vt100,
-                                      int default_tty)
-{
-  /* If running inside emacs the terminal is not VT100.  Some emacs
-     seem to claim the TERM is xterm even though they do not support
-     VT100 escapes.  */
-  const char* emacs = getenv("EMACS");
-  if(emacs && *emacs == 't')
-    {
-    return 0;
-    }
-
-  /* Check for a valid terminal.  */
-  if(!default_vt100)
-    {
-    const char** t = 0;
-    const char* term = getenv("TERM");
-    if(term)
-      {
-      for(t = kwsysTerminalVT100Names; *t && strcmp(term, *t) != 0; ++t) {}
-      }
-    if(!(t && *t))
-      {
-      return 0;
-      }
-    }
-
-#if defined(KWSYS_TERMINAL_ISATTY_WORKS)
-  /* Make sure the stream is a tty. */
-  (void)default_tty;
-  return isatty(fileno(stream))? 1:0;
-#else
-  /* Check for cases in which the stream is definitely not a tty.  */
-  if(kwsysTerminalStreamIsNotInteractive(stream))
-    {
-    return 0;
-    }
-
-  /* Use the provided default for whether this is a tty.  */
-  return default_tty;
-#endif
-}
-
-/*--------------------------------------------------------------------------*/
-/* VT100 escape sequence strings.  */
-#define KWSYS_TERMINAL_VT100_NORMAL              "\33[0m"
-#define KWSYS_TERMINAL_VT100_BOLD                "\33[1m"
-#define KWSYS_TERMINAL_VT100_UNDERLINE           "\33[4m"
-#define KWSYS_TERMINAL_VT100_BLINK               "\33[5m"
-#define KWSYS_TERMINAL_VT100_INVERSE             "\33[7m"
-#define KWSYS_TERMINAL_VT100_FOREGROUND_BLACK    "\33[30m"
-#define KWSYS_TERMINAL_VT100_FOREGROUND_RED      "\33[31m"
-#define KWSYS_TERMINAL_VT100_FOREGROUND_GREEN    "\33[32m"
-#define KWSYS_TERMINAL_VT100_FOREGROUND_YELLOW   "\33[33m"
-#define KWSYS_TERMINAL_VT100_FOREGROUND_BLUE     "\33[34m"
-#define KWSYS_TERMINAL_VT100_FOREGROUND_MAGENTA  "\33[35m"
-#define KWSYS_TERMINAL_VT100_FOREGROUND_CYAN     "\33[36m"
-#define KWSYS_TERMINAL_VT100_FOREGROUND_WHITE    "\33[37m"
-#define KWSYS_TERMINAL_VT100_BACKGROUND_BLACK    "\33[40m"
-#define KWSYS_TERMINAL_VT100_BACKGROUND_RED      "\33[41m"
-#define KWSYS_TERMINAL_VT100_BACKGROUND_GREEN    "\33[42m"
-#define KWSYS_TERMINAL_VT100_BACKGROUND_YELLOW   "\33[43m"
-#define KWSYS_TERMINAL_VT100_BACKGROUND_BLUE     "\33[44m"
-#define KWSYS_TERMINAL_VT100_BACKGROUND_MAGENTA  "\33[45m"
-#define KWSYS_TERMINAL_VT100_BACKGROUND_CYAN     "\33[46m"
-#define KWSYS_TERMINAL_VT100_BACKGROUND_WHITE    "\33[47m"
-
-/*--------------------------------------------------------------------------*/
-/* Write VT100 escape sequences to the stream for the given color.  */
-static void kwsysTerminalSetVT100Color(FILE* stream, int color)
-{
-  if(color == kwsysTerminal_Color_Normal)
-    {
-    fprintf(stream, KWSYS_TERMINAL_VT100_NORMAL);
-    return;
-    }
-
-  switch(color & kwsysTerminal_Color_ForegroundMask)
-    {
-    case kwsysTerminal_Color_Normal:
-      fprintf(stream, KWSYS_TERMINAL_VT100_NORMAL);
-      break;
-    case kwsysTerminal_Color_ForegroundBlack:
-      fprintf(stream, KWSYS_TERMINAL_VT100_FOREGROUND_BLACK);
-      break;
-    case kwsysTerminal_Color_ForegroundRed:
-      fprintf(stream, KWSYS_TERMINAL_VT100_FOREGROUND_RED);
-      break;
-    case kwsysTerminal_Color_ForegroundGreen:
-      fprintf(stream, KWSYS_TERMINAL_VT100_FOREGROUND_GREEN);
-      break;
-    case kwsysTerminal_Color_ForegroundYellow:
-      fprintf(stream, KWSYS_TERMINAL_VT100_FOREGROUND_YELLOW);
-      break;
-    case kwsysTerminal_Color_ForegroundBlue:
-      fprintf(stream, KWSYS_TERMINAL_VT100_FOREGROUND_BLUE);
-      break;
-    case kwsysTerminal_Color_ForegroundMagenta:
-      fprintf(stream, KWSYS_TERMINAL_VT100_FOREGROUND_MAGENTA);
-      break;
-    case kwsysTerminal_Color_ForegroundCyan:
-      fprintf(stream, KWSYS_TERMINAL_VT100_FOREGROUND_CYAN);
-      break;
-    case kwsysTerminal_Color_ForegroundWhite:
-      fprintf(stream, KWSYS_TERMINAL_VT100_FOREGROUND_WHITE);
-      break;
-    }
-  switch(color & kwsysTerminal_Color_BackgroundMask)
-    {
-    case kwsysTerminal_Color_BackgroundBlack:
-      fprintf(stream, KWSYS_TERMINAL_VT100_BACKGROUND_BLACK);
-      break;
-    case kwsysTerminal_Color_BackgroundRed:
-      fprintf(stream, KWSYS_TERMINAL_VT100_BACKGROUND_RED);
-      break;
-    case kwsysTerminal_Color_BackgroundGreen:
-      fprintf(stream, KWSYS_TERMINAL_VT100_BACKGROUND_GREEN);
-      break;
-    case kwsysTerminal_Color_BackgroundYellow:
-      fprintf(stream, KWSYS_TERMINAL_VT100_BACKGROUND_YELLOW);
-      break;
-    case kwsysTerminal_Color_BackgroundBlue:
-      fprintf(stream, KWSYS_TERMINAL_VT100_BACKGROUND_BLUE);
-      break;
-    case kwsysTerminal_Color_BackgroundMagenta:
-      fprintf(stream, KWSYS_TERMINAL_VT100_BACKGROUND_MAGENTA);
-      break;
-    case kwsysTerminal_Color_BackgroundCyan:
-      fprintf(stream, KWSYS_TERMINAL_VT100_BACKGROUND_CYAN);
-      break;
-    case kwsysTerminal_Color_BackgroundWhite:
-      fprintf(stream, KWSYS_TERMINAL_VT100_BACKGROUND_WHITE);
-      break;
-    }
-  if(color & kwsysTerminal_Color_ForegroundBold)
-    {
-    fprintf(stream, KWSYS_TERMINAL_VT100_BOLD);
-    }
-}
-
-/*--------------------------------------------------------------------------*/
-#if defined(KWSYS_TERMINAL_SUPPORT_CONSOLE)
-
-# define KWSYS_TERMINAL_MASK_FOREGROUND \
-  (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY)
-# define KWSYS_TERMINAL_MASK_BACKGROUND \
-  (BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_INTENSITY)
-
-/* Get the Windows handle for a FILE stream.  */
-static HANDLE kwsysTerminalGetStreamHandle(FILE* stream)
-{
-  /* Get the C-library file descriptor from the stream.  */
-  int fd = fileno(stream);
-
-# if defined(__CYGWIN__)
-  /* Cygwin seems to have an extra pipe level.  If the file descriptor
-     corresponds to stdout or stderr then obtain the matching windows
-     handle directly.  */
-  if(fd == fileno(stdout))
-    {
-    return GetStdHandle(STD_OUTPUT_HANDLE);
-    }
-  else if(fd == fileno(stderr))
-    {
-    return GetStdHandle(STD_ERROR_HANDLE);
-    }
-# endif
-
-  /* Get the underlying Windows handle for the descriptor.  */
-  return (HANDLE)_get_osfhandle(fd);
-}
-
-/* Set color attributes in a Windows console.  */
-static void kwsysTerminalSetConsoleColor(HANDLE hOut,
-                                         CONSOLE_SCREEN_BUFFER_INFO* hOutInfo,
-                                         FILE* stream,
-                                         int color)
-{
-  WORD attributes = 0;
-  switch(color & kwsysTerminal_Color_ForegroundMask)
-    {
-    case kwsysTerminal_Color_Normal:
-      attributes |= hOutInfo->wAttributes & KWSYS_TERMINAL_MASK_FOREGROUND;
-      break;
-    case kwsysTerminal_Color_ForegroundBlack:
-      attributes |= 0;
-      break;
-    case kwsysTerminal_Color_ForegroundRed:
-      attributes |= FOREGROUND_RED;
-      break;
-    case kwsysTerminal_Color_ForegroundGreen:
-      attributes |= FOREGROUND_GREEN;
-      break;
-    case kwsysTerminal_Color_ForegroundYellow:
-      attributes |= FOREGROUND_RED | FOREGROUND_GREEN;
-      break;
-    case kwsysTerminal_Color_ForegroundBlue:
-      attributes |= FOREGROUND_BLUE;
-      break;
-    case kwsysTerminal_Color_ForegroundMagenta:
-      attributes |= FOREGROUND_RED | FOREGROUND_BLUE;
-      break;
-    case kwsysTerminal_Color_ForegroundCyan:
-      attributes |= FOREGROUND_BLUE | FOREGROUND_GREEN;
-      break;
-    case kwsysTerminal_Color_ForegroundWhite:
-      attributes |= FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED;
-      break;
-    }
-  switch(color & kwsysTerminal_Color_BackgroundMask)
-    {
-    case kwsysTerminal_Color_Normal:
-      attributes |= hOutInfo->wAttributes & KWSYS_TERMINAL_MASK_BACKGROUND;
-      break;
-    case kwsysTerminal_Color_BackgroundBlack:
-      attributes |= 0;
-      break;
-    case kwsysTerminal_Color_BackgroundRed:
-      attributes |= BACKGROUND_RED;
-      break;
-    case kwsysTerminal_Color_BackgroundGreen:
-      attributes |= BACKGROUND_GREEN;
-      break;
-    case kwsysTerminal_Color_BackgroundYellow:
-      attributes |= BACKGROUND_RED | BACKGROUND_GREEN;
-      break;
-    case kwsysTerminal_Color_BackgroundBlue:
-      attributes |= BACKGROUND_BLUE;
-      break;
-    case kwsysTerminal_Color_BackgroundMagenta:
-      attributes |= BACKGROUND_RED | BACKGROUND_BLUE;
-      break;
-    case kwsysTerminal_Color_BackgroundCyan:
-      attributes |= BACKGROUND_BLUE | BACKGROUND_GREEN;
-      break;
-    case kwsysTerminal_Color_BackgroundWhite:
-      attributes |= BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_RED;
-      break;
-    }
-  if(color & kwsysTerminal_Color_ForegroundBold)
-    {
-    attributes |= FOREGROUND_INTENSITY;
-    }
-  if(color & kwsysTerminal_Color_BackgroundBold)
-    {
-    attributes |= BACKGROUND_INTENSITY;
-    }
-  fflush(stream);
-  SetConsoleTextAttribute(hOut, attributes);
-}
-#endif
diff --git a/src/kwsys/Terminal.h.in b/src/kwsys/Terminal.h.in
deleted file mode 100644
index 108cba0..0000000
--- a/src/kwsys/Terminal.h.in
+++ /dev/null
@@ -1,159 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef @KWSYS_NAMESPACE at _Terminal_h
-#define @KWSYS_NAMESPACE at _Terminal_h
-
-#include <@KWSYS_NAMESPACE@/Configure.h>
-
-#include <stdio.h> /* For file stream type FILE. */
-
-/* Redefine all public interface symbol names to be in the proper
-   namespace.  These macros are used internally to kwsys only, and are
-   not visible to user code.  Use kwsysHeaderDump.pl to reproduce
-   these macros after making changes to the interface.  */
-#if !defined(KWSYS_NAMESPACE)
-# define kwsys_ns(x) @KWSYS_NAMESPACE@##x
-# define kwsysEXPORT @KWSYS_NAMESPACE at _EXPORT
-#endif
-#if !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
-# define kwsysTerminal_cfprintf                kwsys_ns(Terminal_cfprintf)
-# define kwsysTerminal_Color_e                 kwsys_ns(Terminal_Color_e)
-# define kwsysTerminal_Color_Normal            kwsys_ns(Terminal_Color_Normal)
-# define kwsysTerminal_Color_ForegroundBlack   kwsys_ns(Terminal_Color_ForegroundBlack)
-# define kwsysTerminal_Color_ForegroundRed     kwsys_ns(Terminal_Color_ForegroundRed)
-# define kwsysTerminal_Color_ForegroundGreen   kwsys_ns(Terminal_Color_ForegroundGreen)
-# define kwsysTerminal_Color_ForegroundYellow  kwsys_ns(Terminal_Color_ForegroundYellow)
-# define kwsysTerminal_Color_ForegroundBlue    kwsys_ns(Terminal_Color_ForegroundBlue)
-# define kwsysTerminal_Color_ForegroundMagenta kwsys_ns(Terminal_Color_ForegroundMagenta)
-# define kwsysTerminal_Color_ForegroundCyan    kwsys_ns(Terminal_Color_ForegroundCyan)
-# define kwsysTerminal_Color_ForegroundWhite   kwsys_ns(Terminal_Color_ForegroundWhite)
-# define kwsysTerminal_Color_ForegroundMask    kwsys_ns(Terminal_Color_ForegroundMask)
-# define kwsysTerminal_Color_BackgroundBlack   kwsys_ns(Terminal_Color_BackgroundBlack)
-# define kwsysTerminal_Color_BackgroundRed     kwsys_ns(Terminal_Color_BackgroundRed)
-# define kwsysTerminal_Color_BackgroundGreen   kwsys_ns(Terminal_Color_BackgroundGreen)
-# define kwsysTerminal_Color_BackgroundYellow  kwsys_ns(Terminal_Color_BackgroundYellow)
-# define kwsysTerminal_Color_BackgroundBlue    kwsys_ns(Terminal_Color_BackgroundBlue)
-# define kwsysTerminal_Color_BackgroundMagenta kwsys_ns(Terminal_Color_BackgroundMagenta)
-# define kwsysTerminal_Color_BackgroundCyan    kwsys_ns(Terminal_Color_BackgroundCyan)
-# define kwsysTerminal_Color_BackgroundWhite   kwsys_ns(Terminal_Color_BackgroundWhite)
-# define kwsysTerminal_Color_BackgroundMask    kwsys_ns(Terminal_Color_BackgroundMask)
-# define kwsysTerminal_Color_ForegroundBold    kwsys_ns(Terminal_Color_ForegroundBold)
-# define kwsysTerminal_Color_BackgroundBold    kwsys_ns(Terminal_Color_BackgroundBold)
-# define kwsysTerminal_Color_AssumeTTY         kwsys_ns(Terminal_Color_AssumeTTY)
-# define kwsysTerminal_Color_AssumeVT100       kwsys_ns(Terminal_Color_AssumeVT100)
-# define kwsysTerminal_Color_AttributeMask     kwsys_ns(Terminal_Color_AttributeMask)
-#endif
-
-#if defined(__cplusplus)
-extern "C"
-{
-#endif
-
-/**
- * Write colored and formatted text to a stream.  Color is used only
- * for streams supporting it.  The color specification is constructed
- * by bitwise-OR-ing enumeration values.  At most one foreground and
- * one background value may be given.
- *
- * Whether the a stream supports color is usually automatically
- * detected, but with two exceptions:
- *
- *   - When the stream is displayed in a terminal supporting VT100
- *   color but using an intermediate pipe for communication the
- *   detection of a tty fails.  (This typically occurs for a shell
- *   running in an rxvt terminal in MSYS.)  If the caller knows this
- *   to be the case, the attribute Color_AssumeTTY may be included in
- *   the color specification.
- *
- *   - When the stream is displayed in a terminal whose TERM
- *   environment variable is not set or is set to a value that is not
- *   known to support VT100 colors.  If the caller knows this to be
- *   the case, the attribute Color_AssumeVT100 may be included in the
- *   color specification.
- */
-kwsysEXPORT void kwsysTerminal_cfprintf(int color, FILE* stream,
-                                        const char* format, ...);
-enum kwsysTerminal_Color_e
-{
-  /* Normal Text */
-  kwsysTerminal_Color_Normal = 0,
-
-  /* Foreground Color */
-  kwsysTerminal_Color_ForegroundBlack   = 0x1,
-  kwsysTerminal_Color_ForegroundRed     = 0x2,
-  kwsysTerminal_Color_ForegroundGreen   = 0x3,
-  kwsysTerminal_Color_ForegroundYellow  = 0x4,
-  kwsysTerminal_Color_ForegroundBlue    = 0x5,
-  kwsysTerminal_Color_ForegroundMagenta = 0x6,
-  kwsysTerminal_Color_ForegroundCyan    = 0x7,
-  kwsysTerminal_Color_ForegroundWhite   = 0x8,
-  kwsysTerminal_Color_ForegroundMask    = 0xF,
-
-  /* Background Color */
-  kwsysTerminal_Color_BackgroundBlack   = 0x10,
-  kwsysTerminal_Color_BackgroundRed     = 0x20,
-  kwsysTerminal_Color_BackgroundGreen   = 0x30,
-  kwsysTerminal_Color_BackgroundYellow  = 0x40,
-  kwsysTerminal_Color_BackgroundBlue    = 0x50,
-  kwsysTerminal_Color_BackgroundMagenta = 0x60,
-  kwsysTerminal_Color_BackgroundCyan    = 0x70,
-  kwsysTerminal_Color_BackgroundWhite   = 0x80,
-  kwsysTerminal_Color_BackgroundMask    = 0xF0,
-
-  /* Attributes */
-  kwsysTerminal_Color_ForegroundBold = 0x100,
-  kwsysTerminal_Color_BackgroundBold = 0x200,
-  kwsysTerminal_Color_AssumeTTY      = 0x400,
-  kwsysTerminal_Color_AssumeVT100    = 0x800,
-  kwsysTerminal_Color_AttributeMask  = 0xF00
-};
-
-#if defined(__cplusplus)
-} /* extern "C" */
-#endif
-
-/* If we are building a kwsys .c or .cxx file, let it use these macros.
-   Otherwise, undefine them to keep the namespace clean.  */
-#if !defined(KWSYS_NAMESPACE)
-# undef kwsys_ns
-# undef kwsysEXPORT
-# if !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
-#  undef kwsysTerminal_cfprintf
-#  undef kwsysTerminal_Color_e
-#  undef kwsysTerminal_Color_Normal
-#  undef kwsysTerminal_Color_ForegroundBlack
-#  undef kwsysTerminal_Color_ForegroundRed
-#  undef kwsysTerminal_Color_ForegroundGreen
-#  undef kwsysTerminal_Color_ForegroundYellow
-#  undef kwsysTerminal_Color_ForegroundBlue
-#  undef kwsysTerminal_Color_ForegroundMagenta
-#  undef kwsysTerminal_Color_ForegroundCyan
-#  undef kwsysTerminal_Color_ForegroundWhite
-#  undef kwsysTerminal_Color_ForegroundMask
-#  undef kwsysTerminal_Color_BackgroundBlack
-#  undef kwsysTerminal_Color_BackgroundRed
-#  undef kwsysTerminal_Color_BackgroundGreen
-#  undef kwsysTerminal_Color_BackgroundYellow
-#  undef kwsysTerminal_Color_BackgroundBlue
-#  undef kwsysTerminal_Color_BackgroundMagenta
-#  undef kwsysTerminal_Color_BackgroundCyan
-#  undef kwsysTerminal_Color_BackgroundWhite
-#  undef kwsysTerminal_Color_BackgroundMask
-#  undef kwsysTerminal_Color_ForegroundBold
-#  undef kwsysTerminal_Color_BackgroundBold
-#  undef kwsysTerminal_Color_AssumeTTY
-#  undef kwsysTerminal_Color_AssumeVT100
-#  undef kwsysTerminal_Color_AttributeMask
-# endif
-#endif
-
-#endif
diff --git a/src/kwsys/auto_ptr.hxx.in b/src/kwsys/auto_ptr.hxx.in
deleted file mode 100644
index ad9654c..0000000
--- a/src/kwsys/auto_ptr.hxx.in
+++ /dev/null
@@ -1,219 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef @KWSYS_NAMESPACE at _auto_ptr_hxx
-#define @KWSYS_NAMESPACE at _auto_ptr_hxx
-
-#include <@KWSYS_NAMESPACE@/Configure.hxx>
-
-// The HP compiler and VS6 cannot handle the conversions necessary to use
-// auto_ptr_ref to pass an auto_ptr returned from one function
-// directly to another function as in use_auto_ptr(get_auto_ptr()).
-// We instead use const_cast to achieve the syntax on those platforms.
-// We do not use const_cast on other platforms to maintain the C++
-// standard design and guarantee that if an auto_ptr is bound
-// to a reference-to-const then ownership will be maintained.
-#if defined(__HP_aCC) || (defined(_MSC_VER) && _MSC_VER <= 1200)
-# define @KWSYS_NAMESPACE at _AUTO_PTR_REF 0
-# define @KWSYS_NAMESPACE at _AUTO_PTR_CONST const
-# define @KWSYS_NAMESPACE at _AUTO_PTR_CAST(a) cast(a)
-#else
-# define @KWSYS_NAMESPACE at _AUTO_PTR_REF 1
-# define @KWSYS_NAMESPACE at _AUTO_PTR_CONST
-# define @KWSYS_NAMESPACE at _AUTO_PTR_CAST(a) a
-#endif
-
-// In C++11, clang will warn about using dynamic exception specifications
-// as they are deprecated.  But as this class is trying to faithfully
-// mimic std::auto_ptr, we want to keep the 'throw()' decorations below.
-// So we suppress the warning.
-#if defined(__clang__) && defined(__has_warning)
-# if __has_warning("-Wdeprecated")
-#  pragma clang diagnostic push
-#  pragma clang diagnostic ignored "-Wdeprecated"
-# endif
-#endif
-
-namespace @KWSYS_NAMESPACE@
-{
-
-template <class X> class auto_ptr;
-
-#if @KWSYS_NAMESPACE at _AUTO_PTR_REF
-namespace detail
-{
-// The auto_ptr_ref template is supposed to be a private member of
-// auto_ptr but Borland 5.8 cannot handle it.  Instead put it in
-// a private namespace.
-template <class Y> struct auto_ptr_ref
-{
-  Y* p_;
-
-  // The extra constructor argument prevents implicit conversion to
-  // auto_ptr_ref from auto_ptr through the constructor.  Normally
-  // this should be done with the explicit keyword but Borland 5.x
-  // generates code in the conversion operator to call itself
-  // infinately.
-  auto_ptr_ref(Y* p, int): p_(p) {}
-};
-}
-#endif
-
-/** C++98 Standard Section 20.4.5 - Template class auto_ptr.  */
-template <class X>
-class auto_ptr
-{
-#if !@KWSYS_NAMESPACE at _AUTO_PTR_REF
-  template <typename Y>
-  static inline auto_ptr<Y>& cast(auto_ptr<Y> const& a)
-    { return const_cast<auto_ptr<Y>&>(a); }
-#endif
-
-  /** The pointer to the object held.  */
-  X* x_;
-
-public:
-  /** The type of object held by the auto_ptr.  */
-  typedef X element_type;
-
-  /** Construct from an auto_ptr holding a compatible object.  This
-      transfers ownership to the newly constructed auto_ptr.  */
-  template <class Y>
-  auto_ptr(auto_ptr<Y> @KWSYS_NAMESPACE at _AUTO_PTR_CONST& a) throw():
-    x_(@KWSYS_NAMESPACE at _AUTO_PTR_CAST(a).release())
-    {
-    }
-
-  /** Assign from an auto_ptr holding a compatible object.  This
-      transfers ownership to the left-hand-side of the assignment.  */
-  template <class Y>
-  auto_ptr& operator=(auto_ptr<Y> @KWSYS_NAMESPACE at _AUTO_PTR_CONST& a) throw()
-    {
-    this->reset(@KWSYS_NAMESPACE at _AUTO_PTR_CAST(a).release());
-    return *this;
-    }
-
-  /**
-   * Explicitly construct from a raw pointer.  This is typically
-   * called with the result of operator new.  For example:
-   *
-   *   auto_ptr<X> ptr(new X());
-   */
-  explicit auto_ptr(X* p=0) throw(): x_(p)
-    {
-    }
-
-  /** Construct from another auto_ptr holding an object of the same
-      type.  This transfers ownership to the newly constructed
-      auto_ptr.  */
-  auto_ptr(auto_ptr @KWSYS_NAMESPACE at _AUTO_PTR_CONST& a) throw():
-    x_(@KWSYS_NAMESPACE at _AUTO_PTR_CAST(a).release())
-    {
-    }
-
-  /** Assign from another auto_ptr holding an object of the same type.
-      This transfers ownership to the newly constructed auto_ptr.  */
-  auto_ptr& operator=(auto_ptr @KWSYS_NAMESPACE at _AUTO_PTR_CONST& a) throw()
-    {
-    this->reset(@KWSYS_NAMESPACE at _AUTO_PTR_CAST(a).release());
-    return *this;
-    }
-
-  /** Destruct and delete the object held.  */
-  ~auto_ptr() throw()
-    {
-    // Assume object destructor is nothrow.
-    delete this->x_;
-    }
-
-  /** Dereference and return a reference to the object held.  */
-  X& operator*() const throw()
-    {
-    return *this->x_;
-    }
-
-  /** Return a pointer to the object held.  */
-  X* operator->() const throw()
-    {
-    return this->x_;
-    }
-
-  /** Return a pointer to the object held.  */
-  X* get() const throw()
-    {
-    return this->x_;
-    }
-
-  /** Return a pointer to the object held and reset to hold no object.
-      This transfers ownership to the caller.  */
-  X* release() throw()
-    {
-    X* x = this->x_;
-    this->x_ = 0;
-    return x;
-    }
-
-  /** Assume ownership of the given object.  The object previously
-      held is deleted.  */
-  void reset(X* p=0) throw()
-    {
-    if(this->x_ != p)
-      {
-      // Assume object destructor is nothrow.
-      delete this->x_;
-      this->x_ = p;
-      }
-    }
-
-  /** Convert to an auto_ptr holding an object of a compatible type.
-      This transfers ownership to the returned auto_ptr.  */
-  template <class Y> operator auto_ptr<Y>() throw()
-    {
-    return auto_ptr<Y>(this->release());
-    }
-
-#if @KWSYS_NAMESPACE at _AUTO_PTR_REF
-  /** Construct from an auto_ptr_ref.  This is used when the
-      constructor argument is a call to a function returning an
-      auto_ptr.  */
-  auto_ptr(detail::auto_ptr_ref<X> r) throw(): x_(r.p_)
-    {
-    }
-
-  /** Assign from an auto_ptr_ref.  This is used when a function
-      returning an auto_ptr is passed on the right-hand-side of an
-      assignment.  */
-  auto_ptr& operator=(detail::auto_ptr_ref<X> r) throw()
-    {
-    this->reset(r.p_);
-    return *this;
-    }
-
-  /** Convert to an auto_ptr_ref.  This is used when a function
-      returning an auto_ptr is the argument to the constructor of
-      another auto_ptr.  */
-  template <class Y> operator detail::auto_ptr_ref<Y>() throw()
-    {
-    return detail::auto_ptr_ref<Y>(this->release(), 1);
-    }
-#endif
-};
-
-} // namespace @KWSYS_NAMESPACE@
-
-// Undo warning suppression.
-#if defined(__clang__) && defined(__has_warning)
-# if __has_warning("-Wdeprecated")
-#  pragma clang diagnostic pop
-# endif
-#endif
-
-#endif
diff --git a/src/kwsys/hash_fun.hxx.in b/src/kwsys/hash_fun.hxx.in
deleted file mode 100644
index 6f787dd..0000000
--- a/src/kwsys/hash_fun.hxx.in
+++ /dev/null
@@ -1,149 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-/*
- * Copyright (c) 1996
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation.  Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose.  It is provided "as is" without express or implied warranty.
- *
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation.  Hewlett-Packard Company makes no
- * representations about the suitability of this software for any
- * purpose.  It is provided "as is" without express or implied warranty.
- *
- */
-#ifndef @KWSYS_NAMESPACE at _hash_fun_hxx
-#define @KWSYS_NAMESPACE at _hash_fun_hxx
-
-#include <@KWSYS_NAMESPACE@/Configure.hxx>
-#include <@KWSYS_NAMESPACE@/cstddef>        // size_t
-#include <@KWSYS_NAMESPACE@/stl/string>     // string
-
-namespace @KWSYS_NAMESPACE@
-{
-
-template <class _Key> struct hash { };
-
-inline size_t _stl_hash_string(const char* __s)
-{
-  unsigned long __h = 0;
-  for ( ; *__s; ++__s)
-    __h = 5*__h + *__s;
-
-  return size_t(__h);
-}
-
- at KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
-struct hash<char*> {
-  size_t operator()(const char* __s) const { return _stl_hash_string(__s); }
-};
-
- at KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
-struct hash<const char*> {
-  size_t operator()(const char* __s) const { return _stl_hash_string(__s); }
-};
-
- at KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
-  struct hash<@KWSYS_NAMESPACE at _stl::string> {
-  size_t operator()(const @KWSYS_NAMESPACE at _stl::string & __s) const { return _stl_hash_string(__s.c_str()); }
-};
-
-#if !defined(__BORLANDC__)
- at KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
-  struct hash<const @KWSYS_NAMESPACE at _stl::string> {
-  size_t operator()(const @KWSYS_NAMESPACE at _stl::string & __s) const { return _stl_hash_string(__s.c_str()); }
-};
-#endif
-
- at KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
-struct hash<char> {
-  size_t operator()(char __x) const { return __x; }
-};
-
- at KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
-struct hash<unsigned char> {
-  size_t operator()(unsigned char __x) const { return __x; }
-};
-
- at KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
-struct hash<signed char> {
-  size_t operator()(unsigned char __x) const { return __x; }
-};
-
- at KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
-struct hash<short> {
-  size_t operator()(short __x) const { return __x; }
-};
-
- at KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
-struct hash<unsigned short> {
-  size_t operator()(unsigned short __x) const { return __x; }
-};
-
- at KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
-struct hash<int> {
-  size_t operator()(int __x) const { return __x; }
-};
-
- at KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
-struct hash<unsigned int> {
-  size_t operator()(unsigned int __x) const { return __x; }
-};
-
- at KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
-struct hash<long> {
-  size_t operator()(long __x) const { return __x; }
-};
-
- at KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
-struct hash<unsigned long> {
-  size_t operator()(unsigned long __x) const { return __x; }
-};
-
-// use long long or __int64
-#if @KWSYS_USE_LONG_LONG@
- at KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
-struct hash<long long> {
-  size_t operator()(long long __x) const { return __x; }
-};
-
- at KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
-struct hash<unsigned long long> {
-  size_t operator()(unsigned long long __x) const { return __x; }
-};
-#elif @KWSYS_USE___INT64@
- at KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
-struct hash<__int64> {
-  size_t operator()(__int64 __x) const { return __x; }
-};
- at KWSYS_NAMESPACE@_CXX_DEFINE_SPECIALIZATION
-struct hash<unsigned __int64> {
-  size_t operator()(unsigned __int64 __x) const { return __x; }
-};
-#endif // use long long or __int64
-
-} // namespace @KWSYS_NAMESPACE@
-
-#endif
diff --git a/src/kwsys/hash_map.hxx.in b/src/kwsys/hash_map.hxx.in
deleted file mode 100644
index 6d4379d..0000000
--- a/src/kwsys/hash_map.hxx.in
+++ /dev/null
@@ -1,461 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-/*
- * Copyright (c) 1996
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation.  Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose.  It is provided "as is" without express or implied warranty.
- *
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation.  Hewlett-Packard Company makes no
- * representations about the suitability of this software for any
- * purpose.  It is provided "as is" without express or implied warranty.
- *
- */
-#ifndef @KWSYS_NAMESPACE at _hash_map_hxx
-#define @KWSYS_NAMESPACE at _hash_map_hxx
-
-#include <@KWSYS_NAMESPACE@/hashtable.hxx>
-#include <@KWSYS_NAMESPACE@/hash_fun.hxx>
-#include <@KWSYS_NAMESPACE@/stl/functional> // equal_to
-
-#if defined(_MSC_VER)
-# pragma warning (push)
-# pragma warning (disable:4284)
-# pragma warning (disable:4786)
-#endif
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-# pragma set woff 1174
-# pragma set woff 1375
-#endif
-
-namespace @KWSYS_NAMESPACE@
-{
-
-// select1st is an extension: it is not part of the standard.
-template <class T1, class T2>
-struct hash_select1st:
-    public @KWSYS_NAMESPACE at _stl::unary_function<@KWSYS_NAMESPACE at _stl::pair<T1, T2>, T1>
-{
-  const T1& operator()(const @KWSYS_NAMESPACE at _stl::pair<T1, T2>& __x) const
-    { return __x.first; }
-};
-
-// Forward declaration of equality operator; needed for friend declaration.
-
-template <class _Key, class _Tp,
-          class _HashFcn  = hash<_Key>,
-          class _EqualKey = @KWSYS_NAMESPACE at _stl::equal_to<_Key>,
-          class _Alloc = @KWSYS_NAMESPACE at _HASH_DEFAULT_ALLOCATOR(char) >
-class hash_map;
-
-template <class _Key, class _Tp, class _HashFn, class _EqKey, class _Alloc>
-bool operator==(const hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>&,
-                const hash_map<_Key, _Tp, _HashFn, _EqKey, _Alloc>&);
-
-template <class _Key, class _Tp, class _HashFcn, class _EqualKey,
-          class _Alloc>
-class hash_map
-{
-private:
-  typedef hashtable<@KWSYS_NAMESPACE at _stl::pair<const _Key,_Tp>,_Key,_HashFcn,
-                    hash_select1st<const _Key,_Tp>,_EqualKey,_Alloc> _Ht;
-  _Ht _M_ht;
-
-public:
-  typedef typename _Ht::key_type key_type;
-  typedef _Tp data_type;
-  typedef _Tp mapped_type;
-  typedef typename _Ht::value_type value_type;
-  typedef typename _Ht::hasher hasher;
-  typedef typename _Ht::key_equal key_equal;
-
-  typedef typename _Ht::size_type size_type;
-  typedef typename _Ht::difference_type difference_type;
-  typedef typename _Ht::pointer pointer;
-  typedef typename _Ht::const_pointer const_pointer;
-  typedef typename _Ht::reference reference;
-  typedef typename _Ht::const_reference const_reference;
-
-  typedef typename _Ht::iterator iterator;
-  typedef typename _Ht::const_iterator const_iterator;
-
-  typedef typename _Ht::allocator_type allocator_type;
-
-  hasher hash_funct() const { return _M_ht.hash_funct(); }
-  key_equal key_eq() const { return _M_ht.key_eq(); }
-  allocator_type get_allocator() const { return _M_ht.get_allocator(); }
-
-public:
-  hash_map() : _M_ht(100, hasher(), key_equal(), allocator_type()) {}
-  explicit hash_map(size_type __n)
-    : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
-  hash_map(size_type __n, const hasher& __hf)
-    : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
-  hash_map(size_type __n, const hasher& __hf, const key_equal& __eql,
-           const allocator_type& __a = allocator_type())
-    : _M_ht(__n, __hf, __eql, __a) {}
-
-#if @KWSYS_NAMESPACE at _CXX_HAS_MEMBER_TEMPLATES
-  template <class _InputIterator>
-  hash_map(_InputIterator __f, _InputIterator __l)
-    : _M_ht(100, hasher(), key_equal(), allocator_type())
-    { _M_ht.insert_unique(__f, __l); }
-  template <class _InputIterator>
-  hash_map(_InputIterator __f, _InputIterator __l, size_type __n)
-    : _M_ht(__n, hasher(), key_equal(), allocator_type())
-    { _M_ht.insert_unique(__f, __l); }
-  template <class _InputIterator>
-  hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
-           const hasher& __hf)
-    : _M_ht(__n, __hf, key_equal(), allocator_type())
-    { _M_ht.insert_unique(__f, __l); }
-  template <class _InputIterator>
-  hash_map(_InputIterator __f, _InputIterator __l, size_type __n,
-           const hasher& __hf, const key_equal& __eql,
-           const allocator_type& __a = allocator_type())
-    : _M_ht(__n, __hf, __eql, __a)
-    { _M_ht.insert_unique(__f, __l); }
-
-#else
-  hash_map(const value_type* __f, const value_type* __l)
-    : _M_ht(100, hasher(), key_equal(), allocator_type())
-    { _M_ht.insert_unique(__f, __l); }
-  hash_map(const value_type* __f, const value_type* __l, size_type __n)
-    : _M_ht(__n, hasher(), key_equal(), allocator_type())
-    { _M_ht.insert_unique(__f, __l); }
-  hash_map(const value_type* __f, const value_type* __l, size_type __n,
-           const hasher& __hf)
-    : _M_ht(__n, __hf, key_equal(), allocator_type())
-    { _M_ht.insert_unique(__f, __l); }
-  hash_map(const value_type* __f, const value_type* __l, size_type __n,
-           const hasher& __hf, const key_equal& __eql,
-           const allocator_type& __a = allocator_type())
-    : _M_ht(__n, __hf, __eql, __a)
-    { _M_ht.insert_unique(__f, __l); }
-
-  hash_map(const_iterator __f, const_iterator __l)
-    : _M_ht(100, hasher(), key_equal(), allocator_type())
-    { _M_ht.insert_unique(__f, __l); }
-  hash_map(const_iterator __f, const_iterator __l, size_type __n)
-    : _M_ht(__n, hasher(), key_equal(), allocator_type())
-    { _M_ht.insert_unique(__f, __l); }
-  hash_map(const_iterator __f, const_iterator __l, size_type __n,
-           const hasher& __hf)
-    : _M_ht(__n, __hf, key_equal(), allocator_type())
-    { _M_ht.insert_unique(__f, __l); }
-  hash_map(const_iterator __f, const_iterator __l, size_type __n,
-           const hasher& __hf, const key_equal& __eql,
-           const allocator_type& __a = allocator_type())
-    : _M_ht(__n, __hf, __eql, __a)
-    { _M_ht.insert_unique(__f, __l); }
-#endif
-
-public:
-  size_type size() const { return _M_ht.size(); }
-  size_type max_size() const { return _M_ht.max_size(); }
-  bool empty() const { return _M_ht.empty(); }
-  void swap(hash_map& __hs) { _M_ht.swap(__hs._M_ht); }
-
-  friend bool operator==@KWSYS_NAMESPACE at _CXX_NULL_TEMPLATE_ARGS(const hash_map&,
-                                                                 const hash_map&);
-
-  iterator begin() { return _M_ht.begin(); }
-  iterator end() { return _M_ht.end(); }
-  const_iterator begin() const { return _M_ht.begin(); }
-  const_iterator end() const { return _M_ht.end(); }
-
-public:
-  @KWSYS_NAMESPACE at _stl::pair<iterator,bool> insert(const value_type& __obj)
-    { return _M_ht.insert_unique(__obj); }
-#if @KWSYS_NAMESPACE at _CXX_HAS_MEMBER_TEMPLATES
-  template <class _InputIterator>
-  void insert(_InputIterator __f, _InputIterator __l)
-    { _M_ht.insert_unique(__f,__l); }
-#else
-  void insert(const value_type* __f, const value_type* __l) {
-    _M_ht.insert_unique(__f,__l);
-  }
-  void insert(const_iterator __f, const_iterator __l)
-    { _M_ht.insert_unique(__f, __l); }
-#endif
-  @KWSYS_NAMESPACE at _stl::pair<iterator,bool> insert_noresize(const value_type& __obj)
-    { return _M_ht.insert_unique_noresize(__obj); }
-
-  iterator find(const key_type& __key) { return _M_ht.find(__key); }
-  const_iterator find(const key_type& __key) const
-    { return _M_ht.find(__key); }
-
-  _Tp& operator[](const key_type& __key) {
-    return _M_ht.find_or_insert(value_type(__key, _Tp())).second;
-  }
-
-  size_type count(const key_type& __key) const { return _M_ht.count(__key); }
-
-  @KWSYS_NAMESPACE at _stl::pair<iterator, iterator> equal_range(const key_type& __key)
-    { return _M_ht.equal_range(__key); }
-  @KWSYS_NAMESPACE at _stl::pair<const_iterator, const_iterator>
-  equal_range(const key_type& __key) const
-    { return _M_ht.equal_range(__key); }
-
-  size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
-  void erase(iterator __it) { _M_ht.erase(__it); }
-  void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
-  void clear() { _M_ht.clear(); }
-
-  void resize(size_type __hint) { _M_ht.resize(__hint); }
-  size_type bucket_count() const { return _M_ht.bucket_count(); }
-  size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
-  size_type elems_in_bucket(size_type __n) const
-    { return _M_ht.elems_in_bucket(__n); }
-};
-
-template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
-bool
-operator==(const hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1,
-           const hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm2)
-{
-  return __hm1._M_ht == __hm2._M_ht;
-}
-
-template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
-inline bool
-operator!=(const hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1,
-           const hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm2) {
-  return !(__hm1 == __hm2);
-}
-
-template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
-inline void
-swap(hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1,
-     hash_map<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm2)
-{
-  __hm1.swap(__hm2);
-}
-
-// Forward declaration of equality operator; needed for friend declaration.
-
-template <class _Key, class _Tp,
-          class _HashFcn  = hash<_Key>,
-          class _EqualKey = @KWSYS_NAMESPACE at _stl::equal_to<_Key>,
-          class _Alloc = @KWSYS_NAMESPACE at _HASH_DEFAULT_ALLOCATOR(char) >
-class hash_multimap;
-
-template <class _Key, class _Tp, class _HF, class _EqKey, class _Alloc>
-bool
-operator==(const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm1,
-           const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm2);
-
-template <class _Key, class _Tp, class _HashFcn, class _EqualKey,
-          class _Alloc>
-class hash_multimap
-{
-private:
-  typedef hashtable<@KWSYS_NAMESPACE at _stl::pair<const _Key, _Tp>, _Key, _HashFcn,
-                    hash_select1st<const _Key, _Tp>, _EqualKey, _Alloc>
-          _Ht;
-  _Ht _M_ht;
-
-public:
-  typedef typename _Ht::key_type key_type;
-  typedef _Tp data_type;
-  typedef _Tp mapped_type;
-  typedef typename _Ht::value_type value_type;
-  typedef typename _Ht::hasher hasher;
-  typedef typename _Ht::key_equal key_equal;
-
-  typedef typename _Ht::size_type size_type;
-  typedef typename _Ht::difference_type difference_type;
-  typedef typename _Ht::pointer pointer;
-  typedef typename _Ht::const_pointer const_pointer;
-  typedef typename _Ht::reference reference;
-  typedef typename _Ht::const_reference const_reference;
-
-  typedef typename _Ht::iterator iterator;
-  typedef typename _Ht::const_iterator const_iterator;
-
-  typedef typename _Ht::allocator_type allocator_type;
-
-  hasher hash_funct() const { return _M_ht.hash_funct(); }
-  key_equal key_eq() const { return _M_ht.key_eq(); }
-  allocator_type get_allocator() const { return _M_ht.get_allocator(); }
-
-public:
-  hash_multimap() : _M_ht(100, hasher(), key_equal(), allocator_type()) {}
-  explicit hash_multimap(size_type __n)
-    : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
-  hash_multimap(size_type __n, const hasher& __hf)
-    : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
-  hash_multimap(size_type __n, const hasher& __hf, const key_equal& __eql,
-                const allocator_type& __a = allocator_type())
-    : _M_ht(__n, __hf, __eql, __a) {}
-
-#if @KWSYS_NAMESPACE at _CXX_HAS_MEMBER_TEMPLATES
-  template <class _InputIterator>
-  hash_multimap(_InputIterator __f, _InputIterator __l)
-    : _M_ht(100, hasher(), key_equal(), allocator_type())
-    { _M_ht.insert_equal(__f, __l); }
-  template <class _InputIterator>
-  hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n)
-    : _M_ht(__n, hasher(), key_equal(), allocator_type())
-    { _M_ht.insert_equal(__f, __l); }
-  template <class _InputIterator>
-  hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
-                const hasher& __hf)
-    : _M_ht(__n, __hf, key_equal(), allocator_type())
-    { _M_ht.insert_equal(__f, __l); }
-  template <class _InputIterator>
-  hash_multimap(_InputIterator __f, _InputIterator __l, size_type __n,
-                const hasher& __hf, const key_equal& __eql,
-                const allocator_type& __a = allocator_type())
-    : _M_ht(__n, __hf, __eql, __a)
-    { _M_ht.insert_equal(__f, __l); }
-
-#else
-  hash_multimap(const value_type* __f, const value_type* __l)
-    : _M_ht(100, hasher(), key_equal(), allocator_type())
-    { _M_ht.insert_equal(__f, __l); }
-  hash_multimap(const value_type* __f, const value_type* __l, size_type __n)
-    : _M_ht(__n, hasher(), key_equal(), allocator_type())
-    { _M_ht.insert_equal(__f, __l); }
-  hash_multimap(const value_type* __f, const value_type* __l, size_type __n,
-                const hasher& __hf)
-    : _M_ht(__n, __hf, key_equal(), allocator_type())
-    { _M_ht.insert_equal(__f, __l); }
-  hash_multimap(const value_type* __f, const value_type* __l, size_type __n,
-                const hasher& __hf, const key_equal& __eql,
-                const allocator_type& __a = allocator_type())
-    : _M_ht(__n, __hf, __eql, __a)
-    { _M_ht.insert_equal(__f, __l); }
-
-  hash_multimap(const_iterator __f, const_iterator __l)
-    : _M_ht(100, hasher(), key_equal(), allocator_type())
-    { _M_ht.insert_equal(__f, __l); }
-  hash_multimap(const_iterator __f, const_iterator __l, size_type __n)
-    : _M_ht(__n, hasher(), key_equal(), allocator_type())
-    { _M_ht.insert_equal(__f, __l); }
-  hash_multimap(const_iterator __f, const_iterator __l, size_type __n,
-                const hasher& __hf)
-    : _M_ht(__n, __hf, key_equal(), allocator_type())
-    { _M_ht.insert_equal(__f, __l); }
-  hash_multimap(const_iterator __f, const_iterator __l, size_type __n,
-                const hasher& __hf, const key_equal& __eql,
-                const allocator_type& __a = allocator_type())
-    : _M_ht(__n, __hf, __eql, __a)
-    { _M_ht.insert_equal(__f, __l); }
-#endif
-
-public:
-  size_type size() const { return _M_ht.size(); }
-  size_type max_size() const { return _M_ht.max_size(); }
-  bool empty() const { return _M_ht.empty(); }
-  void swap(hash_multimap& __hs) { _M_ht.swap(__hs._M_ht); }
-
-  friend bool operator==@KWSYS_NAMESPACE at _CXX_NULL_TEMPLATE_ARGS(const hash_multimap&,
-                                                                 const hash_multimap&);
-
-  iterator begin() { return _M_ht.begin(); }
-  iterator end() { return _M_ht.end(); }
-  const_iterator begin() const { return _M_ht.begin(); }
-  const_iterator end() const { return _M_ht.end(); }
-
-public:
-  iterator insert(const value_type& __obj)
-    { return _M_ht.insert_equal(__obj); }
-#if @KWSYS_NAMESPACE at _CXX_HAS_MEMBER_TEMPLATES
-  template <class _InputIterator>
-  void insert(_InputIterator __f, _InputIterator __l)
-    { _M_ht.insert_equal(__f,__l); }
-#else
-  void insert(const value_type* __f, const value_type* __l) {
-    _M_ht.insert_equal(__f,__l);
-  }
-  void insert(const_iterator __f, const_iterator __l)
-    { _M_ht.insert_equal(__f, __l); }
-#endif
-  iterator insert_noresize(const value_type& __obj)
-    { return _M_ht.insert_equal_noresize(__obj); }
-
-  iterator find(const key_type& __key) { return _M_ht.find(__key); }
-  const_iterator find(const key_type& __key) const
-    { return _M_ht.find(__key); }
-
-  size_type count(const key_type& __key) const { return _M_ht.count(__key); }
-
-  @KWSYS_NAMESPACE at _stl::pair<iterator, iterator> equal_range(const key_type& __key)
-    { return _M_ht.equal_range(__key); }
-  @KWSYS_NAMESPACE at _stl::pair<const_iterator, const_iterator>
-  equal_range(const key_type& __key) const
-    { return _M_ht.equal_range(__key); }
-
-  size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
-  void erase(iterator __it) { _M_ht.erase(__it); }
-  void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
-  void clear() { _M_ht.clear(); }
-
-public:
-  void resize(size_type __hint) { _M_ht.resize(__hint); }
-  size_type bucket_count() const { return _M_ht.bucket_count(); }
-  size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
-  size_type elems_in_bucket(size_type __n) const
-    { return _M_ht.elems_in_bucket(__n); }
-};
-
-template <class _Key, class _Tp, class _HF, class _EqKey, class _Alloc>
-bool
-operator==(const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm1,
-           const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm2)
-{
-  return __hm1._M_ht == __hm2._M_ht;
-}
-
-template <class _Key, class _Tp, class _HF, class _EqKey, class _Alloc>
-inline bool
-operator!=(const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm1,
-           const hash_multimap<_Key,_Tp,_HF,_EqKey,_Alloc>& __hm2) {
-  return !(__hm1 == __hm2);
-}
-
-template <class _Key, class _Tp, class _HashFcn, class _EqlKey, class _Alloc>
-inline void
-swap(hash_multimap<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm1,
-     hash_multimap<_Key,_Tp,_HashFcn,_EqlKey,_Alloc>& __hm2)
-{
-  __hm1.swap(__hm2);
-}
-
-} // namespace @KWSYS_NAMESPACE@
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-# pragma reset woff 1174
-# pragma reset woff 1375
-#endif
-
-#if defined(_MSC_VER)
-# pragma warning (pop)
-#endif
-
-#endif
diff --git a/src/kwsys/hash_set.hxx.in b/src/kwsys/hash_set.hxx.in
deleted file mode 100644
index 5ee01a5..0000000
--- a/src/kwsys/hash_set.hxx.in
+++ /dev/null
@@ -1,445 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-/*
- * Copyright (c) 1996
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation.  Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose.  It is provided "as is" without express or implied warranty.
- *
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation.  Hewlett-Packard Company makes no
- * representations about the suitability of this software for any
- * purpose.  It is provided "as is" without express or implied warranty.
- *
- */
-#ifndef @KWSYS_NAMESPACE at _hash_set_hxx
-#define @KWSYS_NAMESPACE at _hash_set_hxx
-
-#include <@KWSYS_NAMESPACE@/hashtable.hxx>
-#include <@KWSYS_NAMESPACE@/hash_fun.hxx>
-#include <@KWSYS_NAMESPACE@/stl/functional> // equal_to
-
-#if defined(_MSC_VER)
-# pragma warning (push)
-# pragma warning (disable:4284)
-# pragma warning (disable:4786)
-#endif
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-# pragma set woff 1174
-# pragma set woff 1375
-#endif
-
-namespace @KWSYS_NAMESPACE@
-{
-
-// identity is an extension: it is not part of the standard.
-template <class _Tp>
-struct _Identity : public @KWSYS_NAMESPACE at _stl::unary_function<_Tp,_Tp>
-{
-  const _Tp& operator()(const _Tp& __x) const { return __x; }
-};
-
-// Forward declaration of equality operator; needed for friend declaration.
-
-template <class _Value,
-          class _HashFcn  = hash<_Value>,
-          class _EqualKey = @KWSYS_NAMESPACE at _stl::equal_to<_Value>,
-          class _Alloc = @KWSYS_NAMESPACE at _HASH_DEFAULT_ALLOCATOR(char) >
-class hash_set;
-
-template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
-bool
-operator==(const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs1,
-           const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs2);
-
-template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
-class hash_set
-{
-private:
-  typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>,
-                    _EqualKey, _Alloc> _Ht;
-  _Ht _M_ht;
-
-public:
-  typedef typename _Ht::key_type key_type;
-  typedef typename _Ht::value_type value_type;
-  typedef typename _Ht::hasher hasher;
-  typedef typename _Ht::key_equal key_equal;
-
-  typedef typename _Ht::size_type size_type;
-  typedef typename _Ht::difference_type difference_type;
-  typedef typename _Ht::const_pointer pointer;
-  typedef typename _Ht::const_pointer const_pointer;
-  typedef typename _Ht::const_reference reference;
-  typedef typename _Ht::const_reference const_reference;
-
-  typedef typename _Ht::const_iterator iterator;
-  typedef typename _Ht::const_iterator const_iterator;
-
-  typedef typename _Ht::allocator_type allocator_type;
-
-  hasher hash_funct() const { return _M_ht.hash_funct(); }
-  key_equal key_eq() const { return _M_ht.key_eq(); }
-  allocator_type get_allocator() const { return _M_ht.get_allocator(); }
-
-public:
-  hash_set()
-    : _M_ht(100, hasher(), key_equal(), allocator_type()) {}
-  explicit hash_set(size_type __n)
-    : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
-  hash_set(size_type __n, const hasher& __hf)
-    : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
-  hash_set(size_type __n, const hasher& __hf, const key_equal& __eql,
-           const allocator_type& __a = allocator_type())
-    : _M_ht(__n, __hf, __eql, __a) {}
-
-#if @KWSYS_NAMESPACE at _CXX_HAS_MEMBER_TEMPLATES
-  template <class _InputIterator>
-  hash_set(_InputIterator __f, _InputIterator __l)
-    : _M_ht(100, hasher(), key_equal(), allocator_type())
-    { _M_ht.insert_unique(__f, __l); }
-  template <class _InputIterator>
-  hash_set(_InputIterator __f, _InputIterator __l, size_type __n)
-    : _M_ht(__n, hasher(), key_equal(), allocator_type())
-    { _M_ht.insert_unique(__f, __l); }
-  template <class _InputIterator>
-  hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
-           const hasher& __hf)
-    : _M_ht(__n, __hf, key_equal(), allocator_type())
-    { _M_ht.insert_unique(__f, __l); }
-  template <class _InputIterator>
-  hash_set(_InputIterator __f, _InputIterator __l, size_type __n,
-           const hasher& __hf, const key_equal& __eql,
-           const allocator_type& __a = allocator_type())
-    : _M_ht(__n, __hf, __eql, __a)
-    { _M_ht.insert_unique(__f, __l); }
-#else
-
-  hash_set(const value_type* __f, const value_type* __l)
-    : _M_ht(100, hasher(), key_equal(), allocator_type())
-    { _M_ht.insert_unique(__f, __l); }
-  hash_set(const value_type* __f, const value_type* __l, size_type __n)
-    : _M_ht(__n, hasher(), key_equal(), allocator_type())
-    { _M_ht.insert_unique(__f, __l); }
-  hash_set(const value_type* __f, const value_type* __l, size_type __n,
-           const hasher& __hf)
-    : _M_ht(__n, __hf, key_equal(), allocator_type())
-    { _M_ht.insert_unique(__f, __l); }
-  hash_set(const value_type* __f, const value_type* __l, size_type __n,
-           const hasher& __hf, const key_equal& __eql,
-           const allocator_type& __a = allocator_type())
-    : _M_ht(__n, __hf, __eql, __a)
-    { _M_ht.insert_unique(__f, __l); }
-
-  hash_set(const_iterator __f, const_iterator __l)
-    : _M_ht(100, hasher(), key_equal(), allocator_type())
-    { _M_ht.insert_unique(__f, __l); }
-  hash_set(const_iterator __f, const_iterator __l, size_type __n)
-    : _M_ht(__n, hasher(), key_equal(), allocator_type())
-    { _M_ht.insert_unique(__f, __l); }
-  hash_set(const_iterator __f, const_iterator __l, size_type __n,
-           const hasher& __hf)
-    : _M_ht(__n, __hf, key_equal(), allocator_type())
-    { _M_ht.insert_unique(__f, __l); }
-  hash_set(const_iterator __f, const_iterator __l, size_type __n,
-           const hasher& __hf, const key_equal& __eql,
-           const allocator_type& __a = allocator_type())
-    : _M_ht(__n, __hf, __eql, __a)
-    { _M_ht.insert_unique(__f, __l); }
-#endif
-
-public:
-  size_type size() const { return _M_ht.size(); }
-  size_type max_size() const { return _M_ht.max_size(); }
-  bool empty() const { return _M_ht.empty(); }
-  void swap(hash_set& __hs) { _M_ht.swap(__hs._M_ht); }
-
-  friend bool operator==@KWSYS_NAMESPACE at _CXX_NULL_TEMPLATE_ARGS(const hash_set&,
-                                                                 const hash_set&);
-
-  iterator begin() const { return _M_ht.begin(); }
-  iterator end() const { return _M_ht.end(); }
-
-public:
-  @KWSYS_NAMESPACE at _stl::pair<iterator, bool> insert(const value_type& __obj)
-    {
-      typedef typename _Ht::iterator _Ht_iterator;
-      @KWSYS_NAMESPACE at _stl::pair<_Ht_iterator, bool> __p = _M_ht.insert_unique(__obj);
-      return @KWSYS_NAMESPACE at _stl::pair<iterator,bool>(__p.first, __p.second);
-    }
-#if @KWSYS_NAMESPACE at _CXX_HAS_MEMBER_TEMPLATES
-  template <class _InputIterator>
-  void insert(_InputIterator __f, _InputIterator __l)
-    { _M_ht.insert_unique(__f,__l); }
-#else
-  void insert(const value_type* __f, const value_type* __l) {
-    _M_ht.insert_unique(__f,__l);
-  }
-  void insert(const_iterator __f, const_iterator __l)
-    {_M_ht.insert_unique(__f, __l); }
-#endif
-  @KWSYS_NAMESPACE at _stl::pair<iterator, bool> insert_noresize(const value_type& __obj)
-  {
-    typedef typename _Ht::iterator _Ht_iterator;
-    @KWSYS_NAMESPACE at _stl::pair<_Ht_iterator, bool> __p =
-      _M_ht.insert_unique_noresize(__obj);
-    return @KWSYS_NAMESPACE at _stl::pair<iterator, bool>(__p.first, __p.second);
-  }
-
-  iterator find(const key_type& __key) const { return _M_ht.find(__key); }
-
-  size_type count(const key_type& __key) const { return _M_ht.count(__key); }
-
-  @KWSYS_NAMESPACE at _stl::pair<iterator, iterator> equal_range(const key_type& __key) const
-    { return _M_ht.equal_range(__key); }
-
-  size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
-  void erase(iterator __it) { _M_ht.erase(__it); }
-  void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
-  void clear() { _M_ht.clear(); }
-
-public:
-  void resize(size_type __hint) { _M_ht.resize(__hint); }
-  size_type bucket_count() const { return _M_ht.bucket_count(); }
-  size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
-  size_type elems_in_bucket(size_type __n) const
-    { return _M_ht.elems_in_bucket(__n); }
-};
-
-template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
-bool
-operator==(const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs1,
-           const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs2)
-{
-  return __hs1._M_ht == __hs2._M_ht;
-}
-
-template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
-inline bool
-operator!=(const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs1,
-           const hash_set<_Value,_HashFcn,_EqualKey,_Alloc>& __hs2) {
-  return !(__hs1 == __hs2);
-}
-
-template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
-inline void
-swap(hash_set<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
-     hash_set<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2)
-{
-  __hs1.swap(__hs2);
-}
-
-template <class _Value,
-          class _HashFcn = hash<_Value>,
-          class _EqualKey = @KWSYS_NAMESPACE at _stl::equal_to<_Value>,
-          class _Alloc = @KWSYS_NAMESPACE at _HASH_DEFAULT_ALLOCATOR(char) >
-class hash_multiset;
-
-template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
-bool
-operator==(const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
-           const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2);
-
-
-template <class _Value, class _HashFcn, class _EqualKey, class _Alloc>
-class hash_multiset
-{
-private:
-  typedef hashtable<_Value, _Value, _HashFcn, _Identity<_Value>,
-                    _EqualKey, _Alloc> _Ht;
-  _Ht _M_ht;
-
-public:
-  typedef typename _Ht::key_type key_type;
-  typedef typename _Ht::value_type value_type;
-  typedef typename _Ht::hasher hasher;
-  typedef typename _Ht::key_equal key_equal;
-
-  typedef typename _Ht::size_type size_type;
-  typedef typename _Ht::difference_type difference_type;
-  typedef typename _Ht::const_pointer pointer;
-  typedef typename _Ht::const_pointer const_pointer;
-  typedef typename _Ht::const_reference reference;
-  typedef typename _Ht::const_reference const_reference;
-
-  typedef typename _Ht::const_iterator iterator;
-  typedef typename _Ht::const_iterator const_iterator;
-
-  typedef typename _Ht::allocator_type allocator_type;
-
-  hasher hash_funct() const { return _M_ht.hash_funct(); }
-  key_equal key_eq() const { return _M_ht.key_eq(); }
-  allocator_type get_allocator() const { return _M_ht.get_allocator(); }
-
-public:
-  hash_multiset()
-    : _M_ht(100, hasher(), key_equal(), allocator_type()) {}
-  explicit hash_multiset(size_type __n)
-    : _M_ht(__n, hasher(), key_equal(), allocator_type()) {}
-  hash_multiset(size_type __n, const hasher& __hf)
-    : _M_ht(__n, __hf, key_equal(), allocator_type()) {}
-  hash_multiset(size_type __n, const hasher& __hf, const key_equal& __eql,
-                const allocator_type& __a = allocator_type())
-    : _M_ht(__n, __hf, __eql, __a) {}
-
-#if @KWSYS_NAMESPACE at _CXX_HAS_MEMBER_TEMPLATES
-  template <class _InputIterator>
-  hash_multiset(_InputIterator __f, _InputIterator __l)
-    : _M_ht(100, hasher(), key_equal(), allocator_type())
-    { _M_ht.insert_equal(__f, __l); }
-  template <class _InputIterator>
-  hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n)
-    : _M_ht(__n, hasher(), key_equal(), allocator_type())
-    { _M_ht.insert_equal(__f, __l); }
-  template <class _InputIterator>
-  hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
-                const hasher& __hf)
-    : _M_ht(__n, __hf, key_equal(), allocator_type())
-    { _M_ht.insert_equal(__f, __l); }
-  template <class _InputIterator>
-  hash_multiset(_InputIterator __f, _InputIterator __l, size_type __n,
-                const hasher& __hf, const key_equal& __eql,
-                const allocator_type& __a = allocator_type())
-    : _M_ht(__n, __hf, __eql, __a)
-    { _M_ht.insert_equal(__f, __l); }
-#else
-
-  hash_multiset(const value_type* __f, const value_type* __l)
-    : _M_ht(100, hasher(), key_equal(), allocator_type())
-    { _M_ht.insert_equal(__f, __l); }
-  hash_multiset(const value_type* __f, const value_type* __l, size_type __n)
-    : _M_ht(__n, hasher(), key_equal(), allocator_type())
-    { _M_ht.insert_equal(__f, __l); }
-  hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
-                const hasher& __hf)
-    : _M_ht(__n, __hf, key_equal(), allocator_type())
-    { _M_ht.insert_equal(__f, __l); }
-  hash_multiset(const value_type* __f, const value_type* __l, size_type __n,
-                const hasher& __hf, const key_equal& __eql,
-                const allocator_type& __a = allocator_type())
-    : _M_ht(__n, __hf, __eql, __a)
-    { _M_ht.insert_equal(__f, __l); }
-
-  hash_multiset(const_iterator __f, const_iterator __l)
-    : _M_ht(100, hasher(), key_equal(), allocator_type())
-    { _M_ht.insert_equal(__f, __l); }
-  hash_multiset(const_iterator __f, const_iterator __l, size_type __n)
-    : _M_ht(__n, hasher(), key_equal(), allocator_type())
-    { _M_ht.insert_equal(__f, __l); }
-  hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
-                const hasher& __hf)
-    : _M_ht(__n, __hf, key_equal(), allocator_type())
-    { _M_ht.insert_equal(__f, __l); }
-  hash_multiset(const_iterator __f, const_iterator __l, size_type __n,
-                const hasher& __hf, const key_equal& __eql,
-                const allocator_type& __a = allocator_type())
-    : _M_ht(__n, __hf, __eql, __a)
-    { _M_ht.insert_equal(__f, __l); }
-#endif
-
-public:
-  size_type size() const { return _M_ht.size(); }
-  size_type max_size() const { return _M_ht.max_size(); }
-  bool empty() const { return _M_ht.empty(); }
-  void swap(hash_multiset& hs) { _M_ht.swap(hs._M_ht); }
-
-  friend bool operator==@KWSYS_NAMESPACE at _CXX_NULL_TEMPLATE_ARGS(const hash_multiset&,
-                                                                 const hash_multiset&);
-
-  iterator begin() const { return _M_ht.begin(); }
-  iterator end() const { return _M_ht.end(); }
-
-public:
-  iterator insert(const value_type& __obj)
-    { return _M_ht.insert_equal(__obj); }
-#if @KWSYS_NAMESPACE at _CXX_HAS_MEMBER_TEMPLATES
-  template <class _InputIterator>
-  void insert(_InputIterator __f, _InputIterator __l)
-    { _M_ht.insert_equal(__f,__l); }
-#else
-  void insert(const value_type* __f, const value_type* __l) {
-    _M_ht.insert_equal(__f,__l);
-  }
-  void insert(const_iterator __f, const_iterator __l)
-    { _M_ht.insert_equal(__f, __l); }
-#endif
-  iterator insert_noresize(const value_type& __obj)
-    { return _M_ht.insert_equal_noresize(__obj); }
-
-  iterator find(const key_type& __key) const { return _M_ht.find(__key); }
-
-  size_type count(const key_type& __key) const { return _M_ht.count(__key); }
-
-  @KWSYS_NAMESPACE at _stl::pair<iterator, iterator> equal_range(const key_type& __key) const
-    { return _M_ht.equal_range(__key); }
-
-  size_type erase(const key_type& __key) {return _M_ht.erase(__key); }
-  void erase(iterator __it) { _M_ht.erase(__it); }
-  void erase(iterator __f, iterator __l) { _M_ht.erase(__f, __l); }
-  void clear() { _M_ht.clear(); }
-
-public:
-  void resize(size_type __hint) { _M_ht.resize(__hint); }
-  size_type bucket_count() const { return _M_ht.bucket_count(); }
-  size_type max_bucket_count() const { return _M_ht.max_bucket_count(); }
-  size_type elems_in_bucket(size_type __n) const
-    { return _M_ht.elems_in_bucket(__n); }
-};
-
-template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
-bool
-operator==(const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
-           const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2)
-{
-  return __hs1._M_ht == __hs2._M_ht;
-}
-
-template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
-inline bool
-operator!=(const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
-           const hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2) {
-  return !(__hs1 == __hs2);
-}
-
-template <class _Val, class _HashFcn, class _EqualKey, class _Alloc>
-inline void
-swap(hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs1,
-     hash_multiset<_Val,_HashFcn,_EqualKey,_Alloc>& __hs2) {
-  __hs1.swap(__hs2);
-}
-
-} // namespace @KWSYS_NAMESPACE@
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-# pragma reset woff 1174
-# pragma reset woff 1375
-#endif
-
-#if defined(_MSC_VER)
-# pragma warning (pop)
-#endif
-
-#endif
diff --git a/src/kwsys/hashtable.hxx.in b/src/kwsys/hashtable.hxx.in
deleted file mode 100644
index b93e9be..0000000
--- a/src/kwsys/hashtable.hxx.in
+++ /dev/null
@@ -1,1296 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-/*
- * Copyright (c) 1996
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation.  Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose.  It is provided "as is" without express or implied warranty.
- *
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation.  Hewlett-Packard Company makes no
- * representations about the suitability of this software for any
- * purpose.  It is provided "as is" without express or implied warranty.
- *
- */
-#ifdef __BORLANDC__
-# pragma warn -8027 /* 'for' not inlined.  */
-# pragma warn -8026 /* 'exception' not inlined.  */
-#endif 
-
-#ifndef @KWSYS_NAMESPACE at _hashtable_hxx
-#define @KWSYS_NAMESPACE at _hashtable_hxx
-
-#include <@KWSYS_NAMESPACE@/Configure.hxx>
-
-#include <@KWSYS_NAMESPACE@/cstddef>        // size_t
-#include <@KWSYS_NAMESPACE@/stl/algorithm>  // lower_bound
-#include <@KWSYS_NAMESPACE@/stl/functional> // unary_function
-#include <@KWSYS_NAMESPACE@/stl/iterator>   // iterator_traits
-#include <@KWSYS_NAMESPACE@/stl/memory>     // allocator
-#include <@KWSYS_NAMESPACE@/stl/utility>    // pair
-#include <@KWSYS_NAMESPACE@/stl/vector>     // vector
-
-#if defined(_MSC_VER)
-# pragma warning (push)
-# pragma warning (disable:4284)
-# pragma warning (disable:4786)
-# pragma warning (disable:4512) /* no assignment operator for class */
-#endif
-#if defined(__sgi) && !defined(__GNUC__)
-# pragma set woff 3970 /* pointer to int conversion */ 3321 3968
-#endif
-
-// In C++11, clang will warn about using dynamic exception specifications
-// as they are deprecated.  But as this class is trying to faithfully
-// mimic unordered_set and unordered_map, we want to keep the 'throw()'
-// decorations below.  So we suppress the warning.
-#if defined(__clang__) && defined(__has_warning)
-# if __has_warning("-Wdeprecated")
-#  pragma clang diagnostic push
-#  pragma clang diagnostic ignored "-Wdeprecated"
-# endif
-#endif
-
-#if @KWSYS_NAMESPACE at _STL_HAS_ALLOCATOR_TEMPLATE
-# define @KWSYS_NAMESPACE at _HASH_DEFAULT_ALLOCATOR(T) @KWSYS_NAMESPACE at _stl::allocator< T >
-#elif @KWSYS_NAMESPACE at _STL_HAS_ALLOCATOR_NONTEMPLATE
-# define @KWSYS_NAMESPACE at _HASH_DEFAULT_ALLOCATOR(T) @KWSYS_NAMESPACE at _stl::allocator
-#else
-# define @KWSYS_NAMESPACE at _HASH_DEFAULT_ALLOCATOR(T) @KWSYS_NAMESPACE at _stl::alloc
-#endif
-
-#if @KWSYS_NAMESPACE at _STL_HAS_ALLOCATOR_OBJECTS
-# define @KWSYS_NAMESPACE at _HASH_BUCKETS_INIT(__a) _M_buckets(__a)
-# define @KWSYS_NAMESPACE at _HASH_BUCKETS_GET_ALLOCATOR(__b) , __b.get_allocator()
-#else
-# define @KWSYS_NAMESPACE at _HASH_BUCKETS_INIT(__a) _M_buckets()
-# define @KWSYS_NAMESPACE at _HASH_BUCKETS_GET_ALLOCATOR(__b)
-#endif
-
-namespace @KWSYS_NAMESPACE@
-{
-
-//----------------------------------------------------------------------------
-// Define an allocator adaptor for platforms that do not provide an
-// allocator with the rebind member.
-#if !@KWSYS_NAMESPACE at _STL_HAS_ALLOCATOR_REBIND
-
-// Utility functions to convert item counts.
-inline size_t hash_sizeof(void*) { return sizeof(char); }
-inline size_t hash_sizeof(const void*) { return sizeof(char); }
-template <class TPtr> inline size_t hash_sizeof(TPtr p)
-{
-  static_cast<void>(p);
-  return sizeof(*p);
-}
-template <class POut, class PIn, class TSize>
-inline TSize hash_allocator_n(POut out, PIn in, TSize n)
-{
-  return n*(hash_sizeof(out)/hash_sizeof(in) +
-            (hash_sizeof(out)%hash_sizeof(in)>0));
-}
-
-// Define an allocation method to use the native allocator with
-// the proper signature.  The following signatures of the allocate
-// method are used on various STL implementations:
-//   pointer allocate(size_type, const void* hint)
-//   pointer allocate(size_type)
-//   static pointer allocate(size_type, const void* hint)
-//   static pointer allocate(size_type)
-// Where pointer might be a real type or void*.
-// This set of overloads decodes the signature for a particular STL.
-// The extra three int/long arguments will favor certain signatures
-// over others in the case that multiple are present to avoid
-// ambiguity errors.
-template <class TAlloc, class PIn, class TSize, class THint, class POut>
-inline void hash_allocate(TAlloc* a, PIn (TAlloc::*allocate)(TSize, THint),
-                          TSize n_out, const void* hint, POut& out,
-                          int, int, int)
-{
-  TSize n_in = hash_allocator_n(POut(), PIn(), n_out);
-  void* vout = (a->*allocate)(n_in, const_cast<THint>(hint));
-  out = static_cast<POut>(vout);
-}
-
-template <class TAlloc, class PIn, class TSize, class POut>
-inline void hash_allocate(TAlloc* a, PIn (TAlloc::*allocate)(TSize),
-                          TSize n_out, const void*, POut& out,
-                          int, int, long)
-{
-  TSize n_in = hash_allocator_n(POut(), PIn(), n_out);
-  void* vout = (a->*allocate)(n_in);
-  out = static_cast<POut>(vout);
-}
-
-template <class PIn, class TSize, class THint, class POut>
-inline void hash_allocate(void*, PIn (*allocate)(TSize, THint),
-                          TSize n_out, const void* hint, POut& out,
-                          int, long, long)
-{
-  TSize n_in = hash_allocator_n(POut(), PIn(), n_out);
-  void* vout = allocate(n_in, const_cast<THint>(hint));
-  out = static_cast<POut>(vout);
-}
-
-template <class PIn, class TSize, class POut>
-inline void hash_allocate(void*, PIn (*allocate)(TSize),
-                          TSize n_out, const void*, POut& out,
-                          long, long, long)
-{
-  TSize n_in = hash_allocator_n(POut(), PIn(), n_out);
-  void* vout = allocate(n_in);
-  out = static_cast<POut>(vout);
-}
-
-// Define a deallocation method to use the native allocator with
-// the proper signature.  The following signatures of the deallocate
-// method are used on various STL implementations:
-//   void deallocate(pointer, size_type)
-//   void deallocate(pointer)
-//   static void deallocate(pointer, size_type)
-//   static void deallocate(pointer)
-// Where pointer might be a real type or void*.
-// This set of overloads decodes the signature for a particular STL.
-// The extra three int/long arguments will favor certain signatures
-// over others in the case that multiple are present to avoid
-// ambiguity errors.
-template <class TAlloc, class PIn, class TSize, class PInReal, class POut>
-inline void hash_deallocate(TAlloc* a, void (TAlloc::*deallocate)(PIn, TSize),
-                            PInReal, POut p, TSize n_out, int, int, int)
-{
-  TSize n_in = hash_allocator_n(POut(), PInReal(), n_out);
-  void* vout = p;
-  (a->*deallocate)(static_cast<PIn>(vout), n_in);
-}
-
-template <class TAlloc, class PIn, class TSize, class PInReal, class POut>
-inline void hash_deallocate(TAlloc* a, void (TAlloc::*deallocate)(PIn),
-                            PInReal, POut p, TSize, int, int, long)
-{
-  void* vout = p;
-  (a->*deallocate)(static_cast<PIn>(vout));
-}
-
-template <class PIn, class TSize, class PInReal, class POut>
-inline void hash_deallocate(void*, void (*deallocate)(PIn, TSize),
-                            PInReal, POut p, TSize n_out, int, long, long)
-{
-  TSize n_in = hash_allocator_n(POut(), PInReal(), n_out);
-  void* vout = p;
-  deallocate(static_cast<PIn>(vout), n_in);
-}
-
-template <class PIn, class TSize, class PInReal, class POut>
-inline void hash_deallocate(void*, void (*deallocate)(PIn),
-                            PInReal, POut p, TSize, long, long, long)
-{
-  void* vout = p;
-  deallocate(static_cast<PIn>(vout));
-}
-
-// Use the same four overloads as hash_allocate to decode the type
-// really used for allocation.  This is passed as PInReal to the
-// deallocate functions so that hash_allocator_n has the proper size.
-template <class TAlloc, class PIn, class TSize, class THint>
-inline PIn hash_allocate_type(PIn (TAlloc::*)(TSize, THint),
-                              int, int, int) { return 0; }
-template <class TAlloc, class PIn, class TSize>
-inline PIn hash_allocate_type(PIn (TAlloc::*)(TSize),
-                              int, int, long) { return 0; }
-template <class PIn, class TSize, class THint>
-inline PIn hash_allocate_type(PIn (*)(TSize, THint),
-                              int, long, long) { return 0; }
-template <class PIn, class TSize>
-inline PIn hash_allocate_type(PIn (*)(TSize),
-                              long, long, long) { return 0; }
-
-// Define the comparison operators in terms of a base type to avoid
-// needing templated versions.
-class hash_allocator_base {};
-inline bool operator==(const hash_allocator_base&,
-                const hash_allocator_base&) throw() { return true; }
-inline bool operator!=(const hash_allocator_base&,
-                const hash_allocator_base&) throw() { return false; }
-
-// Define the allocator template.
-template <class T, class Alloc>
-class hash_allocator: public hash_allocator_base
-{
-private:
-  // Store the real allocator privately.
-  typedef Alloc alloc_type;
-  alloc_type alloc_;
-
-public:
-  // Standard allocator interface.
-  typedef size_t size_type;
-  typedef ptrdiff_t difference_type;
-  typedef T* pointer;
-  typedef const T* const_pointer;
-  typedef T& reference;
-  typedef const T& const_reference;
-  typedef T value_type;
-
-  hash_allocator() throw(): alloc_() {}
-  hash_allocator(const hash_allocator_base&) throw() : alloc_() {}
-  hash_allocator(const hash_allocator& a) throw() : alloc_(a.alloc_) {}
-  hash_allocator(const alloc_type& a) throw() : alloc_(a) {}
-  ~hash_allocator() throw() {}
-# if @KWSYS_NAMESPACE at _CXX_HAS_MEMBER_TEMPLATES
-  template <class U>
-  struct rebind { typedef hash_allocator<U, alloc_type> other; };
-# endif
-  pointer address(reference x) const { return &x; }
-  const_pointer address(const_reference x) const { return &x; }
-  typedef void* void_pointer;
-  typedef const void* const_void_pointer;
-  pointer allocate(size_type n=1, const_void_pointer hint = 0)
-    {
-    if(n)
-      {
-      pointer p;
-      hash_allocate(&alloc_, &alloc_type::allocate, n, hint, p, 1, 1, 1);
-      return p;
-      }
-    else
-      {
-      return 0;
-      }
-    }
-  void deallocate(pointer p, size_type n=1)
-    {
-    if(n)
-      {
-      hash_deallocate(&alloc_, &alloc_type::deallocate,
-                      hash_allocate_type(&alloc_type::allocate, 1, 1, 1),
-                      p, n, 1, 1, 1);
-      }
-    }
-#if @KWSYS_NAMESPACE at _STL_HAS_ALLOCATOR_MAX_SIZE_ARGUMENT
-  size_type max_size(size_type s) const throw()
-    {
-    return alloc_.max_size(s);
-    }
-#else
-  size_type max_size() const throw()
-    {
-    size_type n = alloc_.max_size() / sizeof(value_type);
-    return n>0? n:1;
-    }
-#endif
-  void construct(pointer p, const value_type& val) { new (p) value_type(val); }
-  void destroy(pointer p) { (void)p; p->~value_type(); }
-};
-#endif
-
-template <class _Val>
-struct _Hashtable_node
-{
-  _Hashtable_node* _M_next;
-  _Val _M_val;
-  void public_method_to_quiet_warning_about_all_methods_private();
-private:
-  void operator=(_Hashtable_node<_Val> const&); // poison node assignment
-};
-
-template <class _Val, class _Key, class _HashFcn,
-          class _ExtractKey, class _EqualKey,
-          class _Alloc = @KWSYS_NAMESPACE at _HASH_DEFAULT_ALLOCATOR(char) >
-class hashtable;
-
-template <class _Val, class _Key, class _HashFcn,
-          class _ExtractKey, class _EqualKey, class _Alloc>
-struct _Hashtable_iterator;
-
-template <class _Val, class _Key, class _HashFcn,
-          class _ExtractKey, class _EqualKey, class _Alloc>
-struct _Hashtable_const_iterator;
-
-template <class _Val, class _Key, class _HashFcn,
-          class _ExtractKey, class _EqualKey, class _Alloc>
-struct _Hashtable_iterator {
-  typedef hashtable<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc>
-          _Hashtable;
-  typedef _Hashtable_iterator<_Val, _Key, _HashFcn,
-                              _ExtractKey, _EqualKey, _Alloc>
-          iterator;
-  typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn,
-                                    _ExtractKey, _EqualKey, _Alloc>
-          const_iterator;
-  typedef _Hashtable_node<_Val> _Node;
-
-  typedef @KWSYS_NAMESPACE at _stl::forward_iterator_tag iterator_category;
-  typedef _Val value_type;
-  typedef ptrdiff_t difference_type;
-  typedef size_t size_type;
-  typedef _Val& reference;
-  typedef _Val* pointer;
-
-  _Node* _M_cur;
-  _Hashtable* _M_ht;
-
-  _Hashtable_iterator(_Node* __n, _Hashtable* __tab)
-    : _M_cur(__n), _M_ht(__tab) {}
-  _Hashtable_iterator() {}
-  reference operator*() const { return _M_cur->_M_val; }
-  pointer operator->() const { return &(operator*()); }
-  iterator& operator++();
-  iterator operator++(int);
-  bool operator==(const iterator& __it) const
-    { return _M_cur == __it._M_cur; }
-  bool operator!=(const iterator& __it) const
-    { return _M_cur != __it._M_cur; }
-};
-
-
-template <class _Val, class _Key, class _HashFcn,
-          class _ExtractKey, class _EqualKey, class _Alloc>
-struct _Hashtable_const_iterator {
-  typedef hashtable<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc>
-          _Hashtable;
-  typedef _Hashtable_iterator<_Val,_Key,_HashFcn,
-                              _ExtractKey,_EqualKey,_Alloc>
-          iterator;
-  typedef _Hashtable_const_iterator<_Val, _Key, _HashFcn,
-                                    _ExtractKey, _EqualKey, _Alloc>
-          const_iterator;
-  typedef _Hashtable_node<_Val> _Node;
-
-  typedef @KWSYS_NAMESPACE at _stl::forward_iterator_tag iterator_category;
-  typedef _Val value_type;
-  typedef ptrdiff_t difference_type;
-  typedef size_t size_type;
-  typedef const _Val& reference;
-  typedef const _Val* pointer;
-
-  const _Node* _M_cur;
-  const _Hashtable* _M_ht;
-
-  _Hashtable_const_iterator(const _Node* __n, const _Hashtable* __tab)
-    : _M_cur(__n), _M_ht(__tab) {}
-  _Hashtable_const_iterator() {}
-  _Hashtable_const_iterator(const iterator& __it)
-    : _M_cur(__it._M_cur), _M_ht(__it._M_ht) {}
-  reference operator*() const { return _M_cur->_M_val; }
-  pointer operator->() const { return &(operator*()); }
-  const_iterator& operator++();
-  const_iterator operator++(int);
-  bool operator==(const const_iterator& __it) const
-    { return _M_cur == __it._M_cur; }
-  bool operator!=(const const_iterator& __it) const
-    { return _M_cur != __it._M_cur; }
-};
-
-// Note: assumes long is at least 32 bits.
-enum { _stl_num_primes = 31 };
-
-// create a function with a static local to that function that returns
-// the static
-inline const unsigned long* get_stl_prime_list() {
-
-static const unsigned long _stl_prime_list[_stl_num_primes] =
-{
-  5ul,          11ul,         23ul,
-  53ul,         97ul,         193ul,       389ul,       769ul,
-  1543ul,       3079ul,       6151ul,      12289ul,     24593ul,
-  49157ul,      98317ul,      196613ul,    393241ul,    786433ul,
-  1572869ul,    3145739ul,    6291469ul,   12582917ul,  25165843ul,
-  50331653ul,   100663319ul,  201326611ul, 402653189ul, 805306457ul,
-  1610612741ul, 3221225473ul, 4294967291ul
-};
-
-return &_stl_prime_list[0]; }
-
-inline size_t _stl_next_prime(size_t __n)
-{
-  const unsigned long* __first = get_stl_prime_list();
-  const unsigned long* __last = get_stl_prime_list() + (int)_stl_num_primes;
-  const unsigned long* pos = @KWSYS_NAMESPACE at _stl::lower_bound(__first, __last, __n);
-  return pos == __last ? *(__last - 1) : *pos;
-}
-
-// Forward declaration of operator==.
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-class hashtable;
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-bool operator==(const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht1,
-                const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht2);
-
-// Hashtables handle allocators a bit differently than other containers
-//  do.  If we're using standard-conforming allocators, then a hashtable
-//  unconditionally has a member variable to hold its allocator, even if
-//  it so happens that all instances of the allocator type are identical.
-// This is because, for hashtables, this extra storage is negligible.
-//  Additionally, a base class wouldn't serve any other purposes; it
-//  wouldn't, for example, simplify the exception-handling code.
-
-template <class _Val, class _Key, class _HashFcn,
-          class _ExtractKey, class _EqualKey, class _Alloc>
-class hashtable {
-public:
-  typedef _Key key_type;
-  typedef _Val value_type;
-  typedef _HashFcn hasher;
-  typedef _EqualKey key_equal;
-
-  typedef size_t            size_type;
-  typedef ptrdiff_t         difference_type;
-  typedef value_type*       pointer;
-  typedef const value_type* const_pointer;
-  typedef value_type&       reference;
-  typedef const value_type& const_reference;
-
-  hasher hash_funct() const { return _M_hash; }
-  key_equal key_eq() const { return _M_equals; }
-
-private:
-  typedef _Hashtable_node<_Val> _Node;
-
-#if @KWSYS_NAMESPACE at _STL_HAS_ALLOCATOR_REBIND
-public:
-  typedef typename _Alloc::template rebind<_Val>::other allocator_type;
-  allocator_type get_allocator() const { return _M_node_allocator; }
-private:
-  typedef typename _Alloc::template rebind<_Node>::other _M_node_allocator_type;
-  typedef typename _Alloc::template rebind<_Node*>::other _M_node_ptr_allocator_type;
-  typedef @KWSYS_NAMESPACE at _stl::vector<_Node*,_M_node_ptr_allocator_type> _M_buckets_type;
-#else
-public:
-  typedef hash_allocator<_Val, _Alloc> allocator_type;
-  allocator_type get_allocator() const { return allocator_type(); }
-private:
-  typedef hash_allocator<_Node, _Alloc> _M_node_allocator_type;
-# if @KWSYS_NAMESPACE at _STL_HAS_ALLOCATOR_OBJECTS
-  typedef hash_allocator<_Node*, _Alloc> _M_node_ptr_allocator_type;
-# else
-  typedef _Alloc _M_node_ptr_allocator_type;
-# endif
-  typedef @KWSYS_NAMESPACE at _stl::vector<_Node*,_M_node_ptr_allocator_type> _M_buckets_type;
-#endif
-
-private:
-  _M_node_allocator_type _M_node_allocator;
-  hasher                 _M_hash;
-  key_equal              _M_equals;
-  _ExtractKey            _M_get_key;
-  _M_buckets_type        _M_buckets;
-  size_type              _M_num_elements;
-
-  _Node* _M_get_node() { return _M_node_allocator.allocate(1); }
-  void _M_put_node(_Node* __p) { _M_node_allocator.deallocate(__p, 1); }
-
-public:
-  typedef _Hashtable_iterator<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc>
-          iterator;
-  typedef _Hashtable_const_iterator<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,
-                                    _Alloc>
-          const_iterator;
-
-  friend struct
-  _Hashtable_iterator<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc>;
-  friend struct
-  _Hashtable_const_iterator<_Val,_Key,_HashFcn,_ExtractKey,_EqualKey,_Alloc>;
-
-public:
-  hashtable(size_type __n,
-            const _HashFcn&    __hf,
-            const _EqualKey&   __eql,
-            const _ExtractKey& __ext,
-            const allocator_type& __a = allocator_type())
-    : _M_node_allocator(__a),
-      _M_hash(__hf),
-      _M_equals(__eql),
-      _M_get_key(__ext),
-      @KWSYS_NAMESPACE at _HASH_BUCKETS_INIT(__a),
-      _M_num_elements(0)
-  {
-    _M_initialize_buckets(__n);
-  }
-
-  hashtable(size_type __n,
-            const _HashFcn&    __hf,
-            const _EqualKey&   __eql,
-            const allocator_type& __a = allocator_type())
-    : _M_node_allocator(__a),
-      _M_hash(__hf),
-      _M_equals(__eql),
-      _M_get_key(_ExtractKey()),
-      @KWSYS_NAMESPACE at _HASH_BUCKETS_INIT(__a),
-      _M_num_elements(0)
-  {
-    _M_initialize_buckets(__n);
-  }
-
-  hashtable(const hashtable& __ht)
-    : _M_node_allocator(__ht.get_allocator()),
-      _M_hash(__ht._M_hash),
-      _M_equals(__ht._M_equals),
-      _M_get_key(__ht._M_get_key),
-      @KWSYS_NAMESPACE at _HASH_BUCKETS_INIT(__ht.get_allocator()),
-      _M_num_elements(0)
-  {
-    _M_copy_from(__ht);
-  }
-
-  hashtable& operator= (const hashtable& __ht)
-  {
-    if (&__ht != this) {
-      clear();
-      _M_hash = __ht._M_hash;
-      _M_equals = __ht._M_equals;
-      _M_get_key = __ht._M_get_key;
-      _M_copy_from(__ht);
-    }
-    return *this;
-  }
-
-  ~hashtable() { clear(); }
-
-  size_type size() const { return _M_num_elements; }
-  size_type max_size() const { return size_type(-1); }
-  bool empty() const { return size() == 0; }
-
-  void swap(hashtable& __ht)
-  {
-    @KWSYS_NAMESPACE at _stl::swap(_M_hash, __ht._M_hash);
-    @KWSYS_NAMESPACE at _stl::swap(_M_equals, __ht._M_equals);
-    @KWSYS_NAMESPACE at _stl::swap(_M_get_key, __ht._M_get_key);
-    _M_buckets.swap(__ht._M_buckets);
-    @KWSYS_NAMESPACE at _stl::swap(_M_num_elements, __ht._M_num_elements);
-  }
-
-  iterator begin()
-  {
-    for (size_type __n = 0; __n < _M_buckets.size(); ++__n)
-      if (_M_buckets[__n])
-        return iterator(_M_buckets[__n], this);
-    return end();
-  }
-
-  iterator end() { return iterator(0, this); }
-
-  const_iterator begin() const
-  {
-    for (size_type __n = 0; __n < _M_buckets.size(); ++__n)
-      if (_M_buckets[__n])
-        return const_iterator(_M_buckets[__n], this);
-    return end();
-  }
-
-  const_iterator end() const { return const_iterator(0, this); }
-
-  friend bool operator==@KWSYS_NAMESPACE at _CXX_NULL_TEMPLATE_ARGS(const hashtable&,
-                                                                 const hashtable&);
-
-public:
-
-  size_type bucket_count() const { return _M_buckets.size(); }
-
-  size_type max_bucket_count() const
-    { return get_stl_prime_list()[(int)_stl_num_primes - 1]; }
-
-  size_type elems_in_bucket(size_type __bucket) const
-  {
-    size_type __result = 0;
-    for (_Node* __cur = _M_buckets[__bucket]; __cur; __cur = __cur->_M_next)
-      __result += 1;
-    return __result;
-  }
-
-  @KWSYS_NAMESPACE at _stl::pair<iterator, bool> insert_unique(const value_type& __obj)
-  {
-    resize(_M_num_elements + 1);
-    return insert_unique_noresize(__obj);
-  }
-
-  iterator insert_equal(const value_type& __obj)
-  {
-    resize(_M_num_elements + 1);
-    return insert_equal_noresize(__obj);
-  }
-
-  @KWSYS_NAMESPACE at _stl::pair<iterator, bool> insert_unique_noresize(const value_type& __obj);
-  iterator insert_equal_noresize(const value_type& __obj);
-
-#if @KWSYS_NAMESPACE at _STL_HAS_ITERATOR_TRAITS
-# define @KWSYS_NAMESPACE at _HASH_ITERATOR_CATEGORY(T,I) \
-  typename @KWSYS_NAMESPACE at _stl::iterator_traits< T >::iterator_category()
-#elif @KWSYS_NAMESPACE at _STL_HAS_ITERATOR_CATEGORY
-# define @KWSYS_NAMESPACE at _HASH_ITERATOR_CATEGORY(T,I) \
-  @KWSYS_NAMESPACE at _stl::iterator_category( I )
-#elif @KWSYS_NAMESPACE at _STL_HAS___ITERATOR_CATEGORY
-# define @KWSYS_NAMESPACE at _HASH_ITERATOR_CATEGORY(T,I) \
-  @KWSYS_NAMESPACE at _stl::__iterator_category( I )
-#endif
-
-#if @KWSYS_NAMESPACE at _CXX_HAS_MEMBER_TEMPLATES && defined(@KWSYS_NAMESPACE at _HASH_ITERATOR_CATEGORY)
-  template <class _InputIterator>
-  void insert_unique(_InputIterator __f, _InputIterator __l)
-  {
-    insert_unique(__f, __l,
-      @KWSYS_NAMESPACE at _HASH_ITERATOR_CATEGORY(_InputIterator, __f));
-  }
-
-  template <class _InputIterator>
-  void insert_equal(_InputIterator __f, _InputIterator __l)
-  {
-    insert_equal(__f, __l,
-      @KWSYS_NAMESPACE at _HASH_ITERATOR_CATEGORY(_InputIterator, __f));
-  }
-
-  template <class _InputIterator>
-  void insert_unique(_InputIterator __f, _InputIterator __l,
-                     @KWSYS_NAMESPACE at _stl::input_iterator_tag)
-  {
-    for ( ; __f != __l; ++__f)
-      insert_unique(*__f);
-  }
-
-  template <class _InputIterator>
-  void insert_equal(_InputIterator __f, _InputIterator __l,
-                    @KWSYS_NAMESPACE at _stl::input_iterator_tag)
-  {
-    for ( ; __f != __l; ++__f)
-      insert_equal(*__f);
-  }
-
-  template <class _ForwardIterator>
-  void insert_unique(_ForwardIterator __f, _ForwardIterator __l,
-                     @KWSYS_NAMESPACE at _stl::forward_iterator_tag)
-  {
-    size_type __n = 0;
-    @KWSYS_NAMESPACE at _stl::distance(__f, __l, __n);
-    resize(_M_num_elements + __n);
-    for ( ; __n > 0; --__n, ++__f)
-      insert_unique_noresize(*__f);
-  }
-
-  template <class _ForwardIterator>
-  void insert_equal(_ForwardIterator __f, _ForwardIterator __l,
-                    @KWSYS_NAMESPACE at _stl::forward_iterator_tag)
-  {
-    size_type __n = 0;
-    @KWSYS_NAMESPACE at _stl::distance(__f, __l, __n);
-    resize(_M_num_elements + __n);
-    for ( ; __n > 0; --__n, ++__f)
-      insert_equal_noresize(*__f);
-  }
-
-#else
-  void insert_unique(const value_type* __f, const value_type* __l)
-  {
-    size_type __n = __l - __f;
-    resize(_M_num_elements + __n);
-    for ( ; __n > 0; --__n, ++__f)
-      insert_unique_noresize(*__f);
-  }
-
-  void insert_equal(const value_type* __f, const value_type* __l)
-  {
-    size_type __n = __l - __f;
-    resize(_M_num_elements + __n);
-    for ( ; __n > 0; --__n, ++__f)
-      insert_equal_noresize(*__f);
-  }
-
-  void insert_unique(const_iterator __f, const_iterator __l)
-  {
-    size_type __n = 0;
-    @KWSYS_NAMESPACE at _stl::distance(__f, __l, __n);
-    resize(_M_num_elements + __n);
-    for ( ; __n > 0; --__n, ++__f)
-      insert_unique_noresize(*__f);
-  }
-
-  void insert_equal(const_iterator __f, const_iterator __l)
-  {
-    size_type __n = 0;
-    @KWSYS_NAMESPACE at _stl::distance(__f, __l, __n);
-    resize(_M_num_elements + __n);
-    for ( ; __n > 0; --__n, ++__f)
-      insert_equal_noresize(*__f);
-  }
-#endif
-
-  reference find_or_insert(const value_type& __obj);
-
-  iterator find(const key_type& __key)
-  {
-    size_type __n = _M_bkt_num_key(__key);
-    _Node* __first;
-    for ( __first = _M_buckets[__n];
-          __first && !_M_equals(_M_get_key(__first->_M_val), __key);
-          __first = __first->_M_next)
-      {}
-    return iterator(__first, this);
-  }
-
-  const_iterator find(const key_type& __key) const
-  {
-    size_type __n = _M_bkt_num_key(__key);
-    const _Node* __first;
-    for ( __first = _M_buckets[__n];
-          __first && !_M_equals(_M_get_key(__first->_M_val), __key);
-          __first = __first->_M_next)
-      {}
-    return const_iterator(__first, this);
-  }
-
-  size_type count(const key_type& __key) const
-  {
-    const size_type __n = _M_bkt_num_key(__key);
-    size_type __result = 0;
-
-    for (const _Node* __cur = _M_buckets[__n]; __cur; __cur = __cur->_M_next)
-      if (_M_equals(_M_get_key(__cur->_M_val), __key))
-        ++__result;
-    return __result;
-  }
-
-  @KWSYS_NAMESPACE at _stl::pair<iterator, iterator>
-  equal_range(const key_type& __key);
-
-  @KWSYS_NAMESPACE at _stl::pair<const_iterator, const_iterator>
-  equal_range(const key_type& __key) const;
-
-  size_type erase(const key_type& __key);
-  void erase(const iterator& __it);
-  void erase(iterator __first, iterator __last);
-
-  void erase(const const_iterator& __it);
-  void erase(const_iterator __first, const_iterator __last);
-
-  void resize(size_type __num_elements_hint);
-  void clear();
-
-private:
-  size_type _M_next_size(size_type __n) const
-    { return _stl_next_prime(__n); }
-
-  void _M_initialize_buckets(size_type __n)
-  {
-    const size_type __n_buckets = _M_next_size(__n);
-    _M_buckets.reserve(__n_buckets);
-    _M_buckets.insert(_M_buckets.end(), __n_buckets, (_Node*) 0);
-    _M_num_elements = 0;
-  }
-
-  size_type _M_bkt_num_key(const key_type& __key) const
-  {
-    return _M_bkt_num_key(__key, _M_buckets.size());
-  }
-
-  size_type _M_bkt_num(const value_type& __obj) const
-  {
-    return _M_bkt_num_key(_M_get_key(__obj));
-  }
-
-  size_type _M_bkt_num_key(const key_type& __key, size_t __n) const
-  {
-    return _M_hash(__key) % __n;
-  }
-
-  size_type _M_bkt_num(const value_type& __obj, size_t __n) const
-  {
-    return _M_bkt_num_key(_M_get_key(__obj), __n);
-  }
-
-  void construct(_Val* p, const _Val& v)
-    {
-    new (p) _Val(v);
-    }
-  void destroy(_Val* p)
-    {
-    (void)p;
-    p->~_Val();
-    }
-
-  _Node* _M_new_node(const value_type& __obj)
-  {
-    _Node* __n = _M_get_node();
-    __n->_M_next = 0;
-    try {
-      construct(&__n->_M_val, __obj);
-      return __n;
-    }
-    catch(...) {_M_put_node(__n); throw;}
-  }
-
-  void _M_delete_node(_Node* __n)
-  {
-    destroy(&__n->_M_val);
-    _M_put_node(__n);
-  }
-
-  void _M_erase_bucket(const size_type __n, _Node* __first, _Node* __last);
-  void _M_erase_bucket(const size_type __n, _Node* __last);
-
-  void _M_copy_from(const hashtable& __ht);
-
-};
-
-template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
-          class _All>
-_Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>&
-_Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++()
-{
-  const _Node* __old = _M_cur;
-  _M_cur = _M_cur->_M_next;
-  if (!_M_cur) {
-    size_type __bucket = _M_ht->_M_bkt_num(__old->_M_val);
-    while (!_M_cur && ++__bucket < _M_ht->_M_buckets.size())
-      _M_cur = _M_ht->_M_buckets[__bucket];
-  }
-  return *this;
-}
-
-template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
-          class _All>
-inline _Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>
-_Hashtable_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++(int)
-{
-  iterator __tmp = *this;
-  ++*this;
-  return __tmp;
-}
-
-template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
-          class _All>
-_Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>&
-_Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++()
-{
-  const _Node* __old = _M_cur;
-  _M_cur = _M_cur->_M_next;
-  if (!_M_cur) {
-    size_type __bucket = _M_ht->_M_bkt_num(__old->_M_val);
-    while (!_M_cur && ++__bucket < _M_ht->_M_buckets.size())
-      _M_cur = _M_ht->_M_buckets[__bucket];
-  }
-  return *this;
-}
-
-template <class _Val, class _Key, class _HF, class _ExK, class _EqK,
-          class _All>
-inline _Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>
-_Hashtable_const_iterator<_Val,_Key,_HF,_ExK,_EqK,_All>::operator++(int)
-{
-  const_iterator __tmp = *this;
-  ++*this;
-  return __tmp;
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-bool operator==(const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht1,
-                const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht2)
-{
-  typedef typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::_Node _Node;
-  if (__ht1._M_buckets.size() != __ht2._M_buckets.size())
-    return false;
-  for (int __n = 0; __n < __ht1._M_buckets.size(); ++__n) {
-    _Node* __cur1 = __ht1._M_buckets[__n];
-    _Node* __cur2 = __ht2._M_buckets[__n];
-    for ( ; __cur1 && __cur2 && __cur1->_M_val == __cur2->_M_val;
-          __cur1 = __cur1->_M_next, __cur2 = __cur2->_M_next)
-      {}
-    if (__cur1 || __cur2)
-      return false;
-  }
-  return true;
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-inline bool operator!=(const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht1,
-                       const hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>& __ht2) {
-  return !(__ht1 == __ht2);
-}
-
-template <class _Val, class _Key, class _HF, class _Extract, class _EqKey,
-          class _All>
-inline void swap(hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht1,
-                 hashtable<_Val, _Key, _HF, _Extract, _EqKey, _All>& __ht2) {
-  __ht1.swap(__ht2);
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
- at KWSYS_NAMESPACE@_stl::pair<@KWSYS_NAMESPACE at _CXX_DECL_TYPENAME hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator, bool>
-hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
-  ::insert_unique_noresize(const value_type& __obj)
-{
-  const size_type __n = _M_bkt_num(__obj);
-  _Node* __first = _M_buckets[__n];
-
-  for (_Node* __cur = __first; __cur; __cur = __cur->_M_next)
-    if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj)))
-      return @KWSYS_NAMESPACE at _stl::pair<iterator, bool>(iterator(__cur, this), false);
-
-  _Node* __tmp = _M_new_node(__obj);
-  __tmp->_M_next = __first;
-  _M_buckets[__n] = __tmp;
-  ++_M_num_elements;
-  return @KWSYS_NAMESPACE at _stl::pair<iterator, bool>(iterator(__tmp, this), true);
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator
-hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
-  ::insert_equal_noresize(const value_type& __obj)
-{
-  const size_type __n = _M_bkt_num(__obj);
-  _Node* __first = _M_buckets[__n];
-
-  for (_Node* __cur = __first; __cur; __cur = __cur->_M_next)
-    if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj))) {
-      _Node* __tmp = _M_new_node(__obj);
-      __tmp->_M_next = __cur->_M_next;
-      __cur->_M_next = __tmp;
-      ++_M_num_elements;
-      return iterator(__tmp, this);
-    }
-
-  _Node* __tmp = _M_new_node(__obj);
-  __tmp->_M_next = __first;
-  _M_buckets[__n] = __tmp;
-  ++_M_num_elements;
-  return iterator(__tmp, this);
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::reference
-hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::find_or_insert(const value_type& __obj)
-{
-  resize(_M_num_elements + 1);
-
-  size_type __n = _M_bkt_num(__obj);
-  _Node* __first = _M_buckets[__n];
-
-  for (_Node* __cur = __first; __cur; __cur = __cur->_M_next)
-    if (_M_equals(_M_get_key(__cur->_M_val), _M_get_key(__obj)))
-      return __cur->_M_val;
-
-  _Node* __tmp = _M_new_node(__obj);
-  __tmp->_M_next = __first;
-  _M_buckets[__n] = __tmp;
-  ++_M_num_elements;
-  return __tmp->_M_val;
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
- at KWSYS_NAMESPACE@_stl::pair<@KWSYS_NAMESPACE at _CXX_DECL_TYPENAME hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator,
-     @KWSYS_NAMESPACE at _CXX_DECL_TYPENAME hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::iterator>
-hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::equal_range(const key_type& __key)
-{
-  typedef @KWSYS_NAMESPACE at _stl::pair<iterator, iterator> _Pii;
-  const size_type __n = _M_bkt_num_key(__key);
-
-  for (_Node* __first = _M_buckets[__n]; __first; __first = __first->_M_next)
-    if (_M_equals(_M_get_key(__first->_M_val), __key)) {
-      for (_Node* __cur = __first->_M_next; __cur; __cur = __cur->_M_next)
-        if (!_M_equals(_M_get_key(__cur->_M_val), __key))
-          return _Pii(iterator(__first, this), iterator(__cur, this));
-      for (size_type __m = __n + 1; __m < _M_buckets.size(); ++__m)
-        if (_M_buckets[__m])
-          return _Pii(iterator(__first, this),
-                     iterator(_M_buckets[__m], this));
-      return _Pii(iterator(__first, this), end());
-    }
-  return _Pii(end(), end());
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
- at KWSYS_NAMESPACE@_stl::pair<@KWSYS_NAMESPACE at _CXX_DECL_TYPENAME hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::const_iterator,
-     @KWSYS_NAMESPACE at _CXX_DECL_TYPENAME hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::const_iterator>
-hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
-  ::equal_range(const key_type& __key) const
-{
-  typedef @KWSYS_NAMESPACE at _stl::pair<const_iterator, const_iterator> _Pii;
-  const size_type __n = _M_bkt_num_key(__key);
-
-  for (const _Node* __first = _M_buckets[__n] ;
-       __first;
-       __first = __first->_M_next) {
-    if (_M_equals(_M_get_key(__first->_M_val), __key)) {
-      for (const _Node* __cur = __first->_M_next;
-           __cur;
-           __cur = __cur->_M_next)
-        if (!_M_equals(_M_get_key(__cur->_M_val), __key))
-          return _Pii(const_iterator(__first, this),
-                      const_iterator(__cur, this));
-      for (size_type __m = __n + 1; __m < _M_buckets.size(); ++__m)
-        if (_M_buckets[__m])
-          return _Pii(const_iterator(__first, this),
-                      const_iterator(_M_buckets[__m], this));
-      return _Pii(const_iterator(__first, this), end());
-    }
-  }
-  return _Pii(end(), end());
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-typename hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::size_type
-hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::erase(const key_type& __key)
-{
-  const size_type __n = _M_bkt_num_key(__key);
-  _Node* __first = _M_buckets[__n];
-  size_type __erased = 0;
-
-  if (__first) {
-    _Node* __cur = __first;
-    _Node* __next = __cur->_M_next;
-    while (__next) {
-      if (_M_equals(_M_get_key(__next->_M_val), __key)) {
-        __cur->_M_next = __next->_M_next;
-        _M_delete_node(__next);
-        __next = __cur->_M_next;
-        ++__erased;
-        --_M_num_elements;
-      }
-      else {
-        __cur = __next;
-        __next = __cur->_M_next;
-      }
-    }
-    if (_M_equals(_M_get_key(__first->_M_val), __key)) {
-      _M_buckets[__n] = __first->_M_next;
-      _M_delete_node(__first);
-      ++__erased;
-      --_M_num_elements;
-    }
-  }
-  return __erased;
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::erase(const iterator& __it)
-{
-  _Node* __p = __it._M_cur;
-  if (__p) {
-    const size_type __n = _M_bkt_num(__p->_M_val);
-    _Node* __cur = _M_buckets[__n];
-
-    if (__cur == __p) {
-      _M_buckets[__n] = __cur->_M_next;
-      _M_delete_node(__cur);
-      --_M_num_elements;
-    }
-    else {
-      _Node* __next = __cur->_M_next;
-      while (__next) {
-        if (__next == __p) {
-          __cur->_M_next = __next->_M_next;
-          _M_delete_node(__next);
-          --_M_num_elements;
-          break;
-        }
-        else {
-          __cur = __next;
-          __next = __cur->_M_next;
-        }
-      }
-    }
-  }
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
-  ::erase(iterator __first, iterator __last)
-{
-  size_type __f_bucket = __first._M_cur ?
-    _M_bkt_num(__first._M_cur->_M_val) : _M_buckets.size();
-  size_type __l_bucket = __last._M_cur ?
-    _M_bkt_num(__last._M_cur->_M_val) : _M_buckets.size();
-
-  if (__first._M_cur == __last._M_cur)
-    return;
-  else if (__f_bucket == __l_bucket)
-    _M_erase_bucket(__f_bucket, __first._M_cur, __last._M_cur);
-  else {
-    _M_erase_bucket(__f_bucket, __first._M_cur, 0);
-    for (size_type __n = __f_bucket + 1; __n < __l_bucket; ++__n)
-      _M_erase_bucket(__n, 0);
-    if (__l_bucket != _M_buckets.size())
-      _M_erase_bucket(__l_bucket, __last._M_cur);
-  }
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-inline void
-hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::erase(const_iterator __first,
-                                             const_iterator __last)
-{
-  erase(iterator(const_cast<_Node*>(__first._M_cur),
-                 const_cast<hashtable*>(__first._M_ht)),
-        iterator(const_cast<_Node*>(__last._M_cur),
-                 const_cast<hashtable*>(__last._M_ht)));
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-inline void
-hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::erase(const const_iterator& __it)
-{
-  erase(iterator(const_cast<_Node*>(__it._M_cur),
-                 const_cast<hashtable*>(__it._M_ht)));
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
-  ::resize(size_type __num_elements_hint)
-{
-  const size_type __old_n = _M_buckets.size();
-  if (__num_elements_hint > __old_n) {
-    const size_type __n = _M_next_size(__num_elements_hint);
-    if (__n > __old_n) {
-      _M_buckets_type __tmp(
-        __n, (_Node*)(0)
-        @KWSYS_NAMESPACE at _HASH_BUCKETS_GET_ALLOCATOR(_M_buckets));
-      try {
-        for (size_type __bucket = 0; __bucket < __old_n; ++__bucket) {
-          _Node* __first = _M_buckets[__bucket];
-          while (__first) {
-            size_type __new_bucket = _M_bkt_num(__first->_M_val, __n);
-            _M_buckets[__bucket] = __first->_M_next;
-            __first->_M_next = __tmp[__new_bucket];
-            __tmp[__new_bucket] = __first;
-            __first = _M_buckets[__bucket];
-          }
-        }
-        _M_buckets.swap(__tmp);
-      }
-      catch(...) {
-        for (size_type __bucket = 0; __bucket < __tmp.size(); ++__bucket) {
-          while (__tmp[__bucket]) {
-            _Node* __next = __tmp[__bucket]->_M_next;
-            _M_delete_node(__tmp[__bucket]);
-            __tmp[__bucket] = __next;
-          }
-        }
-        throw;
-      }
-    }
-  }
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
-  ::_M_erase_bucket(const size_type __n, _Node* __first, _Node* __last)
-{
-  _Node* __cur = _M_buckets[__n];
-  if (__cur == __first)
-    _M_erase_bucket(__n, __last);
-  else {
-    _Node* __next;
-    for (__next = __cur->_M_next;
-         __next != __first;
-         __cur = __next, __next = __cur->_M_next)
-      ;
-    while (__next != __last) {
-      __cur->_M_next = __next->_M_next;
-      _M_delete_node(__next);
-      __next = __cur->_M_next;
-      --_M_num_elements;
-    }
-  }
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
-  ::_M_erase_bucket(const size_type __n, _Node* __last)
-{
-  _Node* __cur = _M_buckets[__n];
-  while (__cur != __last) {
-    _Node* __next = __cur->_M_next;
-    _M_delete_node(__cur);
-    __cur = __next;
-    _M_buckets[__n] = __cur;
-    --_M_num_elements;
-  }
-}
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>::clear()
-{
-  for (size_type __i = 0; __i < _M_buckets.size(); ++__i) {
-    _Node* __cur = _M_buckets[__i];
-    while (__cur != 0) {
-      _Node* __next = __cur->_M_next;
-      _M_delete_node(__cur);
-      __cur = __next;
-    }
-    _M_buckets[__i] = 0;
-  }
-  _M_num_elements = 0;
-}
-
-
-template <class _Val, class _Key, class _HF, class _Ex, class _Eq, class _All>
-void hashtable<_Val,_Key,_HF,_Ex,_Eq,_All>
-  ::_M_copy_from(const hashtable& __ht)
-{
-  _M_buckets.clear();
-  _M_buckets.reserve(__ht._M_buckets.size());
-  _M_buckets.insert(_M_buckets.end(), __ht._M_buckets.size(), (_Node*) 0);
-  try {
-    for (size_type __i = 0; __i < __ht._M_buckets.size(); ++__i) {
-      const _Node* __cur = __ht._M_buckets[__i];
-      if (__cur) {
-        _Node* __copy = _M_new_node(__cur->_M_val);
-        _M_buckets[__i] = __copy;
-
-        for (_Node* __next = __cur->_M_next;
-             __next;
-             __cur = __next, __next = __cur->_M_next) {
-          __copy->_M_next = _M_new_node(__next->_M_val);
-          __copy = __copy->_M_next;
-        }
-      }
-    }
-    _M_num_elements = __ht._M_num_elements;
-  }
-  catch(...) {clear(); throw;}
-}
-
-} // namespace @KWSYS_NAMESPACE@
-
-// Normally the comparison operators should be found in the @KWSYS_NAMESPACE@
-// namespace by argument dependent lookup.  For compilers that do not
-// support it we must bring them into the global namespace now.
-#if !@KWSYS_NAMESPACE at _CXX_HAS_ARGUMENT_DEPENDENT_LOOKUP
-using @KWSYS_NAMESPACE@::operator==;
-using @KWSYS_NAMESPACE@::operator!=;
-#endif
-
-// Undo warning suppression.
-#if defined(__clang__) && defined(__has_warning)
-# if __has_warning("-Wdeprecated")
-#  pragma clang diagnostic pop
-# endif
-#endif
-
-#if defined(_MSC_VER)
-# pragma warning (pop)
-#endif
-
-#endif
diff --git a/src/kwsys/kwsysHeaderDump.pl b/src/kwsys/kwsysHeaderDump.pl
deleted file mode 100755
index 0dc4a52..0000000
--- a/src/kwsys/kwsysHeaderDump.pl
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/usr/bin/perl
-#=============================================================================
-# KWSys - Kitware System Library
-# Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-
-if ( $#ARGV+1 < 2 )
-{
-    print "Usage: ./kwsysHeaderDump.pl <name> <header>\n";
-    exit(1);
-}
-
-$name = $ARGV[0];
-$max = 0;
-open(INFILE, $ARGV[1]);
-while (chomp ($line = <INFILE>))
-{
-    if (($line !~ /^\#/) &&
-        ($line =~ s/.*kwsys${name}_([A-Za-z0-9_]*).*/\1/) &&
-        ($i{$line}++ < 1))
-    {
-        push(@lines, "$line");
-        if (length($line) > $max)
-        {
-            $max = length($line);
-        }
-    }
-}
-close(INFILE);
-
-$width = $max + 13;
-print sprintf("#define %-${width}s kwsys_ns(${name})\n", "kwsys${name}");
-foreach $l (@lines)
-{
-    print sprintf("#define %-${width}s kwsys_ns(${name}_$l)\n",
-                  "kwsys${name}_$l");
-}
-print "\n";
-print sprintf("# undef kwsys${name}\n");
-foreach $l (@lines)
-{
-    print sprintf("# undef kwsys${name}_$l\n");
-}
diff --git a/src/kwsys/kwsysPlatformTestsCXX.cxx b/src/kwsys/kwsysPlatformTestsCXX.cxx
index 3f947f3..1596fe4 100644
--- a/src/kwsys/kwsysPlatformTestsCXX.cxx
+++ b/src/kwsys/kwsysPlatformTestsCXX.cxx
@@ -452,6 +452,19 @@ int main()
 }
 #endif
 
+#ifdef TEST_KWSYS_CXX_HAS_GETLOADAVG
+// Match feature definitions from SystemInformation.cxx
+#if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE)
+# define _GNU_SOURCE
+#endif
+#include <stdlib.h>
+int main()
+{
+  double loadavg[3] = { 0.0, 0.0, 0.0 };
+  return getloadavg(loadavg, 3);
+}
+#endif
+
 #ifdef TEST_KWSYS_CXX_HAS_RLIMIT64
 # if defined(KWSYS_HAS_LFS)
 #  define _LARGEFILE_SOURCE
@@ -548,6 +561,10 @@ int main()
 #if (defined(__GNUC__) || defined(__PGI)) && !defined(_GNU_SOURCE)
 # define _GNU_SOURCE
 #endif
+#if defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x5130 \
+     && __linux && __SUNPRO_CC_COMPAT == 'G'
+#  include <iostream>
+#endif
 #include <cxxabi.h>
 int main()
 {
diff --git a/src/kwsys/kwsys_cstddef.hxx.in b/src/kwsys/kwsys_cstddef.hxx.in
deleted file mode 100644
index 925c030..0000000
--- a/src/kwsys/kwsys_cstddef.hxx.in
+++ /dev/null
@@ -1,35 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef @KWSYS_NAMESPACE at _cstddef
-#define @KWSYS_NAMESPACE at _cstddef
-
-#include <@KWSYS_NAMESPACE@/Configure.hxx>
-
-/* Avoid warnings in MSVC standard headers.  */
-#ifdef _MSC_VER
-# pragma warning (push, 1)
-# pragma warning (disable: 4702)
-# pragma warning (disable: 4786)
-#endif
-
-/* Include the real header.  */
-#if @KWSYS_NAMESPACE at _CXX_HAS_CSTDDEF
-# include <cstddef>
-#else
-# include <stddef.h>
-#endif
-
-#ifdef _MSC_VER
-# pragma warning(pop)
-#endif
-
-#endif
diff --git a/src/kwsys/kwsys_ios_fstream.h.in b/src/kwsys/kwsys_ios_fstream.h.in
deleted file mode 100644
index 4b1a8cf..0000000
--- a/src/kwsys/kwsys_ios_fstream.h.in
+++ /dev/null
@@ -1,46 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef @KWSYS_NAMESPACE at _ios_fstream
-#define @KWSYS_NAMESPACE at _ios_fstream
-
-#include <@KWSYS_NAMESPACE@/Configure.hxx>
-
-#ifdef _MSC_VER
-# pragma warning (push, 1)
-# pragma warning (disable: 4702)
-# pragma warning (disable: 4995) /* Old streams are deprecated.  */
-#endif
-
-#if @KWSYS_NAMESPACE at _IOS_USE_ANSI
-# include <fstream>
-#else
-# include <fstream.h>
-#endif
-
-#if !@KWSYS_NAMESPACE at _IOS_USE_SSTREAM
-namespace @KWSYS_NAMESPACE at _ios
-{
-  using @KWSYS_NAMESPACE at _ios_namespace::ostream;
-  using @KWSYS_NAMESPACE at _ios_namespace::istream;
-  using @KWSYS_NAMESPACE at _ios_namespace::ofstream;
-  using @KWSYS_NAMESPACE at _ios_namespace::ifstream;
-  using @KWSYS_NAMESPACE at _ios_namespace::ios;
-  using @KWSYS_NAMESPACE at _ios_namespace::endl;
-  using @KWSYS_NAMESPACE at _ios_namespace::flush;
-}
-#endif
-
-#ifdef _MSC_VER
-# pragma warning(pop)
-#endif
-
-#endif
diff --git a/src/kwsys/kwsys_ios_iosfwd.h.in b/src/kwsys/kwsys_ios_iosfwd.h.in
deleted file mode 100644
index f4fafeb..0000000
--- a/src/kwsys/kwsys_ios_iosfwd.h.in
+++ /dev/null
@@ -1,49 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef @KWSYS_NAMESPACE at _ios_iosfwd
-#define @KWSYS_NAMESPACE at _ios_iosfwd
-
-#include <@KWSYS_NAMESPACE@/Configure.hxx>
-
-#ifdef _MSC_VER
-#pragma warning (push, 1)
-#pragma warning (disable: 4702)
-#endif
-
-#if @KWSYS_NAMESPACE at _IOS_USE_ANSI
-# include <iosfwd>
-#else
-class fstream;
-class ifstream;
-class ios;
-class istream;
-class ofstream;
-class ostream;
-#endif
-
-#if !@KWSYS_NAMESPACE at _IOS_USE_SSTREAM
-namespace @KWSYS_NAMESPACE at _ios
-{
-  using @KWSYS_NAMESPACE at _ios_namespace::fstream;
-  using @KWSYS_NAMESPACE at _ios_namespace::ifstream;
-  using @KWSYS_NAMESPACE at _ios_namespace::ios;
-  using @KWSYS_NAMESPACE at _ios_namespace::istream;
-  using @KWSYS_NAMESPACE at _ios_namespace::ofstream;
-  using @KWSYS_NAMESPACE at _ios_namespace::ostream;
-}
-#endif
-
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
-
-#endif
diff --git a/src/kwsys/kwsys_ios_iostream.h.in b/src/kwsys/kwsys_ios_iostream.h.in
deleted file mode 100644
index 43fc4d5..0000000
--- a/src/kwsys/kwsys_ios_iostream.h.in
+++ /dev/null
@@ -1,99 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef @KWSYS_NAMESPACE at _ios_iostream
-#define @KWSYS_NAMESPACE at _ios_iostream
-
-#include <@KWSYS_NAMESPACE@/Configure.hxx>
-
-#ifdef _MSC_VER
-# pragma warning (push, 1)
-# pragma warning (disable: 4702)
-# pragma warning (disable: 4995) /* Old streams are deprecated.  */
-#endif
-
-#if @KWSYS_NAMESPACE at _IOS_USE_ANSI
-# include <iostream>
-#else
-# include <iostream.h>
-#endif
-
-// The HP implementation of iostream defines cin, cout, cerr, and clog
-// as macros in order to do thread-private streams.
-// See /opt/aCC/include/iostream/iostream.h for details.
-// This block redefines the macros in a safe way that is also compatible
-// with the HP definitions and the using declarations below.
-
-#if !@KWSYS_NAMESPACE at _IOS_USE_SSTREAM
-# if defined(__HP_aCC) && (defined(HP_THREAD_SAFE) || defined(_THREAD_SAFE))
-#  if defined(cin) && !defined(@KWSYS_NAMESPACE at _IOS_HP_HACK_CIN)
-#   define @KWSYS_NAMESPACE at _IOS_HP_HACK_CIN
-#   undef cin
-#   define cin __tcin.ref()
-#  endif
-#  if defined(cout) && !defined(@KWSYS_NAMESPACE at _IOS_HP_HACK_COUT)
-#   define @KWSYS_NAMESPACE at _IOS_HP_HACK_COUT
-#   undef cout
-#   define cout __tcout.ref()
-#  endif
-#  if defined(cerr) && !defined(@KWSYS_NAMESPACE at _IOS_HP_HACK_CERR)
-#   define @KWSYS_NAMESPACE at _IOS_HP_HACK_CERR
-#   undef cerr
-#   define cerr __tcerr.ref()
-#  endif
-#  if defined(clog) && !defined(@KWSYS_NAMESPACE at _IOS_HP_HACK_CLOG)
-#   define @KWSYS_NAMESPACE at _IOS_HP_HACK_CLOG
-#   undef clog
-#   define clog __tclog.ref()
-#  endif
-# endif
-#endif
-
-// If using our own sstream emulation code, put the standard
-// streams in the same namespace.
-#if !@KWSYS_NAMESPACE at _IOS_USE_SSTREAM
-namespace @KWSYS_NAMESPACE at _ios
-{
-  typedef int streamsize;
-  typedef int streamoff;
-  using @KWSYS_NAMESPACE at _ios_namespace::ostream;
-  using @KWSYS_NAMESPACE at _ios_namespace::istream;
-  using @KWSYS_NAMESPACE at _ios_namespace::ios;
-  using @KWSYS_NAMESPACE at _ios_namespace::endl;
-  using @KWSYS_NAMESPACE at _ios_namespace::flush;
-# if defined(@KWSYS_NAMESPACE at _IOS_HP_HACK_CIN)
-  using @KWSYS_NAMESPACE at _ios_namespace::__tcin;
-# else
-  using @KWSYS_NAMESPACE at _ios_namespace::cin;
-# endif
-# if defined(@KWSYS_NAMESPACE at _IOS_HP_HACK_COUT)
-  using @KWSYS_NAMESPACE at _ios_namespace::__tcout;
-# else
-  using @KWSYS_NAMESPACE at _ios_namespace::cout;
-# endif
-# if defined(@KWSYS_NAMESPACE at _IOS_HP_HACK_CERR)
-  using @KWSYS_NAMESPACE at _ios_namespace::__tcerr;
-# else
-  using @KWSYS_NAMESPACE at _ios_namespace::cerr;
-# endif
-# if defined(@KWSYS_NAMESPACE at _IOS_HP_HACK_CLOG)
-  using @KWSYS_NAMESPACE at _ios_namespace::__tclog;
-# else
-  using @KWSYS_NAMESPACE at _ios_namespace::clog;
-# endif
-}
-#endif
-
-#ifdef _MSC_VER
-# pragma warning(pop)
-#endif
-
-#endif
diff --git a/src/kwsys/kwsys_ios_sstream.h.in b/src/kwsys/kwsys_ios_sstream.h.in
deleted file mode 100644
index 29d250c..0000000
--- a/src/kwsys/kwsys_ios_sstream.h.in
+++ /dev/null
@@ -1,199 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef @KWSYS_NAMESPACE at _ios_sstream
-#define @KWSYS_NAMESPACE at _ios_sstream
-
-#include <@KWSYS_NAMESPACE@/Configure.hxx>
-
-/* Define this macro temporarily to keep the code readable.  */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
-# define kwsys_stl @KWSYS_NAMESPACE at _stl
-#endif
-
-#if @KWSYS_NAMESPACE at _IOS_USE_SSTREAM
-# ifdef _MSC_VER
-#  pragma warning (push, 1)
-#  pragma warning (disable: 4702)
-# endif
-# include <sstream>
-# ifdef _MSC_VER
-#  pragma warning(pop)
-# endif
-#else
-# ifdef _MSC_VER
-#  pragma warning (push, 1)
-#  pragma warning (disable: 4702)
-#  pragma warning (disable: 4995) /* Old streams are deprecated.  */
-# endif
-# if @KWSYS_NAMESPACE at _IOS_USE_ANSI
-#  include <strstream>
-# elif @KWSYS_NAMESPACE at _IOS_USE_STRSTREAM_H
-#  include <strstream.h>
-# elif @KWSYS_NAMESPACE at _IOS_USE_STRSTREA_H
-#  include <strstrea.h>
-# endif
-# if @KWSYS_NAMESPACE at _IOS_USE_ANSI
-#  include <new> // Need placement operator new.
-# else
-#  include <new.h> // Need placement operator new.
-# endif
-# ifdef _MSC_VER
-#  pragma warning(pop)
-# endif
-
-// Only have old std strstream classes.  Wrap them to look like new
-// ostringstream and istringstream classes.
-
-# include <@KWSYS_NAMESPACE@/stl/string>
-
-namespace @KWSYS_NAMESPACE at _ios
-{
-using @KWSYS_NAMESPACE at _ios_namespace::streambuf;
-using @KWSYS_NAMESPACE at _ios_namespace::ostream;
-using @KWSYS_NAMESPACE at _ios_namespace::istream;
-using @KWSYS_NAMESPACE at _ios_namespace::strstream;
-using @KWSYS_NAMESPACE at _ios_namespace::istrstream;
-using @KWSYS_NAMESPACE at _ios_namespace::ostrstream;
-using @KWSYS_NAMESPACE at _ios_namespace::ios;
-using @KWSYS_NAMESPACE at _ios_namespace::endl;
-using @KWSYS_NAMESPACE at _ios_namespace::ends;
-using @KWSYS_NAMESPACE at _ios_namespace::flush;
-
-class stringstream_cleanup
-{
-public:
-  stringstream_cleanup(strstream& str): m_StrStream(str) {}
-  ~stringstream_cleanup() { m_StrStream.rdbuf()->freeze(0); }
-  static void IgnoreUnusedVariable(const stringstream_cleanup&) {}
-protected:
-  strstream& m_StrStream;
-private:
-  void operator=(stringstream_cleanup const&);
-};
-
-class stringstream: public strstream
-{
-public:
-  typedef strstream Superclass;
-  stringstream() {}
-  stringstream(const kwsys_stl::string& s) { *this << s.c_str(); }
-  kwsys_stl::string str()
-    {
-    stringstream_cleanup cleanup(*this);
-    stringstream_cleanup::IgnoreUnusedVariable(cleanup);
-// Visual Studio 6 has a strstream::pcount, but this is not rdbuf()->pcount()
-#if (@KWSYS_NAMESPACE at _IOS_USE_STRSTREA_H) && defined(_MSC_VER) && (_MSC_VER == 1200)
-    int count = this->pcount();
-#elif defined(__WATCOMC__)
-    int count = this->rdbuf()->out_waiting();
-#else
-    int count = this->rdbuf()->pcount();
-#endif
-    const char* ptr = this->Superclass::str();
-    return kwsys_stl::string(ptr?ptr:"", count);
-    }
-  void str(const kwsys_stl::string& s)
-    {
-    this->~stringstream();
-    new (this) stringstream(s);
-    }
-private:
-  stringstream(const stringstream&);
-  void operator=(const stringstream&);
-};
-
-class ostringstream_cleanup
-{
-public:
-  ostringstream_cleanup(ostrstream& ostr): m_OStrStream(ostr) {}
-  ~ostringstream_cleanup() { m_OStrStream.rdbuf()->freeze(0); }
-  static void IgnoreUnusedVariable(const ostringstream_cleanup&) {}
-protected:
-  ostrstream& m_OStrStream;
-private:
-  void operator=(ostringstream_cleanup const&);
-};
-
-class ostringstream: public ostrstream
-{
-public:
-  typedef ostrstream Superclass;
-  ostringstream() {}
-  ostringstream(const kwsys_stl::string& s) { *this << s.c_str(); }
-  kwsys_stl::string str()
-    {
-    ostringstream_cleanup cleanup(*this);
-    ostringstream_cleanup::IgnoreUnusedVariable(cleanup);
-    int count = this->pcount();
-    const char* ptr = this->Superclass::str();
-    return kwsys_stl::string(ptr?ptr:"", count);
-    }
-  void str(const kwsys_stl::string& s)
-    {
-    this->~ostringstream();
-    new (this) ostringstream(s);
-    }
-private:
-  ostringstream(const ostringstream&);
-  void operator=(const ostringstream&);
-};
-
-#if defined(_MSC_VER)
-# pragma warning (push)
-# pragma warning (disable: 4097) /* typedef-name used as synonym for class */
-#endif
-#if defined(__WATCOMC__)
-// W728: class modifiers for 'A' conflict with class modifiers for 'B'
-# pragma warning 728 10
-#endif
-
-class istringstream: private kwsys_stl::string, public istrstream
-{
-public:
-  typedef kwsys_stl::string StdString;
-  typedef istrstream IStrStream;
-  istringstream(): StdString(),
-                   IStrStream(const_cast<char*>(StdString::c_str())) {}
-  istringstream(const kwsys_stl::string& s):
-    StdString(s), IStrStream(const_cast<char*>(StdString::c_str())) {}
-  kwsys_stl::string str() const { return *this; }
-  void str(const kwsys_stl::string& s)
-    {
-    this->~istringstream();
-    new (this) istringstream(s);
-    }
-  void clear(int flags)
-    {
-    this->IStrStream::clear(flags);
-    }
-private:
-  istringstream(const istringstream&);
-  void operator=(const istringstream&);
-};
-
-#if defined(__WATCOMC__)
-# pragma warning 728 9
-#endif
-#if defined(_MSC_VER)
-# pragma warning (pop)
-#endif
-
-} // namespace @KWSYS_NAMESPACE at _ios
-
-#endif
-
-/* Undefine temporary macro.  */
-#if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE at _NAME_IS_KWSYS
-# undef kwsys_stl
-#endif
-
-#endif
diff --git a/src/kwsys/kwsys_stl.hxx.in b/src/kwsys/kwsys_stl.hxx.in
deleted file mode 100644
index 610e6d4..0000000
--- a/src/kwsys/kwsys_stl.hxx.in
+++ /dev/null
@@ -1,49 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef @KWSYS_NAMESPACE at _stl_@KWSYS_STL_HEADER@
-#define @KWSYS_NAMESPACE at _stl_@KWSYS_STL_HEADER@
-
-#include <@KWSYS_NAMESPACE@/Configure.hxx>
-
-/* Avoid warnings in MSVC standard headers.  */
-#ifdef _MSC_VER
-# pragma warning (push, 1)
-# pragma warning (disable: 4702)
-# pragma warning (disable: 4786)
-#endif
-
-/* The HP standard library defines the functor "times" instead of
-   "multiplies" as specified by C++98 20.3.2 for backward
-   compatibility with earlier specifications.  Defining this macro
-   fixes this behavior.  The name "times" also conflicts with the
-   function declared in sys/times.h on that platform, so we must do
-   this as a work-around anyway.  */
-#if defined(__HP_aCC) && !defined(__HPACC_USING_MULTIPLIES_IN_FUNCTIONAL)
-# define __HPACC_USING_MULTIPLIES_IN_FUNCTIONAL
-# define @KWSYS_NAMESPACE at _DEFINED___HPACC_USING_MULTIPLIES_IN_FUNCTIONAL
-#endif
-
-/* Include the real header.  */
-#include <@KWSYS_STL_HEADER@>
-
-/* Cleanup.  */
-#if defined(@KWSYS_NAMESPACE at _DEFINED___HPACC_USING_MULTIPLIES_IN_FUNCTIONAL)
-# undef @KWSYS_NAMESPACE at _DEFINED___HPACC_USING_MULTIPLIES_IN_FUNCTIONAL
-# undef __HPACC_USING_MULTIPLIES_IN_FUNCTIONAL
-#endif
-
-#ifdef _MSC_VER
-# pragma warning(pop)
-#endif
-
- at KWSYS_STL_HEADER_EXTRA@
-#endif
diff --git a/src/kwsys/kwsys_stl_string.hxx.in b/src/kwsys/kwsys_stl_string.hxx.in
deleted file mode 100644
index cd312cb..0000000
--- a/src/kwsys/kwsys_stl_string.hxx.in
+++ /dev/null
@@ -1,123 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-
-// This header is extra code for <@KWSYS_NAMESPACE@/stl/string>.
-#if !defined(@KWSYS_NAMESPACE at _stl_string_including_hxx)
-# error "The header <@KWSYS_NAMESPACE@/stl/string.hxx> may be included only by <@KWSYS_NAMESPACE@/stl/string>."
-#endif
-
-// Provide the istream operator for the stl string if it is not
-// provided by the system or another copy of kwsys.  Allow user code
-// to block this definition by defining the macro
-// @KWSYS_NAMESPACE at _STL_STRING_NO_ISTREAM
-// to avoid conflicts with other libraries.  User code can test for
-// this definition by checking the macro
-// @KWSYS_NAMESPACE at _STL_STRING_ISTREAM_DEFINED
-#if !@KWSYS_NAMESPACE at _STL_STRING_HAVE_ISTREAM && !defined(@KWSYS_NAMESPACE at _STL_STRING_NO_ISTREAM) && !defined(KWSYS_STL_STRING_ISTREAM_DEFINED)
-# define KWSYS_STL_STRING_ISTREAM_DEFINED
-# define @KWSYS_NAMESPACE at _STL_STRING_ISTREAM_DEFINED
-# include <ctype.h> // isspace
-# include <@KWSYS_NAMESPACE@/ios/iostream>
-# if defined(__WATCOMC__)
-namespace @KWSYS_NAMESPACE@
-{
-struct ios_istream_hack: public kwsys_ios::istream
-{ void eatwhite() { this->@KWSYS_NAMESPACE at _ios::istream::eatwhite(); } };
-}
-# endif
-inline @KWSYS_NAMESPACE at _ios::istream&
-operator>>(@KWSYS_NAMESPACE at _ios::istream& is,
-           @KWSYS_NAMESPACE at _stl::string& s)
-{
-  // Keep track of the resulting state.
-  int state = @KWSYS_NAMESPACE at _ios::ios::goodbit;
-
-  // Save the width setting and set it back to zero.
-  size_t n = static_cast<size_t>(is.width(0));
-
-  // Clear any old contents of the output string.
-  s.erase();
-
-  // Skip leading whitespace.
-#if defined(__WATCOMC__)
-  static_cast<@KWSYS_NAMESPACE@::ios_istream_hack&>(is).eatwhite();
-#else
-  is.eatwhite();
-#endif
-  @KWSYS_NAMESPACE at _ios::istream& okay = is;
-
-  if(okay)
-    {
-    // Select a maximum possible length.
-    if(n == 0 || n >= s.max_size())
-      {
-      n = s.max_size();
-      }
-
-    // Read until a space is found or the maximum length is reached.
-    bool success = false;
-    for(int c = is.peek(); (--n > 0 && c != EOF && !isspace(c)); c = is.peek())
-      {
-      s += static_cast<char>(c);
-      success = true;
-      is.ignore();
-      }
-
-    // Set flags for resulting state.
-    if(is.peek() == EOF) { state |= @KWSYS_NAMESPACE at _ios::ios::eofbit; }
-    if(!success) { state |= @KWSYS_NAMESPACE at _ios::ios::failbit; }
-    }
-
-  // Set the final result state.
-  is.clear(state);
-  return is;
-}
-#endif
-
-// Provide the ostream operator for the stl string if it is not
-// provided by the system or another copy of kwsys.  Allow user code
-// to block this definition by defining the macro
-// @KWSYS_NAMESPACE at _STL_STRING_NO_OSTREAM
-// to avoid conflicts with other libraries.  User code can test for
-// this definition by checking the macro
-// @KWSYS_NAMESPACE at _STL_STRING_OSTREAM_DEFINED
-#if !@KWSYS_NAMESPACE at _STL_STRING_HAVE_OSTREAM && !defined(@KWSYS_NAMESPACE at _STL_STRING_NO_OSTREAM) && !defined(KWSYS_STL_STRING_OSTREAM_DEFINED)
-# define KWSYS_STL_STRING_OSTREAM_DEFINED
-# define @KWSYS_NAMESPACE at _STL_STRING_OSTREAM_DEFINED
-# include <@KWSYS_NAMESPACE@/ios/iostream>
-inline @KWSYS_NAMESPACE at _ios::ostream&
-operator<<(@KWSYS_NAMESPACE at _ios::ostream& os,
-           @KWSYS_NAMESPACE at _stl::string const& s)
-{
-  return os << s.c_str();
-}
-#endif
-
-// Provide the operator!= for the stl string and char* if it is not
-// provided by the system or another copy of kwsys.  Allow user code
-// to block this definition by defining the macro
-// @KWSYS_NAMESPACE at _STL_STRING_NO_NEQ_CHAR
-// to avoid conflicts with other libraries.  User code can test for
-// this definition by checking the macro
-// @KWSYS_NAMESPACE at _STL_STRING_NEQ_CHAR_DEFINED
-#if !@KWSYS_NAMESPACE at _STL_STRING_HAVE_NEQ_CHAR && !defined(@KWSYS_NAMESPACE at _STL_STRING_NO_NEQ_CHAR) && !defined(KWSYS_STL_STRING_NEQ_CHAR_DEFINED)
-# define KWSYS_STL_STRING_NEQ_CHAR_DEFINED
-# define @KWSYS_NAMESPACE at _STL_STRING_NEQ_CHAR_DEFINED
-inline bool operator!=(@KWSYS_NAMESPACE at _stl::string const& s, const char* c)
-{
-  return !(s == c);
-}
-inline bool operator!=(const char* c, @KWSYS_NAMESPACE at _stl::string const& s)
-{
-  return !(s == c);
-}
-#endif
diff --git a/src/kwsys/testAutoPtr.cxx b/src/kwsys/testAutoPtr.cxx
deleted file mode 100644
index ed75ff4..0000000
--- a/src/kwsys/testAutoPtr.cxx
+++ /dev/null
@@ -1,166 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifdef __BORLANDC__
-# pragma warn -8027 /* 'for' not inlined.  */
-# pragma warn -8026 /* exception not inlined.  */
-#endif 
-#include "kwsysPrivate.h"
-#include KWSYS_HEADER(auto_ptr.hxx)
-// Work-around CMake dependency scanning limitation.  This must
-// duplicate the above list of headers.
-#if 0
-# include "auto_ptr.hxx.in"
-#endif
-
-#include <stdio.h>
-
-#define ASSERT(x,y) if (!(x)) { printf("FAIL: " y "\n"); status = 1; }
-
-int instances = 0; // don't declare as static
-
-struct A
-{
-  A() { ++instances; }
-  ~A() { --instances; }
-  A* self() {return this; }
-};
-struct B: public A {};
-
-static int function_call(kwsys::auto_ptr<A> a)
-{
-  return a.get()? 1:0;
-}
-
-static A* get_A(A& a) { return &a; }
-
-static kwsys::auto_ptr<A> generate_auto_ptr_A()
-{
-  return kwsys::auto_ptr<A>(new A);
-}
-
-static kwsys::auto_ptr<B> generate_auto_ptr_B()
-{
-  return kwsys::auto_ptr<B>(new B);
-}
-
-int testAutoPtr(int, char*[])
-{
-  int status = 0;
-
-  // Keep everything in a subscope so we can detect leaks.
-  {
-    kwsys::auto_ptr<A> pa0;
-    kwsys::auto_ptr<A> pa1(new A());
-    kwsys::auto_ptr<B> pb1(new B());
-    kwsys::auto_ptr<B> pb2(new B());
-    kwsys::auto_ptr<A> pa2(new B());
-
-    A* ptr = get_A(*pa1);
-    ASSERT(ptr == pa1.get(),
-          "auto_ptr does not return correct object when dereferenced");
-    ptr = pa1->self();
-    ASSERT(ptr == pa1.get(),
-          "auto_ptr does not return correct pointer from operator->");
-
-    A* before = pa0.get();
-    pa0.reset(new A());
-    ASSERT(pa0.get() && pa0.get() != before,
-          "auto_ptr empty after reset(new A())");
-
-    before = pa0.get();
-    pa0.reset(new B());
-    ASSERT(pa0.get() && pa0.get() != before,
-          "auto_ptr empty after reset(new B())");
-
-    delete pa0.release();
-    ASSERT(!pa0.get(), "auto_ptr holds an object after release()");
-
-    kwsys::auto_ptr<A> pa3(pb1);
-    ASSERT(!pb1.get(),
-           "auto_ptr full after being used to construct another");
-    ASSERT(pa3.get(),
-          "auto_ptr empty after construction from another");
-
-    {
-    kwsys::auto_ptr<A> pa;
-    pa = pa3;
-    ASSERT(!pa3.get(),
-           "auto_ptr full after assignment to another");
-    ASSERT(pa.get(),
-          "auto_ptr empty after assignment from another");
-    }
-
-    {
-    kwsys::auto_ptr<A> pa;
-    pa = pb2;
-    ASSERT(!pb2.get(),
-           "auto_ptr full after assignment to compatible");
-    ASSERT(pa.get(),
-          "auto_ptr empty after assignment from compatible");
-    }
-
-    {
-    int receive = function_call(pa2);
-    ASSERT(receive,
-           "auto_ptr did not receive ownership in called function");
-    ASSERT(!pa2.get(),
-           "auto_ptr did not release ownership to called function");
-    }
-
-    {
-    int received = function_call(generate_auto_ptr_A());
-    ASSERT(received,
-           "auto_ptr in called function did not take ownership "
-           "from factory function");
-    }
-
-#if 0
-    // Is this allowed by the standard?
-    {
-    int received = function_call(generate_auto_ptr_B());
-    ASSERT(received,
-           "auto_ptr in called function did not take ownership "
-           "from factory function with conversion");
-    }
-#endif
-
-    {
-    kwsys::auto_ptr<A> pa(generate_auto_ptr_A());
-    ASSERT(pa.get(),
-      "auto_ptr empty after construction from factory function");
-    }
-
-    {
-    kwsys::auto_ptr<A> pa;
-    pa = generate_auto_ptr_A();
-    ASSERT(pa.get(),
-      "auto_ptr empty after assignment from factory function");
-    }
-
-    {
-    kwsys::auto_ptr<A> pa(generate_auto_ptr_B());
-    ASSERT(pa.get(),
-      "auto_ptr empty after construction from compatible factory function");
-    }
-
-    {
-    kwsys::auto_ptr<A> pa;
-    pa = generate_auto_ptr_B();
-    ASSERT(pa.get(),
-      "auto_ptr empty after assignment from compatible factory function");
-    }
-  }
-
-  ASSERT(instances == 0, "auto_ptr leaked an object");
-
-  return status;
-}
diff --git a/src/kwsys/testCommandLineArguments.cxx b/src/kwsys/testCommandLineArguments.cxx
deleted file mode 100644
index 6a03c0f..0000000
--- a/src/kwsys/testCommandLineArguments.cxx
+++ /dev/null
@@ -1,187 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#include "kwsysPrivate.h"
-#include KWSYS_HEADER(CommandLineArguments.hxx)
-#include KWSYS_HEADER(ios/iostream)
-#include KWSYS_HEADER(stl/vector)
-
-// Work-around CMake dependency scanning limitation.  This must
-// duplicate the above list of headers.
-#if 0
-# include "CommandLineArguments.hxx.in"
-# include "kwsys_ios_iostream.h.in"
-#endif
-
-#include <stddef.h> /* size_t */
-#include <string.h> /* strcmp */
-
-static void* random_ptr = reinterpret_cast<void*>(0x123);
-
-static int argument(const char* arg, const char* value, void* call_data)
-{
-  kwsys_ios::cout << "Got argument: \"" << arg << "\" value: \"" << (value?value:"(null)") << "\"" << kwsys_ios::endl;
-  if ( call_data != random_ptr )
-    {
-    kwsys_ios::cerr << "Problem processing call_data" << kwsys_ios::endl;
-    return 0;
-    }
-  return 1;
-}
-
-static int unknown_argument(const char* argument, void* call_data)
-{
-  kwsys_ios::cout << "Got unknown argument: \"" << argument << "\"" << kwsys_ios::endl;
-  if ( call_data != random_ptr )
-    {
-    kwsys_ios::cerr << "Problem processing call_data" << kwsys_ios::endl;
-    return 0;
-    }
-  return 1;
-}
-
-static bool CompareTwoItemsOnList(bool i1, bool i2) { return i1 == i2; }
-static bool CompareTwoItemsOnList(int i1, int i2) { return i1 == i2; }
-static bool CompareTwoItemsOnList(double i1, double i2) { return i1 == i2; }
-static bool CompareTwoItemsOnList(const char* i1,
-  const char* i2) { return strcmp(i1, i2) == 0; }
-static bool CompareTwoItemsOnList(const kwsys_stl::string& i1,
-  const kwsys_stl::string& i2) { return i1 == i2; }
-
-int testCommandLineArguments(int argc, char* argv[])
-{
-  // Example run: ./testCommandLineArguments --some-int-variable 4
-  // --another-bool-variable --some-bool-variable=yes
-  // --some-stl-string-variable=foobar --set-bool-arg1 --set-bool-arg2
-  // --some-string-variable=hello
-
-  int res = 0;
-  kwsys::CommandLineArguments arg;
-  arg.Initialize(argc, argv);
-
-  // For error handling
-  arg.SetClientData(random_ptr);
-  arg.SetUnknownArgumentCallback(unknown_argument);
-
-  int some_int_variable = 10;
-  double some_double_variable = 10.10;
-  char* some_string_variable = 0;
-  kwsys_stl::string some_stl_string_variable = "";
-  bool some_bool_variable = false;
-  bool some_bool_variable1 = false;
-  bool bool_arg1 = false;
-  int bool_arg2 = 0;
-
-  kwsys_stl::vector<int> numbers_argument;
-  int valid_numbers[] = { 5, 1, 8, 3, 7, 1, 3, 9, 7, 1 };
-
-  kwsys_stl::vector<double> doubles_argument;
-  double valid_doubles[] = { 12.5, 1.31, 22 };
-
-  kwsys_stl::vector<bool> bools_argument;
-  bool valid_bools[] = { true, true, false };
-
-  kwsys_stl::vector<char*> strings_argument;
-  const char* valid_strings[] = { "andy", "bill", "brad", "ken" };
-
-  kwsys_stl::vector<kwsys_stl::string> stl_strings_argument;
-  kwsys_stl::string valid_stl_strings[] = { "ken", "brad", "bill", "andy" };
-
-  typedef kwsys::CommandLineArguments argT;
-
-  arg.AddArgument("--some-int-variable", argT::SPACE_ARGUMENT, &some_int_variable, "Set some random int variable");
-  arg.AddArgument("--some-double-variable", argT::CONCAT_ARGUMENT, &some_double_variable, "Set some random double variable");
-  arg.AddArgument("--some-string-variable", argT::EQUAL_ARGUMENT, &some_string_variable, "Set some random string variable");
-  arg.AddArgument("--some-stl-string-variable", argT::EQUAL_ARGUMENT, &some_stl_string_variable, "Set some random stl string variable");
-  arg.AddArgument("--some-bool-variable", argT::EQUAL_ARGUMENT, &some_bool_variable, "Set some random bool variable");
-  arg.AddArgument("--another-bool-variable", argT::NO_ARGUMENT, &some_bool_variable1, "Set some random bool variable 1");
-  arg.AddBooleanArgument("--set-bool-arg1", &bool_arg1, "Test AddBooleanArgument 1");
-  arg.AddBooleanArgument("--set-bool-arg2", &bool_arg2, "Test AddBooleanArgument 2");
-  arg.AddArgument("--some-multi-argument", argT::MULTI_ARGUMENT, &numbers_argument, "Some multiple values variable");
-  arg.AddArgument("-N", argT::SPACE_ARGUMENT, &doubles_argument, "Some explicit multiple values variable");
-  arg.AddArgument("-BB", argT::CONCAT_ARGUMENT, &bools_argument, "Some explicit multiple values variable");
-  arg.AddArgument("-SS", argT::EQUAL_ARGUMENT, &strings_argument, "Some explicit multiple values variable");
-  arg.AddArgument("-SSS", argT::MULTI_ARGUMENT, &stl_strings_argument, "Some explicit multiple values variable");
-
-  arg.AddCallback("-A", argT::NO_ARGUMENT, argument, random_ptr, "Some option -A. This option has a multiline comment. It should demonstrate how the code splits lines.");
-  arg.AddCallback("-B", argT::SPACE_ARGUMENT, argument, random_ptr, "Option -B takes argument with space");
-  arg.AddCallback("-C", argT::EQUAL_ARGUMENT, argument, random_ptr, "Option -C takes argument after =");
-  arg.AddCallback("-D", argT::CONCAT_ARGUMENT, argument, random_ptr, "This option takes concatinated argument");
-  arg.AddCallback("--long1", argT::NO_ARGUMENT, argument, random_ptr, "-A");
-  arg.AddCallback("--long2", argT::SPACE_ARGUMENT, argument, random_ptr, "-B");
-  arg.AddCallback("--long3", argT::EQUAL_ARGUMENT, argument, random_ptr, "Same as -C but a bit different");
-  arg.AddCallback("--long4", argT::CONCAT_ARGUMENT, argument, random_ptr, "-C");
-
-  if ( !arg.Parse() )
-    {
-    kwsys_ios::cerr << "Problem parsing arguments" << kwsys_ios::endl;
-    res = 1;
-    }
-  kwsys_ios::cout << "Help: " << arg.GetHelp() << kwsys_ios::endl;
-
-  kwsys_ios::cout << "Some int variable was set to: " << some_int_variable << kwsys_ios::endl;
-  kwsys_ios::cout << "Some double variable was set to: " << some_double_variable << kwsys_ios::endl;
-  if ( some_string_variable && strcmp(some_string_variable, "test string with space") == 0)
-    {
-    kwsys_ios::cout << "Some string variable was set to: " << some_string_variable << kwsys_ios::endl;
-    delete [] some_string_variable;
-    }
-  else
-    {
-    kwsys_ios::cerr << "Problem setting string variable" << kwsys_ios::endl;
-    res = 1;
-    }
-  size_t cc;
-#define CompareTwoLists(list1, list_valid, lsize) \
-  if ( list1.size() != lsize ) \
-    { \
-    kwsys_ios::cerr << "Problem setting " #list1 ". Size is: " << list1.size() \
-     << " should be: " << lsize << kwsys_ios::endl; \
-    res = 1; \
-    } \
-  else \
-    { \
-    kwsys_ios::cout << #list1 " argument set:"; \
-    for ( cc =0; cc < lsize; ++ cc ) \
-      { \
-      kwsys_ios::cout << " " << list1[cc]; \
-      if ( !CompareTwoItemsOnList(list1[cc], list_valid[cc]) ) \
-        { \
-        kwsys_ios::cerr << "Problem setting " #list1 ". Value of " \
-        << cc << " is: [" << list1[cc] << "] <> [" \
-        << list_valid[cc] << "]" << kwsys_ios::endl; \
-        res = 1; \
-        break; \
-        } \
-      } \
-    kwsys_ios::cout << kwsys_ios::endl; \
-    }
-
-  CompareTwoLists(numbers_argument, valid_numbers, 10);
-  CompareTwoLists(doubles_argument, valid_doubles, 3);
-  CompareTwoLists(bools_argument, valid_bools, 3);
-  CompareTwoLists(strings_argument, valid_strings, 4);
-  CompareTwoLists(stl_strings_argument, valid_stl_strings, 4);
-
-  kwsys_ios::cout << "Some STL String variable was set to: " << some_stl_string_variable << kwsys_ios::endl;
-  kwsys_ios::cout << "Some bool variable was set to: " << some_bool_variable << kwsys_ios::endl;
-  kwsys_ios::cout << "Some bool variable was set to: " << some_bool_variable1 << kwsys_ios::endl;
-  kwsys_ios::cout << "bool_arg1 variable was set to: " << bool_arg1 << kwsys_ios::endl;
-  kwsys_ios::cout << "bool_arg2 variable was set to: " << bool_arg2 << kwsys_ios::endl;
-  kwsys_ios::cout << kwsys_ios::endl;
-
-  for ( cc = 0; cc < strings_argument.size(); ++ cc )
-    {
-    delete [] strings_argument[cc];
-    strings_argument[cc] = 0;
-    }
-  return res;
-}
diff --git a/src/kwsys/testCommandLineArguments1.cxx b/src/kwsys/testCommandLineArguments1.cxx
deleted file mode 100644
index b65c37f..0000000
--- a/src/kwsys/testCommandLineArguments1.cxx
+++ /dev/null
@@ -1,108 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#include "kwsysPrivate.h"
-#include KWSYS_HEADER(CommandLineArguments.hxx)
-#include KWSYS_HEADER(ios/iostream)
-#include KWSYS_HEADER(stl/vector)
-
-// Work-around CMake dependency scanning limitation.  This must
-// duplicate the above list of headers.
-#if 0
-# include "CommandLineArguments.hxx.in"
-# include "kwsys_ios_iostream.h.in"
-#endif
-
-#include <assert.h> /* assert */
-#include <string.h> /* strcmp */
-
-int testCommandLineArguments1(int argc, char* argv[])
-{
-  kwsys::CommandLineArguments arg;
-  arg.Initialize(argc, argv);
-
-  int n = 0;
-  char* m = 0;
-  kwsys_stl::string p;
-  int res = 0;
-
-  typedef kwsys::CommandLineArguments argT;
-  arg.AddArgument("-n", argT::SPACE_ARGUMENT, &n, "Argument N");
-  arg.AddArgument("-m", argT::EQUAL_ARGUMENT, &m, "Argument M");
-  arg.AddBooleanArgument("-p", &p, "Argument P");
-
-  arg.StoreUnusedArguments(true);
-
-  if ( !arg.Parse() )
-    {
-    kwsys_ios::cerr << "Problem parsing arguments" << kwsys_ios::endl;
-    res = 1;
-    }
-  if ( n != 24 )
-    {
-    kwsys_ios::cout << "Problem setting N. Value of N: " << n << kwsys_ios::endl;
-    res = 1;
-    }
-  if ( !m || strcmp(m, "test value") != 0 )
-    {
-    kwsys_ios::cout << "Problem setting M. Value of M: " << m << kwsys_ios::endl;
-    res = 1;
-    }
-  if ( p != "1" )
-    {
-    kwsys_ios::cout << "Problem setting P. Value of P: " << p << kwsys_ios::endl;
-    res = 1;
-    }
-  kwsys_ios::cout << "Value of N: " << n << kwsys_ios::endl;
-  kwsys_ios::cout << "Value of M: " << m << kwsys_ios::endl;
-  kwsys_ios::cout << "Value of P: " << p << kwsys_ios::endl;
-  if ( m )
-    {
-    delete [] m;
-    }
-
-  char** newArgv = 0;
-  int newArgc = 0;
-  arg.GetUnusedArguments(&newArgc, &newArgv);
-  int cc;
-  const char* valid_unused_args[9] = {
-    0, "--ignored", "--second-ignored", "third-ignored",
-    "some", "junk", "at", "the", "end"
-  };
-  if ( newArgc != 9 )
-    {
-    kwsys_ios::cerr << "Bad number of unused arguments: " << newArgc << kwsys_ios::endl;
-    res = 1;
-    }
-  for ( cc = 0; cc < newArgc; ++ cc )
-    {
-    assert(newArgv[cc]); /* Quiet Clang scan-build. */
-    kwsys_ios::cout << "Unused argument[" << cc << "] = [" << newArgv[cc] << "]"
-      << kwsys_ios::endl;
-    if ( cc >= 9 )
-      {
-      kwsys_ios::cerr << "Too many unused arguments: " << cc << kwsys_ios::endl;
-      res = 1;
-      }
-    else if ( valid_unused_args[cc] &&
-      strcmp(valid_unused_args[cc], newArgv[cc]) != 0 )
-      {
-      kwsys_ios::cerr << "Bad unused argument [" << cc << "] \""
-        << newArgv[cc] << "\" should be: \"" << valid_unused_args[cc] << "\""
-        << kwsys_ios::endl;
-      res = 1;
-      }
-    }
-  arg.DeleteRemainingArguments(newArgc, &newArgv);
-
-  return res;
-}
- 
diff --git a/src/kwsys/testDynamicLoader.cxx b/src/kwsys/testDynamicLoader.cxx
deleted file mode 100644
index 58adb84..0000000
--- a/src/kwsys/testDynamicLoader.cxx
+++ /dev/null
@@ -1,129 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#include "kwsysPrivate.h"
-
-#include KWSYS_HEADER(DynamicLoader.hxx)
-#include KWSYS_HEADER(ios/iostream)
-#include KWSYS_HEADER(stl/string)
-
-#if defined(__BEOS__) || defined(__HAIKU__)
-#include <be/kernel/OS.h>  /* disable_debugger() API. */
-#endif
-
-// Work-around CMake dependency scanning limitation.  This must
-// duplicate the above list of headers.
-#if 0
-# include "DynamicLoader.hxx.in"
-# include "kwsys_ios_iostream.h.in"
-# include "kwsys_stl_string.hxx.in"
-#endif
-
-// Include with <> instead of "" to avoid getting any in-source copy
-// left on disk.
-#include <testSystemTools.h>
-
-static kwsys_stl::string GetLibName(const char* lname)
-{
-  // Construct proper name of lib
-  kwsys_stl::string slname;
-  slname = EXECUTABLE_OUTPUT_PATH;
-#ifdef CMAKE_INTDIR
-  slname += "/";
-  slname += CMAKE_INTDIR;
-#endif
-  slname += "/";
-  slname += kwsys::DynamicLoader::LibPrefix();
-  slname += lname;
-  slname += kwsys::DynamicLoader::LibExtension();
-
-  return slname;
-}
-
-/* libname = Library name (proper prefix, proper extension)
- * System  = symbol to lookup in libname
- * r1: should OpenLibrary succeed ?
- * r2: should GetSymbolAddress succeed ?
- * r3: should CloseLibrary succeed ?
- */
-int TestDynamicLoader(const char* libname, const char* symbol, int r1, int r2, int r3)
-{
-  kwsys_ios::cerr << "Testing: " << libname << kwsys_ios::endl;
-  kwsys::DynamicLoader::LibraryHandle l
-    = kwsys::DynamicLoader::OpenLibrary(libname);
-  // If result is incompatible with expectation just fails (xor):
-  if( (r1 && !l) || (!r1 && l) )
-    {
-    kwsys_ios::cerr
-      << kwsys::DynamicLoader::LastError() << kwsys_ios::endl;
-    return 1;
-    }
-  kwsys::DynamicLoader::SymbolPointer f
-    = kwsys::DynamicLoader::GetSymbolAddress(l, symbol);
-  if( (r2 && !f) || (!r2 && f) )
-    {
-    kwsys_ios::cerr
-      << kwsys::DynamicLoader::LastError() << kwsys_ios::endl;
-    return 1;
-    }
-#ifndef __APPLE__
-  int s = kwsys::DynamicLoader::CloseLibrary(l);
-  if( (r3 && !s) || (!r3 && s) )
-    {
-    kwsys_ios::cerr
-      << kwsys::DynamicLoader::LastError() << kwsys_ios::endl;
-    return 1;
-    }
-#else
-  (void)r3;
-#endif
-  return 0;
-}
-
-int testDynamicLoader(int argc, char *argv[])
-{
-#if defined(_WIN32)
-  SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
-#elif defined(__BEOS__) || defined(__HAIKU__)
-  disable_debugger(1);
-#endif
-  int res = 0;
-  if( argc == 3 )
-    {
-    // User specify a libname and symbol to check.
-    res = TestDynamicLoader(argv[1], argv[2],1,1,1);
-    return res;
-    }
-
-// dlopen() on Syllable before 11/22/2007 doesn't return 0 on error
-#ifndef __SYLLABLE__
-  // Make sure that inexistent lib is giving correct result
-  res += TestDynamicLoader("azerty_", "foo_bar",0,0,0);
-  // Make sure that random binary file cannot be assimilated as dylib
-  res += TestDynamicLoader(TEST_SYSTEMTOOLS_SOURCE_DIR "/testSystemTools.bin", "wp",0,0,0);
-#endif
-
-#ifdef __linux__
-  // This one is actually fun to test, since dlopen is by default loaded...wonder why :)
-  res += TestDynamicLoader("foobar.lib", "dlopen",0,1,0);
-  res += TestDynamicLoader("libdl.so", "dlopen",1,1,1);
-  res += TestDynamicLoader("libdl.so", "TestDynamicLoader",1,0,1);
-#endif
-  // Now try on the generated library
-  kwsys_stl::string libname = GetLibName(KWSYS_NAMESPACE_STRING "TestDynload");
-  res += TestDynamicLoader(libname.c_str(), "dummy",1,0,1);
-  res += TestDynamicLoader(libname.c_str(), "TestDynamicLoaderSymbolPointer",1,1,1);
-  res += TestDynamicLoader(libname.c_str(), "_TestDynamicLoaderSymbolPointer",1,0,1);
-  res += TestDynamicLoader(libname.c_str(), "TestDynamicLoaderData",1,1,1);
-  res += TestDynamicLoader(libname.c_str(), "_TestDynamicLoaderData",1,0,1);
-
-  return res;
-}
diff --git a/src/kwsys/testDynload.c b/src/kwsys/testDynload.c
deleted file mode 100644
index ba60bec..0000000
--- a/src/kwsys/testDynload.c
+++ /dev/null
@@ -1,22 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifdef _WIN32
-#define DL_EXPORT __declspec( dllexport )
-#else
-#define DL_EXPORT
-#endif
-
-DL_EXPORT int TestDynamicLoaderData = 0;
-
-DL_EXPORT void TestDynamicLoaderSymbolPointer()
-{
-}
diff --git a/src/kwsys/testEncode.c b/src/kwsys/testEncode.c
deleted file mode 100644
index 26d483b..0000000
--- a/src/kwsys/testEncode.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#include "kwsysPrivate.h"
-#include KWSYS_HEADER(MD5.h)
-
-/* Work-around CMake dependency scanning limitation.  This must
-   duplicate the above list of headers.  */
-#if 0
-# include "MD5.h.in"
-#endif
-
-#include <stdio.h>
-#include <string.h>
-
-static const unsigned char testMD5input1[] =
-"  A quick brown fox jumps over the lazy dog.\n"
-"  This is sample text for MD5 sum input.\n";
-static const char testMD5output1[] = "8f146af46ed4f267921bb937d4d3500c";
-
-static const int testMD5input2len = 28;
-static const unsigned char testMD5input2[] = "the cow jumped over the moon";
-static const char testMD5output2[] = "a2ad137b746138fae4e5adca9c85d3ae";
-
-static int testMD5_1(kwsysMD5* md5)
-{
-  char md5out[33];
-  kwsysMD5_Initialize(md5);
-  kwsysMD5_Append(md5, testMD5input1, -1);
-  kwsysMD5_FinalizeHex(md5, md5out);
-  md5out[32] = 0;
-  printf("md5sum 1: expected [%s]\n"
-         "               got [%s]\n",
-         testMD5output1, md5out);
-  return (strcmp(md5out, testMD5output1) != 0)? 1:0;
-}
-
-static int testMD5_2(kwsysMD5* md5)
-{
-  unsigned char digest[16];
-  char md5out[33];
-  kwsysMD5_Initialize(md5);
-  kwsysMD5_Append(md5, testMD5input2, testMD5input2len);
-  kwsysMD5_Finalize(md5, digest);
-  kwsysMD5_DigestToHex(digest, md5out);
-  md5out[32] = 0;
-  printf("md5sum 2: expected [%s]\n"
-         "               got [%s]\n",
-         testMD5output2, md5out);
-  return (strcmp(md5out, testMD5output2) != 0)? 1:0;
-}
-
-int testEncode(int argc, char* argv[])
-{
-  int result = 0;
-  (void)argc;
-  (void)argv;
-
-  /* Test MD5 digest.  */
-  {
-  kwsysMD5* md5 = kwsysMD5_New();
-  result |= testMD5_1(md5);
-  result |= testMD5_2(md5);
-  kwsysMD5_Delete(md5);
-  }
-
-  return result;
-}
diff --git a/src/kwsys/testEncoding.cxx b/src/kwsys/testEncoding.cxx
deleted file mode 100644
index 094588c..0000000
--- a/src/kwsys/testEncoding.cxx
+++ /dev/null
@@ -1,199 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#include "kwsysPrivate.h"
-
-#if defined(_MSC_VER)
-# pragma warning (disable:4786)
-#endif
-
-#include KWSYS_HEADER(Encoding.hxx)
-#include KWSYS_HEADER(Encoding.h)
-#include KWSYS_HEADER(ios/iostream)
-
-#include <locale.h>
-#include <string.h>
-#include <stdlib.h>
-
-// Work-around CMake dependency scanning limitation.  This must
-// duplicate the above list of headers.
-#if 0
-# include "Encoding.hxx.in"
-# include "Encoding.h.in"
-# include "kwsys_ios_iostream.h.in"
-#endif
-
-//----------------------------------------------------------------------------
-static const unsigned char helloWorldStrings[][32] =
-{
-  // English
-  {'H','e','l','l','o',' ','W','o','r','l','d',0},
-  // Japanese
-  {0xE3, 0x81, 0x93, 0xE3, 0x82, 0x93, 0xE3, 0x81, 0xAB, 0xE3,
-   0x81, 0xA1, 0xE3, 0x81, 0xAF, 0xE4, 0xB8, 0x96, 0xE7, 0x95,
-   0x8C, 0},
-   // Arabic
-  {0xD9, 0x85, 0xD8, 0xB1, 0xD8, 0xAD, 0xD8, 0xA8, 0xD8, 0xA7,
-   0x20, 0xD8, 0xA7, 0xD9, 0x84, 0xD8, 0xB9, 0xD8, 0xA7, 0xD9,
-   0x84, 0xD9, 0x85, 0},
-  // Yiddish
-  {0xD7, 0x94, 0xD7, 0xA2, 0xD7, 0x9C, 0xD7, 0x90, 0x20, 0xD7,
-   0x95, 0xD7, 0x95, 0xD7, 0xA2, 0xD7, 0x9C, 0xD7, 0x98, 0},
-  // Russian
-  {0xD0, 0xBF, 0xD1, 0x80, 0xD0, 0xB8, 0xD0, 0xB2, 0xD0, 0xB5,
-   0xD1, 0x82, 0x20, 0xD0, 0xBC, 0xD0, 0xB8, 0xD1, 0x80, 0},
-  // Latin
-  {0x4D, 0x75, 0x6E, 0x64, 0x75, 0x73, 0x20, 0x73, 0x61, 0x6C,
-   0x76, 0x65, 0},
-  // Swahili
-  {0x68, 0x75, 0x6A, 0x61, 0x6D, 0x62, 0x6F, 0x20, 0x44, 0x75,
-   0x6E, 0x69, 0x61, 0},
-  // Icelandic
-  {0x48, 0x61, 0x6C, 0x6C, 0xC3, 0xB3, 0x20, 0x68, 0x65, 0x69,
-   0x6D, 0x75, 0x72, 0},
-  {0}
-};
-
-//----------------------------------------------------------------------------
-static int testHelloWorldEncoding()
-{
-  int ret = 0;
-  for(int i=0; helloWorldStrings[i][0] != 0; i++)
-    {
-    std::string str = reinterpret_cast<const char*>(helloWorldStrings[i]);
-    std::cout << str << std::endl;
-    std::wstring wstr = kwsys::Encoding::ToWide(str);
-    std::string str2 = kwsys::Encoding::ToNarrow(wstr);
-    wchar_t* c_wstr = kwsysEncoding_DupToWide(str.c_str());
-    char* c_str2 = kwsysEncoding_DupToNarrow(c_wstr);
-    if(!wstr.empty() && (str != str2 || strcmp(c_str2, str.c_str())))
-      {
-      std::cout << "converted string was different: " << str2 << std::endl;
-      std::cout << "converted string was different: " << c_str2 << std::endl;
-      ret++;
-      }
-    free(c_wstr);
-    free(c_str2);
-    }
-  return ret;
-}
-
-static int testRobustEncoding()
-{
-  // test that the conversion functions handle invalid
-  // unicode correctly/gracefully
-
-  int ret = 0;
-  char cstr[] = {(char)-1, 0};
-  // this conversion could fail
-  std::wstring wstr = kwsys::Encoding::ToWide(cstr);
-
-  wstr = kwsys::Encoding::ToWide(NULL);
-  if(wstr != L"")
-    {
-    const wchar_t* wcstr = wstr.c_str();
-    std::cout << "ToWide(NULL) returned";
-    for(size_t i=0; i<wstr.size(); i++)
-      {
-      std::cout << " " << std::hex << (int)wcstr[i];
-      }
-    std::cout << std::endl;
-    ret++;
-    }
-  wstr = kwsys::Encoding::ToWide("");
-  if(wstr != L"")
-    {
-    const wchar_t* wcstr = wstr.c_str();
-    std::cout << "ToWide(\"\") returned";
-    for(size_t i=0; i<wstr.size(); i++)
-      {
-      std::cout << " " << std::hex << (int)wcstr[i];
-      }
-    std::cout << std::endl;
-    ret++;
-    }
-
-#ifdef WIN32
-  // 16 bit wchar_t - we make an invalid surrogate pair
-  wchar_t cwstr[] = {0xD801, 0xDA00, 0};
-  // this conversion could fail
-  std::string win_str = kwsys::Encoding::ToNarrow(cwstr);
-#endif
-
-  std::string str = kwsys::Encoding::ToNarrow(NULL);
-  if(str != "")
-    {
-    std::cout << "ToNarrow(NULL) returned " << str << std::endl;
-    ret++;
-    }
-
-  str = kwsys::Encoding::ToNarrow(L"");
-  if(wstr != L"")
-    {
-    std::cout << "ToNarrow(\"\") returned " << str << std::endl;
-    ret++;
-    }
-
-  return ret;
-}
-
-static int testCommandLineArguments()
-{
-  int status = 0;
-
-  char const* argv[2] = {
-    "./app.exe",
-    (char const*)helloWorldStrings[1]
-  };
-
-  kwsys::Encoding::CommandLineArguments args(2, argv);
-  kwsys::Encoding::CommandLineArguments arg2 =
-    kwsys::Encoding::CommandLineArguments(args);
-
-  char const* const* u8_argv = args.argv();
-  for(int i=0; i<args.argc(); i++)
-  {
-    char const* u8_arg = u8_argv[i];
-    if(strcmp(argv[i], u8_arg) != 0)
-    {
-      std::cout << "argv[" << i << "] " << argv[i] << " != "
-                << u8_arg << std::endl;
-      status++;
-    }
-  }
-
-  kwsys::Encoding::CommandLineArguments args3 =
-    kwsys::Encoding::CommandLineArguments::Main(2, argv);
-
-  return status;
-}
-
-//----------------------------------------------------------------------------
-int testEncoding(int, char*[])
-{
-  const char* loc = setlocale(LC_ALL, "");
-  if(loc)
-    {
-    std::cout << "Locale: " << loc << std::endl;
-    }
-  else
-    {
-    std::cout << "Locale: None" << std::endl;
-    }
-
-  int ret = 0;
-
-  ret |= testHelloWorldEncoding();
-  ret |= testRobustEncoding();
-  ret |= testCommandLineArguments();
-
-  return ret;
-}
diff --git a/src/kwsys/testFStream.cxx b/src/kwsys/testFStream.cxx
deleted file mode 100644
index 9abfd4c..0000000
--- a/src/kwsys/testFStream.cxx
+++ /dev/null
@@ -1,190 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#include "kwsysPrivate.h"
-
-#if defined(_MSC_VER)
-# pragma warning (disable:4786)
-#endif
-
-#include KWSYS_HEADER(FStream.hxx)
-#include KWSYS_HEADER(ios/iostream)
-#include <string.h>
-#ifdef __BORLANDC__
-# include <mem.h> /* memcmp */
-#endif
-
-// Work-around CMake dependency scanning limitation.  This must
-// duplicate the above list of headers.
-#if 0
-# include "FStream.hxx.in"
-# include "kwsys_ios_iostream.h.in"
-#endif
-
-
-//----------------------------------------------------------------------------
-static int testNoFile()
-{
-  kwsys::ifstream in_file("NoSuchFile.txt");
-  if(in_file)
-    {
-    return 1;
-    }
-
-  return 0;
-}
-
-static kwsys::FStream::BOM expected_bom[5] =
-{
-  kwsys::FStream::BOM_UTF8,
-  kwsys::FStream::BOM_UTF16LE,
-  kwsys::FStream::BOM_UTF16BE,
-  kwsys::FStream::BOM_UTF32LE,
-  kwsys::FStream::BOM_UTF32BE
-};
-
-static unsigned char expected_bom_data[5][5] =
-{
-    {3, 0xEF, 0xBB, 0xBF},
-    {2, 0xFF, 0xFE},
-    {2, 0xFE, 0xFF},
-    {4, 0xFF, 0xFE, 0x00, 0x00},
-    {4, 0x00, 0x00, 0xFE, 0xFF},
-};
-
-static unsigned char file_data[5][45] =
-{
-    {11, 'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd'},
-    {22, 0x48, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x6F, 0x00, 0x20, 0x00,
-    0x57, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x6C, 0x00, 0x64, 0x00},
-    {22, 0x00, 0x48, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x6F, 0x00, 0x20,
-    0x00, 0x57, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x6C, 0x00, 0x64},
-    {44, 0x48, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00,
-    0x6C, 0x00, 0x00, 0x00, 0x6F, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
-    0x57, 0x00, 0x00, 0x00, 0x6F, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00,
-    0x6C, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00},
-    {44, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6C,
-    0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x6F, 0x00, 0x00, 0x00, 0x20,
-    0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x6F, 0x00, 0x00, 0x00, 0x72,
-    0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x64},
-};
-
-//----------------------------------------------------------------------------
-static int testBOM()
-{
-  // test various encodings in binary mode
-  for(int i=0; i<5; i++)
-    {
-      {
-      kwsys::ofstream out("bom.txt", kwsys::ofstream::binary);
-      out.write(reinterpret_cast<const char*>(expected_bom_data[i]+1),
-                *expected_bom_data[i]);
-      out.write(reinterpret_cast<const char*>(file_data[i]+1),
-                file_data[i][0]);
-      }
-
-    kwsys::ifstream in("bom.txt", kwsys::ofstream::binary);
-    kwsys::FStream::BOM bom = kwsys::FStream::ReadBOM(in);
-    if(bom != expected_bom[i])
-      {
-      kwsys_ios::cout << "Unexpected BOM " << i << std::endl;
-      return 1;
-      }
-    char data[45];
-    in.read(data, file_data[i][0]);
-    if(!in.good())
-      {
-      kwsys_ios::cout << "Unable to read data " << i << std::endl;
-      return 1;
-      }
-
-    if(memcmp(data, file_data[i]+1, file_data[i][0]) != 0)
-      {
-      kwsys_ios::cout << "Incorrect read data " << i << std::endl;
-      return 1;
-      }
-
-    }
-
-  // test text file without bom
-  {
-    {
-    kwsys::ofstream out("bom.txt");
-    out << "Hello World";
-    }
-
-    kwsys::ifstream in("bom.txt");
-    kwsys::FStream::BOM bom = kwsys::FStream::ReadBOM(in);
-    if(bom != kwsys::FStream::BOM_None)
-      {
-      kwsys_ios::cout << "Unexpected BOM for none case" << std::endl;
-      return 1;
-      }
-    char data[45];
-    in.read(data, file_data[0][0]);
-    if(!in.good())
-      {
-      kwsys_ios::cout << "Unable to read data for none case" << std::endl;
-      return 1;
-      }
-
-    if(memcmp(data, file_data[0]+1, file_data[0][0]) != 0)
-      {
-      kwsys_ios::cout << "Incorrect read data for none case" << std::endl;
-      return 1;
-      }
-  }
-
-  // test text file with utf-8 bom
-  {
-    {
-    kwsys::ofstream out("bom.txt");
-    out.write(reinterpret_cast<const char*>(expected_bom_data[0]+1),
-              *expected_bom_data[0]);
-    out << "Hello World";
-    }
-
-    kwsys::ifstream in("bom.txt");
-    kwsys::FStream::BOM bom = kwsys::FStream::ReadBOM(in);
-    if(bom != kwsys::FStream::BOM_UTF8)
-      {
-      kwsys_ios::cout << "Unexpected BOM for utf-8 case" << std::endl;
-      return 1;
-      }
-    char data[45];
-    in.read(data, file_data[0][0]);
-    if(!in.good())
-      {
-      kwsys_ios::cout << "Unable to read data for utf-8 case" << std::endl;
-      return 1;
-      }
-
-    if(memcmp(data, file_data[0]+1, file_data[0][0]) != 0)
-      {
-      kwsys_ios::cout << "Incorrect read data for utf-8 case" << std::endl;
-      return 1;
-      }
-  }
-
-  return 0;
-}
-
-
-//----------------------------------------------------------------------------
-int testFStream(int, char*[])
-{
-  int ret = 0;
-
-  ret |= testNoFile();
-  ret |= testBOM();
-
-  return ret;
-}
diff --git a/src/kwsys/testFail.c b/src/kwsys/testFail.c
deleted file mode 100644
index 7e062c1..0000000
--- a/src/kwsys/testFail.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-int testFail(int argc, char* argv[])
-{
-  char* env = getenv("DASHBOARD_TEST_FROM_CTEST");
-  int oldCtest = 0;
-  if(env)
-    {
-    if(strcmp(env, "1") == 0)
-      {
-      oldCtest = 1;
-      }
-    printf("DASHBOARD_TEST_FROM_CTEST = %s\n", env);
-    }
-  printf("%s: This test intentionally fails\n", argv[0]);
-  if(oldCtest)
-    {
-    printf("The version of ctest is not able to handle intentionally failing tests, so pass.\n");
-    return 0;
-    }
-  return argc;
-}
diff --git a/src/kwsys/testHashSTL.cxx b/src/kwsys/testHashSTL.cxx
deleted file mode 100644
index b861a5b..0000000
--- a/src/kwsys/testHashSTL.cxx
+++ /dev/null
@@ -1,75 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#include "kwsysPrivate.h"
-#include KWSYS_HEADER(hash_map.hxx)
-#include KWSYS_HEADER(hash_set.hxx)
-#include KWSYS_HEADER(ios/iostream)
-
-// Work-around CMake dependency scanning limitation.  This must
-// duplicate the above list of headers.
-#if 0
-# include "hash_map.hxx.in"
-# include "hash_set.hxx.in"
-# include "hashtable.hxx.in"
-# include "kwsys_ios_iostream.h.in"
-#endif
-
-#if defined(_MSC_VER)
-# pragma warning (disable:4786)
-#endif
-
-#if defined(__sgi) && !defined(__GNUC__)
-# pragma set woff 1468 /* inline function cannot be explicitly instantiated */
-#endif
-
-template class kwsys::hash_map<const char*, int>;
-template class kwsys::hash_set<int>;
-
-bool test_hash_map()
-{
-  typedef kwsys::hash_map<const char*, int> mtype;
-  mtype m;
-  const char* keys[] = {"hello", "world"};
-  m[keys[0]] = 1;
-  m.insert(mtype::value_type(keys[1], 2));
-  int sum = 0;
-  for(mtype::iterator mi = m.begin(); mi != m.end(); ++mi)
-    {
-    kwsys_ios::cout << "Found entry [" << mi->first << "," << mi->second << "]"
-                    << kwsys_ios::endl;
-    sum += mi->second;
-    }
-  return sum == 3;
-}
-
-bool test_hash_set()
-{
-  typedef kwsys::hash_set<int> stype;
-  stype s;
-  s.insert(1);
-  s.insert(2);
-  int sum = 0;
-  for(stype::iterator si = s.begin(); si != s.end(); ++si)
-    {
-    kwsys_ios::cout << "Found entry [" << *si << "]" << kwsys_ios::endl;
-    sum += *si;
-    }
-  return sum == 3;
-}
-
-int testHashSTL(int, char*[])
-{
-  bool result = true;
-  result = test_hash_map() && result;
-  result = test_hash_set() && result;
-  return result? 0:1;
-}
diff --git a/src/kwsys/testIOS.cxx b/src/kwsys/testIOS.cxx
deleted file mode 100644
index f0c7f1a..0000000
--- a/src/kwsys/testIOS.cxx
+++ /dev/null
@@ -1,167 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#include "kwsysPrivate.h"
-#include KWSYS_HEADER(stl/vector)
-#include KWSYS_HEADER(ios/sstream)
-#include KWSYS_HEADER(ios/fstream)
-#include KWSYS_HEADER(ios/iostream)
-
-// Work-around CMake dependency scanning limitation.  This must
-// duplicate the above list of headers.
-#if 0
-# include "kwsys_stl_string.hxx.in"
-# include "kwsys_stl_vector.h.in"
-# include "kwsys_ios_sstream.h.in"
-# include "kwsys_ios_fstream.h.in"
-# include "kwsys_ios_iostream.h.in"
-#endif
-
-#include <string.h> /* strlen */
-
-int testIOS(int, char*[])
-{
-  kwsys_ios::ostringstream ostr;
-  const char hello[] = "hello";
-  ostr << hello;
-  if(ostr.str() != hello)
-    {
-    kwsys_ios::cerr << "failed to write hello to ostr" << kwsys_ios::endl;
-    return 1;
-    }
-  const char world[] = "world";
-  kwsys_ios::ostringstream ostr2;
-  ostr2.write( hello, strlen(hello) ); /* I could do sizeof */
-  ostr2.put( '\0' );
-  ostr2.write( world, strlen(world) );
-  if(ostr2.str().size() !=  strlen(hello) + 1 + strlen(world) )
-    {
-    kwsys_ios::cerr << "failed to write hello to ostr2" << kwsys_ios::endl;
-    return 1;
-    }
-  static const unsigned char array[] = { 0xff,0x4f,0xff,0x51,0x00,0x29,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x00,0x3e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x07,0x01,0x01,0xff,0x52,0x00,0x0c,0x00,0x00,0x00,0x01,0x00,0x05,0x04,0x04,0x00,0x01,0xff,0x5c,0x00,0x13,0x40,0x40,0x48,0x48,0x50,0x48,0x48,0x50,0x48,0x48,0x50,0x48,0x48,0x50,0x48,0x48,0x50,0xff,0x64,0x00,0x2c,0x00,0x00,0x43,0x72,0x65,0x61,0 [...]
-  const size_t narray = sizeof(array); // 180
-  kwsys_ios::stringstream strstr;
-  strstr.write( (char*)array, narray );
-  //strstr.seekp( narray / 2 ); // set position of put pointer in mid string
-  if(strstr.str().size() != narray )
-    {
-    kwsys_ios::cerr << "failed to write array to strstr" << kwsys_ios::endl;
-    return 1;
-    }
-
-  kwsys_ios::istringstream istr(" 10 20 str ");
-  kwsys_stl::string s;
-  int x;
-  if(istr >> x)
-    {
-    if(x != 10)
-      {
-      kwsys_ios::cerr << "x != 10" << kwsys_ios::endl;
-      return 1;
-      }
-    }
-  else
-    {
-    kwsys_ios::cerr << "Failed to read 10 from istr" << kwsys_ios::endl;
-    return 1;
-    }
-  if(istr >> x)
-    {
-    if(x != 20)
-      {
-      kwsys_ios::cerr << "x != 20" << kwsys_ios::endl;
-      return 1;
-      }
-    }
-  else
-    {
-    kwsys_ios::cerr << "Failed to read 20 from istr" << kwsys_ios::endl;
-    return 1;
-    }
-  if(istr >> s)
-    {
-    if(s != "str")
-      {
-      kwsys_ios::cerr << "s != \"str\"" << kwsys_ios::endl;
-      return 1;
-      }
-    }
-  else
-    {
-    kwsys_ios::cerr << "Failed to read str from istr" << kwsys_ios::endl;
-    return 1;
-    }
-  if(istr >> s)
-    {
-    kwsys_ios::cerr << "Able to read past end of stream" << kwsys_ios::endl;
-    return 1;
-    }
-  else
-    {
-    // Clear the failure.
-    istr.clear(istr.rdstate() & ~kwsys_ios::ios::eofbit);
-    istr.clear(istr.rdstate() & ~kwsys_ios::ios::failbit);
-    }
-  istr.str("30");
-  if(istr >> x)
-    {
-    if(x != 30)
-      {
-      kwsys_ios::cerr << "x != 30" << kwsys_ios::endl;
-      return 1;
-      }
-    }
-  else
-    {
-    kwsys_ios::cerr << "Failed to read 30 from istr" << kwsys_ios::endl;
-    return 1;
-    }
-
-  kwsys_ios::stringstream sstr;
-  sstr << "40 str2";
-  if(sstr >> x)
-    {
-    if(x != 40)
-      {
-      kwsys_ios::cerr << "x != 40" << kwsys_ios::endl;
-      return 1;
-      }
-    }
-  else
-    {
-    kwsys_ios::cerr << "Failed to read 40 from sstr" << kwsys_ios::endl;
-    return 1;
-    }
-  if(sstr >> s)
-    {
-    if(s != "str2")
-      {
-      kwsys_ios::cerr << "s != \"str2\"" << kwsys_ios::endl;
-      return 1;
-      }
-    }
-  else
-    {
-    kwsys_ios::cerr << "Failed to read str2 from sstr" << kwsys_ios::endl;
-    return 1;
-    }
-
-  // Just try to compile this.
-  if(x == 12345)
-    {
-    kwsys_ios::ifstream fin("/does_not_exist",
-                            kwsys_ios::ios::in | kwsys_ios_binary);
-    }
-
-  kwsys_ios::cout << "IOS tests passed" << kwsys_ios::endl;
-  return 0;
-}
diff --git a/src/kwsys/testProcess.c b/src/kwsys/testProcess.c
deleted file mode 100644
index 47c3fb0..0000000
--- a/src/kwsys/testProcess.c
+++ /dev/null
@@ -1,548 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#include "kwsysPrivate.h"
-#include KWSYS_HEADER(Process.h)
-#include KWSYS_HEADER(Encoding.h)
-
-/* Work-around CMake dependency scanning limitation.  This must
-   duplicate the above list of headers.  */
-#if 0
-# include "Process.h.in"
-# include "Encoding.h.in"
-#endif
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#if defined(_WIN32)
-# include <windows.h>
-#else
-# include <unistd.h>
-#endif
-
-#if defined(__BORLANDC__)
-# pragma warn -8060 /* possibly incorrect assignment */
-#endif
-
-#if defined(__BEOS__) && !defined(__ZETA__)
-/* BeOS 5 doesn't have usleep(), but it has snooze(), which is identical. */
-# include <be/kernel/OS.h>
-static inline void testProcess_usleep(unsigned int msec)
-{
-  snooze(msec);
-}
-#else
-# define testProcess_usleep usleep
-#endif
-
-int runChild(const char* cmd[], int state, int exception, int value,
-             int share, int output, int delay, double timeout, int poll,
-             int repeat, int disown);
-
-static int test1(int argc, const char* argv[])
-{
-  (void)argc; (void)argv;
-  fprintf(stdout, "Output on stdout from test returning 0.\n");
-  fprintf(stderr, "Output on stderr from test returning 0.\n");
-  return 0;
-}
-
-static int test2(int argc, const char* argv[])
-{
-  (void)argc; (void)argv;
-  fprintf(stdout, "Output on stdout from test returning 123.\n");
-  fprintf(stderr, "Output on stderr from test returning 123.\n");
-  return 123;
-}
-
-static int test3(int argc, const char* argv[])
-{
-  (void)argc; (void)argv;
-  fprintf(stdout, "Output before sleep on stdout from timeout test.\n");
-  fprintf(stderr, "Output before sleep on stderr from timeout test.\n");
-  fflush(stdout);
-  fflush(stderr);
-#if defined(_WIN32)
-  Sleep(15000);
-#else
-  sleep(15);
-#endif
-  fprintf(stdout, "Output after sleep on stdout from timeout test.\n");
-  fprintf(stderr, "Output after sleep on stderr from timeout test.\n");
-  return 0;
-}
-
-static int test4(int argc, const char* argv[])
-{
-  /* Prepare a pointer to an invalid address.  Don't use null, because
-  dereferencing null is undefined behaviour and compilers are free to
-  do whatever they want. ex: Clang will warn at compile time, or even
-  optimize away the write. We hope to 'outsmart' them by using
-  'volatile' and a slightly larger address, based on a runtime value. */
-  volatile int* invalidAddress = 0;
-  invalidAddress += argc?1:2;
-
-#if defined(_WIN32)
-  /* Avoid error diagnostic popups since we are crashing on purpose.  */
-  SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
-#elif defined(__BEOS__) || defined(__HAIKU__)
-  /* Avoid error diagnostic popups since we are crashing on purpose.  */
-  disable_debugger(1);
-#endif
-  (void)argc; (void)argv;
-  fprintf(stdout, "Output before crash on stdout from crash test.\n");
-  fprintf(stderr, "Output before crash on stderr from crash test.\n");  
-  fflush(stdout);
-  fflush(stderr);
-  assert(invalidAddress); /* Quiet Clang scan-build. */
-  /* Provoke deliberate crash by writing to the invalid address. */
-  *invalidAddress = 0;
-  fprintf(stdout, "Output after crash on stdout from crash test.\n");
-  fprintf(stderr, "Output after crash on stderr from crash test.\n");
-  return 0;
-}
-
-static int test5(int argc, const char* argv[])
-{
-  int r;
-  const char* cmd[4];
-  (void)argc;
-  cmd[0] = argv[0];
-  cmd[1] = "run";
-  cmd[2] = "4";
-  cmd[3] = 0;
-  fprintf(stdout, "Output on stdout before recursive test.\n");
-  fprintf(stderr, "Output on stderr before recursive test.\n");
-  fflush(stdout);
-  fflush(stderr);
-  r = runChild(cmd, kwsysProcess_State_Exception,
-               kwsysProcess_Exception_Fault, 1, 1, 1, 0, 15, 0, 1, 0);
-  fprintf(stdout, "Output on stdout after recursive test.\n");
-  fprintf(stderr, "Output on stderr after recursive test.\n");
-  fflush(stdout);
-  fflush(stderr);
-  return r;
-}
-
-#define TEST6_SIZE (4096*2)
-static void test6(int argc, const char* argv[])
-{
-  int i;
-  char runaway[TEST6_SIZE+1];
-  (void)argc; (void)argv;
-  for(i=0;i < TEST6_SIZE;++i)
-    {
-    runaway[i] = '.';
-    }
-  runaway[TEST6_SIZE] = '\n';
-
-  /* Generate huge amounts of output to test killing.  */
-  for(;;)
-    {
-    fwrite(runaway, 1, TEST6_SIZE+1, stdout);
-    fflush(stdout);
-    }
-}
-
-/* Define MINPOLL to be one more than the number of times output is
-   written.  Define MAXPOLL to be the largest number of times a loop
-   delaying 1/10th of a second should ever have to poll.  */
-#define MINPOLL 5
-#define MAXPOLL 20
-static int test7(int argc, const char* argv[])
-{
-  (void)argc; (void)argv;
-  fprintf(stdout, "Output on stdout before sleep.\n");
-  fprintf(stderr, "Output on stderr before sleep.\n");
-  fflush(stdout);
-  fflush(stderr);
-  /* Sleep for 1 second.  */
-#if defined(_WIN32)
-  Sleep(1000);
-#else
-  sleep(1);
-#endif
-  fprintf(stdout, "Output on stdout after sleep.\n");
-  fprintf(stderr, "Output on stderr after sleep.\n");
-  fflush(stdout);
-  fflush(stderr);
-  return 0;
-}
-
-static int test8(int argc, const char* argv[])
-{
-  /* Create a disowned grandchild to test handling of processes
-     that exit before their children.  */
-  int r;
-  const char* cmd[4];
-  (void)argc;
-  cmd[0] = argv[0];
-  cmd[1] = "run";
-  cmd[2] = "108";
-  cmd[3] = 0;
-  fprintf(stdout, "Output on stdout before grandchild test.\n");
-  fprintf(stderr, "Output on stderr before grandchild test.\n");
-  fflush(stdout);
-  fflush(stderr);
-  r = runChild(cmd, kwsysProcess_State_Disowned, kwsysProcess_Exception_None,
-               1, 1, 1, 0, 10, 0, 1, 1);
-  fprintf(stdout, "Output on stdout after grandchild test.\n");
-  fprintf(stderr, "Output on stderr after grandchild test.\n");
-  fflush(stdout);
-  fflush(stderr);
-  return r;
-}
-
-static int test8_grandchild(int argc, const char* argv[])
-{
-  (void)argc; (void)argv;
-  fprintf(stdout, "Output on stdout from grandchild before sleep.\n");
-  fprintf(stderr, "Output on stderr from grandchild before sleep.\n");
-  fflush(stdout);
-  fflush(stderr);
-  /* TODO: Instead of closing pipes here leave them open to make sure
-     the grandparent can stop listening when the parent exits.  This
-     part of the test cannot be enabled until the feature is
-     implemented.  */
-  fclose(stdout);
-  fclose(stderr);
-#if defined(_WIN32)
-  Sleep(15000);
-#else
-  sleep(15);
-#endif
-  return 0;
-}
-
-static int runChild2(kwsysProcess* kp,
-              const char* cmd[], int state, int exception, int value,
-              int share, int output, int delay, double timeout,
-              int poll, int disown)
-{
-  int result = 0;
-  char* data = 0;
-  int length = 0;
-  double userTimeout = 0;
-  double* pUserTimeout = 0;
-  kwsysProcess_SetCommand(kp, cmd);
-  if(timeout >= 0)
-    {
-    kwsysProcess_SetTimeout(kp, timeout);
-    }
-  if(share)
-    {
-    kwsysProcess_SetPipeShared(kp, kwsysProcess_Pipe_STDOUT, 1);
-    kwsysProcess_SetPipeShared(kp, kwsysProcess_Pipe_STDERR, 1);
-    }
-  if(disown)
-    {
-    kwsysProcess_SetOption(kp, kwsysProcess_Option_Detach, 1);
-    }
-  kwsysProcess_Execute(kp);
-
-  if(poll)
-    {
-    pUserTimeout = &userTimeout;
-    }
-
-  if(!share && !disown)
-    {
-    int p;
-    while((p = kwsysProcess_WaitForData(kp, &data, &length, pUserTimeout)))
-      {
-      if(output)
-        {
-        if(poll && p == kwsysProcess_Pipe_Timeout)
-          {
-          fprintf(stdout, "WaitForData timeout reached.\n");
-          fflush(stdout);
-
-          /* Count the number of times we polled without getting data.
-             If it is excessive then kill the child and fail.  */
-          if(++poll >= MAXPOLL)
-            {
-            fprintf(stdout, "Poll count reached limit %d.\n",
-                    MAXPOLL);
-            kwsysProcess_Kill(kp);
-            }
-          }
-        else
-          {
-          fwrite(data, 1, (size_t) length, stdout);
-          fflush(stdout);
-          }
-        }
-      if(poll)
-        {
-        /* Delay to avoid busy loop during polling.  */
-#if defined(_WIN32)
-        Sleep(100);
-#else
-        testProcess_usleep(100000);
-#endif
-        }
-      if(delay)
-        {
-        /* Purposely sleeping only on Win32 to let pipe fill up.  */
-#if defined(_WIN32)
-        Sleep(100);
-#endif
-        }
-      }
-    }
-
-  if(disown)
-    {
-    kwsysProcess_Disown(kp);
-    }
-  else
-    {
-    kwsysProcess_WaitForExit(kp, 0);
-    }
-
-  switch (kwsysProcess_GetState(kp))
-    {
-    case kwsysProcess_State_Starting:
-      printf("No process has been executed.\n"); break;
-    case kwsysProcess_State_Executing:
-      printf("The process is still executing.\n"); break;
-    case kwsysProcess_State_Expired:
-      printf("Child was killed when timeout expired.\n"); break;
-    case kwsysProcess_State_Exited:
-      printf("Child exited with value = %d\n",
-             kwsysProcess_GetExitValue(kp));
-      result = ((exception != kwsysProcess_GetExitException(kp)) ||
-                (value != kwsysProcess_GetExitValue(kp))); break;
-    case kwsysProcess_State_Killed:
-      printf("Child was killed by parent.\n"); break;
-    case kwsysProcess_State_Exception:
-      printf("Child terminated abnormally: %s\n",
-             kwsysProcess_GetExceptionString(kp));
-      result = ((exception != kwsysProcess_GetExitException(kp)) ||
-                (value != kwsysProcess_GetExitValue(kp))); break;
-    case kwsysProcess_State_Disowned:
-      printf("Child was disowned.\n"); break;
-    case kwsysProcess_State_Error:
-      printf("Error in administrating child process: [%s]\n",
-             kwsysProcess_GetErrorString(kp)); break;
-    };
-  
-  if(result)
-    {
-    if(exception != kwsysProcess_GetExitException(kp))
-      {
-      fprintf(stderr, "Mismatch in exit exception.  "
-              "Should have been %d, was %d.\n",
-              exception, kwsysProcess_GetExitException(kp));
-      }
-    if(value != kwsysProcess_GetExitValue(kp))
-      {
-      fprintf(stderr, "Mismatch in exit value.  "
-              "Should have been %d, was %d.\n",
-              value, kwsysProcess_GetExitValue(kp));
-      }
-    }
-  
-  if(kwsysProcess_GetState(kp) != state)
-    {
-    fprintf(stderr, "Mismatch in state.  "
-            "Should have been %d, was %d.\n",
-            state, kwsysProcess_GetState(kp));
-    result = 1;
-    }
-
-  /* We should have polled more times than there were data if polling
-     was enabled.  */
-  if(poll && poll < MINPOLL)
-    {
-    fprintf(stderr, "Poll count is %d, which is less than %d.\n",
-            poll, MINPOLL);
-    result = 1;
-    }
-
-  return result;
-}
-
-int runChild(const char* cmd[], int state, int exception, int value,
-             int share, int output, int delay, double timeout,
-             int poll, int repeat, int disown)
-{
-  int result = 1;
-  kwsysProcess* kp = kwsysProcess_New();
-  if(!kp)
-    {
-    fprintf(stderr, "kwsysProcess_New returned NULL!\n");
-    return 1;
-    }
-  while(repeat-- > 0)
-    {
-    result = runChild2(kp, cmd, state, exception, value, share,
-                       output, delay, timeout, poll, disown);
-    }
-  kwsysProcess_Delete(kp);
-  return result;
-}
-
-int main(int argc, const char* argv[])
-{
-  int n = 0;
-
-#ifdef _WIN32
-  int i;
-  char new_args[10][_MAX_PATH];
-  LPWSTR* w_av = CommandLineToArgvW(GetCommandLineW(), &argc);
-  for(i=0; i<argc; i++)
-  {
-    kwsysEncoding_wcstombs(new_args[i], w_av[i], _MAX_PATH);
-    argv[i] = new_args[i];
-  }
-  LocalFree(w_av);
-#endif
-
-#if 0
-    {
-    HANDLE out = GetStdHandle(STD_OUTPUT_HANDLE);
-    DuplicateHandle(GetCurrentProcess(), out,
-                    GetCurrentProcess(), &out, 0, FALSE,
-                    DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
-    SetStdHandle(STD_OUTPUT_HANDLE, out);
-    }
-    {
-    HANDLE out = GetStdHandle(STD_ERROR_HANDLE);
-    DuplicateHandle(GetCurrentProcess(), out,
-                    GetCurrentProcess(), &out, 0, FALSE,
-                    DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
-    SetStdHandle(STD_ERROR_HANDLE, out);
-    }
-#endif
-  if(argc == 2)
-    {
-    n = atoi(argv[1]);
-    }
-  else if(argc == 3 && strcmp(argv[1], "run") == 0)
-    {
-    n = atoi(argv[2]);
-    }
-  /* Check arguments.  */
-  if(((n >= 1 && n <= 8) || n == 108) && argc == 3)
-    {
-    /* This is the child process for a requested test number.  */
-    switch (n)
-      {
-      case 1: return test1(argc, argv);
-      case 2: return test2(argc, argv);
-      case 3: return test3(argc, argv);
-      case 4: return test4(argc, argv);
-      case 5: return test5(argc, argv);
-      case 6: test6(argc, argv); return 0;
-      case 7: return test7(argc, argv);
-      case 8: return test8(argc, argv);
-      case 108: return test8_grandchild(argc, argv);
-      }
-    fprintf(stderr, "Invalid test number %d.\n", n);
-    return 1;
-    }
-  else if(n >= 1 && n <= 8)
-    {
-    /* This is the parent process for a requested test number.  */
-    int states[8] =
-    {
-      kwsysProcess_State_Exited,
-      kwsysProcess_State_Exited,
-      kwsysProcess_State_Expired,
-      kwsysProcess_State_Exception,
-      kwsysProcess_State_Exited,
-      kwsysProcess_State_Expired,
-      kwsysProcess_State_Exited,
-      kwsysProcess_State_Exited
-    };
-    int exceptions[8] =
-    {
-      kwsysProcess_Exception_None,
-      kwsysProcess_Exception_None,
-      kwsysProcess_Exception_None,
-      kwsysProcess_Exception_Fault,
-      kwsysProcess_Exception_None,
-      kwsysProcess_Exception_None,
-      kwsysProcess_Exception_None,
-      kwsysProcess_Exception_None
-    };
-    int values[8] = {0, 123, 1, 1, 0, 0, 0, 0};
-    int outputs[8] = {1, 1, 1, 1, 1, 0, 1, 1};
-    int delays[8] = {0, 0, 0, 0, 0, 1, 0, 0};
-    double timeouts[8] = {10, 10, 10, 30, 30, 10, -1, 10};
-    int polls[8] = {0, 0, 0, 0, 0, 0, 1, 0};
-    int repeat[8] = {2, 1, 1, 1, 1, 1, 1, 1};
-    int r;
-    const char* cmd[4];
-#ifdef _WIN32
-    char* argv0 = 0;
-    if(n == 0 && (argv0 = strdup(argv[0])))
-      {
-      /* Try converting to forward slashes to see if it works.  */
-      char* c;
-      for(c=argv0; *c; ++c)
-        {
-        if(*c == '\\')
-          {
-          *c = '/';
-          }
-        }
-      cmd[0] = argv0;
-      }
-    else
-      {
-      cmd[0] = argv[0];
-      }
-#else
-    cmd[0] = argv[0];
-#endif
-    cmd[1] = "run";
-    cmd[2] = argv[1];
-    cmd[3] = 0;
-    fprintf(stdout, "Output on stdout before test %d.\n", n);
-    fprintf(stderr, "Output on stderr before test %d.\n", n);
-    fflush(stdout);
-    fflush(stderr);
-    r = runChild(cmd, states[n-1], exceptions[n-1], values[n-1], 0,
-                 outputs[n-1], delays[n-1], timeouts[n-1],
-                 polls[n-1], repeat[n-1], 0);
-    fprintf(stdout, "Output on stdout after test %d.\n", n);
-    fprintf(stderr, "Output on stderr after test %d.\n", n);
-    fflush(stdout);
-    fflush(stderr);
-#if defined(_WIN32)
-    if(argv0) { free(argv0); }
-#endif
-    return r;
-    }
-  else if(argc > 2 && strcmp(argv[1], "0") == 0)
-    {
-    /* This is the special debugging test to run a given command
-       line.  */
-    const char** cmd = argv+2;
-    int state = kwsysProcess_State_Exited;
-    int exception = kwsysProcess_Exception_None;
-    int value = 0;
-    double timeout = 0;
-    int r = runChild(cmd, state, exception, value, 0, 1, 0, timeout, 0, 1, 0);
-    return r;
-    }
-  else
-    {
-    /* Improper usage.  */
-    fprintf(stdout, "Usage: %s <test number>\n", argv[0]);
-    return 1;
-    }
-}
diff --git a/src/kwsys/testSharedForward.c.in b/src/kwsys/testSharedForward.c.in
deleted file mode 100644
index ee753ef..0000000
--- a/src/kwsys/testSharedForward.c.in
+++ /dev/null
@@ -1,36 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#if defined(CMAKE_INTDIR)
-# define CONFIG_DIR_PRE CMAKE_INTDIR "/"
-# define CONFIG_DIR_POST "/" CMAKE_INTDIR
-#else
-# define CONFIG_DIR_PRE ""
-# define CONFIG_DIR_POST ""
-#endif
-#define @KWSYS_NAMESPACE at _SHARED_FORWARD_DIR_BUILD "@EXEC_DIR@"
-#define @KWSYS_NAMESPACE at _SHARED_FORWARD_PATH_BUILD "." CONFIG_DIR_POST
-#define @KWSYS_NAMESPACE at _SHARED_FORWARD_PATH_INSTALL 0
-#define @KWSYS_NAMESPACE at _SHARED_FORWARD_EXE_BUILD \
-  CONFIG_DIR_PRE "@KWSYS_NAMESPACE at TestProcess"
-#define @KWSYS_NAMESPACE at _SHARED_FORWARD_EXE_INSTALL \
-  "@KWSYS_NAMESPACE at TestProcess"
-#define @KWSYS_NAMESPACE at _SHARED_FORWARD_OPTION_COMMAND "--command"
-#define @KWSYS_NAMESPACE at _SHARED_FORWARD_OPTION_PRINT "--print"
-#define @KWSYS_NAMESPACE at _SHARED_FORWARD_OPTION_LDD "--ldd"
-#if defined(CMAKE_INTDIR)
-# define @KWSYS_NAMESPACE at _SHARED_FORWARD_CONFIG_NAME CMAKE_INTDIR
-#endif
-#include <@KWSYS_NAMESPACE@/SharedForward.h>
-int main(int argc, char** argv)
-{
-  return @KWSYS_NAMESPACE at _shared_forward_to_real(argc, argv);
-}
diff --git a/src/kwsys/testSystemInformation.cxx b/src/kwsys/testSystemInformation.cxx
deleted file mode 100644
index 53d51ac..0000000
--- a/src/kwsys/testSystemInformation.cxx
+++ /dev/null
@@ -1,118 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#include "kwsysPrivate.h"
-#include KWSYS_HEADER(SystemInformation.hxx)
-#include KWSYS_HEADER(ios/iostream)
-
-// Work-around CMake dependency scanning limitation.  This must
-// duplicate the above list of headers.
-#if 0
-# include "SystemInformation.hxx.in"
-# include "kwsys_ios_iostream.h.in"
-#endif
-
-#if defined(KWSYS_USE_LONG_LONG)
-# if defined(KWSYS_IOS_HAS_OSTREAM_LONG_LONG)
-#  define iostreamLongLong(x) (x)
-# else
-#  define iostreamLongLong(x) ((long)x)
-# endif
-#elif defined(KWSYS_USE___INT64)
-# if defined(KWSYS_IOS_HAS_OSTREAM___INT64)
-#  define iostreamLongLong(x) (x)
-# else
-#  define iostreamLongLong(x) ((long)x)
-# endif
-#else
-# error "No Long Long"
-#endif
-
-#define printMethod(info, m) kwsys_ios::cout << #m << ": " \
-<< info.m() << "\n"
-
-#define printMethod2(info, m, unit) kwsys_ios::cout << #m << ": " \
-<< info.m() << " " << unit << "\n"
-
-#define printMethod3(info, m, unit) kwsys_ios::cout << #m << ": " \
-<< iostreamLongLong(info.m) << " " << unit << "\n"
-
-int testSystemInformation(int, char*[])
-{
-  kwsys_ios::cout << "CTEST_FULL_OUTPUT\n"; // avoid truncation
-
-  kwsys::SystemInformation info;
-  info.RunCPUCheck();
-  info.RunOSCheck();
-  info.RunMemoryCheck();
-  printMethod(info, GetOSName);
-  printMethod(info, GetOSIsLinux);
-  printMethod(info, GetOSIsApple);
-  printMethod(info, GetOSIsWindows);
-  printMethod(info, GetHostname);
-  printMethod(info, GetFullyQualifiedDomainName);
-  printMethod(info, GetOSRelease);
-  printMethod(info, GetOSVersion);
-  printMethod(info, GetOSPlatform);
-  printMethod(info, GetVendorString);
-  printMethod(info, GetVendorID);
-  printMethod(info, GetTypeID);
-  printMethod(info, GetFamilyID);
-  printMethod(info, GetModelID);
-  printMethod(info, GetExtendedProcessorName);
-  printMethod(info, GetSteppingCode);
-  printMethod(info, GetProcessorSerialNumber);
-  printMethod2(info, GetProcessorCacheSize, "KB");
-  printMethod(info, GetLogicalProcessorsPerPhysical);
-  printMethod2(info, GetProcessorClockFrequency, "MHz");
-  printMethod(info, Is64Bits);
-  printMethod(info, GetNumberOfLogicalCPU);
-  printMethod(info, GetNumberOfPhysicalCPU);
-  printMethod(info, DoesCPUSupportCPUID);
-  printMethod(info, GetProcessorAPICID);
-  printMethod2(info, GetTotalVirtualMemory, "MB");
-  printMethod2(info, GetAvailableVirtualMemory, "MB");
-  printMethod2(info, GetTotalPhysicalMemory, "MB");
-  printMethod2(info, GetAvailablePhysicalMemory, "MB");
-  printMethod3(info, GetHostMemoryTotal(), "KiB");
-  printMethod3(info, GetHostMemoryAvailable("KWSHL"), "KiB");
-  printMethod3(info, GetProcMemoryAvailable("KWSHL","KWSPL"), "KiB");
-  printMethod3(info, GetHostMemoryUsed(), "KiB");
-  printMethod3(info, GetProcMemoryUsed(), "KiB");
-
-  for (long int i = 0; i <= 31; i++)
-    {
-    if (info.DoesCPUSupportFeature(static_cast<long int>(1) << i))
-      {
-      kwsys_ios::cout << "CPU feature " << i << "\n";
-      }
-    }
-
-  /* test stack trace
-  */
-  kwsys_ios::cout
-    << "Program Stack:" << kwsys_ios::endl
-    << kwsys::SystemInformation::GetProgramStack(0,0) << kwsys_ios::endl
-    << kwsys_ios::endl;
-
-  /* test segv handler
-  info.SetStackTraceOnError(1);
-  double *d = (double*)100;
-  *d=0;
-  */
-
-  /* test abort handler
-  info.SetStackTraceOnError(1);
-  abort();
-  */
-
-  return 0;
-}
diff --git a/src/kwsys/testSystemTools.bin b/src/kwsys/testSystemTools.bin
deleted file mode 100644
index 961a404..0000000
Binary files a/src/kwsys/testSystemTools.bin and /dev/null differ
diff --git a/src/kwsys/testSystemTools.cxx b/src/kwsys/testSystemTools.cxx
deleted file mode 100644
index 42b6249..0000000
--- a/src/kwsys/testSystemTools.cxx
+++ /dev/null
@@ -1,650 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#include "kwsysPrivate.h"
-
-#if defined(_MSC_VER)
-# pragma warning (disable:4786)
-#endif
-
-#include KWSYS_HEADER(SystemTools.hxx)
-#include KWSYS_HEADER(ios/iostream)
-
-// Work-around CMake dependency scanning limitation.  This must
-// duplicate the above list of headers.
-#if 0
-# include "SystemTools.hxx.in"
-# include "kwsys_ios_iostream.h.in"
-#endif
-
-// Include with <> instead of "" to avoid getting any in-source copy
-// left on disk.
-#include <testSystemTools.h>
-
-#include <string.h> /* strcmp */
-
-//----------------------------------------------------------------------------
-static const char* toUnixPaths[][2] =
-{
-    { "/usr/local/bin/passwd", "/usr/local/bin/passwd" },
-    { "/usr/lo cal/bin/pa sswd", "/usr/lo cal/bin/pa sswd" },
-    { "/usr/lo\\ cal/bin/pa\\ sswd", "/usr/lo\\ cal/bin/pa\\ sswd" },
-    { "c:/usr/local/bin/passwd", "c:/usr/local/bin/passwd" },
-    { "c:/usr/lo cal/bin/pa sswd", "c:/usr/lo cal/bin/pa sswd" },
-    { "c:/usr/lo\\ cal/bin/pa\\ sswd", "c:/usr/lo\\ cal/bin/pa\\ sswd" },
-    { "\\usr\\local\\bin\\passwd", "/usr/local/bin/passwd" },
-    { "\\usr\\lo cal\\bin\\pa sswd", "/usr/lo cal/bin/pa sswd" },
-    { "\\usr\\lo\\ cal\\bin\\pa\\ sswd", "/usr/lo\\ cal/bin/pa\\ sswd" },
-    { "c:\\usr\\local\\bin\\passwd", "c:/usr/local/bin/passwd" },
-    { "c:\\usr\\lo cal\\bin\\pa sswd", "c:/usr/lo cal/bin/pa sswd" },
-    { "c:\\usr\\lo\\ cal\\bin\\pa\\ sswd", "c:/usr/lo\\ cal/bin/pa\\ sswd" },
-    { "\\\\usr\\local\\bin\\passwd", "//usr/local/bin/passwd" },
-    { "\\\\usr\\lo cal\\bin\\pa sswd", "//usr/lo cal/bin/pa sswd" },
-    { "\\\\usr\\lo\\ cal\\bin\\pa\\ sswd", "//usr/lo\\ cal/bin/pa\\ sswd" },
-    {0, 0}
-};
-
-static bool CheckConvertToUnixSlashes(kwsys_stl::string input,
-                                      kwsys_stl::string output)
-{
-  kwsys_stl::string result = input;
-  kwsys::SystemTools::ConvertToUnixSlashes(result);
-  if ( result != output )
-    {
-    kwsys_ios::cerr
-      << "Problem with ConvertToUnixSlashes - input: " << input
-      << " output: " << result << " expected: " << output
-      << kwsys_ios::endl;
-    return false;
-    }
-  return true;
-}
-
-//----------------------------------------------------------------------------
-static const char* checkEscapeChars[][4] =
-{
-  { "1 foo 2 bar 2", "12", "\\", "\\1 foo \\2 bar \\2"},
-  { " {} ", "{}", "#", " #{#} "},
-  {0, 0, 0, 0}
-};
-
-static bool CheckEscapeChars(kwsys_stl::string input,
-                             const char *chars_to_escape,
-                             char escape_char,
-                             kwsys_stl::string output)
-{
-  kwsys_stl::string result = kwsys::SystemTools::EscapeChars(
-    input.c_str(), chars_to_escape, escape_char);
-  if (result != output)
-    {
-    kwsys_ios::cerr
-      << "Problem with CheckEscapeChars - input: " << input
-      << " output: " << result << " expected: " << output
-      << kwsys_ios::endl;
-    return false;
-    }
-  return true;
-}
-
-//----------------------------------------------------------------------------
-static bool CheckFileOperations()
-{
-  bool res = true;
-  const kwsys_stl::string testBinFile(TEST_SYSTEMTOOLS_SOURCE_DIR
-    "/testSystemTools.bin");
-  const kwsys_stl::string testTxtFile(TEST_SYSTEMTOOLS_SOURCE_DIR
-    "/testSystemTools.cxx");
-  const kwsys_stl::string testNewDir(TEST_SYSTEMTOOLS_BINARY_DIR
-    "/testSystemToolsNewDir");
-  const kwsys_stl::string testNewFile(testNewDir + "/testNewFile.txt");
-
-  if (kwsys::SystemTools::DetectFileType(testBinFile.c_str()) !=
-      kwsys::SystemTools::FileTypeBinary)
-    {
-    kwsys_ios::cerr
-      << "Problem with DetectFileType - failed to detect type of: "
-      << testBinFile << kwsys_ios::endl;
-    res = false;
-    }
-
-  if (kwsys::SystemTools::DetectFileType(testTxtFile.c_str()) !=
-      kwsys::SystemTools::FileTypeText)
-    {
-    kwsys_ios::cerr
-      << "Problem with DetectFileType - failed to detect type of: "
-      << testTxtFile << kwsys_ios::endl;
-    res = false;
-    }
-
-  if (kwsys::SystemTools::FileLength(testBinFile) != 766)
-    {
-    kwsys_ios::cerr
-      << "Problem with FileLength - incorrect length for: "
-      << testBinFile << kwsys_ios::endl;
-    res = false;
-    }
-
-  if (!kwsys::SystemTools::MakeDirectory(testNewDir))
-    {
-    kwsys_ios::cerr
-      << "Problem with MakeDirectory for: "
-      << testNewDir << kwsys_ios::endl;
-    res = false;
-    }
-
-  if (!kwsys::SystemTools::Touch(testNewFile.c_str(), true))
-    {
-    kwsys_ios::cerr
-      << "Problem with Touch for: "
-      << testNewFile << kwsys_ios::endl;
-    res = false;
-    }
-
-  if (!kwsys::SystemTools::RemoveFile(testNewFile))
-    {
-    kwsys_ios::cerr
-      << "Problem with RemoveFile: "
-      << testNewFile << kwsys_ios::endl;
-    res = false;
-    }
-
-  kwsys::SystemTools::Touch(testNewFile.c_str(), true);
-  if (!kwsys::SystemTools::RemoveADirectory(testNewDir))
-    {
-    kwsys_ios::cerr
-      << "Problem with RemoveADirectory for: "
-      << testNewDir << kwsys_ios::endl;
-    res = false;
-    }
-
-#ifdef KWSYS_TEST_SYSTEMTOOLS_LONG_PATHS
-  // Perform the same file and directory creation and deletion tests but
-  // with paths > 256 characters in length.
-
-  const kwsys_stl::string testNewLongDir(
-    TEST_SYSTEMTOOLS_BINARY_DIR "/"
-    "012345678901234567890123456789012345678901234567890123456789"
-    "012345678901234567890123456789012345678901234567890123456789"
-    "012345678901234567890123456789012345678901234567890123456789"
-    "012345678901234567890123456789012345678901234567890123456789"
-    "01234567890123");
-  const kwsys_stl::string testNewLongFile(testNewLongDir + "/"
-    "012345678901234567890123456789012345678901234567890123456789"
-    "012345678901234567890123456789012345678901234567890123456789"
-    "012345678901234567890123456789012345678901234567890123456789"
-    "012345678901234567890123456789012345678901234567890123456789"
-    "0123456789.txt");
-
-  if (!kwsys::SystemTools::MakeDirectory(testNewLongDir))
-    {
-    kwsys_ios::cerr
-      << "Problem with MakeDirectory for: "
-      << testNewLongDir << kwsys_ios::endl;
-    res = false;
-    }
-
-  if (!kwsys::SystemTools::Touch(testNewLongFile.c_str(), true))
-    {
-    kwsys_ios::cerr
-      << "Problem with Touch for: "
-      << testNewLongFile << kwsys_ios::endl;
-    res = false;
-    }
-
-  if (!kwsys::SystemTools::RemoveFile(testNewLongFile))
-    {
-    kwsys_ios::cerr
-      << "Problem with RemoveFile: "
-      << testNewLongFile << kwsys_ios::endl;
-    res = false;
-    }
-
-  kwsys::SystemTools::Touch(testNewLongFile.c_str(), true);
-  if (!kwsys::SystemTools::RemoveADirectory(testNewLongDir))
-    {
-    kwsys_ios::cerr
-      << "Problem with RemoveADirectory for: "
-      << testNewLongDir << kwsys_ios::endl;
-    res = false;
-    }
-#endif
-
-  return res;
-}
-
-//----------------------------------------------------------------------------
-static bool CheckStringOperations()
-{
-  bool res = true;
-
-  kwsys_stl::string test = "mary had a little lamb.";
-  if (kwsys::SystemTools::CapitalizedWords(test) != "Mary Had A Little Lamb.")
-    {
-    kwsys_ios::cerr
-      << "Problem with CapitalizedWords "
-      << '"' << test << '"' << kwsys_ios::endl;
-    res = false;    
-    }
-
-  test = "Mary Had A Little Lamb.";
-  if (kwsys::SystemTools::UnCapitalizedWords(test) != 
-      "mary had a little lamb.")
-    {
-    kwsys_ios::cerr
-      << "Problem with UnCapitalizedWords "
-      << '"' << test << '"' << kwsys_ios::endl;
-    res = false;    
-    }
-
-  test = "MaryHadTheLittleLamb.";
-  if (kwsys::SystemTools::AddSpaceBetweenCapitalizedWords(test) != 
-      "Mary Had The Little Lamb.")
-    {
-    kwsys_ios::cerr
-      << "Problem with AddSpaceBetweenCapitalizedWords "
-      << '"' << test << '"' << kwsys_ios::endl;
-    res = false;    
-    }
-
-  char * cres = 
-    kwsys::SystemTools::AppendStrings("Mary Had A"," Little Lamb.");
-  if (strcmp(cres,"Mary Had A Little Lamb."))
-    {
-    kwsys_ios::cerr
-      << "Problem with AppendStrings "
-      << "\"Mary Had A\" \" Little Lamb.\"" << kwsys_ios::endl;
-    res = false;    
-    }
-  delete [] cres;
-
-  cres = 
-    kwsys::SystemTools::AppendStrings("Mary Had"," A ","Little Lamb.");
-  if (strcmp(cres,"Mary Had A Little Lamb."))
-    {
-    kwsys_ios::cerr
-      << "Problem with AppendStrings "
-      << "\"Mary Had\" \" A \" \"Little Lamb.\"" << kwsys_ios::endl;
-    res = false;    
-    }
-  delete [] cres;
-
-  if (kwsys::SystemTools::CountChar("Mary Had A Little Lamb.",'a') != 3)
-    {
-    kwsys_ios::cerr
-      << "Problem with CountChar "
-      << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl;
-    res = false;    
-    }
-
-  cres = 
-    kwsys::SystemTools::RemoveChars("Mary Had A Little Lamb.","aeiou");
-  if (strcmp(cres,"Mry Hd A Lttl Lmb."))
-    {
-    kwsys_ios::cerr
-      << "Problem with RemoveChars "
-      << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl;
-    res = false;    
-    }
-  delete [] cres;
-
-  cres = 
-    kwsys::SystemTools::RemoveCharsButUpperHex("Mary Had A Little Lamb.");
-  if (strcmp(cres,"A"))
-    {
-    kwsys_ios::cerr
-      << "Problem with RemoveCharsButUpperHex "
-      << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl;
-    res = false;    
-    }
-  delete [] cres;
-
-  char *cres2 = new char [strlen("Mary Had A Little Lamb.")+1];
-  strcpy(cres2,"Mary Had A Little Lamb.");
-  kwsys::SystemTools::ReplaceChars(cres2,"aeiou",'X');
-  if (strcmp(cres2,"MXry HXd A LXttlX LXmb."))
-    {
-    kwsys_ios::cerr
-      << "Problem with ReplaceChars "
-      << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl;
-    res = false;    
-    }
-  delete [] cres2;
-
-  if (!kwsys::SystemTools::StringStartsWith("Mary Had A Little Lamb.",
-                                            "Mary "))
-    {
-    kwsys_ios::cerr
-      << "Problem with StringStartsWith "
-      << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl;
-    res = false;    
-    }
-
-  if (!kwsys::SystemTools::StringEndsWith("Mary Had A Little Lamb.",
-                                          " Lamb."))
-    {
-    kwsys_ios::cerr
-      << "Problem with StringEndsWith "
-      << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl;
-    res = false;    
-    }
-
-  cres = kwsys::SystemTools::DuplicateString("Mary Had A Little Lamb.");
-  if (strcmp(cres,"Mary Had A Little Lamb."))
-    {
-    kwsys_ios::cerr
-      << "Problem with DuplicateString "
-      << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl;
-    res = false;    
-    }
-  delete [] cres;
-
-  test = "Mary Had A Little Lamb.";
-  if (kwsys::SystemTools::CropString(test,13) != 
-      "Mary ...Lamb.")
-    {
-    kwsys_ios::cerr
-      << "Problem with CropString "
-      << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl;
-    res = false;    
-    }
-
-  kwsys_stl::vector<kwsys_stl::string> lines;
-  kwsys::SystemTools::Split("Mary Had A Little Lamb.",lines,' ');
-  if (lines[0] != "Mary" || lines[1] != "Had" ||
-      lines[2] != "A" || lines[3] != "Little" || lines[4] != "Lamb.")
-    {
-    kwsys_ios::cerr
-      << "Problem with Split "
-      << "\"Mary Had A Little Lamb.\"" << kwsys_ios::endl;
-    res = false;
-    }
-
-#ifdef _WIN32
-  if (kwsys::SystemTools::ConvertToWindowsExtendedPath
-      ("L:\\Local Mojo\\Hex Power Pack\\Iffy Voodoo") !=
-      L"\\\\?\\L:\\Local Mojo\\Hex Power Pack\\Iffy Voodoo")
-    {
-    kwsys_ios::cerr
-      << "Problem with ConvertToWindowsExtendedPath "
-      << "\"L:\\Local Mojo\\Hex Power Pack\\Iffy Voodoo\""
-      << kwsys_ios::endl;
-    res = false;
-    }
-
-  if (kwsys::SystemTools::ConvertToWindowsExtendedPath
-      ("L:/Local Mojo/Hex Power Pack/Iffy Voodoo") !=
-      L"\\\\?\\L:\\Local Mojo\\Hex Power Pack\\Iffy Voodoo")
-    {
-    kwsys_ios::cerr
-      << "Problem with ConvertToWindowsExtendedPath "
-      << "\"L:/Local Mojo/Hex Power Pack/Iffy Voodoo\""
-      << kwsys_ios::endl;
-    res = false;
-    }
-
-  if (kwsys::SystemTools::ConvertToWindowsExtendedPath
-      ("\\\\Foo\\Local Mojo\\Hex Power Pack\\Iffy Voodoo") !=
-      L"\\\\?\\UNC\\Foo\\Local Mojo\\Hex Power Pack\\Iffy Voodoo")
-    {
-    kwsys_ios::cerr
-      << "Problem with ConvertToWindowsExtendedPath "
-      << "\"\\\\Foo\\Local Mojo\\Hex Power Pack\\Iffy Voodoo\""
-      << kwsys_ios::endl;
-    res = false;
-    }
-
-  if (kwsys::SystemTools::ConvertToWindowsExtendedPath
-      ("//Foo/Local Mojo/Hex Power Pack/Iffy Voodoo") !=
-      L"\\\\?\\UNC\\Foo\\Local Mojo\\Hex Power Pack\\Iffy Voodoo")
-    {
-    kwsys_ios::cerr
-      << "Problem with ConvertToWindowsExtendedPath "
-      << "\"//Foo/Local Mojo/Hex Power Pack/Iffy Voodoo\""
-      << kwsys_ios::endl;
-    res = false;
-    }
-
-  if (kwsys::SystemTools::ConvertToWindowsExtendedPath("//") !=
-      L"//")
-    {
-    kwsys_ios::cerr
-      << "Problem with ConvertToWindowsExtendedPath "
-      << "\"//\""
-      << kwsys_ios::endl;
-    res = false;
-    }
-
-  if (kwsys::SystemTools::ConvertToWindowsExtendedPath("\\\\.\\") !=
-      L"\\\\.\\")
-    {
-    kwsys_ios::cerr
-      << "Problem with ConvertToWindowsExtendedPath "
-      << "\"\\\\.\\\""
-      << kwsys_ios::endl;
-    res = false;
-    }
-
-  if (kwsys::SystemTools::ConvertToWindowsExtendedPath("\\\\.\\X") !=
-      L"\\\\.\\X")
-    {
-    kwsys_ios::cerr
-      << "Problem with ConvertToWindowsExtendedPath "
-      << "\"\\\\.\\X\""
-      << kwsys_ios::endl;
-    res = false;
-    }
-
-  if (kwsys::SystemTools::ConvertToWindowsExtendedPath("\\\\.\\X:") !=
-      L"\\\\?\\X:")
-    {
-    kwsys_ios::cerr
-      << "Problem with ConvertToWindowsExtendedPath "
-      << "\"\\\\.\\X:\""
-      << kwsys_ios::endl;
-    res = false;
-    }
-
-  if (kwsys::SystemTools::ConvertToWindowsExtendedPath("\\\\.\\X:\\") !=
-      L"\\\\?\\X:\\")
-    {
-    kwsys_ios::cerr
-      << "Problem with ConvertToWindowsExtendedPath "
-      << "\"\\\\.\\X:\\\""
-      << kwsys_ios::endl;
-    res = false;
-    }
-
-  if (kwsys::SystemTools::ConvertToWindowsExtendedPath("NUL") !=
-      L"\\\\.\\NUL")
-    {
-    kwsys_ios::cerr
-      << "Problem with ConvertToWindowsExtendedPath "
-      << "\"NUL\""
-      << kwsys_ios::endl;
-    res = false;
-    }
-
-#endif
-
-  if (kwsys::SystemTools::ConvertToWindowsOutputPath
-      ("L://Local Mojo/Hex Power Pack/Iffy Voodoo") != 
-      "\"L:\\Local Mojo\\Hex Power Pack\\Iffy Voodoo\"")
-    {
-    kwsys_ios::cerr
-      << "Problem with ConvertToWindowsOutputPath "
-      << "\"L://Local Mojo/Hex Power Pack/Iffy Voodoo\""
-      << kwsys_ios::endl;
-    res = false;    
-    }
-  
-  if (kwsys::SystemTools::ConvertToWindowsOutputPath
-      ("//grayson/Local Mojo/Hex Power Pack/Iffy Voodoo") != 
-      "\"\\\\grayson\\Local Mojo\\Hex Power Pack\\Iffy Voodoo\"")
-    {
-    kwsys_ios::cerr
-      << "Problem with ConvertToWindowsOutputPath "
-      << "\"//grayson/Local Mojo/Hex Power Pack/Iffy Voodoo\""
-      << kwsys_ios::endl;
-    res = false;    
-    }
-
-  if (kwsys::SystemTools::ConvertToUnixOutputPath
-      ("//Local Mojo/Hex Power Pack/Iffy Voodoo") != 
-      "//Local\\ Mojo/Hex\\ Power\\ Pack/Iffy\\ Voodoo")
-    {
-    kwsys_ios::cerr
-      << "Problem with ConvertToUnixOutputPath "
-      << "\"//Local Mojo/Hex Power Pack/Iffy Voodoo\""
-      << kwsys_ios::endl;
-    res = false;    
-    }
-
-  return res;
-}
-
-//----------------------------------------------------------------------------
-
-static bool CheckPutEnv(const kwsys_stl::string& env, const char* name, const char* value)
-{
-  if(!kwsys::SystemTools::PutEnv(env))
-    {
-    kwsys_ios::cerr << "PutEnv(\"" << env
-                    << "\") failed!" << kwsys_ios::endl;
-    return false;
-    }
-  const char* v = kwsys::SystemTools::GetEnv(name);
-  v = v? v : "(null)";
-  if(strcmp(v, value) != 0)
-    {
-    kwsys_ios::cerr << "GetEnv(\"" << name << "\") returned \""
-                    << v << "\", not \"" << value << "\"!" << kwsys_ios::endl;
-    return false;
-    }
-  return true;
-}
-
-static bool CheckUnPutEnv(const char* env, const char* name)
-{
-  if(!kwsys::SystemTools::UnPutEnv(env))
-    {
-    kwsys_ios::cerr << "UnPutEnv(\"" << env << "\") failed!"
-                    << kwsys_ios::endl;
-    return false;
-    }
-  if(const char* v = kwsys::SystemTools::GetEnv(name))
-    {
-    kwsys_ios::cerr << "GetEnv(\"" << name << "\") returned \""
-                    << v << "\", not (null)!" << kwsys_ios::endl;
-    return false;
-    }
-  return true;
-}
-
-static bool CheckEnvironmentOperations()
-{
-  bool res = true;
-  res &= CheckPutEnv("A=B", "A", "B");
-  res &= CheckPutEnv("B=C", "B", "C");
-  res &= CheckPutEnv("C=D", "C", "D");
-  res &= CheckPutEnv("D=E", "D", "E");
-  res &= CheckUnPutEnv("A", "A");
-  res &= CheckUnPutEnv("B=", "B");
-  res &= CheckUnPutEnv("C=D", "C");
-  /* Leave "D=E" in environment so a memory checker can test for leaks.  */
-  return res;
-}
-
-
-static bool CheckRelativePath(
-  const kwsys_stl::string& local,
-  const kwsys_stl::string& remote,
-  const kwsys_stl::string& expected)
-{
-  kwsys_stl::string result = kwsys::SystemTools::RelativePath(local, remote);
-  if(expected != result)
-    {
-    kwsys_ios::cerr << "RelativePath(" << local << ", " << remote
-      << ")  yielded " << result << " instead of " << expected << kwsys_ios::endl;
-    return false;
-    }
-  return true;
-}
-
-static bool CheckRelativePaths()
-{
-  bool res = true;
-  res &= CheckRelativePath("/usr/share", "/bin/bash", "../../bin/bash");
-  res &= CheckRelativePath("/usr/./share/", "/bin/bash", "../../bin/bash");
-  res &= CheckRelativePath("/usr//share/", "/bin/bash", "../../bin/bash");
-  res &= CheckRelativePath("/usr/share/../bin/", "/bin/bash", "../../bin/bash");
-  res &= CheckRelativePath("/usr/share", "/usr/share//bin", "bin");
-  return res;
-}
-
-static bool CheckCollapsePath(
-  const kwsys_stl::string& path,
-  const kwsys_stl::string& expected)
-{
-  kwsys_stl::string result = kwsys::SystemTools::CollapseFullPath(path);
-  if(expected != result)
-    {
-    kwsys_ios::cerr << "CollapseFullPath(" << path
-      << ")  yielded " << result << " instead of " << expected << kwsys_ios::endl;
-    return false;
-    }
-  return true;
-}
-
-static bool CheckCollapsePath()
-{
-  bool res = true;
-  res &= CheckCollapsePath("/usr/share/*", "/usr/share/*");
-  res &= CheckCollapsePath("C:/Windows/*", "C:/Windows/*");
-  return res;
-}
-
-//----------------------------------------------------------------------------
-int testSystemTools(int, char*[])
-{
-  bool res = true;
-
-  int cc;
-  for ( cc = 0; toUnixPaths[cc][0]; cc ++ )
-    {
-    res &= CheckConvertToUnixSlashes(toUnixPaths[cc][0], toUnixPaths[cc][1]);
-    }
-
-  // Special check for ~
-  kwsys_stl::string output;
-  if(kwsys::SystemTools::GetEnv("HOME", output))
-    {
-    output += "/foo bar/lala";
-    res &= CheckConvertToUnixSlashes("~/foo bar/lala", output);
-    }
-
-  for (cc = 0; checkEscapeChars[cc][0]; cc ++ )
-    {
-    res &= CheckEscapeChars(checkEscapeChars[cc][0], checkEscapeChars[cc][1], 
-                            *checkEscapeChars[cc][2], checkEscapeChars[cc][3]);
-    }
-
-  res &= CheckFileOperations();
-
-  res &= CheckStringOperations();
-
-  res &= CheckEnvironmentOperations();
-
-  res &= CheckRelativePaths();
-
-  res &= CheckCollapsePath();
-
-  return res ? 0 : 1;
-}
diff --git a/src/kwsys/testSystemTools.h.in b/src/kwsys/testSystemTools.h.in
deleted file mode 100644
index 66f0f72..0000000
--- a/src/kwsys/testSystemTools.h.in
+++ /dev/null
@@ -1,21 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef @KWSYS_NAMESPACE at _testSystemtools_h
-#define @KWSYS_NAMESPACE at _testSystemtools_h
-
-#define EXECUTABLE_OUTPUT_PATH "@CMAKE_CURRENT_BINARY_DIR@"
-
-#define TEST_SYSTEMTOOLS_SOURCE_DIR "@TEST_SYSTEMTOOLS_SOURCE_DIR@"
-#define TEST_SYSTEMTOOLS_BINARY_DIR "@TEST_SYSTEMTOOLS_BINARY_DIR@"
-#cmakedefine KWSYS_TEST_SYSTEMTOOLS_LONG_PATHS
-
-#endif
diff --git a/src/kwsys/testTerminal.c b/src/kwsys/testTerminal.c
deleted file mode 100644
index 0d2d7a7..0000000
--- a/src/kwsys/testTerminal.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/*============================================================================
-  KWSys - Kitware System Library
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#include "kwsysPrivate.h"
-#include KWSYS_HEADER(Terminal.h)
-
-/* Work-around CMake dependency scanning limitation.  This must
-   duplicate the above list of headers.  */
-#if 0
-# include "Terminal.h.in"
-#endif
-
-int testTerminal(int argc, char* argv[])
-{
-  (void)argc;
-  (void)argv;
-  kwsysTerminal_cfprintf(kwsysTerminal_Color_ForegroundYellow |
-                         kwsysTerminal_Color_BackgroundBlue |
-                         kwsysTerminal_Color_AssumeTTY,
-                         stdout, "Hello %s!", "World");
-  fprintf(stdout, "\n");
-  return 0;
-}
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index f44680f..b88433d 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -23,11 +23,12 @@ find_package(LibXml2 QUIET)
 
 macro(castxml_test_cmd test)
   set(command $<TARGET_FILE:castxml> ${ARGN})
+  set(_castxml_expect ${castxml_test_cmd_expect} cmd.${test})
   add_test(
     NAME cmd.${test}
     COMMAND ${CMAKE_COMMAND}
     "-Dcommand:STRING=${command}"
-    "-Dexpect=cmd.${test}"
+    "-Dexpect=${_castxml_expect}"
     ${castxml_test_cmd_extra_arguments}
     -P ${CMAKE_CURRENT_SOURCE_DIR}/run.cmake
     )
@@ -44,6 +45,11 @@ macro(castxml_test_gccxml_common prefix ext std test)
   else()
     set(_castxml_input ${test})
   endif()
+  set(_castxml_expect ${prefix}.${std}.${test})
+  if("${std}" MATCHES "^gnu(.*)$")
+    list(APPEND _castxml_expect ${prefix}.c${CMAKE_MATCH_1}.${test})
+  endif()
+  list(APPEND _castxml_expect ${prefix}.any.${test})
   set(command $<TARGET_FILE:castxml>
     --castxml-gccxml
     ${_castxml_start}
@@ -56,7 +62,7 @@ macro(castxml_test_gccxml_common prefix ext std test)
     NAME ${prefix}.${std}.${test}
     COMMAND ${CMAKE_COMMAND}
     "-Dcommand:STRING=${command}"
-    "-Dexpect=${prefix}.${std}.${test};${prefix}.any.${test}"
+    "-Dexpect=${_castxml_expect}"
     "-Dxml=${prefix}.${std}.${test}.xml"
     "-Dxmllint=${LIBXML2_XMLLINT_EXECUTABLE}"
     -P ${CMAKE_CURRENT_SOURCE_DIR}/run.cmake
@@ -67,34 +73,79 @@ macro(castxml_test_gccxml_c89 test)
   castxml_test_gccxml_common(gccxml c c89 ${test})
 endmacro()
 
+macro(castxml_test_gccxml_gnu89 test)
+  castxml_test_gccxml_common(gccxml c gnu89 ${test})
+endmacro()
+
 macro(castxml_test_gccxml_cxx98 test)
   castxml_test_gccxml_common(gccxml cxx c++98 ${test})
 endmacro()
 
+macro(castxml_test_gccxml_gnuxx98 test)
+  castxml_test_gccxml_common(gccxml cxx gnu++98 ${test})
+endmacro()
+
 macro(castxml_test_gccxml_cxx11 test)
   castxml_test_gccxml_common(gccxml cxx c++11 ${test})
 endmacro()
 
+macro(castxml_test_gccxml_gnuxx11 test)
+  castxml_test_gccxml_common(gccxml cxx gnu++11 ${test})
+endmacro()
+
+macro(castxml_test_gccxml_cxx14 test)
+  castxml_test_gccxml_common(gccxml cxx c++14 ${test})
+endmacro()
+
+macro(castxml_test_gccxml_gnuxx14 test)
+  castxml_test_gccxml_common(gccxml cxx gnu++14 ${test})
+endmacro()
+
 macro(castxml_test_gccxml_broken_cxx98 test)
   castxml_test_gccxml_common(gccxml.broken cxx c++98 ${test})
 endmacro()
 
+macro(castxml_test_gccxml_broken_gnuxx98 test)
+  castxml_test_gccxml_common(gccxml.broken cxx gnu++98 ${test})
+endmacro()
+
 macro(castxml_test_gccxml_broken_cxx11 test)
   castxml_test_gccxml_common(gccxml.broken cxx c++11 ${test})
 endmacro()
 
+macro(castxml_test_gccxml_broken_gnuxx11 test)
+  castxml_test_gccxml_common(gccxml.broken cxx gnu++11 ${test})
+endmacro()
+
+macro(castxml_test_gccxml_broken_cxx14 test)
+  castxml_test_gccxml_common(gccxml.broken cxx c++14 ${test})
+endmacro()
+
+macro(castxml_test_gccxml_broken_gnuxx14 test)
+  castxml_test_gccxml_common(gccxml.broken cxx gnu++14 ${test})
+endmacro()
+
 macro(castxml_test_gccxml_c test)
   castxml_test_gccxml_c89(${test})
+  castxml_test_gccxml_gnu89(${test})
 endmacro()
 
 macro(castxml_test_gccxml test)
   castxml_test_gccxml_cxx98(${test})
+  castxml_test_gccxml_gnuxx98(${test})
   castxml_test_gccxml_cxx11(${test})
+  castxml_test_gccxml_gnuxx11(${test})
+  castxml_test_gccxml_cxx14(${test})
+  castxml_test_gccxml_gnuxx14(${test})
 endmacro()
 
 macro(castxml_test_gccxml_broken test)
   castxml_test_gccxml_broken_cxx98(${test})
+  castxml_test_gccxml_broken_gnuxx98(${test})
   castxml_test_gccxml_broken_cxx11(${test})
+  castxml_test_gccxml_broken_gnuxx11(${test})
+  castxml_test_gccxml_broken_cxx14(${test})
+  castxml_test_gccxml_broken_gnuxx14(${test})
 endmacro()
 
 set(input ${CMAKE_CURRENT_LIST_DIR}/input)
@@ -126,6 +177,8 @@ castxml_test_cmd(gccxml-and-objc2 --castxml-gccxml ${empty_mm})
 castxml_test_cmd(gccxml-empty-c++98 --castxml-gccxml -std=c++98 ${empty_cxx})
 castxml_test_cmd(gccxml-empty-c++98-E --castxml-gccxml -std=c++98 ${empty_cxx} -E)
 castxml_test_cmd(gccxml-empty-c++98-c --castxml-gccxml -std=c++98 ${empty_cxx} -c)
+castxml_test_cmd(std-c++98-src-c -std=c++98 ${empty_c})
+castxml_test_cmd(std-c89-src-cxx -std=c89 ${empty_cxx})
 castxml_test_cmd(input-missing ${input}/does-not-exist.c)
 castxml_test_cmd(o-missing -o)
 castxml_test_cmd(start-missing --castxml-start)
@@ -133,39 +186,73 @@ castxml_test_cmd(rsp-empty @${input}/empty.rsp)
 castxml_test_cmd(rsp-missing @${input}/does-not-exist.rsp)
 castxml_test_cmd(rsp-o-missing @${input}/o-missing.rsp)
 
+# Test predefined macros when not using --castxml-cc-<id>.
+math(EXPR __castxml__ "1000000*${CastXML_VERSION_MAJOR} + 1000*${CastXML_VERSION_MINOR} + ${CastXML_VERSION_PATCH}")
+configure_file(expect/cmd.predefined-macros.stdout.txt.in
+               expect/cmd.predefined-macros.stdout.txt @ONLY)
+set(castxml_test_cmd_expect ${CMAKE_CURRENT_BINARY_DIR}/expect/cmd.predefined-macros)
+castxml_test_cmd(predefined-macros --castxml-gccxml ${empty_cxx} -E -dM)
+unset(castxml_test_cmd_expect)
+
 # Test --castxml-cc-gnu detection.
 add_executable(cc-gnu cc-gnu.c)
 set_property(SOURCE cc-gnu.c APPEND PROPERTY COMPILE_DEFINITIONS
   "TEST_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"")
-castxml_test_cmd(cc-gnu-c-E --castxml-cc-gnu $<TARGET_FILE:cc-gnu> ${empty_c} -E -dM)
-castxml_test_cmd(cc-gnu-c-cmd --castxml-cc-gnu $<TARGET_FILE:cc-gnu> ${empty_c} "-###")
-castxml_test_cmd(cc-gnu-cxx-E --castxml-cc-gnu $<TARGET_FILE:cc-gnu> ${empty_cxx} -E -dM)
-castxml_test_cmd(cc-gnu-cxx-cmd --castxml-cc-gnu $<TARGET_FILE:cc-gnu> ${empty_cxx} "-###")
+castxml_test_cmd(cc-gnu-bad-cmd --castxml-cc-gnu cc-gnu-bad-cmd ${empty_cxx})
+castxml_test_cmd(cc-gnu-src-c-E --castxml-cc-gnu $<TARGET_FILE:cc-gnu> ${empty_c} -E -dM)
+castxml_test_cmd(cc-gnu-src-cxx-E --castxml-cc-gnu $<TARGET_FILE:cc-gnu> ${empty_cxx} -E -dM)
+castxml_test_cmd(cc-gnu-src-cxx-cmd --castxml-cc-gnu $<TARGET_FILE:cc-gnu> ${empty_cxx} "-###")
 castxml_test_cmd(cc-gnu-tgt-amd64 --castxml-cc-gnu "(" $<TARGET_FILE:cc-gnu> --cc-define=__amd64__ ")" ${empty_cxx} "-###")
 castxml_test_cmd(cc-gnu-tgt-explicit --castxml-cc-gnu "(" $<TARGET_FILE:cc-gnu> ")" -target explicit-target-triple ${empty_cxx} "-###")
 castxml_test_cmd(cc-gnu-tgt-i386 --castxml-cc-gnu "(" $<TARGET_FILE:cc-gnu> --cc-define=__i386__ ")" ${empty_cxx} "-###")
 castxml_test_cmd(cc-gnu-tgt-mingw --castxml-cc-gnu "(" $<TARGET_FILE:cc-gnu> --cc-define=_WIN32 --cc-define=__MINGW32__ ")" ${empty_cxx} "-###")
 castxml_test_cmd(cc-gnu-tgt-win --castxml-cc-gnu "(" $<TARGET_FILE:cc-gnu> --cc-define=_WIN32 ")" ${empty_cxx} "-###")
 castxml_test_cmd(cc-gnu-tgt-x86_64 --castxml-cc-gnu "(" $<TARGET_FILE:cc-gnu> --cc-define=__x86_64__ ")" ${empty_cxx} "-###")
+castxml_test_cmd(cc-gnu-std-c++98 --castxml-cc-gnu "(" $<TARGET_FILE:cc-gnu>              -ansi ")" ${empty_cxx} "-###")
+castxml_test_cmd(cc-gnu-std-c++11 --castxml-cc-gnu "(" $<TARGET_FILE:cc-gnu> -std=201103L -ansi ")" ${empty_cxx} "-###")
+castxml_test_cmd(cc-gnu-std-c++14 --castxml-cc-gnu "(" $<TARGET_FILE:cc-gnu> -std=201402L -ansi ")" ${empty_cxx} "-###")
+castxml_test_cmd(cc-gnu-std-gnu++98 --castxml-cc-gnu "(" $<TARGET_FILE:cc-gnu>              ")" ${empty_cxx} "-###")
+castxml_test_cmd(cc-gnu-std-gnu++11 --castxml-cc-gnu "(" $<TARGET_FILE:cc-gnu> -std=201103L ")" ${empty_cxx} "-###")
+castxml_test_cmd(cc-gnu-std-gnu++14 --castxml-cc-gnu "(" $<TARGET_FILE:cc-gnu> -std=201402L ")" ${empty_cxx} "-###")
+castxml_test_cmd(cc-gnu-std-explicit --castxml-cc-gnu "(" $<TARGET_FILE:cc-gnu> -std=199901L ")" -std=c++14 ${empty_cxx} "-###")
+castxml_test_cmd(cc-gnu-c-bad-cmd --castxml-cc-gnu-c "(" cc-gnu-c-bad-cmd ")" ${empty_c})
+castxml_test_cmd(cc-gnu-c-src-c-E --castxml-cc-gnu-c $<TARGET_FILE:cc-gnu> ${empty_c} -E -dM)
+castxml_test_cmd(cc-gnu-c-src-c-cmd --castxml-cc-gnu-c $<TARGET_FILE:cc-gnu> ${empty_c} "-###")
+castxml_test_cmd(cc-gnu-c-std-c89 --castxml-cc-gnu-c "(" $<TARGET_FILE:cc-gnu>              -ansi ")" ${empty_c} "-###")
+castxml_test_cmd(cc-gnu-c-std-c99 --castxml-cc-gnu-c "(" $<TARGET_FILE:cc-gnu> -std=199901L -ansi ")" ${empty_c} "-###")
+castxml_test_cmd(cc-gnu-c-std-c11 --castxml-cc-gnu-c "(" $<TARGET_FILE:cc-gnu> -std=201112L -ansi ")" ${empty_c} "-###")
+castxml_test_cmd(cc-gnu-c-std-gnu89 --castxml-cc-gnu-c "(" $<TARGET_FILE:cc-gnu>              ")" ${empty_c} "-###")
+castxml_test_cmd(cc-gnu-c-std-gnu99 --castxml-cc-gnu-c "(" $<TARGET_FILE:cc-gnu> -std=199901L ")" ${empty_c} "-###")
+castxml_test_cmd(cc-gnu-c-std-gnu11 --castxml-cc-gnu-c "(" $<TARGET_FILE:cc-gnu> -std=201112L ")" ${empty_c} "-###")
 
 # Test --castxml-cc-msvc detection.
 add_executable(cc-msvc cc-msvc.c)
 set(castxml_test_cmd_extra_arguments "-Dprologue=${CMAKE_CURRENT_SOURCE_DIR}/cc-msvc.cmake")
-castxml_test_cmd(cc-msvc-c-E --castxml-cc-msvc $<TARGET_FILE:cc-msvc> ${empty_c} -E -dM)
-castxml_test_cmd(cc-msvc-c-cmd --castxml-cc-msvc $<TARGET_FILE:cc-msvc> ${empty_c} "-###")
-castxml_test_cmd(cc-msvc-cxx-E --castxml-cc-msvc $<TARGET_FILE:cc-msvc> ${empty_cxx} -E -dM)
-castxml_test_cmd(cc-msvc-cxx-cmd --castxml-cc-msvc $<TARGET_FILE:cc-msvc> ${empty_cxx} "-###")
+castxml_test_cmd(cc-msvc-bad-cmd --castxml-cc-msvc cc-msvc-bad-cmd ${empty_cxx})
+castxml_test_cmd(cc-msvc-src-c-E --castxml-cc-msvc $<TARGET_FILE:cc-msvc> ${empty_c} -E -dM)
+castxml_test_cmd(cc-msvc-src-cxx-E --castxml-cc-msvc $<TARGET_FILE:cc-msvc> ${empty_cxx} -E -dM)
+castxml_test_cmd(cc-msvc-src-cxx-cmd --castxml-cc-msvc $<TARGET_FILE:cc-msvc> ${empty_cxx} "-###")
 castxml_test_cmd(cc-msvc-tgt-amd64 --castxml-cc-msvc "(" $<TARGET_FILE:cc-msvc> --cc-define=_M_AMD64 ")" ${empty_cxx} "-###")
 castxml_test_cmd(cc-msvc-tgt-explicit --castxml-cc-msvc "(" $<TARGET_FILE:cc-msvc> ")" -target explicit-target-triple ${empty_cxx} "-###")
 castxml_test_cmd(cc-msvc-tgt-i386 --castxml-cc-msvc "(" $<TARGET_FILE:cc-msvc> --cc-define=_M_IX86 ")" ${empty_cxx} "-###")
 castxml_test_cmd(cc-msvc-tgt-win --castxml-cc-msvc "(" $<TARGET_FILE:cc-msvc> --cc-define=_WIN32 ")" ${empty_cxx} "-###")
 castxml_test_cmd(cc-msvc-tgt-x86_64 --castxml-cc-msvc "(" $<TARGET_FILE:cc-msvc> --cc-define=_M_X64 ")" ${empty_cxx} "-###")
+castxml_test_cmd(cc-msvc-std-c++98 --castxml-cc-msvc "(" $<TARGET_FILE:cc-msvc> -msc=1500 ")" ${empty_cxx} "-###")
+castxml_test_cmd(cc-msvc-std-c++11 --castxml-cc-msvc "(" $<TARGET_FILE:cc-msvc> -msc=1600 ")" ${empty_cxx} "-###")
+castxml_test_cmd(cc-msvc-std-c++14 --castxml-cc-msvc "(" $<TARGET_FILE:cc-msvc> -msc=1900 ")" ${empty_cxx} "-###")
+castxml_test_cmd(cc-msvc-std-explicit --castxml-cc-msvc "(" $<TARGET_FILE:cc-msvc> -msc=1500 ")" -std=gnu++14 ${empty_cxx} "-###")
+castxml_test_cmd(cc-msvc-c-bad-cmd --castxml-cc-msvc-c "(" cc-msvc-c-bad-cmd ")" ${empty_c})
+castxml_test_cmd(cc-msvc-c-src-c-E --castxml-cc-msvc-c $<TARGET_FILE:cc-msvc> ${empty_c} -E -dM)
+castxml_test_cmd(cc-msvc-c-src-c-cmd --castxml-cc-msvc-c $<TARGET_FILE:cc-msvc> ${empty_c} "-###")
+castxml_test_cmd(cc-msvc-c-std-c89 --castxml-cc-msvc-c "(" $<TARGET_FILE:cc-msvc> ")" ${empty_c} "-###")
 unset(castxml_test_cmd_extra_arguments)
 
 castxml_test_gccxml(ArrayType)
 castxml_test_gccxml(ArrayType-incomplete)
 castxml_test_gccxml(Class)
 castxml_test_gccxml(Class-abstract)
+castxml_test_gccxml(Class-annotate)
+castxml_test_gccxml(Class-base-offset)
 castxml_test_gccxml(Class-base-typedef)
 castxml_test_gccxml(Class-bases)
 castxml_test_gccxml(Class-forward)
@@ -191,11 +278,21 @@ castxml_test_gccxml(Class-template-friends)
 castxml_test_gccxml(Class-template-member-Typedef)
 castxml_test_gccxml(Class-template-member-Typedef-const)
 castxml_test_gccxml(Class-template-member-template)
+castxml_test_gccxml(Constructor)
+castxml_test_gccxml(Constructor-annotate)
+castxml_test_gccxml(Converter)
+castxml_test_gccxml(Converter-annotate)
 castxml_test_gccxml(CvQualifiedType)
+castxml_test_gccxml(Destructor)
+castxml_test_gccxml(Destructor-annotate)
 castxml_test_gccxml(Enumeration)
+castxml_test_gccxml(Enumeration-annotate)
 castxml_test_gccxml(Enumeration-anonymous)
 castxml_test_gccxml(Field)
+castxml_test_gccxml(Field-annotate)
 castxml_test_gccxml(Function)
+castxml_test_gccxml(Function-annotate)
+castxml_test_gccxml(Function-Argument-annotate)
 castxml_test_gccxml(Function-Argument-decay)
 castxml_test_gccxml(Function-Argument-default)
 castxml_test_gccxml(Function-rvalue-reference)
@@ -207,6 +304,8 @@ castxml_test_gccxml(FunctionType-variadic)
 castxml_test_gccxml(FundamentalType)
 castxml_test_gccxml(FundamentalTypes)
 castxml_test_gccxml(Method)
+castxml_test_gccxml(Method-annotate)
+castxml_test_gccxml(Method-overrides)
 castxml_test_gccxml(Method-rvalue-reference)
 castxml_test_gccxml(MethodType)
 castxml_test_gccxml(MethodType-cv)
@@ -227,10 +326,15 @@ castxml_test_gccxml(Namespace-repeat-start)
 castxml_test_gccxml(OffsetType)
 castxml_test_gccxml(OffsetType-cv)
 castxml_test_gccxml(OperatorFunction)
+castxml_test_gccxml(OperatorFunction-annotate)
 castxml_test_gccxml(OperatorMethod)
+castxml_test_gccxml(OperatorMethod-annotate)
 castxml_test_gccxml(PointerType)
 castxml_test_gccxml(ReferenceType)
 castxml_test_gccxml(RValueReferenceType)
+castxml_test_gccxml(TypeAlias)
+castxml_test_gccxml(TypeAliasTemplate)
+castxml_test_gccxml(Typedef-annotate)
 castxml_test_gccxml(Typedef-paren)
 castxml_test_gccxml(Typedef-to-Class-template)
 castxml_test_gccxml(Typedef-to-Enumeration)
@@ -238,6 +342,7 @@ castxml_test_gccxml(Typedef-to-Enumeration-anonymous)
 castxml_test_gccxml(Typedef-to-FundamentalType-mode)
 castxml_test_gccxml(Typedef-to-extern-C-FundamentalType-mode)
 castxml_test_gccxml(Variable)
+castxml_test_gccxml(Variable-annotate)
 castxml_test_gccxml(Variable-in-Class)
 castxml_test_gccxml(Variable-init)
 
@@ -250,6 +355,7 @@ castxml_test_gccxml(Namespace-nested-2)
 unset(castxml_test_gccxml_custom_start)
 unset(castxml_test_gccxml_custom_input)
 
+castxml_test_gccxml(invalid-decl-for-type)
 castxml_test_gccxml(qualified-type-name)
 castxml_test_gccxml(using-declaration-class)
 castxml_test_gccxml(using-declaration-ns)
@@ -260,6 +366,7 @@ castxml_test_gccxml(using-directive-start)
 if(";${LLVM_TARGETS_TO_BUILD};" MATCHES ";X86;")
   set(castxml_test_gccxml_extra_arguments -target i386-pc-windows-msvc)
   castxml_test_gccxml(Function-calling-convention-ms)
+  castxml_test_gccxml(Function-calling-convention-ms-annotate)
   castxml_test_gccxml(implicit-decl-ms)
   castxml_test_gccxml(inline-asm-ms)
   unset(castxml_test_gccxml_extra_arguments)
@@ -273,72 +380,20 @@ castxml_test_gccxml_c(invalid)
 
 castxml_test_gccxml_broken(ReferenceType-to-Class-template)
 
-#-----------------------------------------------------------------------------
-# Find a real GNU compiler to test with --castxml-cc-gnu.
-
-set(_gnu_C gcc)
-set(_gnu_CXX g++)
-
-foreach(lang C CXX)
-  find_program(TEST_GNU_${lang} NAMES ${_gnu_${lang}} DOC "Path to GNU ${_gnu_${lang}} compiler for testing")
-  # Exclude the Apple LLVM tool that is not really a GNU compiler.
-  if(TEST_GNU_${lang})
-    execute_process(
-      COMMAND ${TEST_GNU_${lang}} --version
-      OUTPUT_VARIABLE version
-      ERROR_VARIABLE version
-      RESULT_VARIABLE failed
-      )
-    if(failed OR version MATCHES "Apple LLVM")
-      set(TEST_GNU_${lang} TEST_GNU_${lang}-NOTFOUND)
-    endif()
-  endif()
-  if(TEST_GNU_${lang})
-    set(castxml_test_gccxml_extra_arguments --castxml-cc-gnu ${TEST_GNU_C})
-    message(STATUS "Found GNU ${lang} compiler '${TEST_GNU_C}' to drive tests")
-  endif()
-endforeach()
-
-if(TEST_GNU_C)
-  set(castxml_test_gccxml_extra_arguments --castxml-cc-gnu ${TEST_GNU_C})
-
-  # Check if the GNU compiler supports __float128 to enable test.
-  execute_process(
-    COMMAND ${TEST_GNU_C} -c ${CMAKE_CURRENT_SOURCE_DIR}/input/GNU-float128.c
-    OUTPUT_VARIABLE out
-    ERROR_VARIABLE out
-    RESULT_VARIABLE failed_float128_c
-    )
-  if(NOT failed_float128_c)
-    castxml_test_gccxml_c(GNU-float128)
-    set(castxml_test_gccxml_custom_input GNU-float128)
-    set(castxml_test_gccxml_custom_start "")
-    castxml_test_gccxml_c(GNU-float128-nostart)
-    unset(castxml_test_gccxml_custom_start)
-    unset(castxml_test_gccxml_custom_input)
-  endif()
-
-  unset(castxml_test_gccxml_extra_arguments)
-endif()
-
-if(TEST_GNU_CXX)
-  set(castxml_test_gccxml_extra_arguments --castxml-cc-gnu ${TEST_GNU_CXX})
-
-  # Check if the GNU compiler supports __float128 to enable test.
-  execute_process(
-    COMMAND ${TEST_GNU_CXX} -c ${CMAKE_CURRENT_SOURCE_DIR}/input/GNU-float128.cxx
-    OUTPUT_VARIABLE out
-    ERROR_VARIABLE out
-    RESULT_VARIABLE failed_float128_cxx
-    )
-  if(NOT failed_float128_cxx)
-    castxml_test_gccxml(GNU-float128)
-    set(castxml_test_gccxml_custom_input GNU-float128)
-    set(castxml_test_gccxml_custom_start "")
-    castxml_test_gccxml(GNU-float128-nostart)
-    unset(castxml_test_gccxml_custom_start)
-    unset(castxml_test_gccxml_custom_input)
-  endif()
+set(castxml_test_gccxml_extra_arguments --castxml-cc-gnu-c "(" $<TARGET_FILE:cc-gnu> --cc-define=__x86_64__ ")")
+castxml_test_gccxml_c(GNU-float128)
+set(castxml_test_gccxml_custom_input GNU-float128)
+set(castxml_test_gccxml_custom_start "")
+castxml_test_gccxml_c(GNU-float128-nostart)
+unset(castxml_test_gccxml_custom_start)
+unset(castxml_test_gccxml_custom_input)
+unset(castxml_test_gccxml_extra_arguments)
 
-  unset(castxml_test_gccxml_extra_arguments)
-endif()
+set(castxml_test_gccxml_extra_arguments --castxml-cc-gnu "(" $<TARGET_FILE:cc-gnu> --cc-define=__x86_64__ ")")
+castxml_test_gccxml(GNU-float128)
+set(castxml_test_gccxml_custom_input GNU-float128)
+set(castxml_test_gccxml_custom_start "")
+castxml_test_gccxml(GNU-float128-nostart)
+unset(castxml_test_gccxml_custom_start)
+unset(castxml_test_gccxml_custom_input)
+unset(castxml_test_gccxml_extra_arguments)
diff --git a/test/cc-gnu.c b/test/cc-gnu.c
index 55a37a4..750efea 100644
--- a/test/cc-gnu.c
+++ b/test/cc-gnu.c
@@ -3,17 +3,34 @@
 
 int main(int argc, const char* argv[])
 {
+  int cpp = 0;
+  const char* std_date = 0;
   int i;
   for (i = 1; i < argc; ++i) {
     if (strncmp(argv[i], "--cc-define=", 12) == 0) {
       fprintf(stdout, "#define %s 1\n", argv[i]+12);
+    } else if (strncmp(argv[i], "-std=", 5) == 0) {
+      std_date = argv[i]+5;
+    } else if (strcmp(argv[i], "-ansi") == 0) {
+      fprintf(stdout, "#define __STRICT_ANSI__ 1\n");
+    } else if (strstr(argv[i], ".cpp")) {
+      cpp = 1;
     }
   }
+  if (cpp) {
+    fprintf(stdout,
+      "#define __cplusplus %s\n", std_date? std_date : "199711L"
+      );
+  } else if(std_date) {
+    fprintf(stdout,
+      "#define __STDC_VERSION__ %s\n", std_date
+      );
+  }
   fprintf(stdout,
-    "#define __cc_gnu__ 1\n"
+    "#define __GNUC__ 1\n"
     "#define __has_include(x) x\n"
     "#define __has_include_next(x) x\n"
-    "#define __cc_gnu_minor__ 1\n"
+    "#define __GNUC_MINOR__ 1\n"
     "#define __has_last(x) x"
     );
   fprintf(stderr,
diff --git a/test/cc-msvc.c b/test/cc-msvc.c
index 0933b92..10afc63 100644
--- a/test/cc-msvc.c
+++ b/test/cc-msvc.c
@@ -3,18 +3,33 @@
 
 int main(int argc, const char* argv[])
 {
+  int cpp = 0;
+  const char* msc_ver = "1600";
   int i;
   for (i = 1; i < argc; ++i) {
     if (strncmp(argv[i], "--cc-define=", 12) == 0) {
       fprintf(stdout, "\n#define %s 1", argv[i]+12);
+    } else if (strncmp(argv[i], "-msc=", 5) == 0) {
+      msc_ver = argv[i]+5;
+    } else if (strstr(argv[i], ".cpp")) {
+      cpp = 1;
     }
   }
   fprintf(stdout,
     "\n"
-    "#define __cc_msvc__ 1\n"
+    );
+  if (cpp) {
+    fprintf(stdout,
+      "#define __cplusplus 199711L\n"
+      );
+  }
+  fprintf(stdout,
+    "#define _MSC_VER %s\n", msc_ver
+    );
+  fprintf(stdout,
     "#define __has_include(x) x\n"
     "#define __has_include_next(x) x\n"
-    "#define __cc_msvc_minor__ 1\n"
+    "#define _WIN32 1\n"
     "#define __has_last(x) x"
     );
   return 0;
diff --git a/test/expect/cmd.gccxml-and-c++14.result.txt b/test/expect/cmd.cc-gnu-bad-cmd.result.txt
similarity index 100%
copy from test/expect/cmd.gccxml-and-c++14.result.txt
copy to test/expect/cmd.cc-gnu-bad-cmd.result.txt
diff --git a/test/expect/cmd.cc-gnu-bad-cmd.stderr.txt b/test/expect/cmd.cc-gnu-bad-cmd.stderr.txt
new file mode 100644
index 0000000..92a7973
--- /dev/null
+++ b/test/expect/cmd.cc-gnu-bad-cmd.stderr.txt
@@ -0,0 +1,3 @@
+^error: '--castxml-cc-gnu' compiler command failed:
+
+ 'cc-gnu-bad-cmd' '-E' '-dM' '-v' '.*/share/castxml/empty.cpp'
diff --git a/test/expect/cmd.cc-gnu-c-E.stdout.txt b/test/expect/cmd.cc-gnu-c-E.stdout.txt
deleted file mode 100644
index 83be182..0000000
--- a/test/expect/cmd.cc-gnu-c-E.stdout.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-^#define __cc_gnu__ 1
-#define __cc_gnu_minor__ 1$
diff --git a/test/expect/cmd.gccxml-and-c++14.result.txt b/test/expect/cmd.cc-gnu-c-bad-cmd.result.txt
similarity index 100%
copy from test/expect/cmd.gccxml-and-c++14.result.txt
copy to test/expect/cmd.cc-gnu-c-bad-cmd.result.txt
diff --git a/test/expect/cmd.cc-gnu-c-bad-cmd.stderr.txt b/test/expect/cmd.cc-gnu-c-bad-cmd.stderr.txt
new file mode 100644
index 0000000..117a4c5
--- /dev/null
+++ b/test/expect/cmd.cc-gnu-c-bad-cmd.stderr.txt
@@ -0,0 +1,3 @@
+^error: '--castxml-cc-gnu-c' compiler command failed:
+
+ 'cc-gnu-c-bad-cmd' '-E' '-dM' '-v' '.*/share/castxml/empty.c'
diff --git a/test/expect/cmd.cc-gnu-c-src-c-E.stdout.txt b/test/expect/cmd.cc-gnu-c-src-c-E.stdout.txt
new file mode 100644
index 0000000..d251114
--- /dev/null
+++ b/test/expect/cmd.cc-gnu-c-src-c-E.stdout.txt
@@ -0,0 +1,6 @@
+^#define __GNUC_MINOR__ 1
+#define __GNUC__ 1
+#define __castxml__ [0-9]+
+#define __castxml_clang_major__ [0-9]+
+#define __castxml_clang_minor__ [0-9]+
+#define __castxml_clang_patchlevel__ [0-9]+$
diff --git a/test/expect/cmd.cc-gnu-c-cmd.stderr.txt b/test/expect/cmd.cc-gnu-c-src-c-cmd.stderr.txt
similarity index 100%
rename from test/expect/cmd.cc-gnu-c-cmd.stderr.txt
rename to test/expect/cmd.cc-gnu-c-src-c-cmd.stderr.txt
diff --git a/test/expect/cmd.cc-gnu-c-std-c11.stderr.txt b/test/expect/cmd.cc-gnu-c-std-c11.stderr.txt
new file mode 100644
index 0000000..6335004
--- /dev/null
+++ b/test/expect/cmd.cc-gnu-c-std-c11.stderr.txt
@@ -0,0 +1 @@
+"clang" .* "-std=c11"
diff --git a/test/expect/cmd.cc-gnu-c-std-c89.stderr.txt b/test/expect/cmd.cc-gnu-c-std-c89.stderr.txt
new file mode 100644
index 0000000..46c01fd
--- /dev/null
+++ b/test/expect/cmd.cc-gnu-c-std-c89.stderr.txt
@@ -0,0 +1 @@
+"clang" .* "-std=c89"
diff --git a/test/expect/cmd.cc-gnu-c-std-c99.stderr.txt b/test/expect/cmd.cc-gnu-c-std-c99.stderr.txt
new file mode 100644
index 0000000..020242f
--- /dev/null
+++ b/test/expect/cmd.cc-gnu-c-std-c99.stderr.txt
@@ -0,0 +1 @@
+"clang" .* "-std=c99"
diff --git a/test/expect/cmd.cc-gnu-c-std-gnu11.stderr.txt b/test/expect/cmd.cc-gnu-c-std-gnu11.stderr.txt
new file mode 100644
index 0000000..d1e843e
--- /dev/null
+++ b/test/expect/cmd.cc-gnu-c-std-gnu11.stderr.txt
@@ -0,0 +1 @@
+"clang" .* "-std=gnu11"
diff --git a/test/expect/cmd.cc-gnu-c-std-gnu89.stderr.txt b/test/expect/cmd.cc-gnu-c-std-gnu89.stderr.txt
new file mode 100644
index 0000000..767cfae
--- /dev/null
+++ b/test/expect/cmd.cc-gnu-c-std-gnu89.stderr.txt
@@ -0,0 +1 @@
+"clang" .* "-std=gnu89"
diff --git a/test/expect/cmd.cc-gnu-c-std-gnu99.stderr.txt b/test/expect/cmd.cc-gnu-c-std-gnu99.stderr.txt
new file mode 100644
index 0000000..fc27c75
--- /dev/null
+++ b/test/expect/cmd.cc-gnu-c-std-gnu99.stderr.txt
@@ -0,0 +1 @@
+"clang" .* "-std=gnu99"
diff --git a/test/expect/cmd.cc-gnu-cxx-E.stdout.txt b/test/expect/cmd.cc-gnu-cxx-E.stdout.txt
deleted file mode 100644
index 83be182..0000000
--- a/test/expect/cmd.cc-gnu-cxx-E.stdout.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-^#define __cc_gnu__ 1
-#define __cc_gnu_minor__ 1$
diff --git a/test/expect/cmd.gccxml-and-c++14.result.txt b/test/expect/cmd.cc-gnu-src-c-E.result.txt
similarity index 100%
copy from test/expect/cmd.gccxml-and-c++14.result.txt
copy to test/expect/cmd.cc-gnu-src-c-E.result.txt
diff --git a/test/expect/cmd.cc-gnu-src-c-E.stderr.txt b/test/expect/cmd.cc-gnu-src-c-E.stderr.txt
new file mode 100644
index 0000000..de25ca1
--- /dev/null
+++ b/test/expect/cmd.cc-gnu-src-c-E.stderr.txt
@@ -0,0 +1 @@
+^error: invalid argument '-std=gnu\+\+98' not allowed with 'C/ObjC'$
diff --git a/test/expect/cmd.cc-gnu-src-cxx-E.stdout.txt b/test/expect/cmd.cc-gnu-src-cxx-E.stdout.txt
new file mode 100644
index 0000000..a20a94d
--- /dev/null
+++ b/test/expect/cmd.cc-gnu-src-cxx-E.stdout.txt
@@ -0,0 +1,7 @@
+^#define __GNUC_MINOR__ 1
+#define __GNUC__ 1
+#define __castxml__ [0-9]+
+#define __castxml_clang_major__ [0-9]+
+#define __castxml_clang_minor__ [0-9]+
+#define __castxml_clang_patchlevel__ [0-9]+
+#define __cplusplus 199711L$
diff --git a/test/expect/cmd.cc-gnu-cxx-cmd.stderr.txt b/test/expect/cmd.cc-gnu-src-cxx-cmd.stderr.txt
similarity index 100%
rename from test/expect/cmd.cc-gnu-cxx-cmd.stderr.txt
rename to test/expect/cmd.cc-gnu-src-cxx-cmd.stderr.txt
diff --git a/test/expect/cmd.cc-gnu-std-c++11.stderr.txt b/test/expect/cmd.cc-gnu-std-c++11.stderr.txt
new file mode 100644
index 0000000..788ddfb
--- /dev/null
+++ b/test/expect/cmd.cc-gnu-std-c++11.stderr.txt
@@ -0,0 +1 @@
+"clang" .* "-std=c\+\+11"
diff --git a/test/expect/cmd.cc-gnu-std-c++14.stderr.txt b/test/expect/cmd.cc-gnu-std-c++14.stderr.txt
new file mode 100644
index 0000000..dae98f7
--- /dev/null
+++ b/test/expect/cmd.cc-gnu-std-c++14.stderr.txt
@@ -0,0 +1 @@
+"clang" .* "-std=c\+\+14"
diff --git a/test/expect/cmd.cc-gnu-std-c++98.stderr.txt b/test/expect/cmd.cc-gnu-std-c++98.stderr.txt
new file mode 100644
index 0000000..ce14416
--- /dev/null
+++ b/test/expect/cmd.cc-gnu-std-c++98.stderr.txt
@@ -0,0 +1 @@
+"clang" .* "-std=c\+\+98"
diff --git a/test/expect/cmd.cc-gnu-std-explicit.stderr.txt b/test/expect/cmd.cc-gnu-std-explicit.stderr.txt
new file mode 100644
index 0000000..dae98f7
--- /dev/null
+++ b/test/expect/cmd.cc-gnu-std-explicit.stderr.txt
@@ -0,0 +1 @@
+"clang" .* "-std=c\+\+14"
diff --git a/test/expect/cmd.cc-gnu-std-gnu++11.stderr.txt b/test/expect/cmd.cc-gnu-std-gnu++11.stderr.txt
new file mode 100644
index 0000000..28289a2
--- /dev/null
+++ b/test/expect/cmd.cc-gnu-std-gnu++11.stderr.txt
@@ -0,0 +1 @@
+"clang" .* "-std=gnu\+\+11"
diff --git a/test/expect/cmd.cc-gnu-std-gnu++14.stderr.txt b/test/expect/cmd.cc-gnu-std-gnu++14.stderr.txt
new file mode 100644
index 0000000..ec617e1
--- /dev/null
+++ b/test/expect/cmd.cc-gnu-std-gnu++14.stderr.txt
@@ -0,0 +1 @@
+"clang" .* "-std=gnu\+\+14"
diff --git a/test/expect/cmd.cc-gnu-std-gnu++98.stderr.txt b/test/expect/cmd.cc-gnu-std-gnu++98.stderr.txt
new file mode 100644
index 0000000..3ead6f7
--- /dev/null
+++ b/test/expect/cmd.cc-gnu-std-gnu++98.stderr.txt
@@ -0,0 +1 @@
+"clang" .* "-std=gnu\+\+98"
diff --git a/test/expect/cmd.gccxml-and-c++14.result.txt b/test/expect/cmd.cc-msvc-bad-cmd.result.txt
similarity index 100%
copy from test/expect/cmd.gccxml-and-c++14.result.txt
copy to test/expect/cmd.cc-msvc-bad-cmd.result.txt
diff --git a/test/expect/cmd.cc-msvc-bad-cmd.stderr.txt b/test/expect/cmd.cc-msvc-bad-cmd.stderr.txt
new file mode 100644
index 0000000..d7ef766
--- /dev/null
+++ b/test/expect/cmd.cc-msvc-bad-cmd.stderr.txt
@@ -0,0 +1,3 @@
+^error: '--castxml-cc-msvc' compiler command failed:
+
+ 'cc-msvc-bad-cmd' '-c' '-FoNUL' '.*/share/castxml/detect_vs.cpp'
diff --git a/test/expect/cmd.cc-msvc-c-E.stdout.txt b/test/expect/cmd.cc-msvc-c-E.stdout.txt
deleted file mode 100644
index a4cc19c..0000000
--- a/test/expect/cmd.cc-msvc-c-E.stdout.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-^#define __cc_msvc__ 1
-#define __cc_msvc_minor__ 1$
diff --git a/test/expect/cmd.gccxml-and-c++14.result.txt b/test/expect/cmd.cc-msvc-c-bad-cmd.result.txt
similarity index 100%
copy from test/expect/cmd.gccxml-and-c++14.result.txt
copy to test/expect/cmd.cc-msvc-c-bad-cmd.result.txt
diff --git a/test/expect/cmd.cc-msvc-c-bad-cmd.stderr.txt b/test/expect/cmd.cc-msvc-c-bad-cmd.stderr.txt
new file mode 100644
index 0000000..fca19b3
--- /dev/null
+++ b/test/expect/cmd.cc-msvc-c-bad-cmd.stderr.txt
@@ -0,0 +1,3 @@
+^error: '--castxml-cc-msvc-c' compiler command failed:
+
+ 'cc-msvc-c-bad-cmd' '-c' '-FoNUL' '.*/share/castxml/detect_vs.c
diff --git a/test/expect/cmd.cc-msvc-c-src-c-E.stdout.txt b/test/expect/cmd.cc-msvc-c-src-c-E.stdout.txt
new file mode 100644
index 0000000..c2b5320
--- /dev/null
+++ b/test/expect/cmd.cc-msvc-c-src-c-E.stdout.txt
@@ -0,0 +1,6 @@
+^#define _MSC_VER 1600
+#define _WIN32 1
+#define __castxml__ [0-9]+
+#define __castxml_clang_major__ [0-9]+
+#define __castxml_clang_minor__ [0-9]+
+#define __castxml_clang_patchlevel__ [0-9]+$
diff --git a/test/expect/cmd.cc-msvc-c-cmd.stderr.txt b/test/expect/cmd.cc-msvc-c-src-c-cmd.stderr.txt
similarity index 100%
rename from test/expect/cmd.cc-msvc-c-cmd.stderr.txt
rename to test/expect/cmd.cc-msvc-c-src-c-cmd.stderr.txt
diff --git a/test/expect/cmd.cc-msvc-c-std-c89.stderr.txt b/test/expect/cmd.cc-msvc-c-std-c89.stderr.txt
new file mode 100644
index 0000000..46c01fd
--- /dev/null
+++ b/test/expect/cmd.cc-msvc-c-std-c89.stderr.txt
@@ -0,0 +1 @@
+"clang" .* "-std=c89"
diff --git a/test/expect/cmd.cc-msvc-cxx-E.stdout.txt b/test/expect/cmd.cc-msvc-cxx-E.stdout.txt
deleted file mode 100644
index a4cc19c..0000000
--- a/test/expect/cmd.cc-msvc-cxx-E.stdout.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-^#define __cc_msvc__ 1
-#define __cc_msvc_minor__ 1$
diff --git a/test/expect/cmd.gccxml-and-c++14.result.txt b/test/expect/cmd.cc-msvc-src-c-E.result.txt
similarity index 100%
copy from test/expect/cmd.gccxml-and-c++14.result.txt
copy to test/expect/cmd.cc-msvc-src-c-E.result.txt
diff --git a/test/expect/cmd.cc-msvc-src-c-E.stderr.txt b/test/expect/cmd.cc-msvc-src-c-E.stderr.txt
new file mode 100644
index 0000000..bcfb7c4
--- /dev/null
+++ b/test/expect/cmd.cc-msvc-src-c-E.stderr.txt
@@ -0,0 +1 @@
+^error: invalid argument '-std=c\+\+11' not allowed with 'C/ObjC'$
diff --git a/test/expect/cmd.cc-msvc-src-cxx-E.stdout.txt b/test/expect/cmd.cc-msvc-src-cxx-E.stdout.txt
new file mode 100644
index 0000000..ebc0301
--- /dev/null
+++ b/test/expect/cmd.cc-msvc-src-cxx-E.stdout.txt
@@ -0,0 +1,7 @@
+^#define _MSC_VER 1600
+#define _WIN32 1
+#define __castxml__ [0-9]+
+#define __castxml_clang_major__ [0-9]+
+#define __castxml_clang_minor__ [0-9]+
+#define __castxml_clang_patchlevel__ [0-9]+
+#define __cplusplus 199711L$
diff --git a/test/expect/cmd.cc-msvc-cxx-cmd.stderr.txt b/test/expect/cmd.cc-msvc-src-cxx-cmd.stderr.txt
similarity index 100%
rename from test/expect/cmd.cc-msvc-cxx-cmd.stderr.txt
rename to test/expect/cmd.cc-msvc-src-cxx-cmd.stderr.txt
diff --git a/test/expect/cmd.cc-msvc-std-c++11.stderr.txt b/test/expect/cmd.cc-msvc-std-c++11.stderr.txt
new file mode 100644
index 0000000..788ddfb
--- /dev/null
+++ b/test/expect/cmd.cc-msvc-std-c++11.stderr.txt
@@ -0,0 +1 @@
+"clang" .* "-std=c\+\+11"
diff --git a/test/expect/cmd.cc-msvc-std-c++14.stderr.txt b/test/expect/cmd.cc-msvc-std-c++14.stderr.txt
new file mode 100644
index 0000000..dae98f7
--- /dev/null
+++ b/test/expect/cmd.cc-msvc-std-c++14.stderr.txt
@@ -0,0 +1 @@
+"clang" .* "-std=c\+\+14"
diff --git a/test/expect/cmd.cc-msvc-std-c++98.stderr.txt b/test/expect/cmd.cc-msvc-std-c++98.stderr.txt
new file mode 100644
index 0000000..ce14416
--- /dev/null
+++ b/test/expect/cmd.cc-msvc-std-c++98.stderr.txt
@@ -0,0 +1 @@
+"clang" .* "-std=c\+\+98"
diff --git a/test/expect/cmd.cc-msvc-std-explicit.stderr.txt b/test/expect/cmd.cc-msvc-std-explicit.stderr.txt
new file mode 100644
index 0000000..ec617e1
--- /dev/null
+++ b/test/expect/cmd.cc-msvc-std-explicit.stderr.txt
@@ -0,0 +1 @@
+"clang" .* "-std=gnu\+\+14"
diff --git a/test/expect/cmd.gccxml-and-c++14.stderr.txt b/test/expect/cmd.gccxml-and-c++14.stderr.txt
deleted file mode 100644
index 76ed9ea..0000000
--- a/test/expect/cmd.gccxml-and-c++14.stderr.txt
+++ /dev/null
@@ -1 +0,0 @@
-^error: '--castxml-gccxml' does not work with c\+\+14$
diff --git a/test/expect/cmd.predefined-macros.stdout.txt.in b/test/expect/cmd.predefined-macros.stdout.txt.in
new file mode 100644
index 0000000..a2c60d4
--- /dev/null
+++ b/test/expect/cmd.predefined-macros.stdout.txt.in
@@ -0,0 +1,9 @@
+#define __castxml__ @__castxml__@
+#define __castxml_clang_major__ [0-9]+
+#define __castxml_clang_minor__ [0-9]+
+#define __castxml_clang_patchlevel__ [0-9]+
+#define __clang__ 1
+#define __clang_major__ [0-9]+
+#define __clang_minor__ [0-9]+
+#define __clang_patchlevel__ [0-9]+
+#define __clang_version__
diff --git a/test/expect/cmd.gccxml-and-c++14.result.txt b/test/expect/cmd.std-c++98-src-c.result.txt
similarity index 100%
copy from test/expect/cmd.gccxml-and-c++14.result.txt
copy to test/expect/cmd.std-c++98-src-c.result.txt
diff --git a/test/expect/cmd.std-c++98-src-c.stderr.txt b/test/expect/cmd.std-c++98-src-c.stderr.txt
new file mode 100644
index 0000000..c2537f9
--- /dev/null
+++ b/test/expect/cmd.std-c++98-src-c.stderr.txt
@@ -0,0 +1 @@
+^error: invalid argument '-std=c\+\+98' not allowed with 'C/ObjC'$
diff --git a/test/expect/cmd.gccxml-and-c++14.result.txt b/test/expect/cmd.std-c89-src-cxx.result.txt
similarity index 100%
rename from test/expect/cmd.gccxml-and-c++14.result.txt
rename to test/expect/cmd.std-c89-src-cxx.result.txt
diff --git a/test/expect/cmd.std-c89-src-cxx.stderr.txt b/test/expect/cmd.std-c89-src-cxx.stderr.txt
new file mode 100644
index 0000000..b05c32e
--- /dev/null
+++ b/test/expect/cmd.std-c89-src-cxx.stderr.txt
@@ -0,0 +1 @@
+^error: invalid argument '-std=c89' not allowed with 'C\+\+/ObjC\+\+'$
diff --git a/test/expect/gccxml.any.Class-annotate.xml.txt b/test/expect/gccxml.any.Class-annotate.xml.txt
new file mode 100644
index 0000000..e8a645c
--- /dev/null
+++ b/test/expect/gccxml.any.Class-annotate.xml.txt
@@ -0,0 +1,17 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+  <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6" size="[0-9]+" align="[0-9]+" attributes="annotate\(an annotation\)"/>
+  <Constructor id="_3" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
+    <Argument type="_7" location="f1:1" file="f1" line="1"/>
+  </Constructor>
+  <OperatorMethod id="_5" name="=" returns="_8" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_7" location="f1:1" file="f1" line="1"/>
+  </OperatorMethod>
+  <Destructor id="_6" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
+  <ReferenceType id="_7" type="_1c"/>
+  <CvQualifiedType id="_1c" type="_1" const="1"/>
+  <ReferenceType id="_8" type="_1"/>
+  <Namespace id="_2" name="::"/>
+  <File id="f1" name=".*/test/input/Class-annotate.cxx"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.any.Class-base-offset.xml.txt b/test/expect/gccxml.any.Class-base-offset.xml.txt
new file mode 100644
index 0000000..14f49b6
--- /dev/null
+++ b/test/expect/gccxml.any.Class-base-offset.xml.txt
@@ -0,0 +1,11 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+  <Class id="_1" name="start" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6" bases="_7 _8 _9" size="[0-9]+" align="[0-9]+">
+    <Base type="_7" access="public" virtual="0" offset="0"/>
+    <Base type="_8" access="public" virtual="0" offset="1"/>
+    <Base type="_9" access="public" virtual="0" offset="2"/>
+  </Class>
+.*
+  <Namespace id="_2" name="::"/>
+  <File id="f1" name=".*/test/input/Class-base-offset.cxx"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.any.Class-base-typedef.xml.txt b/test/expect/gccxml.any.Class-base-typedef.xml.txt
index 101af60..f82be8a 100644
--- a/test/expect/gccxml.any.Class-base-typedef.xml.txt
+++ b/test/expect/gccxml.any.Class-base-typedef.xml.txt
@@ -1,7 +1,7 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:3" file="f1" line="3" members="_3 _4 _5 _6" bases="_7" size="[0-9]+" align="[0-9]+">
-    <Base type="_7" access="public" virtual="0"/>
+    <Base type="_7" access="public" virtual="0" offset="0"/>
   </Class>
   <Constructor id="_3" name="start" context="_1" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"( throw="")?>
diff --git a/test/expect/gccxml.any.Class-implicit-member-access-mutable.xml.txt b/test/expect/gccxml.any.Class-implicit-member-access-mutable.xml.txt
index 833adbd..56dece8 100644
--- a/test/expect/gccxml.any.Class-implicit-member-access-mutable.xml.txt
+++ b/test/expect/gccxml.any.Class-implicit-member-access-mutable.xml.txt
@@ -1,7 +1,7 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:10" file="f1" line="10" members="_3 _4" bases="_5" size="[0-9]+" align="[0-9]+">
-    <Base type="_5" access="public" virtual="0"/>
+    <Base type="_5" access="public" virtual="0" offset="0"/>
   </Class>
   <Destructor id="_3" name="start" context="_1" access="public" location="f1:10" file="f1" line="10" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:10" file="f1" line="10" inline="1" artificial="1"( throw="")?/>
diff --git a/test/expect/gccxml.any.Class-implicit-member-access.xml.txt b/test/expect/gccxml.any.Class-implicit-member-access.xml.txt
index 7ccf23a..9cf2a14 100644
--- a/test/expect/gccxml.any.Class-implicit-member-access.xml.txt
+++ b/test/expect/gccxml.any.Class-implicit-member-access.xml.txt
@@ -1,7 +1,7 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:9" file="f1" line="9" members="_3 _4" bases="_5" size="[0-9]+" align="[0-9]+">
-    <Base type="_5" access="public" virtual="0"/>
+    <Base type="_5" access="public" virtual="0" offset="0"/>
   </Class>
   <Destructor id="_3" name="start" context="_1" access="public" location="f1:9" file="f1" line="9" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:9" file="f1" line="9" inline="1" artificial="1"( throw="")?/>
diff --git a/test/expect/gccxml.any.Class-implicit-member-bad-base.xml.txt b/test/expect/gccxml.any.Class-implicit-member-bad-base.xml.txt
index 16ba2dc..6c98ab9 100644
--- a/test/expect/gccxml.any.Class-implicit-member-bad-base.xml.txt
+++ b/test/expect/gccxml.any.Class-implicit-member-bad-base.xml.txt
@@ -1,7 +1,7 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:9" file="f1" line="9" members="_3 _4 _5" bases="_6" size="[0-9]+" align="[0-9]+">
-    <Base type="_6" access="public" virtual="0"/>
+    <Base type="_6" access="public" virtual="0" offset="0"/>
   </Class>
   <Constructor id="_3" name="start" context="_1" access="public" location="f1:9" file="f1" line="9" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:9" file="f1" line="9" inline="1" artificial="1"( throw="")?>
diff --git a/test/expect/gccxml.any.Constructor-annotate.xml.txt b/test/expect/gccxml.any.Constructor-annotate.xml.txt
new file mode 100644
index 0000000..90c7f02
--- /dev/null
+++ b/test/expect/gccxml.any.Constructor-annotate.xml.txt
@@ -0,0 +1,17 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+  <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6" size="[0-9]+" align="[0-9]+"/>
+  <Constructor id="_3" name="start" context="_1" access="private" location="f1:2" file="f1" line="2" attributes="annotate\(an annotation\)"/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
+    <Argument type="_7" location="f1:1" file="f1" line="1"/>
+  </Constructor>
+  <OperatorMethod id="_5" name="=" returns="_8" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_7" location="f1:1" file="f1" line="1"/>
+  </OperatorMethod>
+  <Destructor id="_6" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
+  <ReferenceType id="_7" type="_1c"/>
+  <CvQualifiedType id="_1c" type="_1" const="1"/>
+  <ReferenceType id="_8" type="_1"/>
+  <Namespace id="_2" name="::"/>
+  <File id="f1" name=".*/test/input/Constructor-annotate.cxx"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.any.Constructor.xml.txt b/test/expect/gccxml.any.Constructor.xml.txt
new file mode 100644
index 0000000..4aec461
--- /dev/null
+++ b/test/expect/gccxml.any.Constructor.xml.txt
@@ -0,0 +1,17 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+  <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6" size="[0-9]+" align="[0-9]+"/>
+  <Constructor id="_3" name="start" context="_1" access="private" location="f1:2" file="f1" line="2"/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
+    <Argument type="_7" location="f1:1" file="f1" line="1"/>
+  </Constructor>
+  <OperatorMethod id="_5" name="=" returns="_8" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_7" location="f1:1" file="f1" line="1"/>
+  </OperatorMethod>
+  <Destructor id="_6" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
+  <ReferenceType id="_7" type="_1c"/>
+  <CvQualifiedType id="_1c" type="_1" const="1"/>
+  <ReferenceType id="_8" type="_1"/>
+  <Namespace id="_2" name="::"/>
+  <File id="f1" name=".*/test/input/Constructor.cxx"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.any.Converter-annotate.xml.txt b/test/expect/gccxml.any.Converter-annotate.xml.txt
new file mode 100644
index 0000000..0642674
--- /dev/null
+++ b/test/expect/gccxml.any.Converter-annotate.xml.txt
@@ -0,0 +1,19 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+  <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
+  <Converter id="_3" returns="_8" context="_1" access="private" location="f1:2" file="f1" line="2" mangled="[^"]+" attributes="annotate\(an annotation\)"/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
+    <Argument type="_9" location="f1:1" file="f1" line="1"/>
+  </Constructor>
+  <OperatorMethod id="_6" name="=" returns="_10" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_9" location="f1:1" file="f1" line="1"/>
+  </OperatorMethod>
+  <Destructor id="_7" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
+  <FundamentalType id="_8" name="int" size="[0-9]+" align="[0-9]+"/>
+  <ReferenceType id="_9" type="_1c"/>
+  <CvQualifiedType id="_1c" type="_1" const="1"/>
+  <ReferenceType id="_10" type="_1"/>
+  <Namespace id="_2" name="::"/>
+  <File id="f1" name=".*/test/input/Converter-annotate.cxx"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.any.Converter.xml.txt b/test/expect/gccxml.any.Converter.xml.txt
new file mode 100644
index 0000000..0c563a3
--- /dev/null
+++ b/test/expect/gccxml.any.Converter.xml.txt
@@ -0,0 +1,19 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+  <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
+  <Converter id="_3" returns="_8" context="_1" access="private" location="f1:2" file="f1" line="2" mangled="[^"]+"/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
+    <Argument type="_9" location="f1:1" file="f1" line="1"/>
+  </Constructor>
+  <OperatorMethod id="_6" name="=" returns="_10" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_9" location="f1:1" file="f1" line="1"/>
+  </OperatorMethod>
+  <Destructor id="_7" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
+  <FundamentalType id="_8" name="int" size="[0-9]+" align="[0-9]+"/>
+  <ReferenceType id="_9" type="_1c"/>
+  <CvQualifiedType id="_1c" type="_1" const="1"/>
+  <ReferenceType id="_10" type="_1"/>
+  <Namespace id="_2" name="::"/>
+  <File id="f1" name=".*/test/input/Converter.cxx"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.any.Destructor-annotate.xml.txt b/test/expect/gccxml.any.Destructor-annotate.xml.txt
new file mode 100644
index 0000000..0660f79
--- /dev/null
+++ b/test/expect/gccxml.any.Destructor-annotate.xml.txt
@@ -0,0 +1,17 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+  <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6" size="[0-9]+" align="[0-9]+"/>
+  <Destructor id="_3" name="start" context="_1" access="private" location="f1:2" file="f1" line="2" attributes="annotate\(an annotation\)"/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
+    <Argument type="_7" location="f1:1" file="f1" line="1"/>
+  </Constructor>
+  <OperatorMethod id="_6" name="=" returns="_8" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_7" location="f1:1" file="f1" line="1"/>
+  </OperatorMethod>
+  <ReferenceType id="_7" type="_1c"/>
+  <CvQualifiedType id="_1c" type="_1" const="1"/>
+  <ReferenceType id="_8" type="_1"/>
+  <Namespace id="_2" name="::"/>
+  <File id="f1" name=".*/test/input/Destructor-annotate.cxx"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.any.Destructor.xml.txt b/test/expect/gccxml.any.Destructor.xml.txt
new file mode 100644
index 0000000..130b197
--- /dev/null
+++ b/test/expect/gccxml.any.Destructor.xml.txt
@@ -0,0 +1,17 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+  <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6" size="[0-9]+" align="[0-9]+"/>
+  <Destructor id="_3" name="start" context="_1" access="private" location="f1:2" file="f1" line="2"/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
+    <Argument type="_7" location="f1:1" file="f1" line="1"/>
+  </Constructor>
+  <OperatorMethod id="_6" name="=" returns="_8" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_7" location="f1:1" file="f1" line="1"/>
+  </OperatorMethod>
+  <ReferenceType id="_7" type="_1c"/>
+  <CvQualifiedType id="_1c" type="_1" const="1"/>
+  <ReferenceType id="_8" type="_1"/>
+  <Namespace id="_2" name="::"/>
+  <File id="f1" name=".*/test/input/Destructor.cxx"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.any.Enumeration-annotate.xml.txt b/test/expect/gccxml.any.Enumeration-annotate.xml.txt
new file mode 100644
index 0000000..b9cc0da
--- /dev/null
+++ b/test/expect/gccxml.any.Enumeration-annotate.xml.txt
@@ -0,0 +1,8 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+  <Enumeration id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" attributes="annotate\(an annotation\)">
+    <EnumValue name="ev0" init="0" attributes="annotate\(an annotation\)"/>
+  </Enumeration>
+  <Namespace id="_2" name="::"/>
+  <File id="f1" name=".*/test/input/Enumeration-annotate.cxx"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.any.Field-annotate.xml.txt b/test/expect/gccxml.any.Field-annotate.xml.txt
new file mode 100644
index 0000000..d5d524e
--- /dev/null
+++ b/test/expect/gccxml.any.Field-annotate.xml.txt
@@ -0,0 +1,19 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+  <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
+  <Field id="_3" name="field" type="_8" context="_1" access="private" location="f1:2" file="f1" line="2" offset="0" attributes="annotate\(an annotation\)"/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
+    <Argument type="_9" location="f1:1" file="f1" line="1"/>
+  </Constructor>
+  <OperatorMethod id="_6" name="=" returns="_10" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_9" location="f1:1" file="f1" line="1"/>
+  </OperatorMethod>
+  <Destructor id="_7" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
+  <FundamentalType id="_8" name="int" size="[0-9]+" align="[0-9]+"/>
+  <ReferenceType id="_9" type="_1c"/>
+  <CvQualifiedType id="_1c" type="_1" const="1"/>
+  <ReferenceType id="_10" type="_1"/>
+  <Namespace id="_2" name="::"/>
+  <File id="f1" name=".*/test/input/Field-annotate.cxx"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.any.Function-Argument-Annotate.xml.txt b/test/expect/gccxml.any.Function-Argument-Annotate.xml.txt
new file mode 100644
index 0000000..f02c1a2
--- /dev/null
+++ b/test/expect/gccxml.any.Function-Argument-Annotate.xml.txt
@@ -0,0 +1,10 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+  <Function id="_1" name="start" returns="_2" context="_3" location="f1:1" file="f1" line="1" mangled="[^"]+">
+    <Argument type="_4" location="f1:1" file="f1" line="1" attributes="annotate\(an annotation\)"/>
+  </Function>
+  <FundamentalType id="_2" name="void" size="[0-9]+" align="[0-9]+"/>
+  <FundamentalType id="_4" name="int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/Function-Argument-annotate.cxx"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.any.Function-annotate.xml.txt b/test/expect/gccxml.any.Function-annotate.xml.txt
new file mode 100644
index 0000000..3f98887
--- /dev/null
+++ b/test/expect/gccxml.any.Function-annotate.xml.txt
@@ -0,0 +1,10 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+  <Function id="_1" name="start" returns="_2" context="_3" location="f1:1" file="f1" line="1" mangled="[^"]+" attributes="annotate\(an annotation\)">
+    <Argument type="_4" location="f1:1" file="f1" line="1"/>
+  </Function>
+  <FundamentalType id="_2" name="void" size="[0-9]+" align="[0-9]+"/>
+  <FundamentalType id="_4" name="int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/Function-annotate.cxx"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.any.Function-calling-convention-ms-annotate.xml.txt b/test/expect/gccxml.any.Function-calling-convention-ms-annotate.xml.txt
new file mode 100644
index 0000000..ba7fb08
--- /dev/null
+++ b/test/expect/gccxml.any.Function-calling-convention-ms-annotate.xml.txt
@@ -0,0 +1,26 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+  <Function id="_1" name="start" returns="_5" context="_6" location="f1:1" file="f1" line="1" mangled="[^"]+" attributes="annotate\(an annotation\)">
+    <Argument type="_7" location="f1:1" file="f1" line="1"/>
+  </Function>
+  <Function id="_2" name="start" returns="_5" context="_6" location="f1:2" file="f1" line="2" mangled="[^"]+" attributes="__stdcall__ annotate\(an annotation\)">
+    <Argument type="_8" location="f1:2" file="f1" line="2"/>
+  </Function>
+  <Function id="_3" name="start" returns="_5" context="_6" location="f1:3" file="f1" line="3" mangled="[^"]+" attributes="__fastcall__ annotate\(an annotation\)">
+    <Argument type="_9" location="f1:3" file="f1" line="3"/>
+  </Function>
+  <Function id="_4" name="start" returns="_5" context="_6" location="f1:4" file="f1" line="4" mangled="[^"]+" attributes="__thiscall__ annotate\(an annotation\)">
+    <Argument type="_10" location="f1:4" file="f1" line="4"/>
+  </Function>
+  <FundamentalType id="_5" name="void" size="[0-9]+" align="[0-9]+"/>
+  <PointerType id="_7" type="_11"/>
+  <PointerType id="_8" type="_12"/>
+  <PointerType id="_9" type="_13"/>
+  <PointerType id="_10" type="_14"/>
+  <Namespace id="_6" name="::"/>
+  <FunctionType id="_11" returns="_5"/>
+  <FunctionType id="_12" returns="_5" attributes="__stdcall__"/>
+  <FunctionType id="_13" returns="_5" attributes="__fastcall__"/>
+  <FunctionType id="_14" returns="_5" attributes="__thiscall__"/>
+  <File id="f1" name=".*/test/input/Function-calling-convention-ms-annotate.cxx"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.any.Method-annotate.xml.txt b/test/expect/gccxml.any.Method-annotate.xml.txt
new file mode 100644
index 0000000..3e4f2f3
--- /dev/null
+++ b/test/expect/gccxml.any.Method-annotate.xml.txt
@@ -0,0 +1,21 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+  <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
+  <Method id="_3" name="method" returns="_8" context="_1" access="private" location="f1:2" file="f1" line="2" mangled="[^"]+" attributes="annotate\(an annotation\)">
+    <Argument type="_8" location="f1:2" file="f1" line="2"/>
+  </Method>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
+    <Argument type="_9" location="f1:1" file="f1" line="1"/>
+  </Constructor>
+  <OperatorMethod id="_6" name="=" returns="_10" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_9" location="f1:1" file="f1" line="1"/>
+  </OperatorMethod>
+  <Destructor id="_7" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
+  <FundamentalType id="_8" name="int" size="[0-9]+" align="[0-9]+"/>
+  <ReferenceType id="_9" type="_1c"/>
+  <CvQualifiedType id="_1c" type="_1" const="1"/>
+  <ReferenceType id="_10" type="_1"/>
+  <Namespace id="_2" name="::"/>
+  <File id="f1" name=".*/test/input/Method-annotate.cxx"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.any.Method-overrides.xml.txt b/test/expect/gccxml.any.Method-overrides.xml.txt
new file mode 100644
index 0000000..dc95285
--- /dev/null
+++ b/test/expect/gccxml.any.Method-overrides.xml.txt
@@ -0,0 +1,38 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+  <Class id="_1" name="start" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6 _7" bases="_8" size="[0-9]+" align="[0-9]+">
+    <Base type="_8" access="public" virtual="0" offset="0"/>
+  </Class>
+  <Method id="_3" name="method" returns="_9" context="_1" access="private" location="f1:5" file="f1" line="5" virtual="1" overrides="_10" mangled="[^"]+">
+    <Argument type="_9" location="f1:5" file="f1" line="5"/>
+  </Method>
+  <OperatorMethod id="_4" name="=" returns="_11" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_12" location="f1:4" file="f1" line="4"/>
+  </OperatorMethod>
+  <Destructor id="_5" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_6" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_7" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?>
+    <Argument type="_12" location="f1:4" file="f1" line="4"/>
+  </Constructor>
+  <Class id="_8" name="base" context="_2" location="f1:1" file="f1" line="1" members="_10 _13 _14 _15 _16" size="[0-9]+" align="[0-9]+"/>
+  <FundamentalType id="_9" name="int" size="[0-9]+" align="[0-9]+"/>
+  <Method id="_10" name="method" returns="_9" context="_8" access="private" location="f1:2" file="f1" line="2" virtual="1" mangled="[^"]+">
+    <Argument type="_9" location="f1:2" file="f1" line="2"/>
+  </Method>
+  <ReferenceType id="_11" type="_1"/>
+  <ReferenceType id="_12" type="_1c"/>
+  <CvQualifiedType id="_1c" type="_1" const="1"/>
+  <OperatorMethod id="_13" name="=" returns="_17" context="_8" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_18" location="f1:1" file="f1" line="1"/>
+  </OperatorMethod>
+  <Destructor id="_14" name="base" context="_8" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_15" name="base" context="_8" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_16" name="base" context="_8" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
+    <Argument type="_18" location="f1:1" file="f1" line="1"/>
+  </Constructor>
+  <ReferenceType id="_17" type="_8"/>
+  <ReferenceType id="_18" type="_8c"/>
+  <CvQualifiedType id="_8c" type="_8" const="1"/>
+  <Namespace id="_2" name="::"/>
+  <File id="f1" name=".*/test/input/Method-overrides.cxx"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.any.OperatorFunction-annotate.xml.txt b/test/expect/gccxml.any.OperatorFunction-annotate.xml.txt
new file mode 100644
index 0000000..8393bd2
--- /dev/null
+++ b/test/expect/gccxml.any.OperatorFunction-annotate.xml.txt
@@ -0,0 +1,13 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+  <Namespace id="_1" name="start" context="_2" members="_3"/>
+  <OperatorFunction id="_3" name="<<" returns="_4" context="_1" location="f1:3" file="f1" line="3" mangled="[^"]+" attributes="annotate\(an annotation\)">
+    <Argument type="_4" location="f1:3" file="f1" line="3"/>
+    <Argument type="_5" location="f1:3" file="f1" line="3"/>
+  </OperatorFunction>
+  <ReferenceType id="_4" type="_6"/>
+  <FundamentalType id="_5" name="int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_2" name="::"/>
+  <Class id="_6" name="A" context="_2" location="f1:1" file="f1" line="1" incomplete="1"/>
+  <File id="f1" name=".*/test/input/OperatorFunction-annotate.cxx"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.any.OperatorMethod-annotate.xml.txt b/test/expect/gccxml.any.OperatorMethod-annotate.xml.txt
new file mode 100644
index 0000000..692cd5e
--- /dev/null
+++ b/test/expect/gccxml.any.OperatorMethod-annotate.xml.txt
@@ -0,0 +1,21 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+  <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
+  <OperatorMethod id="_3" name="<<" returns="_8" context="_1" access="private" location="f1:2" file="f1" line="2" mangled="[^"]+" attributes="annotate\(an annotation\)">
+    <Argument type="_9" location="f1:2" file="f1" line="2"/>
+  </OperatorMethod>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
+    <Argument type="_10" location="f1:1" file="f1" line="1"/>
+  </Constructor>
+  <OperatorMethod id="_6" name="=" returns="_8" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_10" location="f1:1" file="f1" line="1"/>
+  </OperatorMethod>
+  <Destructor id="_7" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
+  <ReferenceType id="_8" type="_1"/>
+  <FundamentalType id="_9" name="int" size="[0-9]+" align="[0-9]+"/>
+  <ReferenceType id="_10" type="_1c"/>
+  <CvQualifiedType id="_1c" type="_1" const="1"/>
+  <Namespace id="_2" name="::"/>
+  <File id="f1" name=".*/test/input/OperatorMethod-annotate.cxx"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.any.RValueReferenceType.xml.txt b/test/expect/gccxml.any.RValueReferenceType.xml.txt
index 6899e98..763161e 100644
--- a/test/expect/gccxml.any.RValueReferenceType.xml.txt
+++ b/test/expect/gccxml.any.RValueReferenceType.xml.txt
@@ -1,7 +1,5 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:1" file="f1" line="1"/>
-  <Unimplemented id="_2" type_class="RValueReference"/>
-  <Namespace id="_3" name="::"/>
-  <File id="f1" name=".*/test/input/RValueReferenceType.cxx"/>
+  <Namespace id="_1" name="start" context="_2"/>
+  <Namespace id="_2" name="::"/>
 </GCC_XML>$
diff --git a/test/expect/gccxml.any.TypeAlias.xml.txt b/test/expect/gccxml.any.TypeAlias.xml.txt
new file mode 100644
index 0000000..763161e
--- /dev/null
+++ b/test/expect/gccxml.any.TypeAlias.xml.txt
@@ -0,0 +1,5 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+  <Namespace id="_1" name="start" context="_2"/>
+  <Namespace id="_2" name="::"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.any.TypeAliasTemplate.xml.txt b/test/expect/gccxml.any.TypeAliasTemplate.xml.txt
new file mode 100644
index 0000000..763161e
--- /dev/null
+++ b/test/expect/gccxml.any.TypeAliasTemplate.xml.txt
@@ -0,0 +1,5 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+  <Namespace id="_1" name="start" context="_2"/>
+  <Namespace id="_2" name="::"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.any.Typedef-annotate.xml.txt b/test/expect/gccxml.any.Typedef-annotate.xml.txt
new file mode 100644
index 0000000..e26c743
--- /dev/null
+++ b/test/expect/gccxml.any.Typedef-annotate.xml.txt
@@ -0,0 +1,7 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:1" file="f1" line="1" attributes="annotate\(an annotation\)"/>
+  <FundamentalType id="_2" name="int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/Typedef-annotate.cxx"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.any.Variable-annotate.xml.txt b/test/expect/gccxml.any.Variable-annotate.xml.txt
new file mode 100644
index 0000000..020bcf9
--- /dev/null
+++ b/test/expect/gccxml.any.Variable-annotate.xml.txt
@@ -0,0 +1,7 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+  <Variable id="_1" name="start" type="_2" context="_3" location="f1:1" file="f1" line="1" mangled="[^"]+" attributes="annotate\(an annotation\)"/>
+  <FundamentalType id="_2" name="int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/Variable-annotate.cxx"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.any.invalid-decl-for-type.xml.txt b/test/expect/gccxml.any.invalid-decl-for-type.xml.txt
new file mode 100644
index 0000000..4d3cbab
--- /dev/null
+++ b/test/expect/gccxml.any.invalid-decl-for-type.xml.txt
@@ -0,0 +1,32 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+  <Struct id="_1" name="start" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6 _7 _8" size="[0-9]+" align="[0-9]+"/>
+  <Field id="_3" name="b" type="_9" context="_1" access="public" location="f1:5" file="f1" line="5" offset="0"/>
+  <Typedef id="_4" name="type" type="_10" context="_1" access="public" location="f1:6" file="f1" line="6"/>
+  <Constructor id="_5" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_6" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?>
+    <Argument type="_11" location="f1:4" file="f1" line="4"/>
+  </Constructor>
+  <OperatorMethod id="_7" name="=" returns="_12" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_11" location="f1:4" file="f1" line="4"/>
+  </OperatorMethod>
+  <Destructor id="_8" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
+  <Struct id="_9" name="B<Incomplete>" context="_2" location="f1:2" file="f1" line="2" members="_13 _14 _15 _16" size="[0-9]+" align="[0-9]+"/>
+  <Struct id="_10" name="A<Incomplete>" context="_2" location="f1:1" file="f1" line="1" size="[0-9]+" align="[0-9]+"/>
+  <ReferenceType id="_11" type="_1c"/>
+  <CvQualifiedType id="_1c" type="_1" const="1"/>
+  <ReferenceType id="_12" type="_1"/>
+  <Constructor id="_13" name="B" context="_9" access="public" location="f1:2" file="f1" line="2" inline="1"/>
+  <Constructor id="_14" name="B" context="_9" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")?>
+    <Argument type="_17" location="f1:2" file="f1" line="2"/>
+  </Constructor>
+  <OperatorMethod id="_15" name="=" returns="_18" context="_9" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_17" location="f1:2" file="f1" line="2"/>
+  </OperatorMethod>
+  <Destructor id="_16" name="B" context="_9" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")?/>
+  <ReferenceType id="_17" type="_9c"/>
+  <CvQualifiedType id="_9c" type="_9" const="1"/>
+  <ReferenceType id="_18" type="_9"/>
+  <Namespace id="_2" name="::"/>
+  <File id="f1" name=".*/test/input/invalid-decl-for-type.cxx"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.any.using-declaration-class.xml.txt b/test/expect/gccxml.any.using-declaration-class.xml.txt
index 4ab41e3..857d19f 100644
--- a/test/expect/gccxml.any.using-declaration-class.xml.txt
+++ b/test/expect/gccxml.any.using-declaration-class.xml.txt
@@ -1,7 +1,7 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:5" file="f1" line="5" members="_3 _4 _5 _6 _7 _8" bases="_9" size="[0-9]+" align="[0-9]+">
-    <Base type="_9" access="public" virtual="0"/>
+    <Base type="_9" access="public" virtual="0" offset="0"/>
   </Class>
   <Method id="_3" name="f" returns="_10" context="_9" access="protected" location="f1:3" file="f1" line="3" mangled="[^"]+">
     <Argument type="_10" location="f1:3" file="f1" line="3"/>
diff --git a/test/expect/gccxml.c++11.Class-bases.xml.txt b/test/expect/gccxml.c++11.Class-bases.xml.txt
index c9535df..48b51e1 100644
--- a/test/expect/gccxml.c++11.Class-bases.xml.txt
+++ b/test/expect/gccxml.c++11.Class-bases.xml.txt
@@ -1,8 +1,8 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6" bases="_7 private:_8 protected:_9" size="[0-9]+" align="[0-9]+">
-    <Base type="_7" access="public" virtual="0"/>
-    <Base type="_8" access="private" virtual="0"/>
+    <Base type="_7" access="public" virtual="0" offset="[0-9]+"/>
+    <Base type="_8" access="private" virtual="0" offset="[0-9]+"/>
     <Base type="_9" access="protected" virtual="1"/>
   </Class>
   <OperatorMethod id="_3" name="=" returns="_10" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" mangled="[^"]+">
diff --git a/test/expect/gccxml.c++11.Class-template-bases.xml.txt b/test/expect/gccxml.c++11.Class-template-bases.xml.txt
index 33f0acc..6f9b62a 100644
--- a/test/expect/gccxml.c++11.Class-template-bases.xml.txt
+++ b/test/expect/gccxml.c++11.Class-template-bases.xml.txt
@@ -1,8 +1,8 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start<int>" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6" bases="_7 _8" size="[0-9]+" align="[0-9]+">
-    <Base type="_7" access="public" virtual="0"/>
-    <Base type="_8" access="public" virtual="0"/>
+    <Base type="_7" access="public" virtual="0" offset="[0-9]+"/>
+    <Base type="_8" access="public" virtual="0" offset="[0-9]+"/>
   </Class>
   <Constructor id="_3" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"/>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1">
diff --git a/test/expect/gccxml.c++11.Class-bases.xml.txt b/test/expect/gccxml.c++14.Class-bases.xml.txt
similarity index 96%
copy from test/expect/gccxml.c++11.Class-bases.xml.txt
copy to test/expect/gccxml.c++14.Class-bases.xml.txt
index c9535df..48b51e1 100644
--- a/test/expect/gccxml.c++11.Class-bases.xml.txt
+++ b/test/expect/gccxml.c++14.Class-bases.xml.txt
@@ -1,8 +1,8 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6" bases="_7 private:_8 protected:_9" size="[0-9]+" align="[0-9]+">
-    <Base type="_7" access="public" virtual="0"/>
-    <Base type="_8" access="private" virtual="0"/>
+    <Base type="_7" access="public" virtual="0" offset="[0-9]+"/>
+    <Base type="_8" access="private" virtual="0" offset="[0-9]+"/>
     <Base type="_9" access="protected" virtual="1"/>
   </Class>
   <OperatorMethod id="_3" name="=" returns="_10" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" mangled="[^"]+">
diff --git a/test/expect/gccxml.c++11.Class-template-bases.xml.txt b/test/expect/gccxml.c++14.Class-template-bases.xml.txt
similarity index 95%
copy from test/expect/gccxml.c++11.Class-template-bases.xml.txt
copy to test/expect/gccxml.c++14.Class-template-bases.xml.txt
index 33f0acc..6f9b62a 100644
--- a/test/expect/gccxml.c++11.Class-template-bases.xml.txt
+++ b/test/expect/gccxml.c++14.Class-template-bases.xml.txt
@@ -1,8 +1,8 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start<int>" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6" bases="_7 _8" size="[0-9]+" align="[0-9]+">
-    <Base type="_7" access="public" virtual="0"/>
-    <Base type="_8" access="public" virtual="0"/>
+    <Base type="_7" access="public" virtual="0" offset="[0-9]+"/>
+    <Base type="_8" access="public" virtual="0" offset="[0-9]+"/>
   </Class>
   <Constructor id="_3" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"/>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1">
diff --git a/test/expect/gccxml.c++98.Class-bases.xml.txt b/test/expect/gccxml.c++98.Class-bases.xml.txt
index d7ffa95..6e58110 100644
--- a/test/expect/gccxml.c++98.Class-bases.xml.txt
+++ b/test/expect/gccxml.c++98.Class-bases.xml.txt
@@ -1,8 +1,8 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6" bases="_7 private:_8 protected:_9" size="[0-9]+" align="[0-9]+">
-    <Base type="_7" access="public" virtual="0"/>
-    <Base type="_8" access="private" virtual="0"/>
+    <Base type="_7" access="public" virtual="0" offset="[0-9]+"/>
+    <Base type="_8" access="private" virtual="0" offset="[0-9]+"/>
     <Base type="_9" access="protected" virtual="1"/>
   </Class>
   <OperatorMethod id="_3" name="=" returns="_10" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" throw="" mangled="[^"]+">
diff --git a/test/expect/gccxml.c++98.Class-template-bases.xml.txt b/test/expect/gccxml.c++98.Class-template-bases.xml.txt
index 2c8728f..44c30e1 100644
--- a/test/expect/gccxml.c++98.Class-template-bases.xml.txt
+++ b/test/expect/gccxml.c++98.Class-template-bases.xml.txt
@@ -1,8 +1,8 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start<int>" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6" bases="_7 _8" size="[0-9]+" align="[0-9]+">
-    <Base type="_7" access="public" virtual="0"/>
-    <Base type="_8" access="public" virtual="0"/>
+    <Base type="_7" access="public" virtual="0" offset="[0-9]+"/>
+    <Base type="_8" access="public" virtual="0" offset="[0-9]+"/>
   </Class>
   <Constructor id="_3" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" throw="">
diff --git a/test/expect/gccxml.c++98.TypeAlias.stderr.txt b/test/expect/gccxml.c++98.TypeAlias.stderr.txt
new file mode 100644
index 0000000..02b944f
--- /dev/null
+++ b/test/expect/gccxml.c++98.TypeAlias.stderr.txt
@@ -0,0 +1 @@
+warning: alias declarations are a C\+\+11 extension
diff --git a/test/expect/gccxml.c++98.TypeAliasTemplate.stderr.txt b/test/expect/gccxml.c++98.TypeAliasTemplate.stderr.txt
new file mode 100644
index 0000000..02b944f
--- /dev/null
+++ b/test/expect/gccxml.c++98.TypeAliasTemplate.stderr.txt
@@ -0,0 +1 @@
+warning: alias declarations are a C\+\+11 extension
diff --git a/test/expect/gccxml.c89.GNU-float128.xml.txt b/test/expect/gccxml.c89.GNU-float128.xml.txt
index 3e0272d..d9973e9 100644
--- a/test/expect/gccxml.c89.GNU-float128.xml.txt
+++ b/test/expect/gccxml.c89.GNU-float128.xml.txt
@@ -1,6 +1,6 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Function id="_1" name="start" returns="_2" context="_3" location="f1:1" file="f1" line="1" mangled="_Z5start">
+  <Function id="_1" name="start" returns="_2" context="_3" location="f1:1" file="f1" line="1" mangled="[^"]*start[^"]*">
     <Argument type="_2" location="f1:1" file="f1" line="1"/>
   </Function>
   <FundamentalType id="_2" name="__float128" size="128" align="128"/>
diff --git a/test/input/Class-annotate.cxx b/test/input/Class-annotate.cxx
new file mode 100644
index 0000000..e0f4261
--- /dev/null
+++ b/test/input/Class-annotate.cxx
@@ -0,0 +1 @@
+class __attribute__ ((annotate ("an annotation"))) start {};
diff --git a/test/input/Class-base-offset.cxx b/test/input/Class-base-offset.cxx
new file mode 100644
index 0000000..279584c
--- /dev/null
+++ b/test/input/Class-base-offset.cxx
@@ -0,0 +1,4 @@
+class base_1 { char b1; };
+class base_2 { char b2; };
+class base_3 { char b3; };
+class start: public base_1, public base_2, public base_3 {};
diff --git a/test/input/Constructor-annotate.cxx b/test/input/Constructor-annotate.cxx
new file mode 100644
index 0000000..94cf13e
--- /dev/null
+++ b/test/input/Constructor-annotate.cxx
@@ -0,0 +1,3 @@
+class start {
+  __attribute__ ((annotate ("an annotation"))) start();
+};
diff --git a/test/input/Constructor.cxx b/test/input/Constructor.cxx
new file mode 100644
index 0000000..e6e7948
--- /dev/null
+++ b/test/input/Constructor.cxx
@@ -0,0 +1,3 @@
+class start {
+  start();
+};
diff --git a/test/input/Converter-annotate.cxx b/test/input/Converter-annotate.cxx
new file mode 100644
index 0000000..2e4a915
--- /dev/null
+++ b/test/input/Converter-annotate.cxx
@@ -0,0 +1,3 @@
+class start {
+  __attribute__ ((annotate ("an annotation"))) operator int();
+};
diff --git a/test/input/Converter.cxx b/test/input/Converter.cxx
new file mode 100644
index 0000000..64bad53
--- /dev/null
+++ b/test/input/Converter.cxx
@@ -0,0 +1,3 @@
+class start {
+  operator int();
+};
diff --git a/test/input/Destructor-annotate.cxx b/test/input/Destructor-annotate.cxx
new file mode 100644
index 0000000..f2c59f1
--- /dev/null
+++ b/test/input/Destructor-annotate.cxx
@@ -0,0 +1,3 @@
+class start {
+  __attribute__ ((annotate ("an annotation"))) ~start();
+};
diff --git a/test/input/Destructor.cxx b/test/input/Destructor.cxx
new file mode 100644
index 0000000..6a42e1a
--- /dev/null
+++ b/test/input/Destructor.cxx
@@ -0,0 +1,3 @@
+class start {
+  ~start();
+};
diff --git a/test/input/Enumeration-annotate.cxx b/test/input/Enumeration-annotate.cxx
new file mode 100644
index 0000000..fd2c9a3
--- /dev/null
+++ b/test/input/Enumeration-annotate.cxx
@@ -0,0 +1,3 @@
+enum __attribute__ ((annotate ("an annotation"))) start {
+  ev0 __attribute__ ((annotate ("an annotation")))
+};
diff --git a/test/input/Field-annotate.cxx b/test/input/Field-annotate.cxx
new file mode 100644
index 0000000..917e96f
--- /dev/null
+++ b/test/input/Field-annotate.cxx
@@ -0,0 +1,3 @@
+class start {
+  __attribute__ ((annotate ("an annotation"))) int field;
+};
diff --git a/test/input/Function-Argument-annotate.cxx b/test/input/Function-Argument-annotate.cxx
new file mode 100644
index 0000000..3ea09ad
--- /dev/null
+++ b/test/input/Function-Argument-annotate.cxx
@@ -0,0 +1 @@
+void start( __attribute__ ((annotate ("an annotation"))) int);
diff --git a/test/input/Function-annotate.cxx b/test/input/Function-annotate.cxx
new file mode 100644
index 0000000..d7aaf79
--- /dev/null
+++ b/test/input/Function-annotate.cxx
@@ -0,0 +1 @@
+__attribute__ ((annotate ("an annotation"))) void start(int);
diff --git a/test/input/Function-calling-convention-ms-annotate.cxx b/test/input/Function-calling-convention-ms-annotate.cxx
new file mode 100644
index 0000000..4803dd8
--- /dev/null
+++ b/test/input/Function-calling-convention-ms-annotate.cxx
@@ -0,0 +1,4 @@
+__attribute__ ((annotate ("an annotation"))) void __cdecl start(void (__cdecl *)());
+__attribute__ ((annotate ("an annotation"))) void __stdcall start(void (__stdcall *)());
+__attribute__ ((annotate ("an annotation"))) void __fastcall start(void (__fastcall *)());
+__attribute__ ((annotate ("an annotation"))) void __thiscall start(void (__thiscall *)());
diff --git a/test/input/Method-annotate.cxx b/test/input/Method-annotate.cxx
new file mode 100644
index 0000000..cbd02cf
--- /dev/null
+++ b/test/input/Method-annotate.cxx
@@ -0,0 +1,3 @@
+class start {
+  __attribute__ ((annotate ("an annotation"))) int method(int);
+};
diff --git a/test/input/Method-overrides.cxx b/test/input/Method-overrides.cxx
new file mode 100644
index 0000000..d7e79af
--- /dev/null
+++ b/test/input/Method-overrides.cxx
@@ -0,0 +1,6 @@
+class base {
+  virtual int method(int);
+};
+class start: public base {
+  virtual int method(int);
+};
diff --git a/test/input/OperatorFunction-annotate.cxx b/test/input/OperatorFunction-annotate.cxx
new file mode 100644
index 0000000..bbb3bf9
--- /dev/null
+++ b/test/input/OperatorFunction-annotate.cxx
@@ -0,0 +1,4 @@
+class A;
+namespace start {
+  __attribute__ ((annotate ("an annotation"))) A& operator<<(A&, int);
+}
diff --git a/test/input/OperatorMethod-annotate.cxx b/test/input/OperatorMethod-annotate.cxx
new file mode 100644
index 0000000..3384ece
--- /dev/null
+++ b/test/input/OperatorMethod-annotate.cxx
@@ -0,0 +1,3 @@
+class start {
+  __attribute__ ((annotate ("an annotation"))) start& operator<<(int);
+};
diff --git a/test/input/RValueReferenceType.cxx b/test/input/RValueReferenceType.cxx
index 44f0232..35f2861 100644
--- a/test/input/RValueReferenceType.cxx
+++ b/test/input/RValueReferenceType.cxx
@@ -1 +1,3 @@
-typedef int&& start;
+namespace start {
+  typedef int&& type;
+}
diff --git a/test/input/TypeAlias.cxx b/test/input/TypeAlias.cxx
new file mode 100644
index 0000000..8e5470c
--- /dev/null
+++ b/test/input/TypeAlias.cxx
@@ -0,0 +1,3 @@
+namespace start {
+  using type = int;
+}
diff --git a/test/input/TypeAliasTemplate.cxx b/test/input/TypeAliasTemplate.cxx
new file mode 100644
index 0000000..ec54f80
--- /dev/null
+++ b/test/input/TypeAliasTemplate.cxx
@@ -0,0 +1,4 @@
+template <typename T> struct A { typedef T type; };
+namespace start {
+  template <typename T> using type = typename A<T>::type;
+}
diff --git a/test/input/Typedef-annotate.cxx b/test/input/Typedef-annotate.cxx
new file mode 100644
index 0000000..33dd09c
--- /dev/null
+++ b/test/input/Typedef-annotate.cxx
@@ -0,0 +1 @@
+typedef int (start) __attribute__ ((annotate ("an annotation")));
diff --git a/test/input/Variable-annotate.cxx b/test/input/Variable-annotate.cxx
new file mode 100644
index 0000000..0f044ec
--- /dev/null
+++ b/test/input/Variable-annotate.cxx
@@ -0,0 +1 @@
+__attribute__ ((annotate ("an annotation"))) int start;
diff --git a/test/input/invalid-decl-for-type.cxx b/test/input/invalid-decl-for-type.cxx
new file mode 100644
index 0000000..5c2225f
--- /dev/null
+++ b/test/input/invalid-decl-for-type.cxx
@@ -0,0 +1,7 @@
+template<typename T> struct A { T x; };
+template<typename T> struct B { B() { A<T> a; } };
+struct Incomplete;
+struct start {
+  B<Incomplete> b;
+  typedef A<Incomplete> type;
+};
diff --git a/test/run.cmake b/test/run.cmake
index 1b973b3..e7b2c29 100644
--- a/test/run.cmake
+++ b/test/run.cmake
@@ -36,6 +36,7 @@ if(xml)
     file(READ "${xml}" actual_xml)
     # Filter out arch-specific attributes.
     string(REGEX REPLACE "(<(Constructor|Destructor|Method|OperatorMethod|Converter)[^/>]*) attributes=\"__thiscall__\"(/?>)" "\\1\\3" actual_xml "${actual_xml}")
+    string(REGEX REPLACE "(<(Constructor|Destructor|Method|OperatorMethod|Converter)[^/>]*) attributes=\"__thiscall__ ([^/>]+)\"(/?>)" "\\1 attributes=\"\\3\"\\4" actual_xml "${actual_xml}")
   else()
     set(actual_xml "(missing)")
   endif()
@@ -48,6 +49,7 @@ set(default_stdout "^$")
 set(default_stderr "^$")
 
 foreach(o result stdout stderr ${maybe_xml})
+  string(REGEX REPLACE "(^|\n)warning: unknown platform, assuming -mfloat-abi=soft\n" "\\1" actual_${o} "${actual_${o}}")
   string(REGEX REPLACE "\n+$" "" actual_${o} "${actual_${o}}")
   string(REGEX REPLACE "\n" "\n actual-${o}> " actual-${o} " actual-${o}> ${actual_${o}}")
   set(actual-${o} "Actual ${o}:\n${actual-${o}}\n")
@@ -55,9 +57,14 @@ foreach(o result stdout stderr ${maybe_xml})
   set(expect-${o} "")
   unset(expect_${o})
   foreach(e ${expect})
-    if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/expect/${e}.${o}.txt)
-      file(READ ${CMAKE_CURRENT_LIST_DIR}/expect/${e}.${o}.txt expect_${o})
-      set(expect_${o}_file ${CMAKE_CURRENT_LIST_DIR}/expect/${e}.${o}.txt)
+    if(IS_ABSOLUTE "${e}")
+      set(f "${e}.${o}.txt")
+    else()
+      set(f ${CMAKE_CURRENT_LIST_DIR}/expect/${e}.${o}.txt)
+    endif()
+    if(EXISTS "${f}")
+      file(READ "${f}" expect_${o})
+      set(expect_${o}_file "${f}")
       break()
     endif()
   endforeach()
@@ -84,10 +91,14 @@ if(msg)
     set(update_xml "${actual_xml}")
     string(REGEX REPLACE "^<\\?xml version=\"1.0\"\\?>" "^<\\\\?xml version=\"1.0\"\\\\?>" update_xml "${update_xml}")
     string(REGEX REPLACE "<GCC_XML[^>]*>" "<GCC_XML[^>]*>" update_xml "${update_xml}")
+    string(REGEX REPLACE "([()])" "\\\\\\1" update_xml "${update_xml}")
     string(REGEX REPLACE "mangled=\"[^\"]*\"" "mangled=\"[^\"]+\"" update_xml "${update_xml}")
     string(REGEX REPLACE "artificial=\"1\"( throw=\"\")?" "artificial=\"1\"( throw=\"\")?" update_xml "${update_xml}")
     string(REGEX REPLACE "size=\"[0-9]+\" align=\"[0-9]+\"" "size=\"[0-9]+\" align=\"[0-9]+\"" update_xml "${update_xml}")
     string(REGEX REPLACE "<File id=\"(f[0-9]+)\" name=\"[^\"]*/test/input/([^\"]*)\"/>" "<File id=\"\\1\" name=\".*/test/input/\\2\"/>" update_xml "${update_xml}")
+    if(update_xml MATCHES "<Base.*<Base") # multiple inheritance has ABI-specific offsets
+      string(REGEX REPLACE "<Base type=\"([^\"]*)\" access=\"([^\"]*)\" virtual=\"0\" offset=\"[0-9]+\"/>" "<Base type=\"\\1\" access=\"\\2\" virtual=\"0\" offset=\"[0-9]+\"/>" update_xml "${update_xml}")
+    endif()
     string(REGEX REPLACE "</GCC_XML>$" "</GCC_XML>$" update_xml "${update_xml}")
     file(WRITE "${expect_xml_file}" "${update_xml}\n")
   endif()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/castxml.git



More information about the debian-med-commit mailing list