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 / Setvar.U
CommitLineData
d8875586
MBT
1?RCS: $Id: Setvar.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: Setvar.U,v $
12?RCS: Revision 3.0.1.1 1994/10/29 15:58:28 ram
13?RCS: patch36: call ./whoa explicitly instead of relying on PATH
14?RCS:
15?RCS: Revision 3.0 1993/08/18 12:05:16 ram
16?RCS: Baseline for dist 3.0 netwide release.
17?RCS:
18?X:
19?X: This unit produces a variable that is intended to be eval'ed in
20?X: order to define/undefine a symbol. A consistency check is made
21?X: regarding any previous value and a warning is issued if there
22?X: is any discrepancy.
23?X:
24?X: To use it, say:
25?X: val=<value>
26?X: set d_variable
27?X: eval $setvar
28?X:
29?MAKE:Setvar: Whoa
30?MAKE: -pick add $@ %<
31?LINT:define setvar
32?S:setvar:
33?S: This shell variable is used internally by Configure to set a value
34?S: to a given symbol that is defined or not. A typical use is:
35?S: val=<value computed>
36?S: set d_variable
37?S: eval $setvar
38?S: That will print a message in case the $val value is not the same
39?S: as the previous value of $d_variable.
40?S:.
41?V:setvar:val
42?T:var was td tu
43: function used to set '$1' to '$val'
44setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
45case "$val$was" in
46$define$undef) . ./whoa; eval "$var=\$td";;
47$undef$define) . ./whoa; eval "$var=\$tu";;
48*) eval "$var=$val";;
49esac'
50