This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
MileStone! I can now configure and build with dist-4.0
[metaconfig.git] / U / modified / src.U
CommitLineData
8696c43d 1?RCS: $Id: src.U 1 2006-08-24 12:32:52Z rmanfredi $
959f3c4c
JH
2?RCS:
3?RCS: Copyright (c) 1996, Cygnus Support
8696c43d 4?RCS: Copyright (c) 1991-1997, 2004-2006, 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
8696c43d 10?RCS: of the source tree for dist 4.0.
959f3c4c
JH
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):
8696c43d
MB
22?S: This variable holds the (possibly relative) path of the package source.
23?S: It is up to the Makefile to use this variable and set VPATH accordingly
24?S: to find the sources remotely. Use $pkgsrc to have an absolute path.
959f3c4c
JH
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
33case "$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;;
44esac
45case "$src" in
46'') src=/
47 rsrc=/
48 ;;
8696c43d
MB
49/*) rsrc="$src";;
50*) rsrc="../$src";;
959f3c4c
JH
51esac
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:
61if test -f $rsrc/Configure && \
8696c43d 62 $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
959f3c4c
JH
63then
64 : found it, so we are ok.
65else
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
77fi
78case "$rsrc" in
79'')
80 cat <<EOM >&4
81
82Sorry, I can't seem to locate the source dir for $package. Please start
83Configure with an explicit path -- i.e. /some/path/Configure.
84
85EOM
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 ;;
95esac
96