- # Only update if we need to
- if [ "$2 $3" != "$EXIM_RELEASE_VERSION $EXIM_VARIANT_VERSION" ]
- then
- EXIM_RELEASE_VERSION="$2"
- EXIM_VARIANT_VERSION="$3"
- rm -f version.h
- fi
+if [ -f ./version.sh ]; then
+ . ./version.sh
+elif [ -f ../src/version.sh ]; then
+ . ../src/version.sh
+elif [ -d ../../.git ] || [ -f ../../.git ] || [ "$1" = release ]; then
+ # Modify the output of git describe into separate parts for
+ # the name "exim" and the release and variant versions.
+ # Put a dot in the version number and remove a spurious g.
+ if [ "$2" ]
+ then
+ description=$(git describe "$2")
+ else
+ description=$(git describe --dirty=-XX --match 'exim-4*')
+ fi
+ # Only update if we need to
+ if [ "$2 $3" != "$EXIM_RELEASE_VERSION $EXIM_VARIANT_VERSION" ]
+ then
+ EXIM_RELEASE_VERSION="$2"
+ EXIM_VARIANT_VERSION="$3"
+ rm -f version.h
+ fi
+else
+ echo "Cannot determine the release number" >&2
+ exit