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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
|
We do not have capability to run binaries when cross compiling
Upstream-Status: Pending
Index: nginx-1.12.2/auto/feature
===================================================================
--- nginx-1.12.2.orig/auto/feature
+++ nginx-1.12.2/auto/feature
@@ -49,12 +49,20 @@ eval "/bin/sh -c \"$ngx_test\" >> $NGX_A
if [ -x $NGX_AUTOTEST ]; then
+ if [ ".$NGX_CROSS_COMPILE" = ".yes" ]; then
+ NGX_AUTOTEST_EXEC="true"
+ NGX_FOUND_MSG=" (not tested, cross compiling)"
+ else
+ NGX_AUTOTEST_EXEC="$NGX_AUTOTEST"
+ NGX_FOUND_MSG=""
+ fi
+
case "$ngx_feature_run" in
yes)
# /bin/sh is used to intercept "Killed" or "Abort trap" messages
- if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
- echo " found"
+ if /bin/sh -c $NGX_AUTOTEST_EXEC >> $NGX_AUTOCONF_ERR 2>&1; then
+ echo " found$NGX_FOUND_MSG"
ngx_found=yes
if test -n "$ngx_feature_name"; then
@@ -68,17 +76,27 @@ if [ -x $NGX_AUTOTEST ]; then
value)
# /bin/sh is used to intercept "Killed" or "Abort trap" messages
- if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
- echo " found"
+ if /bin/sh -c $NGX_AUTOTEST_EXEC >> $NGX_AUTOCONF_ERR 2>&1; then
+ echo " found$NGX_FOUND_MSG"
ngx_found=yes
- cat << END >> $NGX_AUTO_CONFIG_H
+ if [ ".$NGX_CROSS_COMPILE" = ".yes" ]; then
+ cat << END >> $NGX_AUTO_CONFIG_H
#ifndef $ngx_feature_name
-#define $ngx_feature_name `$NGX_AUTOTEST`
+#define $ngx_feature_name $(eval "echo \$NGX_WITH_${ngx_feature_name}")
#endif
END
+ else
+ cat << END >> $NGX_AUTO_CONFIG_H
+
+#ifndef $ngx_feature_name
+#define $ngx_feature_name `$NGX_AUTOTEST_EXEC`
+#endif
+
+END
+ fi
else
echo " found but is not working"
fi
@@ -86,7 +104,7 @@ END
bug)
# /bin/sh is used to intercept "Killed" or "Abort trap" messages
- if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
+ if /bin/sh -c $NGX_AUTOTEST_EXEC >> $NGX_AUTOCONF_ERR 2>&1; then
echo " not found"
else
Index: nginx-1.12.2/auto/options
===================================================================
--- nginx-1.12.2.orig/auto/options
+++ nginx-1.12.2/auto/options
@@ -386,6 +386,18 @@ $0: warning: the \"--with-sha1-asm\" opt
--test-build-epoll) NGX_TEST_BUILD_EPOLL=YES ;;
--test-build-solaris-sendfilev) NGX_TEST_BUILD_SOLARIS_SENDFILEV=YES ;;
+ # cross compile support
+ --with-int=*) NGX_WITH_INT="$value" ;;
+ --with-long=*) NGX_WITH_LONG="$value" ;;
+ --with-long-long=*) NGX_WITH_LONG_LONG="$value" ;;
+ --with-ptr-size=*) NGX_WITH_PTR_SIZE="$value" ;;
+ --with-sig-atomic-t=*) NGX_WITH_SIG_ATOMIC_T="$value" ;;
+ --with-size-t=*) NGX_WITH_SIZE_T="$value" ;;
+ --with-off-t=*) NGX_WITH_OFF_T="$value" ;;
+ --with-time-t=*) NGX_WITH_TIME_T="$value" ;;
+ --with-sys-nerr=*) NGX_WITH_NGX_SYS_NERR="$value" ;;
+ --with-endian=*) NGX_WITH_ENDIAN="$value" ;;
+
*)
echo "$0: error: invalid option \"$option\""
exit 1
@@ -568,6 +580,17 @@ cat << END
--with-debug enable debug logging
+ --with-int=VALUE force int size
+ --with-long=VALUE force long size
+ --with-long-long=VALUE force long long size
+ --with-ptr-size=VALUE force pointer size
+ --with-sig-atomic-t=VALUE force sig_atomic_t size
+ --with-size-t=VALUE force size_t size
+ --with-off-t=VALUE force off_t size
+ --with-time-t=VALUE force time_t size
+ --with-sys-nerr=VALUE force sys_nerr value
+ --with-endian=VALUE force system endianess
+
END
exit 1
@@ -576,6 +599,8 @@ fi
if [ ".$NGX_PLATFORM" = ".win32" ]; then
NGX_WINE=$WINE
+elif [ ! -z "$NGX_PLATFORM" ]; then
+ NGX_CROSS_COMPILE="yes"
fi
Index: nginx-1.12.2/auto/types/sizeof
===================================================================
--- nginx-1.12.2.orig/auto/types/sizeof
+++ nginx-1.12.2/auto/types/sizeof
@@ -12,9 +12,12 @@ checking for $ngx_type size
END
-ngx_size=
+ngx_size=$(eval "echo \$NGX_WITH_${ngx_param}")
-cat << END > $NGX_AUTOTEST.c
+if [ ".$ngx_size" != "." ]; then
+ echo " $ngx_size bytes"
+else
+ cat << END > $NGX_AUTOTEST.c
#include <sys/types.h>
#include <sys/time.h>
@@ -33,15 +36,16 @@ int main(void) {
END
-ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
- -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
+ ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
+ -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
-eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
+ eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
-if [ -x $NGX_AUTOTEST ]; then
- ngx_size=`$NGX_AUTOTEST`
- echo " $ngx_size bytes"
+ if [ -x $NGX_AUTOTEST ]; then
+ ngx_size=`$NGX_AUTOTEST`
+ echo " $ngx_size bytes"
+ fi
fi
Index: nginx-1.12.2/auto/unix
===================================================================
--- nginx-1.12.2.orig/auto/unix
+++ nginx-1.12.2/auto/unix
@@ -587,13 +587,13 @@ ngx_feature_libs=
# C types
-ngx_type="int"; . auto/types/sizeof
+ngx_type="int"; ngx_param="INT"; . auto/types/sizeof
-ngx_type="long"; . auto/types/sizeof
+ngx_type="long"; ngx_param="LONG"; . auto/types/sizeof
-ngx_type="long long"; . auto/types/sizeof
+ngx_type="long long"; ngx_param="LONG_LONG"; . auto/types/sizeof
-ngx_type="void *"; . auto/types/sizeof; ngx_ptr_size=$ngx_size
+ngx_type="void *"; ngx_param="PTR_SIZE"; . auto/types/sizeof; ngx_ptr_size=$ngx_size
ngx_param=NGX_PTR_SIZE; ngx_value=$ngx_size; . auto/types/value
@@ -604,7 +604,7 @@ NGX_INCLUDE_AUTO_CONFIG_H="#include \"ng
ngx_type="uint32_t"; ngx_types="u_int32_t"; . auto/types/typedef
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="sig_atomic_t"; ngx_param="SIG_ATOMIC_T"; ngx_types="int"; . auto/types/typedef
. auto/types/sizeof
ngx_param=NGX_SIG_ATOMIC_T_SIZE; ngx_value=$ngx_size; . auto/types/value
@@ -620,15 +620,15 @@ ngx_type="rlim_t"; ngx_types="int"; . au
. auto/endianness
-ngx_type="size_t"; . auto/types/sizeof
+ngx_type="size_t"; ngx_param="SIZE_T"; . auto/types/sizeof
ngx_param=NGX_MAX_SIZE_T_VALUE; ngx_value=$ngx_max_value; . auto/types/value
ngx_param=NGX_SIZE_T_LEN; ngx_value=$ngx_max_len; . auto/types/value
-ngx_type="off_t"; . auto/types/sizeof
+ngx_type="off_t"; ngx_param="OFF_T"; . auto/types/sizeof
ngx_param=NGX_MAX_OFF_T_VALUE; ngx_value=$ngx_max_value; . auto/types/value
ngx_param=NGX_OFF_T_LEN; ngx_value=$ngx_max_len; . auto/types/value
-ngx_type="time_t"; . auto/types/sizeof
+ngx_type="time_t"; ngx_param="TIME_T"; . auto/types/sizeof
ngx_param=NGX_TIME_T_SIZE; ngx_value=$ngx_size; . auto/types/value
ngx_param=NGX_TIME_T_LEN; ngx_value=$ngx_max_len; . auto/types/value
ngx_param=NGX_MAX_TIME_T_VALUE; ngx_value=$ngx_max_value; . auto/types/value
|