--- /dev/null
+dnl -*-autoconf-*-
+
+dnl --- *@-mdw_AUTO_VERSION-@* ---
+dnl
+dnl Author: Mark Wooding
+dnl
+dnl Synopsis: mdw_AUTO_VERSION
+dnl
+dnl Arguments: ---
+dnl
+dnl Use: Defines an m4 macro AUTO_VERSION which contains the current
+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([
+ 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"
+]))])