autoconf: Split PACKAGE_VERSION in four parts

The parts can be accessed with the variables:

	PACKAGE_VERSION_MAJOR
	PACKAGE_VERSION_MINOR
	PACKAGE_VERSION_BUILD
	PACKAGE_VERSION_REVIEW

The last part will be empty for regular releases.
This commit is contained in:
Tobias Brunner 2013-09-02 11:26:31 +02:00
parent 10a69c32c2
commit 5ee0747cfd
2 changed files with 20 additions and 0 deletions

View File

@ -27,6 +27,9 @@ AC_CONFIG_HEADERS([config.h])
AC_DEFINE([CONFIG_H_INCLUDED], [], [defined if config.h included]) AC_DEFINE([CONFIG_H_INCLUDED], [], [defined if config.h included])
PKG_PROG_PKG_CONFIG PKG_PROG_PKG_CONFIG
m4_include(m4/macros/split-package-version.m4)
SPLIT_PACKAGE_VERSION
# ================================= # =================================
# check --enable-xxx & --with-xxx # check --enable-xxx & --with-xxx
# ================================= # =================================

View File

@ -0,0 +1,17 @@
# SPLIT_PACKAGE_VERSION
# ---------------------------
# Split package version in four parts
AC_DEFUN([SPLIT_PACKAGE_VERSION],
[
AC_REQUIRE([AC_PROG_SED])
PACKAGE_VERSION_MAJOR=`echo "$PACKAGE_VERSION" | $SED 's/\([[0-9]]\+\).*/\1/'`
PACKAGE_VERSION_MINOR=`echo "$PACKAGE_VERSION" | $SED 's/[[0-9]]\+\.\([[0-9]]\+\).*/\1/'`
PACKAGE_VERSION_BUILD=`echo "$PACKAGE_VERSION" | $SED 's/[[0-9]]\+\.[[0-9]]\+\.\([[0-9]]\+\).*/\1/'`
PACKAGE_VERSION_REVIEW=`echo "$PACKAGE_VERSION" | $SED 's/[[0-9]]\+\.[[0-9]]\+\.[[0-9]]\+\(.*\)/\1/'`
AC_SUBST([PACKAGE_VERSION_MAJOR])
AC_SUBST([PACKAGE_VERSION_MINOR])
AC_SUBST([PACKAGE_VERSION_BUILD])
AC_SUBST([PACKAGE_VERSION_REVIEW])
]
)