1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
|
CC_WARN=$CC
ngx_fmt_collect=yes
# C types
ngx_type="int"; . auto/types/sizeof
ngx_formats="%d"; . auto/fmt/fmt
ngx_type="long"; . auto/types/sizeof
ngx_formats="%ld"; . auto/fmt/fmt
ngx_type="long long"; . auto/types/sizeof
ngx_formats="%lld %qd"; . auto/fmt/fmt
ngx_type="void *"; . auto/types/sizeof; ngx_ptr_bytes=$ngx_bytes
ngx_fmt_name=PTR_FMT;
eval ngx_formats=\${ngx_${ngx_bytes}_fmt}; . auto/fmt/ptrfmt
# POSIX types
NGX_AUTO_CONFIG="#include \"../$NGX_AUTO_CONFIG_H\""
ngx_type="uint64_t"
ngx_types="u_int64_t"; . auto/types/typedef
ngx_type="sig_atomic_t"
ngx_types="int"; . auto/types/typedef
ngx_type="socklen_t"
ngx_types="uint32_t"; . auto/types/typedef
ngx_type="in_addr_t"
ngx_types="uint32_t"; . auto/types/typedef
ngx_type="rlim_t"
ngx_types="int"; . auto/types/typedef
. auto/types/uintptr_t
# printf() formats
CC_WARN=$CC_STRONG
ngx_fmt_collect=no
ngx_fmt_name=OFF_T_FMT; ngx_type="off_t"; . auto/types/sizeof
ngx_type_max_value=OFF_T_MAX_VALUE; . auto/types/maxvalue
eval ngx_formats=\${ngx_${ngx_bytes}_fmt}; . auto/fmt/fmt
ngx_fmt_name=TIME_T_FMT; ngx_type="time_t"; . auto/types/sizeof
eval ngx_formats=\${ngx_${ngx_bytes}_fmt}; . auto/fmt/fmt
ngx_fmt_name=SIZE_T_FMT; ngx_type="size_t"; . auto/types/sizeof
eval ngx_formats=\${ngx_${ngx_bytes}_fmt}; . auto/fmt/fmt
ngx_fmt_name=SIZE_T_X_FMT; . auto/fmt/xfmt
ngx_fmt_name=PID_T_FMT; ngx_type="pid_t"; . auto/types/sizeof
eval ngx_formats=\${ngx_${ngx_bytes}_fmt}; . auto/fmt/fmt
ngx_fmt_name=RLIM_T_FMT; ngx_type="rlim_t"; . auto/types/sizeof
eval ngx_formats=\${ngx_${ngx_bytes}_fmt}; . auto/fmt/fmt
# syscalls, libc calls and some features
ngx_feature_libs=
ngx_func_libs=
ngx_func="pread()"
ngx_func_inc=
ngx_func_test="char buf[1]; ssize_t n; n = pread(0, buf, 1, 0)"
. auto/func
ngx_func="pwrite()"
ngx_func_inc=
ngx_func_test="char buf[1]; ssize_t n; n = pwrite(1, buf, 1, 0)"
. auto/func
#ngx_func="strsignal()"
#ngx_func_inc="#include <string.h>"
#ngx_func_test="char *s = strsignal(1)"
#. auto/func
ngx_func="strerror_r()"
ngx_func_inc="#include <string.h>"
ngx_func_test="char buf[20]; int n; n = strerror_r(1, buf, 20)"
. auto/func
ngx_func="gnu_strerror_r()"
ngx_func_inc="#include <string.h>"
ngx_func_test="char buf[20], *str; str = strerror_r(1, buf, 20)"
. auto/func
ngx_func="localtime_r()"
ngx_func_inc="#include <time.h>"
ngx_func_test="struct tm t; time_t c=0; localtime_r(&c, &t)"
. auto/func
ngx_func="posix_memalign()"
ngx_func_inc="#include <stdlib.h>"
ngx_func_test="void *p; int n; n = posix_memalign(&p, 4096, 4096)"
. auto/func
ngx_func="memalign()"
ngx_func_inc="#include <stdlib.h>"
ngx_func_test="void *p; p = memalign(4096, 4096)"
. auto/func
ngx_feature="mmap(MAP_ANON|MAP_SHARED)"
ngx_feature_name="MAP_ANON"
ngx_feature_inc="#include <sys/mman.h>"
ngx_feature_test="void *p;
p = mmap(NULL, 4096, PROT_READ|PROT_WRITE,
MAP_ANON|MAP_SHARED, -1, 0);
if (p == MAP_FAILED) return 1;"
ngx_feature_run=yes
. auto/feature
ngx_feature='mmap("/dev/zero", MAP_SHARED)'
ngx_feature_name="MAP_DEVZERO"
ngx_feature_inc="#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>"
ngx_feature_test='void *p; int fd;
fd = open("/dev/zero", O_RDWR);
p = mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
if (p == MAP_FAILED) return 1;'
. auto/feature
ngx_feature="System V shared memory"
ngx_feature_name="SYSVSHM"
ngx_feature_inc="#include <sys/ipc.h>
#include <sys/shm.h>"
ngx_feature_test="int id;
id = shmget(IPC_PRIVATE, 4096, (SHM_R|SHM_W|IPC_CREAT));
if (id == -1) return 1;
shmctl(id, IPC_RMID, NULL);"
. auto/feature
ngx_feature="struct sockaddr_in.sin_len"
ngx_feature_name="sin_len"
ngx_feature_inc="#include <sys/socket.h>
#include <netinet/in.h>"
ngx_feature_test="struct sockaddr_in sa; sa.sin_len = 5"
ngx_feature_run=no
. auto/feature
ngx_feature="struct msghdr.msg_control"
ngx_feature_name="msghdr_msg_control"
ngx_feature_inc="#include <sys/socket.h>"
ngx_feature_test="struct msghdr msg; msg.msg_control = NULL"
. auto/feature
case $PLATFORM in
Linux:*)
ngx_feature_inc="#include <sys/ioctl.h>"
;;
*)
ngx_feature_inc="#include <sys/filio.h>"
;;
esac
ngx_feature="ioctl(FIONBIO)"
ngx_feature_name="FIONBIO"
ngx_feature_test="int i; i = FIONBIO"
. auto/feature
ngx_feature="struct tm.tm_gmtoff"
ngx_feature_name="gmtoff"
ngx_feature_inc="#include <time.h>"
ngx_feature_test="struct tm tm; tm.tm_gmtoff = 0"
. auto/feature
|