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 | |
4c42341b | 5 | ?RCS: |
959f3c4c JH |
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:. | |
959f3c4c JH |
32 | : Find the path to the source tree |
33 | case "$src" in | |
34 | '') case "$0" in | |
35 | */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'` | |
36 | case "$src" in | |
37 | /*) ;; | |
c4385fe3 | 38 | .) ;; |
959f3c4c JH |
39 | *) src=`cd ../$src && pwd` ;; |
40 | esac | |
41 | ;; | |
42 | *) src='.';; | |
43 | esac;; | |
44 | esac | |
45 | case "$src" in | |
46 | '') src=/ | |
47 | rsrc=/ | |
48 | ;; | |
49 | /*) rsrc="$src";; | |
50 | *) rsrc="../$src";; | |
51 | esac | |
52 | ?X: | |
53 | ?X: Now check whether we have found the right source tree (i.e. the one for the | |
54 | ?X: package we're abount to configure). The original unit from Tom Tromey forced | |
55 | ?X: the user to pick a unique file from his distribution, and we were merely | |
56 | ?X: checking the existence of that file. I prefer to rely on Configure (which | |
57 | ?X: we know *is* present since this unit is part of it!) and look for the | |
58 | ?X: definition of the package variable, making sure it's the same as ours. | |
59 | ?X: If it matches, we know we found the right source tree. -- RAM, 15/03/96 | |
60 | ?X: | |
61 | if test -f $rsrc/Configure && \ | |
62 | $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1 | |
63 | then | |
64 | : found it, so we are ok. | |
65 | else | |
66 | ?X: Otherwise try "." and up to 4 parent directories... | |
67 | ?X: Note that we prepend a ".." to get out of the configuration environment. | |
68 | rsrc='' | |
69 | for src in . .. ../.. ../../.. ../../../..; do | |
70 | if test -f ../$src/Configure && \ | |
71 | $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1 | |
72 | then | |
73 | rsrc=../$src | |
74 | break | |
75 | fi | |
76 | done | |
77 | fi | |
78 | case "$rsrc" in | |
79 | '') | |
80 | cat <<EOM >&4 | |
81 | ||
82 | Sorry, I can't seem to locate the source dir for $package. Please start | |
83 | Configure with an explicit path -- i.e. /some/path/Configure. | |
84 | ||
85 | EOM | |
86 | exit 1 | |
87 | ;; | |
88 | ?X: Don't echo anything if the sources are in . -- they should know already ;-) | |
89 | ?X: In that case, rsrc is ../. since we lookup from within UU | |
90 | ../.) rsrc='..';; | |
91 | *) | |
92 | echo " " | |
93 | echo "Sources for $package found in \"$src\"." >&4 | |
94 | ;; | |
95 | esac | |
96 |