Commit | Line | Data |
---|---|---|
959f3c4c JH |
1 | ?RCS: $Id: src.U,v 3.0.1.1 1997/02/28 16:23:54 ram Exp $ |
2 | ?RCS: | |
3 | ?RCS: Copyright (c) 1996, Cygnus Support | |
4 | ?RCS: Copyright (c) 1991-1993, Raphael Manfredi | |
5 | ?RCS: | |
6 | ?RCS: You may redistribute only under the terms of the Artistic Licence, | |
7 | ?RCS: as specified in the README file that comes with the distribution. | |
8 | ?RCS: You may reuse parts of this distribution only within the terms of | |
9 | ?RCS: that same Artistic Licence; a copy of which may be found at the root | |
10 | ?RCS: of the source tree for dist 3.0. | |
11 | ?RCS: | |
12 | ?RCS: Original Author: Tom Tromey <tromey@cygnus.com> | |
13 | ?RCS: | |
14 | ?RCS: $Log: src.U,v $ | |
15 | ?RCS: Revision 3.0.1.1 1997/02/28 16:23:54 ram | |
16 | ?RCS: patch61: created | |
17 | ?RCS: | |
18 | ?MAKE:src +rsrc: Options package contains | |
19 | ?MAKE: -pick add $@ %< | |
20 | ?Y:TOP | |
21 | ?S:src (srcdir): | |
22 | ?S: This variable holds the path to the package source. It is up to | |
23 | ?S: the Makefile to use this variable and set VPATH accordingly to | |
24 | ?S: find the sources remotely. | |
25 | ?S:. | |
26 | ?S:rsrc (relsrcdir): | |
27 | ?S: This variable holds a potentially relative path to the package | |
28 | ?S: source. The contents are correct for the configuration environment, | |
29 | ?S: i.e. there might be an extra .. prepended to get out of the UU dir. | |
30 | ?S: Configure units should use this, not the src variable. | |
31 | ?S:. | |
32 | ?LINT:change package | |
33 | : Find the path to the source tree | |
34 | case "$src" in | |
35 | '') case "$0" in | |
36 | */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'` | |
37 | case "$src" in | |
38 | /*) ;; | |
c4385fe3 | 39 | .) ;; |
959f3c4c JH |
40 | *) src=`cd ../$src && pwd` ;; |
41 | esac | |
42 | ;; | |
43 | *) src='.';; | |
44 | esac;; | |
45 | esac | |
46 | case "$src" in | |
47 | '') src=/ | |
48 | rsrc=/ | |
49 | ;; | |
50 | /*) rsrc="$src";; | |
51 | *) rsrc="../$src";; | |
52 | esac | |
53 | ?X: | |
54 | ?X: Now check whether we have found the right source tree (i.e. the one for the | |
55 | ?X: package we're abount to configure). The original unit from Tom Tromey forced | |
56 | ?X: the user to pick a unique file from his distribution, and we were merely | |
57 | ?X: checking the existence of that file. I prefer to rely on Configure (which | |
58 | ?X: we know *is* present since this unit is part of it!) and look for the | |
59 | ?X: definition of the package variable, making sure it's the same as ours. | |
60 | ?X: If it matches, we know we found the right source tree. -- RAM, 15/03/96 | |
61 | ?X: | |
62 | if test -f $rsrc/Configure && \ | |
63 | $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1 | |
64 | then | |
65 | : found it, so we are ok. | |
66 | else | |
67 | ?X: Otherwise try "." and up to 4 parent directories... | |
68 | ?X: Note that we prepend a ".." to get out of the configuration environment. | |
69 | rsrc='' | |
70 | for src in . .. ../.. ../../.. ../../../..; do | |
71 | if test -f ../$src/Configure && \ | |
72 | $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1 | |
73 | then | |
74 | rsrc=../$src | |
75 | break | |
76 | fi | |
77 | done | |
78 | fi | |
79 | case "$rsrc" in | |
80 | '') | |
81 | cat <<EOM >&4 | |
82 | ||
83 | Sorry, I can't seem to locate the source dir for $package. Please start | |
84 | Configure with an explicit path -- i.e. /some/path/Configure. | |
85 | ||
86 | EOM | |
87 | exit 1 | |
88 | ;; | |
89 | ?X: Don't echo anything if the sources are in . -- they should know already ;-) | |
90 | ?X: In that case, rsrc is ../. since we lookup from within UU | |
91 | ../.) rsrc='..';; | |
92 | *) | |
93 | echo " " | |
94 | echo "Sources for $package found in \"$src\"." >&4 | |
95 | ;; | |
96 | esac | |
97 |