blob: d7ca1a230db00ce6741cab1d233273070b924f07 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# Generation of crypt.h from crypt.h.in and config.h.
#
# Written by Zack Weinberg <zackw at panix.com> in 2017.
# To the extent possible under law, Zack Weinberg has waived all
# copyright and related or neighboring rights to this work.
#
# See https://creativecommons.org/publicdomain/zero/1.0/ for further
# details.
BEGIN {
HAVE_SYS_CDEFS_H = 0
HAVE_SYS_CDEFS_BEGIN_END_DECLS = 0
HAVE_SYS_CDEFS_THROW = 0
}
END {
if (!HAVE_SYS_CDEFS_H &&
(HAVE_SYS_CDEFS_BEGIN_END_DECLS ||
HAVE_SYS_CDEFS_THROW)) {
print "config.h is inconsistent" > "/dev/stderr"
close("/dev/stderr")
exit 1
}
}
FILENAME ~ /config\.h$/ {
if ($0 ~ /^#define HAVE_SYS_CDEFS_H 1$/) {
HAVE_SYS_CDEFS_H = 1
} else if ($0 ~ /^#define HAVE_SYS_CDEFS_BEGIN_END_DECLS 1$/) {
HAVE_SYS_CDEFS_BEGIN_END_DECLS = 1
} else if ($0 ~ /^#define HAVE_SYS_CDEFS_THROW 1$/) {
HAVE_SYS_CDEFS_THROW = 1
}
}
FILENAME !~ /config\.h$/ {
if ($0 ~ /^\/\*HEADER\*\/$/) {
if (HAVE_SYS_CDEFS_H) {
print "#include <sys/cdefs.h>"
}
if (!HAVE_SYS_CDEFS_THROW) {
print "#define __THROW /* nothing */"
}
print ""
if (HAVE_SYS_CDEFS_BEGIN_END_DECLS) {
print "__BEGIN_DECLS"
} else {
print "#ifdef __cplusplus"
print "extern \"C\" {"
print "#endif"
}
} else if ($0 ~ /^\/\*TRAILER\*\/$/) {
if (HAVE_SYS_CDEFS_BEGIN_END_DECLS) {
print "__END_DECLS"
} else {
print "#ifdef __cplusplus"
print "} /* extern \"C\" */"
print "#endif"
}
} else {
print;
}
}
|