0002-auto-feature-add-mechanism-allowing-to-force-feature.patch
4.49 KB
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
From ef72be22ad6d58e230f75553d80b470b80c3303a Mon Sep 17 00:00:00 2001
From: Samuel Martin <s.martin49@gmail.com>
Date: Sun, 4 May 2014 00:40:49 +0200
Subject: [PATCH] auto/feature: add mechanism allowing to force feature run
test result
Whenever a feature needs to run a test, the ngx_feature_run_force_result
variable can be set to the desired test result, and thus skip the test.
Therefore, the generated config.h file will honor these presets.
This mechanism aims to make easier cross-compilation support.
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
---
auto/feature | 80 ++++++++++++++++++++++++++++++++++++++++++++----------------
1 file changed, 59 insertions(+), 21 deletions(-)
diff --git a/auto/feature b/auto/feature
index 1145f28..a194b85 100644
--- a/auto/feature
+++ b/auto/feature
@@ -52,50 +52,88 @@ if [ -x $NGX_AUTOTEST ]; then
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 test -n "$ngx_feature_run_force_result" ; then
+ echo " not tested (maybe cross-compiling)"
+ if test -n "$ngx_feature_name" ; then
+ if test "$ngx_feature_run_force_result" = "yes" ; then
+ have=$ngx_have_feature . auto/have
+ fi
+ fi
ngx_found=yes
+ else
- if test -n "$ngx_feature_name"; then
- have=$ngx_have_feature . auto/have
+ # /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"
+ ngx_found=yes
+
+ if test -n "$ngx_feature_name"; then
+ have=$ngx_have_feature . auto/have
+ fi
+
+ else
+ echo " found but is not working"
fi
- else
- echo " found but is not working"
fi
;;
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 test -n "$ngx_feature_run_force_result" ; then
+ echo " not tested (maybe cross-compiling)"
+ cat << END >> $NGX_AUTO_CONFIG_H
+
+#ifndef $ngx_feature_name
+#define $ngx_feature_name $ngx_feature_run_force_result
+#endif
+
+END
ngx_found=yes
+ else
- cat << END >> $NGX_AUTO_CONFIG_H
+ # /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"
+ ngx_found=yes
+
+ cat << END >> $NGX_AUTO_CONFIG_H
#ifndef $ngx_feature_name
#define $ngx_feature_name `$NGX_AUTOTEST`
#endif
END
- else
- echo " found but is not working"
+ else
+ echo " found but is not working"
+ fi
+
fi
;;
bug)
- # /bin/sh is used to intercept "Killed" or "Abort trap" messages
- if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
- echo " not found"
-
- else
- echo " found"
+ if test -n "$ngx_feature_run_force_result" ; then
+ echo " not tested (maybe cross-compiling)"
+ if test -n "$ngx_feature_name"; then
+ if test "$ngx_feature_run_force_result" = "yes" ; then
+ have=$ngx_have_feature . auto/have
+ fi
+ fi
ngx_found=yes
+ else
- if test -n "$ngx_feature_name"; then
- have=$ngx_have_feature . auto/have
+ # /bin/sh is used to intercept "Killed" or "Abort trap" messages
+ if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
+ echo " not found"
+
+ else
+ echo " found"
+ ngx_found=yes
+
+ if test -n "$ngx_feature_name"; then
+ have=$ngx_have_feature . auto/have
+ fi
fi
+
fi
;;
--
1.9.2