aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Schink <jaylink-dev@marcschink.de>2016-10-11 18:54:11 +0200
committerMarc Schink <jaylink-dev@marcschink.de>2016-10-25 21:55:11 +0200
commitfbf16f81dd74b2bcd53741f7e9b265158725ce43 (patch)
tree873e813cf4eb77a523837aba9a4b881e4d6bce1f
parentcec02b8a258f91c8c6a4a088af02d165b90e95dc (diff)
Rework code for libtool versioning
Signed-off-by: Marc Schink <jaylink-dev@marcschink.de>
-rw-r--r--configure.ac14
-rw-r--r--libjaylink/version.h.in8
-rw-r--r--m4/jaylink.m426
3 files changed, 33 insertions, 15 deletions
diff --git a/configure.ac b/configure.ac
index 37d8f80..9ba68c2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -67,15 +67,7 @@ JAYLINK_SET_PACKAGE_VERSION([JAYLINK_VERSION_PACKAGE], [AC_PACKAGE_VERSION])
# Libtool interface version of libjaylink. This is not the same as the package
# version. For information about the versioning system of libtool, see:
# http://www.gnu.org/software/libtool/manual/libtool.html#Libtool-versioning
-JAYLINK_VERSION_LIB_CURRENT=0
-JAYLINK_VERSION_LIB_REVISION=0
-JAYLINK_VERSION_LIB_AGE=0
-JAYLINK_VERSION_LIB="$JAYLINK_VERSION_LIB_CURRENT:$JAYLINK_VERSION_LIB_REVISION:$JAYLINK_VERSION_LIB_AGE"
-
-AC_SUBST([JAYLINK_VERSION_LIB_CURRENT])
-AC_SUBST([JAYLINK_VERSION_LIB_REVISION])
-AC_SUBST([JAYLINK_VERSION_LIB_AGE])
-AC_SUBST([JAYLINK_VERSION_LIB])
+JAYLINK_SET_LIBRARY_VERSION([JAYLINK_VERSION_LIBRARY], [0:0:0])
AC_ARG_ENABLE([subproject-build], AS_HELP_STRING([--enable-subproject-build],
[enable sub-project build [default=no]]))
@@ -86,7 +78,7 @@ AM_CONDITIONAL([SUBPROJECT_BUILD],
# Libtool interface version is not used for sub-project build as libjaylink is
# built as libtool convenience library.
AS_IF([test "x$enable_subproject_build" != "xyes"],
- [JAYLINK_LIB_LDFLAGS="-version-info $JAYLINK_VERSION_LIB"])
+ [JAYLINK_LIB_LDFLAGS="-version-info $JAYLINK_VERSION_LIBRARY"])
AC_SUBST([JAYLINK_LIB_LDFLAGS])
@@ -110,7 +102,7 @@ AC_OUTPUT
echo
echo "libjaylink configuration summary:"
echo " - Package version ................ $JAYLINK_VERSION_PACKAGE"
-echo " - Library version ................ $JAYLINK_VERSION_LIB"
+echo " - Library version ................ $JAYLINK_VERSION_LIBRARY"
echo " - Installation prefix ............ $prefix"
echo " - Building on .................... $build"
echo " - Building for ................... $host"
diff --git a/libjaylink/version.h.in b/libjaylink/version.h.in
index 6ae7f03..d6a7796 100644
--- a/libjaylink/version.h.in
+++ b/libjaylink/version.h.in
@@ -39,15 +39,15 @@
#define JAYLINK_VERSION_PACKAGE_STRING "@JAYLINK_VERSION_PACKAGE@"
/** <i>Current</i> version number of the libjaylink libtool interface. */
-#define JAYLINK_VERSION_LIBRARY_CURRENT @JAYLINK_VERSION_LIB_CURRENT@
+#define JAYLINK_VERSION_LIBRARY_CURRENT @JAYLINK_VERSION_LIBRARY_CURRENT@
/** <i>Revision</i> version number of the libjaylink libtool interface. */
-#define JAYLINK_VERSION_LIBRARY_REVISION @JAYLINK_VERSION_LIB_REVISION@
+#define JAYLINK_VERSION_LIBRARY_REVISION @JAYLINK_VERSION_LIBRARY_REVISION@
/** <i>Age</i> version number of the libjaylink libtool interface. */
-#define JAYLINK_VERSION_LIBRARY_AGE @JAYLINK_VERSION_LIB_AGE@
+#define JAYLINK_VERSION_LIBRARY_AGE @JAYLINK_VERSION_LIBRARY_AGE@
/** Version number string of the libjaylink libtool interface. */
-#define JAYLINK_VERSION_LIBRARY_STRING "@JAYLINK_VERSION_LIB@"
+#define JAYLINK_VERSION_LIBRARY_STRING "@JAYLINK_VERSION_LIBRARY@"
#endif /* LIBJAYLINK_VERSION_H */
diff --git a/m4/jaylink.m4 b/m4/jaylink.m4
index 409fc9f..7395421 100644
--- a/m4/jaylink.m4
+++ b/m4/jaylink.m4
@@ -61,3 +61,29 @@ AC_DEFUN([JAYLINK_SET_PACKAGE_VERSION], [
_JAYLINK_SET_PACKAGE_VERSION([$1], [$2],
m4_unquote(m4_split(m4_expand([$2]), [\.])))
])
+
+## _JAYLINK_SET_LIBRARY_VERSION(prefix, version, current, revision, age)
+##
+m4_define([_JAYLINK_SET_LIBRARY_VERSION], [
+ m4_assert([$# == 5])
+
+ AC_SUBST([$1_CURRENT], [$3])
+ AC_SUBST([$1_REVISION], [$4])
+ AC_SUBST([$1_AGE], [$5])
+ AC_SUBST([$1], [$2])
+])
+
+## JAYLINK_SET_LIBRARY_VERSION(prefix, version)
+##
+## Parse the library version string of the format <current>:<revision>:<age>
+## and set the variables <prefix>_{CURRENT,REVISION,AGE} to their corresponding
+## values.
+##
+## Set the variable <prefix> to the library version string.
+##
+AC_DEFUN([JAYLINK_SET_LIBRARY_VERSION], [
+ m4_assert([$# == 2])
+
+ _JAYLINK_SET_LIBRARY_VERSION([$1], [$2],
+ m4_unquote(m4_split([$2], [:])))
+])