2 ## This file is part of the libjaylink project.
4 ## Copyright (C) 2016 Marc Schink <jaylink-dev@marcschink.de>
6 ## This program is free software: you can redistribute it and/or modify
7 ## it under the terms of the GNU General Public License as published by
8 ## the Free Software Foundation, either version 2 of the License, or
9 ## (at your option) any later version.
11 ## This program is distributed in the hope that it will be useful,
12 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ## GNU General Public License for more details.
16 ## You should have received a copy of the GNU General Public License
17 ## along with this program. If not, see <http://www.gnu.org/licenses/>.
22 ## _JAYLINK_SET_PACKAGE_VERSION(prefix, version, major, minor, micro)
24 m4_define([_JAYLINK_SET_PACKAGE_VERSION], [
27 # Get the short Git revision hash of the current commit.
28 git_version=`git rev-parse --short HEAD 2> /dev/null`
30 # Try to get the release tag for the package version from the current
32 tag=`git describe --match "$2" --exact-match 2> /dev/null`
36 # If Git is available, append the short Git revision hash of the
37 # current commit to the version string if there is no release tag for
38 # the package version on it.
39 AS_IF([test -n "$git_version" && test -z "$tag"],
40 [version="$version-git-$git_version"])
42 AC_SUBST([$1_MAJOR], [$3])
43 AC_SUBST([$1_MINOR], [$4])
44 AC_SUBST([$1_MICRO], [$5])
45 AC_SUBST([$1], [$version])
48 ## JAYLINK_SET_PACKAGE_VERSION(prefix, version)
50 ## Parse the package version string of the format <major>.<minor>.<micro> and
51 ## set the variables <prefix>_{MAJOR,MINOR,MICRO} to their corresponding
54 ## Set the variable <prefix> to the package version string. If Git is
55 ## available, append the short Git revision hash of the current commit to the
56 ## version string if there is no release tag for the package version on it.
58 AC_DEFUN([JAYLINK_SET_PACKAGE_VERSION], [
61 _JAYLINK_SET_PACKAGE_VERSION([$1], [$2],
62 m4_unquote(m4_split(m4_expand([$2]), [\.])))
65 ## _JAYLINK_SET_LIBRARY_VERSION(prefix, version, current, revision, age)
67 m4_define([_JAYLINK_SET_LIBRARY_VERSION], [
70 AC_SUBST([$1_CURRENT], [$3])
71 AC_SUBST([$1_REVISION], [$4])
72 AC_SUBST([$1_AGE], [$5])
76 ## JAYLINK_SET_LIBRARY_VERSION(prefix, version)
78 ## Parse the library version string of the format <current>:<revision>:<age>
79 ## and set the variables <prefix>_{CURRENT,REVISION,AGE} to their corresponding
82 ## Set the variable <prefix> to the library version string.
84 AC_DEFUN([JAYLINK_SET_LIBRARY_VERSION], [
87 _JAYLINK_SET_LIBRARY_VERSION([$1], [$2],
88 m4_unquote(m4_split([$2], [:])))