auto-version: Separate out version deduction magic.
[cfd] / aclocal.glob
index 0f5a661..eb0e4d0 100644 (file)
@@ -38,18 +38,14 @@ dnl                 version number, worked out in some clever way.
 
 AC_DEFUN([mdw_AUTO_VERSION], [nobody cares...])
 m4_define([mdw_AUTO_VERSION], [m4_define([AUTO_VERSION], m4_esyscmd([
-  if test -d .git && version=$(git describe --abbrev=4 2>/dev/null); then
-    case "$(git diff-index --name-only HEAD)" in
-      "") ;; *) version="$version+" ;;
-    esac
-  elif cat RELEASE 2>/dev/null; then
-    version=$(cat RELEASE)
-  elif test -f debian/changelog; then
-    version=$(sed -n '/^.*(\(.*\)).*$/ { s::\1:p; q; }' debian/changelog)
-  else
-    echo UNKNOWN
-  fi
-  echo -n $version
+  ver=UNKNOWN
+  for pre in ./ config/; do
+    for post in "" .in; do
+      try=${pre}auto-version${post}
+      if test -x $try; then ver=$("$try"); break; fi
+    done
+  done
+  echo -n "$ver"
 ]))])
 
 dnl --- *@-mdw_LIBTOOL_VERSION_INFO-@* ---