summaryrefslogtreecommitdiff
path: root/mcon/U/src.U
blob: e939a4c045319d2ef1f076e889121704e3b4095f (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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
?RCS: $Id$
?RCS:
?RCS: Copyright (c) 1996, Cygnus Support
?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
?RCS: 
?RCS: You may redistribute only under the terms of the Artistic Licence,
?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 Licence; a copy of which may be found at the root
?RCS: of the source tree for dist 4.0.
?RCS:
?RCS: Original Author: Tom Tromey <tromey@cygnus.com>
?RCS:
?RCS: $Log: src.U,v $
?RCS: Revision 3.0.1.1  1997/02/28  16:23:54  ram
?RCS: patch61: created
?RCS:
?MAKE:src +rsrc: Options package contains
?MAKE:	-pick add $@ %<
?Y:TOP
?S:src (srcdir):
?S:	This variable holds the (possibly relative) path of the package source.
?S:	It is up to the Makefile to use this variable and set VPATH accordingly
?S:	to find the sources remotely.  Use $pkgsrc to have an absolute path.
?S:.
?S:rsrc (relsrcdir):
?S:	This variable holds a potentially relative path to the package
?S:	source.  The contents are correct for the configuration environment,
?S:	i.e. there might be an extra .. prepended to get out of the UU dir.
?S:	Configure units should use this, not the src variable.
?S:.
: Find the path to the source tree
case "$src" in
'') case "$0" in
    */*)
		src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
		;;
    *)	src='.';;
    esac;;
esac
case "$src" in
'')	src=/
	rsrc=/
	;;
/*)	rsrc="$src";;
*)	rsrc="../$src";;
esac
?X:
?X: Now check whether we have found the right source tree (i.e. the one for the
?X: package we're abount to configure). The original unit from Tom Tromey forced
?X: the user to pick a unique file from his distribution, and we were merely
?X: checking the existence of that file. I prefer to rely on Configure (which
?X: we know *is* present since this unit is part of it!) and look for the
?X: definition of the package variable, making sure it's the same as ours.
?X: If it matches, we know we found the right source tree. -- RAM, 15/03/96
?X:
if test -f $rsrc/Configure && \
	$contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
then
   : found it, so we are ok.
else
?X: Otherwise try "." and up to 4 parent directories...
?X: Note that we prepend a ".." to get out of the configuration environment.
	rsrc=''
	for src in . .. ../.. ../../.. ../../../..; do
		if test -f ../$src/Configure && \
			$contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
		then
			rsrc=../$src
			break
		fi
	done
fi
case "$rsrc" in
'')
	cat <<EOM >&4

Sorry, I can't seem to locate the source dir for $package.  Please start
Configure with an explicit path -- i.e. /some/path/Configure.

EOM
	exit 1
	;;
?X: Don't echo anything if the sources are in . -- they should know already ;-)
?X: In that case, rsrc is ../. since we lookup from within UU
../.)	rsrc='..';;
*)
	echo " "
	echo "Sources for $package found in \"$src\"." >&4
	;;
esac