Collection of DPF-based plugins for packaging
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.

138 lines
4.8KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_prog_date.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_PROG_DATE()
  8. #
  9. # DESCRIPTION
  10. #
  11. # This macro tries to determine the type of the date (1) command and some
  12. # of its non-standard capabilities.
  13. #
  14. # The type is determined as follow:
  15. #
  16. # * If the version string contains "GNU", then:
  17. # - The variable ax_cv_prog_date_gnu is set to "yes".
  18. # - The variable ax_cv_prog_date_type is set to "gnu".
  19. #
  20. # * If date supports the "-v 1d" option, then:
  21. # - The variable ax_cv_prog_date_bsd is set to "yes".
  22. # - The variable ax_cv_prog_date_type is set to "bsd".
  23. #
  24. # * If both previous checks fail, then:
  25. # - The variable ax_cv_prog_date_type is set to "unknown".
  26. #
  27. # The following capabilities of GNU date are checked:
  28. #
  29. # * If date supports the --date arg option, then:
  30. # - The variable ax_cv_prog_date_gnu_date is set to "yes".
  31. #
  32. # * If date supports the --utc arg option, then:
  33. # - The variable ax_cv_prog_date_gnu_utc is set to "yes".
  34. #
  35. # The following capabilities of BSD date are checked:
  36. #
  37. # * If date supports the -v 1d option, then:
  38. # - The variable ax_cv_prog_date_bsd_adjust is set to "yes".
  39. #
  40. # * If date supports the -r arg option, then:
  41. # - The variable ax_cv_prog_date_bsd_date is set to "yes".
  42. #
  43. # All the aforementioned variables are set to "no" before a check is
  44. # performed.
  45. #
  46. # LICENSE
  47. #
  48. # Copyright (c) 2017 Enrico M. Crisostomo <enrico.m.crisostomo@gmail.com>
  49. #
  50. # This program is free software: you can redistribute it and/or modify it
  51. # under the terms of the GNU General Public License as published by the
  52. # Free Software Foundation, either version 3 of the License, or (at your
  53. # option) any later version.
  54. #
  55. # This program is distributed in the hope that it will be useful, but
  56. # WITHOUT ANY WARRANTY; without even the implied warranty of
  57. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
  58. # Public License for more details.
  59. #
  60. # You should have received a copy of the GNU General Public License along
  61. # with this program. If not, see <http://www.gnu.org/licenses/>.
  62. #
  63. # As a special exception, the respective Autoconf Macro's copyright owner
  64. # gives unlimited permission to copy, distribute and modify the configure
  65. # scripts that are the output of Autoconf when processing the Macro. You
  66. # need not follow the terms of the GNU General Public License when using
  67. # or distributing such scripts, even though portions of the text of the
  68. # Macro appear in them. The GNU General Public License (GPL) does govern
  69. # all other use of the material that constitutes the Autoconf Macro.
  70. #
  71. # This special exception to the GPL applies to versions of the Autoconf
  72. # Macro released by the Autoconf Archive. When you make and distribute a
  73. # modified version of the Autoconf Macro, you may extend this special
  74. # exception to the GPL to apply to your modified version as well.
  75. #serial 3
  76. AC_DEFUN([AX_PROG_DATE], [dnl
  77. AC_CACHE_CHECK([for GNU date], [ax_cv_prog_date_gnu], [
  78. ax_cv_prog_date_gnu=no
  79. if date --version 2>/dev/null | head -1 | grep -q GNU
  80. then
  81. ax_cv_prog_date_gnu=yes
  82. fi
  83. ])
  84. AC_CACHE_CHECK([for BSD date], [ax_cv_prog_date_bsd], [
  85. ax_cv_prog_date_bsd=no
  86. if date -v 1d > /dev/null 2>&1
  87. then
  88. ax_cv_prog_date_bsd=yes
  89. fi
  90. ])
  91. AC_CACHE_CHECK([for date type], [ax_cv_prog_date_type], [
  92. ax_cv_prog_date_type=unknown
  93. if test "x${ax_cv_prog_date_gnu}" = "xyes"
  94. then
  95. ax_cv_prog_date_type=gnu
  96. elif test "x${ax_cv_prog_date_bsd}" = "xyes"
  97. then
  98. ax_cv_prog_date_type=bsd
  99. fi
  100. ])
  101. AS_VAR_IF([ax_cv_prog_date_gnu], [yes], [
  102. AC_CACHE_CHECK([whether GNU date supports --date], [ax_cv_prog_date_gnu_date], [
  103. ax_cv_prog_date_gnu_date=no
  104. if date --date=@1512031231 > /dev/null 2>&1
  105. then
  106. ax_cv_prog_date_gnu_date=yes
  107. fi
  108. ])
  109. AC_CACHE_CHECK([whether GNU date supports --utc], [ax_cv_prog_date_gnu_utc], [
  110. ax_cv_prog_date_gnu_utc=no
  111. if date --utc > /dev/null 2>&1
  112. then
  113. ax_cv_prog_date_gnu_utc=yes
  114. fi
  115. ])
  116. ])
  117. AS_VAR_IF([ax_cv_prog_date_bsd], [yes], [
  118. AC_CACHE_CHECK([whether BSD date supports -r], [ax_cv_prog_date_bsd_date], [
  119. ax_cv_prog_date_bsd_date=no
  120. if date -r 1512031231 > /dev/null 2>&1
  121. then
  122. ax_cv_prog_date_bsd_date=yes
  123. fi
  124. ])
  125. ])
  126. AS_VAR_IF([ax_cv_prog_date_bsd], [yes], [
  127. AC_CACHE_CHECK([whether BSD date supports -v], [ax_cv_prog_date_bsd_adjust], [
  128. ax_cv_prog_date_bsd_adjust=no
  129. if date -v 1d > /dev/null 2>&1
  130. then
  131. ax_cv_prog_date_bsd_adjust=yes
  132. fi
  133. ])
  134. ])
  135. ])dnl AX_PROG_DATE