This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
evat => eval as found by Tom Hukins
[metaconfig.git] / U / modified / Config_sh.U
CommitLineData
9b04e79a
MB
1?RCS: $Id: Config_sh.U 1 2006-08-24 12:32:52Z rmanfredi $
2?RCS:
3?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
959f3c4c 4?RCS:
65a32477 5?RCS: You may redistribute only under the terms of the Artistic License,
959f3c4c
JH
6?RCS: as specified in the README file that comes with the distribution.
7?RCS: You may reuse parts of this distribution only within the terms of
65a32477 8?RCS: that same Artistic License; a copy of which may be found at the root
9b04e79a 9?RCS: of the source tree for dist 4.0.
959f3c4c
JH
10?RCS:
11?RCS: $Log: Config_sh.U,v $
12?RCS: Revision 3.0.1.3 1997/02/28 14:57:53 ram
13?RCS: patch61: added support for src.U
14?RCS:
15?RCS: Revision 3.0.1.2 1995/01/11 14:53:31 ram
16?RCS: patch45: moved path stripping from d_portable.U to end of Configure
17?RCS:
18?RCS: Revision 3.0.1.1 1994/10/29 15:50:37 ram
19?RCS: patch36: added ?F: line for metalint file checking
20?RCS:
21?RCS: Revision 3.0 1993/08/18 12:04:48 ram
22?RCS: Baseline for dist 3.0 netwide release.
23?RCS:
9b04e79a 24?X:
959f3c4c
JH
25?X: This unit ends up producing the config.sh script, which contains all the
26?X: definitions figured out by Configure. The add.Config_sh command knows
27?X: which variables need to be remembered. It also adds the EOT (ends the
28?X: here document redirection with variable substitution).
9b04e79a 29?X:
959f3c4c 30?MAKE:Config_sh: cf_time cf_by test spitshell startsh myuname Myread \
9b04e79a 31 End Obsol_sh Loc +d_portable package src cat
959f3c4c
JH
32?MAKE: -pick add.Config_sh $@ %<
33?MAKE: -pick add $@ ./Obsol_sh
34?MAKE: -pick close.Config_sh $@ %<
9b04e79a 35?F:!config.over !config.arch
61bda305 36?T:file temp
9b04e79a 37?LINT:unclosed EOT
959f3c4c
JH
38: back to where it started
39if test -d ../UU; then
40 cd ..
41fi
42
9b04e79a 43: configuration may be unconditionally patched via a 'config.arch' file
931642c3 44if $test -f config.arch; then
9b04e79a 45 echo "I see a config.arch file, loading it." >&4
931642c3
JH
46 . ./config.arch
47fi
48
959f3c4c
JH
49: configuration may be patched via a 'config.over' file
50if $test -f config.over; then
51 echo " "
52 dflt=y
53 rp='I see a config.over file. Do you wish to load it?'
54 . UU/myread
55 case "$ans" in
56 n*) echo "OK, I'll ignore it.";;
57 *) . ./config.over
58 echo "Configuration override changes have been loaded."
59 ;;
60 esac
61fi
62
63@if d_portable
64: in case they want portability, strip down executable paths
65?X:
66?X: Strip down paths in located executables. For each file, e.g. vi, there
67?X: is a $vi variable whose value is for instance '/usr/bin/vi'. By resetting
68?X: $vi to 'vi', we rely on the PATH variable to locate the executable...
69?X:
70case "$d_portable" in
71"$define")
72 echo " "
73 echo "Stripping down executable paths..." >&4
61bda305
JH
74?X:
75?X: Previously, we used to do eval $file="\$file" but in order
76?X: to handle things like sh Configure -Dmake=gmake, we can't do
77?X: that. What we *really* want is to strip away the absolute path
78?X: and rely on the end user's $PATH to correctly find the executable.
79?X: This method assumes there is a "basename" command available. If
80?X: not, replace it with the following expr-based command:
81?X: expr $temp : '.*/\(.*\)' \| $temp
9b04e79a 82?X: Since this preserves the actual command name, we can now drop the
61bda305
JH
83?X: OS/2 specific code.
84?X: --Andy Dougherty August 1999
85?X:
959f3c4c
JH
86?X: On OS/2, a special $ar command not even named 'ar' is required,
87?X: so we don't strip that name.
65a32477 88?X: Also, on DOS-ish systems, there might not be a ln command, but we
959f3c4c
JH
89?X: might have ln='cp'.
90?X: However, we can't set d_portable=undef on such systems since
91?X: Unix-ish tools don't have standard locations there. Thus we
92?X: MUST rely on the user's $PATH.
93?X: --Andy Dougherty 4/1998
61bda305 94?X:
959f3c4c 95 for file in $loclist $trylist; do
61bda305
JH
96 eval temp=\$$file
97 eval $file=`basename $temp`
959f3c4c
JH
98 done
99 ;;
100esac
101
102@end
103: create config.sh file
104echo " "
105echo "Creating config.sh..." >&4
106$spitshell <<EOT >config.sh
107$startsh
108#
109# This file was produced by running the Configure script. It holds all the
110# definitions figured out by Configure. Should you modify one of these values,
111# do not forget to propagate your changes by running "Configure -der". You may
112# instead choose to run each of the .SH files by yourself, or "Configure -S".
113#
114
115# Package name : $package
116# Source directory : $src
117# Configuration time: $cf_time
118# Configured by : $cf_by
119# Target system : $myuname
120
9b04e79a
MB
121EOT
122?X: Command line options are saved by the Options.U unit in the
123?X: temporary file UU/cmdline.opt
b6206bf1 124: Add in command line options if available
9b04e79a 125$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
b6206bf1 126
9b04e79a
MB
127$spitshell <<EOT >>config.sh
128