mc-version.m4 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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.
  9. AC_DEFUN([MC_VERSION],[
  10. if test ! -f ${srcdir}/version.h; then
  11. ${srcdir}/maint/version.sh ${srcdir}
  12. fi
  13. if test -f ${srcdir}/version.h; then
  14. VERSION=$(grep '^#define MC_CURRENT_VERSION' ${srcdir}/version.h | sed 's/.*"\(.*\)"$/\1/')
  15. else
  16. VERSION="unknown"
  17. fi
  18. AC_SUBST(VERSION)
  19. dnl Version and Release without dashes for the distro packages
  20. DISTR_VERSION=`echo $VERSION | sed 's/^\([[^\-]]*\).*/\1/'`
  21. DISTR_RELEASE=`echo $VERSION | sed 's/^[[^\-]]*\-\(.*\)/\1/' | sed 's/-/./g'`
  22. if test `echo $VERSION | grep -c '\-pre'` -ne 0; then
  23. DISTR_RELEASE="0.$DISTR_RELEASE"
  24. else
  25. if test `echo $VERSION | grep -c '\-'` -eq 0; then
  26. DISTR_RELEASE=1
  27. else
  28. DISTR_RELEASE="2.$DISTR_RELEASE"
  29. fi
  30. fi
  31. AC_SUBST(DISTR_VERSION)
  32. AC_SUBST(DISTR_RELEASE)
  33. ])