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