Index: /branches/eam_branches/ipp-20150112/magic/censorObjects/src/Makefile.am
===================================================================
--- /branches/eam_branches/ipp-20150112/magic/censorObjects/src/Makefile.am	(revision 38049)
+++ /branches/eam_branches/ipp-20150112/magic/censorObjects/src/Makefile.am	(revision 38050)
@@ -1,21 +1,7 @@
-if HAVE_SVNVERSION
-CENSOR_VERSION=`$(SVNVERSION) ..`
-else
-CENSOR_VERSION="UNKNOWN"
-endif
-
-if HAVE_SVN
-CENSOR_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 }'`
-CENSOR_SOURCE=`$(SVN) info | $(SED) -n -e 's/Repository UUID: // p'`
-else
-CENSOR_BRANCH="UNKNOWN"
-CENSOR_SOURCE="UNKNOWN"
-endif
 
 # Force recompilation of censorVersion.c, since it gets the version information
 censorVersion.c: censorVersionDefinitions.h
 censorVersionDefinitions.h: censorVersionDefinitions.h.in FORCE
-	-$(RM) censorVersionDefinitions.h
-	$(SED) -e "s|@CENSOR_VERSION@|\"$(CENSOR_VERSION)\"|" -e "s|@CENSOR_BRANCH@|\"$(CENSOR_BRANCH)\"|" -e "s|@CENSOR_SOURCE@|\"$(CENSOR_SOURCE)\"|" censorVersionDefinitions.h.in > censorVersionDefinitions.h
+	pslib-setsvnversion.pl CENSOR censorVersionDefinitions.h.in censorVersionDefinitions.h
 FORCE: ;
 
Index: /branches/eam_branches/ipp-20150112/magic/remove/src/Makefile.am
===================================================================
--- /branches/eam_branches/ipp-20150112/magic/remove/src/Makefile.am	(revision 38049)
+++ /branches/eam_branches/ipp-20150112/magic/remove/src/Makefile.am	(revision 38050)
@@ -1,21 +1,7 @@
-if HAVE_SVNVERSION
-STREAKS_VERSION=`$(SVNVERSION) ..`
-else
-STREAKS_VERSION="UNKNOWN"
-endif
-
-if HAVE_SVN
-STREAKS_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 }'`
-STREAKS_SOURCE=`$(SVN) info | $(SED) -n -e 's/Repository UUID: // p'`
-else
-STREAKS_BRANCH="UNKNOWN"
-STREAKS_SOURCE="UNKNOWN"
-endif
 
 # Force recompilation of streaksVersion.c, since it gets the version information
 streaksVersion.c: streaksVersionDefinitions.h
 streaksVersionDefinitions.h: streaksVersionDefinitions.h.in FORCE
-	-$(RM) streaksVersionDefinitions.h
-	$(SED) -e "s|@STREAKS_VERSION@|\"$(STREAKS_VERSION)\"|" -e "s|@STREAKS_BRANCH@|\"$(STREAKS_BRANCH)\"|" -e "s|@STREAKS_SOURCE@|\"$(STREAKS_SOURCE)\"|" streaksVersionDefinitions.h.in > streaksVersionDefinitions.h
+	pslib-setsvnversion.pl STREAKS streaksVersionDefinitions.h.in streaksVersionDefinitions.h
 FORCE: ;
 
Index: /branches/eam_branches/ipp-20150112/ppArith/src/Makefile.am
===================================================================
--- /branches/eam_branches/ipp-20150112/ppArith/src/Makefile.am	(revision 38049)
+++ /branches/eam_branches/ipp-20150112/ppArith/src/Makefile.am	(revision 38050)
@@ -1,23 +1,8 @@
 bin_PROGRAMS = ppArith
-
-if HAVE_SVNVERSION
-PPARITH_VERSION=`$(SVNVERSION) ..`
-else
-PPARITH_VERSION="UNKNOWN"
-endif
-
-if HAVE_SVN
-PPARITH_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 }'`
-PPARITH_SOURCE=`$(SVN) info | $(SED) -n -e 's/Repository UUID: // p'`
-else
-PPARITH_BRANCH="UNKNOWN"
-PPARITH_SOURCE="UNKNOWN"
-endif
 
 # Force recompilation of ppArithVersion.c, since it gets the version information
 ppArithVersion.c: ppArithVersionDefinitions.h
 ppArithVersionDefinitions.h: ppArithVersionDefinitions.h.in FORCE
