Index: cpukit/sapi/Makefile.am
===================================================================
--- cpukit/sapi/Makefile.am	(revision 748a12629ad074fcb414c9b6e64c7d7ba1683539)
+++ cpukit/sapi/Makefile.am	(revision 6f3fb8a547f5700416744a7dc82b3cb83177c7a8)
@@ -23,4 +23,5 @@
 include_rtems_HEADERS += include/rtems/timecounter.h
 include_rtems_HEADERS += include/rtems/timespec.h
+include_rtems_HEADERS += include/rtems/version.h
 
 EXTRA_DIST = include/rtems/README
@@ -35,5 +36,5 @@
     src/chainappendnotify.c src/chaingetnotify.c src/chaingetwait.c \
     src/chainprependnotify.c src/rbheap.c src/interrtext.c \
-    src/fatalsrctext.c
+    src/fatalsrctext.c src/version.c
 libsapi_a_SOURCES += src/chainprotected.c
 libsapi_a_SOURCES += src/cpucounterconverter.c
@@ -48,4 +49,39 @@
 libsapi_a_CPPFLAGS = $(AM_CPPFLAGS)
 
+#
+# Create a new Version VC Key header if the VC state has changed.
+#
+vc_key_stamp = $(am__leading_dot)vc-key-stamp
+
+libsapi_a_CPPFLAGS += -I.
+
+BUILT_SOURCES = version-vc-key.h
+
+.PHONY: $(vc_key_stamp)
+
+$(vc_key_stamp):
+
+version-vc-key.h: $(vc_key_stamp)
+	@+current_vc_key=""; \
+	if test -f $(vc_key_stamp); then \
+	 current_vc_key=`cat $(vc_key_stamp)`; \
+	fi; \
+	vc_key=`$(top_srcdir)/sapi/vc-key.sh $(top_srcdir) $$current_vc_key`; \
+	if test "$$vc_key" != "matches"; then \
+	 echo "Generating version-vc-key.h"; \
+	 if test "$$vc_key" == "release"; then \
+	  vc_header_key="\/\* No version control key found; release\? \*\/"; \
+	 else \
+	  vc_header_key="#define RTEMS_VERSION_VC_KEY \"$$vc_key\""; \
+	 fi; \
+	 cat $(top_srcdir)/sapi/version-vc-key.h.in | \
+	  sed -e "s/@VERSION_VC_KEY@/$$vc_header_key/g" > version-vc-key.h; \
+	 echo "$$vc_key" > $(vc_key_stamp); \
+	fi
+
+version.$(OBJEXT):$ version-vc-key.h
+
+all-local: version-vc-key.h
+
 include $(srcdir)/preinstall.am
 include $(top_srcdir)/automake/local.am
Index: cpukit/sapi/include/rtems/version.h
===================================================================
--- cpukit/sapi/include/rtems/version.h	(revision 6f3fb8a547f5700416744a7dc82b3cb83177c7a8)
+++ cpukit/sapi/include/rtems/version.h	(revision 6f3fb8a547f5700416744a7dc82b3cb83177c7a8)
@@ -0,0 +1,77 @@
+/**
+ * @file
+ *
+ * @brief Version API.
+ */
+
+/*
+ *  Copyright (C) 2017.
+ *  Chris Johns <chrisj@rtems.org>
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.org/license/LICENSE.
+ */
+
+#ifndef _RTEMS_VERSION_H
+#define _RTEMS_VERSION_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @defgroup ClassicVersion Version
+ *
+ * @ingroup ClassicVersion
+ *
+ * @brief The Version API provides functions to return the version or parts of
+ * the version of RTEMS you are using.
+ */
+/**@{**/
+
+/**
+ * @brief Returns the version string.
+ *
+ * @retval text The version as a string.
+ */
+const char *rtems_version( void );
+
+/**
+ * @brief Returns the version's major number.
+ *
+ * @retval int The version's major number.
+ */
+int rtems_version_major( void );
+
+/**
+ * @brief Returns the version's minor number.
+ *
+ * @retval int The version's minor number.
+ */
+int rtems_version_minor( void );
+
+/**
+ * @brief Returns the version's revision number.
+ *
+ * @retval int The version's revision number.
+ */
+int rtems_version_revision( void );
+
+/**
+ * @brief Returns the version control key for the current version of code that
+ * has been built. The key is specific to the version control system being used
+ * and allows the built version to be identified.
+ *
+ * @retval int The version's version control key.
+ */
+const char *rtems_version_control_key( void );
+
+/** @} */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+/* end of include file */
Index: cpukit/sapi/preinstall.am
===================================================================
--- cpukit/sapi/preinstall.am	(revision 748a12629ad074fcb414c9b6e64c7d7ba1683539)
+++ cpukit/sapi/preinstall.am	(revision 6f3fb8a547f5700416744a7dc82b3cb83177c7a8)
@@ -95,2 +95,6 @@
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/timespec.h
 
