chiark / gitweb /
m4/mdw-auto-version.m4: Don't try appending suffixes any more.
[runlisp] / m4 / mdw-auto-version.m4
... / ...
CommitLineData
1dnl -*-autoconf-*-
2
3### SYNOPSIS
4###
5### mdw_AUTO_VERSION
6###
7### DESCRIPTION
8###
9### Defines an m4 macro `AUTO_VERSION' which contains the current package's
10### version number, worked out in some clever way.
11###
12### The heavy lifting is performed by the `auto-version' script (q.v.). In
13### brief:
14###
15### * if this is a Git working tree (i.e., there is a `.git' file or
16### directory at toplevel) then call `git describe' and use its output;
17###
18### * if there is a `RELEASE' file, then use its contents literally;
19###
20### * if there is a `debian/changelog' file, then use the most recent
21### entry's version number;
22###
23### * otherwise use `UNKNOWN'.
24###
25### LICENSE
26###
27### Copyright (c) 2008 Mark Wooding <mdw@distorted.org.uk>
28###
29### This program is free software: you can redistribute it and/or modify it
30### under the terms of the GNU General Public License as published by the
31### Free Software Foundation, either version 2 of the License, or (at your
32### option) any later version.
33###
34### This program is distributed in the hope that it will be useful, but
35### WITHOUT ANY WARRANTY; without even the implied warranty of
36### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
37### General Public License for more details.
38###
39### You should have received a copy of the GNU General Public License along
40### with this program. If not, see <http://www.gnu.org/licenses/>.
41###
42### As a special exception, the respective Autoconf Macro's copyright owner
43### gives unlimited permission to copy, distribute and modify the configure
44### scripts that are the output of Autoconf when processing the Macro. You
45### need not follow the terms of the GNU General Public License when using
46### or distributing such scripts, even though portions of the text of the
47### Macro appear in them. The GNU General Public License (GPL) does govern
48### all other use of the material that constitutes the Autoconf Macro.
49###
50### This special exception to the GPL applies to versions of the Autoconf
51### Macro released by the Autoconf Archive. When you make and distribute a
52### modified version of the Autoconf Macro, you may extend this special
53### exception to the GPL to apply to your modified version as well.
54
55# serial 1
56AC_DEFUN([mdw_AUTO_VERSION], [m4_define([AUTO_VERSION], m4_esyscmd([
57 ver=UNKNOWN
58 for pre in ./ config/; do
59 try=${pre}auto-version
60 if test -x $try; then ver=$("$try"); break; fi
61 done
62 echo -n "$ver"
63]))])