File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / nginx / auto / cc / sunc
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Mon Oct 14 09:20:38 2013 UTC (11 years, 5 months ago) by misho
Branches: nginx, MAIN
CVS tags: v1_4_3p0, v1_4_3, HEAD
v 1.4.3

    1: 
    2: # Copyright (C) Igor Sysoev
    3: # Copyright (C) Nginx, Inc.
    4: 
    5: 
    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
   12: 
   13: NGX_SUNC_VER=`$CC -V 2>&1 | grep 'Sun C' 2>&1 \
   14:                           | sed -e 's/^.* Sun C \(.*\)/\1/'`
   15: 
   16: echo " + Sun C version: $NGX_SUNC_VER"
   17: 
   18: have=NGX_COMPILER value="\"Sun C $NGX_SUNC_VER\"" . auto/define
   19: 
   20: 
   21: cat << END > $NGX_AUTOTEST.c
   22: 
   23: int main() { printf("%d", __SUNPRO_C); }
   24: 
   25: END
   26: 
   27: eval "$CC -o $NGX_AUTOTEST $NGX_AUTOTEST.c >> $NGX_ERR 2>&1"
   28: 
   29: if [ -x $NGX_AUTOTEST ]; then
   30:     ngx_sunc_ver=`$NGX_AUTOTEST`
   31: fi
   32: 
   33: rm $NGX_AUTOTEST*
   34: 
   35: # 1424 == 0x590, Sun Studio 12
   36: 
   37: if [ "$ngx_sunc_ver" -ge 1424 ]; then
   38:     ngx_sparc32="-m32"
   39:     ngx_sparc64="-m64"
   40:     ngx_amd64="-m64"
   41: 
   42: else
   43:     ngx_sparc32="-xarch=v8plus"
   44:     ngx_sparc64="-xarch=v9"
   45:     ngx_amd64="-xarch=amd64"
   46: fi
   47: 
   48: case "$NGX_MACHINE" in
   49: 
   50:     i86pc)
   51:         NGX_AUX=" src/os/unix/ngx_sunpro_x86.il"
   52:     ;;
   53: 
   54:     sun4u | sun4v)
   55:         NGX_AUX=" src/os/unix/ngx_sunpro_sparc64.il"
   56:     ;;
   57: 
   58: esac
   59: 
   60: 
   61: # optimizations
   62: 
   63: # 20736 == 0x5100, Sun Studio 12.1
   64: 
   65: if [ "$ngx_sunc_ver" -ge 20736 ]; then
   66:     ngx_fast="-fast"
   67: 
   68: else
   69:     # older versions had problems with bit-fields
   70:     ngx_fast="-fast -xalias_level=any"
   71: fi
   72: 
   73: IPO=-xipo
   74: CFLAGS="$CFLAGS $ngx_fast $IPO"
   75: CORE_LINK="$CORE_LINK $ngx_fast $IPO"
   76: 
   77: 
   78: case $CPU in
   79:     pentium)
   80:         # optimize for Pentium and Athlon
   81:         CPU_OPT="-xchip=pentium"
   82:     ;;
   83: 
   84:     pentiumpro)
   85:         # optimize for Pentium Pro, Pentium II
   86:         CPU_OPT="-xchip=pentium_pro"
   87:     ;;
   88: 
   89:     pentium3)
   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"
   94:     ;;
   95: 
   96:     pentium4)
   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"
  101:     ;;
  102: 
  103:     opteron)
  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"
  108:     ;;
  109: 
  110:     sparc32)
  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
  116:     ;;
  117: 
  118:     sparc64)
  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
  124:     ;;
  125: 
  126:     amd64)
  127:         # build 64-bit amd64 binary
  128:         CPU_OPT="$ngx_amd64"
  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
  133:     ;;
  134: 
  135: esac
  136: 
  137: 
  138: CFLAGS="$CFLAGS $CPU_OPT"
  139: 
  140: 
  141: if [ ".$PCRE_OPT" = "." ]; then
  142:     PCRE_OPT="$ngx_fast $IPO $CPU_OPT"
  143: fi
  144: 
  145: if [ ".$MD5_OPT" = "." ]; then
  146:     MD5_OPT="$ngx_fast $IPO $CPU_OPT"
  147: fi
  148: 
  149: if [ ".$ZLIB_OPT" = "." ]; then
  150:     ZLIB_OPT="$ngx_fast $IPO $CPU_OPT"
  151: fi
  152: 
  153: 
  154: # stop on warning
  155: CFLAGS="$CFLAGS -errwarn=%all"
  156: 
  157: # debug
  158: CFLAGS="$CFLAGS -g"

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>