0002-auto-feature-add-mechanism-allowing-to-force-feature.patch 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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
  5. test result
  6. Whenever a feature needs to run a test, the ngx_feature_run_force_result
  7. variable can be set to the desired test result, and thus skip the test.
  8. Therefore, the generated config.h file will honor these presets.
  9. This mechanism aims to make easier cross-compilation support.
  10. Signed-off-by: Samuel Martin <s.martin49@gmail.com>
  11. ---
  12. auto/feature | 80 ++++++++++++++++++++++++++++++++++++++++++++----------------
  13. 1 file changed, 59 insertions(+), 21 deletions(-)
  14. diff --git a/auto/feature b/auto/feature
  15. index 1145f28..a194b85 100644
  16. --- a/auto/feature
  17. +++ b/auto/feature
  18. @@ -52,50 +52,88 @@ if [ -x $NGX_AUTOTEST ]; then
  19. case "$ngx_feature_run" in
  20. yes)
  21. - # /bin/sh is used to intercept "Killed" or "Abort trap" messages
  22. - if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
  23. - echo " found"
  24. + if test -n "$ngx_feature_run_force_result" ; then
  25. + echo " not tested (maybe cross-compiling)"
  26. + if test -n "$ngx_feature_name" ; then
  27. + if test "$ngx_feature_run_force_result" = "yes" ; then
  28. + have=$ngx_have_feature . auto/have
  29. + fi
  30. + fi
  31. ngx_found=yes
  32. + else
  33. - if test -n "$ngx_feature_name"; then
  34. - have=$ngx_have_feature . auto/have
  35. + # /bin/sh is used to intercept "Killed" or "Abort trap" messages
  36. + if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
  37. + echo " found"
  38. + ngx_found=yes
  39. +
  40. + if test -n "$ngx_feature_name"; then
  41. + have=$ngx_have_feature . auto/have
  42. + fi
  43. +
  44. + else
  45. + echo " found but is not working"
  46. fi
  47. - else
  48. - echo " found but is not working"
  49. fi
  50. ;;
  51. value)
  52. - # /bin/sh is used to intercept "Killed" or "Abort trap" messages
  53. - if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
  54. - echo " found"
  55. + if test -n "$ngx_feature_run_force_result" ; then
  56. + echo " not tested (maybe cross-compiling)"
  57. + cat << END >> $NGX_AUTO_CONFIG_H
  58. +
  59. +#ifndef $ngx_feature_name
  60. +#define $ngx_feature_name $ngx_feature_run_force_result
  61. +#endif
  62. +
  63. +END
  64. ngx_found=yes
  65. + else
  66. - cat << END >> $NGX_AUTO_CONFIG_H
  67. + # /bin/sh is used to intercept "Killed" or "Abort trap" messages
  68. + if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
  69. + echo " found"
  70. + ngx_found=yes
  71. +
  72. + cat << END >> $NGX_AUTO_CONFIG_H
  73. #ifndef $ngx_feature_name
  74. #define $ngx_feature_name `$NGX_AUTOTEST`
  75. #endif
  76. END
  77. - else
  78. - echo " found but is not working"
  79. + else
  80. + echo " found but is not working"
  81. + fi
  82. +
  83. fi
  84. ;;
  85. bug)
  86. - # /bin/sh is used to intercept "Killed" or "Abort trap" messages
  87. - if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
  88. - echo " not found"
  89. -
  90. - else
  91. - echo " found"
  92. + if test -n "$ngx_feature_run_force_result" ; then
  93. + echo " not tested (maybe cross-compiling)"
  94. + if test -n "$ngx_feature_name"; then
  95. + if test "$ngx_feature_run_force_result" = "yes" ; then
  96. + have=$ngx_have_feature . auto/have
  97. + fi
  98. + fi
  99. ngx_found=yes
  100. + else
  101. - if test -n "$ngx_feature_name"; then
  102. - have=$ngx_have_feature . auto/have
  103. + # /bin/sh is used to intercept "Killed" or "Abort trap" messages
  104. + if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
  105. + echo " not found"
  106. +
  107. + else
  108. + echo " found"
  109. + ngx_found=yes
  110. +
  111. + if test -n "$ngx_feature_name"; then
  112. + have=$ngx_have_feature . auto/have
  113. + fi
  114. fi
  115. +
  116. fi
  117. ;;
  118. --
  119. 1.9.2