1*ebfedea0SLionel Sambuc######################################################################## 2*ebfedea0SLionel Sambuc# 3*ebfedea0SLionel Sambuc# Copyright (c) 2010, Secure Endpoints Inc. 4*ebfedea0SLionel Sambuc# All rights reserved. 5*ebfedea0SLionel Sambuc# 6*ebfedea0SLionel Sambuc# Redistribution and use in source and binary forms, with or without 7*ebfedea0SLionel Sambuc# modification, are permitted provided that the following conditions 8*ebfedea0SLionel Sambuc# are met: 9*ebfedea0SLionel Sambuc# 10*ebfedea0SLionel Sambuc# - Redistributions of source code must retain the above copyright 11*ebfedea0SLionel Sambuc# notice, this list of conditions and the following disclaimer. 12*ebfedea0SLionel Sambuc# 13*ebfedea0SLionel Sambuc# - Redistributions in binary form must reproduce the above copyright 14*ebfedea0SLionel Sambuc# notice, this list of conditions and the following disclaimer in 15*ebfedea0SLionel Sambuc# the documentation and/or other materials provided with the 16*ebfedea0SLionel Sambuc# distribution. 17*ebfedea0SLionel Sambuc# 18*ebfedea0SLionel Sambuc# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19*ebfedea0SLionel Sambuc# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20*ebfedea0SLionel Sambuc# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 21*ebfedea0SLionel Sambuc# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 22*ebfedea0SLionel Sambuc# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 23*ebfedea0SLionel Sambuc# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 24*ebfedea0SLionel Sambuc# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25*ebfedea0SLionel Sambuc# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26*ebfedea0SLionel Sambuc# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27*ebfedea0SLionel Sambuc# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 28*ebfedea0SLionel Sambuc# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29*ebfedea0SLionel Sambuc# POSSIBILITY OF SUCH DAMAGE. 30*ebfedea0SLionel Sambuc# 31*ebfedea0SLionel Sambuc 32*ebfedea0SLionel Sambuc# Try to detect the version of Visual C++ in use by parsing the output 33*ebfedea0SLionel Sambuc# of cl.exe. 34*ebfedea0SLionel Sambuc 35*ebfedea0SLionel Sambuc$cl_cmd = shift; 36*ebfedea0SLionel Sambuc 37*ebfedea0SLionel Sambucdie "C compiler command should be specified" if ($cl_cmd eq ''); 38*ebfedea0SLionel Sambuc 39*ebfedea0SLionel Sambucopen(CL, '-|', $cl_cmd." 2>&1") or die "Can't run C compiler command [$cl_cmd]"; 40*ebfedea0SLionel Sambuc 41*ebfedea0SLionel Sambuc$verline = <CL>; 42*ebfedea0SLionel Sambuc 43*ebfedea0SLionel Sambucif ($verline =~ /(\d+).(\d+).(\d+).(\d+)/) { 44*ebfedea0SLionel Sambuc print "Found Version: $1.$2.$3.$4\n"; 45*ebfedea0SLionel Sambuc exit $1 + 0; 46*ebfedea0SLionel Sambuc} else { 47*ebfedea0SLionel Sambuc print "Mismatch"; 48*ebfedea0SLionel Sambuc exit 1; 49*ebfedea0SLionel Sambuc} 50