Merge branch '2968_viewer_next_prev_mode'
[midnight-commander.git] / m4.include / mc-version.m4
blobb687c06faee7ca34b6b3d3b842e8e0a5627fcf66
1 dnl @synopsis MC_VERSION
2 dnl
3 dnl Get current version of Midnight Commander from git tags
4 dnl
5 dnl @author Slava Zanko <slavazanko@gmail.com>
6 dnl @version 2009-12-30
7 dnl @license GPL
8 dnl @copyright Free Software Foundation, Inc.
10 AC_DEFUN([MC_VERSION],[
11     if test ! -f ${srcdir}/version.h; then
12         ${srcdir}/maint/version.sh ${srcdir}
13     fi
14     if test -f ${srcdir}/version.h; then
15         VERSION=$(grep '^#define MC_CURRENT_VERSION' ${srcdir}/version.h | sed 's/.*"\(.*\)"$/\1/')
16     else
17         VERSION="unknown"
18     fi
19     AC_SUBST(VERSION)
21     dnl Version and Release without dashes for the distro packages
22     DISTR_VERSION=`echo $VERSION | sed 's/^\([[^\-]]*\).*/\1/'`
23     DISTR_RELEASE=`echo $VERSION | sed 's/^[[^\-]]*\-\(.*\)/\1/' | sed 's/-/./g'`
25     if test `echo $VERSION | grep -c '\-pre'` -ne 0; then
26         DISTR_RELEASE="0.$DISTR_RELEASE"
27     else
28         if test `echo $VERSION | grep -c '\-'` -eq 0; then
29             DISTR_RELEASE=1
30         else
31             DISTR_RELEASE="2.$DISTR_RELEASE"
32         fi
33     fi
35     AC_SUBST(DISTR_VERSION)
36     AC_SUBST(DISTR_RELEASE)