1 # fetch rrdtool version number from input file and write them to STDOUT
2 BEGIN {
3 while ((getline < ARGV[1]) > 0) {
4 if (match ($0, /^AC_INIT/)) {
5 split($1, t, ",");
6 my_ver_str = substr(t[2],2,length(t[2])-3);
7 split(my_ver_str, v, ".");
8 gsub("[^0-9].*$", "", v[3]);
9 my_ver = v[1] "," v[2] "," v[3];
10 }
11 if (match ($0, /^NUMVERS=/)) {
12 split($1, t, "=");
13 my_num_ver = t[2];
14 }
15 }
16 print "RRD_VERSION = " my_ver "";
17 print "RRD_VERSION_STR = " my_ver_str "";
18 print "RRD_NUMVERS = " my_num_ver "";
19 }