xref: /unit/auto/os/test (revision 216:07257705cd64)
1
2# Copyright (C) Igor Sysoev
3# Copyright (C) NGINX, Inc.
4
5
6NXT_SYSTEM=`uname -s 2>/dev/null`
7
8
9case "$NXT_SYSTEM" in
10
11    Linux)
12        NXT_SYSTEM_VERSION=`uname -r 2>/dev/null`
13        # Linux uname -p can return "unknown".
14        NXT_SYSTEM_PLATFORM=`uname -m 2>/dev/null`
15        echo=echo
16        CC=${CC:-cc}
17        ;;
18
19    FreeBSD | NetBSD | OpenBSD)
20        NXT_SYSTEM_VERSION=`uname -r 2>/dev/null`
21        NXT_SYSTEM_PLATFORM=`uname -m 2>/dev/null`
22        echo=echo
23        CC=${CC:-cc}
24        ;;
25
26    SunOS)
27        NXT_SYSTEM_VERSION=`uname -r 2>/dev/null`
28        NXT_SYSTEM_PLATFORM=`uname -p 2>/dev/null`
29        echo=echo
30        CC=${CC:-gcc}
31
32        NXT_TEST_CFLAGS="$NXT_TEST_CFLAGS -D_XOPEN_SOURCE"
33        NXT_TEST_CFLAGS="$NXT_TEST_CFLAGS -D_XOPEN_SOURCE_EXTENDED=1"
34        NXT_TEST_CFLAGS="$NXT_TEST_CFLAGS -D__EXTENSIONS__"
35        NXT_TEST_LIBS="-lsocket"
36        ;;
37
38    Darwin)
39        NXT_SYSTEM_VERSION=`uname -r 2>/dev/null`
40        NXT_SYSTEM_PLATFORM=`uname -m 2>/dev/null`
41        echo=echo
42        CC=${CC:-cc}
43
44        NXT_TEST_CFLAGS="$NXT_TEST_CFLAGS -mmacosx-version-min=10.5"
45        ;;
46
47    AIX)
48        NXT_SYSTEM_VERSION="`uname -v 2>/dev/null`.`uname -r 2>/dev/null`"
49        NXT_SYSTEM_PLATFORM=`uname -p 2>/dev/null`
50        echo=echo
51        CC=${CC:-gcc}
52        ;;
53
54    HP-UX)
55        NXT_SYSTEM_VERSION=`uname -r 2>/dev/null`
56        NXT_SYSTEM_PLATFORM=`uname -m 2>/dev/null`
57        echo=echo
58        CC=${CC:-gcc}
59
60        NXT_TEST_CFLAGS="$NXT_TEST_CFLAGS -D_XOPEN_SOURCE"
61        NXT_TEST_CFLAGS="$NXT_TEST_CFLAGS -D_XOPEN_SOURCE_EXTENDED"
62        NXT_TEST_CFLAGS="$NXT_TEST_CFLAGS -D_HPUX_ALT_XOPEN_SOCKET_API"
63        ;;
64
65    QNX)
66        NXT_SYSTEM_VERSION=`uname -r 2>/dev/null`
67        NXT_SYSTEM_PLATFORM=`uname -p 2>/dev/null`
68        echo=echo
69        CC=${CC:-gcc}
70        ;;
71
72    MINGW*)
73        # MinGW /bin/sh builtin "echo" omits newline under Wine
74        # for some reason, so use a portable echo.c program built
75        # using MinGW GCC with only msvcrt.dll dependence.
76
77        NXT_SYSTEM_VERSION=`uname -r 2>/dev/null`
78        NXT_SYSTEM_PLATFORM=`uname -m 2>/dev/null`
79        echo=auto/echo/echo.exe
80        CC=${CC:-cl}
81        NXT_WINDOWS=YES
82        ;;
83
84    *)
85        NXT_SYSTEM_VERSION=`uname -r 2>/dev/null`
86        NXT_SYSTEM_PLATFORM=`uname -p 2>/dev/null`
87        echo=echo
88        CC=${CC:-gcc}
89        ;;
90
91esac
92
93$echo configuring for $NXT_SYSTEM $NXT_SYSTEM_VERSION $NXT_SYSTEM_PLATFORM
94