diff --git a/xorgversion.m4 b/xorgversion.m4 index 01bffec..421f3ab 100644 --- a/xorgversion.m4 +++ b/xorgversion.m4 @@ -27,7 +27,8 @@ # XORG_RELEASE_VERSION # -------------------- # Adds --with/without-release-string and changes the PACKAGE and # PACKAGE_TARNAME to use "$PACKAGE{_TARNAME}-$RELEASE_VERSION". If -# no option is given, PACKAGE and PACKAGE_TARNAME are unchanged. +# no option is given, PACKAGE and PACKAGE_TARNAME are unchanged. Also +# defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use. AC_DEFUN([XORG_RELEASE_VERSION],[ AC_ARG_WITH(release-version, @@ -40,4 +41,21 @@ AC_DEFUN([XORG_RELEASE_VERSION],[ PACKAGE_TARNAME="$PACKAGE_TARNAME-$RELEASE_VERSION" AC_MSG_NOTICE([Building with package name set to $PACKAGE]) fi + AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR], + [`echo $PACKAGE_VERSION | sed -ne 's/^\([[^\.]]\+\).*/\1/p'`], + [Major version of this package]) + PVM=`echo $PACKAGE_VERSION | sed -ne 's/^\([[^\.]]\+\)\.\([[^\.]]\+\).*/\2/p'` + if test "x$PVM" = "x"; then + PVM="0" + fi + AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR], + [$PVM], + [Minor version of this package]) + PVP=`echo $PACKAGE_VERSION | sed -ne 's/^\([[^\.]]\+\)\.\([[^\.]]\+\)\.\([[^\.]]\+\).*/\3/p'` + if test "x$PVP" = "x"; then + PVP="0" + fi + AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCHLEVEL], + [$PVP], + [Patch version of this package]) ])