blob: 3561f5941f24e83e9fb5c6ddd8f4d5b85977da4d [file] [log] [blame]
Igor Sysoev415b1ce2004-06-17 17:18:53 +00001
Igor Sysoevff8da912004-09-29 16:00:49 +00002# Copyright (C) Igor Sysoev
Maxim Konovalovf8d59e32012-01-18 15:07:43 +00003# Copyright (C) Nginx, Inc.
Igor Sysoevff8da912004-09-29 16:00:49 +00004
5
Igor Sysoevc0edbcc2004-10-21 15:34:38 +00006echo $ngx_n "checking for $ngx_feature ...$ngx_c"
7
8cat << END >> $NGX_AUTOCONF_ERR
9
10----------------------------------------
11checking for $ngx_feature
12
13END
Igor Sysoev415b1ce2004-06-17 17:18:53 +000014
15ngx_found=no
16
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000017if test -n "$ngx_feature_name"; then
Igor Sysoevac72bd12006-05-04 15:32:46 +000018 ngx_have_feature=`echo $ngx_feature_name \
19 | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000020fi
Igor Sysoev415b1ce2004-06-17 17:18:53 +000021
Igor Sysoev0ec09f92006-11-27 11:07:09 +000022if test -n "$ngx_feature_path"; then
Igor Sysoev1ae389d2008-08-04 14:48:15 +000023 for ngx_temp in $ngx_feature_path; do
24 ngx_feature_inc_path="$ngx_feature_inc_path -I $ngx_temp"
25 done
Igor Sysoev0ec09f92006-11-27 11:07:09 +000026fi
27
Igor Sysoev415b1ce2004-06-17 17:18:53 +000028cat << END > $NGX_AUTOTEST.c
29
30#include <sys/types.h>
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000031$NGX_INCLUDE_UNISTD_H
32$ngx_feature_incs
Igor Sysoev415b1ce2004-06-17 17:18:53 +000033
Piotr Sikora805cd1e2016-06-27 15:00:05 -070034int main(void) {
Igor Sysoev415b1ce2004-06-17 17:18:53 +000035 $ngx_feature_test;
36 return 0;
37}
38
39END
40
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000041
Igor Sysoev0ec09f92006-11-27 11:07:09 +000042ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS $ngx_feature_inc_path \
Igor Sysoev9f34ebe2009-11-27 22:02:04 +000043 -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_TEST_LD_OPT $ngx_feature_libs"
Igor Sysoev1b735832004-11-11 14:07:14 +000044
Igor Sysoev0ec09f92006-11-27 11:07:09 +000045ngx_feature_inc_path=
46
Igor Sysoev48ae1ac2006-12-23 20:31:14 +000047eval "/bin/sh -c \"$ngx_test\" >> $NGX_AUTOCONF_ERR 2>&1"
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000048
Igor Sysoev415b1ce2004-06-17 17:18:53 +000049
50if [ -x $NGX_AUTOTEST ]; then
51
Igor Sysoev13c68742006-03-10 12:51:52 +000052 case "$ngx_feature_run" in
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000053
Igor Sysoev13c68742006-03-10 12:51:52 +000054 yes)
Igor Sysoev2bdefc12006-09-18 12:27:33 +000055 # /bin/sh is used to intercept "Killed" or "Abort trap" messages
Igor Sysoev768f7a02011-05-11 11:50:19 +000056 if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
Igor Sysoev13c68742006-03-10 12:51:52 +000057 echo " found"
58 ngx_found=yes
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000059
Igor Sysoev13c68742006-03-10 12:51:52 +000060 if test -n "$ngx_feature_name"; then
61 have=$ngx_have_feature . auto/have
62 fi
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000063
Igor Sysoev13c68742006-03-10 12:51:52 +000064 else
65 echo " found but is not working"
66 fi
67 ;;
Igor Sysoev415b1ce2004-06-17 17:18:53 +000068
Igor Sysoev7f31a202010-11-25 11:04:03 +000069 value)
70 # /bin/sh is used to intercept "Killed" or "Abort trap" messages
Igor Sysoev768f7a02011-05-11 11:50:19 +000071 if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
Igor Sysoev7f31a202010-11-25 11:04:03 +000072 echo " found"
73 ngx_found=yes
74
75 cat << END >> $NGX_AUTO_CONFIG_H
76
77#ifndef $ngx_feature_name
78#define $ngx_feature_name `$NGX_AUTOTEST`
79#endif
80
81END
82 else
83 echo " found but is not working"
84 fi
85 ;;
86
Igor Sysoev13c68742006-03-10 12:51:52 +000087 bug)
Igor Sysoev2bdefc12006-09-18 12:27:33 +000088 # /bin/sh is used to intercept "Killed" or "Abort trap" messages
Igor Sysoev768f7a02011-05-11 11:50:19 +000089 if /bin/sh -c $NGX_AUTOTEST >> $NGX_AUTOCONF_ERR 2>&1; then
Igor Sysoev13c68742006-03-10 12:51:52 +000090 echo " not found"
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000091
Igor Sysoev13c68742006-03-10 12:51:52 +000092 else
93 echo " found"
94 ngx_found=yes
Igor Sysoevc0edbcc2004-10-21 15:34:38 +000095
Igor Sysoev13c68742006-03-10 12:51:52 +000096 if test -n "$ngx_feature_name"; then
97 have=$ngx_have_feature . auto/have
98 fi
99 fi
100 ;;
101
102 *)
103 echo " found"
104 ngx_found=yes
105
106 if test -n "$ngx_feature_name"; then
107 have=$ngx_have_feature . auto/have
108 fi
109 ;;
110
111 esac
Igor Sysoev415b1ce2004-06-17 17:18:53 +0000112
113else
114 echo " not found"
Igor Sysoevc0edbcc2004-10-21 15:34:38 +0000115
116 echo "----------" >> $NGX_AUTOCONF_ERR
117 cat $NGX_AUTOTEST.c >> $NGX_AUTOCONF_ERR
118 echo "----------" >> $NGX_AUTOCONF_ERR
119 echo $ngx_test >> $NGX_AUTOCONF_ERR
120 echo "----------" >> $NGX_AUTOCONF_ERR
Igor Sysoev415b1ce2004-06-17 17:18:53 +0000121fi
122
Sergey Kandaurovce36edf2013-07-31 18:16:40 +0400123rm -rf $NGX_AUTOTEST*