+$(PROJECT_INCLUDE)/rtems/version.h: include/rtems/version.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
+	$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/version.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/version.h
+
Index: cpukit/sapi/src/version.c
===================================================================
--- cpukit/sapi/src/version.c	(revision 6f3fb8a547f5700416744a7dc82b3cb83177c7a8)
+++ cpukit/sapi/src/version.c	(revision 6f3fb8a547f5700416744a7dc82b3cb83177c7a8)
@@ -0,0 +1,63 @@
+/**
+ * @file
+ *
+ * @brief Creates the version strings from the various pieces of version
+ * information. The main version number is part of the build system and is
+ * stamped into rtems/score/cpuopts.h. The version control key string is
+ * extracted from the version control tool when the code is being built and is
+ * updated if it has changed. The key may indicate there are local
+ * modification.
+ *
+ * @ingroup ClassicVersion
+ */
+
+/*
+ *  Copyright (C) 2017.
+ *  Chris Johns <chrisj@rtems.org>
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.org/license/LICENSE.
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems.h>
+#include <rtems/version.h>
+
+#include "version-vc-key.h"
+
+const char *rtems_version( void )
+{
+#ifdef RTEMS_VERSION_VC_KEY
+  return RTEMS_VERSION "." RTEMS_VERSION_VC_KEY;
+#else
+  return RTEMS_VERSION;
+#endif
+}
+
+int rtems_version_major( void )
+{
+  return __RTEMS_MAJOR__;
+}
+
+int rtems_version_minor( void )
+{
+  return __RTEMS_MINOR__;
+}
+
+int rtems_version_revision( void )
+{
+  return __RTEMS_REVISION__;
+}
+
+const char *rtems_version_control_key( void )
+{
+#ifdef RTEMS_VERSION_VC_KEY
+  return RTEMS_VERSION_VC_KEY;
+#else
+  return NULL;
+#endif
+}
Index: cpukit/sapi/vc-key.sh
===================================================================
--- cpukit/sapi/vc-key.sh	(revision 6f3fb8a547f5700416744a7dc82b3cb83177c7a8)
+++ cpukit/sapi/vc-key.sh	(revision 6f3fb8a547f5700416744a7dc82b3cb83177c7a8)
@@ -0,0 +1,39 @@
+#! /bin/sh
+
+git=$(command -v git)
+
+#
+# Git command not found or not a valid git repo is a release.
+#
+vc_ident="release"
+
+if test $# -ge 1; then
+ repo=$1
+ shift
+ if test -d $repo; then
+  cwd=$(pwd)
+  cd $repo
+  if test -n ${git}; then
+   git rev-parse --git-dir > /dev/null 2>&1
+   if test $? == 0; then
+    git status > /dev/null 2>&1
+    if git diff-index --quiet HEAD --; then
+     modified=""
+    else
+     modified="-modified"
+    fi
+    vc_ident="$(git rev-parse --verify HEAD)${modified}"
+    if test $# -ge 1; then
+     if test "${vc_ident}" == "$1"; then
+      vc_ident="matches"
+     fi
+    fi
+   fi
+  fi
+  cd $cwd
+ fi
+fi
+
+echo ${vc_ident}
+
+exit 0
Index: cpukit/sapi/version-vc-key.h.in
===================================================================
--- cpukit/sapi/version-vc-key.h.in	(revision 6f3fb8a547f5700416744a7dc82b3cb83177c7a8)
+++ cpukit/sapi/version-vc-key.h.in	(revision 6f3fb8a547f5700416744a7dc82b3cb83177c7a8)
@@ -0,0 +1,7 @@
+/*
+ * Automatically generated. Do not edit.
+ */
+#if !defined(_RTEMS_VERSION_VC_KEY_H_)
+#define _RTEMS_VERSION_VC_KEY_H_
+@VERSION_VC_KEY@
+#endif
Index: testsuites/sptests/Makefile.am
===================================================================
--- testsuites/sptests/Makefile.am	(revision 748a12629ad074fcb414c9b6e64c7d7ba1683539)
+++ testsuites/sptests/Makefile.am	(revision 6f3fb8a547f5700416744a7dc82b3cb83177c7a8)
@@ -83,4 +83,5 @@
 _SUBDIRS += spclock_err02
 _SUBDIRS += spcpuset01
