2 # Copyright (C) Igor Sysoev
3 # Copyright (C) Nginx, Inc.
6 # Sun C 5.7 Patch 117837-04 2005/05/11 Sun Studio 10
7 # Sun C 5.8 2005/10/13 Sun Studio 11
8 # Sun C 5.9 SunOS_i386 2007/05/03 Sun Studio 12
9 # Sun C 5.9 SunOS_sparc 2007/05/03
10 # Sun C 5.10 SunOS_i386 2009/06/03 Sun Studio 12.1
11 # Sun C 5.11 SunOS_i386 2010/08/13 Sun Studio 12.2
13 NGX_SUNC_VER=`$CC -V 2>&1 | grep 'Sun C' 2>&1 \
14 | sed -e 's/^.* Sun C \(.*\)/\1/'`
16 echo " + Sun C version: $NGX_SUNC_VER"
18 have=NGX_COMPILER value="\"Sun C $NGX_SUNC_VER\"" . auto/define
21 cat << END > $NGX_AUTOTEST.c
23 int main() { printf("%d", __SUNPRO_C); }
27 eval "$CC -o $NGX_AUTOTEST $NGX_AUTOTEST.c >> $NGX_ERR 2>&1"
29 if [ -x $NGX_AUTOTEST ]; then
30 ngx_sunc_ver=`$NGX_AUTOTEST`
35 # 1424 == 0x590, Sun Studio 12
37 if [ "$ngx_sunc_ver" -ge 1424 ]; then
43 ngx_sparc32="-xarch=v8plus"
44 ngx_sparc64="-xarch=v9"
45 ngx_amd64="-xarch=amd64"
48 case "$NGX_MACHINE" in
51 NGX_AUX=" src/os/unix/ngx_sunpro_x86.il"
55 NGX_AUX=" src/os/unix/ngx_sunpro_sparc64.il"
63 # 20736 == 0x5100, Sun Studio 12.1
65 if [ "$ngx_sunc_ver" -ge 20736 ]; then
69 # older versions had problems with bit-fields
70 ngx_fast="-fast -xalias_level=any"
74 CFLAGS="$CFLAGS $ngx_fast $IPO"
75 CORE_LINK="$CORE_LINK $ngx_fast $IPO"
80 # optimize for Pentium and Athlon
81 CPU_OPT="-xchip=pentium"
85 # optimize for Pentium Pro, Pentium II
86 CPU_OPT="-xchip=pentium_pro"
90 # optimize for Pentium III
91 CPU_OPT="-xchip=pentium3"
92 #CPU_OPT="$CPU_OPT -xarch=sse"
93 CPU_OPT="$CPU_OPT -xcache=16/32/4:256/32/4"
97 # optimize for Pentium 4
98 CPU_OPT="-xchip=pentium4"
99 #CPU_OPT="$CPU_OPT -xarch=sse2"
100 CPU_OPT="$CPU_OPT -xcache=8/64/4:256/128/8"
104 # optimize for Opteron
105 CPU_OPT="-xchip=opteron"
106 #CPU_OPT="$CPU_OPT -xarch=sse2"
107 CPU_OPT="$CPU_OPT -xcache=64/64/2:1024/64/16"
111 # build 32-bit UltraSparc binary
112 CPU_OPT="$ngx_sparc32"
113 CORE_LINK="$CORE_LINK $ngx_sparc32"
114 CC_AUX_FLAGS="$CC_AUX_FLAGS $ngx_sparc32"
115 NGX_CPU_CACHE_LINE=64
119 # build 64-bit UltraSparc binary
120 CPU_OPT="$ngx_sparc64"
121 CORE_LINK="$CORE_LINK $ngx_sparc64"
122 CC_AUX_FLAGS="$CC_AUX_FLAGS $ngx_sparc64"
123 NGX_CPU_CACHE_LINE=64
127 # build 64-bit amd64 binary
129 CORE_LINK="$CORE_LINK $ngx_amd64"
130 CC_AUX_FLAGS="$CC_AUX_FLAGS $ngx_amd64"
131 NGX_AUX=" src/os/unix/ngx_sunpro_amd64.il"
132 NGX_CPU_CACHE_LINE=64
138 CFLAGS="$CFLAGS $CPU_OPT"
141 if [ ".$PCRE_OPT" = "." ]; then
142 PCRE_OPT="$ngx_fast $IPO $CPU_OPT"
145 if [ ".$MD5_OPT" = "." ]; then
146 MD5_OPT="$ngx_fast $IPO $CPU_OPT"
149 if [ ".$ZLIB_OPT" = "." ]; then
150 ZLIB_OPT="$ngx_fast $IPO $CPU_OPT"
155 CFLAGS="$CFLAGS -errwarn=%all"