1 From ef72be22ad6d58e230f75553d80b470b80c3303a Mon Sep 17 00:00:00 2001
2 From: Samuel Martin <s.martin49@gmail.com>
3 Date: Sun, 4 May 2014 00:40:49 +0200
4 Subject: [PATCH] auto/feature: add mechanism allowing to force feature run
7 Whenever a feature needs to run a test, the ngx_feature_run_force_result
8 variable can be set to the desired test result, and thus skip the test.
10 Therefore, the generated config.h file will honor these presets.
12 This mechanism aims to make easier cross-compilation support.
14 Signed-off-by: Samuel Martin <s.martin49@gmail.com>
16 auto/feature | 80 ++++++++++++++++++++++++++++++++++++++++++++----------------
17 1 file changed, 59 insertions(+), 21 deletions(-)
19 diff --git a/auto/feature b/auto/feature
20 index 1145f28..a194b85 100644
23 @@ -52,50 +52,88 @@ if [ -x $NGX_AUTOTEST ]; then
24 case "$ngx_feature_run" in
27 - # /bin/sh is used to intercept "Killed" or "Abort trap" messages
28 - if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
30 + if test -n "$ngx_feature_run_force_result" ; then
31 + echo " not tested (maybe cross-compiling)"
32 + if test -n "$ngx_feature_name" ; then
33 + if test "$ngx_feature_run_force_result" = "yes" ; then
34 + have=$ngx_have_feature . auto/have
40 - if test -n "$ngx_feature_name"; then
41 - have=$ngx_have_feature . auto/have
42 + # /bin/sh is used to intercept "Killed" or "Abort trap" messages
43 + if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
47 + if test -n "$ngx_feature_name"; then
48 + have=$ngx_have_feature . auto/have
52 + echo " found but is not working"
56 - echo " found but is not working"
61 - # /bin/sh is used to intercept "Killed" or "Abort trap" messages
62 - if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
64 + if test -n "$ngx_feature_run_force_result" ; then
65 + echo " not tested (maybe cross-compiling)"
66 + cat << END >> $NGX_AUTO_CONFIG_H
68 +#ifndef $ngx_feature_name
69 +#define $ngx_feature_name $ngx_feature_run_force_result
76 - cat << END >> $NGX_AUTO_CONFIG_H
77 + # /bin/sh is used to intercept "Killed" or "Abort trap" messages
78 + if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
82 + cat << END >> $NGX_AUTO_CONFIG_H
84 #ifndef $ngx_feature_name
85 #define $ngx_feature_name `$NGX_AUTOTEST`
90 - echo " found but is not working"
92 + echo " found but is not working"
99 - # /bin/sh is used to intercept "Killed" or "Abort trap" messages
100 - if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
105 + if test -n "$ngx_feature_run_force_result" ; then
106 + echo " not tested (maybe cross-compiling)"
107 + if test -n "$ngx_feature_name"; then
108 + if test "$ngx_feature_run_force_result" = "yes" ; then
109 + have=$ngx_have_feature . auto/have
115 - if test -n "$ngx_feature_name"; then
116 - have=$ngx_have_feature . auto/have
117 + # /bin/sh is used to intercept "Killed" or "Abort trap" messages
118 + if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
125 + if test -n "$ngx_feature_name"; then
126 + have=$ngx_have_feature . auto/have