-	-$(RM) ppArithVersionDefinitions.h
-	$(SED) -e "s|@PPARITH_VERSION@|\"$(PPARITH_VERSION)\"|" -e "s|@PPARITH_BRANCH@|\"$(PPARITH_BRANCH)\"|" -e "s|@PPARITH_SOURCE@|\"$(PPARITH_SOURCE)\"|" ppArithVersionDefinitions.h.in > ppArithVersionDefinitions.h
+	pslib-setsvnversion.pl PPARITH ppArithVersionDefinitions.h.in ppArithVersionDefinitions.h
 FORCE: ;
 
Index: /branches/eam_branches/ipp-20150112/ppBackground/src/Makefile.am
===================================================================
--- /branches/eam_branches/ipp-20150112/ppBackground/src/Makefile.am	(revision 38049)
+++ /branches/eam_branches/ipp-20150112/ppBackground/src/Makefile.am	(revision 38050)
@@ -1,23 +1,8 @@
 bin_PROGRAMS = ppBackground ppBackgroundStack
-
-if HAVE_SVNVERSION
-PPBACKGROUND_VERSION=`$(SVNVERSION) ..`
-else
-PPBACKGROUND_VERSION="UNKNOWN"
-endif
-
-if HAVE_SVN
-PPBACKGROUND_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 }'`
-PPBACKGROUND_SOURCE=`$(SVN) info | $(SED) -n -e 's/Repository UUID: // p'`
-else
-PPBACKGROUND_BRANCH="UNKNOWN"
-PPBACKGROUND_SOURCE="UNKNOWN"
-endif
 
 # Force recompilation of ppBackgroundVersion.c, since it gets the version information
 ppBackgroundVersion.c: ppBackgroundVersionDefinitions.h
 ppBackgroundVersionDefinitions.h: ppBackgroundVersionDefinitions.h.in FORCE
-	-$(RM) ppBackgroundVersionDefinitions.h
-	$(SED) -e "s|@PPBACKGROUND_VERSION@|\"$(PPBACKGROUND_VERSION)\"|" -e "s|@PPBACKGROUND_BRANCH@|\"$(PPBACKGROUND_BRANCH)\"|" -e "s|@PPBACKGROUND_SOURCE@|\"$(PPBACKGROUND_SOURCE)\"|" ppBackgroundVersionDefinitions.h.in > ppBackgroundVersionDefinitions.h
+	pslib-setsvnversion.pl PPBACKGROUND ppBackgroundVersionDefinitions.h.in ppBackgroundVersionDefinitions.h
 FORCE: ;
 
Index: /branches/eam_branches/ipp-20150112/ppImage/src/Makefile.am
===================================================================
--- /branches/eam_branches/ipp-20150112/ppImage/src/Makefile.am	(revision 38049)
+++ /branches/eam_branches/ipp-20150112/ppImage/src/Makefile.am	(revision 38050)
@@ -4,23 +4,8 @@
 	ppImage.h
 
-if HAVE_SVNVERSION
-PPIMAGE_VERSION=`$(SVNVERSION) ..`
-else
-PPIMAGE_VERSION="UNKNOWN"
-endif
-
-if HAVE_SVN
-PPIMAGE_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 }'`
-PPIMAGE_SOURCE=`$(SVN) info | $(SED) -n -e 's/Repository UUID: // p'`
-else
-PPIMAGE_BRANCH="UNKNOWN"
-PPIMAGE_SOURCE="UNKNOWN"
-endif
-
 # Force recompilation of ppImageVersion.c, since it gets the version information
 ppImageVersion.c: ppImageVersionDefinitions.h
 ppImageVersionDefinitions.h: ppImageVersionDefinitions.h.in FORCE
