view auto/fmt/fmt @ 194:2357fa41738a

nginx-0.0.1-2003-11-21-09:30:49 import
author Igor Sysoev <igor@sysoev.ru>
date Fri, 21 Nov 2003 06:30:49 +0000
parents dd66383796a5
children 8dee38ea9117
line wrap: on
line source


echo "Checking for $NGX_TYPE printf() format"

NGX_FMT=NO

for FMT in $NGX_FORMATS
do
    echo "#include <unistd.h>" > autotest.c
    echo "#include <stdio.h>" >> autotest.c
    echo "#include <sys/types.h>" >> autotest.c
    echo "int main() {" >> autotest.c
    echo "printf(\"${FMT}\", ($NGX_TYPE) $NGX_MAX_SIZE);" >> autotest.c
    echo "return 0; }" >> autotest.c

    eval "${CC_WARN} -o autotest autotest.c > /dev/null 2>&1"

    if [ -x ./autotest ]; then
        if [ "`./autotest`" = $NGX_MAX_SIZE ]; then
            echo " + \"${FMT}\" used"
            NGX_FMT=$FMT
        fi
    fi

    rm autotest*

    if [ $NGX_FMT != NO ]; then
        break
    fi

    echo " + \"${FMT}\" is not appropriate"
done


if [ $NGX_FMT = NO ]; then
    echo "printf() $NGX_TYPE format not found"
    exit 1
fi


echo "#ifndef $NGX_FMT_NAME"                 >> $NGX_AUTO_CONFIG_H
echo "#define $NGX_FMT_NAME  \"$NGX_FMT\""   >> $NGX_AUTO_CONFIG_H
echo "#endif"                                >> $NGX_AUTO_CONFIG_H
echo                                         >> $NGX_AUTO_CONFIG_H