Index: trunk/psModules/src/config/Makefile.am
===================================================================
--- trunk/psModules/src/config/Makefile.am	(revision 22715)
+++ trunk/psModules/src/config/Makefile.am	(revision 23117)
@@ -1,5 +1,14 @@
 noinst_LTLIBRARIES = libpsmodulesconfig.la
 
-libpsmodulesconfig_la_CPPFLAGS = $(SRCINC) $(PSMODULES_CFLAGS)
+PSMODULES_VERSION=`if [ -e ../../VERSION ]; then cat ../../VERSION; else svnversion; fi`
+PSMODULES_BRANCH=`if [ -e ../../BRANCH ]; then cat ../../BRANCH; else svn info | sed -n -e '/URL:/ h' -e '/Repository Root:/ { x; H; x; s|Repository Root: \(.*\)\nURL: \1\(.*\)|\2| ; s|^/|| ; s|/[a-zA-Z]*/src.*|| ; p }'; fi`
+PSMODULES_SOURCE=`if [ -e ../../SOURCE ]; then cat ../../SOURCE; else svn info | sed -n -e 's/Repository UUID: // p'; fi`
+
+# Force recompilation of pmVersion.c, since it gets the version information
+pmVersion.c: FORCE
+	touch pmVersion.c
+FORCE: ;
+
+libpsmodulesconfig_la_CPPFLAGS = $(SRCINC) $(PSMODULES_CFLAGS) -DPSMODULES_VERSION=\"$(PSMODULES_VERSION)\" -DPSMODULES_BRANCH=\"$(PSMODULES_BRANCH)\" -DPSMODULES_SOURCE=\"$(PSMODULES_SOURCE)\"
 libpsmodulesconfig_la_LDFLAGS  = -release $(PACKAGE_VERSION)
 libpsmodulesconfig_la_SOURCES  = \
Index: trunk/psModules/src/config/pmVersion.c
===================================================================
--- trunk/psModules/src/config/pmVersion.c	(revision 22715)
+++ trunk/psModules/src/config/pmVersion.c	(revision 23117)
@@ -8,21 +8,39 @@
 #include "pmVersion.h"
 
-static const char *cvsTag = "$Name: not supported by cvs2svn $";// CVS tag name
-
 psString psModulesVersion(void)
 {
-    psString version = NULL;            // Version, to return
-    psStringAppend(&version, "%s-%s",PACKAGE_NAME,PACKAGE_VERSION);
-    return version;
+#ifndef PSMODULES_VERSION
+#error "PSMODULES_VERSION is not set"
+#endif
+#ifndef PSMODULES_BRANCH
+#error "PSMODULES_BRANCH is not set"
+#endif
+    return psStringCopy(PSMODULES_BRANCH "@" PSMODULES_VERSION);
 }
+
+psString psModulesSource(void)
+{
+#ifndef PSMODULES_SOURCE
+#error "PSMODULES_SOURCE is not set"
+#endif
+    return psStringCopy(PSMODULES_SOURCE);
+}
+
 
 psString psModulesVersionLong(void)
 {
-    psString version = psModulesVersion(); // Version, to return
-    psString tag = psStringStripCVS(cvsTag, "Name"); // CVS tag
+    psString version = psModulesVersion();  // Version, to return
+    psString source = psModulesSource();    // Source
 
-    psStringAppend(&version, " (cvs tag %s) %s, %s", tag, __DATE__, __TIME__);
+    psStringPrepend(&version, "psModules ");
+    psStringAppend(&version, " from %s, built %s, %s", source, __DATE__, __TIME__);
+    psFree(source);
 
-    psFree(tag);
+#ifdef __OPTIMIZE__
+    psStringAppend(&version, " optimised");
+#else
+    psStringAppend(&version, " unoptimised");
+#endif
+
     return version;
-}
+};
Index: trunk/psModules/src/config/pmVersion.h
===================================================================
--- trunk/psModules/src/config/pmVersion.h	(revision 22715)
+++ trunk/psModules/src/config/pmVersion.h	(revision 23117)
@@ -1,8 +1,8 @@
 /*  @file pmVersion.h
  *  @brief Version functions
- * 
+ *
  *  @author Paul Price, IfA
  *  @author Eugene Magnier, IfA
- * 
+ *
  *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
  *  @date $Date: 2007-03-30 21:12:56 $
@@ -22,7 +22,13 @@
  *  @return psString: String with version name.
  */
-psString psModulesVersion(
-    void
-);
+psString psModulesVersion(void);
+
+/** Get current psModules source
+ *
+ *  Returns the current psModules source as a string.
+ *
+ *  @return psString: String with source.
+ */
+psString psModulesSource(void);
 
 /** Get current psModules version (full identification)