-	-$(RM) ppImageVersionDefinitions.h
-	$(SED) -e "s|@PPIMAGE_VERSION@|\"$(PPIMAGE_VERSION)\"|" -e "s|@PPIMAGE_BRANCH@|\"$(PPIMAGE_BRANCH)\"|" -e "s|@PPIMAGE_SOURCE@|\"$(PPIMAGE_SOURCE)\"|" ppImageVersionDefinitions.h.in > ppImageVersionDefinitions.h
+	pslib-setsvnversion.pl PPIMAGE ppImageVersionDefinitions.h.in ppImageVersionDefinitions.h
 FORCE: ;
 
Index: /branches/eam_branches/ipp-20150112/ppMerge/src/Makefile.am
===================================================================
--- /branches/eam_branches/ipp-20150112/ppMerge/src/Makefile.am	(revision 38049)
+++ /branches/eam_branches/ipp-20150112/ppMerge/src/Makefile.am	(revision 38050)
@@ -1,25 +1,9 @@
 bin_PROGRAMS = ppMerge
-
-if HAVE_SVNVERSION
-PPMERGE_VERSION=`$(SVNVERSION) ..`
-else
-PPMERGE_VERSION="UNKNOWN"
-endif
-
-if HAVE_SVN
-PPMERGE_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 }'`
-PPMERGE_SOURCE=`$(SVN) info | $(SED) -n -e 's/Repository UUID: // p'`
-else
-PPMERGE_BRANCH="UNKNOWN"
-PPMERGE_SOURCE="UNKNOWN"
-endif
 
 # Force recompilation of ppMergeVersion.c, since it gets the version information
 ppMergeVersion.c: ppMergeVersionDefinitions.h
 ppMergeVersionDefinitions.h: ppMergeVersionDefinitions.h.in FORCE
-	-$(RM) ppMergeVersionDefinitions.h
-	$(SED) -e "s|@PPMERGE_VERSION@|\"$(PPMERGE_VERSION)\"|" -e "s|@PPMERGE_BRANCH@|\"$(PPMERGE_BRANCH)\"|" -e "s|@PPMERGE_SOURCE@|\"$(PPMERGE_SOURCE)\"|" ppMergeVersionDefinitions.h.in > ppMergeVersionDefinitions.h
+	pslib-setsvnversion.pl PPMERGE ppMergeVersionDefinitions.h.in ppMergeVersionDefinitions.h
 FORCE: ;
-
 
 ppMerge_CFLAGS = $(PPMERGE_CFLAGS) $(PPSTATS_CFLAGS) $(PSMODULE_CFLAGS) $(PSLIB_CFLAGS)
Index: /branches/eam_branches/ipp-20150112/ppNoiseMap/src/Makefile.am
===================================================================
--- /branches/eam_branches/ipp-20150112/ppNoiseMap/src/Makefile.am	(revision 38049)
+++ /branches/eam_branches/ipp-20150112/ppNoiseMap/src/Makefile.am	(revision 38050)
@@ -4,23 +4,8 @@
 	ppNoiseMap.h 
 
-if HAVE_SVNVERSION
-PPNOISEMAP_VERSION=`$(SVNVERSION) ..`
-else
-PPNOISEMAP_VERSION="UNKNOWN"
-endif
-
-if HAVE_SVN
-PPIMAGE_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 }'`
-PPIMAGE_SOURCE=`$(SVN) info | $(SED) -n -e 's/Repository UUID: // p'`
-else
-PPIMAGE_BRANCH="UNKNOWN"
-PPIMAGE_SOURCE="UNKNOWN"
-endif
-
 # Force recompilation of ppNoiseMapVersion.c, since it gets the version information
 ppNoiseMapVersion.c: ppNoiseMapVersionDefinitions.h
 ppNoiseMapVersionDefinitions.h: ppNoiseMapVersionDefinitions.h.in FORCE
