Release 0.8.7-1
[nginx-catap.git] / auto / feature
blobcd71e27b1cdf93f6a44aa78ee9d5e1fdc55388a0
2 # Copyright (C) Igor Sysoev
5 echo $ngx_n "checking for $ngx_feature ...$ngx_c"
7 cat << END >> $NGX_AUTOCONF_ERR
9 ----------------------------------------
10 checking for $ngx_feature
12 END
14 ngx_found=no
16 if test -n "$ngx_feature_name"; then
17     ngx_have_feature=`echo $ngx_feature_name \
18                    | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`
21 if test -n "$ngx_feature_path"; then
22     for ngx_temp in $ngx_feature_path; do
23         ngx_feature_inc_path="$ngx_feature_inc_path -I $ngx_temp"
24     done
27 cat << END > $NGX_AUTOTEST.c
29 #include <sys/types.h>
30 $NGX_INCLUDE_UNISTD_H
31 $ngx_feature_incs
33 int main() {
34     $ngx_feature_test;
35     return 0;
38 END
41 ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS $ngx_feature_inc_path \
42           -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
44 ngx_feature_inc_path=
46 eval "/bin/sh -c \"$ngx_test\" >> $NGX_AUTOCONF_ERR 2>&1"
49 if [ -x $NGX_AUTOTEST ]; then
51     case "$ngx_feature_run" in
53         yes)
54             # /bin/sh is used to intercept "Killed" or "Abort trap" messages
55             if /bin/sh -c $NGX_AUTOTEST >/dev/null 2>&1; then
56                 echo " found"
57                 ngx_found=yes
59                 if test -n "$ngx_feature_name"; then
60                     have=$ngx_have_feature . auto/have
61                 fi
63             else
64                 echo " found but is not working"
65             fi
66         ;;
68         bug)
69             # /bin/sh is used to intercept "Killed" or "Abort trap" messages
70             if /bin/sh -c $NGX_AUTOTEST >/dev/null 2>&1; then
71                 echo " not found"
73             else
74                 echo " found"
75                 ngx_found=yes
77                 if test -n "$ngx_feature_name"; then
78                     have=$ngx_have_feature . auto/have
79                 fi
80             fi
81         ;;
83         *)
84             echo " found"
85             ngx_found=yes
87             if test -n "$ngx_feature_name"; then
88                 have=$ngx_have_feature . auto/have
89             fi
90         ;;
92     esac
94 else
95     echo " not found"
97     echo "----------"    >> $NGX_AUTOCONF_ERR
98     cat $NGX_AUTOTEST.c  >> $NGX_AUTOCONF_ERR
99     echo "----------"    >> $NGX_AUTOCONF_ERR
100     echo $ngx_test       >> $NGX_AUTOCONF_ERR
101     echo "----------"    >> $NGX_AUTOCONF_ERR
104 rm $NGX_AUTOTEST*