feature 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. # Copyright (C) Igor Sysoev
  2. # Copyright (C) Nginx, Inc.
  3. echo $ngx_n "checking for $ngx_feature ...$ngx_c"
  4. cat << END >> $NGX_AUTOCONF_ERR
  5. ----------------------------------------
  6. checking for $ngx_feature
  7. END
  8. ngx_found=no
  9. if test -n "$ngx_feature_name"; then
  10. ngx_have_feature=`echo $ngx_feature_name \
  11. | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`
  12. fi
  13. if test -n "$ngx_feature_path"; then
  14. for ngx_temp in $ngx_feature_path; do
  15. ngx_feature_inc_path="$ngx_feature_inc_path -I $ngx_temp"
  16. done
  17. fi
  18. cat << END > $NGX_AUTOTEST.c
  19. #include <sys/types.h>
  20. $NGX_INCLUDE_UNISTD_H
  21. $ngx_feature_incs
  22. int main(void) {
  23. $ngx_feature_test;
  24. return 0;
  25. }
  26. END
  27. ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS $ngx_feature_inc_path \
  28. -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_TEST_LD_OPT $ngx_feature_libs"
  29. ngx_feature_inc_path=
  30. eval "/bin/sh -c \"$ngx_test\" >> $NGX_AUTOCONF_ERR 2>&1"
  31. if [ -x $NGX_AUTOTEST ]; then
  32. case "$ngx_feature_run" in
  33. yes)
  34. # /bin/sh is used to intercept "Killed" or "Abort trap" messages
  35. if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
  36. echo " found"
  37. ngx_found=yes
  38. if test -n "$ngx_feature_name"; then
  39. have=$ngx_have_feature . auto/have
  40. fi
  41. else
  42. echo " found but is not working"
  43. fi
  44. ;;
  45. value)
  46. # /bin/sh is used to intercept "Killed" or "Abort trap" messages
  47. if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
  48. echo " found"
  49. ngx_found=yes
  50. cat << END >> $NGX_AUTO_CONFIG_H
  51. #ifndef $ngx_feature_name
  52. #define $ngx_feature_name `$NGX_AUTOTEST`
  53. #endif
  54. END
  55. else
  56. echo " found but is not working"
  57. fi
  58. ;;
  59. bug)
  60. # /bin/sh is used to intercept "Killed" or "Abort trap" messages
  61. if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
  62. echo " not found"
  63. else
  64. echo " found"
  65. ngx_found=yes
  66. if test -n "$ngx_feature_name"; then
  67. have=$ngx_have_feature . auto/have
  68. fi
  69. fi
  70. ;;
  71. *)
  72. echo " found"
  73. ngx_found=yes
  74. if test -n "$ngx_feature_name"; then
  75. have=$ngx_have_feature . auto/have
  76. fi
  77. ;;
  78. esac
  79. else
  80. echo " not found"
  81. echo "----------" >> $NGX_AUTOCONF_ERR
  82. cat $NGX_AUTOTEST.c >> $NGX_AUTOCONF_ERR
  83. echo "----------" >> $NGX_AUTOCONF_ERR
  84. echo $ngx_test >> $NGX_AUTOCONF_ERR
  85. echo "----------" >> $NGX_AUTOCONF_ERR
  86. fi
  87. rm -rf $NGX_AUTOTEST*