-	-$(RM) ppNoiseMapVersionDefinitions.h
-	$(SED) -e "s|@PPNOISEMAP_VERSION@|\"$(PPNOISEMAP_VERSION)\"|" -e "s|@PPNOISEMAP_BRANCH@|\"$(PPNOISEMAP_BRANCH)\"|" -e "s|@PPNOISEMAP_SOURCE@|\"$(PPNOISEMAP_SOURCE)\"|" ppNoiseMapVersionDefinitions.h.in > ppNoiseMapVersionDefinitions.h
+	pslib-setsvnversion.pl PPNOISEMAP ppNoiseMapVersionDefinitions.h.in ppNoiseMapVersionDefinitions.h
 FORCE: ;
 
Index: /branches/eam_branches/ipp-20150112/ppSkycell/src/Makefile.am
===================================================================
--- /branches/eam_branches/ipp-20150112/ppSkycell/src/Makefile.am	(revision 38049)
+++ /branches/eam_branches/ipp-20150112/ppSkycell/src/Makefile.am	(revision 38050)
@@ -1,23 +1,8 @@
 bin_PROGRAMS = ppSkycell
-
-if HAVE_SVNVERSION
-PPSKYCELL_VERSION=`$(SVNVERSION) ..`
-else
-PPSKYCELL_VERSION="UNKNOWN"
-endif
-
-if HAVE_SVN
-PPSKYCELL_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 }'`
-PPSKYCELL_SOURCE=`$(SVN) info | $(SED) -n -e 's/Repository UUID: // p'`
-else
-PPSKYCELL_BRANCH="UNKNOWN"
-PPSKYCELL_SOURCE="UNKNOWN"
-endif
 
 # Force recompilation of ppSkycellVersion.c, since it gets the version information
 ppSkycellVersion.c: ppSkycellVersionDefinitions.h
 ppSkycellVersionDefinitions.h: ppSkycellVersionDefinitions.h.in FORCE
-	-$(RM) ppSkycellVersionDefinitions.h
-	$(SED) -e "s|@PPSKYCELL_VERSION@|\"$(PPSKYCELL_VERSION)\"|" -e "s|@PPSKYCELL_BRANCH@|\"$(PPSKYCELL_BRANCH)\"|" -e "s|@PPSKYCELL_SOURCE@|\"$(PPSKYCELL_SOURCE)\"|" ppSkycellVersionDefinitions.h.in > ppSkycellVersionDefinitions.h
+	pslib-setsvnversion.pl PPSKYCELL ppSkycellVersionDefinitions.h.in ppSkycellVersionDefinitions.h
 FORCE: ;
 
Index: /branches/eam_branches/ipp-20150112/ppSmooth/src/Makefile.am
===================================================================
--- /branches/eam_branches/ipp-20150112/ppSmooth/src/Makefile.am	(revision 38049)
+++ /branches/eam_branches/ipp-20150112/ppSmooth/src/Makefile.am	(revision 38050)
@@ -3,23 +3,8 @@
 noinst_HEADERS = ppSmooth.h 
 
-if HAVE_SVNVERSION
-PPSMOOTH_VERSION=`$(SVNVERSION) ..`
-else
-PPSMOOTH_VERSION="UNKNOWN"
-endif
-
-if HAVE_SVN
-PPSMOOTH_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 }'`
-PPSMOOTH_SOURCE=`$(SVN) info | $(SED) -n -e 's/Repository UUID: // p'`
-else
-PPSMOOTH_BRANCH="UNKNOWN"
-PPSMOOTH_SOURCE="UNKNOWN"
-endif
-
 # Force recompilation of ppSmoothVersion.c, since it gets the version information
 ppSmoothVersion.c: ppSmoothVersionDefinitions.h
 ppSmoothVersionDefinitions.h: ppSmoothVersionDefinitions.h.in FORCE
-	-$(RM) ppSmoothVersionDefinitions.h
-	$(SED) -e "s|@PPSMOOTH_VERSION@|\"$(PPSMOOTH_VERSION)\"|" -e "s|@PPSMOOTH_BRANCH@|\"$(PPSMOOTH_BRANCH)\"|" -e "s|@PPSMOOTH_SOURCE@|\"$(PPSMOOTH_SOURCE)\"|" ppSmoothVersionDefinitions.h.in > ppSmoothVersionDefinitions.h
+	pslib-setsvnversion.pl PPSMOOTH ppSmoothVersionDefinitions.h.in ppSmoothVersionDefinitions.h
 FORCE: ;
 
