1#************************************************************************* 2# 3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4# 5# Copyright 2000, 2010 Oracle and/or its affiliates. 6# 7# OpenOffice.org - a multi-platform office productivity suite 8# 9# This file is part of OpenOffice.org. 10# 11# OpenOffice.org is free software: you can redistribute it and/or modify 12# it under the terms of the GNU Lesser General Public License version 3 13# only, as published by the Free Software Foundation. 14# 15# OpenOffice.org is distributed in the hope that it will be useful, 16# but WITHOUT ANY WARRANTY; without even the implied warranty of 17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18# GNU Lesser General Public License version 3 for more details 19# (a copy is included in the LICENSE file that accompanied this code). 20# 21# You should have received a copy of the GNU Lesser General Public License 22# version 3 along with OpenOffice.org. If not, see 23# <http://www.openoffice.org/license.html> 24# for a copy of the LGPLv3 License. 25# 26#************************************************************************* 27BEGIN { 28 CCversion = 0 29 compiler_matched = 0 30} 31# Sun c++ compiler 32/Sun WorkShop/ || /Forte Developer/ || /Sun/{ 33 compiler_matched = 1 34 # version number right after "C++" 35 x = match( $0, /C\+\+ .*/ ) 36 btwn = substr( $0, RSTART, RLENGTH) 37 # extract version, whitespaces get striped later 38 x = match( btwn, / .*\..*[ $\t]/) 39 CCversion = substr( btwn, RSTART, RLENGTH) 40} 41# Microsoft c++ compiler 42/Microsoft/ && /..\...\...../ { 43 compiler_matched = 1 44 # match on the format of the ms versions ( dd.dd.dddd ) 45 x = match( $0, /..\...\...../ ) 46 CCversion = substr( $0, RSTART, RLENGTH) 47} 48# Java 49/java version/ || /openjdk version/ { 50 compiler_matched = 1 51 # match on the format of the java versions ( d[d].d[d].d[d] ) 52 x = match( $0, /[0-9]*\.[0-9]*\.[0-9]*/ ) 53 CCversion = substr( $0, RSTART, RLENGTH) 54} 55/^[0-9]*[.][0-9]*\x0d*$/ { 56 if ( compiler_matched == 0 ) { 57# need to blow to x.xx.xx for comparing 58 CCversion = $0 ".0" 59 } 60} 61/^[0-9]*[.][0-9]*[.][0-9]*\x0d*$/ { 62 if ( compiler_matched == 0 ) { 63 CCversion = $0 64 } 65} 66/^[0-9]*[.][0-9]*[.][0-9]*-[0-9a-z]*$/ { 67 if ( compiler_matched == 0 ) { 68 CCversion = substr($0, 0, index($0, "-") - 1) 69 } 70} 71END { 72 if ( num == "true" ) { 73 tokencount = split (CCversion,vertoken,".") 74 for ( i = 1 ; i <= tokencount ; i++ ) { 75 printf ("%04d",vertoken[i] ) 76 } 77 } else 78 print CCversion 79} 80