ax_hex_version.m4 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. # ===========================================================================
  2. # https://github.com/BrianAker/ddm4
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_HEX_VERSION(VARIABLE_NAME, VERSION)
  8. #
  9. # DESCRIPTION
  10. #
  11. # Generate version information in HEX and STRING format.
  12. #
  13. # LICENSE
  14. #
  15. # Copyright (c) 2012 Brian Aker <brian@tangent.org>
  16. #
  17. # Copying and distribution of this file, with or without modification, are
  18. # permitted in any medium without royalty provided the copyright notice
  19. # and this notice are preserved. This file is offered as-is, without any
  20. # warranty.
  21. #serial 3
  22. AC_DEFUN([AX_HEX_VERSION],
  23. [AC_PREREQ([2.63])dnl
  24. string_version_$1=`echo $2 | sed 's|[\-a-z0-9]*$||' | awk -F. '{printf "%d.%d.%d", $[]1, $[]2, $[]3}'`
  25. hex_version_$1=`echo $2 | sed 's|[\-a-z0-9]*$||' | awk -F. '{printf "0x%0.2d%0.3d%0.3d", $[]1, $[]2, $[]3}'`
  26. AC_SUBST([$1_VERSION_STRING],["$string_version_$1"])
  27. AC_SUBST([$1_VERSION_HEX],["$hex_version_$1"])
  28. ])