.
[glibc/history.git] / scripts / lib-names.awk
blob77e66685156985dc152bbfe447b8a7d0161507d6
1 # awk script for soversions.i -> gnu/lib-names.h; see Makeconfig.
3 $1 != "DEFAULT" { multi = 1 }
7 lib = $2;
8 version = $3;
9 if ($3 !~ /^[0-9]/) {
10 soname = $3;
11 extra = $3;
12 sub(/\.so.*$/, "", extra);
14 else {
15 soname = lib ".so." $3;
16 extra = "";
18 soname = "\"" soname "\"";
19 lib = toupper(lib);
20 extra = toupper(extra);
21 gsub(/-/, "_", lib);
22 gsub(/-/, "_", extra);
23 macros[$1 FS lib "_SO"] = soname;
24 if (extra)
25 macros[$1 FS extra "_SO"] = soname;
28 END {
29 print "/* This file is automatically generated.";
30 print " It defines macros to allow user program to find the shared";
31 print " library files which come as part of GNU libc. */";
32 print "#ifndef __GNU_LIB_NAMES_H";
33 print "#define __GNU_LIB_NAMES_H 1";
34 print "";
36 pfx = multi ? "# define " : "#define ";
37 for (elt in macros) {
38 split(elt, x);
39 line = sprintf("%-40s%s", pfx x[2], macros[elt]);
40 if (x[1] in lines)
41 lines[x[1]] = lines[x[1]] "\n" line;
42 else
43 lines[x[1]] = line;
46 if (multi) {
47 # Print these in a fixed order so the result is identical
48 # on both sides of the coin.
49 if (!("WORDSIZE32" in lines))
50 lines["WORDSIZE32"] = lines["DEFAULT"];
51 if (!("WORDSIZE64" in lines))
52 lines["WORDSIZE64"] = lines["DEFAULT"];
53 print "#include <bits/wordsize.h>\n";
54 print "#if __WORDSIZE == 32";
55 cmd = "LC_ALL=C sort"; print lines["WORDSIZE32"] | cmd; close(cmd);
56 print "#else"
57 cmd = "LC_ALL=C sort"; print lines["WORDSIZE64"] | cmd; close(cmd);
58 print "#endif";
60 else {
61 cmd = "LC_ALL=C sort"; print lines["DEFAULT"] | cmd; close(cmd);
64 print "";
65 print "#endif /* gnu/lib-names.h */"