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