xref: /unit/auto/time (revision 2228:f403dc1e3ec1)
1
2# Copyright (C) Igor Sysoev
3# Copyright (C) NGINX, Inc.
4
5
6# Linux 2.6.32 CLOCK_REALTIME_COARSE.
7# Linux clock_gettime() is in librt.
8
9nxt_feature="Linux clock_gettime(CLOCK_REALTIME_COARSE)"
10nxt_feature_name=NXT_HAVE_CLOCK_REALTIME_COARSE
11nxt_feature_run=yes
12nxt_feature_incs=
13nxt_feature_libs="-lrt"
14nxt_feature_test="#include <time.h>
15
16                  int main(void) {
17                      struct timespec  ts;
18
19                      if (clock_gettime(CLOCK_REALTIME_COARSE, &ts) == -1)
20                          return 1;
21                      return 0;
22                  }"
23. auto/feature
24
25if [ $nxt_found = yes ]; then
26    NXT_LIBRT=$nxt_feature_libs
27fi
28
29
30# FreeBSD 7.0 CLOCK_REALTIME_FAST
31
32nxt_feature="FreeBSD clock_gettime(CLOCK_REALTIME_FAST)"
33nxt_feature_name=NXT_HAVE_CLOCK_REALTIME_FAST
34nxt_feature_run=yes
35nxt_feature_incs=
36nxt_feature_libs=
37nxt_feature_test="#include <time.h>
38
39                  int main(void) {
40                      struct timespec  ts;
41
42                      if (clock_gettime(CLOCK_REALTIME_FAST, &ts) == -1)
43                          return 1;
44                      return 0;
45                  }"
46. auto/feature
47
48
49nxt_feature="clock_gettime(CLOCK_REALTIME)"
50nxt_feature_name=NXT_HAVE_CLOCK_REALTIME
51nxt_feature_run=yes
52nxt_feature_incs=
53nxt_feature_libs=
54nxt_feature_test="#include <time.h>
55
56                  int main(void) {
57                      struct timespec  ts;
58
59                      if (clock_gettime(CLOCK_REALTIME, &ts) == -1)
60                          return 1;
61                      return 0;
62                  }"
63. auto/feature
64
65
66if [ $nxt_found = no ]; then
67
68    # Linux and Solaris 10 clock_gettime() are in librt.
69
70    nxt_feature="clock_gettime(CLOCK_REALTIME) in librt"
71    nxt_feature_libs="-lrt"
72    . auto/feature
73
74    if [ $nxt_found = yes ]; then
75        NXT_LIBRT=$nxt_feature_libs
76    fi
77fi
78
79
80# Linux 2.6.32 CLOCK_MONOTONIC_COARSE.
81# Linux clock_gettime() is in librt.
82
83nxt_feature="Linux clock_gettime(CLOCK_MONOTONIC_COARSE)"
84nxt_feature_name=NXT_HAVE_CLOCK_MONOTONIC_COARSE
85nxt_feature_run=yes
86nxt_feature_incs=
87nxt_feature_libs="-lrt"
88nxt_feature_test="#include <time.h>
89
90                  int main(void) {
91                      struct timespec  ts;
92
93                      if (clock_gettime(CLOCK_MONOTONIC_COARSE, &ts) == -1)
94                          return 1;
95                      return 0;
96                  }"
97. auto/feature
98
99if [ $nxt_found = yes ]; then
100    NXT_LIBRT=$nxt_feature_libs
101fi
102
103
104# FreeBSD 7.0 CLOCK_MONOTONIC_FAST
105
106nxt_feature="FreeBSD clock_gettime(CLOCK_MONOTONIC_FAST)"
107nxt_feature_name=NXT_HAVE_CLOCK_MONOTONIC_FAST
108nxt_feature_run=yes
109nxt_feature_incs=
110nxt_feature_libs=
111nxt_feature_test="#include <time.h>
112
113                  int main(void) {
114                      struct timespec  ts;
115
116                      if (clock_gettime(CLOCK_MONOTONIC_FAST, &ts) == -1)
117                          return 1;
118                      return 0;
119                  }"
120. auto/feature
121
122
123nxt_feature="clock_gettime(CLOCK_MONOTONIC)"
124nxt_feature_name=NXT_HAVE_CLOCK_MONOTONIC
125nxt_feature_run=yes
126nxt_feature_incs=
127nxt_feature_libs=
128nxt_feature_test="#include <time.h>
129
130                  int main(void) {
131                      struct timespec  ts;
132
133                      if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1)
134                          return 1;
135                      return 0;
136                  }"
137. auto/feature
138
139
140if [ $nxt_found = no ]; then
141
142    # Linux and Solaris 10 clock_gettime() are in librt.
143
144    nxt_feature="clock_gettime(CLOCK_MONOTONIC) in librt"
145    nxt_feature_libs="-lrt"
146    . auto/feature
147
148    if [ $nxt_found = yes ]; then
149        NXT_LIBRT=$nxt_feature_libs
150    fi
151fi
152
153
154# HP-UX Mercury Library hg_gethrtime().
155
156NXT_LIBHG=
157
158nxt_feature="HP-UX hg_gethrtime()"
159nxt_feature_name=NXT_HAVE_HG_GETHRTIME
160nxt_feature_run=yes
161nxt_feature_incs=
162nxt_feature_libs="-lhg"
163nxt_feature_test="#include <stdlib.h>
164                  #include <sys/mercury.h>
165
166                  int main(void) {
167                      hg_gethrtime();
168                      return 0;
169                  }"
170. auto/feature
171
172if [ $nxt_found = yes ]; then
173    NXT_LIBHG=$nxt_feature_libs
174fi
175
176
177nxt_feature="struct tm.tm_gmtoff"
178nxt_feature_name=NXT_HAVE_TM_GMTOFF
179nxt_feature_run=
180nxt_feature_incs=
181nxt_feature_libs=
182nxt_feature_test="#include <time.h>
183
184                  int main(void) {
185                      time_t     t;
186                      struct tm  tm;
187
188                      t = 0;
189                      localtime_r(&t, &tm);
190                      return tm.tm_gmtoff;
191                  }"
192. auto/feature
193
194
195nxt_feature="altzone"
196nxt_feature_name=NXT_HAVE_ALTZONE
197nxt_feature_run=
198nxt_feature_incs=
199nxt_feature_libs=
200nxt_feature_test="#include <time.h>
201
202                  int main(void) {
203                      altzone = 0;
204                      return 0;
205                  }"
206. auto/feature
207
208
209nxt_feature="localtime_r()"
210nxt_feature_name=NXT_HAVE_LOCALTIME_R
211nxt_feature_run=
212nxt_feature_incs=
213nxt_feature_libs=
214nxt_feature_test="#include <time.h>
215
216                  int main(void) {
217                      time_t     t;
218                      struct tm  tm;
219
220                      t = 0;
221                      localtime_r(&t, &tm);
222                      return 0;
223                  }"
224. auto/feature
225