summaryrefslogtreecommitdiffhomepage
path: root/auto/fmt/longlong
blob: 4a5e0844a71d4c5f7ea668ea601e38084ab1e312 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

echo "Checking for printf() long long format"

NGX_LONG_LONG_FMT=NO

    echo "int main() {" > autotest.c
    echo "printf(\"%llu\", (unsigned long long) -1);" >> autotest.c
    echo "return 0; }" >> autotest.c

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

    if [ -x ./autotest -a "`./autotest`" = $NGX_MAX_LONG_LONG ]; then
        echo " + \"%ll\" used"
        NGX_LONG_LONG_FMT="ll"
    else
        echo " + \"%ll\" is not appropriate"
    fi

    rm autotest*


if [ $NGX_LONG_LONG_FMT = NO ]; then

    echo "int main() {" > autotest.c
    echo "printf(\"%qu\", (unsigned long long) -1);" >> autotest.c
    echo "return 0; }" >> autotest.c

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

    if [ -x ./autotest -a "`./autotest`" = $NGX_MAX_LONG_LONG ]; then
        echo " + \"%q\" used"
        NGX_LONG_LONG_FMT="q"
    else
        echo " + \"%q\" is not appropriate"
    fi

    rm autotest*

fi


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