summaryrefslogtreecommitdiff
path: root/mcon/U/Oldsym.U
blob: 2546fc322d3d450afcbe3a432c0a0c9bb0c78ddf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
?RCS: $Id: Oldsym.U 167 2013-05-08 17:58:00Z rmanfredi $
?RCS:
?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
?RCS: 
?RCS: You may redistribute only under the terms of the Artistic License,
?RCS: as specified in the README file that comes with the distribution.
?RCS: You may reuse parts of this distribution only within the terms of
?RCS: that same Artistic License; a copy of which may be found at the root
?RCS: of the source tree for dist 4.0.
?RCS:
?RCS: $Log: Oldsym.U,v $
?RCS: Revision 3.0.1.1  1997/02/28  15:06:58  ram
?RCS: patch61: added support for src.U
?RCS:
?RCS: Revision 3.0  1993/08/18  12:05:13  ram
?RCS: Baseline for dist 3.0 netwide release.
?RCS:
?X: 
?X: This unit follows the creation of the config.sh file. It adds some
?X: special symbols: defines from patchlevel.h file if any and CONFIG,
?X: which is set to true. Then, we try to keep all the new symbols that
?X: may come from a hint file or a previous config.sh file.
?X: 
?MAKE:Oldsym: Config_sh Options test hint src sed sort uniq
?MAKE:	-pick add $@ %<
?T:CONFIG sym tmp
?F:!UU
: add special variables
$test -f $src/patchlevel.h && \
awk '/^#define/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
?X: In revision.h we expect something like:
?X: 	#define REVISION "$Revision: 167 $"
?X: which is supposed to be expanded by the revision control system.
$test -f $src/revision.h && \
sed -ne 's/^#define \([A-Za-z0-9_]*\) ".*: \([0-9]*\).*"/\1=\2/p' \
	< $src/revision.h >>config.sh
echo "CONFIG=true" >>config.sh

: propagate old symbols
if $test -f UU/config.sh; then
?X: Make sure each symbol is unique in oldconfig.sh
	<UU/config.sh $sort | $uniq >UU/oldconfig.sh
?X:
?X: All the symbols that appear twice come only from config.sh (hence the
?X: two config.sh in the command line). These symbols will be removed by
?X: the uniq -u command. The oldsyms file thus contains all the symbols
?X: that did not appear in the produced config.sh (Larry Wall).
?X:
?X: Do not touch the -u flag of uniq.  This means you too, Jarkko.
?X:
	$sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
		config.sh config.sh UU/oldconfig.sh |\
		$sort | $uniq -u >UU/oldsyms
	set X `cat UU/oldsyms`
	shift
	case $# in
	0) ;;
	*)
		cat <<EOM
Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
EOM
		echo ": Variables propagated from previous config.sh file." >>config.sh
		for sym in `cat UU/oldsyms`; do
			echo "    Propagating $hint variable "'$'"$sym..."
			eval 'tmp="$'"${sym}"'"'
			echo "$tmp" | \
				sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
		done
		;;
	esac
fi