+_SUBDIRS += spversion01
 
 include $(top_srcdir)/../automake/subdirs.am
Index: testsuites/sptests/configure.ac
===================================================================
--- testsuites/sptests/configure.ac	(revision 748a12629ad074fcb414c9b6e64c7d7ba1683539)
+++ testsuites/sptests/configure.ac	(revision 6f3fb8a547f5700416744a7dc82b3cb83177c7a8)
@@ -254,4 +254,5 @@
 sppartition_err01/Makefile
 sprmsched01/Makefile
+spversion01/Makefile
 ])
 AC_OUTPUT
Index: testsuites/sptests/spversion01/Makefile.am
===================================================================
--- testsuites/sptests/spversion01/Makefile.am	(revision 6f3fb8a547f5700416744a7dc82b3cb83177c7a8)
+++ testsuites/sptests/spversion01/Makefile.am	(revision 6f3fb8a547f5700416744a7dc82b3cb83177c7a8)
@@ -0,0 +1,20 @@
+
+rtems_tests_PROGRAMS = spversion01
+spversion01_SOURCES = init.c
+
+dist_rtems_tests_DATA = spversion01.scn spversion01.doc
+
+include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
+include $(top_srcdir)/../automake/compile.am
+include $(top_srcdir)/../automake/leaf.am
+
+AM_CPPFLAGS += -I$(top_srcdir)/../support/include
+
+LINK_OBJS = $(spversion01_OBJECTS)
+LINK_LIBS = $(spversion01_LDLIBS)
+
+spversion01$(EXEEXT): $(spversion01_OBJECTS) $(spversion01_DEPENDENCIES)
+	@rm -f spversion01$(EXEEXT)
+	$(make-exe)
+
+include $(top_srcdir)/../automake/local.am
Index: testsuites/sptests/spversion01/init.c
===================================================================
--- testsuites/sptests/spversion01/init.c	(revision 6f3fb8a547f5700416744a7dc82b3cb83177c7a8)
+++ testsuites/sptests/spversion01/init.c	(revision 6f3fb8a547f5700416744a7dc82b3cb83177c7a8)
@@ -0,0 +1,58 @@
+/*
+ *  COPYRIGHT (c) 1989-2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems.h>
+#include <rtems/version.h>
+
+#include <tmacros.h>
+
+const char rtems_test_name[] = "VERSION 1";
+
+static rtems_task Init(
+  rtems_task_argument argument
+)
+{
+  TEST_BEGIN();
+
+  printf("Release  : %s\n", rtems_version());
+  printf("Major    : %d\n", rtems_version_major());
+  printf("Minor    : %d\n", rtems_version_minor());
+  printf("Revision : %d\n", rtems_version_revision());
+  printf("VC Key   : %s\n", rtems_version_control_key());
+
+  TEST_END();
+
+  rtems_test_exit(0);
+}
+
+/* configuration information */
+
+#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_EXTRA_TASK_STACKS         (4 * RTEMS_MINIMUM_STACK_SIZE)
+#define CONFIGURE_MAXIMUM_TASKS             2
+
+#define CONFIGURE_DISABLE_SMP_CONFIGURATION
+
+#define CONFIGURE_INIT
+
+#include <rtems/confdefs.h>
+
+/* global variables */
+
+/* end of include file */
Index: testsuites/sptests/spversion01/spversion01.scn
===================================================================
--- testsuites/sptests/spversion01/spversion01.scn	(revision 6f3fb8a547f5700416744a7dc82b3cb83177c7a8)
+++ testsuites/sptests/spversion01/spversion01.scn	(revision 6f3fb8a547f5700416744a7dc82b3cb83177c7a8)
@@ -0,0 +1,21 @@
+Valid version control:
+
+*** BEGIN OF TEST VERSION 1 ***
+Release  : 4.11.99.0.d71542c8bef50261bc3904ef6a17f0b6087d04d9-modified
+Major    : 4
+Minor    : 11
+Revision : 99
+VC Key   : d71542c8bef50261bc3904ef6a17f0b6087d04d9-modified
+
+*** END OF TEST VERSION 1 ***
+
+No valid version control:
+
+*** BEGIN OF TEST VERSION 1 ***
+Release  : 4.11.99.0
+Major    : 4
+Minor    : 11
+Revision : 99
+VC Key   : (null)
+
+*** END OF TEST VERSION 1 ***
