Commit | Line | Data |
---|---|---|
959f3c4c JH |
1 | #! /bin/sh |
2 | # | |
3 | # If these # comments don't work, trim them. Don't worry about any other | |
4 | # shell scripts, Configure will trim # comments from them for you. | |
5 | # | |
6 | # (If you are trying to port this package to a machine without sh, | |
7 | # I would suggest you have a look at the prototypical config_h.SH file | |
8 | # and edit it to reflect your system. Some packages may include samples | |
9 | # of config.h for certain machines, so you might look for one of those.) | |
10 | # | |
11 | # Yes, you may rip this off to use in other distribution packages. This | |
12 | # script belongs to the public domain and cannot be copyrighted. | |
13 | # | |
14 | # (Note: this Configure script was generated automatically. Rather than | |
15 | # working with this copy of Configure, you may wish to get metaconfig. | |
16 | # The dist-3.0 package (which contains metaconfig) was posted in | |
17 | # comp.sources.misc and is available on CPAN under authors/id/RAM so | |
18 | # you may fetch it yourself from your nearest archive site.) | |
19 | # | |
20 | ||
21 | # $Id: Configure,v 3.0.1.11 1997/02/28 14:52:55 ram Exp $ | |
22 | # | |
23 | # Generated on Fri Feb 28 15:36:04 MET 1997 [metaconfig 3.0 PL60] | |
24 | ||
25 | cat >/tmp/c1$$ <<EOF | |
26 | ARGGGHHHH!!!!! | |
27 | ||
28 | SCO csh still thinks true is false. Write to SCO today and tell them that next | |
29 | year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-) | |
30 | ||
31 | (Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All | |
32 | we'd have to do is go in and swap the && and || tokens, wherever they are.) | |
33 | ||
34 | [End of diatribe. We now return you to your regularly scheduled programming...] | |
35 | EOF | |
36 | cat >/tmp/c2$$ <<EOF | |
37 | ||
38 | OOPS! You naughty creature! You didn't run Configure with sh! | |
39 | I will attempt to remedy the situation by running sh for you... | |
40 | EOF | |
41 | ||
42 | true || cat /tmp/c1$$ /tmp/c2$$ | |
43 | true || exec sh $0 $argv:q | |
44 | ||
45 | (exit $?0) || cat /tmp/c2$$ | |
46 | (exit $?0) || exec sh $0 $argv:q | |
47 | rm -f /tmp/c1$$ /tmp/c2$$ | |
48 | ||
49 | : compute my invocation name | |
50 | me=$0 | |
51 | case "$0" in | |
52 | */*) | |
53 | me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null` | |
54 | test "$me" || me=$0 | |
55 | ;; | |
56 | esac | |
57 | ||
58 | : Proper PATH separator | |
59 | p_=: | |
60 | : On OS/2 this directory should exist if this is not floppy only system :-] | |
61 | if test -d c:/.; then | |
62 | p_=\; | |
63 | PATH=`cmd /c "echo %PATH%" | tr '\\\\' / ` | |
64 | OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'` | |
65 | fi | |
66 | ||
67 | : Proper PATH setting | |
68 | paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin' | |
69 | paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin" | |
70 | paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin" | |
71 | paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin" | |
72 | paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb" | |
73 | paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin" | |
74 | paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib" | |
75 | paths="$paths /sbin /usr/sbin /usr/libexec" | |
76 | ||
77 | for p in $paths | |
78 | do | |
79 | case "$p_$PATH$p_" in | |
80 | *$p_$p$p_*) ;; | |
81 | *) test -d $p && PATH=$PATH$p_$p ;; | |
82 | esac | |
83 | done | |
84 | ||
85 | PATH=.$p_$PATH | |
86 | export PATH | |
87 | ||
88 | : shall we be using ksh? | |
89 | inksh='' | |
90 | needksh='' | |
91 | avoidksh='' | |
92 | newsh=/bin/ksh | |
93 | changesh='' | |
94 | if (PATH=.; alias -x) >/dev/null 2>&1; then | |
95 | inksh=true | |
96 | fi | |
97 | if test -f /hp-ux -a -f /bin/ksh; then | |
98 | needksh='to avoid sh bug in "here document" expansion' | |
99 | fi | |
100 | if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then | |
101 | if test X`/usr/bin/uname -v` = X4; then | |
102 | avoidksh="to avoid AIX 4's /bin/sh" | |
103 | newsh=/usr/bin/bsh | |
104 | fi | |
105 | fi | |
106 | case "$inksh/$needksh" in | |
107 | /[a-z]*) | |
108 | unset ENV | |
109 | changesh=true | |
110 | reason="$needksh" | |
111 | ;; | |
112 | esac | |
113 | case "$inksh/$avoidksh" in | |
114 | true/[a-z]*) | |
115 | changesh=true | |
116 | reason="$avoidksh" | |
117 | ;; | |
118 | esac | |
119 | case "$inksh/$needksh-$avoidksh-" in | |
120 | true/--) | |
121 | cat <<EOM | |
122 | (I see you are using the Korn shell. Some ksh's blow up on $me, | |
123 | mainly on older exotic systems. If yours does, try the Bourne shell instead.) | |
124 | EOM | |
125 | ;; | |
126 | esac | |
127 | case "$changesh" in | |
128 | true) | |
129 | echo "(Feeding myself to $newsh $reason.)" | |
130 | case "$0" in | |
131 | Configure|*/Configure) exec $newsh $0 "$@";; | |
132 | *) exec $newsh Configure "$@";; | |
133 | esac | |
134 | ;; | |
135 | esac | |
136 | ||
137 | : Configure runs within the UU subdirectory | |
138 | test -d UU || mkdir UU | |
139 | unset CDPATH | |
140 | cd UU && rm -f ./* | |
141 | ||
142 | d_bsd='' | |
143 | d_eunice='' | |
144 | d_xenix='' | |
145 | eunicefix='' | |
146 | Mcc='' | |
147 | ar='' | |
148 | awk='' | |
149 | bash='' | |
150 | bison='' | |
151 | byacc='' | |
152 | cat='' | |
153 | chgrp='' | |
154 | chmod='' | |
155 | chown='' | |
156 | comm='' | |
157 | compress='' | |
158 | cp='' | |
159 | cpio='' | |
160 | cpp='' | |
161 | csh='' | |
162 | date='' | |
163 | echo='' | |
164 | egrep='' | |
165 | emacs='' | |
166 | expr='' | |
167 | find='' | |
168 | flex='' | |
169 | gcc='' | |
170 | grep='' | |
171 | gzip='' | |
172 | inews='' | |
173 | ksh='' | |
174 | less='' | |
175 | line='' | |
176 | lint='' | |
177 | ln='' | |
178 | lp='' | |
179 | lpr='' | |
180 | ls='' | |
181 | mail='' | |
182 | mailx='' | |
183 | make='' | |
184 | mkdir='' | |
185 | more='' | |
186 | mv='' | |
187 | nroff='' | |
188 | perl='' | |
189 | pg='' | |
190 | pmake='' | |
191 | pr='' | |
192 | rm='' | |
193 | rmail='' | |
194 | sed='' | |
195 | sendmail='' | |
196 | shar='' | |
197 | sleep='' | |
198 | smail='' | |
199 | sort='' | |
200 | submit='' | |
201 | tail='' | |
202 | tar='' | |
203 | tbl='' | |
204 | test='' | |
205 | touch='' | |
206 | tr='' | |
207 | troff='' | |
208 | uname='' | |
209 | uniq='' | |
210 | uuname='' | |
211 | vi='' | |
212 | zcat='' | |
213 | zip='' | |
214 | mailpatches='' | |
215 | notifypatches='' | |
216 | usermail='' | |
217 | hint='' | |
218 | myuname='' | |
219 | osname='' | |
220 | osvers='' | |
221 | Author='' | |
222 | Date='' | |
223 | Header='' | |
224 | Id='' | |
225 | Locker='' | |
226 | Log='' | |
227 | RCSfile='' | |
228 | Revision='' | |
229 | Source='' | |
230 | State='' | |
231 | archobjs='' | |
232 | firstmakefile='' | |
233 | afs='' | |
234 | baserev='' | |
235 | cf_email='' | |
236 | cf_by='' | |
237 | cf_time='' | |
238 | contains='' | |
239 | cpplast='' | |
240 | cppminus='' | |
241 | cpprun='' | |
242 | cppstdin='' | |
243 | d_portable='' | |
244 | defeditor='' | |
245 | install='' | |
246 | installdir='' | |
247 | lns='' | |
248 | mailer='' | |
249 | make_set_make='' | |
250 | installmansrc='' | |
251 | manext='' | |
252 | mansrc='' | |
253 | mansrcexp='' | |
254 | mkdep='' | |
255 | mydomain='' | |
256 | myhostname='' | |
257 | phostname='' | |
258 | c='' | |
259 | n='' | |
260 | d_berknames='' | |
261 | d_passnames='' | |
262 | d_usgnames='' | |
263 | nametype='' | |
264 | groupcat='' | |
265 | hostcat='' | |
266 | passcat='' | |
267 | orgname='' | |
268 | package='' | |
269 | spackage='' | |
270 | pager='' | |
271 | patchlevel='' | |
272 | perlpath='' | |
273 | prefix='' | |
274 | prefixexp='' | |
275 | installprivlib='' | |
276 | privlib='' | |
277 | privlibexp='' | |
278 | installscript='' | |
279 | scriptdir='' | |
280 | scriptdirexp='' | |
281 | sh='' | |
282 | sharpbang='' | |
283 | shsharp='' | |
284 | spitshell='' | |
285 | src='' | |
286 | startperl='' | |
287 | startsh='' | |
288 | sysman='' | |
289 | CONFIG='' | |
290 | ||
291 | define='define' | |
292 | undef='undef' | |
293 | smallmach='pdp11 i8086 z8000 i80286 iAPX286' | |
294 | rmlist='' | |
295 | ||
296 | : We must find out about Eunice early | |
297 | eunicefix=':' | |
298 | if test -f /etc/unixtovms; then | |
299 | eunicefix=/etc/unixtovms | |
300 | fi | |
301 | if test -f /etc/unixtovms.exe; then | |
302 | eunicefix=/etc/unixtovms.exe | |
303 | fi | |
304 | ||
305 | : No trailing extension on UNIX executables | |
306 | _exe='' | |
307 | : Extra object files, if any, needed on this platform. | |
308 | archobjs='' | |
309 | bin='/usr/local/bin' | |
310 | cc='cc' | |
311 | cppflags='' | |
312 | usrinc='/usr/include' | |
313 | ||
314 | : Find the basic shell for Bourne shell scripts | |
315 | case "$sh" in | |
316 | '') | |
317 | case "$SYSTYPE" in | |
318 | *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";; | |
319 | *) xxx='/bin/sh';; | |
320 | esac | |
321 | if test -f "$xxx"; then | |
322 | sh="$xxx" | |
323 | else | |
324 | : Build up a list and do a single loop so we can 'break' out. | |
325 | pth=`echo $PATH | sed -e "s/$p_/ /g"` | |
326 | for xxx in sh bash ksh pdksh ash; do | |
327 | for p in $pth; do | |
328 | try="$try ${p}/${xxx}" | |
329 | done | |
330 | done | |
331 | for xxx in $try; do | |
332 | if test -f "$xxx"; then | |
333 | sh="$xxx"; | |
334 | break | |
335 | elif test -f "$xxx.exe"; then | |
336 | sh="$xxx"; | |
337 | break | |
338 | fi | |
339 | done | |
340 | fi | |
341 | ;; | |
342 | esac | |
343 | ||
344 | case "$sh" in | |
345 | '') cat <<EOM >&2 | |
346 | $me: Fatal Error: I can't find a Bourne Shell anywhere. | |
347 | ||
348 | Usually it's in /bin/sh. How did you even get this far? | |
349 | Please contact me (Raphael Manfredi) at Raphael_Manfredi@grenoble.hp.com and | |
350 | we'll try to straighten this all out. | |
351 | EOM | |
352 | exit 1 | |
353 | ;; | |
354 | esac | |
355 | ||
356 | : see if sh knows # comments | |
357 | if `$sh -c '#' >/dev/null 2>&1`; then | |
358 | shsharp=true | |
359 | spitshell=cat | |
360 | xcat=/bin/cat | |
361 | test -f $xcat || xcat=/usr/bin/cat | |
362 | echo "#!$xcat" >try | |
363 | $eunicefix try | |
364 | chmod +x try | |
365 | ./try > today | |
366 | if test -s today; then | |
367 | sharpbang='#!' | |
368 | else | |
369 | echo "#! $xcat" > try | |
370 | $eunicefix try | |
371 | chmod +x try | |
372 | ./try > today | |
373 | if test -s today; then | |
374 | sharpbang='#! ' | |
375 | else | |
376 | sharpbang=': use ' | |
377 | fi | |
378 | fi | |
379 | else | |
380 | echo " " | |
381 | echo "Your $sh doesn't grok # comments--I will strip them later on." | |
382 | shsharp=false | |
383 | cd .. | |
384 | echo "exec grep -v '^[ ]*#'" >spitshell | |
385 | chmod +x spitshell | |
386 | $eunicefix spitshell | |
387 | spitshell=`pwd`/spitshell | |
388 | cd UU | |
389 | echo "I presume that if # doesn't work, #! won't work either!" | |
390 | sharpbang=': use ' | |
391 | fi | |
392 | rm -f try today | |
393 | ||
394 | : figure out how to guarantee sh startup | |
395 | case "$startsh" in | |
396 | '') startsh=${sharpbang}${sh} ;; | |
397 | *) | |
398 | esac | |
399 | cat >try <<EOSS | |
400 | $startsh | |
401 | set abc | |
402 | test "$?abc" != 1 | |
403 | EOSS | |
404 | ||
405 | chmod +x try | |
406 | $eunicefix try | |
407 | if ./try; then | |
408 | : echo "Yup, it does." | |
409 | else | |
410 | echo "Hmm... '$startsh' does not guarantee sh startup..." | |
411 | echo "You may have to fix up the shell scripts to make sure $sh runs them." | |
412 | fi | |
413 | rm -f try | |
414 | ||
415 | : produce awk script to parse command line options | |
416 | cat >options.awk <<'EOF' | |
417 | BEGIN { | |
418 | optstr = "dD:eEf:hKOrsSU:V"; # getopt-style specification | |
419 | ||
420 | len = length(optstr); | |
421 | for (i = 1; i <= len; i++) { | |
422 | c = substr(optstr, i, 1); | |
423 | if (i < len) a = substr(optstr, i + 1, 1); else a = ""; | |
424 | if (a == ":") { | |
425 | arg[c] = 1; | |
426 | i++; | |
427 | } | |
428 | opt[c] = 1; | |
429 | } | |
430 | } | |
431 | { | |
432 | expect = 0; | |
433 | str = $0; | |
434 | if (substr(str, 1, 1) != "-") { | |
435 | printf("'%s'\n", str); | |
436 | next; | |
437 | } | |
438 | len = length($0); | |
439 | for (i = 2; i <= len; i++) { | |
440 | c = substr(str, i, 1); | |
441 | if (!opt[c]) { | |
442 | printf("-%s\n", substr(str, i)); | |
443 | next; | |
444 | } | |
445 | printf("-%s\n", c); | |
446 | if (arg[c]) { | |
447 | if (i < len) | |
448 | printf("'%s'\n", substr(str, i + 1)); | |
449 | else | |
450 | expect = 1; | |
451 | next; | |
452 | } | |
453 | } | |
454 | } | |
455 | END { | |
456 | if (expect) | |
457 | print "?"; | |
458 | } | |
459 | EOF | |
460 | ||
461 | : process the command line options | |
462 | set X `for arg in "$@"; do echo "X$arg"; done | | |
463 | sed -e s/X// | awk -f options.awk` | |
464 | eval "set $*" | |
465 | shift | |
466 | rm -f options.awk | |
467 | ||
468 | : set up default values | |
469 | fastread='' | |
470 | reuseval=false | |
471 | config_sh='' | |
472 | alldone='' | |
473 | error='' | |
474 | silent='' | |
475 | extractsh='' | |
476 | override='' | |
477 | knowitall='' | |
478 | rm -f optdef.sh | |
479 | cat >optdef.sh <<EOS | |
480 | $startsh | |
481 | EOS | |
482 | ||
483 | ||
484 | : option parsing | |
485 | while test $# -gt 0; do | |
486 | case "$1" in | |
487 | -d) shift; fastread=yes;; | |
488 | -e) shift; alldone=cont;; | |
489 | -f) | |
490 | shift | |
491 | cd .. | |
492 | if test -r "$1"; then | |
493 | config_sh="$1" | |
494 | else | |
495 | echo "$me: cannot read config file $1." >&2 | |
496 | error=true | |
497 | fi | |
498 | cd UU | |
499 | shift;; | |
500 | -h) shift; error=true;; | |
501 | -r) shift; reuseval=true;; | |
502 | -s) shift; silent=true; realsilent=true;; | |
503 | -E) shift; alldone=exit;; | |
504 | -K) shift; knowitall=true;; | |
505 | -O) shift; override=true;; | |
506 | -S) shift; silent=true; extractsh=true;; | |
507 | -D) | |
508 | shift | |
509 | case "$1" in | |
510 | *=) | |
511 | echo "$me: use '-U symbol=', not '-D symbol='." >&2 | |
512 | echo "$me: ignoring -D $1" >&2 | |
513 | ;; | |
514 | *=*) echo "$1" | \ | |
515 | sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;; | |
516 | *) echo "$1='define'" >> optdef.sh;; | |
517 | esac | |
518 | shift | |
519 | ;; | |
520 | -U) | |
521 | shift | |
522 | case "$1" in | |
523 | *=) echo "$1" >> optdef.sh;; | |
524 | *=*) | |
525 | echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2 | |
526 | echo "$me: ignoring -U $1" >&2 | |
527 | ;; | |
528 | *) echo "$1='undef'" >> optdef.sh;; | |
529 | esac | |
530 | shift | |
531 | ;; | |
532 | -V) echo "$me generated by metaconfig 3.0 PL60." >&2 | |
533 | exit 0;; | |
534 | --) break;; | |
535 | -*) echo "$me: unknown option $1" >&2; shift; error=true;; | |
536 | *) break;; | |
537 | esac | |
538 | done | |
539 | ||
540 | case "$error" in | |
541 | true) | |
542 | cat >&2 <<EOM | |
543 | Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value] | |
544 | [-U symbol] [-U symbol=] | |
545 | -d : use defaults for all answers. | |
546 | -e : go on without questioning past the production of config.sh. | |
547 | -f : specify an alternate default configuration file. | |
548 | -h : print this help message and exit (with an error status). | |
549 | -r : reuse C symbols value if possible (skips costly nm extraction). | |
550 | -s : silent mode, only echoes questions and essential information. | |
551 | -D : define symbol to have some value: | |
552 | -D symbol symbol gets the value 'define' | |
553 | -D symbol=value symbol gets the value 'value' | |
554 | -E : stop at the end of questions, after having produced config.sh. | |
555 | -K : do not use unless you know what you are doing. | |
556 | -O : let -D and -U override definitions from loaded configuration file. | |
557 | -S : perform variable substitutions on all .SH files (can mix with -f) | |
558 | -U : undefine symbol: | |
559 | -U symbol symbol gets the value 'undef' | |
560 | -U symbol= symbol gets completely empty | |
561 | -V : print version number and exit (with a zero status). | |
562 | EOM | |
563 | exit 1 | |
564 | ;; | |
565 | esac | |
566 | ||
567 | : Sanity checks | |
568 | case "$fastread$alldone" in | |
569 | yescont|yesexit) ;; | |
570 | *) | |
571 | if test ! -t 0; then | |
572 | echo "Say 'sh Configure', not 'sh <Configure'" | |
573 | exit 1 | |
574 | fi | |
575 | ;; | |
576 | esac | |
577 | ||
578 | exec 4>&1 | |
579 | case "$silent" in | |
580 | true) exec 1>/dev/null;; | |
581 | esac | |
582 | ||
583 | : run the defines and the undefines, if any, but leave the file out there... | |
584 | touch optdef.sh | |
585 | . ./optdef.sh | |
586 | ||
587 | : set package name | |
588 | package=dist | |
589 | first=`echo $package | sed -e 's/^\(.\).*/\1/'` | |
590 | last=`echo $package | sed -e 's/^.\(.*\)/\1/'` | |
591 | case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in | |
592 | ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;; | |
593 | *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;; | |
594 | esac | |
595 | ||
596 | : Some greps do not return status, grrr. | |
597 | echo "grimblepritz" >grimble | |
598 | if grep blurfldyick grimble >/dev/null 2>&1 ; then | |
599 | contains=contains | |
600 | elif grep grimblepritz grimble >/dev/null 2>&1 ; then | |
601 | contains=grep | |
602 | else | |
603 | contains=contains | |
604 | fi | |
605 | rm -f grimble | |
606 | : the following should work in any shell | |
607 | case "$contains" in | |
608 | contains*) | |
609 | echo " " | |
610 | echo "AGH! Grep doesn't return a status. Attempting remedial action." | |
611 | cat >contains <<'EOSS' | |
612 | grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp | |
613 | EOSS | |
614 | chmod +x contains | |
615 | esac | |
616 | ||
617 | : first determine how to suppress newline on echo command | |
618 | echo " " | |
619 | echo "Checking echo to see how to suppress newlines..." | |
620 | (echo "hi there\c" ; echo " ") >.echotmp | |
621 | if $contains c .echotmp >/dev/null 2>&1 ; then | |
622 | echo "...using -n." | |
623 | n='-n' | |
624 | c='' | |
625 | else | |
626 | cat <<'EOM' | |
627 | ...using \c | |
628 | EOM | |
629 | n='' | |
630 | c='\c' | |
631 | fi | |
632 | echo $n "The star should be here-->$c" | |
633 | echo '*' | |
634 | rm -f .echotmp | |
635 | ||
636 | : compute the number of columns on the terminal for proper question formatting | |
637 | case "$COLUMNS" in | |
638 | '') COLUMNS='80';; | |
639 | esac | |
640 | ||
641 | : set up the echo used in my read | |
642 | myecho="case \"\$xxxm\" in | |
643 | '') echo $n \"\$rp $c\" >&4;; | |
644 | *) case \"\$rp\" in | |
645 | '') echo $n \"[\$xxxm] $c\";; | |
646 | *) | |
647 | if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then | |
648 | echo \"\$rp\" >&4 | |
649 | echo $n \"[\$xxxm] $c\" >&4 | |
650 | else | |
651 | echo $n \"\$rp [\$xxxm] $c\" >&4 | |
652 | fi | |
653 | ;; | |
654 | esac;; | |
655 | esac" | |
656 | ||
657 | : now set up to do reads with possible shell escape and default assignment | |
658 | cat <<EOSC >myread | |
659 | $startsh | |
660 | xxxm=\$dflt | |
661 | $myecho | |
662 | ans='!' | |
663 | case "\$fastread" in | |
664 | yes) case "\$dflt" in | |
665 | '') ;; | |
666 | *) ans=''; | |
667 | case "\$silent-\$rp" in | |
668 | true-) ;; | |
669 | *) echo " " >&4;; | |
670 | esac;; | |
671 | esac;; | |
672 | *) case "\$silent" in | |
673 | true) case "\$rp" in | |
674 | '') ans='';; | |
675 | esac;; | |
676 | esac;; | |
677 | esac | |
678 | while expr "X\$ans" : "X!" >/dev/null; do | |
679 | read answ | |
680 | set x \$xxxm | |
681 | shift | |
682 | aok=''; eval "ans=\\"\$answ\\"" && aok=y | |
683 | case "\$answ" in | |
684 | "!") | |
685 | sh 1>&4 | |
686 | echo " " | |
687 | $myecho | |
688 | ;; | |
689 | !*) | |
690 | set x \`expr "X\$ans" : "X!\(.*\)\$"\` | |
691 | shift | |
692 | sh 1>&4 -c "\$*" | |
693 | echo " " | |
694 | $myecho | |
695 | ;; | |
696 | "\$ans") | |
697 | case "\$ans" in | |
698 | \\&*) | |
699 | set x \`expr "X\$ans" : "X&\(.*\)\$"\` | |
700 | shift | |
701 | case "\$1" in | |
702 | -d) | |
703 | fastread=yes | |
704 | echo "(OK, I'll run with -d after this question.)" >&4 | |
705 | ;; | |
706 | -*) | |
707 | echo "*** Sorry, \$1 not supported yet." >&4 | |
708 | ;; | |
709 | esac | |
710 | $myecho | |
711 | ans=! | |
712 | ;; | |
713 | esac;; | |
714 | *) | |
715 | case "\$aok" in | |
716 | y) | |
717 | echo "*** Substitution done -- please confirm." | |
718 | xxxm="\$ans" | |
719 | ans=\`echo $n "\$ans$c" | tr '\012' ' '\` | |
720 | xxxm="\$ans" | |
721 | ans=! | |
722 | ;; | |
723 | *) | |
724 | echo "*** Error -- try again." | |
725 | ans=! | |
726 | ;; | |
727 | esac | |
728 | $myecho | |
729 | ;; | |
730 | esac | |
731 | case "\$ans\$xxxm\$nostick" in | |
732 | '') | |
733 | ans=! | |
734 | $myecho | |
735 | ;; | |
736 | esac | |
737 | done | |
738 | case "\$ans" in | |
739 | '') ans="\$xxxm";; | |
740 | esac | |
741 | EOSC | |
742 | ||
743 | : Find the path to the source tree | |
744 | case "$src" in | |
745 | '') src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`;; | |
746 | esac | |
747 | case "$src" in | |
748 | '') | |
749 | src=. | |
750 | rsrc=.. | |
751 | ;; | |
752 | /*) rsrc="$src/..";; | |
753 | *) rsrc="../$src";; | |
754 | esac | |
755 | if test -f $rsrc/Configure && \ | |
756 | $contains "^package=$package" $rsrc/Configure >/dev/null 2>&1 | |
757 | then | |
758 | : found it, so we are ok. | |
759 | else | |
760 | rsrc='' | |
761 | for src in . .. ../.. ../../.. ../../../..; do | |
762 | if test -f ../$src/Configure && \ | |
763 | $contains "^package=$package" ../$src/Configure >/dev/null 2>&1 | |
764 | then | |
765 | rsrc=../$src | |
766 | break | |
767 | fi | |
768 | done | |
769 | fi | |
770 | case "$rsrc" in | |
771 | '') | |
772 | echo " " | |
773 | dflt= | |
774 | rp="Directory where sources for $package are located?" | |
775 | . ./myread | |
776 | src="$ans" | |
777 | rsrc="$src" | |
778 | if test -f $rsrc/Configure && \ | |
779 | $contains "^package=$package" $rsrc/Configure >/dev/null 2>&1 | |
780 | then | |
781 | echo "Ok, I've found them under $src" | |
782 | else | |
783 | echo "Sorry, I can't seem to be able to locate $package sources." >&4 | |
784 | exit 1 | |
785 | fi | |
786 | ;; | |
787 | ../.) ;; | |
788 | *) | |
789 | echo " " | |
790 | echo "Sources for $package found in $src" >&4 | |
791 | ;; | |
792 | esac | |
793 | ||
794 | : script used to extract .SH files with variable substitutions | |
795 | cat >extract <<'EOS' | |
796 | CONFIG=true | |
797 | echo "Doing variable substitutions on .SH files..." | |
798 | if test -f $src/MANIFEST; then | |
799 | set x `awk '{print $1}' <$src/MANIFEST | grep '\.SH'` | |
800 | else | |
801 | echo "(Looking for .SH files under the source directory.)" | |
802 | set x `(cd $src; find . -name "*.SH" -print)` | |
803 | fi | |
804 | shift | |
805 | case $# in | |
806 | 0) set x `(cd $src; echo *.SH)`; shift;; | |
807 | esac | |
808 | if test ! -f $src/$1; then | |
809 | shift | |
810 | fi | |
811 | mkdir_p=' | |
812 | name=$1; | |
813 | create=""; | |
814 | while test $name; do | |
815 | if test ! -d "$name"; then | |
816 | create="$name $create"; | |
817 | name=`echo $name | sed -e "s|^[^/]*$||"`; | |
818 | name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`; | |
819 | else | |
820 | name=""; | |
821 | fi; | |
822 | done; | |
823 | for file in $create; do | |
824 | mkdir $file; | |
825 | done | |
826 | ' | |
827 | for file in $*; do | |
828 | case "$src" in | |
829 | ".") | |
830 | case "$file" in | |
831 | */*) | |
832 | dir=`expr X$file : 'X\(.*\)/'` | |
833 | file=`expr X$file : 'X.*/\(.*\)'` | |
834 | (cd $dir && . ./$file) | |
835 | ;; | |
836 | *) | |
837 | . ./$file | |
838 | ;; | |
839 | esac | |
840 | ;; | |
841 | *) | |
842 | case "$file" in | |
843 | */*) | |
844 | dir=`expr X$file : 'X\(.*\)/'` | |
845 | file=`expr X$file : 'X.*/\(.*\)'` | |
846 | (set x $dir; shift; eval $mkdir_p) | |
847 | sh <$src/$dir/$file | |
848 | ;; | |
849 | *) | |
850 | sh <$src/$file | |
851 | ;; | |
852 | esac | |
853 | ;; | |
854 | esac | |
855 | done | |
856 | if test -f $src/config_h.SH; then | |
857 | if test ! -f config.h; then | |
858 | : oops, they left it out of MANIFEST, probably, so do it anyway. | |
859 | . $src/config_h.SH | |
860 | fi | |
861 | fi | |
862 | EOS | |
863 | ||
864 | : extract files and exit if asked to do so | |
865 | case "$extractsh" in | |
866 | true) | |
867 | case "$realsilent" in | |
868 | true) ;; | |
869 | *) exec 1>&4;; | |
870 | esac | |
871 | case "$config_sh" in | |
872 | '') config_sh='config.sh'; config="$rsrc/config.sh";; | |
873 | /*) config="$config_sh";; | |
874 | *) config="$rsrc/$config_sh";; | |
875 | esac | |
876 | echo " " | |
877 | echo "Fetching answers from $config_sh..." | |
878 | . $config | |
879 | test "$override" && . ./optdef.sh | |
880 | echo " " | |
881 | cd .. | |
882 | . UU/extract | |
883 | rm -rf UU | |
884 | echo "Done." | |
885 | exit 0 | |
886 | ;; | |
887 | esac | |
888 | ||
889 | : Eunice requires " " instead of "", can you believe it | |
890 | echo " " | |
891 | : Here we go... | |
892 | echo "Beginning of configuration questions for $package." | |
893 | ||
894 | trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15 | |
895 | ||
896 | : Now test for existence of everything in MANIFEST | |
897 | echo " " | |
898 | if test -f $rsrc/MANIFEST; then | |
899 | echo "First let's make sure your kit is complete. Checking..." >&4 | |
900 | awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50 | |
901 | rm -f missing | |
902 | tmppwd=`pwd` | |
903 | for filelist in x??; do | |
904 | (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing) | |
905 | done | |
906 | if test -s missing; then | |
907 | cat missing >&4 | |
908 | cat >&4 <<'EOM' | |
909 | ||
910 | THIS PACKAGE SEEMS TO BE INCOMPLETE. | |
911 | ||
912 | You have the option of continuing the configuration process, despite the | |
913 | distinct possibility that your kit is damaged, by typing 'y'es. If you | |
914 | do, don't blame me if something goes wrong. I advise you to type 'n'o | |
915 | and contact the author (Raphael_Manfredi@grenoble.hp.com). | |
916 | ||
917 | EOM | |
918 | echo $n "Continue? [n] $c" >&4 | |
919 | read ans | |
920 | case "$ans" in | |
921 | y*) | |
922 | echo "Continuing..." >&4 | |
923 | rm -f missing | |
924 | ;; | |
925 | *) | |
926 | echo "ABORTING..." >&4 | |
927 | kill $$ | |
928 | ;; | |
929 | esac | |
930 | else | |
931 | echo "Looks good..." | |
932 | fi | |
933 | else | |
934 | echo "There is no MANIFEST file. I hope your kit is complete !" | |
935 | fi | |
936 | rm -f missing x?? | |
937 | ||
938 | : create .config dir to save info across Configure sessions | |
939 | test -d ../.config || mkdir ../.config | |
940 | cat >../.config/README <<EOF | |
941 | This directory created by Configure to save information that should | |
942 | persist across sessions for $package. | |
943 | ||
944 | You may safely delete it if you wish. | |
945 | EOF | |
946 | ||
947 | : general instructions | |
948 | needman=true | |
949 | firsttime=true | |
950 | user=`(logname) 2>/dev/null` | |
951 | case "$user" in | |
952 | '') user=`whoami 2>&1`;; | |
953 | esac | |
954 | if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then | |
955 | firsttime=false | |
956 | echo " " | |
957 | rp='Would you like to see the instructions?' | |
958 | dflt=n | |
959 | . ./myread | |
960 | case "$ans" in | |
961 | [yY]*) ;; | |
962 | *) needman=false;; | |
963 | esac | |
964 | fi | |
965 | if $needman; then | |
966 | cat <<EOH | |
967 | ||
968 | This installation shell script will examine your system and ask you questions | |
969 | to determine how the dist package should be installed. If you get | |
970 | stuck on a question, you may use a ! shell escape to start a subshell or | |
971 | execute a command. Many of the questions will have default answers in square | |
972 | brackets; typing carriage return will give you the default. | |
973 | ||
974 | On some of the questions which ask for file or directory names you are allowed | |
975 | to use the ~name construct to specify the login directory belonging to "name", | |
976 | even if you don't have a shell which knows about that. Questions where this is | |
977 | allowed will be marked "(~name ok)". | |
978 | ||
979 | EOH | |
980 | rp='' | |
981 | dflt='Type carriage return to continue' | |
982 | . ./myread | |
983 | cat <<'EOH' | |
984 | ||
985 | The prompter used in this script allows you to use shell variables and | |
986 | backticks in your answers. You may use $1, $2, etc... to refer to the words | |
987 | in the default answer, as if the default line was a set of arguments given to a | |
988 | script shell. This means you may also use $* to repeat the whole default line, | |
989 | so you do not have to re-type everything to add something to the default. | |
990 | ||
991 | Everytime there is a substitution, you will have to confirm. If there is an | |
992 | error (e.g. an unmatched backtick), the default answer will remain unchanged | |
993 | and you will be prompted again. | |
994 | ||
995 | If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all | |
996 | the questions and use the computed defaults (or the previous answers if there | |
997 | was already a config.sh file). Type 'Configure -h' for a list of options. | |
998 | You may also start interactively and then answer '& -d' at any prompt to turn | |
999 | on the non-interactive behaviour for the remaining of the execution. | |
1000 | ||
1001 | EOH | |
1002 | . ./myread | |
1003 | cat <<EOH | |
1004 | ||
1005 | Much effort has been expended to ensure that this shell script will run on any | |
1006 | Unix system. If despite that it blows up on yours, your best bet is to edit | |
1007 | Configure and run it again. If you can't run Configure for some reason, | |
1008 | you'll have to generate a config.sh file by hand. Whatever problems you | |
1009 | have, let me (Raphael_Manfredi@grenoble.hp.com) know how I blew it. | |
1010 | ||
1011 | This installation script affects things in two ways: | |
1012 | ||
1013 | 1) it may do direct variable substitutions on some of the files included | |
1014 | in this kit. | |
1015 | 2) it builds a config.h file for inclusion in C programs. You may edit | |
1016 | any of these files as the need arises after running this script. | |
1017 | ||
1018 | If you make a mistake on a question, there is no easy way to back up to it | |
1019 | currently. The easiest thing to do is to edit config.sh and rerun all the SH | |
1020 | files. Configure will offer to let you do this before it runs the SH files. | |
1021 | ||
1022 | EOH | |
1023 | dflt='Type carriage return to continue' | |
1024 | . ./myread | |
1025 | case "$firsttime" in | |
1026 | true) echo $user >>../.config/instruct;; | |
1027 | esac | |
1028 | fi | |
1029 | ||
1030 | : find out where common programs are | |
1031 | echo " " | |
1032 | echo "Locating common programs..." >&4 | |
1033 | cat <<EOSC >loc | |
1034 | $startsh | |
1035 | case \$# in | |
1036 | 0) exit 1;; | |
1037 | esac | |
1038 | thing=\$1 | |
1039 | shift | |
1040 | dflt=\$1 | |
1041 | shift | |
1042 | for dir in \$*; do | |
1043 | case "\$thing" in | |
1044 | .) | |
1045 | if test -d \$dir/\$thing; then | |
1046 | echo \$dir | |
1047 | exit 0 | |
1048 | fi | |
1049 | ;; | |
1050 | *) | |
1051 | for thisthing in \$dir/\$thing; do | |
1052 | : just loop through to pick last item | |
1053 | done | |
1054 | if test -f \$thisthing; then | |
1055 | echo \$thisthing | |
1056 | exit 0 | |
1057 | elif test -f \$dir/\$thing.exe; then | |
1058 | : on Eunice apparently | |
1059 | echo \$dir/\$thing | |
1060 | exit 0 | |
1061 | fi | |
1062 | ;; | |
1063 | esac | |
1064 | done | |
1065 | echo \$dflt | |
1066 | exit 1 | |
1067 | EOSC | |
1068 | chmod +x loc | |
1069 | $eunicefix loc | |
1070 | loclist=" | |
1071 | awk | |
1072 | cat | |
1073 | chgrp | |
1074 | chmod | |
1075 | chown | |
1076 | echo | |
1077 | expr | |
1078 | grep | |
1079 | make | |
1080 | mkdir | |
1081 | mv | |
1082 | rm | |
1083 | sed | |
1084 | sort | |
1085 | touch | |
1086 | tr | |
1087 | uniq | |
1088 | " | |
1089 | trylist=" | |
1090 | cpp | |
1091 | date | |
1092 | inews | |
1093 | less | |
1094 | line | |
1095 | ln | |
1096 | ||
1097 | more | |
1098 | nroff | |
1099 | perl | |
1100 | pg | |
1101 | rmail | |
1102 | sendmail | |
1103 | smail | |
1104 | test | |
1105 | uname | |
1106 | vi | |
1107 | zcat | |
1108 | " | |
1109 | pth=`echo $PATH | sed -e "s/$p_/ /g"` | |
1110 | pth="$pth /lib /usr/lib" | |
1111 | for file in $loclist; do | |
1112 | eval xxx=\$$file | |
1113 | case "$xxx" in | |
1114 | /*|?:[\\/]*) | |
1115 | if test -f "$xxx"; then | |
1116 | : ok | |
1117 | else | |
1118 | echo "WARNING: no $xxx -- ignoring your setting for $file." >&4 | |
1119 | xxx=`./loc $file $file $pth` | |
1120 | fi | |
1121 | ;; | |
1122 | '') xxx=`./loc $file $file $pth`;; | |
1123 | *) xxx=`./loc $xxx $xxx $pth`;; | |
1124 | esac | |
1125 | eval $file=$xxx | |
1126 | eval _$file=$xxx | |
1127 | case "$xxx" in | |
1128 | /*) | |
1129 | echo $file is in $xxx. | |
1130 | ;; | |
1131 | ?:[\\/]*) | |
1132 | echo $file is in $xxx. | |
1133 | ;; | |
1134 | *) | |
1135 | echo "I don't know where '$file' is, and my life depends on it." >&4 | |
1136 | echo "Go find a public domain implementation or fix your PATH setting!" >&4 | |
1137 | exit 1 | |
1138 | ;; | |
1139 | esac | |
1140 | done | |
1141 | echo " " | |
1142 | echo "Don't worry if any of the following aren't found..." | |
1143 | say=offhand | |
1144 | for file in $trylist; do | |
1145 | eval xxx=\$$file | |
1146 | case "$xxx" in | |
1147 | /*|?:[\\/]*) | |
1148 | if test -f "$xxx"; then | |
1149 | : ok | |
1150 | else | |
1151 | echo "WARNING: no $xxx -- ignoring your setting for $file." >&4 | |
1152 | xxx=`./loc $file $file $pth` | |
1153 | fi | |
1154 | ;; | |
1155 | '') xxx=`./loc $file $file $pth`;; | |
1156 | *) xxx=`./loc $xxx $xxx $pth`;; | |
1157 | esac | |
1158 | eval $file=$xxx | |
1159 | eval _$file=$xxx | |
1160 | case "$xxx" in | |
1161 | /*) | |
1162 | echo $file is in $xxx. | |
1163 | ;; | |
1164 | ?:[\\/]*) | |
1165 | echo $file is in $xxx. | |
1166 | ;; | |
1167 | *) | |
1168 | echo "I don't see $file out there, $say." | |
1169 | say=either | |
1170 | ;; | |
1171 | esac | |
1172 | done | |
1173 | case "$egrep" in | |
1174 | egrep) | |
1175 | echo "Substituting grep for egrep." | |
1176 | egrep=$grep | |
1177 | ;; | |
1178 | esac | |
1179 | case "$ln" in | |
1180 | ln) | |
1181 | echo "Substituting cp for ln." | |
1182 | ln=$cp | |
1183 | ;; | |
1184 | esac | |
1185 | case "$test" in | |
1186 | test) | |
1187 | echo "Hopefully test is built into your sh." | |
1188 | ;; | |
1189 | *) | |
1190 | if `sh -c "PATH= test true" >/dev/null 2>&1`; then | |
1191 | echo "Using the test built into your sh." | |
1192 | test=test | |
1193 | _test=test | |
1194 | fi | |
1195 | ;; | |
1196 | esac | |
1197 | case "$echo" in | |
1198 | echo) | |
1199 | echo "Hopefully echo is built into your sh." | |
1200 | ;; | |
1201 | '') ;; | |
1202 | *) | |
1203 | echo " " | |
1204 | echo "Checking compatibility between $echo and builtin echo (if any)..." >&4 | |
1205 | $echo $n "hi there$c" >foo1 | |
1206 | echo $n "hi there$c" >foo2 | |
1207 | if cmp foo1 foo2 >/dev/null 2>&1; then | |
1208 | echo "They are compatible. In fact, they may be identical." | |
1209 | else | |
1210 | case "$n" in | |
1211 | '-n') n='' c='\c';; | |
1212 | *) n='-n' c='';; | |
1213 | esac | |
1214 | cat <<FOO | |
1215 | They are not compatible! You are probably running ksh on a non-USG system. | |
1216 | I'll have to use $echo instead of the builtin, since Bourne shell doesn't | |
1217 | have echo built in and we may have to run some Bourne shell scripts. That | |
1218 | means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous. | |
1219 | ||
1220 | FOO | |
1221 | $echo $n "The star should be here-->$c" | |
1222 | $echo "*" | |
1223 | fi | |
1224 | $rm -f foo1 foo2 | |
1225 | ;; | |
1226 | esac | |
1227 | ||
1228 | : determine whether symbolic links are supported | |
1229 | echo " " | |
1230 | $touch blurfl | |
1231 | if $ln -s blurfl sym > /dev/null 2>&1 ; then | |
1232 | echo "Symbolic links are supported." >&4 | |
1233 | lns="$ln -s" | |
1234 | else | |
1235 | echo "Symbolic links are NOT supported." >&4 | |
1236 | lns="$ln" | |
1237 | fi | |
1238 | $rm -f blurfl sym | |
1239 | ||
1240 | : see whether [:lower:] and [:upper:] are supported character classes | |
1241 | echo " " | |
1242 | up='[A-Z]' | |
1243 | low='[a-z]' | |
1244 | case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in | |
1245 | ABYZ) | |
1246 | echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4 | |
1247 | up='[:upper:]' | |
1248 | low='[:lower:]' | |
1249 | ;; | |
1250 | *) | |
1251 | echo "Your tr only supports [a-z] and [A-Z] to convert case." >&4 | |
1252 | ;; | |
1253 | esac | |
1254 | : set up the translation script tr, must be called with ./tr of course | |
1255 | cat >tr <<EOSC | |
1256 | $startsh | |
1257 | case "\$1\$2" in | |
1258 | '[A-Z][a-z]') exec $tr '$up' '$low';; | |
1259 | '[a-z][A-Z]') exec $tr '$low' '$up';; | |
1260 | esac | |
1261 | exec $tr "\$@" | |
1262 | EOSC | |
1263 | chmod +x tr | |
1264 | $eunicefix tr | |
1265 | ||
1266 | : Try to determine whether config.sh was made on this system | |
1267 | case "$config_sh" in | |
1268 | '') | |
1269 | myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1` | |
1270 | myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \ | |
1271 | ./tr '[A-Z]' '[a-z]' | tr '\012' ' '` | |
1272 | newmyuname="$myuname" | |
1273 | dflt=n | |
1274 | case "$knowitall" in | |
1275 | '') | |
1276 | if test -f ../config.sh; then | |
1277 | if $contains myuname= ../config.sh >/dev/null 2>&1; then | |
1278 | eval "`grep myuname= ../config.sh`" | |
1279 | fi | |
1280 | if test "X$myuname" = "X$newmyuname"; then | |
1281 | dflt=y | |
1282 | fi | |
1283 | fi | |
1284 | ;; | |
1285 | *) dflt=y;; | |
1286 | esac | |
1287 | ||
1288 | : Get old answers, if there is a config file out there | |
1289 | hint=default | |
1290 | hintfile='' | |
1291 | if test -f ../config.sh; then | |
1292 | echo " " | |
1293 | rp="I see a config.sh file. Shall I use it to set the defaults?" | |
1294 | . ./myread | |
1295 | case "$ans" in | |
1296 | n*|N*) echo "OK, I'll ignore it.";; | |
1297 | *) echo "Fetching default answers from your old config.sh file..." >&4 | |
1298 | tmp_n="$n" | |
1299 | tmp_c="$c" | |
1300 | . ../config.sh | |
1301 | cp ../config.sh . | |
1302 | n="$tmp_n" | |
1303 | c="$tmp_c" | |
1304 | hint=previous | |
1305 | ;; | |
1306 | esac | |
1307 | fi | |
1308 | ;; | |
1309 | *) | |
1310 | echo " " | |
1311 | echo "Fetching default answers from $config_sh..." >&4 | |
1312 | tmp_n="$n" | |
1313 | tmp_c="$c" | |
1314 | cd .. | |
1315 | cp $config_sh config.sh 2>/dev/null | |
1316 | chmod +w config.sh | |
1317 | . ./config.sh | |
1318 | cd UU | |
1319 | cp ../config.sh . | |
1320 | n="$tmp_n" | |
1321 | c="$tmp_c" | |
1322 | hint=previous | |
1323 | ;; | |
1324 | esac | |
1325 | test "$override" && . ./optdef.sh | |
1326 | myuname="$newmyuname" | |
1327 | ||
1328 | : Restore computed paths | |
1329 | for file in $loclist $trylist; do | |
1330 | eval $file="\$_$file" | |
1331 | done | |
1332 | ||
1333 | : who configured the system | |
1334 | cf_time=`$date 2>&1` | |
1335 | cf_by=`(logname) 2>/dev/null` | |
1336 | case "$cf_by" in | |
1337 | "") | |
1338 | cf_by=`(whoami) 2>/dev/null` | |
1339 | case "$cf_by" in | |
1340 | "") cf_by=unknown ;; | |
1341 | esac ;; | |
1342 | esac | |
1343 | ||
1344 | : is AFS running? | |
1345 | echo " " | |
1346 | case "$afs" in | |
1347 | $define|true) afs=true ;; | |
1348 | $undef|false) afs=false ;; | |
1349 | *) if test -d /afs; then | |
1350 | afs=true | |
1351 | else | |
1352 | afs=false | |
1353 | fi | |
1354 | ;; | |
1355 | esac | |
1356 | if $afs; then | |
1357 | echo "AFS may be running... I'll be extra cautious then..." >&4 | |
1358 | else | |
1359 | echo "AFS does not seem to be running..." >&4 | |
1360 | fi | |
1361 | ||
1362 | : determine where manual pages are on this system | |
1363 | echo " " | |
1364 | case "$sysman" in | |
1365 | '') | |
1366 | syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1' | |
1367 | syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1" | |
1368 | syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1" | |
1369 | syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1" | |
1370 | syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1" | |
1371 | sysman=`./loc . /usr/man/man1 $syspath` | |
1372 | ;; | |
1373 | esac | |
1374 | if $test -d "$sysman"; then | |
1375 | echo "System manual is in $sysman." >&4 | |
1376 | else | |
1377 | echo "Could not find manual pages in source form." >&4 | |
1378 | fi | |
1379 | ||
1380 | : decide how portable to be | |
1381 | case "$d_portable" in | |
1382 | "$define") dflt=y;; | |
1383 | *) dflt=n;; | |
1384 | esac | |
1385 | $cat <<'EOH' | |
1386 | ||
1387 | I can set things up so that your shell scripts and binaries are more portable, | |
1388 | at what may be a noticable cost in performance. In particular, if you | |
1389 | ask to be portable, the following happens: | |
1390 | ||
1391 | 1) Shell scripts will rely on the PATH variable rather than using | |
1392 | the paths derived above. | |
1393 | 2) ~username interpretations will be done at run time rather than | |
1394 | by Configure. | |
1395 | ||
1396 | EOH | |
1397 | rp="Do you expect to run these scripts and binaries on multiple machines?" | |
1398 | . ./myread | |
1399 | case "$ans" in | |
1400 | y*) d_portable="$define" | |
1401 | ;; | |
1402 | *) d_portable="$undef" ;; | |
1403 | esac | |
1404 | ||
1405 | : set up shell script to do ~ expansion | |
1406 | cat >filexp <<EOSS | |
1407 | $startsh | |
1408 | : expand filename | |
1409 | case "\$1" in | |
1410 | ~/*|~) | |
1411 | echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|" | |
1412 | ;; | |
1413 | ~*) | |
1414 | if $test -f /bin/csh; then | |
1415 | /bin/csh -f -c "glob \$1" | |
1416 | failed=\$? | |
1417 | echo "" | |
1418 | exit \$failed | |
1419 | else | |
1420 | name=\`$expr x\$1 : '..\([^/]*\)'\` | |
1421 | dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\` | |
1422 | if $test ! -d "\$dir"; then | |
1423 | me=\`basename \$0\` | |
1424 | echo "\$me: can't locate home directory for: \$name" >&2 | |
1425 | exit 1 | |
1426 | fi | |
1427 | case "\$1" in | |
1428 | */*) | |
1429 | echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\` | |
1430 | ;; | |
1431 | *) | |
1432 | echo \$dir | |
1433 | ;; | |
1434 | esac | |
1435 | fi | |
1436 | ;; | |
1437 | *) | |
1438 | echo \$1 | |
1439 | ;; | |
1440 | esac | |
1441 | EOSS | |
1442 | chmod +x filexp | |
1443 | $eunicefix filexp | |
1444 | ||
1445 | : now set up to get a file name | |
1446 | cat <<EOS >getfile | |
1447 | $startsh | |
1448 | EOS | |
1449 | cat <<'EOSC' >>getfile | |
1450 | tilde='' | |
1451 | fullpath='' | |
1452 | already='' | |
1453 | skip='' | |
1454 | none_ok='' | |
1455 | exp_file='' | |
1456 | nopath_ok='' | |
1457 | orig_rp="$rp" | |
1458 | orig_dflt="$dflt" | |
1459 | ||
1460 | case "$fn" in | |
1461 | *\(*) | |
1462 | expr $fn : '.*(\(.*\)).*' | tr ',' '\012' >getfile.ok | |
1463 | fn=`echo $fn | sed 's/(.*)//'` | |
1464 | ;; | |
1465 | esac | |
1466 | ||
1467 | case "$fn" in | |
1468 | *:*) | |
1469 | loc_file=`expr $fn : '.*:\(.*\)'` | |
1470 | fn=`expr $fn : '\(.*\):.*'` | |
1471 | ;; | |
1472 | esac | |
1473 | ||
1474 | case "$fn" in | |
1475 | *~*) tilde=true;; | |
1476 | esac | |
1477 | case "$fn" in | |
1478 | */*) fullpath=true;; | |
1479 | esac | |
1480 | case "$fn" in | |
1481 | *+*) skip=true;; | |
1482 | esac | |
1483 | case "$fn" in | |
1484 | *n*) none_ok=true;; | |
1485 | esac | |
1486 | case "$fn" in | |
1487 | *e*) exp_file=true;; | |
1488 | esac | |
1489 | case "$fn" in | |
1490 | *p*) nopath_ok=true;; | |
1491 | esac | |
1492 | ||
1493 | case "$fn" in | |
1494 | *f*) type='File';; | |
1495 | *d*) type='Directory';; | |
1496 | *l*) type='Locate';; | |
1497 | esac | |
1498 | ||
1499 | what="$type" | |
1500 | case "$what" in | |
1501 | Locate) what='File';; | |
1502 | esac | |
1503 | ||
1504 | case "$exp_file" in | |
1505 | '') | |
1506 | case "$d_portable" in | |
1507 | "$define") ;; | |
1508 | *) exp_file=true;; | |
1509 | esac | |
1510 | ;; | |
1511 | esac | |
1512 | ||
1513 | cd .. | |
1514 | while test "$type"; do | |
1515 | redo='' | |
1516 | rp="$orig_rp" | |
1517 | dflt="$orig_dflt" | |
1518 | case "$tilde" in | |
1519 | true) rp="$rp (~name ok)";; | |
1520 | esac | |
1521 | . UU/myread | |
1522 | if test -f UU/getfile.ok && \ | |
1523 | $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1 | |
1524 | then | |
1525 | value="$ans" | |
1526 | ansexp="$ans" | |
1527 | break | |
1528 | fi | |
1529 | case "$ans" in | |
1530 | none) | |
1531 | value='' | |
1532 | ansexp='' | |
1533 | case "$none_ok" in | |
1534 | true) type='';; | |
1535 | esac | |
1536 | ;; | |
1537 | *) | |
1538 | case "$tilde" in | |
1539 | '') value="$ans" | |
1540 | ansexp="$ans";; | |
1541 | *) | |
1542 | value=`UU/filexp $ans` | |
1543 | case $? in | |
1544 | 0) | |
1545 | if test "$ans" != "$value"; then | |
1546 | echo "(That expands to $value on this system.)" | |
1547 | fi | |
1548 | ;; | |
1549 | *) value="$ans";; | |
1550 | esac | |
1551 | ansexp="$value" | |
1552 | case "$exp_file" in | |
1553 | '') value="$ans";; | |
1554 | esac | |
1555 | ;; | |
1556 | esac | |
1557 | case "$fullpath" in | |
1558 | true) | |
1559 | case "$ansexp" in | |
1560 | /*) value="$ansexp" ;; | |
1561 | *) | |
1562 | redo=true | |
1563 | case "$already" in | |
1564 | true) | |
1565 | echo "I shall only accept a full path name, as in /bin/ls." >&4 | |
1566 | echo "Use a ! shell escape if you wish to check pathnames." >&4 | |
1567 | ;; | |
1568 | *) | |
1569 | echo "Please give a full path name, starting with slash." >&4 | |
1570 | case "$tilde" in | |
1571 | true) | |
1572 | echo "Note that using ~name is ok provided it expands well." >&4 | |
1573 | already=true | |
1574 | ;; | |
1575 | esac | |
1576 | esac | |
1577 | ;; | |
1578 | esac | |
1579 | ;; | |
1580 | esac | |
1581 | case "$redo" in | |
1582 | '') | |
1583 | case "$type" in | |
1584 | File) | |
1585 | if test -f "$ansexp"; then | |
1586 | type='' | |
1587 | elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1 | |
1588 | then | |
1589 | echo "($value is not a plain file, but that's ok.)" | |
1590 | type='' | |
1591 | fi | |
1592 | ;; | |
1593 | Directory) | |
1594 | if test -d "$ansexp"; then | |
1595 | type='' | |
1596 | fi | |
1597 | ;; | |
1598 | Locate) | |
1599 | if test -d "$ansexp"; then | |
1600 | echo "(Looking for $loc_file in directory $value.)" | |
1601 | value="$value/$loc_file" | |
1602 | ansexp="$ansexp/$loc_file" | |
1603 | fi | |
1604 | if test -f "$ansexp"; then | |
1605 | type='' | |
1606 | fi | |
1607 | case "$nopath_ok" in | |
1608 | true) case "$value" in | |
1609 | */*) ;; | |
1610 | *) echo "Assuming $value will be in people's path." | |
1611 | type='' | |
1612 | ;; | |
1613 | esac | |
1614 | ;; | |
1615 | esac | |
1616 | ;; | |
1617 | esac | |
1618 | ||
1619 | case "$skip" in | |
1620 | true) type=''; | |
1621 | esac | |
1622 | ||
1623 | case "$type" in | |
1624 | '') ;; | |
1625 | *) | |
1626 | if test "$fastread" = yes; then | |
1627 | dflt=y | |
1628 | else | |
1629 | dflt=n | |
1630 | fi | |
1631 | rp="$what $value doesn't exist. Use that name anyway?" | |
1632 | . UU/myread | |
1633 | dflt='' | |
1634 | case "$ans" in | |
1635 | y*) type='';; | |
1636 | *) echo " ";; | |
1637 | esac | |
1638 | ;; | |
1639 | esac | |
1640 | ;; | |
1641 | esac | |
1642 | ;; | |
1643 | esac | |
1644 | done | |
1645 | cd UU | |
1646 | ans="$value" | |
1647 | rp="$orig_rp" | |
1648 | dflt="$orig_dflt" | |
1649 | rm -f getfile.ok | |
1650 | EOSC | |
1651 | ||
1652 | : determine root of directory hierarchy where package will be installed. | |
1653 | case "$prefix" in | |
1654 | '') | |
1655 | dflt=`./loc . /usr/local /usr/local /local /opt /usr` | |
1656 | ;; | |
1657 | *) | |
1658 | dflt="$prefix" | |
1659 | ;; | |
1660 | esac | |
1661 | $cat <<EOM | |
1662 | ||
1663 | By default, $package will be installed in $dflt/bin, manual | |
1664 | pages under $dflt/man, etc..., i.e. with $dflt as prefix for | |
1665 | all installation directories. Typically set to /usr/local, but you | |
1666 | may choose /usr if you wish to install $package among your system | |
1667 | binaries. If you wish to have binaries under /bin but manual pages | |
1668 | under /usr/local/man, that's ok: you will be prompted separately | |
1669 | for each of the installation directories, the prefix being only used | |
1670 | to set the defaults. | |
1671 | ||
1672 | EOM | |
1673 | fn=d~ | |
1674 | rp='Installation prefix to use?' | |
1675 | . ./getfile | |
1676 | oldprefix='' | |
1677 | case "$prefix" in | |
1678 | '') ;; | |
1679 | *) | |
1680 | case "$ans" in | |
1681 | "$prefix") ;; | |
1682 | *) oldprefix="$prefix";; | |
1683 | esac | |
1684 | ;; | |
1685 | esac | |
1686 | prefix="$ans" | |
1687 | prefixexp="$ansexp" | |
1688 | ||
1689 | : set the prefixit variable, to compute a suitable default value | |
1690 | prefixit='case "$3" in | |
1691 | ""|none) | |
1692 | case "$oldprefix" in | |
1693 | "") eval "$1=\"\$$2\"";; | |
1694 | *) | |
1695 | case "$3" in | |
1696 | "") eval "$1=";; | |
1697 | none) | |
1698 | eval "tp=\"\$$2\""; | |
1699 | case "$tp" in | |
1700 | ""|" ") eval "$1=\"\$$2\"";; | |
1701 | *) eval "$1=";; | |
1702 | esac;; | |
1703 | esac;; | |
1704 | esac;; | |
1705 | *) | |
1706 | eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\""; | |
1707 | case "$tp" in | |
1708 | --|/*--|\~*--) eval "$1=\"$prefix/$3\"";; | |
1709 | /*-$oldprefix/*|\~*-$oldprefix/*) | |
1710 | eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";; | |
1711 | *) eval "$1=\"\$$2\"";; | |
1712 | esac;; | |
1713 | esac' | |
1714 | ||
1715 | : set the prefixup variable, to restore leading tilda escape | |
1716 | prefixup='case "$prefixexp" in | |
1717 | "$prefix") ;; | |
1718 | *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";; | |
1719 | esac' | |
1720 | ||
1721 | : determine where manual pages go | |
1722 | set mansrc mansrc none | |
1723 | eval $prefixit | |
1724 | $cat <<EOM | |
1725 | ||
1726 | $spackage has manual pages available in source form. | |
1727 | EOM | |
1728 | case "$nroff" in | |
1729 | nroff) | |
1730 | echo "However, you don't have nroff, so they're probably useless to you." | |
1731 | case "$mansrc" in | |
1732 | '') mansrc="none";; | |
1733 | esac;; | |
1734 | esac | |
1735 | echo "If you don't want the manual sources installed, answer 'none'." | |
1736 | case "$mansrc" in | |
1737 | '') | |
1738 | lookpath="$prefixexp/man/man1 $prefixexp/man/u_man/man1" | |
1739 | lookpath="$lookpath $prefixexp/man/l_man/man1" | |
1740 | lookpath="$lookpath /usr/local/man/man1 /opt/man/man1 /usr/man/manl" | |
1741 | lookpath="$lookpath /usr/man/local/man1 /usr/man/l_man/man1" | |
1742 | lookpath="$lookpath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1" | |
1743 | lookpath="$lookpath /usr/man/man.L" | |
1744 | mansrc=`./loc . $prefixexp/man/man1 $lookpath` | |
1745 | if $test -d "$mansrc"; then | |
1746 | dflt="$mansrc" | |
1747 | else | |
1748 | dflt="$sysman" | |
1749 | fi | |
1750 | set dflt | |
1751 | eval $prefixup | |
1752 | ;; | |
1753 | ' ') dflt=none;; | |
1754 | *) dflt="$mansrc" | |
1755 | ;; | |
1756 | esac | |
1757 | echo " " | |
1758 | fn=dn~ | |
1759 | rp='Where do the manual pages (source) go?' | |
1760 | . ./getfile | |
1761 | if test "X$mansrcexp" != "X$ansexp"; then | |
1762 | installmansrc='' | |
1763 | fi | |
1764 | mansrc="$ans" | |
1765 | mansrcexp="$ansexp" | |
1766 | case "$mansrc" in | |
1767 | '') mansrc=' ' | |
1768 | installmansrc='';; | |
1769 | esac | |
1770 | if $afs && $test "$mansrc"; then | |
1771 | $cat <<EOM | |
1772 | ||
1773 | Since you are running AFS, I need to distinguish the directory in which | |
1774 | manual pages reside from the directory in which they are installed (and from | |
1775 | which they are presumably copied to the former directory by occult means). | |
1776 | ||
1777 | EOM | |
1778 | case "$installmansrc" in | |
1779 | '') dflt=`echo $mansrcexp | sed 's#^/afs/#/afs/.#'`;; | |
1780 | *) dflt="$installmansrc";; | |
1781 | esac | |
1782 | fn=de~ | |
1783 | rp='Where will man pages be installed?' | |
1784 | . ./getfile | |
1785 | installmansrc="$ans" | |
1786 | else | |
1787 | installmansrc="$mansrcexp" | |
1788 | fi | |
1789 | ||
1790 | case "$mansrc" in | |
1791 | ' ') manext='0';; | |
1792 | *l) manext=l;; | |
1793 | *n) manext=n;; | |
1794 | *o) manext=l;; | |
1795 | *p) manext=n;; | |
1796 | *C) manext=C;; | |
1797 | *L) manext=L;; | |
1798 | *L1) manext=L1;; | |
1799 | *) manext=1;; | |
1800 | esac | |
1801 | ||
1802 | : determine where private executables go | |
1803 | set dflt privlib lib/$package | |
1804 | eval $prefixit | |
1805 | $cat <<EOM | |
1806 | ||
1807 | There are some auxiliary files for $package that need to be put into a | |
1808 | private library directory that is accessible by everyone. | |
1809 | ||
1810 | EOM | |
1811 | fn=d~+ | |
1812 | rp='Pathname where the private library files will reside?' | |
1813 | . ./getfile | |
1814 | if $test "X$privlibexp" != "X$ansexp"; then | |
1815 | installprivlib='' | |
1816 | fi | |
1817 | privlib="$ans" | |
1818 | privlibexp="$ansexp" | |
1819 | if $afs; then | |
1820 | $cat <<EOM | |
1821 | ||
1822 | Since you are running AFS, I need to distinguish the directory in which | |
1823 | private files reside from the directory in which they are installed (and from | |
1824 | which they are presumably copied to the former directory by occult means). | |
1825 | ||
1826 | EOM | |
1827 | case "$installprivlib" in | |
1828 | '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;; | |
1829 | *) dflt="$installprivlib";; | |
1830 | esac | |
1831 | fn=de~ | |
1832 | rp='Where will private files be installed?' | |
1833 | . ./getfile | |
1834 | installprivlib="$ans" | |
1835 | else | |
1836 | installprivlib="$privlibexp" | |
1837 | fi | |
1838 | ||
1839 | : determine where public executable scripts go | |
1840 | set scriptdir scriptdir | |
1841 | eval $prefixit | |
1842 | case "$scriptdir" in | |
1843 | '') | |
1844 | dflt="$bin" | |
1845 | : guess some guesses | |
1846 | $test -d /usr/share/scripts && dflt=/usr/share/scripts | |
1847 | $test -d /usr/share/bin && dflt=/usr/share/bin | |
1848 | $test -d /usr/local/script && dflt=/usr/local/script | |
1849 | $test -d $prefixexp/script && dflt=$prefixexp/script | |
1850 | set dflt | |
1851 | eval $prefixup | |
1852 | ;; | |
1853 | *) dflt="$scriptdir" | |
1854 | ;; | |
1855 | esac | |
1856 | $cat <<EOM | |
1857 | ||
1858 | Some installations have a separate directory just for executable scripts so | |
1859 | that they can mount it across multiple architectures but keep the scripts in | |
1860 | one spot. You might, for example, have a subdirectory of /usr/share for this. | |
1861 | Or you might just lump your scripts in with all your other executables. | |
1862 | ||
1863 | EOM | |
1864 | fn=d~ | |
1865 | rp='Where do you keep publicly executable scripts?' | |
1866 | . ./getfile | |
1867 | if $test "X$ansexp" != "X$scriptdirexp"; then | |
1868 | installscript='' | |
1869 | fi | |
1870 | scriptdir="$ans" | |
1871 | scriptdirexp="$ansexp" | |
1872 | if $afs; then | |
1873 | $cat <<EOM | |
1874 | ||
1875 | Since you are running AFS, I need to distinguish the directory in which | |
1876 | scripts reside from the directory in which they are installed (and from | |
1877 | which they are presumably copied to the former directory by occult means). | |
1878 | ||
1879 | EOM | |
1880 | case "$installscript" in | |
1881 | '') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;; | |
1882 | *) dflt="$installscript";; | |
1883 | esac | |
1884 | fn=de~ | |
1885 | rp='Where will public scripts be installed?' | |
1886 | . ./getfile | |
1887 | installscript="$ans" | |
1888 | else | |
1889 | installscript="$scriptdirexp" | |
1890 | fi | |
1891 | ||
1892 | : preserve RCS keywords in files with variable substitution, grrr | |
1893 | Header='$Header' | |
1894 | Id='$Id' | |
1895 | Locker='$Locker' | |
1896 | Log='$Log' | |
1897 | ||
1898 | : set the base revision | |
1899 | baserev=3.0 | |
1900 | ||
1901 | : make some quick guesses about what we are up against | |
1902 | echo " " | |
1903 | $echo $n "Hmm... $c" | |
1904 | echo exit 1 >bsd | |
1905 | echo exit 1 >usg | |
1906 | echo exit 1 >v7 | |
1907 | echo exit 1 >osf1 | |
1908 | echo exit 1 >eunice | |
1909 | echo exit 1 >xenix | |
1910 | echo exit 1 >venix | |
1911 | echo exit 1 >os2 | |
1912 | d_bsd="$undef" | |
1913 | $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null | |
1914 | if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1 | |
1915 | then | |
1916 | echo "Looks kind of like an OSF/1 system, but we'll see..." | |
1917 | echo exit 0 >osf1 | |
1918 | elif test `echo abc | tr a-z A-Z` = Abc ; then | |
1919 | xxx=`./loc addbib blurfl $pth` | |
1920 | if $test -f $xxx; then | |
1921 | echo "Looks kind of like a USG system with BSD features, but we'll see..." | |
1922 | echo exit 0 >bsd | |
1923 | echo exit 0 >usg | |
1924 | else | |
1925 | if $contains SIGTSTP foo >/dev/null 2>&1 ; then | |
1926 | echo "Looks kind of like an extended USG system, but we'll see..." | |
1927 | else | |
1928 | echo "Looks kind of like a USG system, but we'll see..." | |
1929 | fi | |
1930 | echo exit 0 >usg | |
1931 | fi | |
1932 | elif $contains SIGTSTP foo >/dev/null 2>&1 ; then | |
1933 | echo "Looks kind of like a BSD system, but we'll see..." | |
1934 | d_bsd="$define" | |
1935 | echo exit 0 >bsd | |
1936 | else | |
1937 | echo "Looks kind of like a Version 7 system, but we'll see..." | |
1938 | echo exit 0 >v7 | |
1939 | fi | |
1940 | case "$eunicefix" in | |
1941 | *unixtovms*) | |
1942 | $cat <<'EOI' | |
1943 | There is, however, a strange, musty smell in the air that reminds me of | |
1944 | something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit. | |
1945 | EOI | |
1946 | echo exit 0 >eunice | |
1947 | d_eunice="$define" | |
1948 | : it so happens the Eunice I know will not run shell scripts in Unix format | |
1949 | ;; | |
1950 | *) | |
1951 | echo " " | |
1952 | echo "Congratulations. You aren't running Eunice." | |
1953 | d_eunice="$undef" | |
1954 | ;; | |
1955 | esac | |
1956 | case "$p_" in | |
1957 | :) ;; | |
1958 | *) | |
1959 | $cat <<'EOI' | |
1960 | I have the feeling something is not exactly right, however...don't tell me... | |
1961 | lemme think...does HAL ring a bell?...no, of course, you're only running OS/2! | |
1962 | EOI | |
1963 | echo exit 0 >os2 | |
1964 | ;; | |
1965 | esac | |
1966 | if test -f /xenix; then | |
1967 | echo "Actually, this looks more like a XENIX system..." | |
1968 | echo exit 0 >xenix | |
1969 | d_xenix="$define" | |
1970 | else | |
1971 | echo " " | |
1972 | echo "It's not Xenix..." | |
1973 | d_xenix="$undef" | |
1974 | fi | |
1975 | chmod +x xenix | |
1976 | $eunicefix xenix | |
1977 | if test -f /venix; then | |
1978 | echo "Actually, this looks more like a VENIX system..." | |
1979 | echo exit 0 >venix | |
1980 | else | |
1981 | echo " " | |
1982 | if ./xenix; then | |
1983 | : null | |
1984 | else | |
1985 | echo "Nor is it Venix..." | |
1986 | fi | |
1987 | fi | |
1988 | chmod +x bsd usg v7 osf1 eunice xenix venix os2 | |
1989 | $eunicefix bsd usg v7 osf1 eunice xenix venix os2 | |
1990 | $rm -f foo | |
1991 | ||
1992 | : see if we have to deal with yellow pages, now NIS. | |
1993 | if $test -d /usr/etc/yp || $test -d /etc/yp; then | |
1994 | if $test -f /usr/etc/nibindd; then | |
1995 | echo " " | |
1996 | echo "I'm fairly confident you're on a NeXT." | |
1997 | echo " " | |
1998 | rp='Do you get the passwd file via NetInfo?' | |
1999 | dflt=y | |
2000 | case "$passcat" in | |
2001 | nidump*) ;; | |
2002 | '') ;; | |
2003 | *) dflt=n;; | |
2004 | esac | |
2005 | . ./myread | |
2006 | case "$ans" in | |
2007 | y*) passcat='nidump passwd .' | |
2008 | ;; | |
2009 | *) echo "You told me, so don't blame me." | |
2010 | case "$passcat" in | |
2011 | nidump*) passcat='' | |
2012 | esac | |
2013 | ;; | |
2014 | esac | |
2015 | echo " " | |
2016 | rp='Do you get the hosts file via NetInfo?' | |
2017 | dflt=y | |
2018 | case "$hostcat" in | |
2019 | nidump*) ;; | |
2020 | '') ;; | |
2021 | *) dflt=n;; | |
2022 | esac | |
2023 | . ./myread | |
2024 | case "$ans" in | |
2025 | y*) hostcat='nidump hosts .';; | |
2026 | *) case "$hostcat" in | |
2027 | nidump*) hostcat='';; | |
2028 | esac | |
2029 | ;; | |
2030 | esac | |
2031 | fi | |
2032 | case "$passcat" in | |
2033 | nidump*) ;; | |
2034 | *) | |
2035 | case "$passcat" in | |
2036 | *ypcat*) dflt=y;; | |
2037 | '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then | |
2038 | dflt=y | |
2039 | else | |
2040 | dflt=n | |
2041 | fi;; | |
2042 | *) dflt=n;; | |
2043 | esac | |
2044 | echo " " | |
2045 | rp='Are you getting the passwd file via yellow pages?' | |
2046 | . ./myread | |
2047 | case "$ans" in | |
2048 | y*) passcat='ypcat passwd' | |
2049 | ;; | |
2050 | *) passcat='cat /etc/passwd' | |
2051 | ;; | |
2052 | esac | |
2053 | ;; | |
2054 | esac | |
2055 | case "$hostcat" in | |
2056 | nidump*) ;; | |
2057 | *) | |
2058 | case "$hostcat" in | |
2059 | *ypcat*) dflt=y;; | |
2060 | '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then | |
2061 | dflt=y | |
2062 | else | |
2063 | dflt=n | |
2064 | fi;; | |
2065 | *) dflt=n;; | |
2066 | esac | |
2067 | echo " " | |
2068 | rp='Are you getting the hosts file via yellow pages?' | |
2069 | . ./myread | |
2070 | case "$ans" in | |
2071 | y*) hostcat='ypcat hosts';; | |
2072 | *) hostcat='cat /etc/hosts';; | |
2073 | esac | |
2074 | ;; | |
2075 | esac | |
2076 | fi | |
2077 | case "$hostcat" in | |
2078 | '') hostcat='cat /etc/hosts';; | |
2079 | esac | |
2080 | case "$groupcat" in | |
2081 | '') groupcat='cat /etc/group';; | |
2082 | esac | |
2083 | case "$passcat" in | |
2084 | '') passcat='cat /etc/passwd';; | |
2085 | esac | |
2086 | ||
2087 | : now get the host name | |
2088 | echo " " | |
2089 | echo "Figuring out host name..." >&4 | |
2090 | case "$myhostname" in | |
2091 | '') cont=true | |
2092 | echo 'Maybe "hostname" will work...' | |
2093 | if tans=`sh -c hostname 2>&1` ; then | |
2094 | myhostname=$tans | |
2095 | phostname=hostname | |
2096 | cont='' | |
2097 | fi | |
2098 | ;; | |
2099 | *) cont='';; | |
2100 | esac | |
2101 | if $test "$cont"; then | |
2102 | if ./xenix; then | |
2103 | echo 'Oh, dear. Maybe "/etc/systemid" is the key...' | |
2104 | if tans=`cat /etc/systemid 2>&1` ; then | |
2105 | myhostname=$tans | |
2106 | phostname='cat /etc/systemid' | |
2107 | echo "Whadyaknow. Xenix always was a bit strange..." | |
2108 | cont='' | |
2109 | fi | |
2110 | elif $test -r /etc/systemid; then | |
2111 | echo "(What is a non-Xenix system doing with /etc/systemid?)" | |
2112 | fi | |
2113 | fi | |
2114 | if $test "$cont"; then | |
2115 | echo 'No, maybe "uuname -l" will work...' | |
2116 | if tans=`sh -c 'uuname -l' 2>&1` ; then | |
2117 | myhostname=$tans | |
2118 | phostname='uuname -l' | |
2119 | else | |
2120 | echo 'Strange. Maybe "uname -n" will work...' | |
2121 | if tans=`sh -c 'uname -n' 2>&1` ; then | |
2122 | myhostname=$tans | |
2123 | phostname='uname -n' | |
2124 | else | |
2125 | echo 'Oh well, maybe I can mine it out of whoami.h...' | |
2126 | if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then | |
2127 | myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'` | |
2128 | phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h" | |
2129 | else | |
2130 | case "$myhostname" in | |
2131 | '') echo "Does this machine have an identity crisis or something?" | |
2132 | phostname='';; | |
2133 | *) | |
2134 | echo "Well, you said $myhostname before..." | |
2135 | phostname='echo $myhostname';; | |
2136 | esac | |
2137 | fi | |
2138 | fi | |
2139 | fi | |
2140 | fi | |
2141 | : you do not want to know about this | |
2142 | set $myhostname | |
2143 | myhostname=$1 | |
2144 | ||
2145 | : verify guess | |
2146 | if $test "$myhostname" ; then | |
2147 | dflt=y | |
2148 | rp='Your host name appears to be "'$myhostname'".'" Right?" | |
2149 | . ./myread | |
2150 | case "$ans" in | |
2151 | y*) ;; | |
2152 | *) myhostname='';; | |
2153 | esac | |
2154 | fi | |
2155 | ||
2156 | : bad guess or no guess | |
2157 | while $test "X$myhostname" = X ; do | |
2158 | dflt='' | |
2159 | rp="Please type the (one word) name of your host:" | |
2160 | . ./myread | |
2161 | myhostname="$ans" | |
2162 | done | |
2163 | ||
2164 | : translate upper to lower if necessary | |
2165 | case "$myhostname" in | |
2166 | *[A-Z]*) | |
2167 | echo "(Normalizing case in your host name)" | |
2168 | myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'` | |
2169 | ;; | |
2170 | esac | |
2171 | ||
2172 | case "$myhostname" in | |
2173 | *.*) | |
2174 | dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"` | |
2175 | myhostname=`expr "X$myhostname" : "X\([^.]*\)\."` | |
2176 | echo "(Trimming domain name from host name--host name is now $myhostname)" | |
2177 | ;; | |
2178 | *) case "$mydomain" in | |
2179 | '') | |
2180 | { | |
2181 | : If we use NIS, try ypmatch. | |
2182 | : Is there some reason why this was not done before? | |
2183 | test "X$hostcat" = "Xypcat hosts" && | |
2184 | ypmatch "$myhostname" hosts 2>/dev/null |\ | |
2185 | $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \ | |
2186 | $test -s hosts | |
2187 | } || { | |
2188 | : Extract only the relevant hosts, reducing file size, | |
2189 | : remove comments, insert trailing space for later use. | |
2190 | $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ / | |
2191 | /[ ]$myhostname[ . ]/p" > hosts | |
2192 | } | |
2193 | tmp_re="[ . ]" | |
2194 | $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ } | |
2195 | END { print sum }" hosts` = x1 || tmp_re="[ ]" | |
2196 | dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \ | |
2197 | hosts | $sort | $uniq | \ | |
2198 | $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"` | |
2199 | case `$echo X$dflt` in | |
2200 | X*\ *) echo "(Several hosts in /etc/hosts matched hostname)" | |
2201 | dflt=. | |
2202 | ;; | |
2203 | X.) echo "(You do not have fully-qualified names in /etc/hosts)" | |
2204 | ;; | |
2205 | esac | |
2206 | case "$dflt" in | |
2207 | .) | |
2208 | tans=`./loc resolv.conf X /etc /usr/etc` | |
2209 | if $test -f "$tans"; then | |
2210 | echo "(Attempting domain name extraction from $tans)" | |
2211 | dflt=.`$sed -n -e 's/ / /g' \ | |
2212 | -e 's/^search *\([^ ]*\).*/\1/p' $tans \ | |
2213 | | ./tr '[A-Z]' '[a-z]' 2>/dev/null` | |
2214 | case "$dflt" in | |
2215 | .) dflt=.`$sed -n -e 's/ / /g' \ | |
2216 | -e 's/^domain *\([^ ]*\).*/\1/p' $tans \ | |
2217 | | ./tr '[A-Z]' '[a-z]' 2>/dev/null` | |
2218 | ;; | |
2219 | esac | |
2220 | fi | |
2221 | ;; | |
2222 | esac | |
2223 | case "$dflt" in | |
2224 | .) echo "(No help from resolv.conf either -- attempting clever guess)" | |
2225 | dflt=.`sh -c domainname 2>/dev/null` | |
2226 | case "$dflt" in | |
2227 | '') dflt='.';; | |
2228 | .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;; | |
2229 | esac | |
2230 | ;; | |
2231 | esac | |
2232 | case "$dflt" in | |
2233 | .) echo "(Lost all hope -- silly guess then)" | |
2234 | dflt='.uucp' | |
2235 | ;; | |
2236 | esac | |
2237 | $rm -f hosts | |
2238 | ;; | |
2239 | *) dflt="$mydomain";; | |
2240 | esac;; | |
2241 | esac | |
2242 | echo " " | |
2243 | rp="What is your domain name?" | |
2244 | . ./myread | |
2245 | tans="$ans" | |
2246 | case "$ans" in | |
2247 | '') ;; | |
2248 | .*) ;; | |
2249 | *) tans=".$tans";; | |
2250 | esac | |
2251 | mydomain="$tans" | |
2252 | ||
2253 | : translate upper to lower if necessary | |
2254 | case "$mydomain" in | |
2255 | *[A-Z]*) | |
2256 | echo "(Normalizing case in your domain name)" | |
2257 | mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'` | |
2258 | ;; | |
2259 | esac | |
2260 | ||
2261 | : a little sanity check here | |
2262 | case "$phostname" in | |
2263 | '') ;; | |
2264 | *) | |
2265 | case `$phostname | ./tr '[A-Z]' '[a-z]'` in | |
2266 | $myhostname$mydomain|$myhostname) ;; | |
2267 | *) | |
2268 | case "$phostname" in | |
2269 | sed*) | |
2270 | echo "(That doesn't agree with your whoami.h file, by the way.)" | |
2271 | ;; | |
2272 | *) | |
2273 | echo "(That doesn't agree with your $phostname command, by the way.)" | |
2274 | ;; | |
2275 | esac | |
2276 | ;; | |
2277 | esac | |
2278 | ;; | |
2279 | esac | |
2280 | ||
2281 | $cat <<EOM | |
2282 | ||
2283 | I need to get your e-mail address in Internet format if possible, i.e. | |
2284 | something like user@host.domain. Please answer accurately since I have | |
2285 | no easy means to double check it. The default value provided below | |
2286 | is most probably close to the reality but may not be valid from outside | |
2287 | your organization... | |
2288 | ||
2289 | EOM | |
2290 | cont=x | |
2291 | while test "$cont"; do | |
2292 | case "$cf_email" in | |
2293 | '') dflt="$cf_by@$myhostname$mydomain";; | |
2294 | *) dflt="$cf_email";; | |
2295 | esac | |
2296 | rp='What is your e-mail address?' | |
2297 | . ./myread | |
2298 | cf_email="$ans" | |
2299 | case "$cf_email" in | |
2300 | *@*.*) cont='' ;; | |
2301 | *) | |
2302 | rp='Address does not look like an Internet one. Use it anyway?' | |
2303 | case "$fastread" in | |
2304 | yes) dflt=y ;; | |
2305 | *) dflt=n ;; | |
2306 | esac | |
2307 | . ./myread | |
2308 | case "$ans" in | |
2309 | y*) cont='' ;; | |
2310 | *) echo " " ;; | |
2311 | esac | |
2312 | ;; | |
2313 | esac | |
2314 | done | |
2315 | ||
2316 | : determine default editor | |
2317 | echo " " | |
2318 | case "$defeditor" in | |
2319 | '') | |
2320 | case "$vi" in | |
2321 | */*) dflt="$vi";; | |
2322 | *) dflt=/usr/ucb/vi;; | |
2323 | esac | |
2324 | ;; | |
2325 | *) dflt="$defeditor" | |
2326 | ;; | |
2327 | esac | |
2328 | fn=f/ | |
2329 | rp="What is the default editor on your system?" | |
2330 | . ./getfile | |
2331 | defeditor="$ans" | |
2332 | ||
2333 | : locate a BSD compatible install program | |
2334 | echo " " | |
2335 | echo "Looking for a BSD-compatible install program..." >&4 | |
2336 | creatdir='' | |
2337 | case "$install" in | |
2338 | '') | |
2339 | tryit='' | |
2340 | for dir in $pth; do | |
2341 | for file in ginstall installbsd scoinst install; do | |
2342 | if $test -f $dir/$file; then | |
2343 | tryit="$tryit $dir/$file" | |
2344 | fi | |
2345 | done | |
2346 | done | |
2347 | $cat >try.c <<EOC | |
2348 | main() | |
2349 | { | |
2350 | printf("OK\n"); | |
2351 | exit(0); | |
2352 | } | |
2353 | EOC | |
2354 | if $cc try.c -o try >/dev/null 2>&1; then | |
2355 | cp try try.ns | |
2356 | strip try >/dev/null 2>&1 | |
2357 | else | |
2358 | echo "(I can't seem to compile a trivial C program -- bypassing.)" | |
2359 | echo "try" >try | |
2360 | cp try try.ns | |
2361 | fi | |
2362 | $cat >tryinst <<EOS | |
2363 | $startsh | |
2364 | $rm -rf foo d | |
2365 | \$1 -d foo/bar | |
2366 | $mkdir d | |
2367 | \$1 -c -m 764 try.ns d | |
2368 | \$1 -c -s -m 642 try.ns d/try | |
2369 | EOS | |
2370 | chmod +x tryinst | |
2371 | $eunicefix tryinst | |
2372 | dflt='' | |
2373 | either='' | |
2374 | for prog in $tryit; do | |
2375 | $echo $n "Checking $prog... $c" | |
2376 | ./tryinst $prog >/dev/null 2>&1 | |
2377 | if $test -d foo/bar; then | |
2378 | creatdir="$prog -d" | |
2379 | fi | |
2380 | (ls -l d/try >try.ls; ls -l d/try.ns >tryno.ls) 2>/dev/null | |
2381 | if (cmp -s d/try try && cmp -s d/try.ns try.ns && \ | |
2382 | $contains 'rwxrw-r--' tryno.ls && \ | |
2383 | $contains 'rw-r---w-' try.ls) >/dev/null 2>&1 | |
2384 | then | |
2385 | dflt="$prog" | |
2386 | echo "ok, that will do." | |
2387 | break | |
2388 | fi | |
2389 | echo "not good$either." | |
2390 | either=' either' | |
2391 | $rm -f try*.ls | |
2392 | done | |
2393 | $rm -rf foo d tryinst try try*.ls try.* | |
2394 | case "$dflt" in | |
2395 | '') | |
2396 | echo "Hopefully, $package comes with its own install script!" | |
2397 | dflt='./install' | |
2398 | ;; | |
2399 | esac | |
2400 | ;; | |
2401 | *) dflt="$install";; | |
2402 | esac | |
2403 | $cat <<EOM | |
2404 | ||
2405 | I will be requiring a BSD-compatible install program (one that allows | |
2406 | options like -s to strip executables or -m to specify a file mode) to | |
2407 | install $package. | |
2408 | ||
2409 | If the question below contains a fully qualified default path, then it | |
2410 | is probably ok. If it is an unqualified name such as 'install', then it | |
2411 | means I was unable to find out a good install program I could use. If | |
2412 | you know of one, please tell me about it. If the default is './install', | |
2413 | then I shall be using the install script supplied with $package. | |
2414 | ||
2415 | EOM | |
2416 | fn='/fe~(install,./install)' | |
2417 | rp='Which install program shall I use?' | |
2418 | . ./getfile | |
2419 | install="$ans" | |
2420 | ||
2421 | : how can we create nested directories? | |
2422 | echo " " | |
2423 | echo "Ok, let's see how we can create nested directories..." >&4 | |
2424 | case "$installdir" in | |
2425 | '') | |
2426 | case "$creatdir" in | |
2427 | '') | |
2428 | $mkdir -p foo/bar >/dev/null 2>&1 | |
2429 | if $test -d foo/bar; then | |
2430 | echo "Great, we can build them using 'mkdir -p'." | |
2431 | creatdir='mkdir -p' | |
2432 | elif eval "$install -d foo/bar"; $test -d foo/bar; then | |
2433 | creatdir="install -d" | |
2434 | echo "It looks like '$creatdir' will do it for us." | |
2435 | fi | |
2436 | ;; | |
2437 | *) | |
2438 | eval "$creatdir foo/bar" >/dev/null 2>&1 | |
2439 | if $test -d foo/bar; then | |
2440 | echo "Ah! We can use '$creatdir' to do just that." | |
2441 | fi | |
2442 | ;; | |
2443 | esac | |
2444 | $rm -rf foo | |
2445 | case "$creatdir" in | |
2446 | '') | |
2447 | echo "Heck! Another ancient system lacking the comfort of modern ones!" | |
2448 | echo "You can thank $package for bringing you its own install script!" | |
2449 | installdir='./install -d' | |
2450 | ;; | |
2451 | *) installdir="$creatdir";; | |
2452 | esac | |
2453 | ;; | |
2454 | *) echo "As you already told me, '$installdir' should work.";; | |
2455 | esac | |
2456 | ||
2457 | : determine the name of a reasonable mailer | |
2458 | case "$mailer" in | |
2459 | '') | |
2460 | if $test -f "$sendmail"; then | |
2461 | dflt="$sendmail" | |
2462 | elif $test -f "$smail"; then | |
2463 | dflt="$smail" | |
2464 | elif $test -f "$rmail"; then | |
2465 | dflt="$rmail" | |
2466 | elif $test -f /bin/mail; then | |
2467 | dflt=/bin/mail | |
2468 | else | |
2469 | dflt=$mail | |
2470 | fi | |
2471 | ;; | |
2472 | *) dflt="$mailer";; | |
2473 | esac | |
2474 | $cat <<EOM | |
2475 | ||
2476 | I need the full pathname of the program used to deliver mail on your system. | |
2477 | A typical answer would be /usr/lib/sendmail or /bin/rmail, but you may choose | |
2478 | any other program, as long as it can be fed from standard input and will | |
2479 | honour any user-supplied headers. | |
2480 | ||
2481 | EOM | |
2482 | fn=f | |
2483 | rp='Mail transport agent to be used?' | |
2484 | . ./getfile | |
2485 | mailer="$ans" | |
2486 | ||
2487 | : see how we invoke the C preprocessor | |
2488 | echo " " | |
2489 | echo "Now, how can we feed standard input to your C preprocessor..." >&4 | |
2490 | cat <<'EOT' >testcpp.c | |
2491 | #define ABC abc | |
2492 | #define XYZ xyz | |
2493 | ABC.XYZ | |
2494 | EOT | |
2495 | cd .. | |
2496 | echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin | |
2497 | chmod 755 cppstdin | |
2498 | wrapper=`pwd`/cppstdin | |
2499 | ok='false' | |
2500 | cd UU | |
2501 | ||
2502 | if $test "X$cppstdin" != "X" && \ | |
2503 | $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \ | |
2504 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 | |
2505 | then | |
2506 | echo "You used to use $cppstdin $cppminus so we'll use that again." | |
2507 | case "$cpprun" in | |
2508 | '') echo "But let's see if we can live without a wrapper..." ;; | |
2509 | *) | |
2510 | if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \ | |
2511 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 | |
2512 | then | |
2513 | echo "(And we'll use $cpprun $cpplast to preprocess directly.)" | |
2514 | ok='true' | |
2515 | else | |
2516 | echo "(However, $cpprun $cpplast does not work, let's see...)" | |
2517 | fi | |
2518 | ;; | |
2519 | esac | |
2520 | else | |
2521 | case "$cppstdin" in | |
2522 | '') ;; | |
2523 | *) | |
2524 | echo "Good old $cppstdin $cppminus does not seem to be of any help..." | |
2525 | ;; | |
2526 | esac | |
2527 | fi | |
2528 | ||
2529 | if $ok; then | |
2530 | : nothing | |
2531 | elif echo 'Maybe "'"$cc"' -E" will work...'; \ | |
2532 | $cc -E <testcpp.c >testcpp.out 2>&1; \ | |
2533 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
2534 | echo "Yup, it does." | |
2535 | x_cpp="$cc -E" | |
2536 | x_minus=''; | |
2537 | elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \ | |
2538 | $cc -E - <testcpp.c >testcpp.out 2>&1; \ | |
2539 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
2540 | echo "Yup, it does." | |
2541 | x_cpp="$cc -E" | |
2542 | x_minus='-'; | |
2543 | elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \ | |
2544 | $cc -P <testcpp.c >testcpp.out 2>&1; \ | |
2545 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
2546 | echo "Yipee, that works!" | |
2547 | x_cpp="$cc -P" | |
2548 | x_minus=''; | |
2549 | elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \ | |
2550 | $cc -P - <testcpp.c >testcpp.out 2>&1; \ | |
2551 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
2552 | echo "At long last!" | |
2553 | x_cpp="$cc -P" | |
2554 | x_minus='-'; | |
2555 | elif echo 'No such luck, maybe "'$cpp'" will work...'; \ | |
2556 | $cpp <testcpp.c >testcpp.out 2>&1; \ | |
2557 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
2558 | echo "It works!" | |
2559 | x_cpp="$cpp" | |
2560 | x_minus=''; | |
2561 | elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \ | |
2562 | $cpp - <testcpp.c >testcpp.out 2>&1; \ | |
2563 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
2564 | echo "Hooray, it works! I was beginning to wonder." | |
2565 | x_cpp="$cpp" | |
2566 | x_minus='-'; | |
2567 | elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \ | |
2568 | $wrapper <testcpp.c >testcpp.out 2>&1; \ | |
2569 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
2570 | x_cpp="$wrapper" | |
2571 | x_minus='' | |
2572 | echo "Eureka!" | |
2573 | else | |
2574 | dflt='' | |
2575 | rp="No dice. I can't find a C preprocessor. Name one:" | |
2576 | . ./myread | |
2577 | x_cpp="$ans" | |
2578 | x_minus='' | |
2579 | $x_cpp <testcpp.c >testcpp.out 2>&1 | |
2580 | if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
2581 | echo "OK, that will do." >&4 | |
2582 | else | |
2583 | echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4 | |
2584 | exit 1 | |
2585 | fi | |
2586 | fi | |
2587 | ||
2588 | case "$ok" in | |
2589 | false) | |
2590 | cppstdin="$x_cpp" | |
2591 | cppminus="$x_minus" | |
2592 | cpprun="$x_cpp" | |
2593 | cpplast="$x_minus" | |
2594 | set X $x_cpp | |
2595 | shift | |
2596 | case "$1" in | |
2597 | "$cpp") | |
2598 | echo "Perhaps can we force $cc -E using a wrapper..." | |
2599 | if $wrapper <testcpp.c >testcpp.out 2>&1; \ | |
2600 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 | |
2601 | then | |
2602 | echo "Yup, we can." | |
2603 | cppstdin="$wrapper" | |
2604 | cppminus=''; | |
2605 | else | |
2606 | echo "Nope, we'll have to live without it..." | |
2607 | fi | |
2608 | ;; | |
2609 | esac | |
2610 | case "$cpprun" in | |
2611 | "$wrapper") | |
2612 | cpprun='' | |
2613 | cpplast='' | |
2614 | ;; | |
2615 | esac | |
2616 | ;; | |
2617 | esac | |
2618 | ||
2619 | case "$cppstdin" in | |
2620 | "$wrapper") ;; | |
2621 | *) $rm -f $wrapper;; | |
2622 | esac | |
2623 | $rm -f testcpp.c testcpp.out | |
2624 | ||
2625 | : Define several unixisms. | |
2626 | : Hints files or command line option can be used to override them. | |
2627 | case "$_a" in | |
2628 | '') _a='.a';; | |
2629 | esac | |
2630 | case "$_o" in | |
2631 | '') _o='.o';; | |
2632 | esac | |
2633 | ||
2634 | : find out how to generate dependencies | |
2635 | echo " " | |
2636 | echo "Checking how to generate makefile dependencies on your machine..." >&4 | |
2637 | toplev=`cd ..;pwd` | |
2638 | $cat >dep.c <<'EOCP' | |
2639 | #include "dep.h" | |
2640 | EOCP | |
2641 | $cat >dep.h <<'EOCP' | |
2642 | ||
2643 | EOCP | |
2644 | takeflags='flags="" | |
2645 | case "$@" in | |
2646 | *--*) | |
2647 | for arg | |
2648 | do | |
2649 | shift | |
2650 | case "$arg" in | |
2651 | --) break;; | |
2652 | *) flags="$flags $arg";; | |
2653 | esac | |
2654 | done;; | |
2655 | esac' | |
2656 | case "$mkdep" in | |
2657 | '') | |
2658 | ;; | |
2659 | *) | |
2660 | if test -x "$mkdep" && | |
2661 | $mkdep dep.c >dep.out 2>/dev/null && | |
2662 | $contains "dep\$_o:.*dep\.h" dep.out >/dev/null 2>&1 | |
2663 | then | |
2664 | echo "$mkdep works." | |
2665 | else | |
2666 | mkdep= | |
2667 | fi | |
2668 | esac | |
2669 | ||
2670 | case "$mkdep" in | |
2671 | '') | |
2672 | $spitshell > ../mkdep <<EOM | |
2673 | $startsh | |
2674 | $takeflags | |
2675 | for srcfile | |
2676 | do | |
2677 | $cpp -M -I. $cppflags \$flags \$srcfile 2>/dev/null | |
2678 | done | |
2679 | exit 0 | |
2680 | EOM | |
2681 | mkdep=$toplev/mkdep | |
2682 | chmod +x $mkdep | |
2683 | $eunicefix $mkdep | |
2684 | if $mkdep dep.c >dep.out 2>/dev/null && | |
2685 | $contains "dep$_o:.*dep\.h" dep.out >/dev/null 2>&1 | |
2686 | then | |
2687 | echo "Looks like we can use $cpp -M." | |
2688 | else | |
2689 | mkdep= | |
2690 | fi | |
2691 | ;; | |
2692 | esac | |
2693 | ||
2694 | case "$mkdep" in | |
2695 | '') | |
2696 | $spitshell > ../mkdep <<EOM | |
2697 | $startsh | |
2698 | $takeflags | |
2699 | for srcfile | |
2700 | do | |
2701 | $cc -MM -I. $cppflags \$flags \$srcfile 2>/dev/null | |
2702 | done | |
2703 | exit 0 | |
2704 | EOM | |
2705 | mkdep=$toplev/mkdep | |
2706 | chmod +x $mkdep | |
2707 | $eunicefix $mkdep | |
2708 | if $mkdep dep.c >dep.out 2>/dev/null && | |
2709 | $contains "dep$_o: dep.h" dep.out >/dev/null 2>&1 | |
2710 | then | |
2711 | echo "Looks like we can use $cc -MM." | |
2712 | else | |
2713 | mkdep= | |
2714 | fi | |
2715 | ;; | |
2716 | esac | |
2717 | ||
2718 | case "$mkdep" in | |
2719 | '') | |
2720 | $spitshell >../mkdep <<EOS | |
2721 | $startsh | |
2722 | $takeflags | |
2723 | for srcfile | |
2724 | do | |
2725 | case "\$srcfile" in | |
2726 | *.c) c='.c';; | |
2727 | *.y) c='.y';; | |
2728 | *.l) c='.l';; | |
2729 | esac | |
2730 | filebase=\`basename \$srcfile \$c\` | |
2731 | <\$srcfile $cpp $cppminus $cppflags -I. \$flags 2>/dev/null | \\ | |
2732 | $sed -e '/^# *[0-9]/!d' \\ | |
2733 | -e 's/^.*"\(.*\)".*\$/'\$filebase'$_o: \1/' \\ | |
2734 | -e 's|: \./|: |' \\ | |
2735 | -e 's|: *$|: '\$srcfile'|' | \\ | |
2736 | $grep -v '^#' | $sort | $uniq | |
2737 | done | |
2738 | exit 0 | |
2739 | EOS | |
2740 | mkdep=$toplev/mkdep | |
2741 | chmod +x $mkdep | |
2742 | $eunicefix $mkdep | |
2743 | if $mkdep dep.c >dep.out 2>/dev/null && | |
2744 | $contains "dep$_o:.*dep\.h" dep.out >/dev/null 2>&1 | |
2745 | then | |
2746 | echo "A shell script using $cpp does the trick." | |
2747 | else | |
2748 | echo "$cpp doesn't seem to be any use at all." | |
2749 | $spitshell >../mkdep <<EOS | |
2750 | $startsh | |
2751 | $takeflags | |
2752 | files="\$@" | |
2753 | set X \$flags | |
2754 | shift | |
2755 | inc='.' | |
2756 | while test \$# -gt 0 | |
2757 | do | |
2758 | case "\$1" in | |
2759 | -I) | |
2760 | shift | |
2761 | inc="\$inc:\$1" | |
2762 | ;; | |
2763 | -I*) | |
2764 | dir=\`echo \$1 | sed -e 's/^-I//'\` | |
2765 | inc="\$inc:\$dir" | |
2766 | ;; | |
2767 | esac | |
2768 | shift | |
2769 | done | |
2770 | set X \$files | |
2771 | shift | |
2772 | trap "$rm -f /tmp/mkdep\$\$; exit 1" 1 2 3 15 | |
2773 | for srcfile | |
2774 | do | |
2775 | case "\$srcfile" in | |
2776 | *.c) c='.c';; | |
2777 | *.y) c='.y';; | |
2778 | *.l) c='.l';; | |
2779 | esac | |
2780 | filebase=\`basename \$srcfile \$c\` | |
2781 | echo \$filebase$_o: \$srcfile | |
2782 | $grep '^#[ ]*include' \$srcfile /dev/null | \ | |
2783 | $sed -n -e 's/#[ ]*include[ ]*//' \\ | |
2784 | -e '/<\(.*\)>/ d' \\ | |
2785 | -e 's/:[^"]*"\([^"]*\)".*/: \1/' \\ | |
2786 | -e "s/\\.c:/$_o:/p" > /tmp/mkdep\$\$ | |
2787 | IFS=': ' | |
2788 | while read file dep; do | |
2789 | for dir in \$inc; do | |
2790 | if $test -f "\$dir/\$dep"; then | |
2791 | dep="\$dir/\$dep" | |
2792 | break | |
2793 | fi | |
2794 | done | |
2795 | echo "\$file: \$dep" | $sed -e 's,: \./,: ,' | |
2796 | done </tmp/mkdep\$\$ | |
2797 | IFS=' ' | |
2798 | $rm -f /tmp/mkdep\$\$ | |
2799 | done | |
2800 | exit 0 | |
2801 | EOS | |
2802 | mkdep=$toplev/mkdep | |
2803 | chmod +x $mkdep | |
2804 | $eunicefix $mkdep | |
2805 | if $mkdep dep.c >dep.out 2>/dev/null && | |
2806 | $contains "dep$_o:.*dep\.h" dep.out >/dev/null 2>&1 | |
2807 | then | |
2808 | cat << EOM | |
2809 | ||
2810 | I can use a script with grep instead, but it will make some incorrect | |
2811 | dependencies, since it doesn't understand about conditional compilation. | |
2812 | Moreover, some dependencies may be missing, because scanning won't be | |
2813 | a recursive process. | |
2814 | If you have a program which generates makefile dependencies, you may want | |
2815 | to use it. If not, you can use the script and edit the Makefile by hand | |
2816 | if you need to. | |
2817 | EOM | |
2818 | else | |
2819 | mkdep= | |
2820 | cat << EOM | |
2821 | ||
2822 | I can't seem to generate makefile dependencies at all! Perhaps you have a | |
2823 | program that does? If you don't, you might look at the mkdep script to | |
2824 | see if you can create one which works. | |
2825 | EOM | |
2826 | fi | |
2827 | fi | |
2828 | esac | |
2829 | dflt="$mkdep" | |
2830 | fn=f~/ | |
2831 | rp="Name of program to make makefile dependencies?" | |
2832 | . ./getfile | |
2833 | mkdep="$ans" | |
2834 | $rm -f dep.c dep.h dep$_o dep.out | |
2835 | ||
2836 | : find out how to find out full name | |
2837 | case "$d_berknames" in | |
2838 | "$define") | |
2839 | dflt=y;; | |
2840 | "$undef") | |
2841 | dflt=n;; | |
2842 | *) | |
2843 | if ./bsd; then | |
2844 | dflt=y | |
2845 | elif ./xenix; then | |
2846 | dflt=y | |
2847 | else | |
2848 | dflt=n | |
2849 | fi | |
2850 | ;; | |
2851 | esac | |
2852 | $cat <<'EOM' | |
2853 | ||
2854 | Does your /etc/passwd file keep full names in Berkeley/V7 format (name first | |
2855 | thing after ':' in GCOS field)? In that case, a typical entry in the password | |
2856 | file looks like this: | |
2857 | ||
2858 | guest:**paswword**:10:100:Mister Guest User:/usr/users:/bin/sh | |
2859 | ^^^^^^^^^^^^^^^^^ | |
2860 | EOM | |
2861 | rp="Berkeley/V7 format for full name in /etc/passwd?" | |
2862 | . ./myread | |
2863 | case "$ans" in | |
2864 | y*) d_passnames="$define" | |
2865 | d_berknames="$define" | |
2866 | d_usgnames="$undef" | |
2867 | nametype=bsd | |
2868 | ;; | |
2869 | *) | |
2870 | case "$d_usgnames" in | |
2871 | "$define") dflt=y;; | |
2872 | "$undef") dflt=n;; | |
2873 | *) | |
2874 | if ./usg; then | |
2875 | dflt=y | |
2876 | else | |
2877 | dflt=n | |
2878 | fi | |
2879 | ;; | |
2880 | esac | |
2881 | $cat <<'EOM' | |
2882 | ||
2883 | Does your passwd file keep full names in USG format (name sandwiched between a | |
2884 | '-' and a '(')? In that case, a typical entry in the password file looks like | |
2885 | this: | |
2886 | ||
2887 | guest:**paswword**:10:100:000-Mister Guest User(000):/usr/users:/bin/sh | |
2888 | ^^^^^^^^^^^^^^^^^ | |
2889 | EOM | |
2890 | rp="USG format for full name in /etc/passwd?" | |
2891 | . ./myread | |
2892 | case "$ans" in | |
2893 | n*) echo "Full name will be taken from ~/.fullname" | |
2894 | d_passnames="$undef" | |
2895 | d_berknames="$undef" | |
2896 | d_usgnames="$undef" | |
2897 | nametype=other | |
2898 | ;; | |
2899 | *) | |
2900 | d_passnames="$define" | |
2901 | d_berknames="$undef" | |
2902 | d_usgnames="$define" | |
2903 | nametype=usg | |
2904 | ;; | |
2905 | esac;; | |
2906 | esac | |
2907 | ||
2908 | : get organization name | |
2909 | longshots='/local/src /usr/src/new /usr/src/local /usr/local/src' | |
2910 | case "$orgname" in | |
2911 | '') if xxx=`./loc news/src/defs.h x $longshots`; then | |
2912 | dflt=`$sed -n 's/^.*MYORG[ ]*"\(.*\)".*$/\1/p' $xxx` | |
2913 | else | |
2914 | dflt='' | |
2915 | fi | |
2916 | ;; | |
2917 | *) dflt="$orgname";; | |
2918 | esac | |
2919 | $cat << 'EOH' | |
2920 | ||
2921 | Please type the name of your organization as you want it to appear on the | |
2922 | Organization line of outgoing articles. (It's nice if this also specifies | |
2923 | your location. Your city name is probably sufficient if well known.) | |
2924 | For example: | |
2925 | ||
2926 | University of Southern North Dakota, Hoople | |
2927 | ||
2928 | You may also put the name of a file, as long as it begins with a slash. | |
2929 | For example: | |
2930 | ||
2931 | /etc/organization | |
2932 | ||
2933 | EOH | |
2934 | orgname="" | |
2935 | while test "X$orgname" = "X"; do | |
2936 | rp='Organization:' | |
2937 | . ./myread | |
2938 | orgname="$ans" | |
2939 | done | |
2940 | ||
2941 | : locate the preferred pager for this system | |
2942 | case "$pager" in | |
2943 | '') | |
2944 | dflt='' | |
2945 | case "$pg" in | |
2946 | /*) dflt=$pg;; | |
2947 | esac | |
2948 | case "$more" in | |
2949 | /*) dflt=$more;; | |
2950 | esac | |
2951 | case "$less" in | |
2952 | /*) dflt=$less;; | |
2953 | esac | |
2954 | case "$dflt" in | |
2955 | '') dflt=/usr/ucb/more;; | |
2956 | esac | |
2957 | ;; | |
2958 | *) dflt="$pager";; | |
2959 | esac | |
2960 | echo " " | |
2961 | fn=f/ | |
2962 | rp='What pager is used on your system?' | |
2963 | . ./getfile | |
2964 | pager="$ans" | |
2965 | ||
2966 | : get the patchlevel | |
2967 | echo " " | |
2968 | echo "Getting the current patchlevel..." >&4 | |
2969 | if $test -r $rsrc/patchlevel.h;then | |
2970 | patchlevel=`awk '/PATCHLEVEL/ {print $3}' < $rsrc/patchlevel.h` | |
2971 | else | |
2972 | patchlevel=0 | |
2973 | fi | |
2974 | echo "(You have $package $baserev PL$patchlevel.)" | |
2975 | ||
2976 | : determine perl absolute location | |
2977 | case "$perlpath" in | |
2978 | '') | |
2979 | if test -f /usr/bin/perl; then | |
2980 | dflt=/usr/bin/perl | |
2981 | else | |
2982 | case "$perl" in | |
2983 | */*) dflt="$perl";; | |
2984 | *) dflt=/usr/bin/perl;; | |
2985 | esac | |
2986 | fi | |
2987 | ;; | |
2988 | *) dflt="$perlpath" | |
2989 | ;; | |
2990 | esac | |
2991 | echo " " | |
2992 | fn=f~/ | |
2993 | rp="Where is perl located on your system?" | |
2994 | . ./getfile | |
2995 | perlpath="$ans" | |
2996 | ||
2997 | : figure out how to guarantee perl startup | |
2998 | case "$sharpbang" in | |
2999 | *!) | |
3000 | $cat >xtry <<EOP | |
3001 | #!$perlpath | |
3002 | system("exit 0"); | |
3003 | EOP | |
3004 | chmod a+x xtry | |
3005 | if ./xtry >/dev/null 2>&1; then | |
3006 | $cat <<EOH | |
3007 | ||
3008 | I can use the #! construct to start perl on your system. This will make | |
3009 | startup of perl scripts faster, but may cause problems if you want to share | |
3010 | those scripts and perl is not in a standard place (/usr/bin/perl) on all your | |
3011 | platforms. The alternative is to force a shell by starting the script with a | |
3012 | single ':' character. | |
3013 | ||
3014 | EOH | |
3015 | pdflt=y | |
3016 | else | |
3017 | $cat <<EOH | |
3018 | ||
3019 | I could use the #! construct to start perl on your system, but using | |
3020 | #!$perlpath | |
3021 | would be too long for your kernel to grok. Indeed, most systems do | |
3022 | limit the size of the leading #! string to 32 characters. | |
3023 | ||
3024 | EOH | |
3025 | pdflt=n | |
3026 | fi | |
3027 | $rm -f xtry | |
3028 | case "$startperl" in | |
3029 | *!*) dflt=y;; | |
3030 | '') case "$d_portable" in | |
3031 | "$define") dflt=n;; | |
3032 | *) dflt=$pdflt;; | |
3033 | esac;; | |
3034 | esac | |
3035 | rp='Shall I use #! to start up perl?' | |
3036 | . ./myread | |
3037 | case "$ans" in | |
3038 | y*|Y*) startperl="#!$perlpath";; | |
3039 | *) startperl=": # use perl";; | |
3040 | esac;; | |
3041 | *) startperl=": # use perl";; | |
3042 | esac | |
3043 | ||
3044 | : notify author that his package is used | |
3045 | if $test -f ../.config/mailauthor && | |
3046 | cmp $rsrc/patchlevel.h ../.config/mailauthor >/dev/null 2>&1 | |
3047 | then | |
3048 | status="say that you're using $package"; | |
3049 | case "$mailpatches" in | |
3050 | true) status='have patches mailed to you as they are issued';; | |
3051 | esac | |
3052 | case "$notifypatches" in | |
3053 | true) status='be notified when new patches are issued';; | |
3054 | esac | |
3055 | $cat <<EOM | |
3056 | ||
3057 | You have already sent the author of $package (Raphael_Manfredi@grenoble.hp.com) mail to | |
3058 | $status. If you wish, you may modify | |
3059 | your previous request by sending a new mail with different options. | |
3060 | ||
3061 | EOM | |
3062 | rp='Should I send a status update to Raphael_Manfredi@grenoble.hp.com?' | |
3063 | dflt=n | |
3064 | else | |
3065 | $cat <<EOM | |
3066 | ||
3067 | If you are able to send mail to the Internet, the author of $package would | |
3068 | really appreciate you letting me send off a quick note, just to say that you've | |
3069 | tried it. The author is more likely to spend time maintaining $package if it's | |
3070 | known that many people are using it, and you can even ask to get sent new | |
3071 | patches automagically this way if you wish. To protect your privacy, all I'll | |
3072 | say in the mail is the version of $package that you're using. | |
3073 | ||
3074 | EOM | |
3075 | rp='Should I send mail to Raphael_Manfredi@grenoble.hp.com?' | |
3076 | dflt=y | |
3077 | $test -f ../.config/nomail && dflt=n | |
3078 | fi | |
3079 | . ./myread | |
3080 | case "$ans" in | |
3081 | [yY]*) | |
3082 | echo " " | |
3083 | echo "Great! Your cooperation is really appreciated." | |
3084 | $cat <<EOM | |
3085 | ||
3086 | Some braindead sites do not set a proper return address in the From: header of | |
3087 | their outgoing mail, making it impossible to reply to mail they generate. | |
3088 | If your site is broken in this way, write to your system administrator and get | |
3089 | it fixed!!! In the mean time, you can manually specify the Internet e-mail | |
3090 | address by which the author can get back to you, should there be a need to do | |
3091 | so. If manually specified, it should be something like "user@domain.top". | |
3092 | If your mail system generates addresses correctly, specify "none". | |
3093 | ||
3094 | EOM | |
3095 | case "$usermail" in | |
3096 | '-'|'') dflt=none;; | |
3097 | *) dflt="$usermail";; | |
3098 | esac | |
3099 | rp='Manually specify a return address to use:' | |
3100 | . ./myread | |
3101 | case "$ans" in | |
3102 | none|*@*.*) | |
3103 | case "$ans" in | |
3104 | none) usermail='-';; | |
3105 | *) usermail="$ans";; | |
3106 | esac | |
3107 | ;; | |
3108 | *) | |
3109 | echo "(Address does not look like an Internet one -- ignoring it.)" | |
3110 | usermail='-' | |
3111 | mailpatches=false | |
3112 | notifypatches=false | |
3113 | ;; | |
3114 | esac | |
3115 | echo " " | |
3116 | opt='' | |
3117 | rp='Would you like to have new patches automatically mailed to you?' | |
3118 | case "$mailpatches" in | |
3119 | true) dflt=y;; | |
3120 | *) dflt=n;; | |
3121 | esac | |
3122 | . ./myread | |
3123 | case "$ans" in | |
3124 | [yY]*) opt=' mailpatches'; mailpatches=true;; | |
3125 | *) | |
3126 | mailpatches=false | |
3127 | echo " " | |
3128 | rp='Ok, would you like to simply be notified of new patches?' | |
3129 | case "$notifypatches" in | |
3130 | false) dflt=n;; | |
3131 | *) dflt=y;; | |
3132 | esac | |
3133 | . ./myread | |
3134 | echo " " | |
3135 | case "$ans" in | |
3136 | [yY]*) opt=' notifypatches'; notifypatches=true;; | |
3137 | *) | |
3138 | echo "Fine, I'll simply say that you've tried it then." | |
3139 | notifypatches=false | |
3140 | ;; | |
3141 | esac | |
3142 | ;; | |
3143 | esac | |
3144 | echo "Sending mail to Raphael_Manfredi@grenoble.hp.com..." >&4 | |
3145 | atsh='@SH' | |
3146 | $mailer Raphael_Manfredi@grenoble.hp.com <<EOM >/dev/null 2>&1 | |
3147 | Subject: Command | |
3148 | Precedence: junk | |
3149 | To: Raphael_Manfredi@grenoble.hp.com | |
3150 | ||
3151 | $atsh package $usermail $package $baserev $patchlevel$opt | |
3152 | EOM | |
3153 | $rm -f ../.config/mailauthor ../.config/nomail | |
3154 | cp $rsrc/patchlevel.h ../.config/mailauthor | |
3155 | ;; | |
3156 | *) | |
3157 | case "$dflt" in | |
3158 | "y") | |
3159 | echo "Oh well, maybe next time." | |
3160 | cp /dev/null ../.config/nomail | |
3161 | ;; | |
3162 | esac | |
3163 | ;; | |
3164 | esac | |
3165 | ||
3166 | : figure out their full name | |
3167 | case "$NAME" in | |
3168 | '') case "$nametype" in | |
3169 | other) | |
3170 | fn=`./filexp ~/.fullname` | |
3171 | xxx=usg | |
3172 | $test -f $fn && xxx=other | |
3173 | ;; | |
3174 | *) | |
3175 | xxx="$nametype" | |
3176 | ;; | |
3177 | esac | |
3178 | ||
3179 | case "$xxx" in | |
3180 | bsd) | |
3181 | cf_name=`$passcat | grep "^$cf_by:" | \ | |
3182 | sed -e 's/^[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\):.*/\1/' \ | |
3183 | -e 's/,.*//'` | |
3184 | ;; | |
3185 | usg) | |
3186 | cf_name=`$passcat | grep "^$cf_by:" | \ | |
3187 | sed -e 's/^[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\):.*/\1/' \ | |
3188 | -e 's/[^-]*-\(.*\)(.*)/\1/'` | |
3189 | ;; | |
3190 | *) | |
3191 | cf_name=`$cat $fn` | |
3192 | ;; | |
3193 | esac | |
3194 | ;; | |
3195 | *) | |
3196 | cf_name="$NAME" | |
3197 | ;; | |
3198 | esac | |
3199 | echo " " | |
3200 | echo "Pleased to meet you, $cf_name." | |
3201 | ||
3202 | : offer to join the mailing list | |
3203 | list_request='majordomo@foretune.co.jp' | |
3204 | list_sub="subscribe dist-users $cf_email" | |
3205 | list_unsub="unsubscribe dist-users $cf_email" | |
3206 | list_name="dist-users" | |
3207 | $cat <<EOM | |
3208 | ||
3209 | There is a mailing list for discussion about $package and related issues. | |
3210 | This is the preferred place to ask questions about the program and discuss | |
3211 | modifications and additions with the author and other users. If you are able | |
3212 | to send mail to the Internet, you are encouraged to subscribe. You need only | |
3213 | ever subscribe once, and you can unsubscribe automatically at any time in the | |
3214 | future. If you have already subscribed and you wish to unsubscribe now, you | |
3215 | may do so by answering "unsubscribe". Answer "subscribe" to subscribe to the | |
3216 | list. | |
3217 | ||
3218 | EOM | |
3219 | rp="Subscribe to or unsubscribe from the $list_name mailing list?" | |
3220 | dflt=neither | |
3221 | . ./myread | |
3222 | case "$ans" in | |
3223 | [sS]*) $cat <<EOM | |
3224 | ||
3225 | You will be sent a message from the list server to let you know when your | |
3226 | subscription has been successful and telling you how to submit articles and | |
3227 | how to unsubscribe again when necessary. You may also unsubscribe by running | |
3228 | this script again and asking it to do so for you. | |
3229 | ||
3230 | EOM | |
3231 | echo "Sending mail to subscribe you to the $list_name list..." >&4 | |
3232 | $mailer $list_request <<EOM >/dev/null 2>&1 | |
3233 | Precedence: junk | |
3234 | To: $list_request | |
3235 | ||
3236 | $list_sub | |
3237 | EOM | |
3238 | ;; | |
3239 | [uU]*) echo "Sending mail to unsubscribe you from the $list_name list..." >&4 | |
3240 | $mailer $list_request <<EOM >/dev/null 2>&1 | |
3241 | Precedence: junk | |
3242 | To: $list_request | |
3243 | ||
3244 | $list_unsub | |
3245 | EOM | |
3246 | ;; | |
3247 | esac | |
3248 | ||
3249 | : end of configuration questions | |
3250 | echo " " | |
3251 | echo "End of configuration questions." | |
3252 | echo " " | |
3253 | ||
3254 | : back to where it started | |
3255 | if test -d ../UU; then | |
3256 | cd .. | |
3257 | fi | |
3258 | ||
3259 | : configuration may be patched via a 'config.over' file | |
3260 | if $test -f config.over; then | |
3261 | echo " " | |
3262 | dflt=y | |
3263 | rp='I see a config.over file. Do you wish to load it?' | |
3264 | . UU/myread | |
3265 | case "$ans" in | |
3266 | n*) echo "OK, I'll ignore it.";; | |
3267 | *) . ./config.over | |
3268 | echo "Configuration override changes have been loaded." | |
3269 | ;; | |
3270 | esac | |
3271 | fi | |
3272 | ||
3273 | : in case they want portability, strip down executable paths | |
3274 | case "$d_portable" in | |
3275 | "$define") | |
3276 | echo " " | |
3277 | echo "Stripping down executable paths..." >&4 | |
3278 | for file in $loclist $trylist; do | |
3279 | eval $file="\$file" | |
3280 | done | |
3281 | ;; | |
3282 | esac | |
3283 | ||
3284 | : create config.sh file | |
3285 | echo " " | |
3286 | echo "Creating config.sh..." >&4 | |
3287 | $spitshell <<EOT >config.sh | |
3288 | $startsh | |
3289 | # | |
3290 | # This file was produced by running the Configure script. It holds all the | |
3291 | # definitions figured out by Configure. Should you modify one of these values, | |
3292 | # do not forget to propagate your changes by running "Configure -der". You may | |
3293 | # instead choose to run each of the .SH files by yourself, or "Configure -S". | |
3294 | # | |
3295 | ||
3296 | # Package name : $package | |
3297 | # Source directory : $src | |
3298 | # Configuration time: $cf_time | |
3299 | # Configured by : $cf_by | |
3300 | # Target system : $myuname | |
3301 | ||
3302 | Author='$Author' | |
3303 | Date='$Date' | |
3304 | Header='$Header' | |
3305 | Id='$Id' | |
3306 | Locker='$Locker' | |
3307 | Log='$Log' | |
3308 | Mcc='$Mcc' | |
3309 | RCSfile='$RCSfile' | |
3310 | Revision='$Revision' | |
3311 | Source='$Source' | |
3312 | State='$State' | |
3313 | afs='$afs' | |
3314 | ar='$ar' | |
3315 | archobjs='$archobjs' | |
3316 | awk='$awk' | |
3317 | baserev='$baserev' | |
3318 | bash='$bash' | |
3319 | bison='$bison' | |
3320 | byacc='$byacc' | |
3321 | c='$c' | |
3322 | cat='$cat' | |
3323 | cf_by='$cf_by' | |
3324 | cf_email='$cf_email' | |
3325 | cf_time='$cf_time' | |
3326 | chgrp='$chgrp' | |
3327 | chmod='$chmod' | |
3328 | chown='$chown' | |
3329 | comm='$comm' | |
3330 | compress='$compress' | |
3331 | contains='$contains' | |
3332 | cp='$cp' | |
3333 | cpio='$cpio' | |
3334 | cpp='$cpp' | |
3335 | cpplast='$cpplast' | |
3336 | cppminus='$cppminus' | |
3337 | cpprun='$cpprun' | |
3338 | cppstdin='$cppstdin' | |
3339 | csh='$csh' | |
3340 | d_berknames='$d_berknames' | |
3341 | d_bsd='$d_bsd' | |
3342 | d_eunice='$d_eunice' | |
3343 | d_passnames='$d_passnames' | |
3344 | d_portable='$d_portable' | |
3345 | d_usgnames='$d_usgnames' | |
3346 | d_xenix='$d_xenix' | |
3347 | date='$date' | |
3348 | defeditor='$defeditor' | |
3349 | echo='$echo' | |
3350 | egrep='$egrep' | |
3351 | emacs='$emacs' | |
3352 | eunicefix='$eunicefix' | |
3353 | expr='$expr' | |
3354 | find='$find' | |
3355 | firstmakefile='$firstmakefile' | |
3356 | flex='$flex' | |
3357 | gcc='$gcc' | |
3358 | grep='$grep' | |
3359 | groupcat='$groupcat' | |
3360 | gzip='$gzip' | |
3361 | hint='$hint' | |
3362 | hostcat='$hostcat' | |
3363 | inews='$inews' | |
3364 | install='$install' | |
3365 | installdir='$installdir' | |
3366 | installmansrc='$installmansrc' | |
3367 | installprivlib='$installprivlib' | |
3368 | installscript='$installscript' | |
3369 | ksh='$ksh' | |
3370 | less='$less' | |
3371 | line='$line' | |
3372 | lint='$lint' | |
3373 | ln='$ln' | |
3374 | lns='$lns' | |
3375 | lp='$lp' | |
3376 | lpr='$lpr' | |
3377 | ls='$ls' | |
3378 | mail='$mail' | |
3379 | mailer='$mailer' | |
3380 | mailpatches='$mailpatches' | |
3381 | mailx='$mailx' | |
3382 | make='$make' | |
3383 | make_set_make='$make_set_make' | |
3384 | manext='$manext' | |
3385 | mansrc='$mansrc' | |
3386 | mansrcexp='$mansrcexp' | |
3387 | mkdep='$mkdep' | |
3388 | mkdir='$mkdir' | |
3389 | more='$more' | |
3390 | mv='$mv' | |
3391 | mydomain='$mydomain' | |
3392 | myhostname='$myhostname' | |
3393 | myuname='$myuname' | |
3394 | n='$n' | |
3395 | nametype='$nametype' | |
3396 | notifypatches='$notifypatches' | |
3397 | nroff='$nroff' | |
3398 | orgname='$orgname' | |
3399 | osname='$osname' | |
3400 | osvers='$osvers' | |
3401 | package='$package' | |
3402 | pager='$pager' | |
3403 | passcat='$passcat' | |
3404 | patchlevel='$patchlevel' | |
3405 | perl='$perl' | |
3406 | perlpath='$perlpath' | |
3407 | pg='$pg' | |
3408 | phostname='$phostname' | |
3409 | pmake='$pmake' | |
3410 | pr='$pr' | |
3411 | prefix='$prefix' | |
3412 | prefixexp='$prefixexp' | |
3413 | privlib='$privlib' | |
3414 | privlibexp='$privlibexp' | |
3415 | rm='$rm' | |
3416 | rmail='$rmail' | |
3417 | scriptdir='$scriptdir' | |
3418 | scriptdirexp='$scriptdirexp' | |
3419 | sed='$sed' | |
3420 | sendmail='$sendmail' | |
3421 | sh='$sh' | |
3422 | shar='$shar' | |
3423 | sharpbang='$sharpbang' | |
3424 | shsharp='$shsharp' | |
3425 | sleep='$sleep' | |
3426 | smail='$smail' | |
3427 | sort='$sort' | |
3428 | spackage='$spackage' | |
3429 | spitshell='$spitshell' | |
3430 | src='$src' | |
3431 | startperl='$startperl' | |
3432 | startsh='$startsh' | |
3433 | submit='$submit' | |
3434 | sysman='$sysman' | |
3435 | tail='$tail' | |
3436 | tar='$tar' | |
3437 | tbl='$tbl' | |
3438 | test='$test' | |
3439 | touch='$touch' | |
3440 | tr='$tr' | |
3441 | troff='$troff' | |
3442 | uname='$uname' | |
3443 | uniq='$uniq' | |
3444 | usermail='$usermail' | |
3445 | uuname='$uuname' | |
3446 | vi='$vi' | |
3447 | zcat='$zcat' | |
3448 | zip='$zip' | |
3449 | EOT | |
3450 | ||
3451 | : add special variables | |
3452 | $test -f $src/patchlevel.h && \ | |
3453 | awk '/^#define/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh | |
3454 | echo "CONFIG=true" >>config.sh | |
3455 | ||
3456 | : propagate old symbols | |
3457 | if $test -f UU/config.sh; then | |
3458 | <UU/config.sh sort | uniq >UU/oldconfig.sh | |
3459 | sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\ | |
3460 | sort | uniq -u >UU/oldsyms | |
3461 | set X `cat UU/oldsyms` | |
3462 | shift | |
3463 | case $# in | |
3464 | 0) ;; | |
3465 | *) | |
3466 | cat <<EOM | |
3467 | Hmm...You had some extra variables I don't know about...I'll try to keep 'em... | |
3468 | EOM | |
3469 | echo "# Variables propagated from previous config.sh file." >>config.sh | |
3470 | for sym in `cat UU/oldsyms`; do | |
3471 | echo " Propagating $hint variable "'$'"$sym..." | |
3472 | eval 'tmp="$'"${sym}"'"' | |
3473 | echo "$tmp" | \ | |
3474 | sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh | |
3475 | done | |
3476 | ;; | |
3477 | esac | |
3478 | fi | |
3479 | ||
3480 | : Finish up by extracting the .SH files | |
3481 | case "$alldone" in | |
3482 | exit) | |
3483 | $rm -rf UU | |
3484 | echo "Done." | |
3485 | exit 0 | |
3486 | ;; | |
3487 | cont) | |
3488 | ;; | |
3489 | '') | |
3490 | dflt='' | |
3491 | nostick=true | |
3492 | $cat <<EOM | |
3493 | ||
3494 | If you'd like to make any changes to the config.sh file before I begin | |
3495 | to configure things, do it as a shell escape now (e.g. !vi config.sh). | |
3496 | ||
3497 | EOM | |
3498 | rp="Press return or use a shell escape to edit config.sh:" | |
3499 | . UU/myread | |
3500 | nostick='' | |
3501 | case "$ans" in | |
3502 | '') ;; | |
3503 | *) : in case they cannot read | |
3504 | sh 1>&4 -c "$ans";; | |
3505 | esac | |
3506 | ;; | |
3507 | esac | |
3508 | ||
3509 | : if this fails, just run all the .SH files by hand | |
3510 | . ./config.sh | |
3511 | ||
3512 | echo " " | |
3513 | exec 1>&4 | |
3514 | . ./UU/extract | |
3515 | ||
3516 | if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then | |
3517 | dflt=y | |
3518 | case "$silent" in | |
3519 | true) ;; | |
3520 | *) | |
3521 | $cat <<EOM | |
3522 | ||
3523 | Now you need to generate make dependencies by running "make depend". | |
3524 | You might prefer to run it in background: "make depend > makedepend.out &" | |
3525 | It can take a while, so you might not want to run it right now. | |
3526 | ||
3527 | EOM | |
3528 | ;; | |
3529 | esac | |
3530 | rp="Run make depend now?" | |
3531 | . UU/myread | |
3532 | case "$ans" in | |
3533 | y*) | |
3534 | make depend && echo "Now you must run a make." | |
3535 | ;; | |
3536 | *) | |
3537 | echo "You must run 'make depend' then 'make'." | |
3538 | ;; | |
3539 | esac | |
3540 | elif test -f [Mm]akefile; then | |
3541 | echo " " | |
3542 | echo "Now you must run a make." | |
3543 | else | |
3544 | echo "Done." | |
3545 | fi | |
3546 | ||
3547 | $rm -f kit*isdone ark*isdone | |
3548 | $rm -rf UU | |
3549 | ||
3550 | : End of Configure | |
3551 |