aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Schink <swo-dev@marcschink.de>2016-11-02 15:55:17 +0100
committerMarc Schink <swo-dev@marcschink.de>2016-11-02 16:14:01 +0100
commit7ee2d3b8bf43012a04cbd126cbea4140a0c22287 (patch)
treeb325a3be87819b25e105a738c04983cb2e17240d
parentf13a3aa5914b2e5e9838da2b3dcdef22e07d7d86 (diff)
Rework code for libtool versioning
-rw-r--r--configure.ac14
-rw-r--r--libswo/version.h.in8
-rw-r--r--m4/libswo.m426
3 files changed, 33 insertions, 15 deletions
diff --git a/configure.ac b/configure.ac
index 20c0ee8..2398264 100644
--- a/configure.ac
+++ b/configure.ac
@@ -85,17 +85,9 @@ LIBSWO_SET_PACKAGE_VERSION([LIBSWO_VERSION_PACKAGE], [AC_PACKAGE_VERSION])
# Libtool interface version of libswo. 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
-LIBSWO_VERSION_LIB_CURRENT=0
-LIBSWO_VERSION_LIB_REVISION=0
-LIBSWO_VERSION_LIB_AGE=0
-LIBSWO_VERSION_LIB="$LIBSWO_VERSION_LIB_CURRENT:$LIBSWO_VERSION_LIB_REVISION:$LIBSWO_VERSION_LIB_AGE"
+LIBSWO_SET_LIBRARY_VERSION([LIBSWO_VERSION_LIBRARY], [0:0:0])
-AC_SUBST(LIBSWO_VERSION_LIB_CURRENT)
-AC_SUBST(LIBSWO_VERSION_LIB_REVISION)
-AC_SUBST(LIBSWO_VERSION_LIB_AGE)
-AC_SUBST(LIBSWO_VERSION_LIB)
-
-LIBSWO_LIB_LDFLAGS="-version-info $LIBSWO_VERSION_LIB"
+LIBSWO_LIB_LDFLAGS="-version-info $LIBSWO_VERSION_LIBRARY"
AC_SUBST([LIBSWO_LIB_LDFLAGS])
@@ -187,7 +179,7 @@ AC_OUTPUT
echo
echo "libswo configuration summary:"
echo " - Package version ................ $LIBSWO_VERSION_PACKAGE"
-echo " - Library version ................ $LIBSWO_VERSION_LIB"
+echo " - Library version ................ $LIBSWO_VERSION_LIBRARY"
echo " - Installation prefix ............ $prefix"
echo " - Building on .................... $build"
echo " - Building for ................... $host"
diff --git a/libswo/version.h.in b/libswo/version.h.in
index 1ac3375..b9ebc15 100644
--- a/libswo/version.h.in
+++ b/libswo/version.h.in
@@ -39,15 +39,15 @@
#define LIBSWO_VERSION_PACKAGE_STRING "@LIBSWO_VERSION_PACKAGE@"
/** <i>Current</i> version number of the libswo libtool interface. */
-#define LIBSWO_VERSION_LIBRARY_CURRENT @LIBSWO_VERSION_LIB_CURRENT@
+#define LIBSWO_VERSION_LIBRARY_CURRENT @LIBSWO_VERSION_LIBRARY_CURRENT@
/** <i>Revision</i> version number of the libswo libtool interface. */
-#define LIBSWO_VERSION_LIBRARY_REVISION @LIBSWO_VERSION_LIB_REVISION@
+#define LIBSWO_VERSION_LIBRARY_REVISION @LIBSWO_VERSION_LIBRARY_REVISION@
/** <i>Age</i> version number of the libswo libtool interface. */
-#define LIBSWO_VERSION_LIBRARY_AGE @LIBSWO_VERSION_LIB_AGE@
+#define LIBSWO_VERSION_LIBRARY_AGE @LIBSWO_VERSION_LIBRARY_AGE@
/** Version number string of the libswo libtool interface. */
-#define LIBSWO_VERSION_LIBRARY_STRING "@LIBSWO_VERSION_LIB@"
+#define LIBSWO_VERSION_LIBRARY_STRING "@LIBSWO_VERSION_LIBRARY@"
#endif /* LIBSWO_VERSION_H */
diff --git a/m4/libswo.m4 b/m4/libswo.m4
index 864c038..a892843 100644
--- a/m4/libswo.m4
+++ b/m4/libswo.m4
@@ -61,3 +61,29 @@ AC_DEFUN([LIBSWO_SET_PACKAGE_VERSION], [
_LIBSWO_SET_PACKAGE_VERSION([$1], [$2],
m4_unquote(m4_split(m4_expand([$2]), [\.])))
])
+
+## _LIBSWO_SET_LIBRARY_VERSION(prefix, version, current, revision, age)
+##
+m4_define([_LIBSWO_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])
+])
+
+## LIBSWO_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([LIBSWO_SET_LIBRARY_VERSION], [
+ m4_assert([$# == 2])
+
+ _LIBSWO_SET_LIBRARY_VERSION([$1], [$2],
+ m4_unquote(m4_split([$2], [:])))
+])