comparison make/windows/get_msc_ver.sh @ 1328:39e409a664b3

6938185: 3/4 6923488 breaks Windows command shell builds Summary: Fix build.bat so invoking command shell doesn't exit on error. Fix dirname assumptions. Document some MKS environment dependencies. Reviewed-by: coleenp
author dcubed
date Thu, 25 Mar 2010 16:27:12 -0700
parents 21141e23627a
children c18cbe5936b8
comparison
equal deleted inserted replaced
1322:21141e23627a 1328:39e409a664b3
46 # This works with both MKS and Cygwin. 46 # This works with both MKS and Cygwin.
47 SH=`which sh` 47 SH=`which sh`
48 TOOL_DIR=`dirname "$SH"` 48 TOOL_DIR=`dirname "$SH"`
49 fi 49 fi
50 50
51 DIRNAME="$TOOL_DIR/dirname"
51 HEAD="$TOOL_DIR/head" 52 HEAD="$TOOL_DIR/head"
52 ECHO="$TOOL_DIR/echo" 53 ECHO="$TOOL_DIR/echo"
53 EXPR="$TOOL_DIR/expr" 54 EXPR="$TOOL_DIR/expr"
54 CUT="$TOOL_DIR/cut" 55 CUT="$TOOL_DIR/cut"
55 SED="$TOOL_DIR/sed" 56 SED="$TOOL_DIR/sed"
74 if [ "x$FORCE_LINK_VER" != "x" ]; then 75 if [ "x$FORCE_LINK_VER" != "x" ]; then
75 echo "LINK_VER=$FORCE_LINK_VER" 76 echo "LINK_VER=$FORCE_LINK_VER"
76 else 77 else
77 # use the "link" command that is co-located with the "cl" command 78 # use the "link" command that is co-located with the "cl" command
78 cl_cmd=`which cl` 79 cl_cmd=`which cl`
79 cl_dir=`dirname $cl_cmd` 80 if [ "x$cl_cmd" != "x" ]; then
80 LINK_VER_RAW=`$cl_dir/link 2>&1 | "$HEAD" -n 1 | "$SED" 's/.*Version[\ ]*\([0-9][0-9.]*\).*/\1/'` 81 link_cmd=`$DIRNAME "$cl_cmd"`/link
82 else
83 # which can't find "cl" so just use which ever "link" we find
84 link_cmd="link"
85 fi
86 LINK_VER_RAW=`"$link_cmd" 2>&1 | "$HEAD" -n 1 | "$SED" 's/.*Version[\ ]*\([0-9][0-9.]*\).*/\1/'`
81 LINK_VER_MAJOR=`"$ECHO" $LINK_VER_RAW | "$CUT" -d'.' -f1` 87 LINK_VER_MAJOR=`"$ECHO" $LINK_VER_RAW | "$CUT" -d'.' -f1`
82 LINK_VER_MINOR=`"$ECHO" $LINK_VER_RAW | "$CUT" -d'.' -f2` 88 LINK_VER_MINOR=`"$ECHO" $LINK_VER_RAW | "$CUT" -d'.' -f2`
83 LINK_VER_MICRO=`"$ECHO" $LINK_VER_RAW | "$CUT" -d'.' -f3` 89 LINK_VER_MICRO=`"$ECHO" $LINK_VER_RAW | "$CUT" -d'.' -f3`
84 LINK_VER=`"$EXPR" $LINK_VER_MAJOR \* 100 + $LINK_VER_MINOR` 90 LINK_VER=`"$EXPR" $LINK_VER_MAJOR \* 100 + $LINK_VER_MINOR`
85 echo "LINK_VER=$LINK_VER" 91 echo "LINK_VER=$LINK_VER"