You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

81 lines
3.2 KiB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_is_release.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_IS_RELEASE(POLICY)
  8. #
  9. # DESCRIPTION
  10. #
  11. # Determine whether the code is being configured as a release, or from
  12. # git. Set the ax_is_release variable to 'yes' or 'no'.
  13. #
  14. # If building a release version, it is recommended that the configure
  15. # script disable compiler errors and debug features, by conditionalising
  16. # them on the ax_is_release variable. If building from git, these
  17. # features should be enabled.
  18. #
  19. # The POLICY parameter specifies how ax_is_release is determined. It can
  20. # take the following values:
  21. #
  22. # * git-directory: ax_is_release will be 'no' if a '.git' directory exists
  23. # * minor-version: ax_is_release will be 'no' if the minor version number
  24. # in $PACKAGE_VERSION is odd; this assumes
  25. # $PACKAGE_VERSION follows the 'major.minor.micro' scheme
  26. # * micro-version: ax_is_release will be 'no' if the micro version number
  27. # in $PACKAGE_VERSION is odd; this assumes
  28. # $PACKAGE_VERSION follows the 'major.minor.micro' scheme
  29. # * dash-version: ax_is_release will be 'no' if there is a dash '-'
  30. # in $PACKAGE_VERSION, for example 1.2-pre3, 1.2.42-a8b9
  31. # or 2.0-dirty (in particular this is suitable for use
  32. # with git-version-gen)
  33. # * always: ax_is_release will always be 'yes'
  34. # * never: ax_is_release will always be 'no'
  35. #
  36. # Other policies may be added in future.
  37. #
  38. # LICENSE
  39. #
  40. # Copyright (c) 2015 Philip Withnall <philip@tecnocode.co.uk>
  41. # Copyright (c) 2016 Collabora Ltd.
  42. #
  43. # Copying and distribution of this file, with or without modification, are
  44. # permitted in any medium without royalty provided the copyright notice
  45. # and this notice are preserved.
  46. #serial 7
  47. AC_DEFUN([AX_IS_RELEASE],[
  48. AC_BEFORE([AC_INIT],[$0])
  49. m4_case([$1],
  50. [git-directory],[
  51. # $is_release = (.git directory does not exist)
  52. AS_IF([test -d ${srcdir}/.git],[ax_is_release=no],[ax_is_release=yes])
  53. ],
  54. [minor-version],[
  55. # $is_release = ($minor_version is even)
  56. minor_version=`echo "$PACKAGE_VERSION" | sed 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'`
  57. AS_IF([test "$(( $minor_version % 2 ))" -ne 0],
  58. [ax_is_release=no],[ax_is_release=yes])
  59. ],
  60. [micro-version],[
  61. # $is_release = ($micro_version is even)
  62. micro_version=`echo "$PACKAGE_VERSION" | sed 's/[[^.]]*\.[[^.]]*\.\([[^.]]*\).*/\1/'`
  63. AS_IF([test "$(( $micro_version % 2 ))" -ne 0],
  64. [ax_is_release=no],[ax_is_release=yes])
  65. ],
  66. [dash-version],[
  67. # $is_release = ($PACKAGE_VERSION has a dash)
  68. AS_CASE([$PACKAGE_VERSION],
  69. [*-*], [ax_is_release=no],
  70. [*], [ax_is_release=yes])
  71. ],
  72. [always],[ax_is_release=yes],
  73. [never],[ax_is_release=no],
  74. [
  75. AC_MSG_ERROR([Invalid policy. Valid policies: git-directory, minor-version, micro-version, dash-version, always, never.])
  76. ])
  77. ])