#!/bin/sh
# only use this if we are in a subversion repository
[ -e ~/.profile ] && . ~/.profile
if [ "x$1" != "x." ] ; then
pushd $1
fi
if [ -d .svn ]; then
rev=`svn info | grep Revision`
val="#define LIBMIA_REVISION "\"$rev\"
echo $val >revision.hh.new
if diff revision.hh.new revision.hh >/dev/null 2>&1 ; then
rm -f revision_info.hh.new
else
mv revision.hh.new revision.hh
fi
elif [ ! -f revision.hh ] ; then
echo "WARNING: Unable to obtain revision number from subversion tree"
echo "WARNING: Either you're not using a working copy of the svn version"
echo "WARNING: or the subversion client is not available"
echo "WARNING: As a workaround you may create a 'revision.hh' by hand"
echo "WARNING: with the line '#define LIBMIA_REVISION \"unknown\"'"
echo "WARNING: build will fail with 'revision.cc: libmia/revision.hh: No such file or directory'"
fi
if [ "x$1" != "x." ] ; then
popd
fi