1# awk script for soversions.i -> gnu/lib-names.h; see Makeconfig.
2
3#
4{
5  split($1, fields, "=")
6  lib = fields[1];
7  soname = version = fields[2];
8  sub(/^.*=/, "", soname);
9  sub(/^lib.*\.so\./, "", version);
10  if ($soname !~ /^lib/) {
11    extra = soname;
12    sub(/\.so.*$/, "", extra);
13  }
14  else {
15    extra = "";
16  }
17  soname = "\"" soname "\"";
18  lib = toupper(lib);
19  extra = toupper(extra);
20  gsub(/-/, "_", lib);
21  gsub(/-/, "_", extra);
22  macros[$1 FS lib "_SO"] = soname;
23  if (extra)
24    macros[$1 FS extra "_SO"] = soname;
25}
26
27END {
28  for (elt in macros) {
29    split(elt, x);
30    printf("%-40s%s\n", "#define " x[2], macros[elt]);
31  }
32}
33