Index: /branches/eam_branches/ipp-20150112/ppStats/src/Makefile.am
===================================================================
--- /branches/eam_branches/ipp-20150112/ppStats/src/Makefile.am	(revision 38049)
+++ /branches/eam_branches/ipp-20150112/ppStats/src/Makefile.am	(revision 38050)
@@ -1,23 +1,8 @@
 lib_LTLIBRARIES = libppStats.la
-
-if HAVE_SVNVERSION
-PPSTATS_VERSION=`$(SVNVERSION) ..`
-else
-PPSTATS_VERSION="UNKNOWN"
-endif
-
-if HAVE_SVN
-PPSTATS_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 }'`
-PPSTATS_SOURCE=`$(SVN) info | $(SED) -n -e 's/Repository UUID: // p'`
-else
-PPSTATS_BRANCH="UNKNOWN"
-PPSTATS_SOURCE="UNKNOWN"
-endif
 
 # Force recompilation of ppStatsVersion.c, since it gets the version information
 ppStatsVersion.c: ppStatsVersionDefinitions.h
 ppStatsVersionDefinitions.h: ppStatsVersionDefinitions.h.in FORCE
-	-$(RM) ppStatsVersionDefinitions.h
-	$(SED) -e "s|@PPSTATS_VERSION@|\"$(PPSTATS_VERSION)\"|" -e "s|@PPSTATS_BRANCH@|\"$(PPSTATS_BRANCH)\"|" -e "s|@PPSTATS_SOURCE@|\"$(PPSTATS_SOURCE)\"|" ppStatsVersionDefinitions.h.in > ppStatsVersionDefinitions.h
+	pslib-setsvnversion.pl PPSTATS ppStatsVersionDefinitions.h.in ppStatsVersionDefinitions.h
 FORCE: ;
 
Index: /branches/eam_branches/ipp-20150112/ppTranslate/src/Makefile.am
===================================================================
--- /branches/eam_branches/ipp-20150112/ppTranslate/src/Makefile.am	(revision 38049)
+++ /branches/eam_branches/ipp-20150112/ppTranslate/src/Makefile.am	(revision 38050)
@@ -1,23 +1,8 @@
 bin_PROGRAMS = ppMops ppMonet
-
-if HAVE_SVNVERSION
-PPTRANSLATE_VERSION=`$(SVNVERSION) ..`
-else
-PPTRANSLATE_VERSION="UNKNOWN"
-endif
-
-if HAVE_SVN
-PPTRANSLATE_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 }'`
-PPTRANSLATE_SOURCE=`$(SVN) info | $(SED) -n -e 's/Repository UUID: // p'`
-else
-PPTRANSLATE_BRANCH="UNKNOWN"
-PPTRANSLATE_SOURCE="UNKNOWN"
-endif
 
 # Force recompilation of ppMopsVersion.c, since it gets the version information
 ppTranslateVersion.c: ppTranslateVersionDefinitions.h
 ppTranslateVersionDefinitions.h: ppTranslateVersionDefinitions.h.in FORCE
-	-$(RM) ppTranslateVersionDefinitions.h
-	$(SED) -e "s|@PPTRANSLATE_VERSION@|\"$(PPTRANSLATE_VERSION)\"|" -e "s|@PPTRANSLATE_BRANCH@|\"$(PPTRANSLATE_BRANCH)\"|" -e "s|@PPTRANSLATE_SOURCE@|\"$(PPTRANSLATE_SOURCE)\"|" ppTranslateVersionDefinitions.h.in > ppTranslateVersionDefinitions.h
+	pslib-setsvnversion.pl PPTRANSLATE ppTranslateVersionDefinitions.h.in ppTranslateVersionDefinitions.h
 FORCE: ;
 
