Debian Codegraph @

Configure

raw
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 package (which contains metaconfig) is available via git:
17 # git clone [email protected]:rmanfredi/dist.git
18
19 # $Id$
20 #
21 # Generated on Tue Jun 5 15:24:34 CEST 2018 [metaconfig 3.5-241]
22
23 cat >c1$$ <<EOF
24 ARGGGHHHH!!!!!
25
26 SCO csh still thinks true is false. Write to SCO today and tell them that next
27 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
28
29 (Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
30 we'd have to do is go in and swap the && and || tokens, wherever they are.)
31
32 [End of diatribe. We now return you to your regularly scheduled programming...]
33 EOF
34 cat >c2$$ <<EOF
35
36 OOPS! You naughty creature! You didn't run Configure with sh!
37 I will attempt to remedy the situation by running sh for you...
38 EOF
39
40 true || cat c1$$ c2$$
41 true || exec sh $0 $argv:q
42
43 (exit $?0) || cat c2$$
44 (exit $?0) || exec sh $0 $argv:q
45 rm -f c1$$ c2$$
46
47 : compute my invocation name
48 me=$0
49 case "$0" in
50 */*)
51 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
52 test "$me" || me=$0
53 ;;
54 esac
55
56 : Proper separator for the PATH environment variable
57 p_=:
58 : On OS/2 this directory should exist if this is not floppy only system ":-]"
59 if test -d c:/. ; then
60 if test -n "$OS2_SHELL"; then
61 p_=\;
62 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
63 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
64 elif test -n "$DJGPP"; then
65 case "X${MACHTYPE:-nonesuchmach}" in
66 *cygwin|*msys) ;;
67 *) p_=\; ;;
68 esac
69 fi
70 fi
71
72 : Proper PATH setting
73 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
74 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
75 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
76 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
77 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
78 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
79 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
80 paths="$paths /sbin /usr/sbin /usr/libexec"
81 paths="$paths /system/gnu_library/bin"
82
83 for p in $paths
84 do
85 case "$p_$PATH$p_" in
86 *$p_$p$p_*) ;;
87 *) test -d $p && PATH=$PATH$p_$p ;;
88 esac
89 done
90
91 PATH=.$p_$PATH
92 export PATH
93
94 : shall we be using ksh?
95 inksh=''
96 needksh=''
97 avoidksh=''
98 newsh=/bin/ksh
99 changesh=''
100 if (PATH=.; alias -x) >/dev/null 2>&1; then
101 inksh=true
102 fi
103 if test -f /hp-ux -a -f /bin/ksh; then
104 needksh='to avoid sh bug in "here document" expansion'
105 fi
106 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
107 if test X`/usr/bin/uname -v` = X4; then
108 avoidksh="to avoid AIX 4's /bin/sh"
109 newsh=/usr/bin/bsh
110 fi
111 fi
112 if test -f /osf_boot -a -f /usr/sbin/setld; then
113 if test X`/usr/bin/uname -s` = XOSF1; then
114 avoidksh="to avoid Digital UNIX' ksh"
115 newsh=/bin/sh
116 unset BIN_SH
117 fi
118 fi
119 case "$inksh/$needksh" in
120 /[a-z]*)
121 ENV=''
122 changesh=true
123 reason="$needksh"
124 ;;
125 esac
126 case "$inksh/$avoidksh" in
127 true/[a-z]*)
128 changesh=true
129 reason="$avoidksh"
130 ;;
131 esac
132 case "$inksh/$needksh-$avoidksh-" in
133 true/--)
134 cat <<EOM
135 (I see you are using the Korn shell. Some ksh's blow up on $me,
136 mainly on older exotic systems. If yours does, try the Bourne shell instead.)
137 EOM
138 ;;
139 esac
140 case "$changesh" in
141 true)
142 export newsh
143 echo "(Feeding myself to $newsh $reason.)"
144 case "$0" in
145 Configure|*/Configure) exec $newsh $0 "$@";;
146 *) exec $newsh Configure "$@";;
147 esac
148 ;;
149 esac
150
151 : if needed, set CDPATH to a harmless value that is not chatty
152 case "$CDPATH" in
153 '') ;;
154 *) case "$SHELL" in
155 *bash*) CDPATH='.' ;;
156 *) CDPATH='' ;;
157 esac
158 ;;
159 esac
160
161 : Configure runs within the UU subdirectory
162 test -d UU || mkdir UU
163 cd UU && rm -f ./*
164
165 ccname=''
166 ccversion=''
167 from=''
168 run=''
169 targetarch=''
170 to=''
171 usecrosscompile=''
172 d_bsd=''
173 d_dos=''
174 d_eunice=''
175 d_linux=''
176 d_os2=''
177 d_windows=''
178 d_xenix=''
179 _exe=''
180 eunicefix=''
181 ar=''
182 awk=''
183 bash=''
184 bison=''
185 byacc=''
186 cat=''
187 chgrp=''
188 chmod=''
189 chown=''
190 comm=''
191 compress=''
192 cp=''
193 cpio=''
194 cpp=''
195 csh=''
196 date=''
197 echo=''
198 egrep=''
199 emacs=''
200 expr=''
201 find=''
202 flex=''
203 gcc=''
204 gmake=''
205 gmsgfmt=''
206 grep=''
207 gzip=''
208 inews=''
209 ksh=''
210 less=''
211 line=''
212 lint=''
213 ln=''
214 lp=''
215 lpr=''
216 ls=''
217 mail=''
218 mailx=''
219 make=''
220 mkdir=''
221 more=''
222 msgfmt=''
223 msgmerge=''
224 mv=''
225 nawk=''
226 nm=''
227 nroff=''
228 perl=''
229 pg=''
230 pmake=''
231 pr=''
232 rm=''
233 rmail=''
234 sed=''
235 sendmail=''
236 shar=''
237 sleep=''
238 smail=''
239 sort=''
240 submit=''
241 tail=''
242 tar=''
243 tbl=''
244 tee=''
245 test=''
246 touch=''
247 tr=''
248 troff=''
249 uname=''
250 uniq=''
251 uuname=''
252 vi=''
253 wc=''
254 xgettext=''
255 zcat=''
256 zip=''
257 incpath=''
258 mips_type=''
259 hint=''
260 myuname=''
261 osname=''
262 osvers=''
263 Author=''
264 Date=''
265 Header=''
266 Id=''
267 Locker=''
268 Log=''
269 RCSfile=''
270 Revision=''
271 Source=''
272 State=''
273 _a=''
274 _o=''
275 archobjs=''
276 firstmakefile=''
277 rm_try=''
278 afs=''
279 afsroot=''
280 baserev=''
281 ccflags=''
282 cppflags=''
283 ldflags=''
284 lkflags=''
285 locincpth=''
286 optimize=''
287 pthread=''
288 cf_email=''
289 cf_by=''
290 cf_time=''
291 contains=''
292 cpp_trad=''
293 cpplast=''
294 cppminus=''
295 cpprun=''
296 cppstdin=''
297 d_portable=''
298 defeditor=''
299 gccosandvers=''
300 gccversion=''
301 install=''
302 installdir=''
303 issymlink=''
304 glibpth=''
305 libpth=''
306 loclibpth=''
307 plibpth=''
308 xlibpth=''
309 lns=''
310 mailer=''
311 make_set_make=''
312 installmansrc=''
313 manext=''
314 mansrc=''
315 mansrcexp=''
316 mydomain=''
317 myhostname=''
318 phostname=''
319 c=''
320 n=''
321 d_berknames=''
322 d_passnames=''
323 d_usgnames=''
324 nametype=''
325 groupcat=''
326 hostcat=''
327 passcat=''
328 orgname=''
329 package=''
330 spackage=''
331 pager=''
332 patchlevel=''
333 revision=''
334 perlpath=''
335 pkgsrc=''
336 prefix=''
337 prefixexp=''
338 installprivlib=''
339 privlib=''
340 privlibexp=''
341 installscript=''
342 scriptdir=''
343 scriptdirexp=''
344 sh=''
345 sharpbang=''
346 shsharp=''
347 spitshell=''
348 src=''
349 startperl=''
350 startsh=''
351 sysman=''
352 trnl=''
353 usrinc=''
354 CONFIG=''
355
356 : Initialize wide constants
357 define='define'
358 undef='undef'
359 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
360 rmlist=''
361
362 : We must find out about Eunice early
363 eunicefix=':'
364 if test -f /etc/unixtovms; then
365 eunicefix=/etc/unixtovms
366 fi
367 if test -f /etc/unixtovms.exe; then
368 eunicefix=/etc/unixtovms.exe
369 fi
370
371 : Set executable suffix now -- needed before hints available
372 if test -f "/libs/version.library"; then
373 : Amiga OS
374 _exe=""
375 elif test -f "/system/gnu_library/bin/ar.pm"; then
376 : Stratus VOS
377 _exe=".pm"
378 elif test -n "$DJGPP"; then
379 : DOS DJGPP
380 _exe=".exe"
381 elif test -d c:/. ; then
382 : OS/2 or cygwin
383 _exe=".exe"
384 else
385 : All other UNIX systems
386 _exe=""
387 fi
388
389 ccname=''
390 ccversion=''
391 : Extra object files, if any, needed on this platform.
392 archobjs=''
393 bin='/usr/local/bin'
394 cc='cc'
395 : Possible local include directories to search.
396 : Set locincpth to "" in a hint file to defeat local include searches.
397 locincpth=""
398 :
399 : no include file wanted by default
400 inclwanted=''
401
402 : change the next line if compiling for Xenix/286 on Xenix/386
403 xlibpth='/usr/lib/386 /lib/386'
404 : Possible local library directories to search.
405 loclibpth=""
406
407 : general looking path for locating libraries
408 glibpth="/lib /usr/lib $xlibpth"
409 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
410 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
411 test -f /shlib/libc.so && glibpth="/shlib $glibpth"
412 glibpth="$glibpth /lib32 /lib64 "`ls -1d /usr/lib/*-gnu 2>/dev/null`
413 : Private path used by Configure to find libraries. Its value
414 : is prepended to libpth. This variable takes care of special
415 : machines, like the mips. Usually, it should be empty.
416 plibpth=''
417
418 : Find the basic shell for Bourne shell scripts
419 case "$sh" in
420 '')
421 case "$SYSTYPE" in
422 *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
423 *) xxx='/bin/sh';;
424 esac
425 if test -f "$xxx"; then
426 sh="$xxx"
427 else
428 : Build up a list and do a single loop so we can 'break' out.
429 pth=`echo $PATH | sed -e "s/$p_/ /g"`
430 for xxx in sh bash ksh pdksh ash; do
431 for p in $pth; do
432 try="$try ${p}/${xxx}"
433 done
434 done
435 for xxx in $try; do
436 if test -f "$xxx"; then
437 sh="$xxx"
438 break
439 elif test -f "$xxx$_exe"; then
440 sh="$xxx$_exe"
441 break
442 elif test -f "$xxx.exe"; then
443 sh="$xxx.exe"
444 break
445 fi
446 done
447 fi
448 ;;
449 esac
450
451 case "$sh" in
452 '') cat >&2 <<EOM
453 $me: Fatal Error: I can't find a Bourne Shell anywhere.
454
455 Usually it's in /bin/sh. How did you even get this far?
456 Please contact me (Raphael Manfredi) at [email protected] and
457 we'll try to straighten this all out.
458 EOM
459 exit 1
460 ;;
461 esac
462
463 : see if sh knows # comments
464 if `$sh -c '#' >/dev/null 2>&1`; then
465 shsharp=true
466 spitshell=cat
467 xcat=/bin/cat
468 test -f $xcat$_exe || xcat=/usr/bin/cat
469 if test ! -f $xcat$_exe; then
470 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
471 if test -f $p/cat$_exe; then
472 xcat=$p/cat
473 break
474 fi
475 done
476 if test ! -f $xcat$_exe; then
477 echo "Can't find cat anywhere!"
478 exit 1
479 fi
480 fi
481 echo "#!$xcat" >sharp
482 $eunicefix sharp
483 chmod +x sharp
484 ./sharp > today 2>/dev/null
485 if test -s today; then
486 sharpbang='#!'
487 else
488 echo "#! $xcat" > sharp
489 $eunicefix sharp
490 chmod +x sharp
491 ./sharp > today 2>/dev/null
492 if test -s today; then
493 sharpbang='#! '
494 else
495 sharpbang=': use '
496 fi
497 fi
498 else
499 echo " "
500 echo "Your $sh doesn't grok # comments--I will strip them later on."
501 shsharp=false
502 cd ..
503 echo "exec grep -v '^[ ]*#'" >spitshell
504 chmod +x spitshell
505 $eunicefix spitshell
506 spitshell=`pwd`/spitshell
507 cd UU
508 echo "I presume that if # doesn't work, #! won't work either!"
509 sharpbang=': use '
510 fi
511 rm -f sharp today
512
513 : figure out how to guarantee sh startup
514 case "$startsh" in
515 '') startsh=${sharpbang}${sh} ;;
516 *)
517 esac
518 cat >sharp <<EOSS
519 $startsh
520 set abc
521 test "$?abc" != 1
522 EOSS
523
524 chmod +x sharp
525 $eunicefix sharp
526 if ./sharp; then
527 : echo "Yup, it does."
528 else
529 echo "Hmm... '$startsh' does not guarantee sh startup..."
530 echo "You may have to fix up the shell scripts to make sure $sh runs them."
531 fi
532 rm -f sharp
533
534 : Save command line options in file UU/cmdline.opt for later use in
535 : generating config.sh.
536 cat > cmdline.opt <<EOSH
537 : Configure command line arguments.
538 config_arg0='$0'
539 config_args='$*'
540 config_argc=$#
541 EOSH
542 argn=1
543 args_exp=''
544 args_sep=''
545 for arg in "$@"; do
546 cat >>cmdline.opt <<EOSH
547 config_arg$argn='$arg'
548 EOSH
549 cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
550 $arg
551 EOC
552 arg_exp=`cat cmdl.opt`
553 args_exp="$args_exp$args_sep'$arg_exp'"
554 argn=`expr $argn + 1`
555 args_sep=' '
556 done
557 rm -f cmdl.opt
558
559 : produce awk script to parse command line options
560 cat >options.awk <<'EOF'
561 BEGIN {
562 optstr = "A:dD:eEf:hKOrsSU:V"; # getopt-style specification
563
564 len = length(optstr);
565 for (i = 1; i <= len; i++) {
566 c = substr(optstr, i, 1);
567 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
568 if (a == ":") {
569 arg[c] = 1;
570 i++;
571 }
572 opt[c] = 1;
573 }
574 }
575 {
576 expect = 0;
577 str = $0;
578 if (substr(str, 1, 1) != "-") {
579 printf("'%s'\n", str);
580 next;
581 }
582 len = length($0);
583 for (i = 2; i <= len; i++) {
584 c = substr(str, i, 1);
585 if (!opt[c]) {
586 printf("-%s\n", substr(str, i));
587 next;
588 }
589 printf("-%s\n", c);
590 if (arg[c]) {
591 if (i < len)
592 printf("'%s'\n", substr(str, i + 1));
593 else
594 expect = 1;
595 next;
596 }
597 }
598 }
599 END {
600 if (expect)
601 print "?";
602 }
603 EOF
604
605 : process the command line options
606 set X `for arg in "$@"; do echo "X$arg"; done |
607 sed -e s/X// | awk -f options.awk`
608 eval "set $*"
609 shift
610 rm -f options.awk
611
612 : set up default values
613 fastread=''
614 reuseval=false
615 config_sh=''
616 alldone=''
617 error=''
618 silent=''
619 extractsh=''
620 override=''
621 knowitall=''
622 rm -f optdef.sh posthint.sh
623 cat >optdef.sh <<EOS
624 $startsh
625 EOS
626
627
628 : option parsing
629 while test $# -gt 0; do
630 case "$1" in
631 -d) shift; fastread=yes;;
632 -e) shift; alldone=cont;;
633 -f)
634 shift
635 cd ..
636 if test -r "$1"; then
637 config_sh="$1"
638 else
639 echo "$me: cannot read config file $1." >&2
640 error=true
641 fi
642 cd UU
643 shift;;
644 -h) shift; error=true;;
645 -r) shift; reuseval=true;;
646 -s) shift; silent=true; realsilent=true;;
647 -E) shift; alldone=exit;;
648 -K) shift; knowitall=true;;
649 -O) shift; override=true;;
650 -S) shift; silent=true; extractsh=true;;
651 -D)
652 shift
653 case "$1" in
654 *=)
655 echo "$me: use '-U symbol=', not '-D symbol='." >&2
656 echo "$me: ignoring -D $1" >&2
657 ;;
658 *=*) echo "$1" | \
659 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
660 *) echo "$1='define'" >> optdef.sh;;
661 esac
662 shift
663 ;;
664 -U)
665 shift
666 case "$1" in
667 *=) echo "$1" >> optdef.sh;;
668 *=*)
669 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
670 echo "$me: ignoring -U $1" >&2
671 ;;
672 *) echo "$1='undef'" >> optdef.sh;;
673 esac
674 shift
675 ;;
676 -A)
677 shift
678 xxx=''
679 yyy="$1"
680 zzz=''
681 uuu=undef
682 case "$yyy" in
683 *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
684 case "$zzz" in
685 *:*) zzz='' ;;
686 *) xxx=append
687 zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'`
688 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
689 esac
690 ;;
691 esac
692 case "$xxx" in
693 '') case "$yyy" in
694 *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
695 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
696 zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
697 yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
698 *) xxx=`echo "$yyy"|sed 's!:.*!!'`
699 yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
700 esac
701 ;;
702 esac
703 case "$xxx" in
704 append)
705 echo "$yyy=\"\${$yyy}$zzz\"" >> posthint.sh ;;
706 clear)
707 echo "$yyy=''" >> posthint.sh ;;
708 define)
709 case "$zzz" in
710 '') zzz=define ;;
711 esac
712 echo "$yyy='$zzz'" >> posthint.sh ;;
713 eval)
714 echo "eval \"$yyy=$zzz\"" >> posthint.sh ;;
715 prepend)
716 echo "$yyy=\"$zzz\${$yyy}\"" >> posthint.sh ;;
717 undef)
718 case "$zzz" in
719 '') zzz="$uuu" ;;
720 esac
721 echo "$yyy=$zzz" >> posthint.sh ;;
722 *) echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
723 esac
724 shift
725 ;;
726 -V) echo "$me generated by metaconfig 3.5-241." >&2
727 exit 0;;
728 --) break;;
729 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
730 *) break;;
731 esac
732 done
733
734 case "$error" in
735 true)
736 cat >&2 <<EOM
737 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
738 [-U symbol] [-U symbol=] [-A command:symbol...]
739 -d : use defaults for all answers.
740 -e : go on without questioning past the production of config.sh.
741 -f : specify an alternate default configuration file.
742 -h : print this help message and exit (with an error status).
743 -r : reuse C symbols value if possible (skips costly nm extraction).
744 -s : silent mode, only echoes questions and essential information.
745 -D : define symbol to have some value:
746 -D symbol symbol gets the value 'define'
747 -D symbol=value symbol gets the value 'value'
748 -E : stop at the end of questions, after having produced config.sh.
749 -K : do not use unless you know what you are doing.
750 -O : let -D and -U override definitions from loaded configuration file.
751 -S : perform variable substitutions on all .SH files (can mix with -f)
752 -U : undefine symbol:
753 -U symbol symbol gets the value 'undef'
754 -U symbol= symbol gets completely empty
755 -A : manipulate symbol after the platform specific hints have been applied:
756 -A symbol=value append " "value to symbol
757 -A append:symbol=value append value to symbol
758 -A define:symbol=value define symbol to have value
759 -A clear:symbol define symbol to be ''
760 -A define:symbol define symbol to be 'define'
761 -A eval:symbol=value define symbol to be eval of value
762 -A prepend:symbol=value prepend value to symbol
763 -A undef:symbol define symbol to be 'undef'
764 -A undef:symbol= define symbol to be ''
765 -V : print version number and exit (with a zero status).
766 EOM
767 exit 1
768 ;;
769 esac
770
771 : Sanity checks
772 case "$fastread$alldone" in
773 yescont|yesexit) ;;
774 *)
775 case "$extractsh" in
776 true) ;;
777 *)
778 if test ! -t 0; then
779 echo "Say 'sh Configure', not 'sh <Configure'"
780 exit 1
781 fi
782 ;;
783 esac
784 ;;
785 esac
786
787 exec 4>&1
788 case "$silent" in
789 true) exec 1>/dev/null;;
790 esac
791
792 touch optdef.sh
793 if grep -q '\\' optdef.sh >/dev/null 2>&1; then
794 echo "Configure does not support \\ in -D or -U arguments" >&2
795 exit 1
796 fi
797
798 : run the defines and the undefines, if any, but leave the file out there...
799 . ./optdef.sh
800 : create the posthint manipulation script and leave the file out there...
801 touch posthint.sh
802
803 : set package name
804 package='dist'
805 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
806 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
807 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
808 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
809 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
810 esac
811
812 : script used to emulate mkdir -p
813 cat >mkdirp <<EOS
814 $startsh
815 EOS
816 cat >>mkdirp <<'EOS'
817 name=$1;
818 create="";
819 while test $name; do
820 if test ! -d "$name"; then
821 create="$name $create"
822 name=`echo $name | sed -e "s|^[^/]*$||"`
823 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`
824 else
825 name=""
826 fi
827 done
828 for file in $create; do
829 mkdir $file
830 done
831 EOS
832 chmod +x mkdirp
833 $eunicefix mkdirp
834
835 : Some greps do not return status, grrr.
836 echo "grimblepritz" >grimble
837 if grep blurfldyick grimble >/dev/null 2>&1 ; then
838 contains=contains
839 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
840 contains=grep
841 else
842 contains=contains
843 fi
844 rm -f grimble
845 : the following should work in any shell
846 case "$contains" in
847 contains*)
848 echo " "
849 echo "AGH! Grep doesn't return a status. Attempting remedial action."
850 cat >contains <<'EOSS'
851 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
852 EOSS
853 chmod +x contains
854 esac
855
856 : Find the path to the source tree
857 case "$src" in
858 '') case "$0" in
859 */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
860 case "$src" in
861 /*) ;;
862 .) ;;
863 *) src=`cd ../$src && pwd` ;;
864 esac
865 ;;
866 *) src='.';;
867 esac;;
868 esac
869 case "$src" in
870 '') src=/
871 rsrc=/
872 ;;
873 /*) rsrc="$src";;
874 *) rsrc="../$src";;
875 esac
876 if test -f $rsrc/Configure && \
877 $contains "^package='$package'\$" $rsrc/Configure >/dev/null 2>&1
878 then
879 : found it, so we are ok.
880 else
881 rsrc=''
882 for src in . .. ../.. ../../.. ../../../..; do
883 if test -f ../$src/Configure && \
884 $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
885 then
886 rsrc=../$src
887 break
888 fi
889 done
890 fi
891 case "$rsrc" in
892 '')
893 cat <<EOM >&4
894
895 Sorry, I can't seem to locate the source dir for $package. Please start
896 Configure with an explicit path -- i.e. /some/path/Configure.
897
898 EOM
899 exit 1
900 ;;
901 ../.) rsrc='..';;
902 *)
903 echo " "
904 echo "Sources for $package found in \"$src\"." >&4
905 ;;
906 esac
907
908 : script used to extract .SH files with variable substitutions
909 cat >extract <<EOS
910 CONFIG=true
911 SRC="$src"
912 TOP=`cd ..; pwd 2>/dev/null`
913 EOS
914 cat >>extract <<'EOS'
915 echo "Doing variable substitutions on .SH files..."
916 if test -f "$SRC/MANIFEST"; then
917 set x `awk '{print $1}' <$SRC/MANIFEST | grep '\.SH'`
918 else
919 echo "(Looking for .SH files under the source directory.)"
920 set x `(cd "$SRC"; find . -name "*.SH" -print)`
921 fi
922 shift
923 case $# in
924 0) set x `(cd "$SRC"; echo *.SH)`; shift;;
925 esac
926 if test ! -f "$SRC/$1"; then
927 shift
928 fi
929 for file in $*; do
930 case "$SRC" in
931 ".")
932 case "$file" in
933 */*)
934 dir=`expr X$file : 'X\(.*\)/'`
935 file=`expr X$file : 'X.*/\(.*\)'`
936 (cd $dir && . ./$file)
937 ;;
938 *)
939 . ./$file
940 ;;
941 esac
942 ;;
943 *)
944 case "$file" in
945 */*)
946 dir=`expr X$file : 'X\(.*\)/'`
947 file=`expr X$file : 'X.*/\(.*\)'`
948 ./mkdirp $dir
949 sh <"$SRC/$dir/$file"
950 ;;
951 *)
952 sh <"$SRC/$file"
953 ;;
954 esac
955 ;;
956 esac
957 done
958 if test -f "$SRC/config_h.SH"; then
959 if test ! -f config.h; then
960 sh <"$SRC/config_h.SH"
961 fi
962 fi
963 EOS
964
965 : extract files and exit if asked to do so
966 case "$extractsh" in
967 true)
968 case "$realsilent" in
969 true) ;;
970 *) exec 1>&4;;
971 esac
972 case "$config_sh" in
973 '') config_sh='config.sh';;
974 esac
975 echo " "
976 echo "Fetching answers from $config_sh..."
977 cd ..
978 . $config_sh
979 test "$override" && . ./optdef.sh
980 echo " "
981 . UU/extract
982 rm -rf UU
983 echo "Extraction done."
984 exit 0
985 ;;
986 esac
987
988 : Eunice requires " " instead of "", can you believe it
989 echo " "
990 : Here we go...
991 echo "Beginning of configuration questions for $package."
992
993 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
994
995 : first determine how to suppress newline on echo command
996 echo " "
997 echo "Checking echo to see how to suppress newlines..."
998 (echo "hi there\c" ; echo " ") >.echotmp
999 if $contains c .echotmp >/dev/null 2>&1 ; then
1000 echo "...using -n."
1001 n='-n'
1002 c=''
1003 else
1004 cat <<'EOM'
1005 ...using \c
1006 EOM
1007 n=''
1008 c='\c'
1009 fi
1010 echo $n "The star should be here-->$c"
1011 echo '*'
1012 rm -f .echotmp
1013
1014 : Now test for existence of everything in MANIFEST
1015 echo " "
1016 if test -f "$rsrc/MANIFEST"; then
1017 echo "First let's make sure your kit is complete. Checking..." >&4
1018 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1019 (split -l 50 2>/dev/null || split -50)
1020 rm -f missing
1021 tmppwd=`pwd`
1022 for filelist in x??; do
1023 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` \
1024 >/dev/null 2>>"$tmppwd/missing")
1025 done
1026 if test -s missing; then
1027 cat missing >&4
1028 cat >&4 <<'EOM'
1029
1030 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1031
1032 You have the option of continuing the configuration process, despite the
1033 distinct possibility that your kit is damaged, by typing 'y'es. If you
1034 do, don't blame me if something goes wrong. I advise you to type 'n'o
1035 and contact the author ([email protected]).
1036
1037 EOM
1038 echo $n "Continue? [n] $c" >&4
1039 read ans
1040 case "$ans" in
1041 y*)
1042 echo "Continuing..." >&4
1043 rm -f missing
1044 ;;
1045 *)
1046 echo "ABORTING..." >&4
1047 kill $$
1048 ;;
1049 esac
1050 else
1051 echo "Looks good..."
1052 fi
1053 else
1054 echo "There is no MANIFEST file. I hope your kit is complete !"
1055 fi
1056 rm -f missing x??
1057
1058 : Find the appropriate value for a newline for tr
1059 if test -n "$DJGPP"; then
1060 trnl='\012'
1061 fi
1062 if test X"$trnl" = X; then
1063 case "`echo foo | tr '\n' x 2>/dev/null`" in
1064 foox) trnl='\n' ;;
1065 esac
1066 fi
1067 if test X"$trnl" = X; then
1068 case "`echo foo | tr '\012' x 2>/dev/null`" in
1069 foox) trnl='\012' ;;
1070 esac
1071 fi
1072 if test X"$trnl" = X; then
1073 case "`echo foo | tr '\r\n' xy 2>/dev/null`" in
1074 fooxy) trnl='\n\r' ;;
1075 esac
1076 fi
1077 if test X"$trnl" = X; then
1078 cat <<EOM >&2
1079
1080 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1081
1082 EOM
1083 exit 1
1084 fi
1085
1086 : compute the number of columns on the terminal for proper question formatting
1087 case "$COLUMNS" in
1088 '') COLUMNS='80';;
1089 esac
1090
1091 : set up the echo used in my read
1092 myecho="case \"\$xxxm\" in
1093 '') echo $n \"\$rp $c\" >&4;;
1094 *) case \"\$rp\" in
1095 '') echo $n \"[\$xxxm] $c\";;
1096 *)
1097 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
1098 echo \"\$rp\" >&4
1099 echo $n \"[\$xxxm] $c\" >&4
1100 else
1101 echo $n \"\$rp [\$xxxm] $c\" >&4
1102 fi
1103 ;;
1104 esac;;
1105 esac"
1106
1107 : now set up to do reads with possible shell escape and default assignment
1108 cat <<EOSC >myread
1109 $startsh
1110 xxxm=\$dflt
1111 $myecho
1112 ans='!'
1113 case "\$fastread" in
1114 yes) case "\$dflt" in
1115 '') ;;
1116 *) ans='';
1117 case "\$silent-\$rp" in
1118 true-) ;;
1119 *) echo " " >&4;;
1120 esac;;
1121 esac;;
1122 *) case "\$silent" in
1123 true) case "\$rp" in
1124 '') ans='';;
1125 esac;;
1126 esac;;
1127 esac
1128 while expr "X\$ans" : "X!" >/dev/null; do
1129 read answ
1130 set x \$xxxm
1131 shift
1132 aok=''; eval "ans=\\"\$answ\\"" && aok=y
1133 case "\$answ" in
1134 "!")
1135 sh 1>&4
1136 echo " "
1137 $myecho
1138 ;;
1139 !*)
1140 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1141 shift
1142 sh 1>&4 -c "\$*"
1143 echo " "
1144 $myecho
1145 ;;
1146 "\$ans")
1147 case "\$ans" in
1148 \\&*)
1149 set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1150 shift
1151 case "\$1" in
1152 -d)
1153 fastread=yes
1154 echo "(OK, I'll run with -d after this question.)" >&4
1155 ;;
1156 -*)
1157 echo "*** Sorry, \$1 not supported yet." >&4
1158 ;;
1159 esac
1160 $myecho
1161 ans=!
1162 ;;
1163 esac;;
1164 *)
1165 case "\$aok" in
1166 y)
1167 echo "*** Substitution done -- please confirm."
1168 xxxm="\$ans"
1169 ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
1170 xxxm="\$ans"
1171 ans=!
1172 ;;
1173 *)
1174 echo "*** Error -- try again."
1175 ans=!
1176 ;;
1177 esac
1178 $myecho
1179 ;;
1180 esac
1181 case "\$ans\$xxxm\$nostick" in
1182 '')
1183 ans=!
1184 $myecho
1185 ;;
1186 esac
1187 done
1188 case "\$ans" in
1189 '') ans="\$xxxm";;
1190 esac
1191 EOSC
1192
1193 : create .config dir to save info across Configure sessions
1194 test -d ../.config || mkdir ../.config
1195 cat >../.config/README <<EOF
1196 This directory created by Configure to save information that should
1197 persist across sessions for $package.
1198
1199 You may safely delete it if you wish.
1200 EOF
1201
1202 : general instructions
1203 needman=true
1204 firsttime=true
1205 user=`(logname) 2>/dev/null`
1206 case "$user" in
1207 '') user=`whoami 2>&1`;;
1208 esac
1209 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1210 firsttime=false
1211 echo " "
1212 rp='Would you like to see the instructions?'
1213 dflt=n
1214 . ./myread
1215 case "$ans" in
1216 [yY]*) ;;
1217 *) needman=false;;
1218 esac
1219 fi
1220 if $needman; then
1221 cat <<EOH
1222
1223 This installation shell script will examine your system and ask you questions
1224 to determine how the dist package should be installed. If you get
1225 stuck on a question, you may use a ! shell escape to start a subshell or
1226 execute a command. Many of the questions will have default answers in square
1227 brackets; typing carriage return will give you the default.
1228
1229 On some of the questions which ask for file or directory names you are allowed
1230 to use the ~name construct to specify the login directory belonging to "name",
1231 even if you don't have a shell which knows about that. Questions where this is
1232 allowed will be marked "(~name ok)".
1233
1234 EOH
1235 rp=''
1236 dflt='Type carriage return to continue'
1237 . ./myread
1238 cat <<'EOH'
1239
1240 The prompter used in this script allows you to use shell variables and
1241 backticks in your answers. You may use $1, $2, etc... to refer to the words
1242 in the default answer, as if the default line was a set of arguments given to a
1243 script shell. This means you may also use $* to repeat the whole default line,
1244 so you do not have to re-type everything to add something to the default.
1245
1246 Every time there is a substitution, you will have to confirm. If there is an
1247 error (e.g. an unmatched backtick), the default answer will remain unchanged
1248 and you will be prompted again.
1249
1250 If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1251 the questions and use the computed defaults (or the previous answers if there
1252 was already a config.sh file). Type 'Configure -h' for a list of options.
1253 You may also start interactively and then answer '& -d' at any prompt to turn
1254 on the non-interactive behaviour for the remainder of the execution.
1255
1256 EOH
1257 . ./myread
1258 cat <<EOH
1259
1260 Much effort has been expended to ensure that this shell script will run on any
1261 Unix system. If despite that it blows up on yours, your best bet is to edit
1262 Configure and run it again. If you can't run Configure for some reason,
1263 you'll have to generate a config.sh file by hand. Whatever problems you
1264 have, let me ([email protected]) know how I blew it.
1265
1266 This installation script affects things in two ways:
1267
1268 1) it may do direct variable substitutions on some of the files included
1269 in this kit.
1270 2) it builds a config.h file for inclusion in C programs. You may edit
1271 any of these files as the need arises after running this script.
1272
1273 If you make a mistake on a question, there is no easy way to back up to it
1274 currently. The easiest thing to do is to edit config.sh and rerun all the SH
1275 files. Configure will offer to let you do this before it runs the SH files.
1276
1277 EOH
1278 dflt='Type carriage return to continue'
1279 . ./myread
1280 case "$firsttime" in
1281 true) echo $user >>../.config/instruct;;
1282 esac
1283 fi
1284
1285 : script used to emit important warnings
1286 cat >warn <<EOS
1287 $startsh
1288 if test \$# -gt 0; then
1289 echo "\$@" >msg
1290 else
1291 cat >msg
1292 fi
1293 echo "*** WARNING:" >&4
1294 sed -e 's/^/*** /' <msg >&4
1295 echo "*** " >&4
1296 cat msg >>config.msg
1297 echo " " >>config.msg
1298 rm -f msg
1299 EOS
1300 chmod +x warn
1301 $eunicefix warn
1302
1303 : find out where common programs are
1304 echo " "
1305 echo "Locating common programs..." >&4
1306 cat <<EOSC >loc
1307 $startsh
1308 case \$# in
1309 0) exit 1;;
1310 esac
1311 thing=\$1
1312 shift
1313 dflt=\$1
1314 shift
1315 for dir in \$*; do
1316 case "\$thing" in
1317 .)
1318 if test -d \$dir/\$thing; then
1319 echo \$dir
1320 exit 0
1321 fi
1322 ;;
1323 *)
1324 for thisthing in \$dir/\$thing; do
1325 : just loop through to pick last item
1326 done
1327 if test -f \$thisthing; then
1328 echo \$thisthing
1329 exit 0
1330 elif test -f \$thisthing$_exe; then
1331 echo \$thisthing
1332 exit 0
1333 elif test -f \$dir/\$thing.exe; then
1334 if test -n "$DJGPP"; then
1335 echo \$dir/\$thing.exe
1336 else
1337 : on Eunice apparently
1338 echo \$dir/\$thing
1339 fi
1340 exit 0
1341 fi
1342 ;;
1343 esac
1344 done
1345 echo \$dflt
1346 exit 1
1347 EOSC
1348 chmod +x loc
1349 $eunicefix loc
1350 loclist="
1351 awk
1352 cat
1353 chgrp
1354 chmod
1355 chown
1356 cp
1357 echo
1358 expr
1359 grep
1360 make
1361 mkdir
1362 mv
1363 rm
1364 sed
1365 sort
1366 touch
1367 tr
1368 uniq
1369 "
1370 trylist="
1371 cpp
1372 date
1373 inews
1374 less
1375 line
1376 ln
1377 mail
1378 more
1379 nroff
1380 perl
1381 pg
1382 rmail
1383 sendmail
1384 smail
1385 test
1386 uname
1387 vi
1388 wc
1389 zcat
1390 "
1391 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1392 pth="$pth /sbin /usr/sbin /lib /usr/lib /etc"
1393 for file in $loclist; do
1394 eval xxx=\$$file
1395 case "$xxx" in
1396 /*|?:[\\/]*)
1397 if test -f "$xxx"; then
1398 : ok
1399 else
1400 ./warn "no $xxx -- ignoring your setting for $file." 4>&4
1401 xxx=`./loc $file $file $pth`
1402 fi
1403 ;;
1404 '') xxx=`./loc $file $file $pth`;;
1405 *) xxx=`./loc $xxx $xxx $pth`;;
1406 esac
1407 eval $file=$xxx
1408 eval _$file=$xxx
1409 case "$xxx" in
1410 /*)
1411 echo $file is in $xxx.
1412 ;;
1413 ?:[\\/]*)
1414 echo $file is in $xxx.
1415 ;;
1416 *)
1417 echo "I don't know where '$file' is, and my life depends on it." >&4
1418 echo "Go find a public domain implementation or fix your PATH!" >&4
1419 exit 1
1420 ;;
1421 esac
1422 done
1423 echo " "
1424 echo "Don't worry if any of the following aren't found..."
1425 say=offhand
1426 for file in $trylist; do
1427 eval xxx=\$$file
1428 case "$xxx" in
1429 /*|?:[\\/]*)
1430 if test -f "$xxx"; then
1431 : ok
1432 else
1433 ./warn "no $xxx -- ignoring your setting for $file." 4>&4
1434 xxx=`./loc $file $file $pth`
1435 fi
1436 ;;
1437 '') xxx=`./loc $file $file $pth`;;
1438 *) xxx=`./loc $xxx $xxx $pth`;;
1439 esac
1440 eval $file=$xxx
1441 eval _$file=$xxx
1442 case "$xxx" in
1443 /*)
1444 echo $file is in $xxx.
1445 ;;
1446 ?:[\\/]*)
1447 echo $file is in $xxx.
1448 ;;
1449 *)
1450 echo "I don't see $file out there, $say."
1451 say=either
1452 ;;
1453 esac
1454 done
1455 case "$egrep" in
1456 egrep$_exe|egrep)
1457 echo "Substituting grep for egrep."
1458 egrep=$grep
1459 _egrep=$_grep
1460 ;;
1461 esac
1462 case "$ln" in
1463 ln$_exe|ln)
1464 echo "Substituting cp for ln."
1465 ln=$cp
1466 _ln=$_cp
1467 ;;
1468 esac
1469 case "$make" in
1470 make$_exe|make)
1471 case "$gmake" in
1472 gmake)
1473 echo "I can't find make or gmake, and my life depends on it." >&4
1474 echo "Go find a public domain implementation or fix your PATH setting!" >&4
1475 exit 1
1476 ;;
1477 esac
1478 ;;
1479 esac
1480 case "$gmake" in
1481 gmake$_exe|gmake) ;;
1482 *)
1483 if test -f "/system/gnu_library/bin/ar.pm"; then
1484 : Stratus VOS
1485 echo "Substituting gmake for make."
1486 make=$gmake
1487 _make=$_gmake
1488 fi
1489 ;;
1490 esac
1491 case "$test" in
1492 test|test$_exe)
1493 echo "Hopefully test is built into your sh."
1494 test=test
1495 ;;
1496 *)
1497 if `sh -c "PATH= test true" >/dev/null 2>&1`; then
1498 echo "Using the test built into your sh."
1499 test=test
1500 _test=test
1501 fi
1502 ;;
1503 esac
1504 case "$echo" in
1505 echo|echo$_exe)
1506 echo "Hopefully echo is built into your sh."
1507 echo=echo
1508 ;;
1509 '') ;;
1510 *)
1511 echo " "
1512 echo "Checking compatibility between $_echo and builtin echo (if any)..." >&4
1513 $echo $n "hi there$c" >foo1
1514 echo $n "hi there$c" >foo2
1515 if cmp foo1 foo2 >/dev/null 2>&1; then
1516 echo "They are compatible. In fact, they may be identical."
1517 else
1518 case "$n" in
1519 '-n') n='' c='\c';;
1520 *) n='-n' c='';;
1521 esac
1522 cat <<FOO
1523 They are not compatible! You are probably running ksh on a non-USG system.
1524 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1525 have echo built in and we may have to run some Bourne shell scripts. That
1526 means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
1527
1528 FOO
1529 $echo $n "The star should be here-->$c"
1530 $echo "*"
1531 fi
1532 $rm -f foo1 foo2
1533 ;;
1534 esac
1535
1536 : generate the trygcc script for later perusal
1537 cat <<EOS >trygcc
1538 $startsh
1539 EOS
1540 cat <<'EOSC' >>trygcc
1541 case "$cc" in
1542 '') ;;
1543 *) $rm -f try try.*
1544 $cat >try.c <<EOM
1545 int main(int argc, char *argv[]) {
1546 (void) argc;
1547 (void) argv;
1548 return 0;
1549 }
1550 EOM
1551 if $cc -o try $ccflags $ldflags try.c; then
1552 :
1553 else
1554 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
1555 despair=yes
1556 trygcc=yes
1557 case "$cc" in
1558 *gcc*) trygcc=no ;;
1559 esac
1560 case "`$cc -v -c try.c 2>&1`" in
1561 *gcc*) trygcc=no ;;
1562 esac
1563 if $test X"$trygcc" = Xyes; then
1564 if gcc -o try -c try.c; then
1565 echo " "
1566 echo "You seem to have a working gcc, though." >&4
1567 rp="Would you like to use it?"
1568 dflt=y
1569 if $test -f myread; then
1570 . ./myread
1571 else
1572 if $test -f UU/myread; then
1573 . ./UU/myread
1574 else
1575 echo "Cannot find myread, sorry. Aborting." >&2
1576 exit 1
1577 fi
1578 fi
1579 case "$ans" in
1580 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
1581 $cat *.cbu >checktmp 2>/dev/null
1582 if $contains ccflags checktmp >/dev/null; then
1583 ./warn 4>&4 <<EOM
1584 Any previous setting of the C compiler flags has been lost.
1585 It may be necessary to pass -Dcc=gcc to Configure right away.
1586 EOM
1587 fi;;
1588 esac
1589 fi
1590 fi
1591 fi
1592 $rm -f try try.*
1593 ;;
1594 esac
1595 EOSC
1596
1597 : generate the checkcc script for later perusal
1598 cat <<EOS >checkcc
1599 $startsh
1600 EOS
1601 cat <<'EOSC' >>checkcc
1602 case "$cc" in
1603 '') ;;
1604 *) $rm -f try try.*
1605 $cat >try.c <<EOM
1606 int main(int argc, char *argv[]) {
1607 (void) argc;
1608 (void) argv;
1609 return 0;
1610 }
1611 EOM
1612 if $cc -o try $ccflags $ldflags try.c; then
1613 :
1614 else
1615 if $test X"$despair" = Xyes; then
1616 echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
1617 fi
1618 $cat >&4 <<EOM
1619 You need to find a working C compiler.
1620 Either (purchase and) install the C compiler supplied by your OS vendor,
1621 or for a free C compiler try http://gcc.gnu.org/
1622 I cannot continue any further, aborting.
1623 EOM
1624 exit 1
1625 fi
1626 $rm -f try try.*
1627 ;;
1628 esac
1629 EOSC
1630
1631 : determine whether symbolic links are supported
1632 echo " "
1633 $rm -f blurfl sym
1634 $touch blurfl
1635 if $ln -s blurfl sym > /dev/null 2>&1 && $test -f sym; then
1636 echo "Symbolic links are supported." >&4
1637 lns="$ln -s"
1638 else
1639 echo "Symbolic links are NOT supported." >&4
1640 lns="$ln"
1641 fi
1642 $rm -f blurfl sym
1643
1644 : determine whether symbolic links are supported
1645 echo " "
1646 case "$lns" in
1647 *"ln"*" -s")
1648 echo "Checking how to test for symbolic links..." >&4
1649 $lns blurfl sym
1650 if $test "X$issymlink" = X; then
1651 case "$newsh" in
1652 '') sh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
1653 *) $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
1654 esac
1655 if test $? = 0; then
1656 issymlink="test -h"
1657 else
1658 echo "Your builtin 'test -h' may be broken." >&4
1659 case "$test" in
1660 /*) ;;
1661 *) pth=`echo $PATH | sed -e "s/$p_/ /g"`
1662 for p in $pth
1663 do
1664 if test -f "$p/$test"; then
1665 test="$p/$test"
1666 break
1667 fi
1668 done
1669 ;;
1670 esac
1671 case "$test" in
1672 /*)
1673 echo "Trying external '$test -h'." >&4
1674 issymlink="$test -h"
1675 if $test ! -h sym >/dev/null 2>&1; then
1676 echo "External '$test -h' is broken, too." >&4
1677 issymlink=''
1678 fi
1679 ;;
1680 *) issymlink='' ;;
1681 esac
1682 fi
1683 fi
1684 if $test "X$issymlink" = X; then
1685 if $test -L sym 2>/dev/null; then
1686 issymlink="$test -L"
1687 echo "The builtin '$test -L' worked." >&4
1688 fi
1689 fi
1690 if $test "X$issymlink" != X; then
1691 echo "You can test for symbolic links with '$issymlink'." >&4
1692 else
1693 echo "I do not know how you can test for symbolic links." >&4
1694 fi
1695 $rm -f blurfl sym
1696 ;;
1697 *) echo "No symbolic links, so not testing for their testing..." >&4
1698 ;;
1699 esac
1700
1701 : define absolute package source directory
1702 case "$src" in
1703 /*) pkgsrc=$src;;
1704 *) pkgsrc=`cd $rsrc; pwd`;;
1705 esac
1706
1707 : Duplicate the tree with symbolic links if -Dmksymlinks was supplied
1708 case "$mksymlinks" in
1709 $define|true|[yY]*)
1710 echo " "
1711 case "$src" in
1712 ''|'.') echo "Cannot create symlinks in the original directory." >&4
1713 exit 1
1714 ;;
1715 *) case "$lns:$issymlink" in
1716 *"ln"*" -s:"*"test -"?)
1717 echo "Creating the symbolic links..." >&4
1718 echo "(First creating the subdirectories...)" >&4
1719 cd ..
1720 awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | \
1721 sort -u | while true
1722 do
1723 read dir
1724 test -z "$dir" && break
1725 ./UU/mkdirp $dir 2>/dev/null
1726 if test -d $dir; then
1727 : ok
1728 else
1729 echo "Failed to create '$dir'. Aborting." >&4
1730 exit 1
1731 fi
1732 done
1733 echo "(Now creating the symlinks...)" >&4
1734 awk '{print $1}' $src/MANIFEST | while true; do
1735 read filename
1736 test -z "$filename" && break
1737 if test -f $filename; then
1738 if $issymlink $filename; then
1739 rm -f $filename
1740 fi
1741 fi
1742 if test -f $filename; then
1743 echo "$filename already exists, not symlinking."
1744 else
1745 ln -s $pkgsrc/$filename $filename
1746 fi
1747 done
1748 echo "(Checking current directory...)" >&4
1749 cd UU
1750 awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | \
1751 (split -l 50 2>/dev/null || split -50)
1752 rm -f missing
1753 tmppwd=`pwd`
1754 for filelist in x??; do
1755 (cd ..; ls `cat "$tmppwd/$filelist"` \
1756 >/dev/null 2>>"$tmppwd/missing")
1757 done
1758 if test -s missing; then
1759 echo "Failed duplication of source tree. Aborting." >&4
1760 exit 1
1761 fi
1762 ;;
1763 *) echo "(I cannot figure out how to do symbolic links, ignoring!)" >&4
1764 ;;
1765 esac
1766 ;;
1767 esac
1768 ;;
1769 esac
1770
1771 : see whether [:lower:] and [:upper:] are supported character classes
1772 echo " "
1773 case "`echo AbyZ | LC_ALL=C $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1774 ABYZ)
1775 echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
1776 up='[:upper:]'
1777 low='[:lower:]'
1778 ;;
1779 *) # There is a discontinuity in EBCDIC between 'I' and 'J'
1780 # (0xc9 and 0xd1), therefore that is a nice testing point.
1781 if test "X$up" = X -o "X$low" = X; then
1782 case "`echo IJ | LC_ALL=C $tr '[I-J]' '[i-j]' 2>/dev/null`" in
1783 ij) up='[A-Z]'
1784 low='[a-z]'
1785 ;;
1786 esac
1787 fi
1788 if test "X$up" = X -o "X$low" = X; then
1789 case "`echo IJ | LC_ALL=C $tr I-J i-j 2>/dev/null`" in
1790 ij) up='A-Z'
1791 low='a-z'
1792 ;;
1793 esac
1794 fi
1795 if test "X$up" = X -o "X$low" = X; then
1796 case "`echo IJ | od -x 2>/dev/null`" in
1797 *C9D1*|*c9d1*)
1798 echo "Hey, this might be EBCDIC." >&4
1799 if test "X$up" = X -o "X$low" = X; then
1800 case "`echo IJ | \
1801 LC_ALL=C $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
1802 ij) up='[A-IJ-RS-Z]'
1803 low='[a-ij-rs-z]'
1804 ;;
1805 esac
1806 fi
1807 if test "X$up" = X -o "X$low" = X; then
1808 case "`echo IJ | LC_ALL=C $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
1809 ij) up='A-IJ-RS-Z'
1810 low='a-ij-rs-z'
1811 ;;
1812 esac
1813 fi
1814 ;;
1815 esac
1816 fi
1817 esac
1818 case "`echo IJ | LC_ALL=C $tr \"$up\" \"$low\" 2>/dev/null`" in
1819 ij)
1820 echo "Using $up and $low to convert case." >&4
1821 ;;
1822 *)
1823 echo "I don't know how to translate letters from upper to lower case." >&4
1824 echo "Your tr is not acting any way I know of." >&4
1825 exit 1
1826 ;;
1827 esac
1828 : set up the translation script tr, must be called with ./tr of course
1829 cat >tr <<EOSC
1830 $startsh
1831 case "\$1\$2" in
1832 '[A-Z][a-z]') LC_ALL=C exec $tr '$up' '$low';;
1833 '[a-z][A-Z]') LC_ALL=C exec $tr '$low' '$up';;
1834 esac
1835 LC_ALL=C exec $tr "\$@"
1836 EOSC
1837 chmod +x tr
1838 $eunicefix tr
1839
1840 : setup for possible cross-compilation
1841 run=''
1842 to=:
1843 from=:
1844 usecrosscompile='undef'
1845 targetarch=''
1846 case "$usecrosscompile" in
1847 $define|true|[yY]*)
1848 echo "Cross-compilation is not supported for this package." >&4
1849 exit 1
1850 ;;
1851 esac
1852
1853 : Determine the name of the machine
1854 myuname=`$uname -a 2>/dev/null`
1855 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
1856 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
1857 ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
1858 newmyuname="$myuname"
1859 has_uname=
1860 $test -f "$uname" && has_uname=y
1861
1862 : Guessing of the OS name -- half the following guesses are probably wrong...
1863 : If you have better tests or hints, please send them to the metaconfig
1864 : authors and to [email protected]
1865 $test -f /irix && osname=irix
1866 $test -f /xenix && osname=sco_xenix
1867 $test -f /dynix && osname=dynix
1868 $test -f /dnix && osname=dnix
1869 $test -f /lynx.os && osname=lynxos
1870 $test -f /unicos && osname=unicos && osvers=`$uname -r`
1871 $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
1872 $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
1873 $test -f /bin/mips && /bin/mips && osname=mips
1874 $test -d /NextApps && set X `hostinfo | $grep 'NeXT Mach.*:' | \
1875 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
1876 $test -d /usr/apollo/bin && osname=apollo
1877 $test -f /etc/saf/_sactab && osname=svr4
1878 $test -d /usr/include/minix && osname=minix
1879 $test -f /system/gnu_library/bin/ar.pm && osname=vos
1880 if $test -d /MachTen -o -d /MachTen_Folder; then
1881 osname=machten
1882 if $test -x /sbin/version; then
1883 osvers=`/sbin/version | $awk '{print $2}' |
1884 $sed -e 's/[A-Za-z]$//'`
1885 elif $test -x /usr/etc/version; then
1886 osvers=`/usr/etc/version | $awk '{print $2}' |
1887 $sed -e 's/[A-Za-z]$//'`
1888 else
1889 osvers="$2.$3"
1890 fi
1891 fi
1892 $test -f /sys/posix.dll &&
1893 $test -f /usr/bin/what &&
1894 set X `/usr/bin/what /sys/posix.dll` &&
1895 $test "$3" = UWIN &&
1896 osname=uwin &&
1897 osvers="$5"
1898 if $test "X$has_uname" != X; then
1899 set X $myuname
1900 shift
1901 case "$5" in
1902 fps*) osname=fps ;;
1903 mips*)
1904 case "$4" in
1905 umips) osname=umips ;;
1906 *) osname=mips ;;
1907 esac;;
1908 [23]100) osname=mips ;;
1909 next*) osname=next ;;
1910 i386*)
1911 tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
1912 if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
1913 osname='sco'
1914 osvers=$tmp
1915 elif $test -f /etc/kconfig; then
1916 osname=isc
1917 if $test "$lns" = "$ln -s"; then
1918 osvers=4
1919 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
1920 osvers=3
1921 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1
1922 then
1923 osvers=2
1924 fi
1925 fi
1926 tmp=''
1927 ;;
1928 pc*)
1929 if $test -n "$DJGPP"; then
1930 osname=dos
1931 osvers=djgpp
1932 fi
1933 ;;
1934 esac
1935 case "$1" in
1936 aix) osname=aix
1937 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
1938 case "$tmp" in
1939 'not found') osvers="$4"."$3" ;;
1940 '<3240'|'<>3240') osvers=3.2.0 ;;
1941 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
1942 '=3250'|'>3250') osvers=3.2.5 ;;
1943 *) osvers=$tmp;;
1944 esac
1945 ;;
1946 bsd386) osname=bsd386
1947 osvers=`$uname -r`
1948 ;;
1949 cygwin*) osname=cygwin
1950 osvers=`echo "$3" | sed -e 's/\(.*\)(.*/\1/'`
1951 ;;
1952 mingw*) osname=mingw
1953 osvers=`echo "$3" | sed -e 's/\(.*\)(.*/\1/'`
1954 ;;
1955 *dc.osx) osname=dcosx
1956 osvers="$3"
1957 ;;
1958 dnix) osname=dnix
1959 osvers="$3"
1960 ;;
1961 domainos) osname=apollo
1962 osvers="$3"
1963 ;;
1964 dgux) osname=dgux
1965 osvers="$3"
1966 ;;
1967 dynixptx*) osname=dynixptx
1968 osvers=`echo "$4"|sed 's/^v//'`
1969 ;;
1970 freebsd) osname=freebsd
1971 osvers="$3" ;;
1972 genix) osname=genix ;;
1973 hp*) osname=hpux
1974 osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
1975 ;;
1976 irix*) osname=irix
1977 case "$3" in
1978 4*) osvers=4 ;;
1979 5*) osvers=5 ;;
1980 *) osvers="$3" ;;
1981 esac
1982 ;;
1983 linux) osname=linux
1984 case "$3" in
1985 *) osvers="$3" ;;
1986 esac
1987 ;;
1988 MiNT) osname=mint
1989 ;;
1990 netbsd*) osname=netbsd
1991 osvers="$3"
1992 ;;
1993 news-os) osvers="$3"
1994 case "$3" in
1995 4*) osname=newsos4 ;;
1996 *) osname=newsos ;;
1997 esac
1998 ;;
1999 next*) osname=next ;;
2000 nonstop-ux) osname=nonstopux ;;
2001 openbsd) osname=openbsd
2002 osvers="$3"
2003 ;;
2004 POSIX-BC | posix-bc ) osname=posix-bc
2005 osvers="$3"
2006 ;;
2007 powerux | power_ux | powermax_os | powermaxos | \
2008 powerunix | power_unix) osname=powerux
2009 osvers="$3"
2010 ;;
2011 qnx) osname=qnx
2012 osvers="$4"
2013 ;;
2014 solaris) osname=solaris
2015 case "$3" in
2016 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2017 *) osvers="$3" ;;
2018 esac
2019 ;;
2020 sunos) osname=sunos
2021 case "$3" in
2022 5*) osname=solaris
2023 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
2024 *) osvers="$3" ;;
2025 esac
2026 ;;
2027 titanos) osname=titanos
2028 case "$3" in
2029 1*) osvers=1 ;;
2030 2*) osvers=2 ;;
2031 3*) osvers=3 ;;
2032 4*) osvers=4 ;;
2033 *) osvers="$3" ;;
2034 esac
2035 ;;
2036 ultrix) osname=ultrix
2037 osvers="$3"
2038 ;;
2039 osf1|mls+) case "$5" in
2040 alpha)
2041 osname=dec_osf
2042 osvers=`sizer -v | awk '{print $3}' | \
2043 ./tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
2044 case "$osvers" in
2045 [1-9].[0-9]*) ;;
2046 *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
2047 esac
2048 ;;
2049 hp*) osname=hp_osf1 ;;
2050 mips) osname=mips_osf1 ;;
2051 esac
2052 ;;
2053 unixware) osname=svr5
2054 osvers="$4"
2055 ;;
2056 uts) osname=uts
2057 osvers="$3"
2058 ;;
2059 vos) osvers="$3"
2060 ;;
2061 $2) case "$osname" in
2062 *isc*) ;;
2063 *freebsd*) ;;
2064 svr*)
2065 : svr4.x or possibly later
2066 case "svr$3" in
2067 ${osname}*)
2068 osname=svr$3
2069 osvers=$4
2070 ;;
2071 esac
2072 case "$osname" in
2073 svr4.0)
2074 : Check for ESIX
2075 if $test -f /stand/boot ; then
2076 eval `$grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
2077 if $test -n "$INITPROG" -a -f "$INITPROG"; then
2078 isesix=`strings -a $INITPROG | \
2079 $grep 'ESIX SYSTEM V/386 Release 4.0'`
2080 if $test -n "$isesix"; then
2081 osname=esix4
2082 fi
2083 fi
2084 fi
2085 ;;
2086 esac
2087 ;;
2088 *) if $test -f /etc/systemid; then
2089 osname=sco
2090 set `echo $3 | $sed 's/\./ /g'` $4
2091 if $test -f $src/hints/sco_$1_$2_$3.sh; then
2092 osvers=$1.$2.$3
2093 elif $test -f $src/hints/sco_$1_$2.sh; then
2094 osvers=$1.$2
2095 elif $test -f $src/hints/sco_$1.sh; then
2096 osvers=$1
2097 fi
2098 else
2099 case "$osname" in
2100 '') : Still unknown. Probably a generic Sys V.
2101 osname="sysv"
2102 osvers="$3"
2103 ;;
2104 esac
2105 fi
2106 ;;
2107 esac
2108 ;;
2109 *) case "$osname" in
2110 '') : Still unknown. Probably a generic BSD.
2111 osname="$1"
2112 osvers="$3"
2113 ;;
2114 esac
2115 ;;
2116 esac
2117 else
2118 if $test -f /vmunix -a -f $src/hints/news_os.sh; then
2119 (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
2120 if $contains news-os UU/kernel.what >/dev/null 2>&1; then
2121 osname=news_os
2122 fi
2123 $rm -f UU/kernel.what
2124 elif $test -d c:/.; then
2125 set X $myuname
2126 osname=os2
2127 osvers="$5"
2128 fi
2129 fi
2130
2131 : Try to determine whether config.sh was made on this system
2132 case "$config_sh" in
2133 '')
2134 dflt=n
2135 case "$knowitall" in
2136 '')
2137 if test -f ../config.sh; then
2138 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2139 eval "`$grep myuname= ../config.sh`"
2140 fi
2141 if test "X$myuname" = "X$newmyuname"; then
2142 dflt=y
2143 fi
2144 fi
2145 ;;
2146 *) dflt=y;;
2147 esac
2148
2149 saved_osname="$osname"
2150 saved_osvers="$osvers"
2151 saved_libswanted="$libswanted"
2152 tmp_n="$n"
2153 tmp_c="$c"
2154 tmp_sh="$sh"
2155
2156 : Get old answers from config file if it was generated on the same system
2157 hint=default
2158 if $test -f ../config.sh; then
2159 echo " "
2160 rp="I see a config.sh file. Shall I use it to set the defaults?"
2161 . ./myread
2162 case "$ans" in
2163 n*|N*) echo "OK, I'll ignore it."
2164 mv ../config.sh ../config.sh.old
2165 myuname="$newmyuname"
2166 ;;
2167 *) echo "Fetching default answers from your old config.sh file..." >&4
2168 . ../config.sh
2169 cp ../config.sh .
2170 hint=previous
2171 case "$dflt" in
2172 n)
2173 echo " "
2174 rp="Do you want further invocations to use these defaults?"
2175 . ./myread
2176 case "$ans" in
2177 y*|Y*) myuname="$newmyuname";;
2178 esac
2179 ;;
2180 esac
2181 ;;
2182 esac
2183 fi
2184 ;;
2185 *)
2186 echo " "
2187 echo "Fetching default answers from $config_sh..." >&4
2188 cd ..
2189 cp $config_sh config.sh 2>/dev/null
2190 chmod +w config.sh
2191 . ./config.sh
2192 cd UU
2193 cp ../config.sh .
2194 hint=previous
2195 ;;
2196 esac
2197 case "$sh" in
2198 '') sh="$tmp_sh" ;;
2199 esac
2200 $test "$override" && . ./optdef.sh
2201
2202 : Restore computed paths
2203 for file in $loclist $trylist; do
2204 eval $file="\$_$file"
2205 done
2206
2207 osname="$saved_osname"
2208 osvers="$saved_osvers"
2209 n="$tmp_n"
2210 c="$tmp_c"
2211
2212 case "$libswanted" in
2213 "$saved_libswanted") ;;
2214 *) libs='';;
2215 esac
2216 libswanted="$saved_libswanted"
2217
2218 . ./checkcc
2219 case "$targetarch" in
2220 '') ;;
2221 *) hostarch=$osname
2222 osname=`echo $targetarch|sed 's,^[^-]*-,,'`
2223 osvers=''
2224 ;;
2225 esac
2226
2227 : Process their -A options
2228 . ./posthint.sh
2229
2230 : Ask them to confirm the OS name
2231 cat << EOM
2232
2233 Configure uses the operating system name and version to set some defaults.
2234 The default value is probably right if the name rings a bell. Otherwise,
2235 since spelling matters for me, either accept the default or answer "none"
2236 to leave it blank.
2237
2238 EOM
2239 case "$osname" in
2240 ''|' ')
2241 case "$hintfile" in
2242 ''|' '|none) dflt=none ;;
2243 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
2244 esac
2245 ;;
2246 *) dflt="$osname" ;;
2247 esac
2248 rp="Operating system name?"
2249 . ./myread
2250 case "$ans" in
2251 none) osname='' ;;
2252 *) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
2253 esac
2254 echo " "
2255 case "$osvers" in
2256 ''|' ')
2257 case "$hintfile" in
2258 ''|' '|none) dflt=none ;;
2259 *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
2260 dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
2261 case "$dflt" in
2262 ''|' ') dflt=none ;;
2263 esac
2264 ;;
2265 esac
2266 ;;
2267 *) dflt="$osvers" ;;
2268 esac
2269 rp="Operating system version?"
2270 . ./myread
2271 case "$ans" in
2272 none) osvers='' ;;
2273 *) osvers="$ans" ;;
2274 esac
2275
2276 : who configured the system
2277 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
2278 case "$cf_by" in
2279 "")
2280 cf_by=`(logname) 2>/dev/null`
2281 case "$cf_by" in
2282 "")
2283 cf_by=`(whoami) 2>/dev/null`
2284 case "$cf_by" in
2285 "") cf_by=unknown ;;
2286 esac ;;
2287 esac ;;
2288 esac
2289
2290 : allow them to override the AFS root
2291 case "$afsroot" in
2292 '') afsroot=/afs ;;
2293 *) afsroot=$afsroot ;;
2294 esac
2295
2296 : is AFS running?
2297 echo " "
2298 case "$afs" in
2299 $define|true) afs=true ;;
2300 $undef|false) afs=false ;;
2301 *) if $test -d $afsroot; then
2302 afs=true
2303 else
2304 afs=false
2305 fi
2306 ;;
2307 esac
2308 if $afs; then
2309 echo "AFS may be running... I'll be extra cautious then..." >&4
2310 else
2311 echo "AFS does not seem to be running..." >&4
2312 fi
2313
2314 : determine where manual pages are on this system
2315 echo " "
2316 case "$sysman" in
2317 '')
2318 syspath='/usr/share/man/man1 /usr/man/man1'
2319 syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
2320 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
2321 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
2322 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2323 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
2324 sysman=`./loc . /usr/man/man1 $syspath`
2325 ;;
2326 esac
2327 if $test -d "$sysman"; then
2328 echo "System manual is in $sysman." >&4
2329 else
2330 echo "Could not find manual pages in source form." >&4
2331 fi
2332
2333 : decide how portable to be
2334 case "$d_portable" in
2335 "$define") dflt=y;;
2336 *) dflt=n;;
2337 esac
2338 $cat <<'EOH'
2339
2340 I can set things up so that your shell scripts and binaries are more portable,
2341 at what may be a noticeable cost in performance. In particular, if you
2342 ask to be portable, the following happens:
2343
2344 1) Shell scripts will rely on the PATH variable rather than using
2345 the paths derived above.
2346 2) ~username interpretations will be done at run time rather than
2347 by Configure.
2348
2349 EOH
2350 rp="Do you expect to run these scripts and binaries on multiple machines?"
2351 . ./myread
2352 case "$ans" in
2353 y*) d_portable="$define"
2354 ;;
2355 *) d_portable="$undef" ;;
2356 esac
2357
2358 : set up shell script to do ~ expansion
2359 cat >filexp <<EOSS
2360 $startsh
2361 : expand filename
2362 case "\$1" in
2363 \~/*|\~)
2364 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
2365 ;;
2366 \~*)
2367 if $test -f /bin/csh; then
2368 /bin/csh -f -c "glob \$1"
2369 failed=\$?
2370 echo ""
2371 exit \$failed
2372 else
2373 name=\`$expr x\$1 : '..\([^/]*\)'\`
2374 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
2375 if $test ! -d "\$dir"; then
2376 me=\`basename \$0\`
2377 echo "\$me: can't locate home directory for: \$name" >&2
2378 exit 1
2379 fi
2380 case "\$1" in
2381 */*)
2382 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
2383 ;;
2384 *)
2385 echo \$dir
2386 ;;
2387 esac
2388 fi
2389 ;;
2390 *)
2391 echo \$1
2392 ;;
2393 esac
2394 EOSS
2395 chmod +x filexp
2396 $eunicefix filexp
2397
2398 : now set up to get a file name
2399 cat <<EOS >getfile
2400 $startsh
2401 EOS
2402 cat <<'EOSC' >>getfile
2403 tilde=''
2404 fullpath=''
2405 already=''
2406 skip=''
2407 none_ok=''
2408 exp_file=''
2409 nopath_ok=''
2410 orig_rp="$rp"
2411 orig_dflt="$dflt"
2412 case "$gfpth" in
2413 '') gfpth='.' ;;
2414 esac
2415
2416 case "$fn" in
2417 *\(*)
2418 : getfile will accept an answer from the comma-separated list
2419 : enclosed in parentheses even if it does not meet other criteria.
2420 expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
2421 fn=`echo $fn | sed 's/(.*)//'`
2422 ;;
2423 esac
2424
2425 case "$fn" in
2426 *:*)
2427 loc_file=`expr $fn : '.*:\(.*\)'`
2428 fn=`expr $fn : '\(.*\):.*'`
2429 ;;
2430 esac
2431
2432 case "$fn" in
2433 *~*) tilde=true;;
2434 esac
2435 case "$fn" in
2436 */*) fullpath=true;;
2437 esac
2438 case "$fn" in
2439 *+*) skip=true;;
2440 esac
2441 case "$fn" in
2442 *n*) none_ok=true;;
2443 esac
2444 case "$fn" in
2445 *e*) exp_file=true;;
2446 esac
2447 case "$fn" in
2448 *p*) nopath_ok=true;;
2449 esac
2450
2451 case "$fn" in
2452 *f*) type='File';;
2453 *d*) type='Directory';;
2454 *l*) type='Locate';;
2455 esac
2456
2457 what="$type"
2458 case "$what" in
2459 Locate) what='File';;
2460 esac
2461
2462 case "$exp_file" in
2463 '')
2464 case "$d_portable" in
2465 "$define") ;;
2466 *) exp_file=true;;
2467 esac
2468 ;;
2469 esac
2470
2471 cd ..
2472 while test "$type"; do
2473 redo=''
2474 rp="$orig_rp"
2475 dflt="$orig_dflt"
2476 case "$tilde" in
2477 true) rp="$rp (~name ok)";;
2478 esac
2479 . UU/myread
2480 if test -f UU/getfile.ok && \
2481 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
2482 then
2483 value="$ans"
2484 ansexp="$ans"
2485 break
2486 fi
2487 case "$ans" in
2488 none)
2489 value=''
2490 ansexp=''
2491 case "$none_ok" in
2492 true) type='';;
2493 esac
2494 ;;
2495 *)
2496 case "$tilde" in
2497 '') value="$ans"
2498 ansexp="$ans";;
2499 *)
2500 value=`UU/filexp $ans`
2501 case $? in
2502 0)
2503 if test "$ans" != "$value"; then
2504 echo "(That expands to $value on this system.)"
2505 fi
2506 ;;
2507 *) value="$ans";;
2508 esac
2509 ansexp="$value"
2510 case "$exp_file" in
2511 '') value="$ans";;
2512 esac
2513 ;;
2514 esac
2515 case "$fullpath" in
2516 true)
2517 case "$ansexp" in
2518 /*) value="$ansexp" ;;
2519 [a-zA-Z]:/*) value="$ansexp" ;;
2520 [a-zA-Z]:\\*) value="$ansexp" ;;
2521 *)
2522 redo=true
2523 case "$already" in
2524 true)
2525 echo "I shall only accept a full path name, as in /bin/ls." >&4
2526 echo "Use a ! shell escape if you wish to check pathnames." >&4
2527 ;;
2528 *)
2529 echo "Please give a full path name, starting with slash." >&4
2530 case "$tilde" in
2531 true)
2532 echo "Note that using ~name is ok provided it expands well." >&4
2533 already=true
2534 ;;
2535 esac
2536 esac
2537 ;;
2538 esac
2539 ;;
2540 esac
2541 case "$redo" in
2542 '')
2543 case "$type" in
2544 File)
2545 for fp in $gfpth; do
2546 if test "X$fp" = X.; then
2547 pf="$ansexp"
2548 else
2549 pf="$fp/$ansexp"
2550 fi
2551 if test -f "$pf"; then
2552 type=''
2553 elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
2554 then
2555 echo "($value is not a plain file, but that's ok.)"
2556 type=''
2557 fi
2558 if test X"$type" = X; then
2559 value="$pf"
2560 break
2561 fi
2562 done
2563 ;;
2564 Directory)
2565 for fp in $gfpth; do
2566 if test "X$fp" = X.; then
2567 dir="$ans"
2568 direxp="$ansexp"
2569 else
2570 dir="$fp/$ansexp"
2571 direxp="$fp/$ansexp"
2572 fi
2573 if test -d "$direxp"; then
2574 type=''
2575 value="$dir"
2576 break
2577 fi
2578 done
2579 ;;
2580 Locate)
2581 if test -d "$ansexp"; then
2582 echo "(Looking for $loc_file in directory $value.)"
2583 value="$value/$loc_file"
2584 ansexp="$ansexp/$loc_file"
2585 fi
2586 if test -f "$ansexp"; then
2587 type=''
2588 fi
2589 case "$nopath_ok" in
2590 true) case "$value" in
2591 */*) ;;
2592 *) echo "Assuming $value will be in people's path."
2593 type=''
2594 ;;
2595 esac
2596 ;;
2597 esac
2598 ;;
2599 esac
2600
2601 case "$skip" in
2602 true) type='';
2603 esac
2604
2605 case "$type" in
2606 '') ;;
2607 *)
2608 if test "$fastread" = yes; then
2609 dflt=y
2610 else
2611 dflt=n
2612 fi
2613 rp="$what $value doesn't exist. Use that name anyway?"
2614 . UU/myread
2615 dflt=''
2616 case "$ans" in
2617 y*) type='';;
2618 *) echo " ";;
2619 esac
2620 ;;
2621 esac
2622 ;;
2623 esac
2624 ;;
2625 esac
2626 done
2627 cd UU
2628 ans="$value"
2629 rp="$orig_rp"
2630 dflt="$orig_dflt"
2631 rm -f getfile.ok
2632 test "X$gfpthkeep" != Xy && gfpth=""
2633 EOSC
2634
2635 : determine root of directory hierarchy where package will be installed.
2636 case "$prefix" in
2637 '')
2638 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
2639 ;;
2640 *)
2641 dflt="$prefix"
2642 ;;
2643 esac
2644 $cat <<EOM
2645
2646 By default, $package will be installed in $dflt/bin, manual
2647 pages under $dflt/man, etc..., i.e. with $dflt as prefix for
2648 all installation directories. Typically set to /usr/local, but you
2649 may choose /usr if you wish to install $package among your system
2650 binaries. If you wish to have binaries under /bin but manual pages
2651 under /usr/local/man, that's ok: you will be prompted separately
2652 for each of the installation directories, the prefix being only used
2653 to set the defaults.
2654
2655 EOM
2656 fn=d~
2657 rp='Installation prefix to use?'
2658 . ./getfile
2659 oldprefix=''
2660 case "$prefix" in
2661 '') ;;
2662 *)
2663 case "$ans" in
2664 "$prefix") ;;
2665 *) oldprefix="$prefix";;
2666 esac
2667 ;;
2668 esac
2669 prefix="$ans"
2670 prefixexp="$ansexp"
2671
2672 : set the prefixit variable, to compute a suitable default value
2673 prefixit='case "$3" in
2674 ""|none)
2675 case "$oldprefix" in
2676 "") eval "$1=\"\$$2\"";;
2677 *)
2678 case "$3" in
2679 "") eval "$1=";;
2680 none)
2681 eval "tp=\"\$$2\"";
2682 case "$tp" in
2683 ""|" ") eval "$1=\"\$$2\"";;
2684 *) eval "$1=";;
2685 esac;;
2686 esac;;
2687 esac;;
2688 *)
2689 eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
2690 case "$tp" in
2691 --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
2692 /*-$oldprefix/*|\~*-$oldprefix/*)
2693 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
2694 *) eval "$1=\"\$$2\"";;
2695 esac;;
2696 esac'
2697
2698 : set the prefixup variable, to restore leading tilda escape
2699 prefixup='case "$prefixexp" in
2700 "$prefix") ;;
2701 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
2702 esac'
2703
2704 : determine where manual pages go
2705 set mansrc mansrc none
2706 eval $prefixit
2707 $cat <<EOM
2708
2709 $spackage has manual pages available in source form.
2710 EOM
2711 case "$nroff" in
2712 nroff)
2713 echo "However, you don't have nroff, so they're probably useless to you."
2714 case "$mansrc" in
2715 '') mansrc="none";;
2716 esac;;
2717 esac
2718 echo "If you don't want the manual sources installed, answer 'none'."
2719 case "$mansrc" in
2720 '')
2721 lookpath="$prefixexp/share/man/man1 $prefixexp/man/man1"
2722 lookpath="$lookpath $prefixexp/man/u_man/man1 $prefixexp/man/l_man/man1"
2723 lookpath="$lookpath /usr/local/man/man1 /opt/man/man1 /usr/man/manl"
2724 lookpath="$lookpath /usr/share/man/man1 /usr/local/share/man/man1"
2725 lookpath="$lookpath /usr/man/local/man1 /usr/man/l_man/man1"
2726 lookpath="$lookpath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
2727 lookpath="$lookpath /usr/man/man.L"
2728 mansrc=`./loc . $prefixexp/man/man1 $lookpath`
2729 if $test -d "$mansrc"; then
2730 dflt="$mansrc"
2731 else
2732 dflt="$sysman"
2733 fi
2734 set dflt
2735 eval $prefixup
2736 ;;
2737 ' ') dflt=none;;
2738 *) dflt="$mansrc"
2739 ;;
2740 esac
2741 echo " "
2742 fn=dn~
2743 rp='Where do the manual pages (source) go?'
2744 . ./getfile
2745 if test "X$mansrcexp" != "X$ansexp"; then
2746 installmansrc=''
2747 fi
2748 mansrc="$ans"
2749 mansrcexp="$ansexp"
2750 case "$mansrc" in
2751 '') mansrc=' '
2752 installmansrc='';;
2753 esac
2754 if $afs && $test "$mansrc"; then
2755 $cat <<EOM
2756
2757 Since you are running AFS, I need to distinguish the directory in which
2758 manual pages reside from the directory in which they are installed (and from
2759 which they are presumably copied to the former directory by occult means).
2760
2761 EOM
2762 case "$installmansrc" in
2763 '') dflt=`echo $mansrcexp | sed 's#^/afs/#/afs/.#'`;;
2764 *) dflt="$installmansrc";;
2765 esac
2766 fn=de~
2767 rp='Where will man pages be installed?'
2768 . ./getfile
2769 installmansrc="$ans"
2770 else
2771 installmansrc="$mansrcexp"
2772 fi
2773
2774 case "$mansrc" in
2775 ' ') manext='0';;
2776 *l) manext=l;;
2777 *n) manext=n;;
2778 *o) manext=l;;
2779 *p) manext=n;;
2780 *C) manext=C;;
2781 *L) manext=L;;
2782 *L1) manext=L1;;
2783 *) manext=1;;
2784 esac
2785
2786 : determine where private executables go
2787 set dflt privlib lib/$package
2788 eval $prefixit
2789 $cat <<EOM
2790
2791 There are some auxiliary files for $package that need to be put into a
2792 private library directory that is accessible by everyone.
2793
2794 EOM
2795 fn=d~+
2796 rp='Pathname where the private library files will reside?'
2797 . ./getfile
2798 if $test "X$privlibexp" != "X$ansexp"; then
2799 installprivlib=''
2800 fi
2801 privlib="$ans"
2802 privlibexp="$ansexp"
2803 if $afs; then
2804 $cat <<EOM
2805
2806 Since you are running AFS, I need to distinguish the directory in which
2807 private files reside from the directory in which they are installed (and from
2808 which they are presumably copied to the former directory by occult means).
2809
2810 EOM
2811 case "$installprivlib" in
2812 '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
2813 *) dflt="$installprivlib";;
2814 esac
2815 fn=de~
2816 rp='Where will private files be installed?'
2817 . ./getfile
2818 installprivlib="$ans"
2819 else
2820 installprivlib="$privlibexp"
2821 fi
2822
2823 : determine where public executable scripts go
2824 set scriptdir scriptdir
2825 eval $prefixit
2826 case "$scriptdir" in
2827 '')
2828 dflt="$bin"
2829 : guess some guesses
2830 $test -d /usr/share/scripts && dflt=/usr/share/scripts
2831 $test -d /usr/share/bin && dflt=/usr/share/bin
2832 $test -d /usr/local/script && dflt=/usr/local/script
2833 $test -d $prefixexp/script && dflt=$prefixexp/script
2834 set dflt
2835 eval $prefixup
2836 ;;
2837 *) dflt="$scriptdir"
2838 ;;
2839 esac
2840 $cat <<EOM
2841
2842 Some installations have a separate directory just for executable scripts so
2843 that they can mount it across multiple architectures but keep the scripts in
2844 one spot. You might, for example, have a subdirectory of /usr/share for this.
2845 Or you might just lump your scripts in with all your other executables.
2846
2847 EOM
2848 fn=d~
2849 rp='Where do you keep publicly executable scripts?'
2850 . ./getfile
2851 if $test "X$ansexp" != "X$scriptdirexp"; then
2852 installscript=''
2853 fi
2854 scriptdir="$ans"
2855 scriptdirexp="$ansexp"
2856 if $afs; then
2857 $cat <<EOM
2858
2859 Since you are running AFS, I need to distinguish the directory in which
2860 scripts reside from the directory in which they are installed (and from
2861 which they are presumably copied to the former directory by occult means).
2862
2863 EOM
2864 case "$installscript" in
2865 '') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;;
2866 *) dflt="$installscript";;
2867 esac
2868 fn=de~
2869 rp='Where will public scripts be installed?'
2870 . ./getfile
2871 installscript="$ans"
2872 else
2873 installscript="$scriptdirexp"
2874 fi
2875
2876 : preserve RCS keywords in files with variable substitution, grrr
2877 Header='$Header'
2878 Id='$Id'
2879 Log='$Log'
2880
2881 : Define several unixisms.
2882 : Hints files or command line option can be used to override them.
2883 case "$_a" in
2884 '') _a='.a';;
2885 esac
2886 case "$_o" in
2887 '') _o='.o';;
2888 esac
2889
2890 rm_try="$rm -f try try$_exe a.out .out try.[cho] try.$_o core core.try* try.core*"
2891
2892 : set the base revision
2893 baserev=3.5
2894
2895 : make some quick guesses about what we are up against
2896 echo " "
2897 $echo $n "Hmm... $c"
2898 echo exit 1 >bsd
2899 echo exit 1 >usg
2900 echo exit 1 >v7
2901 echo exit 1 >osf1
2902 echo exit 1 >eunice
2903 echo exit 1 >xenix
2904 echo exit 1 >venix
2905 echo exit 1 >os2
2906 echo exit 1 >gnu
2907 echo exit 1 >linux
2908 echo exit 1 >dos
2909 echo exit 1 >windows
2910 d_bsd="$undef"
2911 d_linux="$undef"
2912 d_dos="$undef"
2913 d_os2="$undef"
2914 d_windows="$undef"
2915 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
2916 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
2917 then
2918 echo "Looks kind of like an OSF/1 system, but we'll see..."
2919 echo exit 0 >osf1
2920 elif test `echo abc | $tr a-z A-Z` = Abc ; then
2921 xxx=`./loc addbib blurfl $pth`
2922 if $test -f $xxx; then
2923 echo "Looks kind of like a USG system with BSD features, but we'll see..."
2924 echo exit 0 >bsd
2925 echo exit 0 >usg
2926 else
2927 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
2928 echo "Looks kind of like an extended USG system, but we'll see..."
2929 else
2930 echo "Looks kind of like a USG system, but we'll see..."
2931 fi
2932 echo exit 0 >usg
2933 fi
2934 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
2935 echo "Looks kind of like a BSD system, but we'll see..."
2936 d_bsd="$define"
2937 echo exit 0 >bsd
2938 elif
2939 $rm --version 2>/dev/null >foo;
2940 $contains "Free Software Foundation" foo >/dev/null
2941 then
2942 xxx=`uname`
2943 echo exit 0 >gnu
2944 echo "Looks kind of like a GNU/$xxx system, but we'll see..."
2945 if $test X$xxx = XLinux; then
2946 d_linux="$define"
2947 echo exit 0 >linux
2948 fi
2949 else
2950 echo "Looks kind of like a Version 7 system, but we'll see..."
2951 echo exit 0 >v7
2952 fi
2953 case "$eunicefix" in
2954 *unixtovms*)
2955 $cat <<'EOI'
2956 There is, however, a strange, musty smell in the air that reminds me of
2957 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
2958 EOI
2959 echo exit 0 >eunice
2960 d_eunice="$define"
2961 : it so happens the Eunice I know will not run shell scripts in Unix format
2962 ;;
2963 *)
2964 echo " "
2965 echo "Congratulations. You aren't running Eunice."
2966 d_eunice="$undef"
2967 ;;
2968 esac
2969 if test -d c:/.; then
2970 case "X${MACHTYPE:-nonesuchmach}" in
2971 *cygwin) echo " "; echo "Hah!... you're running under Cygwin!";;
2972 *msys) echo " "; echo "Hah!... you're running under MinGW!";;
2973 esac
2974 case "X${MACHTYPE:-nonesuchmach}" in
2975 *cygwin|*msys)
2976 echo exit 0 >windows
2977 d_windows="$define"
2978 ;;
2979 esac
2980 fi
2981 case "$p_" in
2982 :) ;;
2983 *)
2984 $cat <<'EOI'
2985 I have the feeling something is not exactly right, however...don't tell me...
2986 EOI
2987 if test -n "$DJGPP"; then
2988 echo exit 0 >dos
2989 d_dos="$define"
2990 else
2991 $cat <<'EOI'
2992 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
2993 EOI
2994 echo exit 0 >os2
2995 d_os2="$define"
2996 fi
2997 ;;
2998 esac
2999 if test -f /xenix; then
3000 echo "Actually, this looks more like a XENIX system..."
3001 echo exit 0 >xenix
3002 d_xenix="$define"
3003 else
3004 echo " "
3005 echo "It's not Xenix..."
3006 d_xenix="$undef"
3007 fi
3008 chmod +x xenix
3009 $eunicefix xenix
3010 if test -f /venix; then
3011 echo "Actually, this looks more like a VENIX system..."
3012 echo exit 0 >venix
3013 else
3014 echo " "
3015 if ./xenix; then
3016 : null
3017 else
3018 echo "Nor is it Venix..."
3019 fi
3020 fi
3021 chmod +x bsd usg v7 osf1 eunice xenix venix dos os2 gnu linux windows
3022 $eunicefix bsd usg v7 osf1 eunice xenix venix dos os2 gnu linux windows
3023 $rm -f foo
3024
3025 : What should the include directory be ?
3026 echo " "
3027 $echo $n "Hmm... $c"
3028 incpath=''
3029 mips_type=''
3030 if $test -f /bin/mips && /bin/mips; then
3031 echo "Looks like a MIPS system..."
3032 $cat >usr.c <<'EOCP'
3033 #ifdef SYSTYPE_BSD43
3034 /bsd43
3035 #endif
3036 EOCP
3037 if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
3038 dflt='/bsd43/usr/include'
3039 incpath='/bsd43'
3040 mips_type='BSD 4.3'
3041 else
3042 mips_type='System V'
3043 fi
3044 $rm -f usr.c usr.out
3045 echo "and you're compiling with the $mips_type compiler and libraries."
3046 echo "exit 0" >mips
3047 else
3048 echo "Doesn't look like a MIPS system."
3049 echo "exit 1" >mips
3050 fi
3051 chmod +x mips
3052 $eunicefix mips
3053
3054 : What should the include directory be ?
3055 echo " "
3056 dflt='/usr/include'
3057 case "$usrinc" in
3058 '') dflt="$incpath/usr/include";;
3059 *) dflt="$usrinc";;
3060 esac
3061 fn=d/
3062 rp='Where are the include files you want to use?'
3063 . ./getfile
3064 usrinc="$ans"
3065
3066 : see if we have to deal with yellow pages, now NIS.
3067 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
3068 if $test -f /usr/etc/nibindd; then
3069 echo " "
3070 echo "I'm fairly confident you're on a NeXT."
3071 echo " "
3072 rp='Do you get the hosts file via NetInfo?'
3073 dflt=y
3074 case "$hostcat" in
3075 nidump*) ;;
3076 '') ;;
3077 *) dflt=n;;
3078 esac
3079 . ./myread
3080 case "$ans" in
3081 y*) hostcat='nidump hosts .';;
3082 *) case "$hostcat" in
3083 nidump*) hostcat='';;
3084 esac
3085 ;;
3086 esac
3087 fi
3088 case "$hostcat" in
3089 nidump*) ;;
3090 *)
3091 case "$hostcat" in
3092 *ypcat*) dflt=y;;
3093 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
3094 dflt=y
3095 else
3096 dflt=n
3097 fi;;
3098 *) dflt=n;;
3099 esac
3100 echo " "
3101 rp='Are you getting the hosts file via yellow pages?'
3102 . ./myread
3103 case "$ans" in
3104 y*) hostcat='ypcat hosts';;
3105 *) hostcat='cat /etc/hosts';;
3106 esac
3107 ;;
3108 esac
3109 fi
3110 case "$hostcat" in
3111 '') hostcat=':'
3112 $test -f /etc/hosts && hostcat='cat /etc/hosts';;
3113 esac
3114 case "$groupcat" in
3115 '') groupcat=':'
3116 $test -f /etc/group && groupcat='cat /etc/group';;
3117 esac
3118 case "$passcat" in
3119 '') passcat=':'
3120 $test -f /etc/passwd && passcat='cat /etc/passwd';;
3121 esac
3122
3123 : now get the host name
3124 echo " "
3125 echo "Figuring out host name..." >&4
3126 case "$myhostname" in
3127 '') cont=true
3128 echo 'Maybe "hostname" will work...'
3129 if tans=`sh -c hostname 2>&1` ; then
3130 myhostname=$tans
3131 phostname=hostname
3132 cont=''
3133 fi
3134 ;;
3135 *) cont='';;
3136 esac
3137 if $test "$cont"; then
3138 if ./xenix; then
3139 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
3140 if tans=`cat /etc/systemid 2>&1` ; then
3141 myhostname=$tans
3142 phostname='cat /etc/systemid'
3143 echo "Whadyaknow. Xenix always was a bit strange..."
3144 cont=''
3145 fi
3146 elif $test -r /etc/systemid; then
3147 echo "(What is a non-Xenix system doing with /etc/systemid?)"
3148 fi
3149 fi
3150 if $test "$cont"; then
3151 echo 'No, maybe "uuname -l" will work...'
3152 if tans=`sh -c 'uuname -l' 2>&1` ; then
3153 myhostname=$tans
3154 phostname='uuname -l'
3155 else
3156 echo 'Strange. Maybe "uname -n" will work...'
3157 if tans=`sh -c 'uname -n' 2>&1` ; then
3158 myhostname=$tans
3159 phostname='uname -n'
3160 else
3161 echo 'Oh well, maybe I can mine it out of whoami.h...'
3162 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
3163 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
3164 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
3165 else
3166 case "$myhostname" in
3167 '') echo "Does this machine have an identity crisis or something?"
3168 phostname='';;
3169 *)
3170 echo "Well, you said $myhostname before..."
3171 phostname='echo $myhostname';;
3172 esac
3173 fi
3174 fi
3175 fi
3176 fi
3177 case "$myhostname" in
3178 '') myhostname=noname ;;
3179 esac
3180 : you do not want to know about this
3181 set $myhostname
3182 myhostname=$1
3183
3184 : verify guess
3185 if $test "$myhostname" ; then
3186 dflt=y
3187 rp='Your host name appears to be "'$myhostname'".'" Right?"
3188 . ./myread
3189 case "$ans" in
3190 y*) ;;
3191 *) myhostname='';;
3192 esac
3193 fi
3194
3195 : bad guess or no guess
3196 while $test "X$myhostname" = X ; do
3197 dflt=''
3198 rp="Please type the (one word) name of your host:"
3199 . ./myread
3200 myhostname="$ans"
3201 done
3202
3203 : translate upper to lower if necessary
3204 case "$myhostname" in
3205 *[A-Z]*)
3206 echo "(Normalizing case in your host name)"
3207 myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
3208 ;;
3209 esac
3210
3211 case "$myhostname" in
3212 *.*)
3213 dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
3214 myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
3215 echo "(Trimming domain name from host name--host name is now $myhostname)"
3216 ;;
3217 *) case "$mydomain" in
3218 '')
3219 {
3220 test "X$hostcat" = "Xypcat hosts" &&
3221 ypmatch "$myhostname" hosts 2>/dev/null |\
3222 $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \
3223 $test -s hosts
3224 } || {
3225 $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ /
3226 /[ ]$myhostname[ . ]/p" > hosts
3227 }
3228 tmp_re="[ . ]"
3229 $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ }
3230 END { print sum }" hosts` = x1 || tmp_re="[ ]"
3231 dflt=.`$awk \
3232 "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
3233 hosts | $sort | $uniq | \
3234 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
3235 case `$echo X$dflt` in
3236 X*\ *) echo "(Several hosts in /etc/hosts matched hostname)"
3237 dflt=.
3238 ;;
3239 X.)
3240 if $test -f /etc/hosts; then
3241 echo "(You do not have fully-qualified names in /etc/hosts)"
3242 else
3243 echo "(I cannot locate a hosts database anywhere)"
3244 fi
3245 ;;
3246 esac
3247 case "$dflt" in
3248 .)
3249 tans=`./loc resolv.conf X /etc /usr/etc`
3250 if $test -f "$tans"; then
3251 echo "(Attempting domain name extraction from $tans)"
3252 dflt=.`$sed -n -e 's/ / /g' \
3253 -e 's/^search *\([^ ]*\).*/\1/p' $tans \
3254 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
3255 case "$dflt" in
3256 .) dflt=.`$sed -n -e 's/ / /g' \
3257 -e 's/^domain *\([^ ]*\).*/\1/p' $tans \
3258 | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
3259 ;;
3260 esac
3261 fi
3262 ;;
3263 esac
3264 case "$dflt" in
3265 .) echo "(No help from resolv.conf either -- attempting clever guess)"
3266 dflt=.`sh -c domainname 2>/dev/null`
3267 case "$dflt" in
3268 '') dflt='.';;
3269 .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
3270 esac
3271 ;;
3272 esac
3273 case "$dflt$osname" in
3274 .os390)
3275 file="//'SYS1.TCPPARMS(TCPDATA)'"
3276 echo "(Attempting domain name extraction from $file)"
3277 dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "$file" 2>/dev/null`
3278 ;;
3279 esac
3280 case "$dflt" in
3281 .) echo "(Lost all hope -- silly guess then)"
3282 dflt='.nonet'
3283 ;;
3284 esac
3285 $rm -f hosts
3286 ;;
3287 *) dflt="$mydomain";;
3288 esac;;
3289 esac
3290 echo " "
3291 rp="What is your domain name?"
3292 . ./myread
3293 tans="$ans"
3294 case "$ans" in
3295 '') ;;
3296 .*) ;;
3297 *) tans=".$tans";;
3298 esac
3299 mydomain="$tans"
3300
3301 : translate upper to lower if necessary
3302 case "$mydomain" in
3303 *[A-Z]*)
3304 echo "(Normalizing case in your domain name)"
3305 mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
3306 ;;
3307 esac
3308
3309 : a little sanity check here
3310 case "$phostname" in
3311 '') ;;
3312 *)
3313 case `$phostname | ./tr '[A-Z]' '[a-z]'` in
3314 $myhostname$mydomain|$myhostname) ;;
3315 *)
3316 case "$phostname" in
3317 sed*)
3318 echo "(That doesn't agree with your whoami.h file, by the way.)"
3319 ;;
3320 *)
3321 echo "(That doesn't agree with your $phostname command, by the way.)"
3322 ;;
3323 esac
3324 ;;
3325 esac
3326 ;;
3327 esac
3328
3329 : determine the e-mail address of the user who is running us
3330 $cat <<EOM
3331
3332 I need to get your e-mail address in Internet format if possible, i.e.
3333 something like [email protected]. Please answer accurately since I have
3334 no easy means to double check it. The default value provided below
3335 is most probably close to reality but may not be valid from outside
3336 your organization...
3337
3338 EOM
3339 cont=x
3340 while test "$cont"; do
3341 case "$MAILDOMAIN" in
3342 '')
3343 if $test -s /etc/mailname; then
3344 maildomain=`$cat /etc/mailname`
3345 else
3346 maildomain="$myhostname$mydomain"
3347 fi
3348 ;;
3349 *) maildomain="$MAILDOMAIN";;
3350 esac
3351 case "$cf_email" in
3352 '') dflt="$cf_by@$maildomain";;
3353 *) dflt="$cf_email";;
3354 esac
3355 rp='What is your e-mail address?'
3356 . ./myread
3357 cf_email="$ans"
3358 case "$cf_email" in
3359 *@*.*) cont='' ;;
3360 *)
3361 rp='Address does not look like an Internet one. Use it anyway?'
3362 case "$fastread" in
3363 yes) dflt=y ;;
3364 *) dflt=n ;;
3365 esac
3366 . ./myread
3367 case "$ans" in
3368 y*) cont='' ;;
3369 *) echo " " ;;
3370 esac
3371 ;;
3372 esac
3373 done
3374
3375 : how do we get traditional cpp semantics?
3376 echo " "
3377 echo "Checking to see how to get traditional cpp semantics..." >&4
3378 $cat >foo.c <<'EOF'
3379 #define A(x) x
3380 #define B(y) y
3381 A(a)B(b)
3382 EOF
3383 if $cpp foo.c >foo.cpp; $contains ab foo.cpp >/dev/null 2>&1; then
3384 echo "Plain '$cpp' works just fine."
3385 cpp_trad="$cpp"
3386 elif $cpp -traditional foo.c >foo.cpp; \
3387 $contains ab foo.cpp >/dev/null 2>&1; then
3388 echo "We'll use '$cpp -traditional' to get proper semantics."
3389 cpp_trad="$cpp -traditional"
3390 else
3391 echo "I don't know how to get traditional semantics with '$cpp'." >&4
3392 cpp_trad="$cpp"
3393 fi
3394 $rm -f foo.c foo.cpp
3395
3396 : Check whether they have gcc in any guise.
3397 echo " "
3398 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3399 $cat >try.c <<EOM
3400 int main(void) {
3401 #ifdef __GNUC__
3402 gcc_version_major __GNUC__
3403 #ifdef __GNUC_MINOR__
3404 gcc_version_minor __GNUC__
3405 #endif
3406 #ifdef __GNUC_PATCHLEVEL__
3407 gcc_version_patchlevel __GNUC_PATCHLEVEL__
3408 #endif
3409 #endif
3410 }
3411 EOM
3412 if $cc -E try.c > try 2>&1
3413 then
3414 gccversion=`$grep gcc_version_major try |
3415 sed 's/^.*gcc_version_major[\t ]*//'`
3416 case "$gccversion" in
3417 '') echo "You are not using GNU cc." ;;
3418 *) echo "You are using GNU cc $gccversion."
3419 ccname=gcc
3420 ;;
3421 esac
3422 else
3423 gccversion=''
3424 fi
3425 $rm -f try try.*
3426 case "$gccversion" in
3427 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3428 esac
3429 case "$gccversion" in
3430 '') gccosandvers='' ;;
3431 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3432 gccosandvers=`$cc -v 2>&1 | \
3433 $grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3434 gccshortvers=''
3435 case "$gccosandvers" in
3436 $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3437 $osname$osvers) ;; # looking good
3438 $osname*) cat <<EOM >&4
3439
3440 *** WHOA THERE!!! ***
3441
3442 Your gcc has not been compiled for the exact release of
3443 your operating system ($gccosandvers versus $osname$osvers).
3444
3445 In general it is a good idea to keep gcc synchronized with
3446 the operating system because otherwise serious problems
3447 may ensue when trying to compile software, like Perl.
3448
3449 I'm trying to be optimistic here, though, and will continue.
3450 If later during the configuration and build icky compilation
3451 problems appear (headerfile conflicts being the most common
3452 manifestation), I suggest reinstalling the gcc to match
3453 your operating system release.
3454
3455 EOM
3456 ;;
3457 *) gccosandvers='' ;; # failed to parse, better be silent
3458 esac
3459 ;;
3460 esac
3461 case "$ccname" in
3462 '') ccname="$cc" ;;
3463 esac
3464
3465 : gcc 3.1 complains about adding -Idirectories that it already knows about,
3466 : so we will take those off from locincpth.
3467 case "$gccversion" in
3468 3*)
3469 echo "main(){}">try.c
3470 for incdir in `$cc -v -c try.c 2>&1 | \
3471 sed '1,/^#include <\.\.\.>/d;/^End of search list/,$d;s/^ //'` ; do
3472 locincpth=`echo $locincpth | sed s!$incdir!!`
3473 done
3474 $rm -f try try.*
3475 esac
3476
3477 : see how we invoke the C preprocessor
3478 echo " "
3479 echo "Now, how can we feed standard input to your C preprocessor..." >&4
3480 cat <<'EOT' >testcpp.c
3481 #define ABC abc
3482 #define XYZ xyz
3483 ABC.XYZ
3484 EOT
3485 cd ..
3486 if $test ! -f cppstdin; then
3487 echo "$startsh" >cppstdin
3488 if $test "X$osname" = "Xaix" -a "X$gccversion" = X; then
3489 echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; \
3490 test -s .$$.u && \
3491 awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; \
3492 rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >> cppstdin
3493 else
3494 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >>cppstdin
3495 fi; else
3496 echo "Keeping your $hint cppstdin wrapper."
3497 fi
3498 chmod 755 cppstdin
3499 $eunicefix cppstdin
3500 wrapper=`pwd`/cppstdin
3501 ok='false'
3502 cd UU
3503
3504 if $test "X$cppstdin" != "X" && \
3505 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
3506 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3507 then
3508 echo "You used to use $cppstdin $cppminus so we'll use that again."
3509 case "$cpprun" in
3510 '') echo "But let's see if we can live without a wrapper..." ;;
3511 *)
3512 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
3513 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3514 then
3515 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
3516 ok='true'
3517 else
3518 echo "(However, $cpprun $cpplast does not work, let's see...)"
3519 fi
3520 ;;
3521 esac
3522 else
3523 case "$cppstdin" in
3524 '') ;;
3525 *)
3526 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
3527 ;;
3528 esac
3529 fi
3530
3531 if $ok; then
3532 : nothing
3533 elif echo 'Maybe "'"$cc"' -E" will work...'; \
3534 $cc -E <testcpp.c >testcpp.out 2>&1; \
3535 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3536 echo "Yup, it does."
3537 x_cpp="$cc -E"
3538 x_minus='';
3539 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
3540 $cc -E - <testcpp.c >testcpp.out 2>&1; \
3541 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3542 echo "Yup, it does."
3543 x_cpp="$cc -E"
3544 x_minus='-';
3545 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
3546 $cc -P <testcpp.c >testcpp.out 2>&1; \
3547 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3548 echo "Yipee, that works!"
3549 x_cpp="$cc -P"
3550 x_minus='';
3551 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
3552 $cc -P - <testcpp.c >testcpp.out 2>&1; \
3553 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3554 echo "At long last!"
3555 x_cpp="$cc -P"
3556 x_minus='-';
3557 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
3558 $cpp <testcpp.c >testcpp.out 2>&1; \
3559 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3560 echo "It works!"
3561 x_cpp="$cpp"
3562 x_minus='';
3563 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
3564 $cpp - <testcpp.c >testcpp.out 2>&1; \
3565 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3566 echo "Hooray, it works! I was beginning to wonder."
3567 x_cpp="$cpp"
3568 x_minus='-';
3569 elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
3570 $wrapper <testcpp.c >testcpp.out 2>&1; \
3571 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3572 x_cpp="$wrapper"
3573 x_minus=''
3574 echo "Eureka!"
3575 else
3576 dflt=''
3577 rp="No dice. I can't find a C preprocessor. Name one:"
3578 . ./myread
3579 x_cpp="$ans"
3580 x_minus=''
3581 $x_cpp <testcpp.c >testcpp.out 2>&1
3582 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
3583 echo "OK, that will do." >&4
3584 else
3585 echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
3586 exit 1
3587 fi
3588 fi
3589
3590 case "$ok" in
3591 false)
3592 cppstdin="$x_cpp"
3593 cppminus="$x_minus"
3594 cpprun="$x_cpp"
3595 cpplast="$x_minus"
3596 set X $x_cpp
3597 shift
3598 case "$1" in
3599 "$cpp")
3600 echo "Perhaps can we force $cc -E using a wrapper..."
3601 if $wrapper <testcpp.c >testcpp.out 2>&1; \
3602 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
3603 then
3604 echo "Yup, we can."
3605 cppstdin="$wrapper"
3606 cppminus='';
3607 else
3608 echo "Nope, we'll have to live without it..."
3609 fi
3610 ;;
3611 esac
3612 case "$cpprun" in
3613 "$wrapper")
3614 cpprun=''
3615 cpplast=''
3616 ;;
3617 esac
3618 ;;
3619 esac
3620
3621 case "$cppstdin" in
3622 "$wrapper"|'cppstdin') ;;
3623 *) $rm -f $wrapper;;
3624 esac
3625 $rm -f testcpp.c testcpp.out
3626
3627 : Set private lib path
3628 case "$plibpth" in
3629 '') if ./mips; then
3630 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
3631 fi;;
3632 esac
3633 case "$libpth" in
3634 ' ') dlist='';;
3635 '') dlist="$loclibpth $plibpth $glibpth";;
3636 *) dlist="$libpth";;
3637 esac
3638
3639 : Now check and see which directories actually exist, avoiding duplicates
3640 libpth=''
3641 for xxx in $dlist
3642 do
3643 if $test -d $xxx; then
3644 case " $libpth " in
3645 *" $xxx "*) ;;
3646 *) libpth="$libpth $xxx";;
3647 esac
3648 fi
3649 done
3650 $cat <<'EOM'
3651
3652 Some systems have incompatible or broken versions of libraries. Among
3653 the directories listed in the question below, please remove any you
3654 know not to be holding relevant libraries, and add any that are needed.
3655 Say "none" for none.
3656
3657 EOM
3658 case "$libpth" in
3659 '') dflt='none';;
3660 *)
3661 set X $libpth
3662 shift
3663 dflt=${1+"$@"}
3664 ;;
3665 esac
3666 rp="Directories to use for library searches?"
3667 . ./myread
3668 case "$ans" in
3669 none) libpth=' ';;
3670 *) libpth="$ans";;
3671 esac
3672
3673 : determine optimize, if desired, or use for debug flag also
3674 case "$optimize" in
3675 ' '|$undef) dflt='none';;
3676 '')
3677 case "$gccversion" in
3678 '') dflt='-O';;
3679 *) dflt='-O2 -g';;
3680 esac
3681 ;;
3682 *) dflt="$optimize";;
3683 esac
3684 case "$gccversion" in
3685 '') $cat <<EOH
3686
3687 Some C compilers have problems with their optimizers. By default, $package
3688 compiles with the -O flag to use the optimizer. Alternately, you might want
3689 to use the symbolic debugger, which uses the -g flag (on traditional Unix
3690 systems). Either flag can be specified here. To use neither flag, specify
3691 the word "none".
3692
3693 EOH
3694 ;;
3695 *) $cat <<EOH
3696
3697 With the GNU C compiler, it is possible to supply both -O2 and -g flags, to
3698 be able to reasonably optimize, whilst retaining the ability to use a
3699 symbolic debugger. Either flag can be specified here. To use neither flag,
3700 specify the word "none".
3701
3702 EOH
3703 ;;
3704 esac
3705 rp="What optimizer/debugger flag should be used?"
3706 . ./myread
3707 optimize="$ans"
3708 case "$optimize" in
3709 'none') optimize=" ";;
3710 esac
3711
3712
3713 dflt=''
3714 : We will not override a previous value, but we might want to
3715 : augment a hint file
3716 case "$hint" in
3717 default|recommended)
3718 case "$gccversion" in
3719 1*) dflt='-fpcc-struct-return' ;;
3720 esac
3721 case "$gccversion" in
3722 2*) if test -d /etc/conf/kconfig.d &&
3723 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
3724 then
3725 dflt="$dflt -posix"
3726 fi
3727 ;;
3728 esac
3729 case "$gccversion" in
3730 1*|2*) dflt="$dflt -Wall";;
3731 *) dflt="$dflt -W -Wall -Wformat=2 -Wshadow";;
3732 esac
3733 ;;
3734 esac
3735
3736 case "$mips_type" in
3737 *BSD*|'') inclwanted="$locincpth $usrinc";;
3738 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
3739 esac
3740 for thisincl in $inclwanted; do
3741 if $test -d $thisincl; then
3742 if $test x$thisincl != x$usrinc; then
3743 case "$dflt" in
3744 *$thisincl*);;
3745 *) dflt="$dflt -I$thisincl";;
3746 esac
3747 fi
3748 fi
3749 done
3750
3751 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
3752 xxx=true;
3753 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
3754 xxx=true;
3755 else
3756 xxx=false;
3757 fi;
3758 if $xxx; then
3759 case "$dflt" in
3760 *$2*);;
3761 *) dflt="$dflt -D$2";;
3762 esac;
3763 fi'
3764
3765 if ./osf1; then
3766 set signal.h __LANGUAGE_C__; eval $inctest
3767 else
3768 set signal.h LANGUAGE_C; eval $inctest
3769 fi
3770
3771 case "$hint" in
3772 default|recommended) dflt="$dflt $ccflags" ;;
3773 *) dflt="$ccflags";;
3774 esac
3775
3776 case "$dflt" in
3777 ''|' ') dflt=none;;
3778 esac
3779 $cat <<EOH
3780
3781 Your C compiler may want other flags. For this question you should include
3782 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
3783 but you should NOT include libraries or ld flags like -lwhatever.
3784
3785 To use no flags, specify the word "none".
3786
3787 EOH
3788 set X $dflt
3789 shift
3790 dflt=${1+"$@"}
3791 rp="Any additional cc flags?"
3792 . ./myread
3793 case "$ans" in
3794 none) ccflags='';;
3795 *) ccflags="$ans";;
3796 esac
3797
3798 : the following weeds options from ccflags that are of no interest to cpp
3799 cppflags="$ccflags"
3800 case "$gccversion" in
3801 1*) cppflags="$cppflags -D__GNUC__"
3802 esac
3803 case "$mips_type" in
3804 '');;
3805 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
3806 esac
3807 case "$cppflags" in
3808 '');;
3809 *)
3810 echo " "
3811 echo "Let me guess what the preprocessor flags are..." >&4
3812 set X $cppflags
3813 shift
3814 cppflags=''
3815 $cat >cpp.c <<'EOM'
3816 #define BLURFL foo
3817
3818 BLURFL xx LFRULB
3819 EOM
3820 previous=''
3821 for flag in $*
3822 do
3823 case "$flag" in
3824 -*) ftry="$flag";;
3825 *) ftry="$previous $flag";;
3826 esac
3827 if $cppstdin -DLFRULB=bar $ftry $cppminus <cpp.c \
3828 >cpp1.out 2>/dev/null && \
3829 $cpprun -DLFRULB=bar $ftry $cpplast <cpp.c \
3830 >cpp2.out 2>/dev/null && \
3831 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
3832 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
3833 then
3834 cppflags="$cppflags $ftry"
3835 previous=''
3836 else
3837 previous="$flag"
3838 fi
3839 done
3840 set X $cppflags
3841 shift
3842 cppflags=${1+"$@"}
3843 case "$cppflags" in
3844 *-*) echo "They appear to be: $cppflags";;
3845 esac
3846 $rm -f cpp.c cpp?.out
3847 ;;
3848 esac
3849
3850 : flags used in final linking phase
3851 case "$ldflags" in
3852 '') if ./venix; then
3853 dflt='-i -z'
3854 else
3855 dflt=''
3856 fi
3857 case "$ccflags" in
3858 *-posix*) dflt="$dflt -posix" ;;
3859 esac
3860 ;;
3861 *) dflt="$ldflags";;
3862 esac
3863
3864 : Try to guess additional flags to pick up local libraries.
3865 for thislibdir in $libpth; do
3866 case " $loclibpth " in
3867 *" $thislibdir "*)
3868 case "$dflt " in
3869 *"-L$thislibdir "*) ;;
3870 *) dflt="$dflt -L$thislibdir" ;;
3871 esac
3872 ;;
3873 esac
3874 done
3875
3876 case "$dflt" in
3877 '') dflt='none' ;;
3878 *) set X $dflt; shift; dflt="$@";;
3879 esac
3880
3881 $cat <<EOH
3882
3883 Your C linker may need flags. For this question you should
3884 include -L/whatever and any other flags used by the C linker, but you
3885 should NOT include libraries like -lwhatever.
3886
3887 Make sure you include the appropriate -L/path flags if your C linker
3888 does not normally search all of the directories you specified above,
3889 namely
3890 $libpth
3891 To use no flags, specify the word "none".
3892
3893 EOH
3894
3895 rp="Any additional ld flags (NOT including libraries)?"
3896 . ./myread
3897 case "$ans" in
3898 none) ldflags='';;
3899 *) ldflags="$ans";;
3900 esac
3901 rmlist="$rmlist pdp11"
3902
3903 : coherency check
3904 echo " "
3905 echo "Checking your choice of C compiler and flags for coherency..." >&4
3906 set X $cc $optimize $pthread $ccflags $ldflags -o try try.c
3907 shift
3908 $cat >try.msg <<EOM
3909 I've tried to compile and run a simple program with:
3910
3911 $*
3912 ./try
3913
3914 and I got the following output:
3915
3916 EOM
3917 $cat > try.c <<'EOF'
3918 int main() { return 0; }
3919 EOF
3920 dflt=y
3921 if sh -c "$cc $optimize $ccflags $ldflags -o try try.c" >>try.msg 2>&1; then
3922 if sh -c './try' >>try.msg 2>&1; then
3923 dflt=n
3924 else
3925 echo "The program compiled OK, but exited with status $?." >>try.msg
3926 rp="You have a problem. Shall I abort Configure"
3927 dflt=y
3928 fi
3929 else
3930 echo "I can't compile the test program." >>try.msg
3931 rp="You have a BIG problem. Shall I abort Configure"
3932 dflt=y
3933 fi
3934 case "$dflt" in
3935 y)
3936 $cat try.msg >&4
3937 case "$knowitall" in
3938 '')
3939 echo "(The supplied flags might be incorrect with this C compiler.)"
3940 ;;
3941 *) dflt=n;;
3942 esac
3943 echo " "
3944 . ./myread
3945 case "$ans" in
3946 n*|N*) ;;
3947 *) echo "Ok. Stopping Configure." >&4
3948 exit 1
3949 ;;
3950 esac
3951 ;;
3952 n) echo "OK, that should do.";;
3953 esac
3954 $rm_try
3955
3956 : determine default editor
3957 echo " "
3958 case "$defeditor" in
3959 '')
3960 case "$vi" in
3961 */*) dflt="$vi";;
3962 *) dflt=/usr/ucb/vi;;
3963 esac
3964 ;;
3965 *) dflt="$defeditor"
3966 ;;
3967 esac
3968 fn=f/
3969 rp="What is the default editor on your system?"
3970 . ./getfile
3971 defeditor="$ans"
3972
3973 : locate a BSD compatible install program
3974 echo " "
3975 echo "Looking for a BSD-compatible install program..." >&4
3976 creatdir=''
3977 case "$install" in
3978 '')
3979 tryit=''
3980 for dir in $pth; do
3981 for file in ginstall installbsd scoinst install; do
3982 if $test -f $dir/$file; then
3983 tryit="$tryit $dir/$file"
3984 fi
3985 done
3986 done
3987 $cat >try.c <<EOC
3988 int main()
3989 {
3990 printf("OK\n");
3991 exit(0);
3992 }
3993 EOC
3994 if $cc -o try try.c >/dev/null 2>&1; then
3995 cp try try.ns
3996 strip try >/dev/null 2>&1
3997 else
3998 echo "(I can't seem to compile a trivial C program -- bypassing.)"
3999 echo "try" >try
4000 cp try try.ns
4001 fi
4002 $cat >tryinst <<EOS
4003 $startsh
4004 $rm -rf foo d
4005 \$1 -d foo/bar
4006 $mkdir d
4007 \$1 -c -m 764 try.ns d
4008 \$1 -c -s -m 642 try.ns d/try
4009 EOS
4010 chmod +x tryinst
4011 $eunicefix tryinst
4012 dflt=''
4013 either=''
4014 for prog in $tryit; do
4015 $echo $n "Checking $prog... $c"
4016 ./tryinst $prog >/dev/null 2>&1
4017 if $test -d foo/bar; then
4018 creatdir="$prog -d"
4019 fi
4020 (ls -l d/try >try.ls; ls -l d/try.ns >tryno.ls) 2>/dev/null
4021 try_wc=`($wc -c try | $awk '{ print $1}') 2>/dev/null`
4022 tryns_wc=`($wc -c try.ns | $awk '{ print $1}') 2>/dev/null`
4023 d_try_wc=`($wc -c d/try | $awk '{ print $1}') 2>/dev/null`
4024 d_tryns_wc=`($wc -c d/try.ns | $awk '{ print $1}') 2>/dev/null`
4025 if ($test "X$try_wc" = "X$d_try_wc" && \
4026 $test "X$tryns_wc" = "X$d_tryns_wc" && \
4027 $contains 'rwxrw-r--' tryno.ls && \
4028 $contains 'rw-r---w-' try.ls) >/dev/null 2>&1
4029 then
4030 dflt="$prog"
4031 echo "ok, that will do."
4032 break
4033 fi
4034 echo "not good$either."
4035 either=' either'
4036 $rm -f try*.ls
4037 done
4038 $rm -rf foo d tryinst try try*.ls try.*
4039 case "$dflt" in
4040 '')
4041 echo "Hopefully, $package comes with its own install script!"
4042 dflt='./install'
4043 ;;
4044 esac
4045 ;;
4046 *) dflt="$install";;
4047 esac
4048 $cat <<EOM
4049
4050 I will be requiring a BSD-compatible install program (one that allows
4051 options like -s to strip executables or -m to specify a file mode) to
4052 install $package.
4053
4054 If the question below contains a fully qualified default path, then it
4055 is probably ok. If it is an unqualified name such as 'install', then it
4056 means I was unable to find out a good install program I could use. If
4057 you know of one, please tell me about it. If the default is './install',
4058 then I shall be using the install script supplied with $package.
4059
4060 EOM
4061 fn='/fe~(install,./install)'
4062 rp='Which install program shall I use?'
4063 . ./getfile
4064 install="$ans"
4065
4066 : how can we create nested directories?
4067 echo " "
4068 echo "Ok, let's see how we can create nested directories..." >&4
4069 case "$installdir" in
4070 '')
4071 $mkdir -p foo/bar >/dev/null 2>&1
4072 if $test -d foo/bar; then
4073 echo "Great, we can build them using 'mkdir -p'."
4074 creatdir='mkdir -p'
4075 else
4076 case "$creatdir" in
4077 '')
4078 if eval "$install -d foo/bar"; $test -d foo/bar; then
4079 creatdir="install -d"
4080 echo "It looks like '$creatdir' will do it for us."
4081 fi
4082 ;;
4083 *)
4084 eval "$creatdir foo/bar" >/dev/null 2>&1
4085 if $test -d foo/bar; then
4086 echo "Ah! We can use '$creatdir' to do just that."
4087 else
4088 creatdir=''
4089 fi
4090 ;;
4091 esac
4092 fi
4093 $rm -rf foo
4094 case "$creatdir" in
4095 '')
4096 echo "Heck! Another ancient system lacking the comfort of modern ones!"
4097 echo "You can thank $package for bringing you its own install script!"
4098 installdir='./install -d'
4099 ;;
4100 *) installdir="$creatdir";;
4101 esac
4102 ;;
4103 *) echo "As you already told me, '$installdir' should work.";;
4104 esac
4105
4106 : determine the name of a reasonable mailer
4107 case "$mailer" in
4108 '')
4109 if $test -f "$sendmail"; then
4110 dflt="$sendmail"
4111 elif $test -f "$smail"; then
4112 dflt="$smail"
4113 elif $test -f "$rmail"; then
4114 dflt="$rmail"
4115 elif $test -f /bin/mail; then
4116 dflt=/bin/mail
4117 else
4118 dflt=$mail
4119 fi
4120 ;;
4121 *) dflt="$mailer";;
4122 esac
4123 $cat <<EOM
4124
4125 I need the full pathname of the program used to deliver mail on your system.
4126 A typical answer would be /usr/lib/sendmail or /bin/rmail, but you may choose
4127 any other program, as long as it can be fed from standard input and will
4128 honour any user-supplied headers.
4129
4130 EOM
4131 fn=f
4132 rp='Mail transport agent to be used?'
4133 . ./getfile
4134 mailer="$ans"
4135
4136 : find out how to find out full name
4137 case "$d_berknames" in
4138 "$define")
4139 dflt=y;;
4140 "$undef")
4141 dflt=n;;
4142 *)
4143 if ./bsd; then
4144 dflt=y
4145 elif ./xenix; then
4146 dflt=y
4147 else
4148 dflt=n
4149 fi
4150 ;;
4151 esac
4152 $cat <<'EOM'
4153
4154 Does your /etc/passwd file keep full names in Berkeley/V7 format (name first
4155 thing after ':' in GCOS field)? In that case, a typical entry in the password
4156 file looks like this:
4157
4158 guest:**paswword**:10:100:Mister Guest User:/usr/users:/bin/sh
4159 ^^^^^^^^^^^^^^^^^
4160 EOM
4161 rp="Berkeley/V7 format for full name in /etc/passwd?"
4162 . ./myread
4163 case "$ans" in
4164 y*) d_passnames="$define"
4165 d_berknames="$define"
4166 d_usgnames="$undef"
4167 nametype=bsd
4168 ;;
4169 *)
4170 case "$d_usgnames" in
4171 "$define") dflt=y;;
4172 "$undef") dflt=n;;
4173 *)
4174 if ./usg; then
4175 dflt=y
4176 else
4177 dflt=n
4178 fi
4179 ;;
4180 esac
4181 $cat <<'EOM'
4182
4183 Does your passwd file keep full names in USG format (name sandwiched between a
4184 '-' and a '(')? In that case, a typical entry in the password file looks like
4185 this:
4186
4187 guest:**paswword**:10:100:000-Mister Guest User(000):/usr/users:/bin/sh
4188 ^^^^^^^^^^^^^^^^^
4189 EOM
4190 rp="USG format for full name in /etc/passwd?"
4191 . ./myread
4192 case "$ans" in
4193 n*) echo "Full name will be taken from ~/.fullname"
4194 d_passnames="$undef"
4195 d_berknames="$undef"
4196 d_usgnames="$undef"
4197 nametype=other
4198 ;;
4199 *)
4200 d_passnames="$define"
4201 d_berknames="$undef"
4202 d_usgnames="$define"
4203 nametype=usg
4204 ;;
4205 esac;;
4206 esac
4207
4208 : get organization name
4209 longshots='/local/src /usr/src/new /usr/src/local /usr/local/src'
4210 case "$orgname" in
4211 '') if xxx=`./loc news/src/defs.h x $longshots`; then
4212 dflt=`$sed -n 's/^.*MYORG[ ]*"\(.*\)".*$/\1/p' $xxx`
4213 else
4214 dflt=''
4215 fi
4216 ;;
4217 *) dflt="$orgname";;
4218 esac
4219 $cat << 'EOH'
4220
4221 Please type the name of your organization as you want it to appear on the
4222 Organization line of outgoing articles. (It's nice if this also specifies
4223 your location. Your city name is probably sufficient if well known.)
4224 For example:
4225
4226 University of Southern North Dakota, Hoople
4227
4228 You may also put the name of a file, as long as it begins with a slash.
4229 For example:
4230
4231 /etc/organization
4232
4233 EOH
4234 orgname=""
4235 while test "X$orgname" = "X"; do
4236 rp='Organization:'
4237 . ./myread
4238 orgname="$ans"
4239 done
4240
4241 : locate the preferred pager for this system
4242 fn=f/
4243 case "$pager" in
4244 '')
4245 dflt=''
4246 case "$pg" in
4247 /*) dflt=$pg;;
4248 [a-zA-Z]:/*) dflt=$pg;;
4249 esac
4250 case "$more" in
4251 /*) dflt=$more;;
4252 [a-zA-Z]:/*) dflt=$more;;
4253 esac
4254 case "$less" in
4255 /*) dflt=$less;;
4256 [a-zA-Z]:/*) dflt=$less;;
4257 esac
4258 case "$dflt" in
4259 '') dflt=/usr/ucb/more;;
4260 esac
4261 ;;
4262 *) dflt="$pager"
4263 ;;
4264 esac
4265 fn="f/($dflt)"
4266 echo " "
4267 rp='What pager is used on your system?'
4268 . ./getfile
4269 pager="$ans"
4270
4271 : get the patchlevel / revision
4272 echo " "
4273 echo "Getting the current patchlevel / revision..." >&4
4274 if $test -r $rsrc/patchlevel.h;then
4275 patchlevel=`awk \
4276 '/^#[ ]*define[ ][ ]*PATCHLEVEL/ {print $3}' \
4277 < $rsrc/patchlevel.h`
4278 else
4279 patchlevel=0
4280 fi
4281 if $test -r $rsrc/revision.h;then
4282 revision=`awk \
4283 '/^#[ ]*define[ ][ ]*REVISION/ {print $3}' \
4284 < $rsrc/revision.h`
4285 case "$revision" in
4286 '"$Revision:')
4287 revision=`awk \
4288 '/^#[ ]*define[ ][ ]*REVISION/ {print $4}' \
4289 < $rsrc/revision.h`
4290 ;;
4291 esac
4292 else
4293 revision=0
4294 fi
4295 case "$revision" in
4296 0) echo "(You have $package $baserev PL$patchlevel.)" ;;
4297 *)
4298 case "$patchlevel" in
4299 0) echo "(You have $package $baserev-$revision)";;
4300 *) echo "(You have $package $baserev-$revision PL$patchlevel)";;
4301 esac
4302 ;;
4303 esac
4304
4305 : determine perl absolute location
4306 case "$perlpath" in
4307 '')
4308 if test -f /usr/bin/perl; then
4309 dflt=/usr/bin/perl
4310 else
4311 case "$perl" in
4312 */*) dflt="$perl";;
4313 *) dflt=/usr/bin/perl;;
4314 esac
4315 fi
4316 ;;
4317 *) dflt="$perlpath"
4318 ;;
4319 esac
4320 echo " "
4321 fn=f~/
4322 rp="Where is perl located on your system?"
4323 . ./getfile
4324 perlpath="$ans"
4325
4326 : figure out how to guarantee perl startup
4327 case "$sharpbang" in
4328 *!)
4329 $cat >xtry <<EOP
4330 #!$perlpath
4331 system("exit 0");
4332 EOP
4333 chmod a+x xtry
4334 if ./xtry >/dev/null 2>&1; then
4335 $cat <<EOH
4336
4337 I can use the #! construct to start perl on your system. This will make
4338 startup of perl scripts faster, but may cause problems if you want to share
4339 those scripts and perl is not in a standard place (/usr/bin/perl) on all your
4340 platforms. The alternative is to force a shell by starting the script with a
4341 single ':' character.
4342
4343 EOH
4344 pdflt=y
4345 else
4346 $cat <<EOH
4347
4348 I could use the #! construct to start perl on your system, but using
4349 #!$perlpath
4350 would be too long for your kernel to grok. Indeed, most systems do
4351 limit the size of the leading #! string to 32 characters.
4352
4353 EOH
4354 pdflt=n
4355 fi
4356 $rm -f xtry
4357 case "$startperl" in
4358 *!*) dflt=y;;
4359 '') case "$d_portable" in
4360 "$define") dflt=n;;
4361 *) dflt=$pdflt;;
4362 esac;;
4363 *) dflt=n;;
4364 esac
4365 rp='Shall I use #! to start up perl?'
4366 . ./myread
4367 case "$ans" in
4368 y*|Y*) startperl="#!$perlpath";;
4369 *) startperl=": # use perl";;
4370 esac;;
4371 *) startperl=": # use perl";;
4372 esac
4373
4374 : end of configuration questions
4375 echo " "
4376 echo "End of configuration questions."
4377
4378 : back to where it started
4379 if test -d ../UU; then
4380 cd ..
4381 fi
4382
4383 : configuration may be unconditionally patched via a 'config.arch' file
4384 if $test -f config.arch; then
4385 echo "I see a config.arch file, loading it." >&4
4386 . ./config.arch
4387 fi
4388
4389 : configuration may be patched via a 'config.over' file
4390 if $test -f config.over; then
4391 echo " "
4392 dflt=y
4393 rp='I see a config.over file. Do you wish to load it?'
4394 . UU/myread
4395 case "$ans" in
4396 n*) echo "OK, I'll ignore it.";;
4397 *) . ./config.over
4398 echo "Configuration override changes have been loaded."
4399 ;;
4400 esac
4401 fi
4402
4403 : in case they want portability, strip down executable paths
4404 case "$d_portable" in
4405 "$define")
4406 echo " "
4407 echo "Stripping down executable paths..." >&4
4408 xsed=$sed
4409 for file in $loclist $trylist; do
4410 eval sfile="\$$file"
4411 sfile=`echo $sfile | $xsed -e 's,.*/\(.*\),\1,'`
4412 eval $file="$sfile"
4413 done
4414 ;;
4415 esac
4416
4417 : create config.sh file
4418 echo " "
4419 echo "Creating config.sh..." >&4
4420 $spitshell <<EOT >config.sh
4421 $startsh
4422 #
4423 # This file was produced by running the Configure script. It holds all the
4424 # definitions figured out by Configure. Should you modify one of these values,
4425 # do not forget to propagate your changes by running "Configure -der". You may
4426 # instead choose to run each of the .SH files by yourself, or "Configure -S".
4427 #
4428
4429 # Package name : $package
4430 # Source directory : $src
4431 # Configuration time: $cf_time
4432 # Configured by : $cf_by
4433 # Target system : $myuname
4434
4435 EOT
4436 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
4437 $spitshell <<EOT >>config.sh
4438
4439 Author='$Author'
4440 Date='$Date'
4441 Header='$Header'
4442 Id='$Id'
4443 Locker='$Locker'
4444 Log='$Log'
4445 RCSfile='$RCSfile'
4446 Revision='$Revision'
4447 Source='$Source'
4448 State='$State'
4449 _a='$_a'
4450 _exe='$_exe'
4451 _o='$_o'
4452 afs='$afs'
4453 afsroot='$afsroot'
4454 ar='$ar'
4455 archobjs='$archobjs'
4456 awk='$awk'
4457 baserev='$baserev'
4458 bash='$bash'
4459 bison='$bison'
4460 byacc='$byacc'
4461 c='$c'
4462 cat='$cat'
4463 ccflags='$ccflags'
4464 ccname='$ccname'
4465 ccversion='$ccversion'
4466 cf_by='$cf_by'
4467 cf_email='$cf_email'
4468 cf_time='$cf_time'
4469 chgrp='$chgrp'
4470 chmod='$chmod'
4471 chown='$chown'
4472 comm='$comm'
4473 compress='$compress'
4474 contains='$contains'
4475 cp='$cp'
4476 cpio='$cpio'
4477 cpp='$cpp'
4478 cpp_trad='$cpp_trad'
4479 cppflags='$cppflags'
4480 cpplast='$cpplast'
4481 cppminus='$cppminus'
4482 cpprun='$cpprun'
4483 cppstdin='$cppstdin'
4484 csh='$csh'
4485 d_berknames='$d_berknames'
4486 d_bsd='$d_bsd'
4487 d_dos='$d_dos'
4488 d_eunice='$d_eunice'
4489 d_linux='$d_linux'
4490 d_os2='$d_os2'
4491 d_passnames='$d_passnames'
4492 d_portable='$d_portable'
4493 d_usgnames='$d_usgnames'
4494 d_windows='$d_windows'
4495 d_xenix='$d_xenix'
4496 date='$date'
4497 defeditor='$defeditor'
4498 echo='$echo'
4499 egrep='$egrep'
4500 emacs='$emacs'
4501 eunicefix='$eunicefix'
4502 expr='$expr'
4503 find='$find'
4504 firstmakefile='$firstmakefile'
4505 flex='$flex'
4506 from='$from'
4507 gcc='$gcc'
4508 gccosandvers='$gccosandvers'
4509 gccversion='$gccversion'
4510 glibpth='$glibpth'
4511 gmake='$gmake'
4512 gmsgfmt='$gmsgfmt'
4513 grep='$grep'
4514 groupcat='$groupcat'
4515 gzip='$gzip'
4516 hint='$hint'
4517 hostcat='$hostcat'
4518 incpath='$incpath'
4519 inews='$inews'
4520 install='$install'
4521 installdir='$installdir'
4522 installmansrc='$installmansrc'
4523 installprivlib='$installprivlib'
4524 installscript='$installscript'
4525 issymlink='$issymlink'
4526 ksh='$ksh'
4527 ldflags='$ldflags'
4528 less='$less'
4529 libpth='$libpth'
4530 line='$line'
4531 lint='$lint'
4532 lkflags='$lkflags'
4533 ln='$ln'
4534 lns='$lns'
4535 locincpth='$locincpth'
4536 loclibpth='$loclibpth'
4537 lp='$lp'
4538 lpr='$lpr'
4539 ls='$ls'
4540 mail='$mail'
4541 mailer='$mailer'
4542 mailx='$mailx'
4543 make='$make'
4544 make_set_make='$make_set_make'
4545 manext='$manext'
4546 mansrc='$mansrc'
4547 mansrcexp='$mansrcexp'
4548 mips_type='$mips_type'
4549 mkdir='$mkdir'
4550 more='$more'
4551 msgfmt='$msgfmt'
4552 msgmerge='$msgmerge'
4553 mv='$mv'
4554 mydomain='$mydomain'
4555 myhostname='$myhostname'
4556 myuname='$myuname'
4557 n='$n'
4558 nametype='$nametype'
4559 nawk='$nawk'
4560 nm='$nm'
4561 nroff='$nroff'
4562 optimize='$optimize'
4563 orgname='$orgname'
4564 osname='$osname'
4565 osvers='$osvers'
4566 package='$package'
4567 pager='$pager'
4568 passcat='$passcat'
4569 patchlevel='$patchlevel'
4570 perl='$perl'
4571 perlpath='$perlpath'
4572 pg='$pg'
4573 phostname='$phostname'
4574 pkgsrc='$pkgsrc'
4575 plibpth='$plibpth'
4576 pmake='$pmake'
4577 pr='$pr'
4578 prefix='$prefix'
4579 prefixexp='$prefixexp'
4580 privlib='$privlib'
4581 privlibexp='$privlibexp'
4582 pthread='$pthread'
4583 revision='$revision'
4584 rm='$rm'
4585 rm_try='$rm_try'
4586 rmail='$rmail'
4587 run='$run'
4588 scriptdir='$scriptdir'
4589 scriptdirexp='$scriptdirexp'
4590 sed='$sed'
4591 sendmail='$sendmail'
4592 sh='$sh'
4593 shar='$shar'
4594 sharpbang='$sharpbang'
4595 shsharp='$shsharp'
4596 sleep='$sleep'
4597 smail='$smail'
4598 sort='$sort'
4599 spackage='$spackage'
4600 spitshell='$spitshell'
4601 src='$src'
4602 startperl='$startperl'
4603 startsh='$startsh'
4604 submit='$submit'
4605 sysman='$sysman'
4606 tail='$tail'
4607 tar='$tar'
4608 targetarch='$targetarch'
4609 tbl='$tbl'
4610 tee='$tee'
4611 test='$test'
4612 to='$to'
4613 touch='$touch'
4614 tr='$tr'
4615 trnl='$trnl'
4616 troff='$troff'
4617 uname='$uname'
4618 uniq='$uniq'
4619 usecrosscompile='$usecrosscompile'
4620 usrinc='$usrinc'
4621 uuname='$uuname'
4622 vi='$vi'
4623 wc='$wc'
4624 xgettext='$xgettext'
4625 xlibpth='$xlibpth'
4626 zcat='$zcat'
4627 zip='$zip'
4628 EOT
4629
4630 : project-specific code
4631 file=revision.h
4632 echo " "
4633 echo "Generating $file..." >&4
4634 bin/svn-revision . $file
4635
4636 : add special variables
4637 $test -f $src/patchlevel.h && \
4638 awk '/^#define/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
4639 $test -f $src/revision.h && \
4640 sed -ne 's/^#define \([A-Za-z0-9_]*\) ".*: \([0-9]*\).*"/\1=\2/p' \
4641 < $src/revision.h >>config.sh
4642 echo "CONFIG=true" >>config.sh
4643
4644 : propagate old symbols
4645 if $test -f UU/config.sh; then
4646 <UU/config.sh $sort | $uniq >UU/oldconfig.sh
4647 $sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' \
4648 config.sh config.sh UU/oldconfig.sh |\
4649 $sort | $uniq -u >UU/oldsyms
4650 set X `cat UU/oldsyms`
4651 shift
4652 case $# in
4653 0) ;;
4654 *)
4655 cat <<EOM
4656 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
4657 EOM
4658 echo ": Variables propagated from previous config.sh file." >>config.sh
4659 for sym in `cat UU/oldsyms`; do
4660 echo " Propagating $hint variable "'$'"$sym..."
4661 eval 'tmp="$'"${sym}"'"'
4662 echo "$tmp" | \
4663 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
4664 done
4665 ;;
4666 esac
4667 fi
4668
4669 : Finish up by extracting the .SH files
4670 case "$alldone" in
4671 exit)
4672 echo "Stopping at your request, leaving temporary files around."
4673 exit 0
4674 ;;
4675 cont)
4676 ;;
4677 '')
4678 dflt=''
4679 nostick=true
4680 $cat <<EOM
4681
4682 If you'd like to make any changes to the config.sh file before I begin
4683 to configure things, do it as a shell escape now (e.g. !vi config.sh).
4684
4685 EOM
4686 rp="Press return or use a shell escape to edit config.sh:"
4687 . UU/myread
4688 nostick=''
4689 case "$ans" in
4690 '') ;;
4691 *) : in case they cannot read
4692 sh 1>&4 -c "$ans";;
4693 esac
4694 ;;
4695 esac
4696
4697 : if this fails, just run all the .SH files by hand
4698 . ./config.sh
4699
4700 echo " "
4701 exec 1>&4
4702 pwd=`pwd`
4703 . ./UU/extract
4704 cd "$pwd"
4705
4706 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
4707 dflt=y
4708 case "$silent" in
4709 true) ;;
4710 *)
4711 $cat <<EOM
4712
4713 Now you need to generate make dependencies by running "$make depend".
4714 You might prefer to run it in background: "$make depend > makedepend.out &"
4715 It can take a while, so you might not want to run it right now.
4716
4717 EOM
4718 ;;
4719 esac
4720 rp="Run $make depend now?"
4721 . UU/myread
4722 case "$ans" in
4723 y*)
4724 $make depend && echo "Now you must run '$make'."
4725 ;;
4726 *)
4727 echo "You must run '$make depend' then '$make'."
4728 ;;
4729 esac
4730 elif test -f [Mm]akefile; then
4731 echo " "
4732 echo "Now you must run a $make."
4733 else
4734 echo "Configure done."
4735 fi
4736
4737 if $test -f Policy.sh; then
4738 $cat <<EOM
4739
4740 If you compile $package on a different machine or from a different object
4741 directory, copy the Policy.sh file from this object directory to the
4742 new one before you run Configure -- this will help you with most of
4743 the policy defaults.
4744
4745 EOM
4746 fi
4747 if $test -f UU/config.msg; then
4748 echo "Hmm. I also noted the following information while running:"
4749 echo " "
4750 $cat UU/config.msg >&4
4751 fi
4752 $rm -f kit*isdone ark*isdone
4753 $rm -rf UU
4754
4755 : End of Configure