+# Override, used for automated testing w/o access to the
+# .git directory (w.g. inside a git worktree)
+if [ -n "$EXIM_RELEASE_VERSION" ]; then
+ :
+elif [ -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
+ set $(echo "$description" | sed 's/-/ /; s/-g/-/')
+ # 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