Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/make/windows/get_msc_ver.sh
32284 views
#1# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.2# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3#4# This code is free software; you can redistribute it and/or modify it5# under the terms of the GNU General Public License version 2 only, as6# published by the Free Software Foundation.7#8# This code is distributed in the hope that it will be useful, but WITHOUT9# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11# version 2 for more details (a copy is included in the LICENSE file that12# accompanied this code).13#14# You should have received a copy of the GNU General Public License version15# 2 along with this work; if not, write to the Free Software Foundation,16# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17#18# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19# or visit www.oracle.com if you need additional information or have any20# questions.21#22#2324set -e2526# This shell script echoes "MSC_VER=<munged version of cl>"27# It ignores the micro version component.28# Examples:29# cl version 12.00.8804 returns "MSC_VER=1200"30# cl version 13.10.3077 returns "MSC_VER=1310"31# cl version 14.00.30701 returns "MSC_VER=1399" (OLD_MSSDK version)32# cl version 14.00.40310.41 returns "MSC_VER=1400"33# cl version 15.00.21022.8 returns "MSC_VER=1500"3435# Note that we currently do not have a way to set HotSpotMksHome in36# the batch build, but so far this has not seemed to be a problem. The37# reason this environment variable is necessary is that it seems that38# Windows truncates very long PATHs when executing shells like MKS's39# sh, and it has been found that sometimes `which sh` fails.4041if [ "x$HotSpotMksHome" != "x" ]; then42TOOL_DIR="$HotSpotMksHome"43else44# HotSpotMksHome is not set so use the directory that contains "sh".45# This works with both MKS and Cygwin.46SH=`which sh`47TOOL_DIR=`dirname "$SH"`48fi4950DIRNAME="$TOOL_DIR/dirname"51HEAD="$TOOL_DIR/head"52ECHO="$TOOL_DIR/echo"53EXPR="$TOOL_DIR/expr"54CUT="$TOOL_DIR/cut"55SED="$TOOL_DIR/sed"5657if [ "x$FORCE_MSC_VER" != "x" ]; then58echo "MSC_VER=$FORCE_MSC_VER"59else60MSC_VER_RAW=`cl 2>&1 | "$HEAD" -n 1 | "$SED" 's/.*Version[\ ]*\([0-9][0-9.]*\).*/\1/'`61MSC_VER_MAJOR=`"$ECHO" $MSC_VER_RAW | "$CUT" -d'.' -f1`62MSC_VER_MINOR=`"$ECHO" $MSC_VER_RAW | "$CUT" -d'.' -f2`63MSC_VER_MICRO=`"$ECHO" $MSC_VER_RAW | "$CUT" -d'.' -f3`64if [ "${MSC_VER_MAJOR}" -eq 14 -a "${MSC_VER_MINOR}" -eq 0 -a "${MSC_VER_MICRO}" -eq 30701 ] ; then65# This said 1400 but it was really more like VS2003 (VC7) in terms of options66MSC_VER=139967else68MSC_VER=`"$EXPR" $MSC_VER_MAJOR \* 100 + $MSC_VER_MINOR`69fi70echo "MSC_VER=$MSC_VER"71echo "MSC_VER_RAW=$MSC_VER_RAW"72fi7374if [ "x$FORCE_LD_VER" != "x" ]; then75echo "LD_VER=$FORCE_LD_VER"76else77# use the "link" command that is co-located with the "cl" command78cl_cmd=`which cl`79if [ "x$cl_cmd" != "x" ]; then80link_cmd=`$DIRNAME "$cl_cmd"`/link81else82# which can't find "cl" so just use which ever "link" we find83link_cmd="link"84fi85LD_VER_RAW=`"$link_cmd" 2>&1 | "$HEAD" -n 1 | "$SED" 's/.*Version[\ ]*\([0-9][0-9.]*\).*/\1/'`86LD_VER_MAJOR=`"$ECHO" $LD_VER_RAW | "$CUT" -d'.' -f1`87LD_VER_MINOR=`"$ECHO" $LD_VER_RAW | "$CUT" -d'.' -f2`88LD_VER_MICRO=`"$ECHO" $LD_VER_RAW | "$CUT" -d'.' -f3`89LD_VER=`"$EXPR" $LD_VER_MAJOR \* 100 + $LD_VER_MINOR`90echo "LD_VER=$LD_VER"91echo "LD_VER_RAW=$LD_VER_RAW"92fi939495