Mercurial > hg > nginx
comparison auto/fmt/fmt @ 210:00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sun, 14 Dec 2003 20:10:27 +0000 |
parents | 0b81c7a0b133 |
children | 1903c6821958 |
comparison
equal
deleted
inserted
replaced
209:e1c815be05ae | 210:00cafae0bdf1 |
---|---|
1 | 1 |
2 echo "checking for $NGX_TYPE printf() format" | 2 echo -n "checking for $ngx_type printf() format ..." |
3 echo >> $NGX_ERR | |
4 echo "checking for $ngx_type printf() format" >> $NGX_ERR | |
3 | 5 |
4 NGX_FMT=NO | 6 ngx_fmt=no |
7 comma= | |
5 | 8 |
6 for FMT in $NGX_FORMATS | 9 for fmt in $ngx_formats |
7 do | 10 do |
8 echo "#include <stdio.h>" > autotest.c | |
9 echo "#include <sys/types.h>" >> autotest.c | |
10 echo "#include <sys/time.h>" >> autotest.c | |
11 echo "#include <sys/resource.h>" >> autotest.c | |
12 echo "$NGX_INTTYPES_H" >> autotest.c | |
13 echo "$NGX_AUTO_CONFIG" >> autotest.c | |
14 echo "int main() {" >> autotest.c | |
15 echo "printf(\"${FMT}\", ($NGX_TYPE) $NGX_MAX_SIZE);" >> autotest.c | |
16 echo "return 0; }" >> autotest.c | |
17 | 11 |
18 eval "$CC_WARN $CC_TEST_FLAGS -o autotest autotest.c > $NGX_ERR 2>&1" | 12 cat << END > $NGX_AUTOTEST.c |
19 | 13 |
20 MAX_SIZE=`echo $NGX_MAX_SIZE | sed -e "s/L*\$//"` | 14 #include <stdio.h> |
15 #include <sys/types.h> | |
16 #include <sys/time.h> | |
17 #include <sys/resource.h> | |
18 $NGX_INTTYPES_H | |
19 $NGX_AUTO_CONFIG | |
21 | 20 |
22 if [ -x ./autotest ]; then | 21 int main() { |
23 if [ "`./autotest`" = $MAX_SIZE ]; then | 22 printf("$fmt", ($ngx_type) $ngx_max_size); |
24 if [ $NGX_FMT_COLLECT = YES ]; then | 23 return 0; |
25 echo " + \"${FMT}\" is appropriate" | 24 } |
25 | |
26 END | |
27 | |
28 eval "$CC_WARN $CC_TEST_FLAGS -o $NGX_AUTOTEST $NGX_AUTOTEST.c \ | |
29 >> $NGX_ERR 2>&1" | |
30 | |
31 max_size=`echo $ngx_max_size | sed -e "s/L*\$//"` | |
32 | |
33 if [ -x $NGX_AUTOTEST ]; then | |
34 if [ "`$NGX_AUTOTEST`" = $max_size ]; then | |
35 if [ $ngx_fmt_collect = yes ]; then | |
36 echo -n "$comma \"${fmt}\" is appropriate" | |
26 else | 37 else |
27 echo " + \"${FMT}\" used" | 38 echo -n "$comma \"${fmt}\" used" |
28 fi | 39 fi |
29 NGX_FMT=$FMT | 40 ngx_fmt=$fmt |
30 fi | 41 fi |
31 fi | 42 fi |
32 | 43 |
33 rm autotest* | 44 rm $NGX_AUTOTEST* |
34 | 45 |
35 if [ $NGX_FMT != NO ]; then | 46 if [ $ngx_fmt != no ]; then |
36 if [ $NGX_FMT_COLLECT = YES ]; then | 47 if [ $ngx_fmt_collect = yes ]; then |
37 eval "NGX_${NGX_BYTES}_FMT=\"\${NGX_${NGX_BYTES}_FMT} \$NGX_FMT\"" | 48 eval "ngx_${ngx_bytes}_fmt=\"\${ngx_${ngx_bytes}_fmt} \$ngx_fmt\"" |
49 comma="," | |
38 continue | 50 continue |
39 else | 51 else |
40 break | 52 break |
41 fi | 53 fi |
42 fi | 54 fi |
43 | 55 |
44 echo " + \"${FMT}\" is not appropriate" | 56 echo -n "$comma \"${fmt}\" is not appropriate" |
57 comma="," | |
45 done | 58 done |
46 | 59 |
60 echo | |
47 | 61 |
48 if [ $NGX_FMT = NO ]; then | 62 if [ $ngx_fmt = no ]; then |
49 echo "$0: error: printf() $NGX_TYPE format not found" | 63 echo "$0: error: printf() $ngx_type format not found" |
50 exit 1 | 64 exit 1 |
51 fi | 65 fi |
52 | 66 |
53 | 67 |
54 if [ $NGX_FMT_COLLECT = NO ]; then | 68 if [ $ngx_fmt_collect = no ]; then |
55 echo "#ifndef $NGX_FMT_NAME" >> $NGX_AUTO_CONFIG_H | 69 cat << END >> $NGX_AUTO_CONFIG_H |
56 echo "#define $NGX_FMT_NAME \"$NGX_FMT\"" >> $NGX_AUTO_CONFIG_H | 70 |
57 echo "#endif" >> $NGX_AUTO_CONFIG_H | 71 #ifndef $ngx_fmt_name |
58 echo >> $NGX_AUTO_CONFIG_H | 72 #define $ngx_fmt_name "$ngx_fmt" |
73 #endif | |
74 | |
75 END | |
76 | |
59 fi | 77 fi |