Commit | Line | Data |
---|---|---|
aa65fbd2 | 1 | ?RCS: Copyright (c) 2016 Dagfinn Ilmari Mannsåker & H.Merijn Brand |
59fa348a | 2 | ?RCS: |
aa65fbd2 MBT |
3 | ?RCS: You may distribute under the terms of either the GNU General Public |
4 | ?RCS: License or the Artistic License, as specified in the README file. | |
5 | ?RCS: | |
6 | ?X: | |
7 | ?X: This unit produces a variable that is intended to be eval'ed in | |
8 | ?X: order to define/undefine a symbol. A consistency check is made | |
9 | ?X: regarding any previous value and a warning is issued if there | |
10 | ?X: is any discrepancy. | |
11 | ?X: | |
12 | ?X: To use it, say: | |
13 | ?X: set d_siginfo_si_errno siginfo_t int si_errno $d_sigaction signal.h | |
14 | ?X: eval $hasfield_t; | |
15 | ?X: | |
59fa348a | 16 | ?MAKE:Hasfield_t: test Compile rm_try Setvar |
aa65fbd2 | 17 | ?MAKE: -pick add $@ %< |
59fa348a | 18 | ?LINT:define hasfield_t |
aa65fbd2 MBT |
19 | ?S:hasfield_t: |
20 | ?S: Internal macro for Configure | |
21 | ?S:. | |
59fa348a | 22 | ?V:hasfield_t: |
aa65fbd2 MBT |
23 | ?T:varname struct type field |
24 | : Define hasfield_t macro for Configure internal use | |
25 | hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift; | |
26 | while $test $# -ge 2; do | |
27 | case "$1" in | |
28 | $define) echo "#include <$2>";; | |
29 | esac ; | |
30 | shift 2; | |
31 | done > try.c; | |
32 | echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c; | |
33 | set try; | |
34 | if eval $compile; then | |
35 | val="$define"; | |
36 | else | |
37 | val="$undef"; | |
38 | fi; | |
39 | set $varname; | |
40 | eval $setvar; | |
41 | $rm_try' | |
42 |