2004-02-25 01:31:46 +08:00
|
|
|
|
2004-09-30 00:00:49 +08:00
|
|
|
# Copyright (C) Igor Sysoev
|
|
|
|
|
|
|
|
|
2004-02-25 01:31:46 +08:00
|
|
|
echo $ngx_n "checking for $ngx_type printf() format ..." $ngx_c
|
|
|
|
echo >> $NGX_ERR
|
|
|
|
echo "checking for $ngx_type printf() format" >> $NGX_ERR
|
|
|
|
|
|
|
|
ngx_fmt=no
|
|
|
|
comma=
|
|
|
|
fmtX=
|
|
|
|
|
|
|
|
for fmt in $ngx_formats
|
|
|
|
do
|
|
|
|
|
|
|
|
cat << END > $NGX_AUTOTEST.c
|
|
|
|
|
|
|
|
int main() {
|
2004-06-28 02:01:57 +08:00
|
|
|
printf("$fmt", ($ngx_type) $ngx_max_value);
|
2004-02-25 01:31:46 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
eval "$CC_WARN $CC_TEST_FLAGS -o $NGX_AUTOTEST $NGX_AUTOTEST.c \
|
|
|
|
>> $NGX_ERR 2>&1"
|
|
|
|
|
2004-06-28 02:01:57 +08:00
|
|
|
max_value=`echo $ngx_max_value | sed -e "s/L*\$//"`
|
2004-02-25 01:31:46 +08:00
|
|
|
|
|
|
|
if [ -x $NGX_AUTOTEST ]; then
|
2004-06-28 02:01:57 +08:00
|
|
|
if [ "`$NGX_AUTOTEST`" = $max_value ]; then
|
2004-02-25 01:31:46 +08:00
|
|
|
ngx_fmt=$fmt
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm $NGX_AUTOTEST*
|
|
|
|
|
|
|
|
if [ $ngx_fmt != no ]; then
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
|
|
|
|
fmtX=`echo $fmt | sed -e "s/d/X/"`
|
|
|
|
|
|
|
|
echo $ngx_n "$comma \"${fmtX}\" is not appropriate" $ngx_c
|
|
|
|
comma=","
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
if [ $ngx_fmt = no ]; then
|
|
|
|
echo "$0: error: printf() $ngx_type format not found"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2004-02-25 03:34:46 +08:00
|
|
|
|
2004-06-28 02:01:57 +08:00
|
|
|
if [ $ngx_ptr_size = 4 ]; then
|
|
|
|
fmtX="%0`expr 2 \* $ngx_ptr_size`"
|
2004-02-25 03:34:46 +08:00
|
|
|
else
|
2004-02-25 23:46:57 +08:00
|
|
|
fmtX="%"
|
2004-02-25 03:34:46 +08:00
|
|
|
fi
|
|
|
|
|
2004-02-25 01:31:46 +08:00
|
|
|
ngx_fmt=`echo $ngx_fmt | sed -e "s/d/X/" -e "s/^%/$fmtX/"`
|
|
|
|
|
|
|
|
echo "$comma \"${ngx_fmt}\" used"
|
|
|
|
|
2004-02-25 03:34:46 +08:00
|
|
|
|
2004-02-25 01:31:46 +08:00
|
|
|
cat << END >> $NGX_AUTO_CONFIG_H
|
|
|
|
|
|
|
|
#ifndef $ngx_fmt_name
|
|
|
|
#define $ngx_fmt_name "$ngx_fmt"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
END
|