This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[UTIL] Perl system does not default to $_
[metaconfig.git] / dist / U / Inlibc.U
1 ?RCS: $Id: Inlibc.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: Inlibc.U,v $
12 ?RCS: Revision 3.0.1.1  1994/10/29  15:55:08  ram
13 ?RCS: patch36: call ./whoa explicitly instead of relying on PATH
14 ?RCS:
15 ?RCS: Revision 3.0  1993/08/18  12:05:03  ram
16 ?RCS: Baseline for dist 3.0 netwide release.
17 ?RCS:
18 ?X:
19 ?X: This unit checks for the definition of a given function.
20 ?X:
21 ?X: To use it, say:
22 ?X: set function d_func
23 ?X: eval $inlibc
24 ?X:
25 ?MAKE:Inlibc: Csym Whoa Oldconfig
26 ?MAKE:  -pick add $@ %<
27 ?LINT:define inlibc
28 ?V:inlibc
29 ?S:inlibc:
30 ?S:     This shell variable is used internally by Configure to check
31 ?S:     wether a given function is defined or not. A typical use is:
32 ?S:             set function d_func
33 ?S:             eval $inlibc
34 ?S:     That will print a message, saying wether function was found or
35 ?S:     not and set d_func accordingly.
36 ?S:.
37 ?T:was tx sym tres td tu var
38 : define an is-in-libc? function
39 inlibc='echo " "; td=$define; tu=$undef;
40 sym=$1; var=$2; eval "was=\$$2";
41 tx=yes;
42 case "$reuseval$was" in
43 true) ;;
44 true*) tx=no;;
45 esac;
46 case "$tx" in
47 yes)
48         set $sym tres -f;
49         eval $csym;
50         case "$tres" in
51         true)
52                 echo "$sym() found." >&4;
53                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
54         *)
55                 echo "$sym() NOT found." >&4;
56                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
57         esac;;
58 *)
59         case "$was" in
60         $define) echo "$sym() found." >&4;;
61         *) echo "$sym() NOT found." >&4;;
62         esac;;
63 esac'
64