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
|
# Copyright (C) Igor Sysoev
# Copyright (C) NGINX, Inc.
# GCC 4.1+ builtin atomic operations.
nxt_feature="GCC builtin atomic operations"
nxt_feature_name=NXT_HAVE_GCC_ATOMIC
nxt_feature_run=yes
nxt_feature_incs=
nxt_feature_libs=
nxt_feature_test="int main() {
long n = 0;
if (!__sync_bool_compare_and_swap(&n, 0, 3))
return 1;
if (__sync_fetch_and_add(&n, 1) != 3)
return 1;
if (__sync_lock_test_and_set(&n, 5) != 4)
return 1;
if (n != 5)
return 1;
if (__sync_or_and_fetch(&n, 2) != 7)
return 1;
if (__sync_and_and_fetch(&n, 5) != 5)
return 1;
__sync_lock_release(&n);
if (n != 0)
return 1;
return 0;
}"
. auto/feature
# Solaris 10 builtin atomic operations.
if [ $nxt_found = no ]; then
nxt_feature="Solaris builtin atomic operations"
nxt_feature_name=NXT_HAVE_SOLARIS_ATOMIC
nxt_feature_run=yes
nxt_feature_incs=
nxt_feature_libs=
nxt_feature_test="#include <atomic.h>
int main() {
ulong_t n = 0;
if (atomic_cas_ulong(&n, 0, 3) != 0)
return 1;
if (atomic_add_long_nv(&n, 1) != 4)
return 1;
if (atomic_swap_ulong(&n, 5) != 4)
return 1;
if (n != 5)
return 1;
if (atomic_or_ulong_nv(&n, 2) != 7)
return 1;
if (atomic_and_ulong_nv(&n, 5) != 5)
return 1;
return 0;
}"
. auto/feature
fi
# AIX xlC builtin atomic operations.
if [ $nxt_found = no ]; then
if [ $NXT_64BIT = 1 ]; then
nxt_feature_test="int main() {
long n = 0;
long o = 0;
if (!__compare_and_swaplp(&n, &o, 3))
return 1;
if (__fetch_and_addlp(&n, 1) != 3)
return 1;
if (__fetch_and_swaplp(&n, 5) != 4)
return 1;
if (n != 5)
return 1;
__isync();
__lwsync();
return 0;
}"
else
nxt_feature_test="int main() {
int n = 0;
int o = 0;
if (!__compare_and_swap(&n, &o, 3))
return 1;
if (__fetch_and_add(&n, 1) != 3)
return 1;
if (__fetch_and_swap(&n, 5) != 4)
return 1;
if (n != 5)
return 1;
__isync();
__lwsync();
return 0;
}"
fi
nxt_feature="xlC builtin atomic operations"
nxt_feature_name=NXT_HAVE_XLC_ATOMIC
nxt_feature_run=yes
nxt_feature_incs=
nxt_feature_libs=
. auto/feature
fi
if [ $nxt_found = no ]; then
$echo
$echo $0: error: no atomic operations found.
$echo
exit 1;
fi
|