Index: /branches/eam_branches/ipp-20150112/psLib/Makefile.am
===================================================================
--- /branches/eam_branches/ipp-20150112/psLib/Makefile.am	(revision 38049)
+++ /branches/eam_branches/ipp-20150112/psLib/Makefile.am	(revision 38050)
@@ -1,5 +1,5 @@
 SUBDIRS = m4 $(SUBDIR)
 
-bin_SCRIPTS = pslib-config 
+bin_SCRIPTS = pslib-config
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA= pslib.pc
Index: /branches/eam_branches/ipp-20150112/psLib/etc/Makefile.am
===================================================================
--- /branches/eam_branches/ipp-20150112/psLib/etc/Makefile.am	(revision 38049)
+++ /branches/eam_branches/ipp-20150112/psLib/etc/Makefile.am	(revision 38050)
@@ -1,4 +1,6 @@
 BUILT_SOURCES = pslib.config
 EXTRA_DIST = pslib.config.template
+
+bin_SCRIPTS = pslib-setsvnversion.pl
 
 # this is done instead of using autoconf to delay the expansion of datadir
Index: /branches/eam_branches/ipp-20150112/psLib/etc/pslib-setsvnversion.pl
===================================================================
--- /branches/eam_branches/ipp-20150112/psLib/etc/pslib-setsvnversion.pl	(revision 38050)
+++ /branches/eam_branches/ipp-20150112/psLib/etc/pslib-setsvnversion.pl	(revision 38050)
@@ -0,0 +1,108 @@
+#!/usr/bin/env perl
+$VERBOSE = 0;
+
+if (@ARGV != 3) { die "USAGE: setsvnversion.pl (prgname) (src) (tgt)\n"; }
+
+if (! -e $ARGV[1]) { die "setsvnversion.pl cannot find input version file\n"; }
+
+$prgname = $ARGV[0];
+
+$svnversion = `which svnversion`;
+chomp $svnversion;
+if ($?) {
+    $svnversion = "NONE";
+}
+if ($VERBOSE) { print "svnversion: $svnversion\n";}
+
+$svn = `which svn`;
+chomp $svn;
+if ($?) {
+    $svn = "NONE";
+}
+if ($VERBOSE) {print "svn: $svn\n";}
+
+if ($svnversion eq "NONE") {
+    $VERSION = "UNKNOWN";
+} else {
+    $VERSION = `$svnversion`;
+    chomp $VERSION;
+}
+if ($VERBOSE) {print "VERSION: $VERSION\n";}
+
+if ($svn eq "NONE") {
+    $BRANCH = "UNKNOWN";
+    $SOURCE = "UNKNOWN";
+} else {
+    $fullURL = "";
+    $reproot = "";
+    $UUID = "";
+    @lines = `$svn info ..`;
+    foreach $line (@lines) {
+	chomp $line;
+	($key, $value) = split (":", $line, 2);
+	if ($VERBOSE == 2) { print "key: $key\n";}
+	if ($VERBOSE == 2) { print "value: $value\n"; }
+	if ($key eq "URL")             { $fullURL = $value; }
+	if ($key eq "Repository UUID") { $UUID = $value;    }
+	if ($key eq "Repository Root") { $reproot = $value; }
+    }
+    if ($fullURL eq "") { die "failed to find URL\n"; }
+    if ($reproot eq "") { die "failed to find reproot\n"; }
+    if ($UUID    eq "") { die "failed to find UUID\n"; }
+
+    # remove surrounding whitespace
+    $fullURL =~ s/^\s+//;  $fullURL =~ s/\s+$//;
+    $reproot =~ s/^\s+//;  $reproot =~ s/\s+$//;
+    $UUID    =~ s/^\s+//;  $UUID    =~ s/\s+$//;
+
+    ($BRANCH) = $fullURL =~ m|$reproot/(.+)|;
+    if ($BRANCH eq "")  { die "failed to get branch from fullURL $fullURL\n"; }
+   
+    $SOURCE = $UUID;
+}
+
+if ($VERBOSE) { print "SOURCE: $SOURCE\n";}
+if ($VERBOSE) { print "BRANCH: $BRANCH\n";}
+
+open (FILE, "$ARGV[1]");
+@list = <FILE>;
+close (FILE);
+
+$version_field = sprintf "@%s_VERSION@", $prgname;
+$source_field = sprintf "@%s_SOURCE@", $prgname;
+$branch_field = sprintf "@%s_BRANCH@", $prgname;
+
+foreach $line (@list) {
+    $line =~ s|$version_field|"$VERSION"|;
+    $line =~ s|$source_field|"$SOURCE"|;
+    $line =~ s|$branch_field|"$BRANCH"|;
+}
+
+$output = sprintf "%s.tmp", $ARGV[2];
+
+open (FILE, ">$output");
+foreach $line (@list) {
+    print FILE $line;
+}
+close (FILE);
+
+if (! -e $ARGV[2]) {
+    if ($VERBOSE) { 
+	print "prior $ARGV[2] not found, replacing with $output\n";
+    }
+    rename $output, $ARGV[2];
+    exit 0;
+}
+
+$difflines = `diff $ARGV[2] $output`;
+if ($difflines eq "") {
+    print "  setsvnversion.pl: no change to $ARGV[2], keeping old version\n";
+} else {
+    if ($VERBOSE) { 
+	print "$ARGV[2] changed:\n";
+	print $difflines;
+    }
+    rename $output, $ARGV[2];
+}
+
+exit (0);
Index: /branches/eam_branches/ipp-20150112/psLib/pslib.pc.in
===================================================================
--- /branches/eam_branches/ipp-20150112/psLib/pslib.pc.in	(revision 38049)
+++ /branches/eam_branches/ipp-20150112/psLib/pslib.pc.in	(revision 38050)
@@ -7,5 +7,5 @@
 Description: Pan-STARRS Library
 Version: @VERSION@
