summaryrefslogtreecommitdiff
path: root/infrastructure/m4/ax_split_version.m4
blob: 20b353dfac490a82f27fa963a4898f128f89993e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
dnl @synopsis AX_SPLIT_VERSION(DEFINE, VERSION)
dnl
dnl Splits a version number in the format MAJOR.MINOR.POINT into it's
dnl separate components and AC_DEFINES <DEFINE>_MAJOR etc with the values.
dnl
dnl @category Automake
dnl @author Martin Ebourne <martin@zepler.org>
dnl @version
dnl @license AllPermissive

AC_DEFUN([AX_SPLIT_VERSION],[
  ax_major_version=`echo "$2" | sed 's/\([[^.]][[^.]]*\).*/\1/'`
  ax_minor_version=`echo "$2" | sed 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'`
  ax_point_version=`echo "$2" | sed 's/[[^.]][[^.]]*.[[^.]][[^.]]*.\(.*\)/\1/'`

  AC_DEFINE_UNQUOTED([$1_MAJOR], [$ax_major_version], [Define to major version for $1])
  AC_DEFINE_UNQUOTED([$1_MINOR], [$ax_minor_version], [Define to minor version for $1])
  AC_DEFINE_UNQUOTED([$1_POINT], [$ax_point_version], [Define to point version for $1])
])