This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix .gitignore: only ignore 'perl' in root of repo, not U/perl subdir
[metaconfig.git] / U / perl / Hasfield_t.U
CommitLineData
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
25hasfield_t='varname=$1; struct=$2; type=$3; field=$4; shift; shift; shift; shift;
26while $test $# -ge 2; do
27 case "$1" in
28 $define) echo "#include <$2>";;
29 esac ;
30 shift 2;
31done > try.c;
32echo "int main () { $struct foo; $type bar = foo.$field; }" >> try.c;
33set try;
34if eval $compile; then
35 val="$define";
36else
37 val="$undef";
38fi;
39set $varname;
40eval $setvar;
41$rm_try'
42