perl 5.0 alpha 8
[p5sagit/p5-mst-13.2.git] / U / Oldconfig.U
1 ?X:  These units are based on the ones supplied with dist-3.0
2 ?X:  patchlevel 22.  They have been changed or enhanced to work with
3 ?X:  perl5alpha.  I would appreciate hearing about any changes,
4 ?X:  corrections, or enhancements.
5 ?X:     Andy Dougherty                  doughera@lafcol.lafayette.edu
6 ?X:     Dept. of Physics                
7 ?X:     Lafayette College       
8 ?X:     Easton, PA  18042-1782
9 ?X:     Sat Apr  2 15:45:17 EST 1994
10 ?RCS: $Id: Oldconfig.U,v 3.0.1.2 1994/01/24 14:05:02 ram Exp $
11 ?RCS:
12 ?RCS: Copyright (c) 1991-1993, Raphael Manfredi
13 ?RCS: 
14 ?RCS: You may redistribute only under the terms of the Artistic Licence,
15 ?RCS: as specified in the README file that comes with the distribution.
16 ?RCS: You may reuse parts of this distribution only within the terms of
17 ?RCS: that same Artistic Licence; a copy of which may be found at the root
18 ?RCS: of the source tree for dist 3.0.
19 ?RCS:
20 ?RCS: $Log: Oldconfig.U,v $
21 ?RCS: Revision 3.0.1.2  1994/01/24  14:05:02  ram
22 ?RCS: patch16: added post-processing on myuname for Xenix targets
23 ?RCS: patch16: message proposing config.sh defaults made consistent
24 ?RCS:
25 ?RCS: Revision 3.0.1.1  1993/09/13  15:56:32  ram
26 ?RCS: patch10: force use of config.sh when -d option is used (WAD)
27 ?RCS: patch10: complain about non-existent hint files (WAD)
28 ?RCS: patch10: added Options dependency for fastread variable
29 ?RCS:
30 ?RCS: Revision 3.0  1993/08/18  12:05:12  ram
31 ?RCS: Baseline for dist 3.0 netwide release.
32 ?RCS:
33 ?X: 
34 ?X: This unit tries to remember what we did last time we ran Configure, mostly
35 ?X: for the sake of setting defaults.
36 ?X: 
37 ?MAKE:Oldconfig hint myuname: Instruct Myread uname sed test cat rm n c \
38         contains Loc Options
39 ?MAKE:  -pick wipe $@ %<
40 ?S:myuname:
41 ?S:     The output of 'uname -a' if available, otherwise the hostname. On Xenix,
42 ?S:     pseudo variables assignments in the output are stripped, thank you. The
43 ?S:     whole thing is then lower-cased.
44 ?S:.
45 ?S:hint:
46 ?S:     Gives the type of hints used for previous answers. May be one of
47 ?S:     "default", "recommended" or "previous".
48 ?S:.
49 ?T:tmp file oldmyuname tans _
50 ?LINT:change n c
51 : Try to determine whether config.sh was made on this system
52 case "$config_sh" in
53 '')
54 ?X: indentation wrong on purpose--RAM
55 ?X: Leave a white space between first two '(' for ksh. The sub-shell is needed
56 ?X: on some machines to avoid the error message when uname is not found; e.g.
57 ?X: old SUN-OS 3.2 would not execute hostname in (uname -a || hostname). Sigh!
58 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
59 ?X: Special mention for Xenix, whose 'uname -a' gives us output like this:
60 ?X:  sysname=XENIX
61 ?X:  nodename=whatever
62 ?X:  release=2.3.2 .. etc...
63 ?X: Therefore, we strip all this variable assignment junk and remove all the
64 ?X: new lines to keep the myuname variable sane... --RAM
65 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' | \
66         tr '[A-Z]' '[a-z]' | tr '\012' ' '`
67 dflt=n
68 if test "$fastread" = yes; then
69         dflt=y
70 elif test -f ../config.sh; then
71 ?X: The value from config.sh will superseed the one we've just computed
72 ?X: ... but not if we choose to ignore config.sh, so eval oldmyuname here.
73         oldmyuname=''
74         if $contains myuname= ../config.sh >/dev/null 2>&1; then
75                 eval "old`grep myuname= ../config.sh`"
76         fi
77         if test "X$myuname" = "X$oldmyuname"; then
78                 dflt=y
79         fi
80 fi
81
82 @if {test -d ../hints}
83 : Get old answers from old config file if Configure was run on the
84 : same system, otherwise use the hints.
85 hint=default
86 cd ..
87 if test -f config.sh; then
88         echo " "
89         rp="I see a config.sh file.  Shall I use it to set the defaults?"
90         . UU/myread
91         case "$ans" in
92         n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
93         *)  echo "Fetching default answers from your old config.sh file..." >&4
94                 tmp="$n"
95                 tans="$c"
96                 . ./config.sh
97                 cp config.sh UU
98                 n="$tmp"
99                 c="$tans"
100                 hint=previous
101                 ;;
102         esac
103 fi
104 if test ! -f config.sh; then
105         $cat <<EOM
106
107 First time through, eh?  I have some defaults handy for the following systems:
108
109 EOM
110         cd hints; ls -C *.sh | $sed 's/\.sh/   /g' >&4
111         dflt=''
112         : Half the following guesses are probably wrong... If you have better
113         : tests or hints, please send them to <MAINTLOC>
114         : The metaconfig authors would also appreciate a copy...
115         $test -f /irix && dflt="$dflt sgi"
116         $test -f /xenix && dflt="$dflt sco_xenix"
117         $test -f /dynix && dflt="$dflt dynix"
118         $test -f /dnix && dflt="$dflt dnix"
119         $test -f /bin/mips && /bin/mips && dflt="$dflt mips"
120         $test -d /NextApps && test -f /usr/adm/software_version && dflt="$dflt next"
121         $test -d /usr/include/minix && dflt="$dflt minix"
122 ?X: If we have uname, we already computed a suitable uname -a output, correctly
123 ?X: formatted for Xenix, and it lies in $myuname.
124         if $test -f $uname; then
125                 set X $myuname
126                 shift
127
128                 $test -f $5.sh && dflt="$dflt $5"
129
130                 case "$5" in
131                 fps*) dflt="$dflt fps";;
132                 mips*)
133                         case "$4" in
134                         umips) dflt="$dflt umips";;
135                         *) dflt="$dflt mips";;
136                         esac;;
137                 [23]100) dflt="$dflt mips";;
138                 next*) dflt="$dflt next" ;;
139                 news*) dflt="$dflt news" ;;
140                 i386*) if $test -f /etc/kconfig; then
141                                 if $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
142                                         dflt="$dflt isc_3_2_3"
143                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
144                                         dflt="$dflt isc_3_2_2"
145                             fi
146                                 : i386.sh hint is wrong for Interactive.
147                                 dflt=`echo $dflt | $sed 's/i386//'`
148                        fi
149                        ;;
150                 esac
151
152                 case "$1" in
153                 aix) dflt="$dflt aix_rs" ;;
154                 sun[Oo][Ss]) case "$3" in
155                         [34]*) vers=`echo $3 | $sed 's/\./_/g'`
156                                 dflt="$dflt sunos_$vers" ;;
157                         5*) vers=`echo $3 | $sed 's/^5/2/g'`
158                                 dflt="$dflt solaris_$vers" ;;
159                         esac
160                         ;;
161                 [sS]olaris) case "$3" in
162                         5*) vers=`echo $3 | $sed 's/^5/2/g'`
163                                 dflt="$dflt solaris_$vers" ;;
164                         esac
165                         ;;
166                 dnix) dflt="$dflt dnix" ;;
167                 dgux) dflt="$dflt dgux" ;;
168                 genix) dflt="$dflt genix" ;;
169                 hp*ux) dflt="$dflt hpux" ;;
170                 next) dflt="$dflt next" ;;
171                 irix) dflt="$dflt sgi" ;;
172                 ultrix) case "$3" in
173                         3*) dflt="$dflt ultrix_3" ;;
174                         4*) dflt="$dflt ultrix_4" ;;
175                         esac
176                         ;;
177                 uts) dflt="$dflt uts" ;;
178                 $2) case "$dflt" in
179                         *isc*) ;;
180                         *)      if test -f /etc/systemid; then
181                                 set `echo $3 | $sed 's/\./ /g'` $4
182                                         if $test -f sco_$1_$2_$3.sh; then
183                                                 dflt="$dflt sco_$1_$2_$3"
184                                         elif $test -f sco_$1_$2.sh; then
185                                                 dflt="$dflt sco_$1_$2"
186                                         elif $test -f sco_$1.sh; then
187                                                 dflt="$dflt sco_$1"
188                                         fi
189                                 fi
190                                 ;;
191                         esac
192                         ;;
193                 esac
194         else
195 ?X: Try to identify sony's NEWS-OS (BSD unix)
196                 if test -f /vmunix -a -f news_os.sh; then
197                         (what /vmunix | tr '[A-Z]' '[a-z]') > ../UU/kernel.what 2>&1
198                         if $contains news-os ../UU/kernel.what >/dev/null 2>&1; then
199                                 dflt="$dflt news_os"
200                         fi
201                         $rm -f ../UU/kernel.what
202                 fi
203         fi
204         set X `echo $dflt | tr ' ' '\012' | sort | uniq`
205         shift
206         dflt=''
207         for file in $*; do
208                 if $test -f "$file.sh"; then
209                         dflt="$dflt $file"
210                 fi
211         done
212         set X $dflt
213         shift
214         dflt=${1+"$@"}
215         case "$dflt" in
216         '') dflt=none;;
217         esac
218         $cat <<EOM
219
220 You may give one or more space-separated answers, or "none" if appropriate.
221 If your OS version has no hints, DO NOT give a wrong version -- say "none".
222
223 EOM
224         rp="Which of these apply, if any?"
225         . ../UU/myread
226         for file in $ans; do
227                 if $test -f $file.sh; then
228                         . ./$file.sh
229                         $cat $file.sh >> ../UU/config.sh
230                 elif $test X$ans = X -o X$ans = Xnone ; then
231                         : nothing
232                 else
233                         echo "$file.sh does not exist -- ignored"
234                 fi
235         done
236         hint=recommended
237         cd ..
238 fi
239 cd UU
240 @else
241 : Get old answers, if there is a config file out there
242 hint=default
243 if test -f ../config.sh; then
244         echo " "
245         rp="I see a config.sh file.  Shall I use it to set the defaults?"
246         . ./myread
247         case "$ans" in
248         n*|N*) echo "OK, I'll ignore it.";;
249         *)  echo "Fetching default answers from your old config.sh file..." >&4
250                 tmp="$n"
251                 tans="$c"
252                 . ../config.sh
253                 cp ../config.sh .
254                 n="$tmp"
255                 c="$tans"
256                 hint=previous
257                 ;;
258         esac
259 fi
260 @end
261 ?X: remember, indentation is wrong--RAM
262 ;;
263 *)
264         echo " "
265         echo "Fetching default answers from $config_sh..." >&4
266         tmp="$n"
267         tans="$c"
268         cd ..
269 ?X: preserve symbolic links, if any
270         cp $config_sh config.sh 2>/dev/null
271         . ./config.sh
272         cd UU
273         cp ../config.sh .
274         n="$tmp"
275         c="$tans"
276         hint=previous
277         ;;
278 esac
279
280 : Restore computed paths
281 for file in $loclist $trylist; do
282         eval $file="\$_$file"
283 done
284