2005-10-12 21:50:36 +08:00
|
|
|
|
|
|
|
# Copyright (C) Igor Sysoev
|
|
|
|
|
|
|
|
|
2007-07-16 16:54:04 +08:00
|
|
|
# Sun C 5.7 Patch 117837-04 2005/05/11 Sun Studio 10
|
|
|
|
# Sun C 5.8 2005/10/13 Sun Studio 11
|
|
|
|
# Sun C 5.9 SunOS_i386 2007/05/03 Sun Studio 12
|
|
|
|
# Sun C 5.9 SunOS_sparc 2007/05/03
|
2005-10-12 21:50:36 +08:00
|
|
|
|
|
|
|
NGX_SUNC_VER=`$CC -V 2>&1 | grep 'Sun C' 2>&1 \
|
2006-09-18 20:27:33 +08:00
|
|
|
| sed -e 's/^.* Sun C \(.*\)/\1/'`
|
2005-10-12 21:50:36 +08:00
|
|
|
|
|
|
|
echo " + Sun C version: $NGX_SUNC_VER"
|
|
|
|
|
|
|
|
have=NGX_COMPILER value="\"Sun C $NGX_SUNC_VER\"" . auto/define
|
|
|
|
|
|
|
|
|
2007-07-16 16:54:04 +08:00
|
|
|
cat << END > $NGX_AUTOTEST.c
|
|
|
|
|
|
|
|
int main() { printf("%d", __SUNPRO_C); }
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
eval "$CC -o $NGX_AUTOTEST $NGX_AUTOTEST.c >> $NGX_ERR 2>&1"
|
|
|
|
|
|
|
|
if [ -x $NGX_AUTOTEST ]; then
|
|
|
|
ngx_sunc_ver=`$NGX_AUTOTEST`
|
|
|
|
fi
|
|
|
|
|
|
|
|
rm $NGX_AUTOTEST*
|
|
|
|
|
|
|
|
# 1424 == 0x590, Sun Studio 12
|
|
|
|
|
|
|
|
if [ "$ngx_sunc_ver" -ge 1424 ]; then
|
|
|
|
ngx_sparc32="-m32"
|
|
|
|
ngx_sparc64="-m64"
|
|
|
|
ngx_amd64="-m64"
|
|
|
|
|
|
|
|
else
|
|
|
|
ngx_sparc32="-xarch=v8plus"
|
|
|
|
ngx_sparc64="-xarch=v9"
|
2007-07-28 16:48:12 +08:00
|
|
|
ngx_amd64="-xarch=amd64"
|
2007-07-16 16:54:04 +08:00
|
|
|
fi
|
|
|
|
|
2006-10-06 04:06:03 +08:00
|
|
|
case "$NGX_MACHINE" in
|
2005-10-12 21:50:36 +08:00
|
|
|
|
2006-10-06 04:06:03 +08:00
|
|
|
i86pc)
|
2006-09-18 20:27:33 +08:00
|
|
|
ngx_feature="PAUSE hardware capability bug"
|
|
|
|
ngx_feature_name=
|
|
|
|
ngx_feature_run=bug
|
|
|
|
ngx_feature_incs=
|
2006-11-27 19:07:09 +08:00
|
|
|
ngx_feature_path=
|
2006-09-18 20:27:33 +08:00
|
|
|
ngx_feature_libs=
|
|
|
|
ngx_feature_test='__asm ("pause")'
|
|
|
|
|
|
|
|
. auto/feature
|
|
|
|
|
|
|
|
if [ $ngx_found = yes ]; then
|
|
|
|
# disable [ PAUSE ] hwcap for Sun Studio 11
|
|
|
|
CORE_LINK="$CORE_LINK -Msrc/os/unix/ngx_sunpro_x86.map"
|
|
|
|
fi
|
2006-09-16 03:33:55 +08:00
|
|
|
|
2005-10-12 21:50:36 +08:00
|
|
|
NGX_AUX=" src/os/unix/ngx_sunpro_x86.il"
|
|
|
|
;;
|
|
|
|
|
2006-10-06 04:06:03 +08:00
|
|
|
sun4u | sun4v)
|
2005-10-12 21:50:36 +08:00
|
|
|
NGX_AUX=" src/os/unix/ngx_sunpro_sparc64.il"
|
|
|
|
;;
|
|
|
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
|
|
# optimizations
|
|
|
|
|
2007-07-16 16:54:04 +08:00
|
|
|
IPO=-xipo
|
|
|
|
CFLAGS="$CFLAGS -fast $IPO"
|
2007-07-21 14:23:58 +08:00
|
|
|
CORE_LINK="$CORE_LINK -fast $IPO"
|
2005-10-12 21:50:36 +08:00
|
|
|
|
|
|
|
|
|
|
|
case $CPU in
|
|
|
|
pentium)
|
|
|
|
# optimize for Pentium and Athlon
|
|
|
|
CPU_OPT="-xchip=pentium"
|
|
|
|
;;
|
|
|
|
|
|
|
|
pentiumpro)
|
|
|
|
# optimize for Pentium Pro, Pentium II
|
|
|
|
CPU_OPT="-xchip=pentium_pro"
|
|
|
|
;;
|
|
|
|
|
|
|
|
pentium3)
|
|
|
|
# optimize for Pentium III
|
|
|
|
CPU_OPT="-xchip=pentium3"
|
|
|
|
#CPU_OPT="$CPU_OPT -xarch=sse"
|
|
|
|
CPU_OPT="$CPU_OPT -xcache=16/32/4:256/32/4"
|
|
|
|
;;
|
|
|
|
|
|
|
|
pentium4)
|
|
|
|
# optimize for Pentium 4
|
|
|
|
CPU_OPT="-xchip=pentium4"
|
|
|
|
#CPU_OPT="$CPU_OPT -xarch=sse2"
|
|
|
|
CPU_OPT="$CPU_OPT -xcache=8/64/4:256/128/8"
|
|
|
|
;;
|
|
|
|
|
|
|
|
opteron)
|
|
|
|
# optimize for Opteron
|
|
|
|
CPU_OPT="-xchip=opteron"
|
|
|
|
#CPU_OPT="$CPU_OPT -xarch=sse2"
|
|
|
|
CPU_OPT="$CPU_OPT -xcache=64/64/2:1024/64/16"
|
|
|
|
;;
|
|
|
|
|
2007-07-16 04:09:14 +08:00
|
|
|
sparc32)
|
|
|
|
# build 32-bit UltraSparc binary
|
2007-07-16 16:54:04 +08:00
|
|
|
CPU_OPT="$ngx_sparc32"
|
|
|
|
CORE_LINK="$CORE_LINK $ngx_sparc32"
|
|
|
|
CC_AUX_FLAGS="$CC_AUX_FLAGS $ngx_sparc32"
|
2007-07-16 04:09:14 +08:00
|
|
|
NGX_CPU_CACHE_LINE=64
|
|
|
|
;;
|
|
|
|
|
|
|
|
sparc64)
|
|
|
|
# build 64-bit UltraSparc binary
|
2007-07-16 16:54:04 +08:00
|
|
|
CPU_OPT="$ngx_sparc64"
|
|
|
|
CORE_LINK="$CORE_LINK $ngx_sparc64"
|
|
|
|
CC_AUX_FLAGS="$CC_AUX_FLAGS $ngx_sparc64"
|
2007-07-16 04:09:14 +08:00
|
|
|
NGX_CPU_CACHE_LINE=64
|
|
|
|
;;
|
|
|
|
|
2005-10-12 21:50:36 +08:00
|
|
|
amd64)
|
|
|
|
# build 64-bit amd64 binary
|
2007-07-16 16:54:04 +08:00
|
|
|
CPU_OPT="$ngx_amd64"
|
|
|
|
CORE_LINK="$CORE_LINK $ngx_amd64"
|
2007-07-21 14:23:58 +08:00
|
|
|
CC_AUX_FLAGS="$CC_AUX_FLAGS $ngx_amd64"
|
2005-10-12 21:50:36 +08:00
|
|
|
NGX_AUX=" src/os/unix/ngx_sunpro_amd64.il"
|
2007-07-16 16:54:04 +08:00
|
|
|
NGX_CPU_CACHE_LINE=64
|
2005-10-12 21:50:36 +08:00
|
|
|
;;
|
|
|
|
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
|
|
CFLAGS="$CFLAGS $CPU_OPT"
|
|
|
|
|
|
|
|
|
|
|
|
if [ ".$PCRE_OPT" = "." ]; then
|
2007-07-16 16:54:04 +08:00
|
|
|
PCRE_OPT="-fast $IPO $CPU_OPT"
|
2005-10-12 21:50:36 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ".$MD5_OPT" = "." ]; then
|
2007-07-16 16:54:04 +08:00
|
|
|
MD5_OPT="-fast $IPO $CPU_OPT"
|
2005-10-12 21:50:36 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ".$ZLIB_OPT" = "." ]; then
|
2007-07-16 16:54:04 +08:00
|
|
|
ZLIB_OPT="-fast $IPO $CPU_OPT"
|
2005-10-12 21:50:36 +08:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# stop on warning
|
|
|
|
CFLAGS="$CFLAGS -errwarn=%all"
|
2007-08-07 18:56:45 +08:00
|
|
|
|
|
|
|
# debug
|
|
|
|
CFLAGS="$CFLAGS -g"
|