bottleneck testcase based on rubbos
[bottlenecks.git] / rubbos / app / tomcat-connectors-1.2.32-src / support / get_ver.awk
1 BEGIN {
2
3 # Licensed to the Apache Software Foundation (ASF) under one or more
4 # contributor license agreements.  See the NOTICE file distributed with
5 # this work for additional information regarding copyright ownership.
6 # The ASF licenses this file to You under the Apache License, Version 2.0
7 # (the "License"); you may not use this file except in compliance with
8 # the License.  You may obtain a copy of the License at
9 #
10 #     http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17
18
19   # fetch mod_jk version numbers from input file and writes them to STDOUT
20
21   while ((getline < ARGV[1]) > 0) {
22     if (match ($0, /^#define JK_VERMAJOR [^"]+/)) {
23       jk_ver_major = substr($3, 1, length($3));
24     }
25     else if (match ($0, /^#define JK_VERMINOR [^"]+/)) {
26       jk_ver_minor = substr($3, 1, length($3));
27     }
28     else if (match ($0, /^#define JK_VERFIX [^"]+/)) {
29       jk_ver_fix = substr($3, 1, length($3));
30     }
31     else if (match ($0, /^#define JK_VERISRELEASE [^"]+/)) {
32       jk_ver_isrelease = substr($3, 1, length($3));
33     }
34     else if (match ($0, /^#define JK_VERBETA [^"]+/)) {
35       jk_ver_isbeta = substr($3, 1, length($3));
36     }
37     else if (match ($0, /^#define JK_BETASTRING [^"]+/)) {
38       jk_ver_betastr = substr($3, 2, length($3) - 2);
39     }
40   }
41   jk_ver = jk_ver_major "," jk_ver_minor "," jk_ver_fix;
42   jk_ver_str = jk_ver_major "." jk_ver_minor "." jk_ver_fix;
43   if (jk_ver_isrelease != 1) {
44     jk_ver_str = jk_ver_str "-dev";
45   }
46   if (jk_ver_isbeta == 1) {
47     jk_ver_str = jk_ver_str "-beta-" jk_ver_betastr;
48   }
49   
50   # fetch Apache version numbers from input file and writes them to STDOUT
51
52   if (ARGV[2]) {
53     if (match (ARGV[2], /ap_release.h/)) {
54       while ((getline < ARGV[2]) > 0) {
55         if (match ($0, /^#define AP_SERVER_MAJORVERSION "[^"]+"/)) {
56           ap_ver_major = substr($3, 2, length($3) - 2);
57         }
58         else if (match ($0, /^#define AP_SERVER_MINORVERSION "[^"]+"/)) {
59           ap_ver_minor = substr($3, 2, length($3) - 2);
60         }
61         else if (match ($0, /^#define AP_SERVER_PATCHLEVEL/)) {
62           ap_ver_str_patch = substr($3, 2, length($3) - 2);
63           if (match (ap_ver_str_patch, /[0-9][0-9]*/)) {
64             ap_ver_patch = substr(ap_ver_str_patch, RSTART, RLENGTH); 
65           }
66         }
67       }
68       ap_ver_str = ap_ver_major "." ap_ver_minor "." ap_ver_str_patch;
69     }
70     if (match (ARGV[2], /httpd.h/)) {
71       while ((getline < ARGV[2]) > 0) {
72         if (match ($0, /^#define SERVER_BASEREVISION "[^"]+"/)) {
73           ap_ver_str = substr($3, 2, length($3) - 2);
74         }
75       }
76     }
77     print "AP_VERSION_STR = " ap_ver_str "";
78   }
79
80   print "JK_VERSION = " jk_ver "";
81   print "JK_VERSION_STR = " jk_ver_str "";
82
83 }