2004-02-24 11:31:46 -06:00
|
|
|
|
2004-09-29 11:00:49 -05:00
|
|
|
# Copyright (C) Igor Sysoev
|
|
|
|
|
|
|
|
|
2004-10-21 10:34:38 -05:00
|
|
|
echo $ngx_n "checking for $ngx_type printf() format ...$ngx_c"
|
2004-02-24 11:31:46 -06:00
|
|
|
|
2004-10-21 10:34:38 -05:00
|
|
|
cat << END >> $NGX_AUTOCONF_ERR
|
2004-02-24 11:31:46 -06:00
|
|
|
|
2004-10-21 10:34:38 -05:00
|
|
|
----------------------------------------
|
|
|
|
checking for $ngx_type printf() format
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
|
|
|
|
ngx_format=no
|
|
|
|
ngx_comma=
|
|
|
|
ngx_fmt_x=
|
|
|
|
|
|
|
|
for ngx_fmt in $ngx_formats
|
2004-02-24 11:31:46 -06:00
|
|
|
do
|
|
|
|
|
|
|
|
cat << END > $NGX_AUTOTEST.c
|
|
|
|
|
|
|
|
int main() {
|
2004-10-21 10:34:38 -05:00
|
|
|
printf("$ngx_fmt", ($ngx_type) $ngx_max_value);
|
2004-02-24 11:31:46 -06:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
END
|
|
|
|
|
2004-10-21 10:34:38 -05:00
|
|
|
ngx_test="$CC $CC_TEST_FLAGS $CC_WARN $CC_AUX_FLAGS \
|
|
|
|
-o $NGX_AUTOTEST $NGX_AUTOTEST.c"
|
|
|
|
eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
|
2004-02-24 11:31:46 -06:00
|
|
|
|
2004-10-21 10:34:38 -05:00
|
|
|
ngx_max_val=`echo $ngx_max_value | sed -e "s/L*\$//"`
|
2004-02-24 11:31:46 -06:00
|
|
|
|
|
|
|
if [ -x $NGX_AUTOTEST ]; then
|
2004-10-21 10:34:38 -05:00
|
|
|
if [ "`$NGX_AUTOTEST`" = $ngx_max_val ]; then
|
|
|
|
ngx_format=$ngx_fmt
|
2004-02-24 11:31:46 -06:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2004-10-21 10:34:38 -05:00
|
|
|
rm $NGX_AUTOTEST
|
2004-02-24 11:31:46 -06:00
|
|
|
|
2004-10-21 10:34:38 -05:00
|
|
|
if [ $ngx_format != no ]; then
|
2004-02-24 11:31:46 -06:00
|
|
|
break
|
|
|
|
fi
|
|
|
|
|
2004-10-21 10:34:38 -05:00
|
|
|
ngx_fmt_x=`echo $ngx_fmt | sed -e "s/d/X/"`
|
|
|
|
|
|
|
|
echo $ngx_n "$ngx_comma \"${ngx_fmt_x}\" is not appropriate$ngx_c"
|
|
|
|
ngx_comma=","
|
2004-02-24 11:31:46 -06:00
|
|
|
|
2004-10-21 10:34:38 -05:00
|
|
|
echo "----------" >> $NGX_AUTOCONF_ERR
|
|
|
|
cat $NGX_AUTOTEST.c >> $NGX_AUTOCONF_ERR
|
|
|
|
echo "----------" >> $NGX_AUTOCONF_ERR
|
|
|
|
echo $ngx_test >> $NGX_AUTOCONF_ERR
|
|
|
|
echo "----------" >> $NGX_AUTOCONF_ERR
|
2004-02-24 11:31:46 -06:00
|
|
|
done
|
|
|
|
|
|
|
|
|
2004-10-21 10:34:38 -05:00
|
|
|
if [ $ngx_format = no ]; then
|
2004-02-24 11:31:46 -06:00
|
|
|
echo "$0: error: printf() $ngx_type format not found"
|
2004-10-21 10:34:38 -05:00
|
|
|
|
2004-02-24 11:31:46 -06:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2004-02-24 13:34:46 -06:00
|
|
|
|
2004-06-27 13:01:57 -05:00
|
|
|
if [ $ngx_ptr_size = 4 ]; then
|
2004-10-21 10:34:38 -05:00
|
|
|
ngx_fmt_x="%0`expr 2 \* $ngx_ptr_size`"
|
2004-02-24 13:34:46 -06:00
|
|
|
else
|
2004-10-21 10:34:38 -05:00
|
|
|
ngx_fmt_x="%"
|
2004-02-24 13:34:46 -06:00
|
|
|
fi
|
|
|
|
|
2004-10-21 10:34:38 -05:00
|
|
|
ngx_format=`echo $ngx_format | sed -e "s/d/X/" -e "s/^%/$ngx_fmt_x/"`
|
2004-02-24 11:31:46 -06:00
|
|
|
|
2004-10-21 10:34:38 -05:00
|
|
|
echo "$ngx_comma \"${ngx_format}\" used"
|
2004-02-24 11:31:46 -06:00
|
|
|
|
2004-02-24 13:34:46 -06:00
|
|
|
|
2004-02-24 11:31:46 -06:00
|
|
|
cat << END >> $NGX_AUTO_CONFIG_H
|
|
|
|
|
|
|
|
#ifndef $ngx_fmt_name
|
2004-10-21 10:34:38 -05:00
|
|
|
#define $ngx_fmt_name "$ngx_format"
|
2004-02-24 11:31:46 -06:00
|
|
|
#endif
|
|
|
|
|
|
|
|
END
|