This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add the files from dist/meta to perl's repo
[metaconfig.git] / dist / U / Inhdr.U
1 ?RCS: $Id: Inhdr.U 1 2006-08-24 12:32:52Z rmanfredi $
2 ?RCS:
3 ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
4 ?RCS: 
5 ?RCS: You may redistribute only under the terms of the Artistic Licence,
6 ?RCS: as specified in the README file that comes with the distribution.
7 ?RCS: You may reuse parts of this distribution only within the terms of
8 ?RCS: that same Artistic Licence; a copy of which may be found at the root
9 ?RCS: of the source tree for dist 4.0.
10 ?RCS:
11 ?RCS: $Log: Inhdr.U,v $
12 ?RCS: Revision 3.0.1.2  1995/05/12  12:01:31  ram
13 ?RCS: patch54: deleted tabs that caused some /bin/sh to core dump (ADO)
14 ?RCS:
15 ?RCS: Revision 3.0.1.1  1994/10/29  15:55:01  ram
16 ?RCS: patch36: call ./whoa explicitly instead of relying on PATH
17 ?RCS:
18 ?RCS: Revision 3.0  1993/08/18  12:05:01  ram
19 ?RCS: Baseline for dist 3.0 netwide release.
20 ?RCS:
21 ?X:
22 ?X: This unit checks wether a set of header files exists or not.
23 ?X:     If the first header is not found, the function tries to locate
24 ?X: the next header, and so on, until one is found or there is no
25 ?X: more header in the list.
26 ?X:
27 ?X: To use it, say:
28 ?X: set header i_header [ header2 i_header2 ... ]
29 ?X: eval $inhdr
30 ?X:
31 ?MAKE:Inhdr: test Findhdr Whoa
32 ?MAKE:  -pick add $@ %<
33 ?LINT:define inhdr
34 ?V:inhdr
35 ?S:inhdr:
36 ?S:     This shell variable is used internally by Configure to check
37 ?S:     wether a set of headers exist or not. A typical use is:
38 ?S:             set header i_header [ header2 i_header2 ... ]
39 ?S:             eval $inhdr
40 ?S:     That will print a message, saying wether header was found or
41 ?S:     not and set i_header* accordingly. If the first header is not
42 ?S: found, we try the next one, until the list is empty or one is found.
43 ?S:.
44 ?T:xxx xxf var td xxnf tu yyy instead was cont
45 : define an alternate in-header-list? function
46 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
47 cont=true; xxf="echo \"<\$1> found.\" >&4";
48 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
49 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
50 esac;
51 case $# in 4) instead=instead;; *) instead="at last";; esac;
52 while $test "$cont"; do
53         xxx=`./findhdr $1`
54         var=$2; eval "was=\$$2";
55         if $test "$xxx" && $test -r "$xxx";
56         then eval $xxf;
57 ?X: Next line shifted left 1 tabstop to avoid sh core dump on MachTen 2.1.1.
58         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
59                 cont="";
60         else eval $xxnf;
61 ?X: Likewise, the next line has been shifted left 1 tabstop -- ADO, 08/03/95
62         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
63         set $yyy; shift; shift; yyy=$@;
64         case $# in 0) cont="";;
65         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
66                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
67         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
68                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
69         esac;
70 done;
71 ?X: Remaining values are set to 'undef'
72 while $test "$yyy";
73 do set $yyy; var=$2; eval "was=\$$2";
74         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
75         set $yyy; shift; shift; yyy=$@;
76 done'
77