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 --git-dir="$srcdir/.git" rev-parse \
29 --short HEAD 2> /dev/null`
31 # Try to get the release tag for the package version from the current
33 tag=`git --git-dir="$srcdir/.git" describe --match "$2" \
34 --exact-match 2> /dev/null`
38 # If Git is available, append the short Git revision hash of the
39 # current commit to the version string if there is no release tag for
40 # the package version on it.
41 AS_IF([test -n "$git_version" && test -z "$tag"],
42 [version="$version-git-$git_version"])
44 AC_SUBST([$1_MAJOR], [$3])
45 AC_SUBST([$1_MINOR], [$4])
46 AC_SUBST([$1_MICRO], [$5])
47 AC_SUBST([$1], [$version])
50 ## JAYLINK_SET_PACKAGE_VERSION(prefix, version)
52 ## Parse the package version string of the format <major>.<minor>.<micro> and
53 ## set the variables <prefix>_{MAJOR,MINOR,MICRO} to their corresponding
56 ## Set the variable <prefix> to the package version string. If Git is
57 ## available, append the short Git revision hash of the current commit to the
58 ## version string if there is no release tag for the package version on it.
60 AC_DEFUN([JAYLINK_SET_PACKAGE_VERSION], [
63 _JAYLINK_SET_PACKAGE_VERSION([$1], [$2],
64 m4_unquote(m4_split(m4_expand([$2]), [\.])))
67 ## _JAYLINK_SET_LIBRARY_VERSION(prefix, version, current, revision, age)
69 m4_define([_JAYLINK_SET_LIBRARY_VERSION], [
72 AC_SUBST([$1_CURRENT], [$3])
73 AC_SUBST([$1_REVISION], [$4])
74 AC_SUBST([$1_AGE], [$5])
78 ## JAYLINK_SET_LIBRARY_VERSION(prefix, version)
80 ## Parse the library version string of the format <current>:<revision>:<age>
81 ## and set the variables <prefix>_{CURRENT,REVISION,AGE} to their corresponding
84 ## Set the variable <prefix> to the library version string.
86 AC_DEFUN([JAYLINK_SET_LIBRARY_VERSION], [
89 _JAYLINK_SET_LIBRARY_VERSION([$1], [$2],
90 m4_unquote(m4_split([$2], [:])))