| 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 |
| 4 | ?RCS: |
| 5 | ?RCS: You may redistribute only under the terms of the Artistic License, |
| 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 |
| 8 | ?RCS: that same Artistic License; a copy of which may be found at the root |
| 9 | ?RCS: of the source tree for dist 4.0. |
| 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: |
| 24 | ?X: |
| 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). |
| 29 | ?X: |
| 30 | ?MAKE:Config_sh: cf_time cf_by test spitshell startsh myuname Myread \ |
| 31 | End Obsol_sh Loc +d_portable package src cat |
| 32 | ?MAKE: -pick add.Config_sh $@ %< |
| 33 | ?MAKE: -pick add $@ ./Obsol_sh |
| 34 | ?MAKE: -pick close.Config_sh $@ %< |
| 35 | ?F:!config.over !config.arch |
| 36 | ?T:file temp |
| 37 | ?LINT:unclosed EOT |
| 38 | : back to where it started |
| 39 | if test -d ../UU; then |
| 40 | cd .. |
| 41 | fi |
| 42 | |
| 43 | : configuration may be unconditionally patched via a 'config.arch' file |
| 44 | if $test -f config.arch; then |
| 45 | echo "I see a config.arch file, loading it." >&4 |
| 46 | . ./config.arch |
| 47 | fi |
| 48 | |
| 49 | : configuration may be patched via a 'config.over' file |
| 50 | if $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 |
| 61 | fi |
| 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: |
| 70 | case "$d_portable" in |
| 71 | "$define") |
| 72 | echo " " |
| 73 | echo "Stripping down executable paths..." >&4 |
| 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 |
| 82 | ?X: Since this preserves the actual command name, we can now drop the |
| 83 | ?X: OS/2 specific code. |
| 84 | ?X: --Andy Dougherty August 1999 |
| 85 | ?X: |
| 86 | ?X: On OS/2, a special $ar command not even named 'ar' is required, |
| 87 | ?X: so we don't strip that name. |
| 88 | ?X: Also, on DOS-ish systems, there might not be a ln command, but we |
| 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 |
| 94 | ?X: |
| 95 | for file in $loclist $trylist; do |
| 96 | eval temp=\$$file |
| 97 | eval $file=`basename $temp` |
| 98 | done |
| 99 | ;; |
| 100 | esac |
| 101 | |
| 102 | @end |
| 103 | : create config.sh file |
| 104 | echo " " |
| 105 | echo "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 | |
| 121 | EOT |
| 122 | ?X: Command line options are saved by the Options.U unit in the |
| 123 | ?X: temporary file UU/cmdline.opt |
| 124 | : Add in command line options if available |
| 125 | $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh |
| 126 | |
| 127 | $spitshell <<EOT >>config.sh |
| 128 | |