directory where it is run. Since this will be run in a separate shell
anyway, there's no need to worry about changing current directory.
This eliminates the need for the caller to specify where the source
directory is located, and doesn't require that the code take special
care to use the appropriate directory. The fallback method of using
`cat VERSION` was broken in this respect, it would not work when run
from a different directory.
---
configure.ac | 2 +-
version.sh | 7 ++++---
2 files changed, 5 insertions(+), 4 deletions(-)
AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/VERSION'])
-MUTT_VERSION=`env HGROOT="$srcdir" sh "$srcdir/version.sh"`
+MUTT_VERSION=`env sh "$srcdir/version.sh"`
AC_DEFINE_UNQUOTED(MUTT_VERSION,"$MUTT_VERSION", [Full textual version string.])
AC_USE_SYSTEM_EXTENSIONS
#!/bin/sh
-# Adopt $HGROOT from the environment, if present
HG=hg
-[ -n "$HGROOT" ] && HG="$HG -R \$HGROOT"
+
+# Switch to directory where this script lives so that further commands are run
+# from the root directory of the source
+cd `dirname $0`
# Ensure that we have a repo here and that mercurial is installed. If
# not, just cat the VERSION file; it contains the latest release number.
-{ [ -d "$HGROOT/.hg" ] && $HG >/dev/null 2>&1; } \
-|| exec cat "$HGROOT/VERSION"
+{ [ -d ".hg" ] && $HG >/dev/null 2>&1; } \
+|| exec cat VERSION
# This is a mercurial repo and we have the hg command.