comparison auto/fmt/ptrfmt @ 267:83205e0b5522

nginx-0.0.2-2004-02-24-20:31:46 import
author Igor Sysoev <igor@sysoev.ru>
date Tue, 24 Feb 2004 17:31:46 +0000
parents
children db5e5d854754
comparison
equal deleted inserted replaced
266:5238e93961a1 267:83205e0b5522
1
2 echo $ngx_n "checking for $ngx_type printf() format ..." $ngx_c
3 echo >> $NGX_ERR
4 echo "checking for $ngx_type printf() format" >> $NGX_ERR
5
6 ngx_fmt=no
7 comma=
8 fmtX=
9
10 for fmt in $ngx_formats
11 do
12
13 cat << END > $NGX_AUTOTEST.c
14
15 int main() {
16 printf("$fmt", ($ngx_type) $ngx_max_size);
17 return 0;
18 }
19
20 END
21
22 eval "$CC_WARN $CC_TEST_FLAGS -o $NGX_AUTOTEST $NGX_AUTOTEST.c \
23 >> $NGX_ERR 2>&1"
24
25 max_size=`echo $ngx_max_size | sed -e "s/L*\$//"`
26
27 if [ -x $NGX_AUTOTEST ]; then
28 if [ "`$NGX_AUTOTEST`" = $max_size ]; then
29 ngx_fmt=$fmt
30 fi
31 fi
32
33 rm $NGX_AUTOTEST*
34
35 if [ $ngx_fmt != no ]; then
36 break
37 fi
38
39 fmtX=`echo $fmt | sed -e "s/d/X/"`
40
41 echo $ngx_n "$comma \"${fmtX}\" is not appropriate" $ngx_c
42 comma=","
43 done
44
45
46 if [ $ngx_fmt = no ]; then
47 echo "$0: error: printf() $ngx_type format not found"
48 exit 1
49 fi
50
51 fmtX="%0`expr 2 \* ${ngx_ptr_bytes}`"
52 ngx_fmt=`echo $ngx_fmt | sed -e "s/d/X/" -e "s/^%/$fmtX/"`
53
54 echo "$comma \"${ngx_fmt}\" used"
55
56 cat << END >> $NGX_AUTO_CONFIG_H
57
58 #ifndef $ngx_fmt_name
59 #define $ngx_fmt_name "$ngx_fmt"
60 #endif
61
62 END