Index: trunk/pswarp/src/Makefile.am
===================================================================
--- trunk/pswarp/src/Makefile.am	(revision 23790)
+++ trunk/pswarp/src/Makefile.am	(revision 23806)
@@ -1,10 +1,26 @@
 bin_PROGRAMS = pswarp
 
+if HAVE_SVNVERSION
+PSWARP_VERSION=`$(SVNVERSION) ../..`
+else
+PSWARP_VERSION="UNKNOWN"
+endif
+
+if HAVE_SVN
+PSWARP_BRANCH=`$(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 }'`
+PSWARP_SOURCE=`$(SVN) info | $(SED) -n -e 's/Repository UUID: // p'`
+else
+PSWARP_BRANCH="UNKNOWN"
+PSWARP_SOURCE="UNKNOWN"
+endif
+
 # Force recompilation of pswarpVersion.c, since it gets the version information
-pswarpVersion.c: FORCE
-	touch pswarpVersion.c
+pswarpVersion.c: pswarpVersionDefinitions.h
+pswarpVersionDefinitions.h: pswarpVersionDefinitions.h.in FORCE
+	-$(RM) pswarpVersionDefinitions.h
+	$(SED) -e "s|@PSWARP_VERSION@|\"$(PSWARP_VERSION)\"|" -e "s|@PSWARP_BRANCH@|\"$(PSWARP_BRANCH)\"|" -e "s|@PSWARP_SOURCE@|\"$(PSWARP_SOURCE)\"|" pswarpVersionDefinitions.h.in > pswarpVersionDefinitions.h
 FORCE: ;
 
-pswarp_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PPSTATS_CFLAGS) $(PSPHOT_CFLAGS) $(PSWARP_CFLAGS) -DPSWARP_VERSION=\"$(PSWARP_VERSION)\" -DPSWARP_BRANCH=\"$(PSWARP_BRANCH)\" -DPSWARP_SOURCE=\"$(PSWARP_SOURCE)\"
+pswarp_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PPSTATS_CFLAGS) $(PSPHOT_CFLAGS) $(PSWARP_CFLAGS)
 pswarp_LDFLAGS = $(PSLIB_LIBS) $(PSMODULE_LIBS) $(PPSTATS_LIBS) $(PSPHOT_LIBS) $(PSWARP_LIBS)
 
Index: trunk/pswarp/src/pswarpVersion.c
===================================================================
--- trunk/pswarp/src/pswarpVersion.c	(revision 23790)
+++ trunk/pswarp/src/pswarpVersion.c	(revision 23806)
@@ -20,6 +20,7 @@
 #include <ppStats.h>
 
-psString pswarpVersion(void)
-{
+#include "pswarp.h"
+#include "pswarpVersionDefinitions.h"
+
 #ifndef PSWARP_VERSION
 #error "PSWARP_VERSION is not set"
@@ -28,12 +29,17 @@
 #error "PSWARP_BRANCH is not set"
 #endif
-    return psStringCopy(PSWARP_BRANCH "@" PSWARP_VERSION);
+#ifndef PSWARP_SOURCE
+#error "PSWARP_SOURCE is not set"
+#endif
+
+psString pswarpVersion(void)
+{
+    char *value = NULL;
+    psStringAppend(&value, "%s@%s", PSWARP_BRANCH, PSWARP_VERSION);
+    return value;
 }
 
 psString pswarpSource(void)
 {
-#ifndef PSWARP_SOURCE
-#error "PSWARP_SOURCE is not set"
-#endif
     return psStringCopy(PSWARP_SOURCE);
 }
Index: trunk/pswarp/src/pswarpVersionDefinitions.h.in
===================================================================
--- trunk/pswarp/src/pswarpVersionDefinitions.h.in	(revision 23806)
+++ trunk/pswarp/src/pswarpVersionDefinitions.h.in	(revision 23806)
@@ -0,0 +1,8 @@
+#ifndef PSWARP_VERSION_DEFINITIONS_H
+#define PSWARP_VERSION_DEFINITIONS_H
+
+#define PSWARP_VERSION @PSWARP_VERSION@ // SVN version
+#define PSWARP_BRANCH  @PSWARP_BRANCH@  // SVN branch
+#define PSWARP_SOURCE  @PSWARP_SOURCE@  // SVN source
+
+#endif
