view auto/fmt/fmt @ 210:00cafae0bdf1

nginx-0.0.1-2003-12-14-23:10:27 import
author Igor Sysoev <igor@sysoev.ru>
date Sun, 14 Dec 2003 20:10:27 +0000
parents 0b81c7a0b133
children 1903c6821958
line wrap: on
line source


echo -n "checking for $ngx_type printf() format ..."
echo >> $NGX_ERR
echo "checking for $ngx_type printf() format" >> $NGX_ERR

ngx_fmt=no
comma=

for fmt in $ngx_formats
do

    cat << END > $NGX_AUTOTEST.c

#include <stdio.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
$NGX_INTTYPES_H
$NGX_AUTO_CONFIG

int main() {
    printf("$fmt", ($ngx_type) $ngx_max_size);
    return 0;
}

END

    eval "$CC_WARN $CC_TEST_FLAGS -o $NGX_AUTOTEST $NGX_AUTOTEST.c \
          >> $NGX_ERR 2>&1"

    max_size=`echo $ngx_max_size | sed -e "s/L*\$//"`

    if [ -x $NGX_AUTOTEST ]; then
        if [ "`$NGX_AUTOTEST`" = $max_size ]; then
            if [ $ngx_fmt_collect = yes ]; then
                echo -n "$comma \"${fmt}\" is appropriate"
            else
                echo -n "$comma \"${fmt}\" used"
            fi
            ngx_fmt=$fmt
        fi
    fi

    rm $NGX_AUTOTEST*

    if [ $ngx_fmt != no ]; then
        if [ $ngx_fmt_collect = yes ]; then
            eval "ngx_${ngx_bytes}_fmt=\"\${ngx_${ngx_bytes}_fmt} \$ngx_fmt\""
            comma=","
            continue
        else
            break
        fi
    fi

    echo -n "$comma \"${fmt}\" is not appropriate"
    comma=","
done

echo

if [ $ngx_fmt = no ]; then
    echo "$0: error: printf() $ngx_type format not found"
    exit 1
fi


if [ $ngx_fmt_collect = no ]; then
    cat << END >> $NGX_AUTO_CONFIG_H

#ifndef $ngx_fmt_name
#define $ngx_fmt_name  "$ngx_fmt"
#endif

END

fi