Mercurial > hg > nginx-vendor-0-7
comparison auto/fmt/ptrfmt @ 0:f0b350454894 NGINX_0_1_0
nginx 0.1.0
*) The first public version.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 04 Oct 2004 00:00:00 +0400 |
parents | |
children | 4b2dafa26fe2 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0b350454894 |
---|---|
1 | |
2 # Copyright (C) Igor Sysoev | |
3 | |
4 | |
5 echo $ngx_n "checking for $ngx_type printf() format ..." $ngx_c | |
6 echo >> $NGX_ERR | |
7 echo "checking for $ngx_type printf() format" >> $NGX_ERR | |
8 | |
9 ngx_fmt=no | |
10 comma= | |
11 fmtX= | |
12 | |
13 for fmt in $ngx_formats | |
14 do | |
15 | |
16 cat << END > $NGX_AUTOTEST.c | |
17 | |
18 int main() { | |
19 printf("$fmt", ($ngx_type) $ngx_max_value); | |
20 return 0; | |
21 } | |
22 | |
23 END | |
24 | |
25 eval "$CC_WARN $CC_TEST_FLAGS -o $NGX_AUTOTEST $NGX_AUTOTEST.c \ | |
26 >> $NGX_ERR 2>&1" | |
27 | |
28 max_value=`echo $ngx_max_value | sed -e "s/L*\$//"` | |
29 | |
30 if [ -x $NGX_AUTOTEST ]; then | |
31 if [ "`$NGX_AUTOTEST`" = $max_value ]; then | |
32 ngx_fmt=$fmt | |
33 fi | |
34 fi | |
35 | |
36 rm $NGX_AUTOTEST* | |
37 | |
38 if [ $ngx_fmt != no ]; then | |
39 break | |
40 fi | |
41 | |
42 fmtX=`echo $fmt | sed -e "s/d/X/"` | |
43 | |
44 echo $ngx_n "$comma \"${fmtX}\" is not appropriate" $ngx_c | |
45 comma="," | |
46 done | |
47 | |
48 | |
49 if [ $ngx_fmt = no ]; then | |
50 echo "$0: error: printf() $ngx_type format not found" | |
51 exit 1 | |
52 fi | |
53 | |
54 | |
55 if [ $ngx_ptr_size = 4 ]; then | |
56 fmtX="%0`expr 2 \* $ngx_ptr_size`" | |
57 else | |
58 fmtX="%" | |
59 fi | |
60 | |
61 ngx_fmt=`echo $ngx_fmt | sed -e "s/d/X/" -e "s/^%/$fmtX/"` | |
62 | |
63 echo "$comma \"${ngx_fmt}\" used" | |
64 | |
65 | |
66 cat << END >> $NGX_AUTO_CONFIG_H | |
67 | |
68 #ifndef $ngx_fmt_name | |
69 #define $ngx_fmt_name "$ngx_fmt" | |
70 #endif | |
71 | |
72 END |