3 # $0 <path-to-top_srcdir> <version-stamp-file>
5 # <path-to-top_srcdir> may be relative
6 # <version-stamp-file> is relative to src/build topdir
9 test -d "$top_srcdir" ||
{ \
10 echo "Could not change to top_srcdir '$1'" >&2; \
13 version_stamp
="${2-version-stamp}"
15 # If GIT_DIR is set, use it. If not, try top_srcdir/.git.
16 if test -n "$GIT_DIR"; then :;
17 else GIT_DIR
="$top_srcdir/.git"; export GIT_DIR
20 if test -f "$top_srcdir/$version_stamp"; then # dist source tree
21 cat "$top_srcdir/$version_stamp" |
${TR-tr} -d '\012'
22 elif test -d "$GIT_DIR"; then # git source tree
23 git_describe
=`${GIT-git} describe 2>/dev/null || echo devel`
24 echo "$git_describe" |
${SED-sed} -e 's/^v//' -e 's/-/./g' |
${TR-tr} -d '\012'
26 echo "devel" |
${TR-tr} -d '\012'