blob: 98e757cafab8f06ec0cbfecbaa4549f282f9c6ff [file] [log] [blame]
Igor Sysoev415b1ce2004-06-17 17:18:53 +00001
Igor Sysoevff8da912004-09-29 16:00:49 +00002# Copyright (C) Igor Sysoev
3
4
Igor Sysoevc0edbcc2004-10-21 15:34:38 +00005echo $ngx_n "checking for $ngx_feature ...$ngx_c"
6
7cat << END >> $NGX_AUTOCONF_ERR
8
9----------------------------------------
10checking for $ngx_feature
11
12END
Igor Sysoev415b1ce2004-06-17 17:18:53 +000013
14ngx_found=no
15
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000016if test -n "$ngx_feature_name"; then
Igor Sysoevac72bd12006-05-04 15:32:46 +000017 ngx_have_feature=`echo $ngx_feature_name \
18 | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000019fi
Igor Sysoev415b1ce2004-06-17 17:18:53 +000020
Igor Sysoev0ec09f92006-11-27 11:07:09 +000021if test -n "$ngx_feature_path"; then
Igor Sysoev1ae389d2008-08-04 14:48:15 +000022 for ngx_temp in $ngx_feature_path; do
23 ngx_feature_inc_path="$ngx_feature_inc_path -I $ngx_temp"
24 done
Igor Sysoev0ec09f92006-11-27 11:07:09 +000025fi
26
Igor Sysoev415b1ce2004-06-17 17:18:53 +000027cat << END > $NGX_AUTOTEST.c
28
29#include <sys/types.h>
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000030$NGX_INCLUDE_UNISTD_H
31$ngx_feature_incs
Igor Sysoev415b1ce2004-06-17 17:18:53 +000032
33int main() {
34 $ngx_feature_test;
35 return 0;
36}
37
38END
39
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000040
Igor Sysoev0ec09f92006-11-27 11:07:09 +000041ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS $ngx_feature_inc_path \
Igor Sysoev9f34ebe2009-11-27 22:02:04 +000042 -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_TEST_LD_OPT $ngx_feature_libs"
Igor Sysoev1b735832004-11-11 14:07:14 +000043
Igor Sysoev0ec09f92006-11-27 11:07:09 +000044ngx_feature_inc_path=
45
Igor Sysoev48ae1ac2006-12-23 20:31:14 +000046eval "/bin/sh -c \"$ngx_test\" >> $NGX_AUTOCONF_ERR 2>&1"
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000047
Igor Sysoev415b1ce2004-06-17 17:18:53 +000048
49if [ -x $NGX_AUTOTEST ]; then
50
Igor Sysoev13c68742006-03-10 12:51:52 +000051 case "$ngx_feature_run" in
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000052
Igor Sysoev13c68742006-03-10 12:51:52 +000053 yes)
Igor Sysoev2bdefc12006-09-18 12:27:33 +000054 # /bin/sh is used to intercept "Killed" or "Abort trap" messages
Igor Sysoev768f7a02011-05-11 11:50:19 +000055 if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
Igor Sysoev13c68742006-03-10 12:51:52 +000056 echo " found"
57 ngx_found=yes
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000058
Igor Sysoev13c68742006-03-10 12:51:52 +000059 if test -n "$ngx_feature_name"; then
60 have=$ngx_have_feature . auto/have
61 fi
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000062
Igor Sysoev13c68742006-03-10 12:51:52 +000063 else
64 echo " found but is not working"
65 fi
66 ;;
Igor Sysoev415b1ce2004-06-17 17:18:53 +000067
Igor Sysoev7f31a202010-11-25 11:04:03 +000068 value)
69 # /bin/sh is used to intercept "Killed" or "Abort trap" messages
Igor Sysoev768f7a02011-05-11 11:50:19 +000070 if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
Igor Sysoev7f31a202010-11-25 11:04:03 +000071 echo " found"
72 ngx_found=yes
73
74 cat << END >> $NGX_AUTO_CONFIG_H
75
76#ifndef $ngx_feature_name
77#define $ngx_feature_name `$NGX_AUTOTEST`
78#endif
79
80END
81 else
82 echo " found but is not working"
83 fi
84 ;;
85
Igor Sysoev13c68742006-03-10 12:51:52 +000086 bug)
Igor Sysoev2bdefc12006-09-18 12:27:33 +000087 # /bin/sh is used to intercept "Killed" or "Abort trap" messages
Igor Sysoev768f7a02011-05-11 11:50:19 +000088 if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
Igor Sysoev13c68742006-03-10 12:51:52 +000089 echo " not found"
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000090
Igor Sysoev13c68742006-03-10 12:51:52 +000091 else
92 echo " found"
93 ngx_found=yes
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000094
Igor Sysoev13c68742006-03-10 12:51:52 +000095 if test -n "$ngx_feature_name"; then
96 have=$ngx_have_feature . auto/have
97 fi
98 fi
99 ;;
100
101 *)
102 echo " found"
103 ngx_found=yes
104
105 if test -n "$ngx_feature_name"; then
106 have=$ngx_have_feature . auto/have
107 fi
108 ;;
109
110 esac
Igor Sysoev415b1ce2004-06-17 17:18:53 +0000111
112else
113 echo " not found"
Igor Sysoevc0edbcc2004-10-21 15:34:38 +0000114
115 echo "----------" >> $NGX_AUTOCONF_ERR
116 cat $NGX_AUTOTEST.c >> $NGX_AUTOCONF_ERR
117 echo "----------" >> $NGX_AUTOCONF_ERR
118 echo $ngx_test >> $NGX_AUTOCONF_ERR
119 echo "----------" >> $NGX_AUTOCONF_ERR
Igor Sysoev415b1ce2004-06-17 17:18:53 +0000120fi
121
122rm $NGX_AUTOTEST*