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