f5a7fc6a709e694702cf1721b14958592e027773
[p5sagit/p5-mst-13.2.git] / Configure
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, I would
7 # suggest you cut out the prototypical config.h from the end of Configure
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 # $Header: Configure,v 3.0.1.2 89/11/11 04:05:37 lwall Locked $
12 #
13 # Yes, you may rip this off to use in other distribution packages.
14 # (Note: this Configure script was generated automatically.  Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.)
16
17 : sanity checks
18 PATH=".:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc:/usr/new:/usr/new/bin:/usr/nbin:$PATH"
19 export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0; kill $$)
20
21 if test ! -t 0; then
22     echo "Say 'sh Configure', not 'sh <Configure'"
23     exit 1
24 fi
25
26 (alias) >/dev/null 2>&1 && \
27     echo "(I see you are using the Korn shell.  Some ksh's blow up on Configure," && \
28     echo "especially on exotic machines.  If yours does, try the Bourne shell instead.)"
29
30 if test ! -d ../UU; then
31     if test ! -d UU; then
32         mkdir UU
33     fi
34     cd UU
35 fi
36
37 case "$1" in
38 -d) shift; fastread='yes';;
39 esac
40
41 d_eunice=''
42 define=''
43 eunicefix=''
44 loclist=''
45 expr=''
46 sed=''
47 echo=''
48 cat=''
49 rm=''
50 mv=''
51 cp=''
52 tail=''
53 tr=''
54 mkdir=''
55 sort=''
56 uniq=''
57 grep=''
58 trylist=''
59 test=''
60 inews=''
61 egrep=''
62 more=''
63 pg=''
64 Mcc=''
65 vi=''
66 mailx=''
67 mail=''
68 cpp=''
69 perl=''
70 emacs=''
71 ls=''
72 rmail=''
73 sendmail=''
74 shar=''
75 smail=''
76 tbl=''
77 troff=''
78 nroff=''
79 uname=''
80 uuname=''
81 line=''
82 chgrp=''
83 chmod=''
84 lint=''
85 sleep=''
86 pr=''
87 tar=''
88 ln=''
89 lpr=''
90 lp=''
91 touch=''
92 make=''
93 date=''
94 csh=''
95 Log=''
96 Header=''
97 bin=''
98 byteorder=''
99 contains=''
100 cppstdin=''
101 cppminus=''
102 d_bcmp=''
103 d_bcopy=''
104 d_charsprf=''
105 d_crypt=''
106 cryptlib=''
107 d_csh=''
108 d_dosuid=''
109 d_dup2=''
110 d_fchmod=''
111 d_fchown=''
112 d_fcntl=''
113 d_flock=''
114 d_getgrps=''
115 d_gethent=''
116 d_getpgrp=''
117 d_getprior=''
118 d_htonl=''
119 d_index=''
120 d_ioctl=''
121 d_killpg=''
122 d_memcmp=''
123 d_memcpy=''
124 d_mkdir=''
125 d_ndbm=''
126 d_odbm=''
127 d_readdir=''
128 d_rename=''
129 d_rmdir=''
130 d_setegid=''
131 d_seteuid=''
132 d_setpgrp=''
133 d_setprior=''
134 d_setregid=''
135 d_setresgid=''
136 d_setreuid=''
137 d_setresuid=''
138 d_setrgid=''
139 d_setruid=''
140 d_socket=''
141 d_sockpair=''
142 d_oldsock=''
143 socketlib=''
144 d_statblks=''
145 d_stdstdio=''
146 d_strctcpy=''
147 d_symlink=''
148 d_syscall=''
149 d_tminsys=''
150 i_systime=''
151 i_timetoo=''
152 d_varargs=''
153 d_vfork=''
154 d_voidsig=''
155 d_vprintf=''
156 d_charvspr=''
157 d_wait4=''
158 gidtype=''
159 i_dirent=''
160 d_dirnamlen=''
161 i_fcntl=''
162 i_grp=''
163 i_niin=''
164 i_pwd=''
165 d_pwquota=''
166 d_pwage=''
167 d_pwchange=''
168 d_pwclass=''
169 d_pwexpire=''
170 i_sysdir=''
171 i_sysioctl=''
172 i_varargs=''
173 i_vfork=''
174 intsize=''
175 libc=''
176 libnm=''
177 mallocsrc=''
178 mallocobj=''
179 usemymalloc=''
180 mansrc=''
181 manext=''
182 models=''
183 split=''
184 small=''
185 medium=''
186 large=''
187 huge=''
188 optimize=''
189 ccflags=''
190 cppflags=''
191 ldflags=''
192 cc=''
193 libs=''
194 n=''
195 c=''
196 package=''
197 randbits=''
198 sig_name=''
199 spitshell=''
200 shsharp=''
201 sharpbang=''
202 startsh=''
203 stdchar=''
204 uidtype=''
205 voidflags=''
206 defvoidused=''
207 lib=''
208 privlib=''
209 CONFIG=''
210 : set package name
211 package=perl
212
213 echo " "
214 echo "Beginning of configuration questions for $package kit."
215 : Eunice requires " " instead of "", can you believe it
216 echo " "
217
218 define='define'
219 undef='undef'
220 libpth='/usr/lib /usr/local/lib /usr/lib/386 /usr/lib/large /lib /lib/386 /lib/large /usr/lib/small /lib/small'
221 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
222 rmlist='kit[1-9]isdone kit[1-9][0-9]isdone'
223 trap 'echo " "; rm -f $rmlist; exit 1' 1 2 3
224
225 : We must find out about Eunice early
226 eunicefix=':'
227 if test -f /etc/unixtovms; then
228     eunicefix=/etc/unixtovms
229 fi
230 if test -f /etc/unixtovms.exe; then
231     eunicefix=/etc/unixtovms.exe
232 fi
233
234 : Now test for existence of everything in MANIFEST
235
236 echo "First let's make sure your kit is complete.  Checking..."
237 (cd ..; awk '' `awk '$1 !~ /PACKINGLIST/ {print $1}' MANIFEST` >/dev/null || kill $$)
238 echo "Looks good..."
239
240 attrlist="mc68000 sun gcos unix ibm gimpel interdata tss os mert pyr"
241 attrlist="$attrlist vax pdp11 i8086 z8000 u3b2 u3b5 u3b20 u3b200"
242 attrlist="$attrlist hpux hp9000s300 hp9000s500 hp9000s800"
243 attrlist="$attrlist ns32000 ns16000 iAPX286 mc300 mc500 mc700 sparc"
244 attrlist="$attrlist nsc32000 sinix xenix venix posix ansi M_XENIX"
245 attrlist="$attrlist $mc68k __STDC__ UTS M_I8086 M_I186 M_I286 M_I386"
246 attrlist="$attrlist i186"
247 pth="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /usr/plx /usr/5bin /vol/local/bin /etc /usr/lib /lib /usr/local/lib /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/bin /bsd4.3/usr/ucb"
248 d_newshome="/usr/NeWS"
249 defvoidused=7
250 libswanted="net nm ndir ndbm dbm c_s"
251
252 : some greps do not return status, grrr.
253 echo "grimblepritz" >grimble
254 if grep blurfldyick grimble >/dev/null 2>&1 ; then
255     contains=contains
256 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
257     contains=grep
258 else
259     contains=contains
260 fi
261 rm -f grimble
262 : the following should work in any shell
263 case "$contains" in
264 contains*)
265     echo " "
266     echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
267     cat >contains <<'EOSS'
268 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
269 EOSS
270 chmod +x contains
271 esac
272
273 : see if sh knows # comments
274 echo " "
275 echo "Checking your sh to see if it knows about # comments..."
276 if sh -c '#' >/dev/null 2>&1 ; then
277     echo "Your sh handles # comments correctly."
278     shsharp=true
279     spitshell=cat
280     echo " "
281     echo "Okay, let's see if #! works on this system..."
282     echo "#!/bin/echo hi" > try
283     $eunicefix try
284     chmod +x try
285     try > today
286     if $contains hi today >/dev/null 2>&1; then
287         echo "It does."
288         sharpbang='#!'
289     else
290         echo "#! /bin/echo hi" > try
291         $eunicefix try
292         chmod +x try
293         try > today
294         if test -s today; then
295             echo "It does."
296             sharpbang='#! '
297         else
298             echo "It doesn't."
299             sharpbang=': use '
300         fi
301     fi
302 else
303     echo "Your sh doesn't grok # comments--I will strip them later on."
304     shsharp=false
305     echo "exec grep -v '^#'" >spitshell
306     chmod +x spitshell
307     $eunicefix spitshell
308     spitshell=`pwd`/spitshell
309     echo "I presume that if # doesn't work, #! won't work either!"
310     sharpbang=': use '
311 fi
312
313 : figure out how to guarantee sh startup
314 echo " "
315 echo "Checking out how to guarantee sh startup..."
316 startsh=$sharpbang'/bin/sh'
317 echo "Let's see if '$startsh' works..."
318 cat >try <<EOSS
319 $startsh
320 set abc
321 test "$?abc" != 1
322 EOSS
323
324 chmod +x try
325 $eunicefix try
326 if try; then
327     echo "Yup, it does."
328 else
329     echo "Nope.  You may have to fix up the shell scripts to make sure sh runs them."
330 fi
331 rm -f try today
332
333 : first determine how to suppress newline on echo command
334 echo "Checking echo to see how to suppress newlines..."
335 (echo "hi there\c" ; echo " ") >.echotmp
336 if $contains c .echotmp >/dev/null 2>&1 ; then
337     echo "...using -n."
338     n='-n'
339     c=''
340 else
341     cat <<'EOM'
342 ...using \c
343 EOM
344     n=''
345     c='\c'
346 fi
347 echo $n "Type carriage return to continue.  Your cursor should be here-->$c"
348 read ans
349 rm -f .echotmp
350
351 : now set up to do reads with possible shell escape and default assignment
352 cat <<EOSC >myread
353 case "\$fastread" in
354 yes) ans=''; echo " " ;;
355 *) ans='!';;
356 esac
357 while expr "X\$ans" : "X!" >/dev/null; do
358     read ans
359     case "\$ans" in
360     !)
361         sh
362         echo " "
363         echo $n "\$rp $c"
364         ;;
365     !*)
366         set \`expr "X\$ans" : "X!\(.*\)\$"\`
367         sh -c "\$*"
368         echo " "
369         echo $n "\$rp $c"
370         ;;
371     esac
372 done
373 rp='Your answer:'
374 case "\$ans" in
375 '') ans="\$dflt";;
376 esac
377 EOSC
378
379 : general instructions
380 cat <<EOH
381  
382 This installation shell script will examine your system and ask you questions
383 to determine how the $package package should be installed.  If you get stuck
384 on a question, you may use a ! shell escape to start a subshell or execute
385 a command.  Many of the questions will have default answers in square
386 brackets--typing carriage return will give you the default.
387
388 On some of the questions which ask for file or directory names you are
389 allowed to use the ~name construct to specify the login directory belonging
390 to "name", even if you don't have a shell which knows about that.  Questions
391 where this is allowed will be marked "(~name ok)".
392
393 EOH
394 rp="[Type carriage return to continue]"
395 echo $n "$rp $c"
396 . myread
397 cat <<EOH
398
399 Much effort has been expended to ensure that this shell script will run
400 on any Unix system.  If despite that it blows up on you, your best bet is
401 to edit Configure and run it again. Also, let me (lwall@jpl-devvax.jpl.nasa.gov)
402 know how I blew it.  If you can't run Configure for some reason, you'll have
403 to generate a config.sh file by hand.
404
405 This installation script affects things in two ways: 1) it may do direct
406 variable substitutions on some of the files included in this kit, and
407 2) it builds a config.h file for inclusion in C programs.  You may edit
408 any of these files as the need arises after running this script.
409
410 If you make a mistake on a question, there is no easy way to back up to it
411 currently.  The easiest thing to do is to edit config.sh and rerun all the
412 SH files.  Configure will offer to let you do this before it runs the SH files.
413
414 EOH
415 rp="[Type carriage return to continue]"
416 echo $n "$rp $c"
417 . myread
418
419 : get old answers, if there is a config file out there
420 if test -f ../config.sh; then
421     echo " "
422     dflt=y
423     rp="I see a config.sh file.  Did Configure make it on THIS system? [$dflt]"
424     echo $n "$rp $c"
425     . myread
426     case "$ans" in
427     n*) echo "OK, I'll ignore it.";;
428     *)  echo "Fetching default answers from your old config.sh file..."
429         tmp="$n"
430         ans="$c"
431         . ../config.sh
432         n="$tmp"
433         c="$ans"
434         ;;
435     esac
436 fi
437
438 : find out where common programs are
439 echo " "
440 echo "Locating common programs..."
441 cat <<EOSC >loc
442 $startsh
443 case \$# in
444 0) exit 1;;
445 esac
446 thing=\$1
447 shift
448 dflt=\$1
449 shift
450 for dir in \$*; do
451     case "\$thing" in
452     .)
453         if test -d \$dir/\$thing; then
454             echo \$dir
455             exit 0
456         fi
457         ;;
458     *)
459         if test -f \$dir/\$thing; then
460             echo \$dir/\$thing
461             exit 0
462         elif test -f \$dir/\$thing.exe; then
463             : on Eunice apparently
464             echo \$dir/\$thing
465             exit 0
466         fi
467         ;;
468     esac
469 done
470 echo \$dflt
471 exit 1
472 EOSC
473 chmod +x loc
474 $eunicefix loc
475 loclist="
476 cat
477 cp
478 echo
479 expr
480 grep
481 mkdir
482 mv
483 rm
484 sed
485 sort
486 tr
487 uniq
488 "
489 trylist="
490 Mcc
491 cpp
492 csh
493 egrep
494 test
495 "
496 for file in $loclist; do
497     xxx=`loc $file $file $pth`
498     eval $file=$xxx
499     eval _$file=$xxx
500     case "$xxx" in
501     /*)
502         echo $file is in $xxx.
503         ;;
504     *)
505         echo "I don't know where $file is.  I hope it's in everyone's PATH."
506         ;;
507     esac
508 done
509 echo " "
510 echo "Don't worry if any of the following aren't found..."
511 ans=offhand
512 for file in $trylist; do
513     xxx=`loc $file $file $pth`
514     eval $file=$xxx
515     eval _$file=$xxx
516     case "$xxx" in
517     /*)
518         echo $file is in $xxx.
519         ;;
520     *)
521         echo "I don't see $file out there, $ans."
522         ans=either
523         ;;
524     esac
525 done
526 case "$egrep" in
527 egrep)
528     echo "Substituting grep for egrep."
529     egrep=$grep
530     ;;
531 esac
532 case "$test" in
533 test)
534     echo "Hopefully test is built into your sh."
535     ;;
536 /bin/test)
537     if sh -c "PATH= test true" >/dev/null 2>&1; then
538         echo "Using the test built into your sh."
539         test=test
540     fi
541     ;;
542 *)
543     test=test
544     ;;
545 esac
546 case "$echo" in
547 echo)
548     echo "Hopefully echo is built into your sh."
549     ;;
550 /bin/echo)
551     echo " "
552     echo "Checking compatibility between /bin/echo and builtin echo (if any)..."
553     $echo $n "hi there$c" >foo1
554     echo $n "hi there$c" >foo2
555     if cmp foo1 foo2 >/dev/null 2>&1; then
556         echo "They are compatible.  In fact, they may be identical."
557     else
558         case "$n" in
559         '-n') n='' c='\c' ans='\c' ;;
560         *) n='-n' c='' ans='-n' ;;
561         esac
562         cat <<FOO
563 They are not compatible!  You are probably running ksh on a non-USG system.
564 I'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
565 have echo built in and we may have to run some Bourne shell scripts.  That
566 means I'll have to use $ans to suppress newlines now.  Life is ridiculous.
567
568 FOO
569         rp="Your cursor should be here-->"
570         $echo $n "$rp$c"
571         . myread
572     fi
573     $rm -f foo1 foo2
574     ;;
575 *)
576     : cross your fingers
577     echo=echo
578     ;;
579 esac
580 rmlist="$rmlist loc"
581
582 : set up shell script to do ~ expansion
583 cat >filexp <<EOSS
584 $startsh
585 : expand filename
586 case "\$1" in
587  ~/*|~)
588     echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
589     ;;
590  ~*)
591     if $test -f /bin/csh; then
592         /bin/csh -f -c "glob \$1"
593         echo ""
594     else
595         name=\`$expr x\$1 : '..\([^/]*\)'\`
596         dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
597         if $test ! -d "\$dir"; then
598             me=\`basename \$0\`
599             echo "\$me: can't locate home directory for: \$name" >&2
600             exit 1
601         fi
602         case "\$1" in
603         */*)
604             echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
605             ;;
606         *)
607             echo \$dir
608             ;;
609         esac
610     fi
611     ;;
612 *)
613     echo \$1
614     ;;
615 esac
616 EOSS
617 chmod +x filexp
618 $eunicefix filexp
619
620 : determine where public executables go
621 case "$bin" in
622 '')
623     dflt=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin`
624     ;;
625 *)  dflt="$bin"
626     ;;
627 esac
628 cont=true
629 while $test "$cont" ; do
630     echo " "
631     rp="Where do you want to put the public executables? [$dflt]"
632     $echo $n "$rp $c"
633     . myread
634     bin="$ans"
635     bin=`filexp $bin`
636     if test -d $bin; then
637         cont=''
638     else
639         case "$fastread" in
640         yes) dflt=y;;
641         *) dflt=n;;
642         esac
643         rp="Directory $bin doesn't exist.  Use that name anyway? [$dflt]"
644         $echo $n "$rp $c"
645         . myread
646         dflt=''
647         case "$ans" in
648         y*) cont='';;
649         esac
650     fi
651 done
652
653 : determine where manual pages go
654 $cat <<EOM
655   
656 $package has manual pages that need to be installed in source form.
657 EOM
658 case "$mansrc" in
659 '')
660     dflt=`loc . /usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1 /usr/man/u_man/man1 /usr/man/man1 /usr/man/man.L`
661     ;;
662 *)  dflt="$mansrc"
663     ;;
664 esac
665 cont=true
666 while $test "$cont" ; do
667     echo " "
668     rp="Where do the manual pages (source) go? [$dflt]"
669     $echo $n "$rp $c"
670     . myread
671     mansrc=`filexp "$ans"`
672     if $test -d "$mansrc"; then
673         cont=''
674     else
675         if $test "$fastread" = yes; then
676             dflt=y
677         else
678             dflt=n
679         fi
680         rp="Directory $mansrc doesn't exist.  Use that name anyway? [$dflt]"
681         $echo $n "$rp $c"
682         . myread
683         dflt=''
684         case "$ans" in
685         y*) cont='';;
686         esac
687     fi
688 done
689 case "$mansrc" in
690 *l)
691     manext=l
692     ;;
693 *n)
694     manext=n
695     ;;
696 *o)
697     manext=l
698     ;;
699 *p)
700     manext=n
701     ;;
702 *C)
703     manext=C
704     ;;
705 *L)
706     manext=L
707     ;;
708 *)
709     manext=1
710     ;;
711 esac
712
713 : make some quick guesses about what we are up against
714 echo " "
715 $echo $n "Hmm...  $c"
716 cat /usr/include/signal.h /usr/include/sys/signal.h >foo
717 if test `echo abc | tr a-z A-Z` = Abc ; then
718     echo "Looks kind of like a USG system, but we'll see..."
719     echo exit 1 >bsd
720     echo exit 0 >usg
721     echo exit 1 >v7
722 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
723     echo "Looks kind of like a BSD system, but we'll see..."
724     echo exit 0 >bsd
725     echo exit 1 >usg
726     echo exit 1 >v7
727 else
728     echo "Looks kind of like a version 7 system, but we'll see..."
729     echo exit 1 >bsd
730     echo exit 1 >usg
731     echo exit 0 >v7
732 fi
733 case "$eunicefix" in
734 *unixtovms*)
735     cat <<'EOI'
736 There is, however, a strange, musty smell in the air that reminds me of
737 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
738 EOI
739     echo "exit 0" >eunice
740     d_eunice="$define"
741     ;;
742 *)
743     echo " "
744     echo "Congratulations.  You aren't running Eunice."
745     d_eunice="$undef"
746     echo "exit 1" >eunice
747     ;;
748 esac
749 if test -f /xenix; then
750     echo "Actually, this looks more like a XENIX system..."
751     echo "exit 0" >xenix
752 else
753     echo " "
754     echo "It's not Xenix..."
755     echo "exit 1" >xenix
756 fi
757 chmod +x xenix
758 $eunicefix xenix
759 if test -f /venix; then
760     echo "Actually, this looks more like a VENIX system..."
761     echo "exit 0" >venix
762 else
763     echo " "
764     if xenix; then
765         : null
766     else
767         echo "Nor is it Venix..."
768     fi
769     echo "exit 1" >venix
770 fi
771 chmod +x bsd usg v7 eunice venix
772 $eunicefix bsd usg v7 eunice venix
773 rm -rf foo
774 rmlist="$rmlist bsd usg v7 eunice venix xenix"
775
776 : see what memory models we can support
777 case "$models" in
778 '')
779     : We may not use Cppsym or we get a circular dependency through cc.
780     : But this should work regardless of which cc we eventually use.
781     cat >pdp11.c <<'EOP'
782 main() {
783 #ifdef pdp11
784     exit(0);
785 #else
786     exit(1);
787 #endif
788 }
789 EOP
790     cc -o pdp11 pdp11.c >/dev/null 2>&1
791     if pdp11 2>/dev/null; then
792         dflt='unsplit split'
793     else
794         ans=`loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
795         case "$ans" in
796         X) dflt='none';;
797         *)  if $test -d /lib/small || $test -d /usr/lib/small; then
798                 dflt='small'
799             else
800                 dflt=''
801             fi
802             if $test -d /lib/medium || $test -d /usr/lib/medium; then
803                 dflt="$dflt medium"
804             fi
805             if $test -d /lib/large || $test -d /usr/lib/large; then
806                 dflt="$dflt large"
807             fi
808             if $test -d /lib/huge || $test -d /usr/lib/huge; then
809                 dflt="$dflt huge"
810             fi
811         esac
812     fi
813     ;;
814 *)  dflt="$models" ;;
815 esac
816 $cat <<EOM
817  
818 Some systems have different model sizes.  On most systems they are called
819 small, medium, large, and huge.  On the PDP11 they are called unsplit and
820 split.  If your system doesn't support different memory models, say "none".
821 If you wish to force everything to one memory model, say "none" here and
822 put the appropriate flags later when it asks you for other cc and ld flags.
823 Venix systems may wish to put "none" and let the compiler figure things out.
824 (In the following question multiple model names should be space separated.)
825
826 EOM
827 rp="Which models are supported? [$dflt]"
828 $echo $n "$rp $c"
829 . myread
830 models="$ans"
831
832 case "$models" in
833 none)
834     small=''
835     medium=''
836     large=''
837     huge=''
838     unsplit=''
839     split=''
840     ;;
841 *split)
842     case "$split" in
843     '') 
844         if $contains '\-i' $mansrc/man1/ld.1 >/dev/null 2>&1 || \
845            $contains '\-i' $mansrc/man1/cc.1 >/dev/null 2>&1; then
846             dflt='-i'
847         else
848             dflt='none'
849         fi
850         ;;
851     *) dflt="$split";;
852     esac
853     rp="What flag indicates separate I and D space? [$dflt]"
854     $echo $n "$rp $c"
855     . myread
856     case "$ans" in
857     none) ans='';;
858     esac
859     split="$ans"
860     unsplit=''
861     ;;
862 *large*|*small*|*medium*|*huge*)
863     case "$models" in
864     *large*)
865         case "$large" in
866         '') dflt='-Ml';;
867         *) dflt="$large";;
868         esac
869         rp="What flag indicates large model? [$dflt]"
870         $echo $n "$rp $c"
871         . myread
872         case "$ans" in
873         none) ans='';
874         esac
875         large="$ans"
876         ;;
877     *) large='';;
878     esac
879     case "$models" in
880     *huge*)
881         case "$huge" in
882         '') dflt='-Mh';;
883         *) dflt="$huge";;
884         esac
885         rp="What flag indicates huge model? [$dflt]"
886         $echo $n "$rp $c"
887         . myread
888         case "$ans" in
889         none) ans='';
890         esac
891         huge="$ans"
892         ;;
893     *) huge="$large";;
894     esac
895     case "$models" in
896     *medium*)
897         case "$medium" in
898         '') dflt='-Mm';;
899         *) dflt="$medium";;
900         esac
901         rp="What flag indicates medium model? [$dflt]"
902         $echo $n "$rp $c"
903         . myread
904         case "$ans" in
905         none) ans='';
906         esac
907         medium="$ans"
908         ;;
909     *) medium="$large";;
910     esac
911     case "$models" in
912     *small*)
913         case "$small" in
914         '') dflt='none';;
915         *) dflt="$small";;
916         esac
917         rp="What flag indicates small model? [$dflt]"
918         $echo $n "$rp $c"
919         . myread
920         case "$ans" in
921         none) ans='';
922         esac
923         small="$ans"
924         ;;
925     *) small='';;
926     esac
927     ;;
928 *)
929     echo "Unrecognized memory models--you may have to edit Makefile.SH"
930     ;;
931 esac
932
933 : see if we need a special compiler
934 echo " "
935 if usg; then
936     case "$cc" in
937     '')
938         case "$Mcc" in
939         /*) dflt='Mcc'
940             ;;
941         *)
942             case "$large" in
943             -M*)
944                 dflt='cc'
945                 ;;
946             *)
947                 if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then
948                     dflt='cc -M'
949                 else
950                     dflt='cc'
951                 fi
952                 ;;
953             esac
954             ;;
955         esac
956         ;;
957     *)  dflt="$cc";;
958     esac
959     $cat <<'EOM'
960   
961 On some systems the default C compiler will not resolve multiple global
962 references that happen to have the same name.  On some such systems the
963 "Mcc" command may be used to force these to be resolved.  On other systems
964 a "cc -M" command is required.  (Note that the -M flag on other systems
965 indicates a memory model to use!)  If you have the Gnu C compiler, you
966 might wish to use that instead.  What command will force resolution on
967 EOM
968     $echo $n "this system? [$dflt] $c"
969     rp="Command to resolve multiple refs? [$dflt]"
970     . myread
971     cc="$ans"
972 else
973     case "$cc" in
974     '') dflt=cc;;
975     *) dflt="$cc";;
976     esac
977     rp="Use which C compiler? [$dflt]"
978     $echo $n "$rp $c"
979     . myread
980     cc="$ans"
981 fi
982 case "$cc" in
983 gcc*) cpp=`loc gcc-cpp $cpp $pth`;;
984 esac
985
986 : determine optimize, if desired, or use for debug flag also
987 case "$optimize" in
988 ' ') dflt="none"
989      ;;
990 '') dflt="-O";
991     ;;
992 *)  dflt="$optimize"
993     ;;
994 esac
995 cat <<EOH
996
997 Some C compilers have problems with their optimizers, by default, $package
998 compiles with the -O flag to use the optimizer.  Alternately, you might
999 want to use the symbolic debugger, which uses the -g flag (on traditional
1000 Unix systems).  Either flag can be specified here.  To use neither flag,
1001 specify the word "none".
1002   
1003 EOH
1004 rp="What optimizer/debugger flag should be used? [$dflt]"
1005 $echo $n "$rp $c"
1006 . myread
1007 optimize="$ans"
1008 case "$optimize" in
1009 'none') optimize=" "
1010      ;;
1011 esac
1012
1013 case "$ccflags" in
1014 '') case "$cc" in
1015     *gcc*) dflt='-fpcc-struct-return';;
1016     *) dflt='none';;
1017     esac
1018     ;;
1019 *) dflt="$ccflags";;
1020 esac
1021 if test -d /usr/netinclude; then
1022     case "$dflt" in
1023     *netinclude*);;
1024     *) dflt="$dflt -I/usr/netinclude";;
1025     esac
1026 fi
1027 case "$optimize" in
1028 -g*)
1029     case "$dflt" in
1030     *DEBUGGING*);;
1031     *) dflt="$dflt -DDEBUGGING";;
1032     esac
1033     ;;
1034 esac
1035 cat <<EOH
1036
1037 Your C compiler may want other flags.  For this question you should
1038 include -I/whatever and -DWHATEVER flags and any other flags used by
1039 the C compiler, but you should NOT include libraries or ld flags like
1040 -lwhatever.  To use no flags, specify the word "none".
1041   
1042 EOH
1043 rp="Any additional cc flags? [$dflt]"
1044 $echo $n "$rp $c"
1045 . myread
1046 case "$ans" in
1047 none) ans='';
1048 esac
1049 ccflags="$ans"
1050
1051 : the following weeds options from ccflags that are of no interest to cpp
1052 cppflags="$ccflags"
1053 case "$cc" in
1054 *gcc*) cppflags="$cppflags -D__GNUC__";;
1055 esac
1056 case "$cppflags" in
1057 '');;
1058 *)  set X $cppflags
1059     cppflags=''
1060     for flag do
1061         case $flag in
1062         -D*|-I*) cppflags="$cppflags $flag";;
1063         esac
1064     done
1065     case "$cppflags" in
1066     *-*)  echo "(C preprocessor flags: $cppflags)";;
1067     esac
1068     ;;
1069 esac
1070
1071 case "$ldflags" in
1072 '') if venix; then
1073         dflt='-i -z'
1074     else
1075         dflt='none'
1076     fi
1077     ;;
1078 *) dflt="$ldflags";;
1079 esac
1080 echo " "
1081 rp="Any additional ld flags (NOT including libraries)? [$dflt]"
1082 $echo $n "$rp $c"
1083 . myread
1084 case "$ans" in
1085 none) ans='';
1086 esac
1087 ldflags="$ans"
1088 rmlist="$rmlist pdp11"
1089
1090 echo " "
1091 echo "Checking for optional libraries..."
1092 case "$libs" in
1093 '') dflt='';;
1094 *) dflt="$libs";;
1095 esac
1096 case "$libswanted" in
1097 '') libswanted='c_s';;
1098 esac
1099 for thislib in $libswanted; do
1100     if xxx=`loc lib$thislib.a X /usr/lib /usr/local/lib /lib`; then
1101         echo "Found -l$thislib."
1102         case "$dflt" in
1103         *-l$thislib*);;
1104         *) dflt="$dflt -l$thislib";;
1105         esac
1106     elif xxx=`loc lib$thislib.a X $libpth`; then
1107         echo "Found $xxx."
1108         case "$dflt" in
1109         *$xxx*);;
1110         *) dflt="$dflt $xxx";;
1111         esac
1112     else
1113         echo "No -l$thislib."
1114     fi
1115 done
1116 set X $dflt
1117 shift
1118 dflt="$*"
1119 case "$dflt" in
1120 '') dflt='none';;
1121 esac
1122
1123 $cat <<EOM
1124  
1125 Some versions of Unix support shared libraries, which make
1126 executables smaller but make load time slightly longer.
1127
1128 On some systems, mostly newer Unix System V's, the shared library
1129 is included by putting the option "-lc_s" as the last thing on the
1130 cc command line when linking.  Other systems use shared libraries
1131 by default.  There may be other libraries needed to compile $package
1132 on your machine as well.  If your system needs the "-lc_s" option,
1133 include it here.  Include any other special libraries here as well.
1134 EOM
1135
1136 echo " "
1137 rp="Any additional libraries? [$dflt]"
1138 $echo $n "$rp $c"
1139 . myread
1140 case "$ans" in
1141 none) ans='';
1142 esac
1143 libs="$ans"
1144
1145 : check for ordering of bytes in a long
1146 case "$byteorder" in
1147 '')
1148 cat <<'EOM'
1149   
1150 In the following, larger digits indicate more significance.  A big-endian
1151 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321.  A
1152 little-endian machine like a Vax or an Intel 80?86 chip would be 1234.  Other
1153 machines may have weird orders like 3412.  A Cray will report 87654321.  If
1154 the test program works the default is probably right.
1155 I'm now running the test program...
1156 EOM
1157     $cat >try.c <<'EOCP'
1158 #include <stdio.h>
1159 main()
1160 {
1161     int i;
1162     union {
1163         unsigned long l;
1164         char c[8];
1165     } u;
1166
1167     u.l = 0x0807060504030201;
1168     for (i=0; i < sizeof(long); i++)
1169         printf("%c",u.c[i]+'0');
1170     printf("\n");
1171 }
1172 EOCP
1173     if $cc try.c -o try >/dev/null 2>&1 ; then
1174         dflt=`try`
1175         case "$dflt" in
1176         ????|????????) echo "(The test program ran ok.)";;
1177         *) echo "(The test program didn't run right for some reason.)";;
1178         esac
1179     else
1180         dflt='4321'
1181         echo "(I can't seem to compile the test program.  Guessing big-endian...)"
1182     fi
1183     ;;
1184 *)
1185     echo " "
1186     dflt="$byteorder"
1187     ;;
1188 esac
1189 rp="What is the order of bytes in a long? [$dflt]"
1190 $echo $n "$rp $c"
1191 . myread
1192 byteorder="$ans"
1193 $rm -f try.c try
1194
1195 : see how we invoke the C preprocessor
1196 echo " "
1197 echo "Now, how can we feed standard input to your C preprocessor..."
1198 cat <<'EOT' >testcpp.c
1199 #define ABC abc
1200 #define XYZ xyz
1201 ABC.XYZ
1202 EOT
1203 echo 'Maybe "'"$cc"' -E" will work...'
1204 $cc -E <testcpp.c >testcpp.out 2>&1
1205 : try to force gcc preprocessor if that is the compiler they are using
1206 case $? in
1207 0) cppstdin="$cc -E";;
1208 *) case "$cc" in
1209     *gcc*)
1210         cd ..
1211         echo 'Trying (cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c)'
1212         echo 'cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c' >cppstdin
1213         chmod 755 cppstdin
1214         cppstdin=`pwd`/cppstdin
1215         cppminus='';
1216         cd UU
1217         $cppstdin <testcpp.c >testcpp.out 2>&1
1218         ;;
1219     esac
1220     ;;
1221 esac
1222 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1223     echo "Yup, it does."
1224     cppstdin="$cc -E"
1225     cppminus='';
1226 else
1227     echo 'Nope, maybe "'$cpp'" will work...'
1228     $cpp <testcpp.c >testcpp.out 2>&1
1229     if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1230         echo "Yup, it does."
1231         cppstdin="$cpp"
1232         cppminus='';
1233     else
1234         echo 'No such luck...maybe "'$cpp' -" will work...'
1235         $cpp - <testcpp.c >testcpp.out 2>&1
1236         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1237             echo "It works!"
1238             cppstdin="$cpp"
1239             cppminus='-';
1240         else
1241             echo 'Nixed again...maybe "'"$cc"' -E -" will work...'
1242             $cc -E - <testcpp.c >testcpp.out 2>&1
1243             if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1244                 echo "Hooray, it works!  I was beginning to wonder."
1245                 cppstdin="$cc -E"
1246                 cppminus='-';
1247             else
1248                 echo 'Nope...maybe "'"$cc"' -P" will work...'
1249                 $cc -P <testcpp.c >testcpp.out 2>&1
1250                 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1251                     echo "Yup, that does."
1252                     cppstdin="$cc -P"
1253                     cppminus='';
1254                 else
1255                     echo 'Nope...maybe "'"$cc"' -P -" will work...'
1256                     $cc -P - <testcpp.c >testcpp.out 2>&1
1257                     if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1258                         echo "Yup, that does."
1259                         cppstdin="$cc -P"
1260                         cppminus='-';
1261                     else
1262                         echo 'Hmm...perhaps you already told me...'
1263                         case "$cppstdin" in
1264                         '') ;;
1265                         *) $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1;;
1266                         esac
1267                         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1268                             echo "Hooray, you did!  I was beginning to wonder."
1269                         else
1270                             echo 'Uh-uh.  Time to get fancy...'
1271                             cd ..
1272                             echo 'Trying (cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c)'
1273                             echo 'cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c' >cppstdin
1274                             chmod 755 cppstdin
1275                             cppstdin=`pwd`/cppstdin
1276                             cppminus='';
1277                             cd UU
1278                             $cppstdin <testcpp.c >testcpp.out 2>&1
1279                             if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1280                                 echo "Eureka!."
1281                             else
1282                                 dflt=blurfl
1283                                 $echo $n "No dice.  I can't find a C preprocessor.  Name one: $c"
1284                                 rp='Name a C preprocessor:'
1285                                 . myread
1286                                 cppstdin="$ans"
1287                                 $cppstdin <testcpp.c >testcpp.out 2>&1
1288                                 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1289                                     echo "OK, that will do."
1290                                 else
1291                                     echo "Sorry, I can't get that to work.  Go find one."
1292                                     exit 1
1293                                 fi
1294                             fi
1295                         fi
1296                     fi
1297                 fi
1298             fi
1299         fi
1300     fi
1301 fi
1302 rm -f testcpp.c testcpp.out
1303
1304 : get list of predefined functions in a handy place
1305 echo " "
1306 case "$libc" in
1307 '') libc=unknown;;
1308 esac
1309 case "$libpth" in
1310 '') libpth='/lib /usr/lib /usr/local/lib';;
1311 esac
1312 case "$libs" in
1313 *-lc_s*) libc=`loc libc_s.a $libc $libpth`
1314 esac
1315 libnames='';
1316 case "$libs" in
1317 '') ;;
1318 *)  for thislib in $libs; do
1319         case "$thislib" in
1320         -l*) thislib=`expr X$thislib : 'X-l\(.*\)'`
1321             try=`loc lib$thislib.a blurfl/dyick $libpth`
1322             if test ! -f $try; then
1323                 try=`loc lib$thislib blurfl/dyick $libpth`
1324                 if test ! -f $try; then
1325                     try=`loc $thislib blurfl/dyick $libpth`
1326                     if test ! -f $try; then
1327                         try=''
1328                     fi
1329                 fi
1330             fi
1331             libnames="$libnames $try"
1332             ;;
1333         *) libnames="$libnames $thisname" ;;
1334         esac
1335     done
1336     ;;
1337 esac
1338 set /usr/lib/libc.so.[0-9]*
1339 eval set \$$#
1340 if test -f "$1"; then
1341     echo "Your shared C library is in $1."
1342     libc="$1"
1343 elif test -f $libc; then
1344     echo "Your C library is in $libc, like you said before."
1345 elif test -f /lib/libc.a; then
1346     echo "Your C library is in /lib/libc.a.  You're normal."
1347     libc=/lib/libc.a
1348 else
1349     ans=`loc libc.a blurfl/dyick $libpth`
1350     if test ! -f "$ans"; then
1351         ans=`loc libc blurfl/dyick $libpth`
1352     fi
1353     if test ! -f "$ans"; then
1354         ans=`loc clib blurfl/dyick $libpth`
1355     fi
1356     if test ! -f "$ans"; then
1357         ans=`loc Slibc.a blurfl/dyick /usr/lib/386 /lib/386 $libpth`
1358     fi
1359     if test ! -f "$ans"; then
1360         ans=`loc Mlibc.a blurfl/dyick $libpth`
1361     fi
1362     if test ! -f "$ans"; then
1363         ans=`loc Llibc.a blurfl/dyick $libpth`
1364     fi
1365     if test -f "$ans"; then
1366         echo "Your C library is in $ans, of all places."
1367         libc=$ans
1368     else
1369         cat <<EOM
1370  
1371 I can't seem to find your C library.  I've looked in the following places:
1372
1373         $libpth
1374
1375 None of these seems to contain your C library.  What is the full name
1376 EOM
1377         dflt=None
1378         $echo $n "of your C library? $c"
1379         rp='C library full name?'
1380         . myread
1381         libc="$ans"
1382     fi
1383 fi
1384 echo " "
1385 set $libc $libnames
1386 $echo $n "Extracting names from $* for later perusal...$c"
1387 nm $* 2>/dev/null >libc.tmp
1388 $sed -n -e 's/^.* [AT]  *_[_.]*//p' -e 's/^.* [AT] //p' <libc.tmp >libc.list
1389 if $contains '^printf$' libc.list >/dev/null 2>&1; then
1390     echo "done"
1391 else
1392     $sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p' <libc.tmp >libc.list
1393     $contains '^printf$' libc.list >/dev/null 2>&1 || \
1394         $sed -n -e 's/^.* D __*//p' -e 's/^.* D //p' <libc.tmp >libc.list
1395     $contains '^printf$' libc.list >/dev/null 2>&1 || \
1396        $sed -n -e 's/^_//' \
1397               -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p' <libc.tmp >libc.list
1398     if $contains '^printf$' libc.list >/dev/null 2>&1; then
1399         echo "done"
1400     else
1401         echo " "
1402         echo "nm didn't seem to work right."
1403         echo "Trying ar instead..."
1404         if ar t $libc > libc.tmp; then
1405             for thisname in $libnames; do
1406                 ar t $thisname >>libc.tmp
1407             done
1408             $sed -e 's/\.o$//' < libc.tmp > libc.list
1409             echo "Ok."
1410         else
1411             echo "ar didn't seem to work right."
1412             echo "Maybe this is a Cray...trying bld instead..."
1413             if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
1414                 for thisname in $libnames; do
1415                     bld t $libnames | \
1416                         $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
1417                     ar t $thisname >>libc.tmp
1418                 done
1419                 echo "Ok."
1420             else
1421                 echo "That didn't work either.  Giving up."
1422                 exit 1
1423             fi
1424         fi
1425     fi
1426 fi
1427
1428 inlibc='echo " ";
1429 if $contains "^$1\$" libc.list >/dev/null 2>&1;
1430 then echo "$1() found"; eval "$2=$define";
1431 else echo "$1() not found"; eval "$2=$undef"; fi'
1432
1433 rmlist="$rmlist libc.tmp libc.list"
1434
1435 : see if bcmp exists
1436 set bcmp d_bcmp
1437 eval $inlibc
1438
1439 : see if bcopy exists
1440 set bcopy d_bcopy
1441 eval $inlibc
1442
1443 : see if sprintf is declared as int or pointer to char
1444 echo " "
1445 cat >.ucbsprf.c <<'EOF'
1446 main() { char buf[10]; exit((unsigned long)sprintf(buf,"%s","foo") > 10L); }
1447 EOF
1448 if $cc $ccflags .ucbsprf.c -o .ucbsprf >/dev/null 2>&1 && .ucbsprf; then
1449     echo "Your sprintf() returns (int)."
1450     d_charsprf="$undef"
1451 else
1452     echo "Your sprintf() returns (char*)."
1453     d_charsprf="$define"
1454 fi
1455 /bin/rm -f .ucbsprf.c .ucbsprf
1456
1457 : see if vprintf exists
1458 echo " "
1459 if $contains '^vprintf$' libc.list >/dev/null 2>&1; then
1460     echo 'vprintf() found.'
1461     d_vprintf="$define"
1462     cat >.ucbsprf.c <<'EOF'
1463 #include <varargs.h>
1464
1465 main() { xxx("foo"); }
1466
1467 xxx(va_alist)
1468 va_dcl
1469 {
1470     va_list args;
1471     char buf[10];
1472
1473     va_start(args);
1474     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
1475 }
1476 EOF
1477     if $cc $ccflags .ucbsprf.c -o .ucbsprf >/dev/null 2>&1 && .ucbsprf; then
1478         echo "Your vsprintf() returns (int)."
1479         d_charvspr="$undef"
1480     else
1481         echo "Your vsprintf() returns (char*)."
1482         d_charvspr="$define"
1483     fi
1484     /bin/rm -f .ucbsprf.c .ucbsprf
1485 else
1486     echo 'vprintf() not found.'
1487     d_vprintf="$undef"
1488     d_charvspr="$undef"
1489 fi
1490
1491 : see if crypt exists
1492 echo " "
1493 if $contains '^crypt$' libc.list >/dev/null 2>&1; then
1494     echo 'crypt() found.'
1495     d_crypt="$define"
1496     cryptlib=''
1497 else
1498     cryptlib=`loc Slibcrypt.a "" /lib/386 /lib`
1499     if $test -z "$cryptlib"; then
1500         cryptlib=`loc Mlibcrypt.a "" /lib/386 /lib`
1501     else
1502         cryptlib=-lcrypt
1503     fi
1504     if $test -z "$cryptlib"; then
1505         cryptlib=`loc Llibcrypt.a "" /lib/386 /lib`
1506     else
1507         cryptlib=-lcrypt
1508     fi
1509     if $test -z "$cryptlib"; then
1510         cryptlib=`loc libcrypt.a "" $libpth`
1511     else
1512         cryptlib=-lcrypt
1513     fi
1514     if $test -z "$cryptlib"; then
1515         echo 'crypt() not found.'
1516         d_crypt="$undef"
1517     else
1518         d_crypt="$define"
1519     fi
1520 fi
1521
1522 : get csh whereabouts
1523 case "$csh" in
1524 'csh') d_csh="$undef" ;;
1525 *)     d_csh="$define" ;;
1526 esac
1527
1528 : see if this is a dirent system
1529 echo " "
1530 if $test -r /usr/include/dirent.h ; then
1531     i_dirent="$define"
1532     echo "dirent.h found."
1533     if $contains 'd_namlen' /usr/include/sys/dirent.h >/dev/null 2>&1; then
1534         d_dirnamlen="$define"
1535     else
1536         d_dirnamlen="$undef"
1537     fi
1538 else
1539     i_dirent="$undef"
1540     d_dirnamlen="$define"
1541     echo "No dirent.h found."
1542 fi
1543
1544 : now see if they want to do setuid emulation
1545 case "$d_dosuid" in
1546 '') dflt=n;;
1547 *undef*) dflt=n;;
1548 *) dflt=y;;
1549 esac
1550 cat <<EOM
1551  
1552 Some sites have disabled setuid #! scripts because of a bug in the kernel
1553 that prevents them from being secure.  If you are on such a system, the
1554 setuid/setgid bits on scripts are currently useless.  It is possible for
1555 $package to detect those bits and emulate setuid/setgid in a secure fashion
1556 until a better solution is devised for the kernel problem.
1557
1558 EOM
1559 rp="Do you want to do setuid/setgid emulation? [$dflt]"
1560 echo $n "$rp $c"
1561 . myread
1562 case "$ans" in
1563 '') $ans="$dflt";;
1564 esac
1565 case "$ans" in
1566 y*)  d_dosuid="$define";;
1567 *) d_dosuid="$undef";;
1568 esac
1569
1570 : see if dup2 exists
1571 set dup2 d_dup2
1572 eval $inlibc
1573
1574 : see if fchmod exists
1575 set fchmod d_fchmod
1576 eval $inlibc
1577
1578 : see if fchown exists
1579 set fchown d_fchown
1580 eval $inlibc
1581
1582 : see if this is an fcntl system
1583 echo " "
1584 if $test -r /usr/include/fcntl.h ; then
1585     d_fcntl="$define"
1586     echo "fcntl.h found."
1587 else
1588     d_fcntl="$undef"
1589     echo "No fcntl.h found, but that's ok."
1590 fi
1591
1592 : see if flock exists
1593 set flock d_flock
1594 eval $inlibc
1595
1596 : see if getgroups exists
1597 set getgroups d_getgrps
1598 eval $inlibc
1599
1600 : see if gethostent exists
1601 set gethostent d_gethent
1602 eval $inlibc
1603
1604 : see if getpgrp exists
1605 set getpgrp d_getpgrp
1606 eval $inlibc
1607
1608 : see if getpriority exists
1609 set getpriority d_getprior
1610 eval $inlibc
1611
1612 : see if htonl exists
1613 set htonl d_htonl
1614 eval $inlibc
1615
1616 : index or strcpy
1617 echo " "
1618 case "$d_index" in
1619 n) dflt=n;;
1620 *) dflt=y;;
1621 esac
1622 if $contains '^index$' libc.list >/dev/null 2>&1 ; then
1623     if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
1624         echo "Your system has both index() and strchr().  Shall I use"
1625         rp="index() rather than strchr()? [$dflt]"
1626         $echo $n "$rp $c"
1627         . myread
1628         case "$ans" in
1629             n*) d_index="$define" ;;
1630             *)  d_index="$undef" ;;
1631         esac
1632     else
1633         d_index="$undef"
1634         echo "index() found."
1635     fi
1636 else
1637     if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
1638         d_index="$define"
1639         echo "strchr() found."
1640     else
1641         echo "No index() or strchr() found!"
1642         d_index="$undef"
1643     fi
1644 fi
1645
1646 : see if ioctl defs are in sgtty/termio or sys/ioctl
1647 echo " "
1648 if $test -r /usr/include/sys/ioctl.h ; then
1649     d_ioctl="$define"
1650     echo "sys/ioctl.h found."
1651 else
1652     d_ioctl="$undef"
1653     echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h."
1654 fi
1655
1656 : see if killpg exists
1657 set killpg d_killpg
1658 eval $inlibc
1659
1660 : see if memcmp exists
1661 set memcmp d_memcmp
1662 eval $inlibc
1663
1664 : see if memcpy exists
1665 set memcpy d_memcpy
1666 eval $inlibc
1667
1668 : see if mkdir exists
1669 set mkdir d_mkdir
1670 eval $inlibc
1671
1672 : see if ndbm is available
1673 echo " "
1674 if xxx=`loc ndbm.h x /usr/include /usr/local/include /usr/netinclude`; then
1675     d_ndbm="$define"
1676     echo "ndbm.h found."
1677 else
1678     d_ndbm="$undef"
1679     echo "ndbm.h not found."
1680 fi
1681
1682 : see if we have the old dbm
1683 echo " "
1684 if xxx=`loc dbm.h x /usr/include /usr/local/include /usr/netinclude`; then
1685     d_odbm="$define"
1686     echo "dbm.h found."
1687 else
1688     d_odbm="$undef"
1689     echo "dbm.h not found."
1690 fi
1691
1692 : see if this is a pwd system
1693 echo " "
1694 if $test -r /usr/include/pwd.h ; then
1695     i_pwd="$define"
1696     echo "pwd.h found."
1697     $cppstdin $cppflags </usr/include/pwd.h >$$.h
1698     if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
1699         d_pwquota="$define"
1700     else
1701         d_pwquota="$undef"
1702     fi
1703     if $contains 'pw_age' $$.h >/dev/null 2>&1; then
1704         d_pwage="$define"
1705     else
1706         d_pwage="$undef"
1707     fi
1708     if $contains 'pw_change' $$.h >/dev/null 2>&1; then
1709         d_pwchange="$define"
1710     else
1711         d_pwchange="$undef"
1712     fi
1713     if $contains 'pw_class' $$.h >/dev/null 2>&1; then
1714         d_pwclass="$define"
1715     else
1716         d_pwclass="$undef"
1717     fi
1718     if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
1719         d_pwexpire="$define"
1720     else
1721         d_pwexpire="$undef"
1722     fi
1723     rm -f $$.h
1724 else
1725     i_pwd="$undef"
1726     d_pwquota="$undef"
1727     d_pwage="$undef"
1728     d_pwchange="$undef"
1729     d_pwclass="$undef"
1730     d_pwexpire="$undef"
1731     echo "No pwd.h found."
1732 fi
1733
1734 : see if readdir exists
1735 set readdir d_readdir
1736 eval $inlibc
1737
1738 : see if rename exists
1739 set rename d_rename
1740 eval $inlibc
1741
1742 : see if rmdir exists
1743 set rmdir d_rmdir
1744 eval $inlibc
1745
1746 : see if setegid exists
1747 set setegid d_setegid
1748 eval $inlibc
1749
1750 : see if seteuid exists
1751 set seteuid d_seteuid
1752 eval $inlibc
1753
1754 : see if setpgrp exists
1755 set setpgrp d_setpgrp
1756 eval $inlibc
1757
1758 : see if setpriority exists
1759 set setpriority d_setprior
1760 eval $inlibc
1761
1762 : see if setregid exists
1763 set setregid d_setregid
1764 eval $inlibc
1765 set setresgid d_setresgid
1766 eval $inlibc
1767
1768 : see if setreuid exists
1769 set setreuid d_setreuid
1770 eval $inlibc
1771 set setresuid d_setresuid
1772 eval $inlibc
1773
1774 : see if setrgid exists
1775 set setrgid d_setrgid
1776 eval $inlibc
1777
1778 : see if setruid exists
1779 set setruid d_setruid
1780 eval $inlibc
1781
1782 socketlib=''
1783 : see whether socket exists
1784 echo " "
1785 if $contains socket libc.list >/dev/null 2>&1; then
1786     echo "Looks like you have Berkeley networking support."
1787     d_socket="$define"
1788     : now check for advanced features
1789     if $contains setsockopt libc.list >/dev/null 2>&1; then
1790         d_oldsock="$undef"
1791     else
1792         echo "...but it uses the old 4.1c interface, rather than 4.2"
1793         d_oldsock="$define"
1794     fi
1795 else
1796     : hpux, for one, puts all the socket stuff in socklib.o
1797     if $contains socklib libc.list >/dev/null 2>&1; then
1798         echo "Looks like you have Berkeley networking support."
1799         d_socket="$define"
1800         : we will have to assume that it supports the 4.2 BSD interface
1801         d_oldsock="$undef"
1802     else
1803         echo "Hmmm...you don't have Berkeley networking in libc.a..."
1804         : look for an optional networking library
1805         if test -f /usr/lib/libnet.a; then
1806             (ar t /usr/lib/libnet.a ||
1807                 nm -g /usr/lib/libnet.a) 2>/dev/null >> libc.list
1808             if $contains socket libc.list >/dev/null 2>&1; then
1809                 echo "but the Wollongong group seems to have hacked it in."
1810                 socketlib="-lnet"
1811                 d_socket="$define"
1812                 : now check for advanced features
1813                 if $contains setsockopt libc.list >/dev/null 2>&1; then
1814                     d_oldsock="$undef"
1815                 else
1816                     echo "...using the old 4.1c interface, rather than 4.2"
1817                     d_oldsock="$define"
1818                 fi
1819             else
1820                 echo "or even in libnet.a, which is peculiar."
1821                 d_socket="$undef"
1822                 d_oldsock="$undef"
1823             fi
1824         else
1825             echo "or anywhere else I see."
1826             d_socket="$undef"
1827             d_oldsock="$undef"
1828         fi
1829     fi
1830 fi
1831 if $contains socketpair libc.list >/dev/null 2>&1; then
1832     d_sockpair="$define"
1833 else
1834     d_sockpair="$undef"
1835 fi
1836
1837 : see if stat knows about block sizes
1838 echo " "
1839 if $contains 'st_blocks;' /usr/include/sys/stat.h >/dev/null 2>&1 ; then
1840     if $contains 'st_blksize;' /usr/include/sys/stat.h >/dev/null 2>&1 ; then
1841         echo "Your stat knows about block sizes."
1842         d_statblks="$define"
1843     else
1844         echo "Your stat doesn't know about block sizes."
1845         d_statblks="$undef"
1846     fi
1847 else
1848     echo "Your stat doesn't know about block sizes."
1849     d_statblks="$undef"
1850 fi
1851
1852 : see if stdio is really std
1853 echo " "
1854 if $contains 'char.*_ptr;' /usr/include/stdio.h >/dev/null 2>&1 ; then
1855     if $contains '_cnt;' /usr/include/stdio.h >/dev/null 2>&1 ; then
1856         echo "Your stdio is pretty std."
1857         d_stdstdio="$define"
1858     else
1859         echo "Your stdio isn't very std."
1860         d_stdstdio="$undef"
1861     fi
1862 else
1863     echo "Your stdio isn't very std."
1864     d_stdstdio="$undef"
1865 fi
1866
1867 : check for structure copying
1868 echo " "
1869 echo "Checking to see if your C compiler can copy structs..."
1870 $cat >try.c <<'EOCP'
1871 main()
1872 {
1873         struct blurfl {
1874             int dyick;
1875         } foo, bar;
1876
1877         foo = bar;
1878 }
1879 EOCP
1880 if $cc -c try.c >/dev/null 2>&1 ; then
1881     d_strctcpy="$define"
1882     echo "Yup, it can."
1883 else
1884     d_strctcpy="$undef"
1885     echo "Nope, it can't."
1886 fi
1887 $rm -f try.*
1888
1889 : see if symlink exists
1890 set symlink d_symlink
1891 eval $inlibc
1892
1893 : see if syscall exists
1894 set syscall d_syscall
1895 eval $inlibc
1896
1897 : see if struct tm is defined in sys/time.h
1898 echo " "
1899 if $contains 'struct tm' /usr/include/time.h >/dev/null 2>&1 ; then
1900     echo "You have struct tm defined in <time.h> rather than <sys/time.h>."
1901     d_tminsys="$undef"
1902     if test -f /usr/include/sys/time.h; then
1903         i_systime="$define"
1904     else
1905         i_systime="$undef"
1906     fi
1907 else
1908     echo "You have struct tm defined in <sys/time.h> rather than <time.h>."
1909     d_tminsys="$define"
1910     i_systime="$define"
1911 fi
1912 if $contains '^#.*include.*<time\.h>' /usr/include/sys/time.h >/dev/null 2>&1 ; then
1913     i_timetoo="$undef"
1914 else
1915     i_timetoo="$define"
1916 fi
1917
1918 : see if this is a varargs system
1919 echo " "
1920 if $test -r /usr/include/varargs.h ; then
1921     d_varargs="$define"
1922     echo "varargs.h found."
1923 else
1924     d_varargs="$undef"
1925     echo "No varargs.h found, but that's ok (I hope)."
1926 fi
1927
1928 : see if there is a vfork
1929 set vfork d_vfork
1930 eval $inlibc
1931
1932 : see if signal is declared as pointer to function returning int or void
1933 echo " "
1934 if $contains 'void.*signal' /usr/include/signal.h >/dev/null 2>&1 ; then
1935     echo "You have void (*signal())() instead of int."
1936     d_voidsig="$define"
1937 else
1938     echo "You have int (*signal())() instead of void."
1939     d_voidsig="$undef"
1940 fi
1941
1942 : see if there is a wait4
1943 set wait4 d_wait4
1944 eval $inlibc
1945
1946 : check for void type
1947 echo " "
1948 $cat <<EOM
1949 Checking to see how well your C compiler groks the void type...
1950
1951   Support flag bits are:
1952     1: basic void declarations.
1953     2: arrays of pointers to functions returning void.
1954     4: operations between pointers to and addresses of void functions.
1955
1956 EOM
1957 case "$voidflags" in
1958 '')
1959     $cat >try.c <<'EOCP'
1960 #if TRY & 1
1961 void main() {
1962 #else
1963 main() {
1964 #endif
1965         extern void moo();      /* function returning void */
1966         void (*goo)();          /* ptr to func returning void */
1967 #if TRY & 2
1968         void (*foo[10])();
1969 #endif
1970
1971 #if TRY & 4
1972         if(goo == moo) {
1973                 exit(0);
1974         }
1975 #endif
1976         exit(0);
1977 }
1978 EOCP
1979     if $cc -S -DTRY=$defvoidused try.c >.out 2>&1 ; then
1980         voidflags=$defvoidused
1981         echo "It appears to support void."
1982         if $contains warning .out >/dev/null 2>&1; then
1983             echo "However, you might get some warnings that look like this:"
1984             $cat .out
1985         fi
1986     else
1987         echo "Hmm, your compiler has some difficulty with void.  Checking further..."
1988         if $cc -S -DTRY=1 try.c >/dev/null 2>&1 ; then
1989             echo "It supports 1..."
1990             if $cc -S -DTRY=3 try.c >/dev/null 2>&1 ; then
1991                 voidflags=3
1992                 echo "And it supports 2 but not 4."
1993             else
1994                 echo "It doesn't support 2..."
1995                 if $cc -S -DTRY=5 try.c >/dev/null 2>&1 ; then
1996                     voidflags=5
1997                     echo "But it supports 4."
1998                 else
1999                     voidflags=1
2000                     echo "And it doesn't support 4."
2001                 fi
2002             fi
2003         else
2004             echo "There is no support at all for void."
2005             voidflags=0
2006         fi
2007     fi
2008 esac
2009 dflt="$voidflags";
2010 rp="Your void support flags add up to what? [$dflt]"
2011 $echo $n "$rp $c"
2012 . myread
2013 voidflags="$ans"
2014 $rm -f try.* .out
2015
2016 : see what type gids are declared as in the kernel
2017 case "$gidtype" in
2018 '')
2019     if $contains 'gid_t;' /usr/include/sys/types.h >/dev/null 2>&1 ; then
2020         dflt='gid_t';
2021     else
2022         set `grep 'groups\[NGROUPS\];' /usr/include/sys/user.h 2>/dev/null` unsigned short
2023         case $1 in
2024         unsigned) dflt="$1 $2" ;;
2025         *) dflt="$1" ;;
2026         esac
2027     fi
2028     ;;
2029 *)  dflt="$gidtype"
2030     ;;
2031 esac
2032 cont=true
2033 echo " "
2034 echo "(The following only matters if you have getgroups().)"
2035 rp="What type are the group ids returned by getgroups()? [$dflt]"
2036 $echo $n "$rp $c"
2037 . myread
2038 gidtype="$ans"
2039
2040 : see if this is an fcntl system
2041 echo " "
2042 if $test -r /usr/include/fcntl.h ; then
2043     i_fcntl="$define"
2044     echo "fcntl.h found."
2045 else
2046     i_fcntl="$undef"
2047     echo "No fcntl.h found, but that's ok."
2048 fi
2049
2050 : see if this is an grp system
2051 echo " "
2052 if $test -r /usr/include/grp.h ; then
2053     i_grp="$define"
2054     echo "grp.h found."
2055 else
2056     i_grp="$undef"
2057     echo "No grp.h found."
2058 fi
2059
2060 : see if this is a netinet/in.h system
2061 echo " "
2062 if xxx=`loc netinet/in.h x /usr/include /usr/local/include /usr/netinclude`; then
2063     i_niin="$define"
2064     echo "netinet/in.h found."
2065 else
2066     i_niin="$undef"
2067     echo "No netinet/in.h found."
2068 fi
2069
2070 : see if this is a sys/dir.h system
2071 echo " "
2072 if $test -r /usr/include/sys/dir.h ; then
2073     i_sysdir="$define"
2074     echo "sysdir.h found."
2075 else
2076     i_sysdir="$undef"
2077     echo "No sysdir.h found."
2078 fi
2079
2080 : see if ioctl defs are in sgtty/termio or sys/ioctl
2081 echo " "
2082 if $test -r /usr/include/sys/ioctl.h ; then
2083     i_sysioctl="$define"
2084     echo "sys/ioctl.h found."
2085 else
2086     i_sysioctl="$undef"
2087     echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h."
2088 fi
2089
2090 : see if this is a varargs system
2091 echo " "
2092 if $test -r /usr/include/varargs.h ; then
2093     i_varargs="$define"
2094     echo "varargs.h found."
2095 else
2096     i_varargs="$undef"
2097     echo "No varargs.h found, but that's ok (I hope)."
2098 fi
2099
2100 : see if this is a vfork system
2101 echo " "
2102 if $test -r /usr/include/vfork.h ; then
2103     i_vfork="$define"
2104     echo "vfork.h found."
2105 else
2106     i_vfork="$undef"
2107     echo "No vfork.h found."
2108 fi
2109
2110 : check for length of integer
2111 echo " "
2112 case "$intsize" in
2113 '')
2114     echo "Checking to see how big your integers are..."
2115     $cat >try.c <<'EOCP'
2116 #include <stdio.h>
2117 main()
2118 {
2119     printf("%d\n", sizeof(int));
2120 }
2121 EOCP
2122     if $cc try.c -o try >/dev/null 2>&1 ; then
2123         dflt=`try`
2124     else
2125         dflt='4'
2126         echo "(I can't seem to compile the test program.  Guessing...)"
2127     fi
2128     ;;
2129 *)
2130     dflt="$intsize"
2131     ;;
2132 esac
2133 rp="What is the size of an integer (in bytes)? [$dflt]"
2134 $echo $n "$rp $c"
2135 . myread
2136 intsize="$ans"
2137 $rm -f try.c try
2138
2139 : determine where private executables go
2140 case "$privlib" in
2141 '')
2142     dflt=/usr/lib/$package
2143     test -d /usr/local/lib && dflt=/usr/local/lib/$package
2144     ;;
2145 *)  dflt="$privlib"
2146     ;;
2147 esac
2148 $cat <<EOM
2149
2150 The $package package has some auxiliary files that should be put in a library
2151 that is accessible by everyone.  Where do you want to put these "private"
2152 EOM
2153 $echo $n "but accessible files? [$dflt] $c"
2154 rp="Put private files where? [$dflt]"
2155 . myread
2156 privlib="$ans"
2157
2158 : check for size of random number generator
2159 echo " "
2160 case "$randbits" in
2161 '')
2162     echo "Checking to see how many bits your rand function produces..."
2163     $cat >try.c <<'EOCP'
2164 #include <stdio.h>
2165 main()
2166 {
2167     register int i;
2168     register unsigned long tmp;
2169     register unsigned long max = 0L;
2170
2171     for (i=1000; i; i--) {
2172         tmp = (unsigned long)rand();
2173         if (tmp > max) max = tmp;
2174     }
2175     for (i=0; max; i++)
2176         max /= 2;
2177     printf("%d\n",i);
2178 }
2179 EOCP
2180     if $cc try.c -o try >/dev/null 2>&1 ; then
2181         dflt=`try`
2182     else
2183         dflt='?'
2184         echo "(I can't seem to compile the test program...)"
2185     fi
2186     ;;
2187 *)
2188     dflt="$randbits"
2189     ;;
2190 esac
2191 rp="How many bits does your rand() function produce? [$dflt]"
2192 $echo $n "$rp $c"
2193 . myread
2194 randbits="$ans"
2195 $rm -f try.c try
2196
2197 : generate list of signal names
2198 echo " "
2199 case "$sig_name" in
2200 '')
2201     echo "Generating a list of signal names..."
2202     set X `cat /usr/include/signal.h /usr/include/sys/signal.h 2>&1 | awk '
2203 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ {
2204     sig[$3] = substr($2,4,20)
2205     if (max < $3 && $3 < 60) {
2206         max = $3
2207     }
2208 }
2209
2210 END {
2211     for (i=1; i<=max; i++) {
2212         if (sig[i] == "")
2213             printf "%d", i
2214         else
2215             printf "%s", sig[i]
2216         if (i < max)
2217             printf " "
2218     }
2219     printf "\n"
2220 }
2221 '`
2222     shift
2223     case $# in
2224     0)  echo 'kill -l' >/tmp/foo$$
2225         set X `$csh -f </tmp/foo$$`
2226         shift
2227         case $# in
2228         0)set HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM
2229             ;;
2230         esac
2231         ;;
2232     esac
2233     sig_name="ZERO $*"
2234     ;;
2235 esac
2236 echo "Signals are: $sig_name"
2237
2238 : see what type of char stdio uses.
2239 echo " "
2240 if $contains 'unsigned.*char.*_ptr;' /usr/include/stdio.h >/dev/null 2>&1 ; then
2241     echo "Your stdio uses unsigned chars."
2242     stdchar="unsigned char"
2243 else
2244     echo "Your stdio uses signed chars."
2245     stdchar="char"
2246 fi
2247
2248 : see what type uids are declared as in the kernel
2249 case "$uidtype" in
2250 '')
2251     if $contains 'uid_t;' /usr/include/sys/types.h >/dev/null 2>&1 ; then
2252         dflt='uid_t';
2253     else
2254         set `grep '_ruid;' /usr/include/sys/user.h 2>/dev/null` unsigned short
2255         case $1 in
2256         unsigned) dflt="$1 $2" ;;
2257         *) dflt="$1" ;;
2258         esac
2259     fi
2260     ;;
2261 *)  dflt="$uidtype"
2262     ;;
2263 esac
2264 cont=true
2265 echo " "
2266 rp="What type are user ids returned by getuid(), etc.? [$dflt]"
2267 $echo $n "$rp $c"
2268 . myread
2269 uidtype="$ans"
2270
2271 : preserve RCS keywords in files with variable substitution, grrr
2272 Log='$Log'
2273 Header='$Header'
2274
2275
2276 : see if we should include -lnm
2277 echo " "
2278 if $test -r /usr/lib/libnm.a || $test -r /usr/local/lib/libnm.a ; then
2279     echo "New math library found."
2280     libnm='-lnm'
2281 else
2282     ans=`loc libnm.a x $libpth`
2283     case "$ans" in
2284     x)
2285         echo "No nm library found--the normal math library will have to do."
2286         libnm=''
2287         ;;
2288     *)
2289         echo "New math library found in $ans."
2290         libnm="$ans"
2291         ;;
2292     esac
2293 fi
2294
2295 : determine which malloc to compile in
2296 echo " "
2297 case "$usemymalloc" in
2298 '')
2299     if bsd || v7; then
2300         dflt='y'
2301     else
2302         dflt='n'
2303     fi
2304     ;;
2305 *)  dflt="$usemymalloc"
2306     ;;
2307 esac
2308 rp="Do you wish to attempt to use the malloc that comes with $package? [$dflt]"
2309 $echo $n "$rp $c"
2310 . myread
2311 case "$ans" in
2312 '') ans=$dflt;;
2313 esac
2314 usemymalloc="$ans"
2315 case "$ans" in
2316 y*) mallocsrc='malloc.c'; mallocobj='malloc.o';;
2317 *) mallocsrc=''; mallocobj='';;
2318 esac
2319
2320 echo " "
2321 echo "End of configuration questions."
2322 echo " "
2323
2324 : create config.sh file
2325 echo " "
2326 if test -d ../UU; then
2327     cd ..
2328 fi
2329 echo "Creating config.sh..."
2330 $spitshell <<EOT >config.sh
2331 $startsh
2332 # config.sh
2333 # This file was produced by running the Configure script.
2334
2335 d_eunice='$d_eunice'
2336 define='$define'
2337 eunicefix='$eunicefix'
2338 loclist='$loclist'
2339 expr='$expr'
2340 sed='$sed'
2341 echo='$echo'
2342 cat='$cat'
2343 rm='$rm'
2344 mv='$mv'
2345 cp='$cp'
2346 tail='$tail'
2347 tr='$tr'
2348 mkdir='$mkdir'
2349 sort='$sort'
2350 uniq='$uniq'
2351 grep='$grep'
2352 trylist='$trylist'
2353 test='$test'
2354 inews='$inews'
2355 egrep='$egrep'
2356 more='$more'
2357 pg='$pg'
2358 Mcc='$Mcc'
2359 vi='$vi'
2360 mailx='$mailx'
2361 mail='$mail'
2362 cpp='$cpp'
2363 perl='$perl'
2364 emacs='$emacs'
2365 ls='$ls'
2366 rmail='$rmail'
2367 sendmail='$sendmail'
2368 shar='$shar'
2369 smail='$smail'
2370 tbl='$tbl'
2371 troff='$troff'
2372 nroff='$nroff'
2373 uname='$uname'
2374 uuname='$uuname'
2375 line='$line'
2376 chgrp='$chgrp'
2377 chmod='$chmod'
2378 lint='$lint'
2379 sleep='$sleep'
2380 pr='$pr'
2381 tar='$tar'
2382 ln='$ln'
2383 lpr='$lpr'
2384 lp='$lp'
2385 touch='$touch'
2386 make='$make'
2387 date='$date'
2388 csh='$csh'
2389 Log='$Log'
2390 Header='$Header'
2391 bin='$bin'
2392 byteorder='$byteorder'
2393 contains='$contains'
2394 cppstdin='$cppstdin'
2395 cppminus='$cppminus'
2396 d_bcmp='$d_bcmp'
2397 d_bcopy='$d_bcopy'
2398 d_charsprf='$d_charsprf'
2399 d_crypt='$d_crypt'
2400 cryptlib='$cryptlib'
2401 d_csh='$d_csh'
2402 d_dosuid='$d_dosuid'
2403 d_dup2='$d_dup2'
2404 d_fchmod='$d_fchmod'
2405 d_fchown='$d_fchown'
2406 d_fcntl='$d_fcntl'
2407 d_flock='$d_flock'
2408 d_getgrps='$d_getgrps'
2409 d_gethent='$d_gethent'
2410 d_getpgrp='$d_getpgrp'
2411 d_getprior='$d_getprior'
2412 d_htonl='$d_htonl'
2413 d_index='$d_index'
2414 d_ioctl='$d_ioctl'
2415 d_killpg='$d_killpg'
2416 d_memcmp='$d_memcmp'
2417 d_memcpy='$d_memcpy'
2418 d_mkdir='$d_mkdir'
2419 d_ndbm='$d_ndbm'
2420 d_odbm='$d_odbm'
2421 d_readdir='$d_readdir'
2422 d_rename='$d_rename'
2423 d_rmdir='$d_rmdir'
2424 d_setegid='$d_setegid'
2425 d_seteuid='$d_seteuid'
2426 d_setpgrp='$d_setpgrp'
2427 d_setprior='$d_setprior'
2428 d_setregid='$d_setregid'
2429 d_setresgid='$d_setresgid'
2430 d_setreuid='$d_setreuid'
2431 d_setresuid='$d_setresuid'
2432 d_setrgid='$d_setrgid'
2433 d_setruid='$d_setruid'
2434 d_socket='$d_socket'
2435 d_sockpair='$d_sockpair'
2436 d_oldsock='$d_oldsock'
2437 socketlib='$socketlib'
2438 d_statblks='$d_statblks'
2439 d_stdstdio='$d_stdstdio'
2440 d_strctcpy='$d_strctcpy'
2441 d_symlink='$d_symlink'
2442 d_syscall='$d_syscall'
2443 d_tminsys='$d_tminsys'
2444 i_systime='$i_systime'
2445 i_timetoo='$i_timetoo'
2446 d_varargs='$d_varargs'
2447 d_vfork='$d_vfork'
2448 d_voidsig='$d_voidsig'
2449 d_vprintf='$d_vprintf'
2450 d_charvspr='$d_charvspr'
2451 d_wait4='$d_wait4'
2452 gidtype='$gidtype'
2453 i_dirent='$i_dirent'
2454 d_dirnamlen='$d_dirnamlen'
2455 i_fcntl='$i_fcntl'
2456 i_grp='$i_grp'
2457 i_niin='$i_niin'
2458 i_pwd='$i_pwd'
2459 d_pwquota='$d_pwquota'
2460 d_pwage='$d_pwage'
2461 d_pwchange='$d_pwchange'
2462 d_pwclass='$d_pwclass'
2463 d_pwexpire='$d_pwexpire'
2464 i_sysdir='$i_sysdir'
2465 i_sysioctl='$i_sysioctl'
2466 i_varargs='$i_varargs'
2467 i_vfork='$i_vfork'
2468 intsize='$intsize'
2469 libc='$libc'
2470 libnm='$libnm'
2471 mallocsrc='$mallocsrc'
2472 mallocobj='$mallocobj'
2473 usemymalloc='$usemymalloc'
2474 mansrc='$mansrc'
2475 manext='$manext'
2476 models='$models'
2477 split='$split'
2478 small='$small'
2479 medium='$medium'
2480 large='$large'
2481 huge='$huge'
2482 optimize='$optimize'
2483 ccflags='$ccflags'
2484 cppflags='$cppflags'
2485 ldflags='$ldflags'
2486 cc='$cc'
2487 libs='$libs'
2488 n='$n'
2489 c='$c'
2490 package='$package'
2491 randbits='$randbits'
2492 sig_name='$sig_name'
2493 spitshell='$spitshell'
2494 shsharp='$shsharp'
2495 sharpbang='$sharpbang'
2496 startsh='$startsh'
2497 stdchar='$stdchar'
2498 uidtype='$uidtype'
2499 voidflags='$voidflags'
2500 defvoidused='$defvoidused'
2501 lib='$lib'
2502 privlib='$privlib'
2503 CONFIG=true
2504 EOT
2505
2506 CONFIG=true
2507
2508 echo " "
2509 dflt=''
2510 fastread=''
2511 echo "If you didn't make any mistakes, then just type a carriage return here."
2512 rp="If you need to edit config.sh, do it as a shell escape here:"
2513 $echo $n "$rp $c"
2514 . UU/myread
2515 case "$ans" in
2516 '') ;;
2517 *) : in case they cannot read
2518     eval $ans;;
2519 esac
2520 . ./config.sh
2521
2522 echo " "
2523 echo "Doing variable substitutions on .SH files..."
2524 set x `awk '{print $1}' <MANIFEST | $grep '\.SH'`
2525 shift
2526 case $# in
2527 0) set x *.SH; shift;;
2528 esac
2529 if test ! -f $1; then
2530     shift
2531 fi
2532 for file in $*; do
2533     case "$file" in
2534     */*)
2535         dir=`$expr X$file : 'X\(.*\)/'`
2536         file=`$expr X$file : 'X.*/\(.*\)'`
2537         (cd $dir && . $file)
2538         ;;
2539     *)
2540         . $file
2541         ;;
2542     esac
2543 done
2544 if test -f config.h.SH; then
2545     if test ! -f config.h; then
2546         : oops, they left it out of MANIFEST, probably, so do it anyway.
2547         . config.h.SH
2548     fi
2549 fi
2550
2551 if $contains '^depend:' Makefile >/dev/null 2>&1; then
2552     dflt=n
2553     $cat <<EOM
2554
2555 Now you need to generate make dependencies by running "make depend".
2556 You might prefer to run it in background: "make depend > makedepend.out &"
2557 It can take a while, so you might not want to run it right now.
2558
2559 EOM
2560     rp="Run make depend now? [$dflt]"
2561     $echo $n "$rp $c"
2562     . UU/myread
2563     case "$ans" in
2564     y*) make depend && echo "Now you must run a make."
2565         ;;
2566     *)  echo "You must run 'make depend' then 'make'."
2567         ;;
2568     esac
2569 elif test -f Makefile; then
2570     echo " "
2571     echo "Now you must run a make."
2572 else
2573     echo "Done."
2574 fi
2575
2576 $rm -f kit*isdone
2577 : the following is currently useless
2578 cd UU && $rm -f $rmlist
2579 : since this removes it all anyway
2580 cd .. && $rm -rf UU
2581 : end of Configure