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 Git repository description. Ensure that we use our Git
28 # repository even when there is a parent Git repository.
29 git_version=`git -C "$srcdir" --git-dir=.git describe --dirty 2> /dev/null`
31 # If available, use the Git description as package version. Otherwise,
32 # use the version provided by Autoconf.
33 AS_IF([test -n "$git_version"], [version="$git_version"],
36 AC_SUBST([$1_MAJOR], [$3])
37 AC_SUBST([$1_MINOR], [$4])
38 AC_SUBST([$1_MICRO], [$5])
39 AC_SUBST([$1], [$version])
42 ## JAYLINK_SET_PACKAGE_VERSION(prefix, version)
44 ## Parse the package version string of the format <major>.<minor>.<micro> and
45 ## set the variables <prefix>_{MAJOR,MINOR,MICRO} to their corresponding
48 ## Set the variable <prefix> to the package version string. If Git is
49 ## available, append the short Git revision hash of the current commit to the
50 ## version string if there is no release tag for the package version on it.
52 AC_DEFUN([JAYLINK_SET_PACKAGE_VERSION], [
55 _JAYLINK_SET_PACKAGE_VERSION([$1], [$2],
56 m4_unquote(m4_split(m4_expand([$2]), [\.])))
59 ## _JAYLINK_SET_LIBRARY_VERSION(prefix, version, current, revision, age)
61 m4_define([_JAYLINK_SET_LIBRARY_VERSION], [
64 AC_SUBST([$1_CURRENT], [$3])
65 AC_SUBST([$1_REVISION], [$4])
66 AC_SUBST([$1_AGE], [$5])
70 ## JAYLINK_SET_LIBRARY_VERSION(prefix, version)
72 ## Parse the library version string of the format <current>:<revision>:<age>
73 ## and set the variables <prefix>_{CURRENT,REVISION,AGE} to their corresponding
76 ## Set the variable <prefix> to the library version string.
78 AC_DEFUN([JAYLINK_SET_LIBRARY_VERSION], [
81 _JAYLINK_SET_LIBRARY_VERSION([$1], [$2],
82 m4_unquote(m4_split([$2], [:])))