Welcome to mirror list, hosted at ThFree Co, Russian Federation.

sizeof « types « auto - github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8f811136eab55df8e564155431cf08e28f4c1669 (plain)
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

echo "checking for $NGX_TYPE size"

NGX_BYTES=

echo "#include <sys/types.h>" > autotest.c
echo "int main() {" >> autotest.c
echo "printf(\"%d\", sizeof($NGX_TYPE));" >> autotest.c
echo "return 0; }" >> autotest.c

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

if [ -x ./autotest ]; then
    NGX_BYTES=`./autotest`
    echo " + $NGX_TYPE is $NGX_BYTES bytes"
fi

rm autotest*

case $NGX_BYTES in
    4)
        if [ "$NGX_TYPE"="long" ]; then
            NGX_MAX_SIZE=2147483647L
        else
            NGX_MAX_SIZE=2147483647
        fi
    ;;

    8)
        if [ "$NGX_TYPE"="long long" ]; then
            NGX_MAX_SIZE=9223372036854775807LL
        else
            NGX_MAX_SIZE=9223372036854775807L
        fi
    ;;

    *)
        echo "$0: error: can not detect $NGX_TYPE size"
        exit 1
esac