nginx/auto/fmt/ptrfmt

87 lines
1.6 KiB
Plaintext
Raw Normal View History

2004-02-24 11:31:46 -06:00
# Copyright (C) Igor Sysoev
echo $ngx_n "checking for $ngx_type printf() format ...$ngx_c"
2004-02-24 11:31:46 -06:00
cat << END >> $NGX_AUTOCONF_ERR
2004-02-24 11:31:46 -06: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() {
printf("$ngx_fmt", ($ngx_type) $ngx_max_value);
2004-02-24 11:31:46 -06:00
return 0;
}
END
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
ngx_max_val=`echo $ngx_max_value | sed -e "s/L*\$//"`
2004-02-24 11:31:46 -06:00
if [ -x $NGX_AUTOTEST ]; then
if [ "`$NGX_AUTOTEST`" = $ngx_max_val ]; then
ngx_format=$ngx_fmt
2004-02-24 11:31:46 -06:00
fi
fi
rm $NGX_AUTOTEST
2004-02-24 11:31:46 -06:00
if [ $ngx_format != no ]; then
2004-02-24 11:31:46 -06:00
break
fi
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
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
if [ $ngx_format = no ]; then
2004-02-24 11:31:46 -06:00
echo "$0: error: printf() $ngx_type format not found"
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
ngx_fmt_x="%0`expr 2 \* $ngx_ptr_size`"
2004-02-24 13:34:46 -06:00
else
ngx_fmt_x="%"
2004-02-24 13:34:46 -06:00
fi
ngx_format=`echo $ngx_format | sed -e "s/d/X/" -e "s/^%/$ngx_fmt_x/"`
2004-02-24 11:31:46 -06: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
#define $ngx_fmt_name "$ngx_format"
2004-02-24 11:31:46 -06:00
#endif
END