clang (633:be7c69b71469) clang (701:f184ffeb0f02)
1
2# Copyright (C) Igor Sysoev
3# Copyright (C) NGINX, Inc.
4
5
6# C language features.
7
8
9nxt_feature="C99 variadic macro"
10nxt_feature_name=NXT_HAVE_C99_VARIADIC_MACRO
11nxt_feature_run=yes
12nxt_feature_incs=
13nxt_feature_libs=
14nxt_feature_test="#include <stdio.h>
15 #define set(dummy, ...) sprintf(__VA_ARGS__)
16
17 int main() {
18 char buf[4];
19
20 buf[0] = '0';
21 set(0, buf, \"%d\", 1);
22
23 if (buf[0] == '1')
24 return 0;
25 return 1;
26 }"
27. auto/feature
28
29
30if [ $nxt_found = no ]; then
31
32 nxt_feature="GCC variadic macro"
33 nxt_feature_name=NXT_HAVE_GCC_VARIADIC_MACRO
34 nxt_feature_run=yes
35 nxt_feature_incs=
36 nxt_feature_libs=
37 nxt_feature_test="#include <stdio.h>
38 #define set(dummy, args...) sprintf(args)
39
40 int main() {
41 char buf[4];
42
43 buf[0] = '0';
44 set(0, buf, \"%d\", 1);
45
46 if (buf[0] == '1')
47 return 0;
48 return 1;
49 }"
50 . auto/feature
51fi
52
53
54nxt_feature="GCC __builtin_expect()"
55nxt_feature_name=NXT_HAVE_BUILTIN_EXPECT
56nxt_feature_run=no
57nxt_feature_incs=
58nxt_feature_libs=
59nxt_feature_test="int main(int argc, char *const *argv) {
60 if ((__typeof__(argc == 0))
61 __builtin_expect((argc == 0), 0))
62 return 0;
63 return 1;
64 }"
65. auto/feature
66
67
68nxt_feature="GCC __builtin_unreachable()"
69nxt_feature_name=NXT_HAVE_BUILTIN_UNREACHABLE
70nxt_feature_run=no
71nxt_feature_incs=
72nxt_feature_libs=
73nxt_feature_test="int main() {
74 __builtin_unreachable();
75 }"
76. auto/feature
77
78
79nxt_feature="GCC __builtin_prefetch()"
80nxt_feature_name=NXT_HAVE_BUILTIN_PREFETCH
81nxt_feature_run=no
82nxt_feature_incs=
83nxt_feature_libs=
84nxt_feature_test="int main() {
85 __builtin_prefetch(0);
86 return 0;
87 }"
88. auto/feature
89
90
91nxt_feature="GCC __builtin_clz()"
92nxt_feature_name=NXT_HAVE_BUILTIN_CLZ
93nxt_feature_run=
94nxt_feature_incs=
95nxt_feature_libs=
96nxt_feature_test="int main() {
97 if (__builtin_clz(1) == 31)
98 return 0;
99 return 1;
100 }"
101. auto/feature
102
103
1
2# Copyright (C) Igor Sysoev
3# Copyright (C) NGINX, Inc.
4
5
6# C language features.
7
8
9nxt_feature="C99 variadic macro"
10nxt_feature_name=NXT_HAVE_C99_VARIADIC_MACRO
11nxt_feature_run=yes
12nxt_feature_incs=
13nxt_feature_libs=
14nxt_feature_test="#include <stdio.h>
15 #define set(dummy, ...) sprintf(__VA_ARGS__)
16
17 int main() {
18 char buf[4];
19
20 buf[0] = '0';
21 set(0, buf, \"%d\", 1);
22
23 if (buf[0] == '1')
24 return 0;
25 return 1;
26 }"
27. auto/feature
28
29
30if [ $nxt_found = no ]; then
31
32 nxt_feature="GCC variadic macro"
33 nxt_feature_name=NXT_HAVE_GCC_VARIADIC_MACRO
34 nxt_feature_run=yes
35 nxt_feature_incs=
36 nxt_feature_libs=
37 nxt_feature_test="#include <stdio.h>
38 #define set(dummy, args...) sprintf(args)
39
40 int main() {
41 char buf[4];
42
43 buf[0] = '0';
44 set(0, buf, \"%d\", 1);
45
46 if (buf[0] == '1')
47 return 0;
48 return 1;
49 }"
50 . auto/feature
51fi
52
53
54nxt_feature="GCC __builtin_expect()"
55nxt_feature_name=NXT_HAVE_BUILTIN_EXPECT
56nxt_feature_run=no
57nxt_feature_incs=
58nxt_feature_libs=
59nxt_feature_test="int main(int argc, char *const *argv) {
60 if ((__typeof__(argc == 0))
61 __builtin_expect((argc == 0), 0))
62 return 0;
63 return 1;
64 }"
65. auto/feature
66
67
68nxt_feature="GCC __builtin_unreachable()"
69nxt_feature_name=NXT_HAVE_BUILTIN_UNREACHABLE
70nxt_feature_run=no
71nxt_feature_incs=
72nxt_feature_libs=
73nxt_feature_test="int main() {
74 __builtin_unreachable();
75 }"
76. auto/feature
77
78
79nxt_feature="GCC __builtin_prefetch()"
80nxt_feature_name=NXT_HAVE_BUILTIN_PREFETCH
81nxt_feature_run=no
82nxt_feature_incs=
83nxt_feature_libs=
84nxt_feature_test="int main() {
85 __builtin_prefetch(0);
86 return 0;
87 }"
88. auto/feature
89
90
91nxt_feature="GCC __builtin_clz()"
92nxt_feature_name=NXT_HAVE_BUILTIN_CLZ
93nxt_feature_run=
94nxt_feature_incs=
95nxt_feature_libs=
96nxt_feature_test="int main() {
97 if (__builtin_clz(1) == 31)
98 return 0;
99 return 1;
100 }"
101. auto/feature
102
103
104nxt_feature="GCC __builtin_popcount()"
105nxt_feature_name=NXT_HAVE_BUILTIN_POPCOUNT
106nxt_feature_run=
107nxt_feature_incs=
108nxt_feature_libs=
109nxt_feature_test="int main() {
110 if (__builtin_popcount(5) == 2)
111 return 0;
112 return 1;
113 }"
114. auto/feature
115
116
104nxt_feature="GCC __attribute__ visibility"
105nxt_feature_name=NXT_HAVE_GCC_ATTRIBUTE_VISIBILITY
106nxt_feature_run=
107nxt_feature_incs=
108nxt_feature_libs=
109nxt_feature_test="int n __attribute__ ((visibility(\"default\")));
110
111 int main() {
112 return 1;
113 }"
114. auto/feature
115
116
117nxt_feature="GCC __attribute__ aligned"
118nxt_feature_name=NXT_HAVE_GCC_ATTRIBUTE_ALIGNED
119nxt_feature_run=
120nxt_feature_incs=
121nxt_feature_libs=
122nxt_feature_test="int n __attribute__ ((aligned(64)));
123
124 int main() {
125 return 1;
126 }"
127. auto/feature
128
129
130nxt_feature="GCC __attribute__ malloc"
131nxt_feature_name=NXT_HAVE_GCC_ATTRIBUTE_MALLOC
132nxt_feature_run=
133nxt_feature_incs=
134nxt_feature_libs=
135nxt_feature_test="#include <stdlib.h>
136
137 void *f(void) __attribute__ ((__malloc__));
138
139 void *f(void) {
140 return malloc(1);
141 }
142
143 int main() {
144 if (f() != NULL) {
145 return 1;
146 }
147 return 0;
148 }"
149. auto/feature
150
151
152nxt_feature="GCC __attribute__ packed"
153nxt_feature_name=NXT_HAVE_GCC_ATTRIBUTE_PACKED
154nxt_feature_run=
155nxt_feature_incs=
156nxt_feature_libs=
157nxt_feature_test="struct s {
158 char c;
159 int i;
160 } __attribute__ ((__packed__));
161
162 int main() {
163 return 1;
164 }"
165. auto/feature
117nxt_feature="GCC __attribute__ visibility"
118nxt_feature_name=NXT_HAVE_GCC_ATTRIBUTE_VISIBILITY
119nxt_feature_run=
120nxt_feature_incs=
121nxt_feature_libs=
122nxt_feature_test="int n __attribute__ ((visibility(\"default\")));
123
124 int main() {
125 return 1;
126 }"
127. auto/feature
128
129
130nxt_feature="GCC __attribute__ aligned"
131nxt_feature_name=NXT_HAVE_GCC_ATTRIBUTE_ALIGNED
132nxt_feature_run=
133nxt_feature_incs=
134nxt_feature_libs=
135nxt_feature_test="int n __attribute__ ((aligned(64)));
136
137 int main() {
138 return 1;
139 }"
140. auto/feature
141
142
143nxt_feature="GCC __attribute__ malloc"
144nxt_feature_name=NXT_HAVE_GCC_ATTRIBUTE_MALLOC
145nxt_feature_run=
146nxt_feature_incs=
147nxt_feature_libs=
148nxt_feature_test="#include <stdlib.h>
149
150 void *f(void) __attribute__ ((__malloc__));
151
152 void *f(void) {
153 return malloc(1);
154 }
155
156 int main() {
157 if (f() != NULL) {
158 return 1;
159 }
160 return 0;
161 }"
162. auto/feature
163
164
165nxt_feature="GCC __attribute__ packed"
166nxt_feature_name=NXT_HAVE_GCC_ATTRIBUTE_PACKED
167nxt_feature_run=
168nxt_feature_incs=
169nxt_feature_libs=
170nxt_feature_test="struct s {
171 char c;
172 int i;
173 } __attribute__ ((__packed__));
174
175 int main() {
176 return 1;
177 }"
178. auto/feature