-Libs: -L${libdir} -lpslib
+Libs: -L${libdir} -lpslib -lm
 Libs.private: @PSLIB_LIBS@
 Cflags: -I${includedir} @PSLIB_CFLAGS@
Index: /branches/eam_branches/ipp-20150112/psLib/src/sys/Makefile.am
===================================================================
--- /branches/eam_branches/ipp-20150112/psLib/src/sys/Makefile.am	(revision 38049)
+++ /branches/eam_branches/ipp-20150112/psLib/src/sys/Makefile.am	(revision 38050)
@@ -3,23 +3,8 @@
 noinst_LTLIBRARIES = libpslibsys.la
 
-if HAVE_SVNVERSION
-PSLIB_VERSION=`$(SVNVERSION) ../..`
-else
-PSLIB_VERSION="UNKNOWN"
-endif
-
-if HAVE_SVN
-PSLIB_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 }'`
-PSLIB_SOURCE=`$(SVN) info | $(SED) -n -e 's/Repository UUID: // p'`
-else
-PSLIB_BRANCH="UNKNOWN"
-PSLIB_SOURCE="UNKNOWN"
-endif
-
 # Force recompilation of psConfigure.c, since it gets the version information
 psConfigure.c: psVersionDefinitions.h
 psVersionDefinitions.h: psVersionDefinitions.h.in FORCE
-	-$(RM) psVersionDefinitions.h
-	$(SED) -e "s|@PSLIB_VERSION@|\"$(PSLIB_VERSION)\"|" -e "s|@PSLIB_BRANCH@|\"$(PSLIB_BRANCH)\"|" -e "s|@PSLIB_SOURCE@|\"$(PSLIB_SOURCE)\"|" psVersionDefinitions.h.in > psVersionDefinitions.h
+	../../etc/pslib-setsvnversion.pl PSLIB psVersionDefinitions.h.in psVersionDefinitions.h
 FORCE: ;
 
Index: /branches/eam_branches/ipp-20150112/pswarp/src/Makefile.am
===================================================================
--- /branches/eam_branches/ipp-20150112/pswarp/src/Makefile.am	(revision 38049)
+++ /branches/eam_branches/ipp-20150112/pswarp/src/Makefile.am	(revision 38050)
@@ -1,23 +1,8 @@
 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: 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
+	pslib-setsvnversion.pl PSWARP pswarpVersionDefinitions.h.in pswarpVersionDefinitions.h
 FORCE: ;
 
