[PATCH 2 of 4 v3] auto/feature: add mechanism allowing to force feature run test result

Samuel Martin s.martin49 at gmail.com
Fri Aug 1 23:14:07 UTC 2014


# HG changeset patch
# User Samuel Martin <s.martin49 at gmail.com>
# Date 1406932254 -7200
#      Sat Aug 02 00:30:54 2014 +0200
# Node ID 0abfd4903c4b440a18ed2de0d8c68e5b163e94f0
# Parent  e16232205bd4dd2f50173643d133b06b654ed2af
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 at gmail.com>

diff -r e16232205bd4 -r 0abfd4903c4b auto/feature
--- a/auto/feature	Sat Aug 02 00:30:54 2014 +0200
+++ b/auto/feature	Sat Aug 02 00:30:54 2014 +0200
@@ -52,50 +52,88 @@
     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"
+            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
 
-            else
-                echo " found"
-                ngx_found=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 " not found"
 
-                if test -n "$ngx_feature_name"; then
-                    have=$ngx_have_feature . auto/have
+                else
+                    echo " found"
+                    ngx_found=yes
+
+                    if test -n "$ngx_feature_name"; then
+                        have=$ngx_have_feature . auto/have
+                    fi
                 fi
+
             fi
         ;;
 



More information about the nginx-devel mailing list