perl 4.0 patch 16: patch #11, continued
[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 # $RCSfile: Configure,v $$Revision: 4.0.1.5 $$Date: 91/11/05 23:11:32 $
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 cat >/tmp/c1$$ <<EOF
18 ARGGGHHHH!!!!!
19
20 Your csh still thinks true is false.  Write to your vendor today and tell
21 them that next year Configure ought to "rm /bin/csh" unless they fix their
22 blasted shell. :-)
23
24 [End of diatribe.  We now return you to your regularly scheduled
25 programming...]
26
27 EOF
28 cat >/tmp/c2$$ <<EOF
29 OOPS!  You naughty creature!  You didn't run Configure with sh!
30 I will attempt to remedy the situation by running sh for you...
31
32 EOF
33
34 true || cat /tmp/c1$$ /tmp/c2$$
35 true || exec sh $0
36
37 export PATH || cat /tmp/c2$$
38 export PATH || exec sh $0
39 rm -f /tmp/c1$$ /tmp/c2$$
40
41 PATH=".:$PATH:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc:/usr/new:/usr/new/bin:/usr/nbin"
42
43 if test ! -t 0; then
44     echo "Say 'sh Configure', not 'sh <Configure'"
45     exit 1
46 fi
47
48 (alias) >/dev/null 2>&1 && \
49     echo "(I see you are using the Korn shell.  Some ksh's blow up on Configure," && \
50     echo "especially on exotic machines.  If yours does, try the Bourne shell instead.)"
51
52 if test ! -d ../UU; then
53     if test ! -d UU; then
54         mkdir UU
55     fi
56     cd UU
57 fi
58
59 case "$1" in
60 -d) shift; fastread='yes';;
61 esac
62
63 d_eunice=''
64 define=''
65 eunicefix=''
66 loclist=''
67 expr=''
68 sed=''
69 echo=''
70 cat=''
71 rm=''
72 mv=''
73 cp=''
74 tail=''
75 tr=''
76 mkdir=''
77 sort=''
78 uniq=''
79 grep=''
80 trylist=''
81 test=''
82 inews=''
83 egrep=''
84 more=''
85 pg=''
86 Mcc=''
87 vi=''
88 mailx=''
89 mail=''
90 cpp=''
91 perl=''
92 emacs=''
93 ls=''
94 rmail=''
95 sendmail=''
96 shar=''
97 smail=''
98 tbl=''
99 troff=''
100 nroff=''
101 uname=''
102 uuname=''
103 line=''
104 chgrp=''
105 chmod=''
106 lint=''
107 sleep=''
108 pr=''
109 tar=''
110 ln=''
111 lpr=''
112 lp=''
113 touch=''
114 make=''
115 date=''
116 csh=''
117 bash=''
118 ksh=''
119 lex=''
120 flex=''
121 bison=''
122 Log=''
123 Header=''
124 Id=''
125 lastuname=''
126 alignbytes=''
127 bin=''
128 installbin=''
129 byteorder=''
130 contains=''
131 cppstdin=''
132 cppminus=''
133 d_bcmp=''
134 d_bcopy=''
135 d_bzero=''
136 d_castneg=''
137 castflags=''
138 d_charsprf=''
139 d_chsize=''
140 d_crypt=''
141 cryptlib=''
142 d_csh=''
143 d_dosuid=''
144 d_dup2=''
145 d_fchmod=''
146 d_fchown=''
147 d_fcntl=''
148 d_flexfnam=''
149 d_flock=''
150 d_getgrps=''
151 d_gethent=''
152 d_getpgrp=''
153 d_getpgrp2=''
154 d_getprior=''
155 d_htonl=''
156 d_index=''
157 d_killpg=''
158 d_lstat=''
159 d_memcmp=''
160 d_memcpy=''
161 d_mkdir=''
162 d_msg=''
163 d_msgctl=''
164 d_msgget=''
165 d_msgrcv=''
166 d_msgsnd=''
167 d_ndbm=''
168 d_odbm=''
169 d_open3=''
170 d_readdir=''
171 d_rename=''
172 d_rmdir=''
173 d_select=''
174 d_sem=''
175 d_semctl=''
176 d_semget=''
177 d_semop=''
178 d_setegid=''
179 d_seteuid=''
180 d_setpgrp=''
181 d_setpgrp2=''
182 d_setprior=''
183 d_setregid=''
184 d_setresgid=''
185 d_setreuid=''
186 d_setresuid=''
187 d_setrgid=''
188 d_setruid=''
189 d_shm=''
190 d_shmat=''
191 d_voidshmat=''
192 d_shmctl=''
193 d_shmdt=''
194 d_shmget=''
195 d_socket=''
196 d_sockpair=''
197 d_oldsock=''
198 socketlib=''
199 d_statblks=''
200 d_stdstdio=''
201 d_strctcpy=''
202 d_strerror=''
203 d_symlink=''
204 d_syscall=''
205 d_truncate=''
206 d_vfork=''
207 d_voidsig=''
208 d_tosignal=''
209 d_volatile=''
210 d_vprintf=''
211 d_charvspr=''
212 d_wait4=''
213 d_waitpid=''
214 gidtype=''
215 groupstype=''
216 i_fcntl=''
217 i_gdbm=''
218 i_grp=''
219 i_niin=''
220 i_sysin=''
221 i_pwd=''
222 d_pwquota=''
223 d_pwage=''
224 d_pwchange=''
225 d_pwclass=''
226 d_pwexpire=''
227 d_pwcomment=''
228 i_sys_file=''
229 i_sysioctl=''
230 i_time=''
231 i_sys_time=''
232 i_sys_select=''
233 d_systimekernel=''
234 i_utime=''
235 i_varargs=''
236 i_vfork=''
237 intsize=''
238 libc=''
239 nm_opts=''
240 libndir=''
241 i_my_dir=''
242 i_ndir=''
243 i_sys_ndir=''
244 i_dirent=''
245 i_sys_dir=''
246 d_dirnamlen=''
247 ndirc=''
248 ndiro=''
249 mallocsrc=''
250 mallocobj=''
251 d_mymalloc=''
252 mallocptrtype=''
253 mansrc=''
254 manext=''
255 models=''
256 split=''
257 small=''
258 medium=''
259 large=''
260 huge=''
261 optimize=''
262 ccflags=''
263 cppflags=''
264 ldflags=''
265 cc=''
266 nativegcc=''
267 libs=''
268 n=''
269 c=''
270 package=''
271 randbits=''
272 scriptdir=''
273 installscr=''
274 sig_name=''
275 spitshell=''
276 shsharp=''
277 sharpbang=''
278 startsh=''
279 stdchar=''
280 uidtype=''
281 usrinclude=''
282 inclPath=''
283 void=''
284 voidhave=''
285 voidwant=''
286 w_localtim=''
287 w_s_timevl=''
288 w_s_tm=''
289 yacc=''
290 lib=''
291 privlib=''
292 installprivlib=''
293 CONFIG=''
294 : get the name of the package
295 package=perl
296 : Here we go...
297 echo " "
298 echo "Beginning of configuration questions for $package kit."
299 : Eunice requires " " instead of "", can you believe it
300 echo " "
301
302 define='define'
303 undef='undef'
304 : change the next line if compiling for Xenix/286 on Xenix/386
305 xlibpth='/usr/lib/386 /lib/386'
306
307 : the hints files may add more components to libpth
308 test -d /usr/cs/lib             && libpth="$libpth /usr/cs/lib"
309 test -d /usr/ccs/lib            && libpth="$libpth /usr/ccs/lib"
310 test -d /usr/lib                && libpth="$libpth /usr/lib"
311 test -d /usr/ucblib             && libpth="$libpth /usr/ucblib"
312 test -d /usr/local/lib          && libpth="$libpth /usr/local/lib"
313 test -d /usr/lib/large          && libpth="$libpth /usr/lib/large"
314 test -d /lib                    && libpth="$libpth /lib"
315                                    libpth="$libpth $xlibpth"
316 test -d /lib/large              && libpth="$libpth /lib/large"
317 test -d /usr/lib/small          && libpth="$libpth /usr/lib/small"
318 test -d /lib/small              && libpth="$libpth /lib/small"
319 test -d /usr/lib/cmplrs/cc      && libpth="$libpth /usr/lib/cmplrs/cc"
320
321 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
322 trap 'echo " "; exit 1' 1 2 3
323
324 : We must find out about Eunice early
325 eunicefix=':'
326 if test -f /etc/unixtovms; then
327     eunicefix=/etc/unixtovms
328 fi
329 if test -f /etc/unixtovms.exe; then
330     eunicefix=/etc/unixtovms.exe
331 fi
332
333 attrlist="DGUX M_I186 M_I286 M_I386 M_I8086 M_XENIX UTS __DGUX__"
334 attrlist="$attrlist __STDC__ __m88k__ ansi bsd4_2 gcos gimpel"
335 attrlist="$attrlist hp9000s300 hp9000s500 hp9000s800 hpux"
336 attrlist="$attrlist i186 i386 i8086 iAPX286 ibm interdata"
337 attrlist="$attrlist m68k m88k mc300 mc500 mc68000 mc68k mc700 mert"
338 attrlist="$attrlist ns16000 ns32000 nsc32000 os pdp11 posix pyr sinix"
339 attrlist="$attrlist sparc sun tower tower32 tower32_600 tower32_800 tss"
340 attrlist="$attrlist u3b2 u3b20 u3b200 u3b5 ultrix unix vax venix xenix"
341 attrlist="$attrlist z8000"
342 boPATH=""
343 eoPATH="/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 /bsd43/usr/bin"
344 d_newshome="/usr/NeWS"
345 errnolist=errnolist
346 h_fcntl=false
347 h_sys_file=false
348 serve_shm=""
349 serve_msg="$undef"
350 serve_inet_udp=""
351 serve_inet_tcp=""
352 serve_unix_udp=""
353 serve_unix_tcp=""
354 d_ndir=ndir
355 voidwant=1
356 voidwant=7
357 libswanted="c_s net_s net nsl_s nsl socket nm ndir ndbm dbm PW malloc sun m bsd BSD x posix ucb"
358 inclwanted='/usr/include /usr/netinclude /usr/include/sun /usr/include/bsd /usr/include/lan /usr/ucbinclude'
359
360 : Now test for existence of everything in MANIFEST
361
362 echo "First let's make sure your kit is complete.  Checking..."
363 awk '$1 !~ /PACKINGLIST/ {print $1}' ../MANIFEST | split -200
364 rm -f missing
365 for filelist in x??; do
366     (cd ..; ls `cat UU/$filelist` >/dev/null 2>>UU/missing)
367 done
368 if test -s missing; then
369     cat missing
370     kill $$
371 fi
372 echo "Looks good..."
373
374 : some greps do not return status, grrr.
375 echo "grimblepritz" >contains.txt
376 if grep blurfldyick contains.txt >/dev/null 2>&1 ; then
377     contains=contains
378 elif grep grimblepritz contains.txt >/dev/null 2>&1 ; then
379     contains=grep
380 else
381     contains=contains
382 fi
383 : the following should work in any shell
384 case "$contains" in
385 contains*)
386     echo " "
387     echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
388     cat >contains <<'EOSS'
389 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
390 EOSS
391 chmod +x contains
392 esac
393
394 : see if sh knows # comments
395 echo " "
396 echo "Checking your sh to see if it knows about # comments..."
397 if sh -c '#' >/dev/null 2>&1 ; then
398     echo "Your sh handles # comments correctly."
399     shsharp=true
400     spitshell=cat
401     echo " "
402     echo "Okay, let's see if #! works on this system..."
403     if test -f /bsd43/bin/echo; then
404         echo "#!/bsd43/bin/echo hi" > spit.sh
405     else
406         echo "#!/bin/echo hi" > spit.sh
407     fi
408     $eunicefix spit.sh
409     chmod +x spit.sh
410     ./spit.sh > today
411     if $contains hi today >/dev/null 2>&1; then
412         echo "It does."
413         sharpbang='#!'
414     else
415         echo "#! /bin/echo hi" > spit.sh
416         $eunicefix spit.sh
417         chmod +x spit.sh
418         ./spit.sh > today
419         if test -s today; then
420             echo "It does."
421             sharpbang='#! '
422         else
423             echo "It doesn't."
424             sharpbang=': use '
425         fi
426     fi
427 else
428     echo "Your sh doesn't grok # comments--I will strip them later on."
429     shsharp=false
430     echo "exec grep -v '^#'" >spitshell
431     chmod +x spitshell
432     $eunicefix spitshell
433     spitshell=`pwd`/spitshell
434     echo "I presume that if # doesn't work, #! won't work either!"
435     sharpbang=': use '
436 fi
437
438 : figure out how to guarantee sh startup
439 echo " "
440 echo "Checking out how to guarantee sh startup..."
441 startsh=$sharpbang'/bin/sh'
442 echo "Let's see if '$startsh' works..."
443 cat >start.sh <<EOSS
444 $startsh
445 set abc
446 test "$?abc" != 1
447 EOSS
448
449 chmod +x start.sh
450 $eunicefix start.sh
451 if ./start.sh; then
452     echo "Yup, it does."
453 else
454     echo "Nope.  You may have to fix up the shell scripts to make sure sh runs them."
455 fi
456
457 : first determine how to suppress newline on echo command
458 echo "Checking echo to see how to suppress newlines..."
459 (echo "hi there\c" ; echo " ") >echotmp
460 if $contains c echotmp >/dev/null 2>&1 ; then
461     echo "...using -n."
462     n='-n'
463     c=''
464 else
465     cat <<'EOM'
466 ...using \c
467 EOM
468     n=''
469     c='\c'
470 fi
471 echo $n "Type carriage return to continue.  Your cursor should be here-->$c"
472 read ans
473
474 : now set up to do reads with possible shell escape and default assignment
475 cat <<EOSC >myread
476 case "\$fastread" in
477 yes) ans=''; echo " " ;;
478 *) ans='!';;
479 esac
480 while expr "X\$ans" : "X!" >/dev/null; do
481     read ans
482     case "\$ans" in
483     !)
484         sh
485         echo " "
486         echo $n "\$rp $c"
487         ;;
488     !*)
489         set \`expr "X\$ans" : "X!\(.*\)\$"\`
490         sh -c "\$*"
491         echo " "
492         echo $n "\$rp $c"
493         ;;
494     esac
495 done
496 rp='Your answer:'
497 case "\$ans" in
498 '') ans="\$dflt";;
499 esac
500 EOSC
501
502 : general instructions
503 cat <<EOH
504  
505 This installation shell script will examine your system and ask you questions
506 to determine how the $package package should be installed.  If you get stuck
507 on a question, you may use a ! shell escape to start a subshell or execute
508 a command.  Many of the questions will have default answers in square
509 brackets--typing carriage return will give you the default.
510
511 On some of the questions which ask for file or directory names you are
512 allowed to use the ~name construct to specify the login directory belonging
513 to "name", even if you don't have a shell which knows about that.  Questions
514 where this is allowed will be marked "(~name ok)".
515
516 EOH
517 rp="[Type carriage return to continue]"
518 echo $n "$rp $c"
519 . myread
520 cat <<EOH
521
522 Much effort has been expended to ensure that this shell script will run on any
523 Unix system.  If despite that it blows up on you, your best bet is to edit
524 Configure and run it again. Also, let me (lwall@netlabs.com)
525 know how I blew it.  If you can't run Configure for some reason, you'll have
526 to generate a config.sh file by hand.
527
528 This installation script affects things in two ways: 1) it may do direct
529 variable substitutions on some of the files included in this kit, and
530 2) it builds a config.h file for inclusion in C programs.  You may edit
531 any of these files as the need arises after running this script.
532
533 If you make a mistake on a question, there is no easy way to back up to it
534 currently.  The easiest thing to do is to edit config.sh and rerun all the
535 SH files.  Configure will offer to let you do this before it runs the SH files.
536
537 EOH
538 rp="[Type carriage return to continue]"
539 echo $n "$rp $c"
540 . myread
541
542 : find out where common programs are
543 echo " "
544 echo "Locating common programs..."
545 cat <<EOSC >loc
546 $startsh
547 case \$# in
548 0) exit 1;;
549 esac
550 thing=\$1
551 shift
552 dflt=\$1
553 shift
554 for dir in \$*; do
555     case "\$thing" in
556     .)
557         if test -d \$dir/\$thing; then
558             echo \$dir
559             exit 0
560         fi
561         ;;
562     *)
563         if test -f \$dir/\$thing; then
564             echo \$dir/\$thing
565             exit 0
566         elif test -f \$dir/\$thing.exe; then
567             : on Eunice apparently
568             echo \$dir/\$thing
569             exit 0
570         fi
571         ;;
572     esac
573 done
574 echo \$dflt
575 exit 1
576 EOSC
577 chmod +x loc
578 $eunicefix loc
579 loclist="
580 cat
581 cp
582 echo
583 expr
584 grep
585 mkdir
586 mv
587 rm
588 sed
589 sort
590 tr
591 uniq
592 "
593 trylist="
594 Mcc
595 bison
596 cpp
597 csh
598 egrep
599 nroff
600 test
601 uname
602 yacc
603 "
604 pth=`echo :$boPATH:$PATH:$eoPATH: | sed -e 's/:/ /g'`
605 for file in $loclist; do
606     xxx=`./loc $file $file $pth`
607     eval $file=$xxx
608     eval _$file=$xxx
609     case "$xxx" in
610     /*)
611         echo $file is in $xxx.
612         ;;
613     *)
614         echo "I don't know where $file is.  I hope it's in everyone's PATH."
615         ;;
616     esac
617 done
618 echo " "
619 echo "Don't worry if any of the following aren't found..."
620 ans=offhand
621 for file in $trylist; do
622     xxx=`./loc $file $file $pth`
623     eval $file=$xxx
624     eval _$file=$xxx
625     case "$xxx" in
626     /*)
627         echo $file is in $xxx.
628         ;;
629     *)
630         echo "I don't see $file out there, $ans."
631         ans=either
632         ;;
633     esac
634 done
635 case "$egrep" in
636 egrep)
637     echo "Substituting grep for egrep."
638     egrep=$grep
639     ;;
640 esac
641 case "$test" in
642 test)
643     echo "Hopefully test is built into your sh."
644     ;;
645 /bin/test)
646     if sh -c "PATH= test true" >/dev/null 2>&1; then
647         echo "Using the test built into your sh."
648         test=test
649     fi
650     ;;
651 *)
652     test=test
653     ;;
654 esac
655 case "$echo" in
656 echo)
657     echo "Hopefully echo is built into your sh."
658     ;;
659 /bin/echo)
660     echo " "
661     echo "Checking compatibility between /bin/echo and builtin echo (if any)..."
662     $echo $n "hi there$c" >Loc1.txt
663     echo $n "hi there$c" >Loc2.txt
664     if cmp Loc1.txt Loc2.txt >/dev/null 2>&1; then
665         echo "They are compatible.  In fact, they may be identical."
666     else
667         case "$n" in
668         '-n') n='' c='\c' ans='\c' ;;
669         *) n='-n' c='' ans='-n' ;;
670         esac
671         cat <<FOO
672 They are not compatible!  You are probably running ksh on a non-USG system.
673 I'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
674 have echo built in and we may have to run some Bourne shell scripts.  That
675 means I'll have to use $ans to suppress newlines now.  Life is ridiculous.
676
677 FOO
678         rp="Your cursor should be here-->"
679         $echo $n "$rp$c"
680         . myread
681     fi
682     ;;
683 *)
684     : cross your fingers
685     echo=echo
686     ;;
687 esac
688
689 : set up shell script to do ~ expansion
690 cat >filexp <<EOSS
691 $startsh
692 : expand filename
693 case "\$1" in
694  ~/*|~)
695     echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
696     ;;
697  ~*)
698     if $test -f /bin/csh; then
699         /bin/csh -f -c "glob \$1"
700         echo ""
701     else
702         name=\`$expr x\$1 : '..\([^/]*\)'\`
703         dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
704         if $test ! -d "\$dir"; then
705             me=\`basename \$0\`
706             echo "\$me: can't locate home directory for: \$name" >&2
707             exit 1
708         fi
709         case "\$1" in
710         */*)
711             echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
712             ;;
713         *)
714             echo \$dir
715             ;;
716         esac
717     fi
718     ;;
719 *)
720     echo \$1
721     ;;
722 esac
723 EOSS
724 chmod +x filexp
725 $eunicefix filexp
726
727 : get old answers, if there is a config file out there
728 hint=default
729 if test -f ../config.sh; then
730     echo " "
731     eval "`grep lastuname ../config.sh`"
732     tmp=`(uname -a) 2>&1`
733     if test "X$tmp" = "X$lastuname"; then
734         dflt=y
735     else
736         dflt=n
737     fi
738     lastuname="$tmp"
739     rp="I see a config.sh file.  Did Configure make it on THIS system? [$dflt]"
740     echo $n "$rp $c"
741     . myread
742     case "$ans" in
743     n*) echo "OK, I'll ignore it."; mv ../config.sh ../config.sh.old;;
744     *)  echo "Fetching default answers from your old config.sh file..."
745         tmp="$n"
746         ans="$c"
747         . ../config.sh
748         n="$tmp"
749         c="$ans"
750         hint=previous
751         ;;
752     esac
753 else
754     lastuname=`(uname -a) 2>&1`
755 fi
756 if test -d ../hints && test ! -f ../config.sh; then
757     echo ' '
758     echo "First time through, eh?  I have some defaults handy for the following systems:"
759     (cd ../hints; ls -C *.sh | sed 's/\.sh/   /g')
760     dflt=''
761     : Half the following guesses are probably wrong...
762     test -f /irix && dflt="$dflt sgi"
763     test -f /xenix && dflt="$dflt sco_xenix"
764     test -f /dynix && dflt="$dflt dynix"
765     test -f /dnix && dflt="$dflt dnix"
766     test -f /bin/mips && /bin/mips && dflt="$dflt mips"
767     test -d /NextApps && test -f /usr/adm/software_version && dflt="$dflt next"
768     if test -f /bin/uname || test -f /usr/bin/uname; then
769         set `uname -a | tr '[A-Z]' '[a-z]'`
770
771         test -f "../hints/$5.sh" && dflt="$dflt $5"
772
773         case "$5" in
774         3b2) dflt="$dflt 3b2";;
775         fps*) dflt="$dflt fps";;
776         mips*) dflt="$dflt mips";;
777         [23]100) dflt="$dflt mips";;
778         next*) dflt="$dflt next" ;;
779         esac
780
781         case "$1" in
782         aix) dflt="$dflt aix_rs" ;;
783         sunos) case "$3" in
784             3.4) dflt="$dflt sunos_3_4" ;;
785             3.5) dflt="$dflt sunos_3_5" ;;
786             4.0.1) dflt="$dflt sunos_4_0_1" ;;
787             4.0.2) dflt="$dflt sunos_4_0_2" ;;
788             esac
789             ;;
790         dnix) dflt="$dflt dnix" ;;
791         genix) dflt="$dflt genix" ;;
792         hp*ux) dflt="$dflt hpux" ;;
793         next) dflt="$dflt next" ;;
794         irix) dflt="$dflt sgi" ;;
795         ultrix) case "$3" in
796             3*) dflt="$dflt ultrix_3" ;;
797             4*) dflt="$dflt ultrix_4" ;;
798             esac
799             ;;
800         uts) dflt="$dflt uts" ;;
801         $2) if test -f /etc/systemid; then
802                 set `echo $3 | sed 's/\./ /` $4
803                 if test -f ../hints/sco_$1_$2_$3.sh; then
804                     dflt="$dflt sco_$1_$2_$3"
805                 elif test -f ../hints/sco_$1_$2.sh; then
806                     dflt="$dflt sco_$1_$2"
807                 elif test -f ../hints/sco_$1.sh; then
808                     dflt="$dflt sco_$1"
809                 fi
810             fi
811             ;;
812         esac
813     fi
814     set X `echo $dflt | tr ' ' '\012' | sort | uniq`
815     shift
816     dflt=${1+"$@"}
817     case "$dflt" in
818     '') dflt=none;;
819     esac
820     echo '(You may give one or more space-separated answers, or "none" if appropriate.'
821     echo 'If your OS version has no hints, do not give a wrong version--say "none".)'
822     rp="Which of these apply, if any? [$dflt]"
823     echo $n "$rp $c"
824     . myread
825     for file in $ans; do
826         if test -f ../hints/$file.sh; then
827             . ../hints/$file.sh
828             cat ../hints/$file.sh >>../config.sh
829             hint=recommended
830         fi
831     done
832 fi
833
834 cat >whoa <<'EOF'
835 eval "was=\$$2"
836 dflt=y
837 echo ' '
838 echo "*** WHOA THERE!!! ***"
839 echo "    The $hint value for \$$2 on this machine was \"$was\"!"
840 rp="    Keep the $hint value? [y]"
841 echo $n "$rp $c"
842 . myread
843 case "$ans" in
844 y) td=$was; tu=$was;;
845 esac
846 EOF
847
848 setvar='td=$define; tu=$undef; set X $1; eval "was=\$$2";
849 case "$val$was" in
850 defineundef) . whoa; eval "$2=\$td";;
851 undefdefine) . whoa; eval "$2=\$tu";;
852 *) eval "$2=$val";;
853 esac'
854
855 : determine where manual pages go
856 $cat <<EOM
857   
858 $package has manual pages available in source form.
859 EOM
860 case "$nroff" in
861 '')
862     echo "However, you don't have nroff, so they're probably useless to you."
863     case "$mansrc" in
864     '')
865         mansrc="none"
866         ;;
867     esac
868 esac
869 echo "If you don't want the manual sources installed, answer 'none'."
870 case "$mansrc" in
871 '')
872     dflt=`./loc . none /usr/man/local/man1 /usr/man/man.L /usr/man/manl /usr/man/mann /usr/man/u_man/man1 /usr/man/man1`
873     ;;
874 *)  dflt="$mansrc"
875     ;;
876 esac
877 cont=true
878 while $test "$cont" ; do
879     echo " "
880     rp="Where do the manual pages (source) go (~name ok)? [$dflt]"
881     $echo $n "$rp $c"
882     . myread
883     case "$ans" in
884     'none')
885         mansrc=''
886         cont=''
887         ;;
888     *)
889         mansrc=`./filexp "$ans"`
890         if $test -d "$mansrc"; then
891             cont=''
892         else
893             if $test "$fastread" = yes; then
894                 dflt=y
895             else
896                 dflt=n
897             fi
898             rp="Directory $mansrc doesn't exist.  Use that name anyway? [$dflt]"
899             $echo $n "$rp $c"
900             . myread
901             dflt=''
902             case "$ans" in
903             y*) cont='';;
904             esac
905         fi
906         ;;
907     esac
908 done
909 case "$mansrc" in
910 '')
911     manext=''
912     ;;
913 *l)
914     manext=l
915     ;;
916 *n)
917     manext=n
918     ;;
919 *o)
920     manext=l
921     ;;
922 *p)
923     manext=n
924     ;;
925 *C)
926     manext=C
927     ;;
928 *L)
929     manext=L
930     ;;
931 *)
932     manext=1
933     ;;
934 esac
935
936 : Sigh.  Well, at least the box is fast...
937 echo " "
938 $echo $n "Hmm...  $c"
939 case "$usrinclude" in
940 '') dflt='/usr/include';;
941 *) dflt=$usrinclude;;
942 esac
943 inclPath=''
944 if $test -f /bin/mips && /bin/mips; then
945     echo "Looks like a MIPS system..."
946     $cat >usrinclude.c <<'EOCP'
947 #ifdef SYSTYPE_BSD43
948 /bsd43
949 #endif
950 EOCP
951     if cc -E usrinclude.c > usrinclude.out && $contains / usrinclude.out >/dev/null 2>&1 ; then
952         echo "and you're compiling with the BSD43 compiler and libraries."
953         dflt='/bsd43/usr/include'
954         inclPath='/bsd43'
955     else
956         echo "and you're compiling with the SysV compiler and libraries."
957     fi
958 else
959     echo "Doesn't look like a MIPS system."
960     echo "exit 1" >mips
961     chmod +x mips
962     $eunicefix mips
963 fi
964
965 cont=true
966 while $test "$cont" ; do
967     echo " "
968     rp="Where are the include files you want to use? [$dflt]"
969     $echo $n "$rp $c"
970     . myread
971     usrinclude="$ans"
972     if $test -d $ans; then
973         cont=''
974     else
975         if $test "$fastread" = yes; then
976             dflt=y
977         else
978             dflt=n
979         fi
980         rp="Directory $ans doesn't exist.  Use that name anyway? [$dflt]"
981         $echo $n "$rp $c"
982         . myread
983         dflt=''
984         case "$ans" in
985         y*) cont='';;
986         esac
987     fi
988 done
989
990 : make some quick guesses about what we are up against
991 echo " "
992 cat $usrinclude/signal.h $usrinclude/sys/signal.h >guess.txt 2>/dev/null
993 if test "$usrinclude" = "/bsd43/usr/include" ; then
994     echo "Looks kind of like a SysV MIPS running BSD, but we'll see..."
995     echo exit 0 >bsd
996     echo exit 1 >usg
997     echo exit 1 >v7
998 elif test `echo abc | tr a-z A-Z` = Abc ; then
999     echo "Looks kind of like a USG system, but we'll see..."
1000     echo exit 1 >bsd
1001     echo exit 0 >usg
1002     echo exit 1 >v7
1003 elif $contains SIGTSTP guess.txt >/dev/null 2>&1 ; then
1004     echo "Looks kind of like a BSD system, but we'll see..."
1005     echo exit 0 >bsd
1006     echo exit 1 >usg
1007     echo exit 1 >v7
1008 else
1009     echo "Looks kind of like a version 7 system, but we'll see..."
1010     echo exit 1 >bsd
1011     echo exit 1 >usg
1012     echo exit 0 >v7
1013 fi
1014 case "$eunicefix" in
1015 *unixtovms*)
1016     cat <<'EOI'
1017 There is, however, a strange, musty smell in the air that reminds me of
1018 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
1019 EOI
1020     echo "exit 0" >eunice
1021     d_eunice="$define"
1022     ;;
1023 *)
1024     echo " "
1025     echo "Congratulations.  You aren't running Eunice."
1026     d_eunice="$undef"
1027     echo "exit 1" >eunice
1028     ;;
1029 esac
1030 if test -f /xenix; then
1031     echo "Actually, this looks more like a XENIX system..."
1032     echo "exit 0" >xenix
1033 else
1034     echo " "
1035     echo "It's not Xenix..."
1036     echo "exit 1" >xenix
1037 fi
1038 chmod +x xenix
1039 $eunicefix xenix
1040 if test -f /venix; then
1041     echo "Actually, this looks more like a VENIX system..."
1042     echo "exit 0" >venix
1043 else
1044     echo " "
1045     if xenix; then
1046         : null
1047     else
1048         echo "Nor is it Venix..."
1049     fi
1050     echo "exit 1" >venix
1051 fi
1052 chmod +x bsd usg v7 eunice venix
1053 $eunicefix bsd usg v7 eunice venix
1054
1055 : see what memory models we can support
1056 case "$models" in
1057 '')
1058     : We may not use Cppsym or we get a circular dependency through cc.
1059     : But this should work regardless of which cc we eventually use.
1060     cat >pdp11.c <<'EOP'
1061 main() {
1062 #ifdef pdp11
1063     exit(0);
1064 #else
1065     exit(1);
1066 #endif
1067 }
1068 EOP
1069     cc -o pdp11 pdp11.c >/dev/null 2>&1
1070     if pdp11 2>/dev/null; then
1071         dflt='unsplit split'
1072     else
1073         ans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
1074         case "$ans" in
1075         X) dflt='none';;
1076         *)  if $test -d /lib/small || $test -d /usr/lib/small; then
1077                 dflt='small'
1078             else
1079                 dflt=''
1080             fi
1081             if $test -d /lib/medium || $test -d /usr/lib/medium; then
1082                 dflt="$dflt medium"
1083             fi
1084             if $test -d /lib/large || $test -d /usr/lib/large; then
1085                 dflt="$dflt large"
1086             fi
1087             if $test -d /lib/huge || $test -d /usr/lib/huge; then
1088                 dflt="$dflt huge"
1089             fi
1090         esac
1091     fi
1092     ;;
1093 *)  dflt="$models" ;;
1094 esac
1095 $cat <<EOM
1096  
1097 Some systems have different model sizes.  On most systems they are called
1098 small, medium, large, and huge.  On the PDP11 they are called unsplit and
1099 split.  If your system doesn't support different memory models, say "none".
1100 If you wish to force everything to one memory model, say "none" here and
1101 put the appropriate flags later when it asks you for other cc and ld flags.
1102 Venix systems may wish to put "none" and let the compiler figure things out.
1103 (In the following question multiple model names should be space separated.)
1104
1105 EOM
1106 rp="Which models are supported? [$dflt]"
1107 $echo $n "$rp $c"
1108 . myread
1109 models="$ans"
1110
1111 case "$models" in
1112 none)
1113     small=''
1114     medium=''
1115     large=''
1116     huge=''
1117     unsplit=''
1118     split=''
1119     ;;
1120 *split)
1121     case "$split" in
1122     '') 
1123         if $contains '\-i' $mansrc/man1/ld.1 >/dev/null 2>&1 || \
1124            $contains '\-i' $mansrc/man1/cc.1 >/dev/null 2>&1; then
1125             dflt='-i'
1126         else
1127             dflt='none'
1128         fi
1129         ;;
1130     *) dflt="$split";;
1131     esac
1132     rp="What flag indicates separate I and D space? [$dflt]"
1133     $echo $n "$rp $c"
1134     . myread
1135     case "$ans" in
1136     none) ans='';;
1137     esac
1138     split="$ans"
1139     unsplit=''
1140     ;;
1141 *large*|*small*|*medium*|*huge*)
1142     case "$models" in
1143     *large*)
1144         case "$large" in
1145         '') dflt='-Ml';;
1146         *) dflt="$large";;
1147         esac
1148         rp="What flag indicates large model? [$dflt]"
1149         $echo $n "$rp $c"
1150         . myread
1151         case "$ans" in
1152         none) ans='';
1153         esac
1154         large="$ans"
1155         ;;
1156     *) large='';;
1157     esac
1158     case "$models" in
1159     *huge*)
1160         case "$huge" in
1161         '') dflt='-Mh';;
1162         *) dflt="$huge";;
1163         esac
1164         rp="What flag indicates huge model? [$dflt]"
1165         $echo $n "$rp $c"
1166         . myread
1167         case "$ans" in
1168         none) ans='';
1169         esac
1170         huge="$ans"
1171         ;;
1172     *) huge="$large";;
1173     esac
1174     case "$models" in
1175     *medium*)
1176         case "$medium" in
1177         '') dflt='-Mm';;
1178         *) dflt="$medium";;
1179         esac
1180         rp="What flag indicates medium model? [$dflt]"
1181         $echo $n "$rp $c"
1182         . myread
1183         case "$ans" in
1184         none) ans='';
1185         esac
1186         medium="$ans"
1187         ;;
1188     *) medium="$large";;
1189     esac
1190     case "$models" in
1191     *small*)
1192         case "$small" in
1193         '') dflt='none';;
1194         *) dflt="$small";;
1195         esac
1196         rp="What flag indicates small model? [$dflt]"
1197         $echo $n "$rp $c"
1198         . myread
1199         case "$ans" in
1200         none) ans='';
1201         esac
1202         small="$ans"
1203         ;;
1204     *) small='';;
1205     esac
1206     ;;
1207 *)
1208     echo "Unrecognized memory models--you may have to edit Makefile.SH"
1209     ;;
1210 esac
1211
1212 : see if we need a special compiler
1213 echo " "
1214 if usg; then
1215     case "$cc" in
1216     '')
1217         case "$Mcc" in
1218         /*) dflt='Mcc'
1219             ;;
1220         *)
1221             case "$large" in
1222             -M*)
1223                 dflt='cc'
1224                 ;;
1225             *)
1226                 if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then
1227                     dflt='cc -M'
1228                 else
1229                     dflt='cc'
1230                 fi
1231                 ;;
1232             esac
1233             ;;
1234         esac
1235         ;;
1236     *)  dflt="$cc";;
1237     esac
1238     $cat <<'EOM'
1239   
1240 On some systems the default C compiler will not resolve multiple global
1241 references that happen to have the same name.  On some such systems the
1242 "Mcc" command may be used to force these to be resolved.  On other systems
1243 a "cc -M" command is required.  (Note that the -M flag on other systems
1244 indicates a memory model to use!)  If you have the Gnu C compiler, you
1245 might wish to use that instead.  What command will force resolution on
1246 EOM
1247     $echo $n "this system? [$dflt] $c"
1248     rp="Command to resolve multiple refs? [$dflt]"
1249     . myread
1250     cc="$ans"
1251 else
1252     case "$cc" in
1253     '') dflt=cc;;
1254     *) dflt="$cc";;
1255     esac
1256     rp="Use which C compiler? [$dflt]"
1257     $echo $n "$rp $c"
1258     . myread
1259     cc="$ans"
1260 fi
1261 case "$cc" in
1262 gcc*) cpp=`./loc gcc-cpp $cpp $pth`
1263     case "$nativegcc" in
1264     '') case "$ccflags" in
1265         *-fpcc-struct-return*) dflt=n;;
1266         *) dflt=y;;
1267         esac
1268         ;;
1269     undef) dflt=n;;
1270     *) dflt=y;;
1271     esac
1272     echo " "
1273     rp="Are your system (especially dbm) libraries compiled with gcc? [$dflt]"
1274     $echo $n "$rp $c"
1275     . myread
1276     case "$ans" in
1277     n*) nativegcc="$undef"; gccflags='-fpcc-struct-return';;
1278     *) nativegcc="$define"; gccflags='';;
1279     esac
1280     case "$gccflags" in
1281     *-ansi*) ;;
1282     *-traditional*) ;;
1283     *) gccflags="$gccflags -traditional -Dvolatile=__volatile__" ;;
1284     esac
1285     ;;
1286 esac
1287
1288 : determine optimize, if desired, or use for debug flag also
1289 case "$optimize" in
1290 ' ') dflt="none"
1291      ;;
1292 '') dflt="-O";
1293     ;;
1294 *)  dflt="$optimize"
1295     ;;
1296 esac
1297 cat <<EOH
1298
1299 Some C compilers have problems with their optimizers, by default, $package
1300 compiles with the -O flag to use the optimizer.  Alternately, you might
1301 want to use the symbolic debugger, which uses the -g flag (on traditional
1302 Unix systems).  Either flag can be specified here.  To use neither flag,
1303 specify the word "none".
1304   
1305 EOH
1306 rp="What optimizer/debugger flag should be used? [$dflt]"
1307 $echo $n "$rp $c"
1308 . myread
1309 optimize="$ans"
1310 case "$optimize" in
1311 'none') optimize=" "
1312      ;;
1313 esac
1314
1315 case "$ccflags" in
1316 '') case "$cc" in
1317     *gcc*) dflt="$gccflags";;
1318     *) dflt='';;
1319     esac
1320     ;;
1321 *-fpcc-struct-return*) dflt="$ccflags";;
1322 *) case "$cc" in
1323     *gcc*) dflt="$ccflags $gccflags";;
1324     *) dflt="$ccflags";;
1325     esac
1326     ;;
1327 esac
1328 for thisincl in $inclwanted; do
1329     if test -d $thisincl; then
1330         if test "x$thisincl" != "x$usrinclude"; then
1331             case "$dflt" in
1332             *$thisincl*);;
1333             *) dflt="$dflt -I$thisincl";;
1334             esac
1335         fi
1336     fi
1337 done
1338 case "$optimize" in
1339 -g*)
1340     case "$dflt" in
1341     *DEBUGGING*);;
1342     *) dflt="$dflt -DDEBUGGING";;
1343     esac
1344     ;;
1345 esac
1346 if $contains 'LANGUAGE_C' $usrinclude/signal.h >/dev/null 2>&1; then
1347     case "$dflt" in
1348     *LANGUAGE_C*);;
1349     *) dflt="$dflt -DLANGUAGE_C";;
1350     esac
1351 fi
1352 if $contains '_NO_PROTO' $usrinclude/signal.h >/dev/null 2>&1; then
1353     case "$dflt" in
1354     *_NO_PROTO*);;
1355     *) dflt="$dflt -D_NO_PROTO";;
1356     esac
1357 fi
1358 case "$dflt" in
1359 '') dflt=none;;
1360 esac
1361 cat <<EOH
1362
1363 Your C compiler may want other flags.  For this question you should
1364 include -I/whatever and -DWHATEVER flags and any other flags used by
1365 the C compiler, but you should NOT include libraries or ld flags like
1366 -lwhatever.  To use no flags, specify the word "none".
1367   
1368 EOH
1369 rp="Any additional cc flags? [$dflt]"
1370 $echo $n "$rp $c"
1371 . myread
1372 case "$ans" in
1373 none) ans='';
1374 esac
1375 ccflags="$ans"
1376
1377 : the following weeds options from ccflags that are of no interest to cpp
1378 cppflags="$ccflags"
1379 case "$cc" in
1380 *gcc*) cppflags="$cppflags -D__GNUC__";;
1381 esac
1382 case "$cppflags" in
1383 '');;
1384 *)  set X $cppflags
1385     cppflags=''
1386     for flag do
1387         case $flag in
1388         -D*|-U*|-I*|-traditional|-ansi|-nostdinc) cppflags="$cppflags $flag";;
1389         esac
1390     done
1391     case "$cppflags" in
1392     *-*)  echo "(C preprocessor flags: $cppflags)";;
1393     esac
1394     ;;
1395 esac
1396
1397 case "$ldflags" in
1398 '') if venix; then
1399         dflt='-i -z'
1400     else
1401         dflt='none'
1402     fi
1403     ;;
1404 *) dflt="$ldflags";;
1405 esac
1406 echo " "
1407 rp="Any additional ld flags (NOT including libraries)? [$dflt]"
1408 $echo $n "$rp $c"
1409 . myread
1410 case "$ans" in
1411 none) ans='';
1412 esac
1413 ldflags="$ans"
1414
1415 echo " "
1416 echo "Checking for optional libraries..."
1417 case "$libs" in
1418 '') dflt=' ';;
1419 *) dflt="$libs ";;
1420 esac
1421 case "$libswanted" in
1422 '') libswanted='c_s';;
1423 esac
1424 for thislib in $libswanted; do
1425     case "$thislib" in
1426     dbm) thatlib=ndbm;;
1427     *_s) thatlib=NONE;;
1428     *) thatlib="${thislib}_s";;
1429     *) thatlib=NONE;;
1430     esac
1431     xxx=`./loc lib$thislib.a X /usr/ccs/lib /usr/lib /usr/ucblib /usr/local/lib /lib`
1432     if test -f $xxx; then
1433         echo "Found -l$thislib."
1434         case "$dflt" in
1435         *"-l$thislib "*|*"-l$thatlib "*);;
1436         *) dflt="$dflt -l$thislib ";;
1437         esac
1438     else
1439         xxx=`./loc lib$thislib.a X $libpth`
1440         if test -f $xxx; then
1441             echo "Found $xxx."
1442             case "$dflt" in
1443             *"$xxx "*);;
1444             *) dflt="$dflt $xxx ";;
1445             esac
1446         else
1447             xxx=`./loc Slib$thislib.a X $xlibpth`
1448             if test -f $xxx; then
1449                 echo "Found -l$thislib."
1450                 case "$dflt" in
1451                 *"-l$thislib "*|*"-l$thatlib "*);;
1452                 *) dflt="$dflt -l$thislib ";;
1453                 esac
1454             else
1455                 xxx=`./loc lib$thislib.so X /usr/ccs/lib /usr/lib /usr/ucblib /usr/local/lib /lib`
1456                 if test -f $xxx; then
1457                     echo "Found -l$thislib as a shared object only."
1458                     case "$dflt" in
1459                     *"-l$thislib "*|*"-l$thatlib "*);;
1460                     *) dflt="$dflt -l$thislib ";;
1461                     esac
1462                 else
1463                     echo "No -l$thislib."
1464                 fi
1465             fi
1466         fi
1467     fi
1468 done
1469 set X $dflt
1470 shift
1471 dflt="$*"
1472 case "$dflt" in
1473 '') dflt='none';;
1474 esac
1475
1476 $cat <<EOM
1477  
1478 Some versions of Unix support shared libraries, which make
1479 executables smaller but make load time slightly longer.
1480
1481 On some systems, mostly newer Unix System V's, the shared library
1482 is included by putting the option "-lc_s" as the last thing on the
1483 cc command line when linking.  Other systems use shared libraries
1484 by default.  There may be other libraries needed to compile $package
1485 on your machine as well.  If your system needs the "-lc_s" option,
1486 include it here.  Include any other special libraries here as well.
1487 Say "none" for none.
1488 EOM
1489
1490 echo " "
1491 rp="Any additional libraries? [$dflt]"
1492 $echo $n "$rp $c"
1493 . myread
1494 case "$ans" in
1495 none) ans='';
1496 esac
1497 libs="$ans"
1498
1499 : check for size of random number generator
1500 echo " "
1501 case "$alignbytes" in
1502 '')
1503     echo "Checking alignment constraints..."
1504     $cat >try.c <<'EOCP'
1505 struct foobar {
1506     char foo;
1507     double bar;
1508 } try;
1509 main()
1510 {
1511     printf("%d\n", (char*)&try.bar - (char*)&try.foo);
1512 }
1513 EOCP
1514     if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
1515         dflt=`./try`
1516     else
1517         dflt='?'
1518         echo "(I can't seem to compile the test program...)"
1519     fi
1520     ;;
1521 *)
1522     dflt="$alignbytes"
1523     ;;
1524 esac
1525 rp="Doubles must be aligned on a how-many-byte boundary? [$dflt]"
1526 $echo $n "$rp $c"
1527 . myread
1528 alignbytes="$ans"
1529 $rm -f try.c try
1530
1531 : determine where public executables go
1532 cat <<EOF
1533  
1534 The following questions distinguish the directory in which executables
1535 reside from the directory in which they are installed (and from which they
1536 are presumably copied to the former directory by occult means).  This
1537 distinction is often necessary under afs.  On most other systems, however,
1538 the two directories are the same.
1539  
1540 EOF
1541 case "$bin" in
1542 '')
1543     dflt=`./loc . /usr/local/bin /usr/local/bin /usr/lbin /usr/local /usr/bin /bin`
1544     ;;
1545 *)  dflt="$bin"
1546     ;;
1547 esac
1548 cont=true
1549 while $test "$cont" ; do
1550     rp="In which directory will public executables reside (~name ok)? [$dflt]"
1551     $echo "In which directory will public executables reside (~name ok)?"
1552     $echo $n "[$dflt] $c"
1553     . myread
1554     bin="$ans"
1555     bin=`./filexp $bin`
1556     if test -d $bin; then
1557         cont=''
1558     else
1559         case "$fastread" in
1560         yes) dflt=y;;
1561         *) dflt=n;;
1562         esac
1563         rp="Directory $bin doesn't exist.  Use that name anyway? [$dflt]"
1564         $echo $n "$rp $c"
1565         . myread
1566         dflt=''
1567         case "$ans" in
1568         y*) cont='';;
1569         esac
1570     fi
1571 done
1572
1573 case "$installbin" in
1574 '')
1575     dflt=`echo $bin | sed 's#^/afs/#/afs/.#'`
1576     test -d $dflt || dflt="$bin"
1577     ;;
1578 *)  dflt="$installbin"
1579     ;;
1580 esac
1581 cont=true
1582 while $test "$cont" ; do
1583     rp="In which directory will public executables be installed (~name ok)? [$dflt]"
1584     $echo "In which directory will public executables be installed (~name ok)?"
1585     $echo $n "[$dflt] $c"
1586     . myread
1587     installbin="$ans"
1588     installbin=`./filexp $installbin`
1589     if test -d $installbin; then
1590         cont=''
1591     else
1592         case "$fastread" in
1593         yes) dflt=y;;
1594         *) dflt=n;;
1595         esac
1596         rp="Directory $installbin doesn't exist.  Use that name anyway? [$dflt]"
1597         $echo $n "$rp $c"
1598         . myread
1599         dflt=''
1600         case "$ans" in
1601         y*) cont='';;
1602         esac
1603     fi
1604 done
1605
1606 : check for ordering of bytes in a long
1607 case "$byteorder" in
1608 '')
1609 cat <<'EOM'
1610   
1611 In the following, larger digits indicate more significance.  A big-endian
1612 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321.  A
1613 little-endian machine like a Vax or an Intel 80?86 chip would be 1234.  Other
1614 machines may have weird orders like 3412.  A Cray will report 87654321.  If
1615 the test program works the default is probably right.
1616 I'm now running the test program...
1617 EOM
1618     $cat >byteorder.c <<'EOCP'
1619 #include <stdio.h>
1620 main()
1621 {
1622     int i;
1623     union {
1624         unsigned long l;
1625         char c[sizeof(long)];
1626     } u;
1627
1628     if (sizeof(long) > 4)
1629         u.l = (0x08070605 << 32) | 0x04030201;
1630     else
1631         u.l = 0x04030201;
1632     for (i=0; i < sizeof(long); i++)
1633         printf("%c",u.c[i]+'0');
1634     printf("\n");
1635 }
1636 EOCP
1637     if $cc byteorder.c -o byteorder >/dev/null 2>&1 ; then
1638         dflt=`./byteorder`
1639         case "$dflt" in
1640         ????|????????) echo "(The test program ran ok.)";;
1641         *) echo "(The test program didn't run right for some reason.)";;
1642         esac
1643     else
1644         dflt='4321'
1645         echo "(I can't seem to compile the test program.  Guessing big-endian...)"
1646     fi
1647     ;;
1648 *)
1649     echo " "
1650     dflt="$byteorder"
1651     ;;
1652 esac
1653 rp="What is the order of bytes in a long? [$dflt]"
1654 $echo $n "$rp $c"
1655 . myread
1656 byteorder="$ans"
1657
1658 : check for ability to cast negative floats to unsigned
1659 echo " "
1660 echo 'Checking to see if your C compiler can cast weird floats to unsigned'
1661 $cat >try.c <<'EOCP'
1662 #include <signal.h>
1663
1664 blech() { exit(3); }
1665
1666 main()
1667 {
1668         double f = -123;
1669         unsigned long along;
1670         unsigned int aint;
1671         unsigned short ashort;
1672         int result = 0;
1673
1674         signal(SIGFPE, blech);
1675         along = (unsigned long)f;
1676         aint = (unsigned int)f;
1677         ashort = (unsigned short)f;
1678         if (along != (unsigned long)-123)
1679             result |= 1;
1680         if (aint != (unsigned int)-123)
1681             result |= 1;
1682         if (ashort != (unsigned short)-123)
1683             result |= 1;
1684         f = (double)0x40000000;
1685         f = f + f;
1686         along = 0;
1687         along = (unsigned long)f;
1688         if (along != 0x80000000)
1689             result |= 2;
1690         f -= 1;
1691         along = 0;
1692         along = (unsigned long)f;
1693         if (along != 0x7fffffff)
1694             result |= 1;
1695         f += 2;
1696         along = 0;
1697         along = (unsigned long)f;
1698         if (along != 0x80000001)
1699             result |= 2;
1700         exit(result);
1701 }
1702 EOCP
1703 if $cc -o try $ccflags try.c >/dev/null 2>&1; then
1704     ./try
1705     castflags=$?
1706 else
1707     castflags=3
1708 fi
1709 case "$castflags" in
1710 0)  val="$define"
1711     echo "Yup, it does."
1712     ;;
1713 *)  val="$undef"
1714     echo "Nope, it doesn't."
1715     ;;
1716 esac
1717 set d_castneg
1718 eval $setvar
1719 $rm -f try.*
1720
1721 : see how we invoke the C preprocessor
1722 echo " "
1723 echo "Now, how can we feed standard input to your C preprocessor..."
1724 cat <<'EOT' >testcpp.c
1725 #define ABC abc
1726 #define XYZ xyz
1727 ABC.XYZ
1728 EOT
1729
1730 cd ..
1731 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
1732 chmod 755 cppstdin
1733 wrapper=cppstdin
1734
1735 case "$cppstdin" in
1736 /*cppstdin) cppstdin=cppstdin;;
1737 esac
1738 cp cppstdin UU
1739 cd UU
1740
1741 if test "X$cppstdin" != "X" && \
1742   $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
1743   $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1744     echo "You used to use $cppstdin $cppminus so we'll use that again."
1745 elif test "$cc" = gcc && \
1746   (echo "Using gcc, eh?  We'll try to force gcc -E using a wrapper..."; \
1747   $wrapper <testcpp.c >testcpp.out 2>&1; \
1748   $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1) ; then
1749     echo "Yup, we can."
1750     cppstdin="$wrapper"
1751     cppminus='';
1752 elif echo 'Maybe "'"$cc"' -E" will work...'; \
1753   $cc -E <testcpp.c >testcpp.out 2>&1; \
1754   $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1755     echo "Yup, it does."
1756     cppstdin="$cc -E"
1757     cppminus='';
1758 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
1759   $cc -E - <testcpp.c >testcpp.out 2>&1; \
1760   $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1761     echo "Yup, it does."
1762     cppstdin="$cc -E"
1763     cppminus='-';
1764 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
1765   $cpp <testcpp.c >testcpp.out 2>&1; \
1766   $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1767     echo "It works!"
1768     cppstdin="$cpp"
1769     cppminus='';
1770 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
1771   $cpp - <testcpp.c >testcpp.out 2>&1; \
1772   $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1773     echo "Hooray, it works!  I was beginning to wonder."
1774     cppstdin="$cpp"
1775     cppminus='-';
1776 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
1777   $wrapper <testcpp.c >testcpp.out 2>&1; \
1778   $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1779     cppstdin="$wrapper"
1780     cppminus=''
1781     echo "Eureka!."
1782 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
1783   $cc -P <testcpp.c >testcpp.out 2>&1; \
1784   $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1785     echo "Yipee, that works!"
1786     cppstdin="$cc -P"
1787     cppminus='';
1788 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
1789   $cc -P - <testcpp.c >testcpp.out 2>&1; \
1790   $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1791     echo "At long last!"
1792     cppstdin="$cc -P"
1793     cppminus='-';
1794 else
1795     dflt=blurfl
1796     $echo $n "No dice.  I can't find a C preprocessor.  Name one: $c"
1797     rp='Name a C preprocessor:'
1798     . myread
1799     cppstdin="$ans"
1800     $cppstdin <testcpp.c >testcpp.out 2>&1
1801     if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1802         echo "OK, that will do."
1803     else
1804         echo "Sorry, I can't get that to work.  Go find one and rerun Configure."
1805         exit 1
1806     fi
1807 fi
1808
1809 : get list of predefined functions in a handy place
1810 echo " "
1811 case "$libc" in
1812 '') libc=unknown;;
1813 esac
1814 case "$nm_opts" in
1815 '') if test -f /mach_boot; then
1816         nm_opts=''
1817     elif test -d /usr/ccs/lib; then
1818         nm_opts='-p'
1819     else
1820         nm_opts=''
1821     fi
1822     ;;
1823 esac
1824 : on mips, we DO NOT want /lib, and we want inclPath/usr/lib
1825 case "$libpth" in
1826 '') if mips; then
1827         libpth='$inclPath/usr/lib /usr/local/lib'
1828         nm_opts="-B"
1829     else
1830         libpth='/usr/ccs/lib /lib /usr/lib /usr/ucblib /usr/local/lib'
1831     fi
1832     ;;
1833 esac
1834 case "$libs" in
1835 *-lc_s*) libc=`./loc libc_s.a $libc $libpth`
1836 esac
1837 libnames='';
1838 case "$libs" in
1839 '') ;;
1840 *)  for thislib in $libs; do
1841         case "$thislib" in
1842         -l*) thislib=`expr X$thislib : 'X-l\(.*\)'`
1843             try=`./loc lib$thislib.a blurfl/dyick $libpth`
1844             if test ! -f $try; then
1845                 try=`./loc lib$thislib blurfl/dyick $libpth`
1846                 if test ! -f $try; then
1847                     try=`./loc $thislib blurfl/dyick $libpth`
1848                     if test ! -f $try; then
1849                         try=`./loc Slib$thislib.a blurfl/dyick $xlibpth`
1850                         if test ! -f $try; then
1851                             try=''
1852                         fi
1853                     fi
1854                 fi
1855             fi
1856             libnames="$libnames $try"
1857             ;;
1858         *) libnames="$libnames $thislib" ;;
1859         esac
1860     done
1861     ;;
1862 esac
1863 set /usr/ccs/lib/libc.so
1864 test -f $1 || set /usr/lib/libc.so
1865 test -f $1 || set /usr/lib/libc.so.[0-9]*
1866 test -f $1 || set /lib/libsys_s.a
1867 eval set \$$#
1868 if test -f "$1"; then
1869     echo "Your (shared) C library seems to be in $1."
1870     libc="$1"
1871 elif test -f "$libc"; then
1872     echo "Your C library seems to be in $libc."
1873 elif test -f /lib/libc.a; then
1874     echo "Your C library seems to be in /lib/libc.a.  You're normal."
1875     libc=/lib/libc.a
1876 else
1877     if   ans=`./loc libc.a  blurfl/dyick $libpth`; test -f "$ans"; then
1878         :
1879     elif ans=`./loc libc    blurfl/dyick $libpth`; test -f "$ans"; then
1880             libnames="$libnames "`./loc clib blurfl/dyick $libpth`
1881     elif ans=`./loc clib    blurfl/dyick $libpth`; test -f "$ans"; then
1882         :
1883     elif ans=`./loc Slibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then
1884         :
1885     elif ans=`./loc Mlibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then
1886         :
1887     elif ans=`./loc Llibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then
1888         :
1889     fi
1890     if test -f "$ans"; then
1891         echo "Your C library seems to be in $ans, of all places."
1892         libc=$ans
1893     else
1894         cat <<EOM
1895  
1896 I can't seem to find your C library.  I've looked in the following places:
1897
1898         $libpth
1899
1900 None of these seems to contain your C library.  What is the full name
1901 EOM
1902         dflt=None
1903         $echo $n "of your C library? $c"
1904         rp='C library full name?'
1905         . myread
1906         libc="$ans"
1907     fi
1908 fi
1909 echo " "
1910 if test $libc = "/lib/libc"; then
1911     libc="$libc /lib/clib"
1912 fi
1913 cat <<END
1914  
1915 If the guess above is wrong (which it might be if you're using a strange
1916 compiler, or your machine supports multiple models), you can override it here.
1917 END
1918 dflt="$libc";
1919 rp="Your C library is where? [$dflt]"
1920 $echo $n "$rp $c"
1921 . myread
1922 libc="$ans"
1923 echo " "
1924 echo $libc $libnames | tr ' ' '\012' | sort | uniq >libnames
1925 $echo "Extracting names from the following files for later perusal:"
1926 sed 's/^/       /' libnames
1927 echo $n "This may take a while...$c"
1928 set X `cat libnames`
1929 shift
1930 nm $nm_opts $* 2>/dev/null >libc.tmp
1931 $sed -n -e 's/^.* [ATDS]  *[_.]*//p' -e 's/^.* [ATDS] //p' <libc.tmp >libc.list
1932 if $contains '^printf$' libc.list >/dev/null 2>&1; then
1933     echo done
1934 elif $sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p' \
1935         <libc.tmp >libc.list; \
1936   $contains '^printf$' libc.list >/dev/null 2>&1; then
1937     echo done
1938 elif $sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p' <libc.tmp >libc.list; \
1939   $contains '^printf$' libc.list >/dev/null 2>&1; then
1940     echo done
1941 elif $sed -n -e 's/^.* D __*//p' -e 's/^.* D //p' <libc.tmp >libc.list; \
1942   $contains '^printf$' libc.list >/dev/null 2>&1; then
1943     echo done
1944 elif $sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p' \
1945                 <libc.tmp >libc.list; \
1946   $contains '^printf$' libc.list >/dev/null 2>&1; then
1947     echo done
1948 elif $grep '|' <libc.tmp | $sed -n -e '/|COMMON/d' -e '/|DATA/d' -e '/ file/d' \
1949                                    -e 's/^\([^     ]*\).*/\1/p' >libc.list
1950   $contains '^printf$' libc.list >/dev/null 2>&1; then
1951     echo done
1952 elif $sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p' \
1953            <libc.tmp >libc.list; \
1954   $contains '^printf$' libc.list >/dev/null 2>&1; then
1955     echo done
1956 else
1957     nm -p $* 2>/dev/null >libc.tmp
1958     $sed -n -e 's/^.* [AT]  *_[_.]*//p' -e 's/^.* [AT] //p' <libc.tmp >libc.list
1959     if $contains '^printf$' libc.list >/dev/null 2>&1; then
1960         nm_opts='-p'
1961         echo "done"
1962     else
1963         echo " "
1964         echo "nm didn't seem to work right."
1965         echo "Trying ar instead..."
1966         if ar t $libc > libc.tmp; then
1967             for thisname in $libnames; do
1968                 ar t $thisname >>libc.tmp
1969             done
1970             $sed -e 's/\.o$//' < libc.tmp > libc.list
1971             echo "Ok."
1972         else
1973             echo "ar didn't seem to work right."
1974             echo "Maybe this is a Cray...trying bld instead..."
1975             if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
1976                 for thisname in $libnames; do
1977                     bld t $libnames | \
1978                         $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
1979                     ar t $thisname >>libc.tmp
1980                 done
1981                 echo "Ok."
1982             else
1983                 echo "That didn't work either.  Giving up."
1984                 exit 1
1985             fi
1986         fi
1987     fi
1988 fi
1989 if test -f /lib/syscalls.exp; then
1990     echo "Also extracting names from /lib/syscalls.exp for good ole AIX..."
1991     sed -n 's/^\([^     ]*\)[   ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list
1992 fi
1993
1994 inlibc='echo " "; td=$define; tu=$undef;
1995 if $contains "^$1\$" libc.list >/dev/null 2>&1;
1996 then echo "$1() found";
1997   eval "case \"\$$2\" in undef) . whoa; esac"; eval "$2=\$td";
1998 else echo "$1() not found";
1999   eval "case \"\$$2\" in define) . whoa; esac"; eval "$2=\$tu"; fi'
2000
2001 : see if bcmp exists
2002 set bcmp d_bcmp
2003 eval $inlibc
2004
2005 : see if bcopy exists
2006 set bcopy d_bcopy
2007 eval $inlibc
2008
2009 : see if bzero exists
2010 set bzero d_bzero
2011 eval $inlibc
2012
2013 : see if sprintf is declared as int or pointer to char
2014 echo " "
2015 cat >ucbsprf.c <<'EOF'
2016 #include <stdio.h>
2017 main()
2018 {
2019     int sprintf();
2020     char buf[10];
2021     exit((unsigned long)sprintf(buf,"%s","foo") > 10L);
2022 }
2023 EOF
2024 if $cc $ccflags ucbsprf.c -o ucbsprf >/dev/null 2>&1 && ./ucbsprf; then
2025     echo "Your sprintf() returns (int)."
2026     val="$undef"
2027 else
2028     echo "Your sprintf() returns (char*)."
2029     val="$define"
2030 fi
2031 set d_charsprf
2032 eval $setvar
2033
2034 : see if vprintf exists
2035 echo " "
2036 if $contains '^vprintf$' libc.list >/dev/null 2>&1; then
2037     echo 'vprintf() found.'
2038     val="$define"
2039     cat >vprintf.c <<'EOF'
2040 #include <varargs.h>
2041
2042 main() { xxx("foo"); }
2043
2044 xxx(va_alist)
2045 va_dcl
2046 {
2047     va_list args;
2048     char buf[10];
2049
2050     va_start(args);
2051     exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
2052 }
2053 EOF
2054     if $cc $ccflags vprintf.c -o vprintf >/dev/null 2>&1 && ./vprintf; then
2055         echo "Your vsprintf() returns (int)."
2056         val2="$undef"
2057     else
2058         echo "Your vsprintf() returns (char*)."
2059         val2="$define"
2060     fi
2061 else
2062     echo 'vprintf() not found.'
2063     val="$undef"
2064     val2="$undef"
2065 fi
2066 set d_vprintf
2067 eval $setvar
2068 val=$val2
2069 set d_charvspr
2070 eval $setvar
2071
2072 : see if chsize exists
2073 set chsize d_chsize
2074 eval $inlibc
2075
2076 : see if crypt exists
2077 echo " "
2078 if $contains '^crypt$' libc.list >/dev/null 2>&1; then
2079     echo 'crypt() found.'
2080     val="$define"
2081     cryptlib=''
2082 else
2083     cryptlib=`./loc Slibcrypt.a "" $xlibpth`
2084     if $test -z "$cryptlib"; then
2085         cryptlib=`./loc Mlibcrypt.a "" $xlibpth`
2086     else
2087         cryptlib=-lcrypt
2088     fi
2089     if $test -z "$cryptlib"; then
2090         cryptlib=`./loc Llibcrypt.a "" $xlibpth`
2091     else
2092         cryptlib=-lcrypt
2093     fi
2094     if $test -z "$cryptlib"; then
2095         cryptlib=`./loc libcrypt.a "" $libpth`
2096     else
2097         cryptlib=-lcrypt
2098     fi
2099     if $test -z "$cryptlib"; then
2100         echo 'crypt() not found.'
2101         val="$undef"
2102     else
2103         val="$define"
2104     fi
2105 fi
2106 set d_crypt
2107 eval $setvar
2108
2109 : get csh whereabouts
2110 case "$csh" in
2111 'csh') val="$undef" ;;
2112 *)     val="$define" ;;
2113 esac
2114 set d_csh
2115 eval $setvar
2116
2117 : see if readdir exists
2118 set readdir d_readdir
2119 eval $inlibc
2120
2121 : see if there are directory access routines out there
2122 echo " "
2123 xxx=`./loc ndir.h x $usrinclude /usr/local/include $inclwanted`
2124 case "$xxx" in
2125 x)
2126     xxx=`./loc sys/ndir.h x $usrinclude /usr/local/include $inclwanted`
2127     ;;
2128 esac
2129 D_dirnamlen="$undef"
2130 I_dirent="$undef"
2131 I_sys_dir="$undef"
2132 I_my_dir="$undef"
2133 I_ndir="$undef"
2134 I_sys_ndir="$undef"
2135 libndir=''
2136 ndirc=''
2137 ndiro=''
2138 if $test -r $usrinclude/dirent.h; then
2139     echo "dirent.h found."
2140     if $contains 'd_namlen' $usrinclude/dirent.h >/dev/null 2>&1; then
2141         D_dirnamlen="$define"
2142     fi
2143     I_dirent="$define"
2144 elif $test -r $xxx; then
2145     echo "You seem to use <$xxx>,"
2146     if $test "$d_readdir" = "$define"; then
2147         echo "and I can get readdir() from your C library."
2148     elif $test -r /usr/lib/libndir.a || $test -r /usr/local/lib/libndir.a; then
2149         echo "and I'll get the routines using -lndir ."
2150         libndir='-lndir'
2151     else
2152         ans=`./loc libndir.a x $libpth`
2153         case "$ans" in
2154         x)
2155             echo "but I can't find the ndir library!"
2156             ;;
2157         *)
2158             echo "and I found the directory library in $ans."
2159             libndir="$ans"
2160             ;;
2161         esac
2162     fi
2163     if $contains 'd_namlen' $xxx >/dev/null 2>&1; then
2164         D_dirnamlen="$define"
2165     fi
2166     case "$xxx" in
2167     sys/)
2168         I_sys_ndir="$define"
2169         ;;
2170     *)
2171         I_ndir="$define"
2172         ;;
2173     esac
2174 else
2175     : The next line used to require this to be a bsd system.
2176     if $contains '^readdir$' libc.list >/dev/null 2>&1 ; then
2177         echo "No ndir library found, but you have readdir() so we'll use that."
2178         if $contains 'd_namlen' $usrinclude/sys/dir.h >/dev/null 2>&1; then
2179             D_dirnamlen="$define"
2180         fi
2181         I_sys_dir="$define"
2182     else
2183         echo "No ndir library found--using ./$d_ndir.c."
2184 : This will lose since $d_ndir.h is in another directory.
2185 : I doubt we can rely on it being in ../$d_ndir.h . 
2186 : At least it will fail in a conservative manner.
2187         if $contains 'd_namlen' $d_ndir.h >/dev/null 2>&1; then
2188             D_dirnamlen="$define"
2189         fi
2190         I_my_dir="$define"
2191         ndirc="$d_ndir.c"
2192         ndiro="$d_ndir.o"
2193     fi
2194 fi
2195 val=$D_dirnamlen;       set d_dirnamlen;        eval $setvar
2196 val=$I_dirent;          set i_dirent;           eval $setvar
2197 val=$I_sys_dir;         set i_sys_dir;          eval $setvar
2198 val=$I_my_dir;          set i_my_dir;           eval $setvar
2199 val=$I_ndir;            set i_ndir;             eval $setvar
2200 val=$I_sys_ndir;        set i_sys_ndir;         eval $setvar
2201
2202 : now see if they want to do setuid emulation
2203 case "$d_dosuid" in
2204 '') dflt=n;;
2205 *undef*) dflt=n;;
2206 *) dflt=y;;
2207 esac
2208 cat <<EOM
2209  
2210 Some sites have disabled setuid #! scripts because of a bug in the kernel
2211 that prevents them from being secure.  If you are on such a system, the
2212 setuid/setgid bits on scripts are currently useless.  It is possible for
2213 $package to detect those bits and emulate setuid/setgid in a secure fashion
2214 until a better solution is devised for the kernel problem.
2215
2216 EOM
2217 rp="Do you want to do setuid/setgid emulation? [$dflt]"
2218 $echo $n "$rp $c"
2219 . myread
2220 case "$ans" in
2221 '') $ans="$dflt";;
2222 esac
2223 case "$ans" in
2224 y*)  d_dosuid="$define";;
2225 *) d_dosuid="$undef";;
2226 esac
2227
2228 : see if dup2 exists
2229 set dup2 d_dup2
2230 eval $inlibc
2231
2232 : see if fchmod exists
2233 set fchmod d_fchmod
2234 eval $inlibc
2235
2236 : see if fchown exists
2237 set fchown d_fchown
2238 eval $inlibc
2239
2240 : see if this is an fcntl system
2241 set fcntl d_fcntl
2242 eval $inlibc
2243
2244 : see if we can have long filenames
2245 echo " "
2246 rm -f 123456789abcde
2247 if (echo hi >123456789abcdef) 2>/dev/null; then
2248     : not version 8
2249     if test -f 123456789abcde; then
2250         echo 'You cannot have filenames longer than 14 characters.  Sigh.'
2251         val="$undef"
2252     else
2253         echo 'You can have filenames longer than 14 characters.'
2254         val="$define"
2255     fi
2256 else
2257     : version 8 probably
2258     echo "You can't have filenames longer than 14 chars.  You can't even think about them!"
2259     val="$undef"
2260 fi 
2261 set d_flexfnam
2262 eval $setvar
2263
2264 : see if flock exists
2265 set flock d_flock
2266 eval $inlibc
2267
2268 : see if getgroups exists
2269 set getgroups d_getgrps
2270 eval $inlibc
2271
2272 : see if gethostent exists
2273 set gethostent d_gethent
2274 eval $inlibc
2275
2276 : see if getpgrp exists
2277 set getpgrp d_getpgrp
2278 eval $inlibc
2279
2280 : see if getpgrp2 exists
2281 set getpgrp2 d_getpgrp2
2282 eval $inlibc
2283
2284 : see if getpriority exists
2285 set getpriority d_getprior
2286 eval $inlibc
2287
2288 : see if htonl exists
2289 set htonl d_htonl
2290 eval $inlibc
2291
2292 : index or strcpy
2293 echo " "
2294 case "$d_index" in
2295 n) dflt=n;;
2296 *)  if $test -f /unix; then
2297         dflt=n
2298     else
2299         dflt=y
2300     fi
2301     ;;
2302 esac
2303 if $contains '^index$' libc.list >/dev/null 2>&1 ; then
2304     if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
2305         echo "Your system has both index() and strchr().  Shall I use"
2306         rp="index() rather than strchr()? [$dflt]"
2307         $echo $n "$rp $c"
2308         . myread
2309         case "$ans" in
2310             n*) d_index="$define" ;;
2311             *)  d_index="$undef" ;;
2312         esac
2313     else
2314         d_index="$undef"
2315         echo "index() found."
2316     fi
2317 else
2318     if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
2319         d_index="$define"
2320         echo "strchr() found."
2321     else
2322         echo "No index() or strchr() found!"
2323         d_index="$undef"
2324     fi
2325 fi
2326
2327 : see if killpg exists
2328 set killpg d_killpg
2329 eval $inlibc
2330
2331 : see if lstat exists
2332 set lstat d_lstat
2333 eval $inlibc
2334
2335 : see if memcmp exists
2336 set memcmp d_memcmp
2337 eval $inlibc
2338
2339 : see if memcpy exists
2340 set memcpy d_memcpy
2341 eval $inlibc
2342
2343 : see if mkdir exists
2344 set mkdir d_mkdir
2345 eval $inlibc
2346
2347 : see if msgctl exists
2348 set msgctl d_msgctl
2349 eval $inlibc
2350
2351 : see if msgget exists
2352 set msgget d_msgget
2353 eval $inlibc
2354
2355 : see if msgsnd exists
2356 set msgsnd d_msgsnd
2357 eval $inlibc
2358
2359 : see if msgrcv exists
2360 set msgrcv d_msgrcv
2361 eval $inlibc
2362
2363 : see how much of the 'msg*(2)' library is present.
2364 h_msg=true
2365 echo " "
2366 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
2367 *undef*) h_msg=false;;
2368 esac
2369 : we could also check for sys/ipc.h ...
2370 if $h_msg && $test -r $usrinclude/sys/msg.h; then
2371     echo "You have the full msg*(2) library."
2372     val="$define"
2373 else
2374     echo "You don't have the full msg*(2) library."
2375     val="$undef"
2376 fi
2377 set d_msg
2378 eval $setvar
2379
2380 : see if ndbm is available
2381 echo " "
2382 xxx=`./loc ndbm.h x $usrinclude /usr/local/include $inclwanted`
2383 if test -f $xxx; then
2384     val="$define"
2385     echo "ndbm.h found."
2386 else
2387     val="$undef"
2388     echo "ndbm.h not found."
2389 fi
2390 set d_ndbm
2391 eval $setvar
2392
2393 : see if we have the old dbm
2394 echo " "
2395 xxx=`./loc dbm.h x $usrinclude /usr/local/include $inclwanted`
2396 if test -f $xxx; then
2397     val="$define"
2398     echo "dbm.h found."
2399 else
2400     val="$undef"
2401     echo "dbm.h not found."
2402 fi
2403 set d_odbm
2404 eval $setvar
2405
2406 : see whether socket exists
2407 echo " "
2408 socketlib=''
2409 if $contains socket libc.list >/dev/null 2>&1; then
2410     echo "Looks like you have Berkeley networking support."
2411     val="$define"
2412     : now check for advanced features
2413     if $contains setsockopt libc.list >/dev/null 2>&1; then
2414         val2="$undef"
2415     else
2416         echo "...but it uses the old 4.1c interface, rather than 4.2"
2417         val2="$define"
2418     fi
2419 else
2420     : hpux, for one, puts all the socket stuff in socklib.o
2421     if $contains socklib libc.list >/dev/null 2>&1; then
2422         echo "Looks like you have Berkeley networking support."
2423         val="$define"
2424         : we will have to assume that it supports the 4.2 BSD interface
2425         val2="$undef"
2426     else
2427         echo "Hmmm...you don't have Berkeley networking in libc.a..."
2428         : look for an optional networking library
2429         if test -f /usr/lib/libnet.a; then
2430             (ar t /usr/lib/libnet.a ||
2431                 nm -g /usr/lib/libnet.a) 2>/dev/null >> libc.list
2432             if $contains socket libc.list >/dev/null 2>&1; then
2433                 echo "but the Wollongong group seems to have hacked it in."
2434                 socketlib="-lnet -lnsl_s"
2435                 val="$define"
2436                 : now check for advanced features
2437                 if $contains setsockopt libc.list >/dev/null 2>&1; then
2438                     val2="$undef"
2439                 else
2440                     echo "...using the old 4.1c interface, rather than 4.2"
2441                     val2="$define"
2442                 fi
2443             else
2444                 echo "or even in libnet.a, which is peculiar."
2445                 val="$undef"
2446                 val2="$undef"
2447             fi
2448         else
2449             echo "or anywhere else I see."
2450             val="$undef"
2451             val2="$undef"
2452         fi
2453     fi
2454 fi
2455 set d_socket
2456 eval $setvar
2457
2458 if $contains socketpair libc.list >/dev/null 2>&1; then
2459     val="$define"
2460 else
2461     val="$undef"
2462 fi
2463 set d_sockpair
2464 eval $setvar
2465 val=$val2
2466 set d_oldsock
2467 eval $setvar
2468
2469 : Locate the flags for 'open()'
2470 echo " "
2471 $cat >open3.c <<'EOCP'
2472 #include <sys/types.h>
2473 #ifdef I_FCNTL
2474 #include <fcntl.h>
2475 #endif
2476 #ifdef I_SYS_FILE
2477 #include <sys/file.h>
2478 #endif
2479 main() {
2480
2481         if(O_RDONLY);
2482
2483 #ifdef O_TRUNC
2484         exit(0);
2485 #else
2486         exit(1);
2487 #endif
2488 }
2489 EOCP
2490 : check sys/file.h first to get FREAD on Sun
2491 if $test -r $usrinclude/sys/file.h && \
2492    $cc $cppflags "-DI_SYS_FILE" open3.c -o open3 >/dev/null 2>&1 ; then
2493     h_sys_file=true;
2494     echo "sys/file.h defines the O_* constants..."
2495     if ./open3; then
2496         echo "and you have the 3 argument form of open()."
2497         val="$define"
2498     else
2499         echo "but not the 3 argument form of open().  Oh, well."
2500         val="$undef"
2501     fi
2502 elif $test -r $usrinclude/fcntl.h && \
2503    $cc "-DI_FCNTL" open3.c -o open3 >/dev/null 2>&1 ; then
2504     h_fcntl=true;
2505     echo "fcntl.h defines the O_* constants..."
2506     if ./open3; then
2507         echo "and you have the 3 argument form of open()."
2508         val="$define"
2509     else
2510         echo "but not the 3 argument form of open().  Oh, well."
2511         val="$undef"
2512     fi
2513 else
2514     val="$undef"
2515     echo "I can't find the O_* constant definitions!  You got problems."
2516 fi
2517 set d_open3
2518 eval $setvar
2519
2520 : see if how pwd stuff is defined
2521 echo " "
2522 if $test -r $usrinclude/pwd.h ; then
2523     i_pwd="$define"
2524     echo "pwd.h found."
2525     $cppstdin $cppflags $cppminus <$usrinclude/pwd.h | \
2526         sed -n '/struct[        ][      ]*passwd/,/^};/p' >pwd.txt
2527     if $contains 'pw_quota' pwd.txt >/dev/null 2>&1; then
2528         d_pwquota="$define"
2529     else
2530         d_pwquota="$undef"
2531     fi
2532     if $contains 'pw_age' pwd.txt >/dev/null 2>&1; then
2533         d_pwage="$define"
2534     else
2535         d_pwage="$undef"
2536     fi
2537     if $contains 'pw_change' pwd.txt >/dev/null 2>&1; then
2538         d_pwchange="$define"
2539     else
2540         d_pwchange="$undef"
2541     fi
2542     if $contains 'pw_class' pwd.txt >/dev/null 2>&1; then
2543         d_pwclass="$define"
2544     else
2545         d_pwclass="$undef"
2546     fi
2547     if $contains 'pw_expire' pwd.txt >/dev/null 2>&1; then
2548         d_pwexpire="$define"
2549     else
2550         d_pwexpire="$undef"
2551     fi
2552     if $contains 'pw_comment' pwd.txt >/dev/null 2>&1; then
2553         d_pwcomment="$define"
2554     else
2555         d_pwcomment="$undef"
2556     fi
2557 else
2558     i_pwd="$undef"
2559     d_pwquota="$undef"
2560     d_pwage="$undef"
2561     d_pwchange="$undef"
2562     d_pwclass="$undef"
2563     d_pwexpire="$undef"
2564     d_pwcomment="$undef"
2565     echo "No pwd.h found."
2566 fi
2567
2568 : see if rename exists
2569 set rename d_rename
2570 eval $inlibc
2571
2572 : see if rmdir exists
2573 set rmdir d_rmdir
2574 eval $inlibc
2575
2576 : see if select exists
2577 set select d_select
2578 eval $inlibc
2579
2580 : see if semctl exists
2581 set semctl d_semctl
2582 eval $inlibc
2583
2584 : see if semget exists
2585 set semget d_semget
2586 eval $inlibc
2587
2588 : see if semop exists
2589 set semop d_semop
2590 eval $inlibc
2591
2592 : see how much of the 'sem*(2)' library is present.
2593 h_sem=true
2594 echo " "
2595 case "$d_semctl$d_semget$d_semop" in
2596 *undef*) h_sem=false;;
2597 esac
2598 : we could also check for sys/ipc.h ...
2599 if $h_sem && $test -r $usrinclude/sys/sem.h; then
2600     echo "You have the full sem*(2) library."
2601     val="$define"
2602 else
2603     echo "You don't have the full sem*(2) library."
2604     val="$undef"
2605 fi
2606 set d_sem
2607 eval $setvar
2608
2609 : see if setegid exists
2610 set setegid d_setegid
2611 eval $inlibc
2612
2613 : see if seteuid exists
2614 set seteuid d_seteuid
2615 eval $inlibc
2616
2617 : see if setpgrp exists
2618 set setpgrp d_setpgrp
2619 eval $inlibc
2620
2621 : see if setpgrp2 exists
2622 set setpgrp2 d_setpgrp2
2623 eval $inlibc
2624
2625 : see if setpriority exists
2626 set setpriority d_setprior
2627 eval $inlibc
2628
2629 : see if setregid exists
2630 set setregid d_setregid
2631 eval $inlibc
2632 set setresgid d_setresgid
2633 eval $inlibc
2634
2635 : see if setreuid exists
2636 set setreuid d_setreuid
2637 eval $inlibc
2638 set setresuid d_setresuid
2639 eval $inlibc
2640
2641 : see if setrgid exists
2642 set setrgid d_setrgid
2643 eval $inlibc
2644
2645 : see if setruid exists
2646 set setruid d_setruid
2647 eval $inlibc
2648
2649 : see if shmctl exists
2650 set shmctl d_shmctl
2651 eval $inlibc
2652
2653 : see if shmget exists
2654 set shmget d_shmget
2655 eval $inlibc
2656
2657 : see if shmat exists
2658 set shmat d_shmat
2659 eval $inlibc
2660
2661 d_voidshmat="$undef"
2662 case "$d_shmat" in
2663 define)
2664     $cppstdin $cppflags $cppminus < $usrinclude/sys/shm.h >voidshmat.txt 2>/dev/null
2665     if $contains "void.*shmat" voidshmat.txt >/dev/null 2>&1; then
2666         echo "and shmat returns (void*)"
2667         d_voidshmat="$define"
2668     else
2669         echo "and shmat returns (char*)"
2670     fi
2671     ;;
2672 esac
2673
2674 : see if shmdt exists
2675 set shmdt d_shmdt
2676 eval $inlibc
2677
2678 : see how much of the 'shm*(2)' library is present.
2679 h_shm=true
2680 echo " "
2681 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
2682 *undef*) h_shm=false;;
2683 esac
2684 : we could also check for sys/ipc.h ...
2685 if $h_shm && $test -r $usrinclude/sys/shm.h; then
2686     echo "You have the full shm*(2) library."
2687     val="$define"
2688 else
2689     echo "You don't have the full shm*(2) library."
2690     val="$undef"
2691 fi
2692 set d_shm
2693 eval $setvar
2694
2695 : see if stat knows about block sizes
2696 echo " "
2697 if $contains 'st_blocks;' $usrinclude/sys/stat.h >/dev/null 2>&1 ; then
2698     if $contains 'st_blksize;' $usrinclude/sys/stat.h >/dev/null 2>&1 ; then
2699         echo "Your stat knows about block sizes."
2700         val="$define"
2701     else
2702         echo "Your stat doesn't know about block sizes."
2703         val="$undef"
2704     fi
2705 else
2706     echo "Your stat doesn't know about block sizes."
2707     val="$undef"
2708 fi
2709 set d_statblks
2710 eval $setvar
2711
2712 : see if stdio is really std
2713 echo " "
2714 if $contains 'char.*_ptr.*;' $usrinclude/stdio.h >/dev/null 2>&1 ; then
2715     if $contains '_cnt;' $usrinclude/stdio.h >/dev/null 2>&1 ; then
2716         echo "Your stdio is pretty std."
2717         val="$define"
2718     else
2719         echo "Your stdio isn't very std."
2720         val="$undef"
2721     fi
2722 else
2723     echo "Your stdio isn't very std."
2724     val="$undef"
2725 fi
2726 set d_stdstdio
2727 eval $setvar
2728
2729 : check for structure copying
2730 echo " "
2731 echo "Checking to see if your C compiler can copy structs..."
2732 $cat >strctcpy.c <<'EOCP'
2733 main()
2734 {
2735         struct blurfl {
2736             int dyick;
2737         } foo, bar;
2738
2739         foo = bar;
2740 }
2741 EOCP
2742 if $cc -c strctcpy.c >/dev/null 2>&1 ; then
2743     val="$define"
2744     echo "Yup, it can."
2745 else
2746     val="$undef"
2747     echo "Nope, it can't."
2748 fi
2749 set d_strctcpy
2750 eval $setvar
2751
2752 : see if strerror exists
2753 set strerror d_strerror
2754 eval $inlibc
2755
2756 : see if symlink exists
2757 set symlink d_symlink
2758 eval $inlibc
2759
2760 : see if syscall exists
2761 set syscall d_syscall
2762 eval $inlibc
2763
2764 : set if package uses struct tm
2765 w_s_tm=1
2766
2767 : set if package uses struct timeval
2768 case "$d_select" in
2769 define) w_s_timevl=1 ;;
2770 esac
2771
2772 : set if package uses localtime function
2773 w_localtim=1
2774
2775 : see which of time.h, sys/time.h, and sys/select should be included.
2776 idefs=''
2777 cat <<'EOM'
2778   
2779 Testing to see which of <time.h>, <sys/time.h>, and <sys/select.h>
2780 should be included, because this application wants:
2781
2782 EOM
2783 case "$w_s_itimer" in
2784 1)
2785     echo "      struct itimerval"
2786     idefs="-DS_ITIMERVAL $idefs"
2787     ;;
2788 esac
2789 case "$w_s_timevl" in
2790 1)
2791     echo "      struct timeval"
2792     idefs="-DS_TIMEVAL $idefs"
2793     ;;
2794 esac
2795 case "$w_s_tm" in
2796 1)
2797     echo "      struct tm"
2798     idefs="-DS_TM $idefs"
2799     ;;
2800 esac
2801 case "$w_localtim" in
2802 1)
2803     echo "      ctime(3) declarations"
2804     idefs="-DD_CTIME $idefs"
2805     ;;
2806 esac
2807 case "$idefs" in
2808 '')
2809     echo "      (something I don't know about)"
2810     ;;
2811 esac
2812 echo " "
2813 echo "I'm now running the test program..."
2814 $cat >i_time.c <<'EOCP'
2815 #include <sys/types.h>
2816 #ifdef I_TIME
2817 #include <time.h>
2818 #endif
2819 #ifdef I_SYS_TIME
2820 #ifdef SYSTIMEKERNEL
2821 #define KERNEL
2822 #endif
2823 #include <sys/time.h>
2824 #endif
2825 #ifdef I_SYS_SELECT
2826 #include <sys/select.h>
2827 #endif
2828 main()
2829 {
2830     struct tm foo;
2831     struct tm *tmp;
2832 #ifdef S_TIMEVAL
2833     struct timeval bar;
2834 #endif
2835 #ifdef S_ITIMERVAL
2836     struct itimerval baz;
2837 #endif
2838
2839     if (foo.tm_sec == foo.tm_sec)
2840         exit(0);
2841 #ifdef S_TIMEVAL
2842     if (bar.tv_sec == bar.tv_sec)
2843         exit(0);
2844 #endif
2845 #ifdef S_ITIMERVAL
2846     if (baz.it_interval == baz.it_interval)
2847         exit(0);
2848 #endif
2849 #ifdef S_TIMEVAL
2850     if (bar.tv_sec == bar.tv_sec)
2851         exit(0);
2852 #endif
2853 #ifdef D_CTIME
2854     /* this might not do anything for us... */
2855     tmp = localtime((time_t *)0);
2856 #endif
2857     exit(1);
2858 }
2859 EOCP
2860 flags=''
2861 for i_sys_select in '' '-DI_SYS_SELECT'; do
2862     for d_systimekernel in '' '-DSYSTIMEKERNEL'; do
2863         for i_time in '' '-DI_TIME'; do
2864             for i_systime in '-DI_SYS_TIME' ''; do
2865                 case "$flags" in
2866                 '') echo Trying $i_time $i_systime $d_systimekernel $i_sys_select
2867                     if $cc $ccflags $idefs \
2868                             $i_time $i_systime $d_systimekernel $i_sys_select \
2869                             i_time.c -o i_time >/dev/null 2>&1 ; then
2870                         set X $i_time $i_systime $d_systimekernel $i_sys_select
2871                         shift
2872                         flags="$*"
2873                         echo Succeeded with $flags
2874                     fi
2875                     ;;
2876                 esac
2877             done
2878         done
2879     done
2880 done
2881 case "$flags" in
2882 *SYSTIMEKERNEL*) val="$define";;
2883 *) val="$undef";;
2884 esac
2885 set d_systimekernel
2886 eval $setvar
2887 case "$flags" in
2888 *I_TIME*) val="$define";;
2889 *) val="$undef";;
2890 esac
2891 set i_time
2892 eval $setvar
2893 case "$flags" in
2894 *I_SYS_SELECT*) val="$define";;
2895 *) val="$undef";;
2896 esac
2897 set i_sys_select
2898 eval $setvar
2899 case "$flags" in
2900 *I_SYS_TIME*) val="$define";;
2901 *) val="$undef";;
2902 esac
2903 set i_sys_time
2904 eval $setvar
2905 case "$flags$i_sys_time$i_time" in
2906 undefundef) i_sys_time="$define"; i_time="$define";
2907     echo "ICK, NOTHING WORKED!!!  You may have to diddle the includes.";;
2908 esac
2909
2910 : see if signal is declared as pointer to function returning int or void
2911 echo " "
2912 $cppstdin $cppflags $cppminus < $usrinclude/signal.h >d_voidsig.txt
2913 if $contains 'int[^A-Za-z]*signal' d_voidsig.txt >/dev/null 2>&1 ; then
2914     echo "You have int (*signal())() instead of void."
2915     val="$undef"
2916 else
2917     echo "You have void (*signal())() instead of int."
2918     val="$define"
2919 fi
2920 set d_voidsig
2921 eval $setvar
2922 case $voidsig in
2923 define) d_tosignal=void;;
2924 *) d_tosignal=int;;
2925 esac
2926
2927 : see if truncate exists
2928 set truncate d_truncate
2929 eval $inlibc
2930
2931 : see if there is a vfork
2932 set vfork d_vfork
2933 eval $inlibc
2934
2935 : check for volatile keyword
2936 echo " "
2937 echo 'Checking to see if your C compiler knows about "volatile"...'
2938 $cat >try.c <<'EOCP'
2939 main()
2940 {
2941         typedef unsigned short foo_t;
2942         char *volatile foo;
2943         volatile int bar;
2944         volatile foo_t blech;
2945         foo = foo;
2946 }
2947 EOCP
2948 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
2949     val="$define"
2950     echo "Yup, it does."
2951 else
2952     val="$undef"
2953     echo "Nope, it doesn't."
2954 fi
2955 set d_volatile
2956 eval $setvar
2957 $rm -f try.*
2958
2959 : see if there is a wait4
2960 set wait4 d_wait4
2961 eval $inlibc
2962
2963 : see if there is a waitpid
2964 set waitpid d_waitpid
2965 eval $inlibc
2966
2967 : see what type gids are declared as in the kernel
2968 case "$gidtype" in
2969 '')
2970     if $contains 'gid_t;' $usrinclude/sys/types.h >/dev/null 2>&1 ; then
2971         dflt='gid_t';
2972     else
2973         set `grep '_rgid;' $usrinclude/sys/user.h 2>/dev/null` unsigned short
2974         case $1 in
2975         unsigned) dflt="$1 $2" ;;
2976         *) dflt="$1" ;;
2977         esac
2978     fi
2979     ;;
2980 *)  dflt="$gidtype"
2981     ;;
2982 esac
2983 cont=true
2984 echo " "
2985 rp="What type are groups ids returned by getgid(), etc.? [$dflt]"
2986 $echo $n "$rp $c"
2987 . myread
2988 gidtype="$ans"
2989
2990 : see what type gids are returned by getgroups
2991 echo " "
2992 case "$groupstype" in
2993 '')
2994     if $contains 'getgroups.*short' /usr/lib/lint/llib-lc >/dev/null 2>&1; then
2995         dflt='short'
2996     elif $contains 'getgroups.*int' /usr/lib/lint/llib-lc >/dev/null 2>&1; then
2997         dflt='int'
2998     elif $contains 'getgroups.*short' /usr/include/libc.h >/dev/null 2>&1; then
2999         dflt='short'
3000     elif $contains 'getgroups.*int' /usr/include/libc.h >/dev/null 2>&1; then
3001         dflt='int'
3002     elif $contains 'getgroups.*short' /usr/lib/lint/llib-lbsd >/dev/null 2>&1; then
3003         dflt='short'
3004     elif $contains 'getgroups.*int' /usr/lib/lint/llib-lbsd >/dev/null 2>&1; then
3005         dflt='int'
3006     elif $contains 'int.*gidset' /usr/man/man2/getgroups.2 >/dev/null 2>&1; then
3007         dflt='int'
3008     elif $contains 'gid_t;' $usrinclude/sys/types.h >/dev/null 2>&1 ; then
3009         dflt='gid_t'
3010     else
3011         set `grep 'groups\[NGROUPS\];' $usrinclude/sys/user.h 2>/dev/null` unsigned short
3012         case $1 in
3013         unsigned) dflt="$1 $2" ;;
3014         *) dflt="$1" ;;
3015         esac
3016     fi
3017     ;;
3018 *)  dflt="$groupstype"
3019     ;;
3020 esac
3021 cont=true
3022 echo "(The following only matters if you have getgroups().)"
3023 rp="What type are the group ids returned by getgroups()? [$dflt]"
3024 $echo $n "$rp $c"
3025 . myread
3026 groupstype="$ans"
3027
3028 : check for length of integer
3029 echo " "
3030 case "$intsize" in
3031 '')
3032     echo "Checking to see how big your integers are..."
3033     $cat >intsize.c <<'EOCP'
3034 #include <stdio.h>
3035 main()
3036 {
3037     printf("%d\n", sizeof(int));
3038 }
3039 EOCP
3040     if $cc intsize.c -o intsize >/dev/null 2>&1 ; then
3041         dflt=`./intsize`
3042     else
3043         dflt='4'
3044         echo "(I can't seem to compile the test program.  Guessing...)"
3045     fi
3046     ;;
3047 *)
3048     dflt="$intsize"
3049     ;;
3050 esac
3051 rp="What is the size of an integer (in bytes)? [$dflt]"
3052 $echo $n "$rp $c"
3053 . myread
3054 intsize="$ans"
3055
3056 : determine which malloc to compile in
3057 echo " "
3058 case "$d_mymalloc" in
3059 '')
3060     case "$usemymalloc" in
3061     '')
3062         if bsd || v7; then
3063             dflt='y'
3064         else
3065             dflt='n'
3066         fi
3067         ;;
3068     n*) dflt=n;;
3069     *)  dflt=y;;
3070     esac
3071     ;;
3072 define)  dflt="y"
3073     ;;
3074 *)  dflt="n"
3075     ;;
3076 esac
3077 rp="Do you wish to attempt to use the malloc that comes with $package? [$dflt]"
3078 $echo $n "$rp $c"
3079 . myread
3080 case "$ans" in
3081 '') ans=$dflt;;
3082 esac
3083 case "$ans" in
3084 y*) mallocsrc='malloc.c'; mallocobj='malloc.o'
3085     libs=`echo $libs | sed 's/-lmalloc//'`
3086     val="$define"
3087     case "$mallocptrtype" in
3088     '')
3089         cat >usemymalloc.c <<'END'
3090 #ifdef __STDC__
3091 #include <stdlib.h>
3092 #else
3093 #include <malloc.h>
3094 #endif
3095 void *malloc();
3096 END
3097         if $cc $ccflags -c usemymalloc.c >/dev/null 2>&1; then
3098             mallocptrtype=void
3099         else
3100             mallocptrtype=char
3101         fi
3102         ;;
3103     esac
3104     echo " "
3105     echo "Your system wants malloc to return $mallocptrtype*, it would seem."
3106     ;;
3107 *)  mallocsrc='';
3108     mallocobj='';
3109     mallocptrtype=void
3110     val="$define"
3111     ;;
3112 esac
3113 set d_mymalloc
3114 eval $setvar
3115
3116 : determine where private executables go
3117 case "$privlib" in
3118 '')
3119     dflt=/usr/lib/$package
3120     test -d /usr/local/lib && dflt=/usr/local/lib/$package
3121     ;;
3122 *)  dflt="$privlib"
3123     ;;
3124 esac
3125 $cat <<EOM
3126
3127 The $package package has some auxiliary files that should be reside in a library
3128 that is accessible by everyone.  Where should these "private" but accessible
3129 EOM
3130 $echo $n "files reside? (~name ok) [$dflt] $c"
3131 rp="Private files will reside where? [$dflt]"
3132 . myread
3133 privlib=`./filexp "$ans"`
3134
3135 case "$installprivlib" in
3136 '')
3137     dflt=`echo $privlib | sed 's#^/afs/#/afs/.#'`
3138     test -d $dflt || dflt="$privlib"
3139     ;;
3140 *)  dflt="$installprivlib"
3141     ;;
3142 esac
3143 $cat <<EOM
3144
3145 On some systems (such as afs) you have to install the library files in a
3146 different directory to get them to go to the right place.  Where should the
3147 EOM
3148 $echo $n "library files be installed? (~name ok) [$dflt] $c"
3149 rp="Install private files where? [$dflt]"
3150 . myread
3151 installprivlib=`./filexp "$ans"`
3152
3153 : check for size of random number generator
3154 echo " "
3155 case "$randbits" in
3156 '')
3157     echo "Checking to see how many bits your rand function produces..."
3158     $cat >randbits.c <<'EOCP'
3159 #include <stdio.h>
3160 main()
3161 {
3162     register int i;
3163     register unsigned long tmp;
3164     register unsigned long max = 0L;
3165
3166     for (i=1000; i; i--) {
3167         tmp = (unsigned long)rand();
3168         if (tmp > max) max = tmp;
3169     }
3170     for (i=0; max; i++)
3171         max /= 2;
3172     printf("%d\n",i);
3173 }
3174 EOCP
3175     if $cc randbits.c -o randbits >/dev/null 2>&1 ; then
3176         dflt=`./randbits`
3177     else
3178         dflt='?'
3179         echo "(I can't seem to compile the test program...)"
3180     fi
3181     ;;
3182 *)
3183     dflt="$randbits"
3184     ;;
3185 esac
3186 rp="How many bits does your rand() function produce? [$dflt]"
3187 $echo $n "$rp $c"
3188 . myread
3189 randbits="$ans"
3190
3191 : determine where publicly executable scripts go
3192 case "$scriptdir" in
3193 '')
3194     dflt="$bin"
3195     : guess some guesses
3196     test -d /usr/share/scripts && dflt=/usr/share/scripts
3197     test -d /usr/share/bin && dflt=/usr/share/bin
3198     ;;
3199 *)  dflt="$scriptdir"
3200     ;;
3201 esac
3202 cont=true
3203 $cat <<EOM
3204  
3205 Some installations have a separate directory just for executable scripts so
3206 that they can mount it across multiple architectures but keep the scripts in
3207 one spot.  You might, for example, have a subdirectory of /usr/share for this.
3208 Or you might just lump your scripts in with all your other executables.
3209  
3210 EOM
3211 while $test "$cont" ; do
3212     rp="Where will publicly executable scripts reside (~name ok)? [$dflt]"
3213     $echo $n "$rp $c"
3214     . myread
3215     scriptdir="$ans"
3216     scriptdir=`./filexp "$scriptdir"`
3217     if test -d $scriptdir; then
3218         cont=''
3219     else
3220         case "$fastread" in
3221         yes) dflt=y;;
3222         *) dflt=n;;
3223         esac
3224         rp="Directory $scriptdir doesn't exist.  Use that name anyway? [$dflt]"
3225         $echo $n "$rp $c"
3226         . myread
3227         dflt=''
3228         case "$ans" in
3229         y*) cont='';;
3230         esac
3231     fi
3232 done
3233
3234 case "$installscr" in
3235 '')
3236     dflt=`echo $scriptdir | sed 's#^/afs/#/afs/.#'`
3237     test -d $dflt || dflt="$scriptdir"
3238     ;;
3239 *)  dflt="$scriptdir"
3240     ;;
3241 esac
3242 cont=true
3243 $cat <<EOM
3244  
3245 Some installations must install scripts in a different directory than where
3246 they will eventually reside.  On most systems they're the same directory.
3247 EOM
3248 while $test "$cont" ; do
3249     rp="Where do you install publicly executable scripts (~name ok)? [$dflt]"
3250     $echo $n "$rp $c"
3251     . myread
3252     installscr="$ans"
3253     installscr=`./filexp "$installscr"`
3254     if test -d $installscr; then
3255         cont=''
3256     else
3257         case "$fastread" in
3258         yes) dflt=y;;
3259         *) dflt=n;;
3260         esac
3261         rp="Directory $installscr doesn't exist.  Use that name anyway? [$dflt]"
3262         $echo $n "$rp $c"
3263         . myread
3264         dflt=''
3265         case "$ans" in
3266         y*) cont='';;
3267         esac
3268     fi
3269 done
3270
3271 : generate list of signal names
3272 echo " "
3273 case "$sig_name" in
3274 '')
3275     echo "Generating a list of signal names..."
3276     set X `cat $usrinclude/signal.h $usrinclude/sys/signal.h 2>&1 | awk '
3277 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ {
3278     sig[$3] = substr($2,4,20)
3279     if (max < $3 && $3 < 60) {
3280         max = $3
3281     }
3282 }
3283
3284 END {
3285     for (i=1; i<=max; i++) {
3286         if (sig[i] == "")
3287             printf "%d", i
3288         else
3289             printf "%s", sig[i]
3290         if (i < max)
3291             printf " "
3292     }
3293     printf "\n"
3294 }
3295 '`
3296     shift
3297     case $# in
3298     0)  echo 'kill -l' >/tmp/foo$$
3299         set X `$csh -f </tmp/foo$$`
3300         shift
3301         case $# in
3302         0)set HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM
3303             ;;
3304         esac
3305         ;;
3306     esac
3307     sig_name="ZERO $*"
3308     ;;
3309 esac
3310 echo "Signals are: $sig_name"
3311
3312 : see what type of char stdio uses.
3313 echo " "
3314 if $contains 'unsigned.*char.*\*.*_ptr.*;' $usrinclude/stdio.h >/dev/null 2>&1 ; then
3315     echo "Your stdio uses unsigned chars."
3316     stdchar="unsigned char"
3317 else
3318     echo "Your stdio uses signed chars."
3319     stdchar="char"
3320 fi
3321
3322 : see what type uids are declared as in the kernel
3323 case "$uidtype" in
3324 '')
3325     if $contains 'uid_t;' $usrinclude/sys/types.h >/dev/null 2>&1 ; then
3326         dflt='uid_t';
3327     else
3328         set `grep '_ruid;' $usrinclude/sys/user.h 2>/dev/null` unsigned short
3329         case $1 in
3330         unsigned) dflt="$1 $2" ;;
3331         *) dflt="$1" ;;
3332         esac
3333     fi
3334     ;;
3335 *)  dflt="$uidtype"
3336     ;;
3337 esac
3338 cont=true
3339 echo " "
3340 rp="What type are user ids returned by getuid(), etc.? [$dflt]"
3341 $echo $n "$rp $c"
3342 . myread
3343 uidtype="$ans"
3344
3345 : check for void type
3346 echo " "
3347 $cat <<EOM
3348 Checking to see how well your C compiler groks the void type...
3349
3350   Support flag bits are:
3351     1: basic void declarations.
3352     2: arrays of pointers to functions returning void.
3353     4: operations between pointers to and addresses of void functions.
3354
3355 EOM
3356 case "$voidhave" in
3357 '')
3358     $cat >void.c <<'EOCP'
3359 #if TRY & 1
3360 void main() {
3361 #else
3362 main() {
3363 #endif
3364         extern void moo();      /* function returning void */
3365         void (*goo)();          /* ptr to func returning void */
3366 #if TRY & 2
3367         void (*foo[10])();
3368 #endif
3369
3370 #if TRY & 4
3371         if(goo == moo) {
3372                 exit(0);
3373         }
3374 #endif
3375         exit(0);
3376 }
3377 EOCP
3378     if $cc -c -DTRY=$voidwant void.c >void.out 2>&1 ; then
3379         voidhave=$voidwant
3380         echo "It appears to support void to the level $package wants ($voidwant)."
3381         if $contains warning void.out >/dev/null 2>&1; then
3382             echo "However, you might get some warnings that look like this:"
3383             $cat void.out
3384         fi
3385     else
3386         echo "Hmm, your compiler has some difficulty with void.  Checking further..."
3387         if $cc -c -DTRY=1 void.c >/dev/null 2>&1 ; then
3388             echo "It supports 1..."
3389             if $cc -c -DTRY=3 void.c >/dev/null 2>&1 ; then
3390                 voidhave=3
3391                 echo "And it supports 2 but not 4."
3392             else
3393                 echo "It doesn't support 2..."
3394                 if $cc -c -DTRY=5 void.c >/dev/null 2>&1 ; then
3395                     voidhave=5
3396                     echo "But it supports 4."
3397                 else
3398                     voidhave=1
3399                     echo "And it doesn't support 4."
3400                 fi
3401             fi
3402         else
3403             echo "There is no support at all for void."
3404             voidhave=0
3405         fi
3406     fi
3407 esac
3408 dflt="$voidhave";
3409 rp="Your void support flags add up to what? [$dflt]"
3410 $echo $n "$rp $c"
3411 . myread
3412 voidhave="$ans"
3413
3414 : preserve RCS keywords in files with variable substitution, grrr
3415 Log='$Log'
3416 Header='$Header'
3417 Id='$Id'
3418 Author='$Author'
3419 Date='$Date'
3420 Locker='$Locker'
3421 RCSfile='$RCSfile'
3422 Revision='$Revision'
3423 Source='$Source'
3424 State='$State'
3425
3426
3427 : determine compiler compiler
3428 case "$yacc" in
3429 '') if xenix; then
3430         dflt=yacc
3431     else
3432         dflt='yacc -Sm25000'
3433     fi
3434     ;;
3435 *)  dflt="$yacc";;
3436 esac
3437 cont=true
3438     echo " "
3439 rp="Which compiler compiler (yacc or bison -y) will you use? [$dflt]"
3440 $echo $n "$rp $c"
3441 . myread
3442 case "$ans" in
3443 '') ans="$dflt";;
3444 esac
3445 yacc="$ans"
3446
3447 : see if we can include fcntl.h
3448 echo " "
3449 if $h_fcntl; then
3450     val="$define"
3451     echo "We'll be including <fcntl.h>."
3452 else
3453     val="$undef"
3454     if $h_sys_file; then
3455         echo "We don't need to <fcntl.h> if we include <sys/file.h>."
3456     else
3457         echo "We won't be including <fcntl.h>."
3458     fi
3459 fi
3460 set i_fcntl
3461 eval $setvar
3462
3463 : see if gdbm is available
3464 echo " "
3465 xxx=`./loc gdbm.h x $usrinclude /usr/local/include $inclwanted`
3466 if test -f $xxx; then
3467     val="$define"
3468     echo "gdbm.h found."
3469 else
3470     val="$undef"
3471     echo "gdbm.h not found."
3472 fi
3473 set i_gdbm
3474 eval $setvar
3475
3476 : see if this is an grp system
3477 echo " "
3478 if $test -r $usrinclude/grp.h ; then
3479     val="$define"
3480     echo "grp.h found."
3481 else
3482     val="$undef"
3483     echo "No grp.h found."
3484 fi
3485 set i_grp
3486 eval $setvar
3487
3488 : see if this is a netinet/in.h or sys/in.h system
3489 echo " "
3490 xxx=`./loc netinet/in.h x $usrinclude /usr/local/include $inclwanted`
3491 if test -f $xxx; then
3492     val="$define"
3493     val2="$undef"
3494     echo "netinet/in.h found."
3495 else
3496     val="$undef"
3497     echo "No netinet/in.h found, ..."
3498     xxx=`./loc sys/in.h x $usrinclude /usr/local/include $inclwanted`
3499     if test -f $xxx; then
3500         val2="$define"
3501         echo "but I found sys/in.h instead."
3502     else
3503         val2="$undef"
3504         echo "and I didn't find sys/in.h either."
3505     fi
3506 fi
3507 set i_niin
3508 eval $setvar
3509 val=$val2
3510 set i_sysin
3511 eval $setvar
3512
3513 : Do we need to #include <sys/file.h> ?
3514 echo " "
3515 if $h_sys_file; then
3516     val="$define"
3517     echo "We'll be including <sys/file.h>."
3518 else
3519     val="$undef"
3520     echo "We won't be including <sys/file.h>."
3521 fi
3522 set i_sys_file
3523 eval $setvar
3524
3525 : see if ioctl defs are in sgtty/termio or sys/ioctl
3526 echo " "
3527 if $test -r $usrinclude/sys/ioctl.h ; then
3528     val="$define"
3529     echo "sys/ioctl.h found."
3530 else
3531     val="$undef"
3532     echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h."
3533 fi
3534 set i_sysioctl
3535 eval $setvar
3536
3537 : see if we should include utime.h
3538 echo " "
3539 if $test -r $usrinclude/utime.h ; then
3540     val="$define"
3541     echo "utime.h found."
3542 else
3543     val="$undef"
3544     echo "No utime.h found, but that's ok."
3545 fi
3546 set i_utime
3547 eval $setvar
3548
3549 : see if this is a varargs system
3550 echo " "
3551 if $test -r $usrinclude/varargs.h ; then
3552     val="$define"
3553     echo "varargs.h found."
3554 else
3555     val="$undef"
3556     echo "No varargs.h found, but that's ok (I hope)."
3557 fi
3558 set i_varargs
3559 eval $setvar
3560
3561 : see if this is a vfork system
3562 echo " "
3563 if $test -r $usrinclude/vfork.h ; then
3564     val="$define"
3565     echo "vfork.h found."
3566 else
3567     val="$undef"
3568     echo "No vfork.h found."
3569 fi
3570 set i_vfork
3571 eval $setvar
3572
3573 : end of configuration questions
3574 echo " "
3575 echo "End of configuration questions."
3576 echo " "
3577
3578 : create config.sh file
3579 echo " "
3580 if test -d ../UU; then
3581     cd ..
3582 fi
3583 echo "Creating config.sh..."
3584 test -f config.sh && cp config.sh UU/oldconfig.sh
3585 $spitshell <<EOT >config.sh
3586 $startsh
3587 # config.sh
3588 # This file was produced by running the Configure script.
3589 d_eunice='$d_eunice'
3590 define='$define'
3591 eunicefix='$eunicefix'
3592 loclist='$loclist'
3593 expr='$expr'
3594 sed='$sed'
3595 echo='$echo'
3596 cat='$cat'
3597 rm='$rm'
3598 mv='$mv'
3599 cp='$cp'
3600 tail='$tail'
3601 tr='$tr'
3602 mkdir='$mkdir'
3603 sort='$sort'
3604 uniq='$uniq'
3605 grep='$grep'
3606 trylist='$trylist'
3607 test='$test'
3608 inews='$inews'
3609 egrep='$egrep'
3610 more='$more'
3611 pg='$pg'
3612 Mcc='$Mcc'
3613 vi='$vi'
3614 mailx='$mailx'
3615 mail='$mail'
3616 cpp='$cpp'
3617 perl='$perl'
3618 emacs='$emacs'
3619 ls='$ls'
3620 rmail='$rmail'
3621 sendmail='$sendmail'
3622 shar='$shar'
3623 smail='$smail'
3624 tbl='$tbl'
3625 troff='$troff'
3626 nroff='$nroff'
3627 uname='$uname'
3628 uuname='$uuname'
3629 line='$line'
3630 chgrp='$chgrp'
3631 chmod='$chmod'
3632 lint='$lint'
3633 sleep='$sleep'
3634 pr='$pr'
3635 tar='$tar'
3636 ln='$ln'
3637 lpr='$lpr'
3638 lp='$lp'
3639 touch='$touch'
3640 make='$make'
3641 date='$date'
3642 csh='$csh'
3643 bash='$bash'
3644 ksh='$ksh'
3645 lex='$lex'
3646 flex='$flex'
3647 bison='$bison'
3648 Log='$Log'
3649 Header='$Header'
3650 Id='$Id'
3651 lastuname='$lastuname'
3652 alignbytes='$alignbytes'
3653 bin='$bin'
3654 installbin='$installbin'
3655 byteorder='$byteorder'
3656 contains='$contains'
3657 cppstdin='$cppstdin'
3658 cppminus='$cppminus'
3659 d_bcmp='$d_bcmp'
3660 d_bcopy='$d_bcopy'
3661 d_bzero='$d_bzero'
3662 d_castneg='$d_castneg'
3663 castflags='$castflags'
3664 d_charsprf='$d_charsprf'
3665 d_chsize='$d_chsize'
3666 d_crypt='$d_crypt'
3667 cryptlib='$cryptlib'
3668 d_csh='$d_csh'
3669 d_dosuid='$d_dosuid'
3670 d_dup2='$d_dup2'
3671 d_fchmod='$d_fchmod'
3672 d_fchown='$d_fchown'
3673 d_fcntl='$d_fcntl'
3674 d_flexfnam='$d_flexfnam'
3675 d_flock='$d_flock'
3676 d_getgrps='$d_getgrps'
3677 d_gethent='$d_gethent'
3678 d_getpgrp='$d_getpgrp'
3679 d_getpgrp2='$d_getpgrp2'
3680 d_getprior='$d_getprior'
3681 d_htonl='$d_htonl'
3682 d_index='$d_index'
3683 d_killpg='$d_killpg'
3684 d_lstat='$d_lstat'
3685 d_memcmp='$d_memcmp'
3686 d_memcpy='$d_memcpy'
3687 d_mkdir='$d_mkdir'
3688 d_msg='$d_msg'
3689 d_msgctl='$d_msgctl'
3690 d_msgget='$d_msgget'
3691 d_msgrcv='$d_msgrcv'
3692 d_msgsnd='$d_msgsnd'
3693 d_ndbm='$d_ndbm'
3694 d_odbm='$d_odbm'
3695 d_open3='$d_open3'
3696 d_readdir='$d_readdir'
3697 d_rename='$d_rename'
3698 d_rmdir='$d_rmdir'
3699 d_select='$d_select'
3700 d_sem='$d_sem'
3701 d_semctl='$d_semctl'
3702 d_semget='$d_semget'
3703 d_semop='$d_semop'
3704 d_setegid='$d_setegid'
3705 d_seteuid='$d_seteuid'
3706 d_setpgrp='$d_setpgrp'
3707 d_setpgrp2='$d_setpgrp2'
3708 d_setprior='$d_setprior'
3709 d_setregid='$d_setregid'
3710 d_setresgid='$d_setresgid'
3711 d_setreuid='$d_setreuid'
3712 d_setresuid='$d_setresuid'
3713 d_setrgid='$d_setrgid'
3714 d_setruid='$d_setruid'
3715 d_shm='$d_shm'
3716 d_shmat='$d_shmat'
3717 d_voidshmat='$d_voidshmat'
3718 d_shmctl='$d_shmctl'
3719 d_shmdt='$d_shmdt'
3720 d_shmget='$d_shmget'
3721 d_socket='$d_socket'
3722 d_sockpair='$d_sockpair'
3723 d_oldsock='$d_oldsock'
3724 socketlib='$socketlib'
3725 d_statblks='$d_statblks'
3726 d_stdstdio='$d_stdstdio'
3727 d_strctcpy='$d_strctcpy'
3728 d_strerror='$d_strerror'
3729 d_symlink='$d_symlink'
3730 d_syscall='$d_syscall'
3731 d_truncate='$d_truncate'
3732 d_vfork='$d_vfork'
3733 d_voidsig='$d_voidsig'
3734 d_tosignal='$d_tosignal'
3735 d_volatile='$d_volatile'
3736 d_vprintf='$d_vprintf'
3737 d_charvspr='$d_charvspr'
3738 d_wait4='$d_wait4'
3739 d_waitpid='$d_waitpid'
3740 gidtype='$gidtype'
3741 groupstype='$groupstype'
3742 i_fcntl='$i_fcntl'
3743 i_gdbm='$i_gdbm'
3744 i_grp='$i_grp'
3745 i_niin='$i_niin'
3746 i_sysin='$i_sysin'
3747 i_pwd='$i_pwd'
3748 d_pwquota='$d_pwquota'
3749 d_pwage='$d_pwage'
3750 d_pwchange='$d_pwchange'
3751 d_pwclass='$d_pwclass'
3752 d_pwexpire='$d_pwexpire'
3753 d_pwcomment='$d_pwcomment'
3754 i_sys_file='$i_sys_file'
3755 i_sysioctl='$i_sysioctl'
3756 i_time='$i_time'
3757 i_sys_time='$i_sys_time'
3758 i_sys_select='$i_sys_select'
3759 d_systimekernel='$d_systimekernel'
3760 i_utime='$i_utime'
3761 i_varargs='$i_varargs'
3762 i_vfork='$i_vfork'
3763 intsize='$intsize'
3764 libc='$libc'
3765 nm_opts='$nm_opts'
3766 libndir='$libndir'
3767 i_my_dir='$i_my_dir'
3768 i_ndir='$i_ndir'
3769 i_sys_ndir='$i_sys_ndir'
3770 i_dirent='$i_dirent'
3771 i_sys_dir='$i_sys_dir'
3772 d_dirnamlen='$d_dirnamlen'
3773 ndirc='$ndirc'
3774 ndiro='$ndiro'
3775 mallocsrc='$mallocsrc'
3776 mallocobj='$mallocobj'
3777 d_mymalloc='$d_mymalloc'
3778 mallocptrtype='$mallocptrtype'
3779 mansrc='$mansrc'
3780 manext='$manext'
3781 models='$models'
3782 split='$split'
3783 small='$small'
3784 medium='$medium'
3785 large='$large'
3786 huge='$huge'
3787 optimize='$optimize'
3788 ccflags='$ccflags'
3789 cppflags='$cppflags'
3790 ldflags='$ldflags'
3791 cc='$cc'
3792 nativegcc='$nativegcc'
3793 libs='$libs'
3794 n='$n'
3795 c='$c'
3796 package='$package'
3797 randbits='$randbits'
3798 scriptdir='$scriptdir'
3799 installscr='$installscr'
3800 sig_name='$sig_name'
3801 spitshell='$spitshell'
3802 shsharp='$shsharp'
3803 sharpbang='$sharpbang'
3804 startsh='$startsh'
3805 stdchar='$stdchar'
3806 uidtype='$uidtype'
3807 usrinclude='$usrinclude'
3808 inclPath='$inclPath'
3809 void='$void'
3810 voidhave='$voidhave'
3811 voidwant='$voidwant'
3812 w_localtim='$w_localtim'
3813 w_s_timevl='$w_s_timevl'
3814 w_s_tm='$w_s_tm'
3815 yacc='$yacc'
3816 lib='$lib'
3817 privlib='$privlib'
3818 installprivlib='$installprivlib'
3819 EOT
3820
3821 test -f patchlevel.h && awk '{printf "%s=%s\n",$2,$3}' patchlevel.h >>config.sh
3822 echo "CONFIG=true" >>config.sh
3823
3824 if test -f UU/oldconfig.sh; then
3825     sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
3826       sort | uniq -u >UU/oldsyms
3827     set X `cat UU/oldsyms`
3828     shift
3829     case $# in
3830     0) ;;
3831     *)  echo "Hmm...You had some extra variables I don't know about...I'll try to keep 'em..."
3832         for sym in `cat UU/oldsyms`; do
3833             echo "    Propagating $hint variable "'$'"$sym..."
3834             eval 'tmp="$'"${sym}"'"'
3835             echo "$tmp" | \
3836               sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
3837         done
3838         ;;
3839     esac
3840 fi
3841
3842 : Finish up
3843 CONFIG=true
3844
3845 echo " "
3846 dflt=''
3847 fastread=''
3848 echo "If you didn't make any mistakes, then just type a carriage return here."
3849 rp="If you need to edit config.sh, do it as a shell escape here:"
3850 $echo $n "$rp $c"
3851 . UU/myread
3852 case "$ans" in
3853 '') ;;
3854 *) : in case they cannot read
3855     eval $ans;;
3856 esac
3857 chmod +x doSH
3858 ./doSH
3859
3860 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
3861     dflt=n
3862     $cat <<EOM
3863
3864 Now you need to generate make dependencies by running "make depend".
3865 You might prefer to run it in background: "make depend > makedepend.out &"
3866 It can take a while, so you might not want to run it right now.
3867
3868 EOM
3869     rp="Run make depend now? [$dflt]"
3870     $echo $n "$rp $c"
3871     . UU/myread
3872     case "$ans" in
3873     y*) make depend && echo "Now you must run a make."
3874         ;;
3875     *)  echo "You must run 'make depend' then 'make'."
3876         ;;
3877     esac
3878 elif test -f [Mm]akefile; then
3879     echo " "
3880     echo "Now you must run a make."
3881 else
3882     echo "Done."
3883 fi
3884
3885 $rm -f kit*isdone
3886 $rm -rf UU
3887 : end of Configure