]> git.proxmox.com Git - mirror_kronosnet.git/blob - m4/ax_prog_date.m4
[handle] Set thread stack size on create
[mirror_kronosnet.git] / m4 / ax_prog_date.m4
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
76 #serial 3
77
78 AC_DEFUN([AX_PROG_DATE], [dnl
79 AC_CACHE_CHECK([for GNU date], [ax_cv_prog_date_gnu], [
80 ax_cv_prog_date_gnu=no
81 if date --version 2>/dev/null | head -1 | grep -q GNU
82 then
83 ax_cv_prog_date_gnu=yes
84 fi
85 ])
86 AC_CACHE_CHECK([for BSD date], [ax_cv_prog_date_bsd], [
87 ax_cv_prog_date_bsd=no
88 if date -v 1d > /dev/null 2>&1
89 then
90 ax_cv_prog_date_bsd=yes
91 fi
92 ])
93 AC_CACHE_CHECK([for date type], [ax_cv_prog_date_type], [
94 ax_cv_prog_date_type=unknown
95 if test "x${ax_cv_prog_date_gnu}" = "xyes"
96 then
97 ax_cv_prog_date_type=gnu
98 elif test "x${ax_cv_prog_date_bsd}" = "xyes"
99 then
100 ax_cv_prog_date_type=bsd
101 fi
102 ])
103 AS_VAR_IF([ax_cv_prog_date_gnu], [yes], [
104 AC_CACHE_CHECK([whether GNU date supports --date], [ax_cv_prog_date_gnu_date], [
105 ax_cv_prog_date_gnu_date=no
106 if date --date=@1512031231 > /dev/null 2>&1
107 then
108 ax_cv_prog_date_gnu_date=yes
109 fi
110 ])
111 AC_CACHE_CHECK([whether GNU date supports --utc], [ax_cv_prog_date_gnu_utc], [
112 ax_cv_prog_date_gnu_utc=no
113 if date --utc > /dev/null 2>&1
114 then
115 ax_cv_prog_date_gnu_utc=yes
116 fi
117 ])
118 ])
119 AS_VAR_IF([ax_cv_prog_date_bsd], [yes], [
120 AC_CACHE_CHECK([whether BSD date supports -r], [ax_cv_prog_date_bsd_date], [
121 ax_cv_prog_date_bsd_date=no
122 if date -r 1512031231 > /dev/null 2>&1
123 then
124 ax_cv_prog_date_bsd_date=yes
125 fi
126 ])
127 ])
128 AS_VAR_IF([ax_cv_prog_date_bsd], [yes], [
129 AC_CACHE_CHECK([whether BSD date supports -v], [ax_cv_prog_date_bsd_adjust], [
130 ax_cv_prog_date_bsd_adjust=no
131 if date -v 1d > /dev/null 2>&1
132 then
133 ax_cv_prog_date_bsd_adjust=yes
134 fi
135 ])
136 ])
137 ])dnl AX_PROG_DATE