#!/bin/sh

#
# This file is part of Fig2dev: Translate fig code to various devices.
#
#	update-version_m4: Set the version information in version.m4.
#	Author: Thomas Loimer <thomas.loimer@tuwien.ac.at>, 2016
#

if test "`git describe --abbrev=1`" != \
	"`sed -n '/^m4_def.*FIG_VERS/ {s/.*, *\[\(.*\)\])/\1/;p}' version.m4`"
then
    sed  -i "\
	/^m4_define(\[\{0,1\}FIG_VERSION/ s/\(.*, *\[\).*\]/\1`git describe --abbrev=1`]/
	/^m4_define(\[\{0,1\}RELEASEDATE/ s/\(.*, *\[\).*\]/\1`git show -s --pretty=%cd --date=format:'%b %Y'`]/" version.m4
fi
