81be1407ddc17d9bcfeb37d90c1f0fbcc8e05fed
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them.  Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh, I would
7 # suggest you cut out the prototypical config.h from the end of Configure
8 # and edit it to reflect your system.  Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # $Header: Configure,v 2.0.1.1 88/06/28 16:24:02 root Exp $
12 #
13 # Yes, you may rip this off to use in other distribution packages.
14 # (Note: this Configure script was generated automatically.  Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.)
16
17 : sanity checks
18 PATH='.:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc:/usr/new:/usr/new/bin:/usr/nbin'
19 export PATH || (echo "OOPS, this isn't sh.  Desperation time.  I will feed myself to sh."; sh $0; kill $$)
20
21 if test ! -t 0; then
22     echo "Say 'sh Configure', not 'sh <Configure'"
23     exit 1
24 fi
25
26 (alias) >/dev/null 2>&1 && \
27     echo "(I see you are using the Korn shell.  Some ksh's blow up on Configure," && \
28     echo "especially on exotic machines.  If yours does, try the Bourne shell instead.)"
29
30 if test ! -d ../UU; then
31     if test ! -d UU; then
32         mkdir UU
33     fi
34     cd UU
35 fi
36
37 case "$1" in
38 -d) shift; fastread='yes';;
39 esac
40
41 d_eunice=''
42 eunicefix=''
43 define=''
44 loclist=''
45 expr=''
46 sed=''
47 echo=''
48 cat=''
49 rm=''
50 mv=''
51 cp=''
52 tail=''
53 tr=''
54 mkdir=''
55 sort=''
56 uniq=''
57 grep=''
58 trylist=''
59 test=''
60 inews=''
61 egrep=''
62 more=''
63 pg=''
64 Mcc=''
65 vi=''
66 mailx=''
67 mail=''
68 cpp=''
69 Log=''
70 Header=''
71 bin=''
72 cc=''
73 contains=''
74 cppstdin=''
75 cppminus=''
76 d_bcopy=''
77 d_charsprf=''
78 d_crypt=''
79 d_dosuid=''
80 d_fchmod=''
81 d_fchown=''
82 d_getgrps=''
83 d_index=''
84 d_killpg=''
85 d_memcpy=''
86 d_rename=''
87 d_setegid=''
88 d_seteuid=''
89 d_setrgid=''
90 d_setruid=''
91 d_statblks=''
92 d_stdstdio=''
93 d_strcspn=''
94 d_strctcpy=''
95 d_symlink=''
96 d_tminsys=''
97 d_vfork=''
98 d_voidsig=''
99 gidtype=''
100 libc=''
101 libnm=''
102 mallocsrc=''
103 mallocobj=''
104 usemymalloc=''
105 mansrc=''
106 manext=''
107 models=''
108 split=''
109 small=''
110 medium=''
111 large=''
112 huge=''
113 ccflags=''
114 ldflags=''
115 n=''
116 c=''
117 package=''
118 spitshell=''
119 shsharp=''
120 sharpbang=''
121 startsh=''
122 stdchar=''
123 uidtype=''
124 voidflags=''
125 defvoidused=''
126 privlib=''
127 CONFIG=''
128 : set package name
129 package=perl
130
131 echo " "
132 echo "Beginning of configuration questions for $package kit."
133 : Eunice requires " " instead of "", can you believe it
134 echo " "
135
136 define='define'
137 undef='undef'
138 libpth='/usr/lib /usr/local/lib /lib'
139 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
140 rmlist='kit[1-9]isdone kit[1-9][0-9]isdone'
141 trap 'echo " "; rm -f $rmlist; exit 1' 1 2 3
142
143 : We must find out about Eunice early
144 eunicefix=':'
145 if test -f /etc/unixtovms; then
146     eunicefix=/etc/unixtovms
147 fi
148 if test -f /etc/unixtovms.exe; then
149     eunicefix=/etc/unixtovms.exe
150 fi
151
152 attrlist="mc68000 sun gcos unix ibm gimpel interdata tss os mert pyr"
153 attrlist="$attrlist vax pdp11 i8086 z8000 u3b2 u3b5 u3b20 u3b200"
154 attrlist="$attrlist ns32000 ns16000 iAPX286 mc300 mc500 mc700 sparc"
155 attrlist="$attrlist nsc32000 sinix xenix venix posix ansi M_XENIX"
156 attrlist="$attrlist $mc68k __STDC__"
157 pth="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /etc /usr/lib /lib"
158 d_newshome="../../NeWS"
159 defvoidused=7
160
161 : some greps do not return status, grrr.
162 echo "grimblepritz" >grimble
163 if grep blurfldyick grimble >/dev/null 2>&1 ; then
164     contains=contains
165 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
166     contains=grep
167 else
168     contains=contains
169 fi
170 rm -f grimble
171 : the following should work in any shell
172 case "$contains" in
173 contains*)
174     echo " "
175     echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
176     cat >contains <<'EOSS'
177 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
178 EOSS
179 chmod +x contains
180 esac
181
182 : first determine how to suppress newline on echo command
183 echo "Checking echo to see how to suppress newlines..."
184 (echo "hi there\c" ; echo " ") >.echotmp
185 if $contains c .echotmp >/dev/null 2>&1 ; then
186     echo "...using -n."
187     n='-n'
188     c=''
189 else
190     cat <<'EOM'
191 ...using \c
192 EOM
193     n=''
194     c='\c'
195 fi
196 echo $n "Type carriage return to continue.  Your cursor should be here-->$c"
197 read ans
198 rm -f .echotmp
199
200 : now set up to do reads with possible shell escape and default assignment
201 cat <<EOSC >myread
202 case "\$fastread" in
203 yes) ans=''; echo " " ;;
204 *) ans='!';;
205 esac
206 while expr "X\$ans" : "X!" >/dev/null; do
207     read ans
208     case "\$ans" in
209     !)
210         sh
211         echo " "
212         echo $n "\$rp $c"
213         ;;
214     !*)
215         set \`expr "X\$ans" : "X!\(.*\)\$"\`
216         sh -c "\$*"
217         echo " "
218         echo $n "\$rp $c"
219         ;;
220     esac
221 done
222 rp='Your answer:'
223 case "\$ans" in
224 '') ans="\$dflt";;
225 esac
226 EOSC
227
228 : general instructions
229 cat <<EOH
230  
231 This installation shell script will examine your system and ask you questions
232 to determine how the $package package should be installed.  If you get stuck
233 on a question, you may use a ! shell escape to start a subshell or execute
234 a command.  Many of the questions will have default answers in square
235 brackets--typing carriage return will give you the default.
236
237 On some of the questions which ask for file or directory names you are
238 allowed to use the ~name construct to specify the login directory belonging
239 to "name", even if you don't have a shell which knows about that.  Questions
240 where this is allowed will be marked "(~name ok)".
241
242 EOH
243 rp="[Type carriage return to continue]"
244 echo $n "$rp $c"
245 . myread
246 cat <<EOH
247
248 Much effort has been expended to ensure that this shell script will run
249 on any Unix system.  If despite that it blows up on you, your best bet is
250 to edit Configure and run it again. Also, let me (lwall@jpl-devvax.jpl.nasa.gov)
251 know how I blew it.  If you can't run Configure for some reason, you'll have
252 to generate a config.sh file by hand.
253
254 This installation script affects things in two ways: 1) it may do direct
255 variable substitutions on some of the files included in this kit, and
256 2) it builds a config.h file for inclusion in C programs.  You may edit
257 any of these files as the need arises after running this script.
258
259 If you make a mistake on a question, there is no easy way to back up to it
260 currently.  The easiest thing to do is to edit config.sh and rerun all the
261 SH files.  Configure will offer to let you do this before it runs the SH files.
262
263 EOH
264 rp="[Type carriage return to continue]"
265 echo $n "$rp $c"
266 . myread
267
268 : get old answers, if there is a config file out there
269 if test -f ../config.sh; then
270     echo " "
271     dflt=y
272     rp="I see a config.sh file.  Did Configure make it on THIS system? [$dflt]"
273     echo $n "$rp $c"
274     . myread
275     case "$ans" in
276     n*) echo "OK, I'll ignore it.";;
277     *)  echo "Fetching default answers from your old config.sh file..."
278         tmp="$n"
279         ans="$c"
280         . ../config.sh
281         n="$tmp"
282         c="$ans"
283         ;;
284     esac
285 fi
286
287 : find out where common programs are
288 echo " "
289 echo "Locating common programs..."
290 cat <<EOSC >loc
291 $startsh
292 case \$# in
293 0) exit 1;;
294 esac
295 thing=\$1
296 shift
297 dflt=\$1
298 shift
299 for dir in \$*; do
300     case "\$thing" in
301     .)
302         if test -d \$dir/\$thing; then
303             echo \$dir
304             exit 0
305         fi
306         ;;
307     *)
308         if test -f \$dir/\$thing; then
309             echo \$dir/\$thing
310             exit 0
311         elif test -f \$dir/\$thing.exe; then
312             : on Eunice apparently
313             echo \$dir/\$thing
314             exit 0
315         fi
316         ;;
317     esac
318 done
319 echo \$dflt
320 exit 1
321 EOSC
322 chmod +x loc
323 $eunicefix loc
324 loclist="
325 expr
326 sed
327 echo
328 cat
329 rm
330 mv
331 cp
332 tr
333 mkdir
334 sort
335 uniq
336 grep
337 "
338 trylist="
339 test
340 egrep
341 Mcc
342 cpp
343 "
344 for file in $loclist; do
345     xxx=`loc $file $file $pth`
346     eval $file=$xxx
347     eval _$file=$xxx
348     case "$xxx" in
349     /*)
350         echo $file is in $xxx.
351         ;;
352     *)
353         echo "I don't know where $file is.  I hope it's in everyone's PATH."
354         ;;
355     esac
356 done
357 echo " "
358 echo "Don't worry if any of the following aren't found..."
359 ans=offhand
360 for file in $trylist; do
361     xxx=`loc $file $file $pth`
362     eval $file=$xxx
363     eval _$file=$xxx
364     case "$xxx" in
365     /*)
366         echo $file is in $xxx.
367         ;;
368     *)
369         echo "I don't see $file out there, $ans."
370         ans=either
371         ;;
372     esac
373 done
374 case "$egrep" in
375 egrep)
376     echo "Substituting grep for egrep."
377     egrep=$grep
378     ;;
379 esac
380 case "$test" in
381 test)
382     echo "Hopefully test is built into your sh."
383     ;;
384 /bin/test)
385     echo " "
386     dflt=n
387     rp="Is your "'"'"test"'"'" built into sh? [$dflt] (OK to guess)"
388     echo $n "$rp $c"
389     . myread
390     case "$ans" in
391     y*) test=test ;;
392     esac
393     ;;
394 *)
395     test=test
396     ;;
397 esac
398 case "$echo" in
399 echo)
400     echo "Hopefully echo is built into your sh."
401     ;;
402 /bin/echo)
403     echo " "
404     echo "Checking compatibility between /bin/echo and builtin echo (if any)..."
405     $echo $n "hi there$c" >foo1
406     echo $n "hi there$c" >foo2
407     if cmp foo1 foo2 >/dev/null 2>&1; then
408         echo "They are compatible.  In fact, they may be identical."
409     else
410         case "$n" in
411         '-n') n='' c='\c' ans='\c' ;;
412         *) n='-n' c='' ans='-n' ;;
413         esac
414         cat <<FOO
415 They are not compatible!  You are probably running ksh on a non-USG system.
416 I'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
417 have echo built in and we may have to run some Bourne shell scripts.  That
418 means I'll have to use $ans to suppress newlines now.  Life is ridiculous.
419
420 FOO
421         rp="Your cursor should be here-->"
422         $echo $n "$rp$c"
423         . myread
424     fi
425     $rm -f foo1 foo2
426     ;;
427 *)
428     : cross your fingers
429     echo=echo
430     ;;
431 esac
432 rmlist="$rmlist loc"
433
434 : get list of predefined functions in a handy place
435 echo " "
436 if test -f /lib/libc.a; then
437     echo "Your C library is in /lib/libc.a.  You're normal."
438     libc=/lib/libc.a
439 else
440     ans=`loc libc.a blurfl/dyick $libpth`
441     if test ! -f $ans; then
442         ans=`loc clib blurfl/dyick $libpth`
443     fi
444     if test ! -f $ans; then
445         ans=`loc libc blurfl/dyick $libpth`
446     fi
447     if test -f $ans; then
448         echo "Your C library is in $ans, of all places."
449         libc=$ans
450     else
451         if test -f "$libc"; then
452             echo "Your C library is in $libc, like you said before."
453         else
454             cat <<EOM
455  
456 I can't seem to find your C library.  I've looked in the following places:
457
458         $libpth
459
460 None of these seems to contain your C library.  What is the full name
461 EOM
462             dflt=None
463             $echo $n "of your C library? $c"
464             rp='C library full name?'
465             . myread
466             libc="$ans"
467         fi
468     fi
469 fi
470 echo " "
471 $echo $n "Extracting names from $libc for later perusal...$c"
472 nm $libc 2>/dev/null | sed -n -e 's/^.* T _//p' -e 's/^.* T //p' > libc.list
473 if $contains '^printf$' libc.list >/dev/null 2>&1; then
474     echo "done"
475 else
476     nm $libc 2>/dev/null | sed -n -e 's/^.* D _//p' -e 's/^.* D //p' > libc.list
477     if $contains '^printf$' libc.list >/dev/null 2>&1; then
478         echo "done"
479     else
480         echo " "
481         echo "nm didn't seem to work right."
482         echo "Trying ar instead..."
483         rmlist="$rmlist libc.tmp"
484         if ar t $libc > libc.tmp; then
485             sed -e 's/\.o$//' < libc.tmp > libc.list
486             echo "Ok."
487         else
488             echo "ar didn't seem to work right."
489             echo "Maybe this is a Cray...trying bld instead..."
490             if bld t $libc | sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
491                 echo "Ok."
492             else
493                 echo "That didn't work either.  Giving up."
494                 exit 1
495             fi
496         fi
497     fi
498 fi
499 rmlist="$rmlist libc.list"
500
501 : make some quick guesses about what we are up against
502 echo " "
503 $echo $n "Hmm...  $c"
504 if $contains SIGTSTP /usr/include/signal.h >/dev/null 2>&1 ; then
505     echo "Looks kind of like a BSD system, but we'll see..."
506     echo exit 0 >bsd
507     echo exit 1 >usg
508     echo exit 1 >v7
509 elif $contains '^fcntl$' libc.list >/dev/null 2>&1 ; then
510     echo "Looks kind of like a USG system, but we'll see..."
511     echo exit 1 >bsd
512     echo exit 0 >usg
513     echo exit 1 >v7
514 else
515     echo "Looks kind of like a version 7 system, but we'll see..."
516     echo exit 1 >bsd
517     echo exit 1 >usg
518     echo exit 0 >v7
519 fi
520 if $contains '^vmssystem$' libc.list >/dev/null 2>&1 ; then
521     cat <<'EOI'
522 There is, however, a strange, musty smell in the air that reminds me of
523 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
524 EOI
525     echo "exit 0" >eunice
526     eunicefix=unixtovms
527     d_eunice="$define"
528 : it so happens the Eunice I know will not run shell scripts in Unix format
529 else
530     echo " "
531     echo "Congratulations.  You aren't running Eunice."
532     eunicefix=':'
533     d_eunice="$undef"
534     echo "exit 1" >eunice
535 fi
536 if test -f /xenix; then
537     echo "Actually, this looks more like a XENIX system..."
538     echo "exit 0" >xenix
539 else
540     echo " "
541     echo "It's not Xenix..."
542     echo "exit 1" >xenix
543 fi
544 chmod +x xenix
545 $eunicefix xenix
546 if test -f /venix; then
547     echo "Actually, this looks more like a VENIX system..."
548     echo "exit 0" >venix
549 else
550     echo " "
551     if xenix; then
552         : null
553     else
554         echo "Nor is it Venix..."
555     fi
556     echo "exit 1" >venix
557 fi
558 chmod +x bsd usg v7 eunice venix
559 $eunicefix bsd usg v7 eunice venix
560 rmlist="$rmlist bsd usg v7 eunice venix xenix"
561
562 : see if sh knows # comments
563 echo " "
564 echo "Checking your sh to see if it knows about # comments..."
565 if sh -c '#' >/dev/null 2>&1 ; then
566     echo "Your sh handles # comments correctly."
567     shsharp=true
568     spitshell=cat
569     echo " "
570     echo "Okay, let's see if #! works on this system..."
571     echo "#!/bin/echo hi" > try
572     $eunicefix try
573     chmod +x try
574     try > today
575     if $contains hi today >/dev/null 2>&1; then
576         echo "It does."
577         sharpbang='#!'
578     else
579         echo "#! /bin/echo hi" > try
580         $eunicefix try
581         chmod +x try
582         try > today
583         if test -s today; then
584             echo "It does."
585             sharpbang='#! '
586         else
587             echo "It doesn't."
588             sharpbang=': use '
589         fi
590     fi
591 else
592     echo "Your sh doesn't grok # comments--I will strip them later on."
593     shsharp=false
594     echo "exec grep -v '^#'" >spitshell
595     chmod +x spitshell
596     $eunicefix spitshell
597     spitshell=`pwd`/spitshell
598     echo "I presume that if # doesn't work, #! won't work either!"
599     sharpbang=': use '
600 fi
601
602 : figure out how to guarantee sh startup
603 echo " "
604 echo "Checking out how to guarantee sh startup..."
605 startsh=$sharpbang'/bin/sh'
606 echo "Let's see if '$startsh' works..."
607 cat >try <<EOSS
608 $startsh
609 set abc
610 test "$?abc" != 1
611 EOSS
612
613 chmod +x try
614 $eunicefix try
615 if try; then
616     echo "Yup, it does."
617 else
618     echo "Nope.  You may have to fix up the shell scripts to make sure sh runs them."
619 fi
620 rm -f try today
621
622 : see how we invoke the C preprocessor
623 echo " "
624 echo "Now, how can we feed standard input to your C preprocessor..."
625 cat <<'EOT' >testcpp.c
626 #define ABC abc
627 #define XYZ xyz
628 ABC.XYZ
629 EOT
630 echo 'Maybe "'$cpp'" will work...'
631 $cpp <testcpp.c >testcpp.out 2>&1
632 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
633     echo "Yup, it does."
634     cppstdin="$cpp"
635     cppminus='';
636 else
637     echo 'Nope, maybe "'$cpp' -" will work...'
638     $cpp - <testcpp.c >testcpp.out 2>&1
639     if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
640         echo "Yup, it does."
641         cppstdin="$cpp"
642         cppminus='-';
643     else
644         echo 'No such luck...maybe "cc -E" will work...'
645         cc -E <testcpp.c >testcpp.out 2>&1
646         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
647             echo "It works!"
648             cppstdin='cc -E'
649             cppminus='';
650         else
651             echo 'Nixed again...maybe "cc -E -" will work...'
652             cc -E - <testcpp.c >testcpp.out 2>&1
653             if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
654                 echo "Hooray, it works!  I was beginning to wonder."
655                 cppstdin='cc -E'
656                 cppminus='-';
657             else
658                 echo 'Nope...maybe "cc -P" will work...'
659                 cc -P <testcpp.c >testcpp.out 2>&1
660                 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
661                     echo "Yup, that does."
662                     cppstdin='cc -P'
663                     cppminus='';
664                 else
665                     echo 'Nope...maybe "cc -P -" will work...'
666                     cc -P - <testcpp.c >testcpp.out 2>&1
667                     if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
668                         echo "Yup, that does."
669                         cppstdin='cc -P'
670                         cppminus='-';
671                     else
672                         echo 'Hmm...perhaps you already told me...'
673                         case "$cppstdin" in
674                         '') ;;
675                         *) $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1;;
676                         esac
677                         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
678                             echo "Hooray, you did!  I was beginning to wonder."
679                         else
680                             echo 'Uh-uh.  Time to get fancy...'
681                             echo 'Trying (cat >/tmp/$$.c; cc -E /tmp/$$.c; rm /tmp/$$.c)'
682                             cppstdin='(cat >/tmp/$$.c; cc -E /tmp/$$.c; rm /tmp/$$.c)'
683                             cppminus='';
684                             $cppstdin <testcpp.c >testcpp.out 2>&1
685                             if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
686                                 echo "Eureka!."
687                             else
688                                 dflt=blurfl
689                                 $echo $n "No dice.  I can't find a C preprocessor.  Name one: $c"
690                                 rp='Name a C preprocessor:'
691                                 . myread
692                                 cppstdin="$ans"
693                                 $cppstdin <testcpp.c >testcpp.out 2>&1
694                                 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
695                                     echo "OK, that will do."
696                                 else
697                                     echo "Sorry, I can't get that to work.  Go find one."
698                                     exit 1
699                                 fi
700                             fi
701                         fi
702                     fi
703                 fi
704             fi
705         fi
706     fi
707 fi
708 rm -f testcpp.c testcpp.out
709
710 : see if bcopy exists
711 echo " "
712 if $contains '^bcopy$' libc.list >/dev/null 2>&1; then
713     echo 'bcopy() found.'
714     d_bcopy="$define"
715 else
716     echo 'bcopy() not found.'
717     d_bcopy="$undef"
718 fi
719
720 : see if sprintf is declared as int or pointer to char
721 echo " "
722 cat >.ucbsprf.c <<'EOF'
723 main() { char buf[10]; exit((unsigned long)sprintf(buf,"%s","foo") > 10L); }
724 EOF
725 if cc .ucbsprf.c -o .ucbsprf >/dev/null 2>&1 && .ucbsprf; then
726     echo "Your sprintf() returns (int)."
727     d_charsprf="$undef"
728 else
729     echo "Your sprintf() returns (char*)."
730     d_charsprf="$define"
731 fi
732 /bin/rm -f .ucbsprf.c .ucbsprf
733
734 : see if crypt exists
735 echo " "
736 if $contains '^crypt$' libc.list >/dev/null 2>&1; then
737     echo 'crypt() found.'
738     d_crypt="$define"
739 else
740     echo 'crypt() not found.'
741     d_crypt="$undef"
742 fi
743
744 : now see if they want to do setuid emulation
745 case "$d_dosuid" in
746 '') if bsd; then
747         dflt=y
748     else
749         dflt=n
750     fi
751     ;;
752 *undef*) dflt=n;;
753 *) dflt=y;;
754 esac
755 cat <<EOM
756  
757 Some sites have disabled setuid #! scripts because of a bug in the kernel
758 that prevents them from being secure.  If you are on such a system, the
759 setuid/setgid bits on scripts are currently useless.  It is possible for
760 $package to detect those bits and emulate setuid/setgid in a secure fashion
761 until a better solution is devised for the kernel problem.
762
763 EOM
764 rp="Do you want to do setuid/setgid emulation? [$dflt]"
765 echo $n "$rp $c"
766 . myread
767 case "$ans" in
768 '') $ans="$dflt";;
769 esac
770 case "$ans" in
771 y*)  d_dosuid="$define";;
772 *) d_dosuid="$undef";;
773 esac
774
775 : see if fchmod exists
776 echo " "
777 if $contains '^fchmod$' libc.list >/dev/null 2>&1; then
778     echo 'fchmod() found.'
779     d_fchmod="$define"
780 else
781     echo 'fchmod() not found.'
782     d_fchmod="$undef"
783 fi
784
785 : see if fchown exists
786 echo " "
787 if $contains '^fchown$' libc.list >/dev/null 2>&1; then
788     echo 'fchown() found.'
789     d_fchown="$define"
790 else
791     echo 'fchown() not found.'
792     d_fchown="$undef"
793 fi
794
795 : see if getgroups exists
796 echo " "
797 if $contains '^getgroups$' libc.list >/dev/null 2>&1; then
798     echo 'getgroups() found.'
799     d_getgrps="$define"
800 else
801     echo 'getgroups() not found.'
802     d_getgrps="$undef"
803 fi
804
805 : index or strcpy
806 echo " "
807 case "$d_index" in
808 n) dflt=n;;
809 *) dflt=y;;
810 esac
811 if $contains '^index$' libc.list >/dev/null 2>&1 ; then
812     if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
813         echo "Your system has both index() and strchr().  Shall I use"
814         rp="index() rather than strchr()? [$dflt]"
815         $echo $n "$rp $c"
816         . myread
817         case "$ans" in
818             n*) d_index="$define" ;;
819             *)  d_index="$undef" ;;
820         esac
821     else
822         d_index="$undef"
823         echo "index() found."
824     fi
825 else
826     if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
827         d_index="$define"
828         echo "strchr() found."
829     else
830         echo "No index() or strchr() found!"
831         d_index="$undef"
832     fi
833 fi
834
835 : see if killpg exists
836 echo " "
837 if $contains '^killpg$' libc.list >/dev/null 2>&1; then
838     echo 'killpg() found.'
839     d_killpg="$define"
840 else
841     echo 'killpg() not found.'
842     d_killpg="$undef"
843 fi
844
845 : see if memcpy exists
846 echo " "
847 if $contains '^memcpy$' libc.list >/dev/null 2>&1; then
848     echo 'memcpy() found.'
849     d_memcpy="$define"
850 else
851     echo 'memcpy() not found.'
852     d_memcpy="$undef"
853 fi
854
855 : see if rename exists
856 echo " "
857 if $contains '^rename$' libc.list >/dev/null 2>&1; then
858     echo 'rename() found.'
859     d_rename="$define"
860 else
861     echo 'rename() not found.'
862     d_rename="$undef"
863 fi
864
865 : see if setegid exists
866 echo " "
867 if $contains '^setegid$' libc.list >/dev/null 2>&1; then
868     echo 'setegid() found.'
869     d_setegid="$define"
870 else
871     echo 'setegid() not found.'
872     d_setegid="$undef"
873 fi
874
875 : see if seteuid exists
876 echo " "
877 if $contains '^seteuid$' libc.list >/dev/null 2>&1; then
878     echo 'seteuid() found.'
879     d_seteuid="$define"
880 else
881     echo 'seteuid() not found.'
882     d_seteuid="$undef"
883 fi
884
885 : see if setrgid exists
886 echo " "
887 if $contains '^setrgid$' libc.list >/dev/null 2>&1; then
888     echo 'setrgid() found.'
889     d_setrgid="$define"
890 else
891     echo 'setrgid() not found.'
892     d_setrgid="$undef"
893 fi
894
895 : see if setruid exists
896 echo " "
897 if $contains '^setruid$' libc.list >/dev/null 2>&1; then
898     echo 'setruid() found.'
899     d_setruid="$define"
900 else
901     echo 'setruid() not found.'
902     d_setruid="$undef"
903 fi
904
905 : see if stat knows about block sizes
906 echo " "
907 if $contains 'st_blocks;' /usr/include/sys/stat.h >/dev/null 2>&1 ; then
908     if $contains 'st_blksize;' /usr/include/sys/stat.h >/dev/null 2>&1 ; then
909         echo "Your stat knows about block sizes."
910         d_statblks="$define"
911     else
912         echo "Your stat doesn't know about block sizes."
913         d_statblks="$undef"
914     fi
915 else
916     echo "Your stat doesn't know about block sizes."
917     d_statblks="$undef"
918 fi
919
920 : see if stdio is really std
921 echo " "
922 if $contains 'char.*_ptr;' /usr/include/stdio.h >/dev/null 2>&1 ; then
923     if $contains '_cnt;' /usr/include/stdio.h >/dev/null 2>&1 ; then
924         echo "Your stdio is pretty std."
925         d_stdstdio="$define"
926     else
927         echo "Your stdio isn't very std."
928         d_stdstdio="$undef"
929     fi
930 else
931     echo "Your stdio isn't very std."
932     d_stdstdio="$undef"
933 fi
934
935 : see if strcspn exists
936 echo " "
937 if $contains '^strcspn$' libc.list >/dev/null 2>&1; then
938     echo 'strcspn() found.'
939     d_strcspn="$define"
940 else
941     echo 'strcspn() not found.'
942     d_strcspn="$undef"
943 fi
944
945 : check for structure copying
946 echo " "
947 echo "Checking to see if your C compiler can copy structs..."
948 $cat >try.c <<'EOCP'
949 main()
950 {
951         struct blurfl {
952             int dyick;
953         } foo, bar;
954
955         foo = bar;
956 }
957 EOCP
958 if cc -c try.c >/dev/null 2>&1 ; then
959     d_strctcpy="$define"
960     echo "Yup, it can."
961 else
962     d_strctcpy="$undef"
963     echo "Nope, it can't."
964 fi
965 $rm -f try.*
966
967 : see if symlink exists
968 echo " "
969 if $contains '^symlink$' libc.list >/dev/null 2>&1; then
970     echo 'symlink() found.'
971     d_symlink="$define"
972 else
973     echo 'symlink() not found.'
974     d_symlink="$undef"
975 fi
976
977 : see if struct tm is defined in sys/time.h
978 echo " "
979 if $contains 'struct tm' /usr/include/time.h >/dev/null 2>&1 ; then
980     echo "You have struct tm defined in <time.h> rather than <sys/time.h>."
981     d_tminsys="$undef"
982 else
983     echo "You have struct tm defined in <sys/time.h> rather than <time.h>."
984     d_tminsys="$define"
985 fi
986
987 : see if there is a vfork
988 echo " "
989 if $contains '^vfork$' libc.list >/dev/null 2>&1 ; then
990     echo "vfork() found."
991     d_vfork="$undef"
992 else
993     echo "No vfork() found--will use fork() instead."
994     d_vfork="$define"
995 fi
996
997 : see if signal is declared as pointer to function returning int or void
998 echo " "
999 if $contains 'void.*signal' /usr/include/signal.h >/dev/null 2>&1 ; then
1000     echo "You have void (*signal())() instead of int."
1001     d_voidsig="$define"
1002 else
1003     echo "You have int (*signal())() instead of void."
1004     d_voidsig="$undef"
1005 fi
1006
1007 : check for void type
1008 echo " "
1009 $cat <<EOM
1010 Checking to see how well your C compiler groks the void type...
1011
1012   Support flag bits are:
1013     1: basic void declarations.
1014     2: arrays of pointers to functions returning void.
1015     4: operations between pointers to and addresses of void functions.
1016
1017 EOM
1018 case "$voidflags" in
1019 '')
1020     $cat >try.c <<'EOCP'
1021 #if TRY & 1
1022 void main() {
1023 #else
1024 main() {
1025 #endif
1026         extern void *moo();
1027         void *(*goo)();
1028 #if TRY & 2
1029         void (*foo[10])();
1030 #endif
1031
1032 #if TRY & 4
1033         if(*goo == moo) {
1034                 exit(0);
1035         }
1036 #endif
1037         exit(0);
1038 }
1039 EOCP
1040     if cc -S -DTRY=7 try.c >.out 2>&1 ; then
1041         voidflags=7
1042         echo "It appears to support void fully."
1043         if $contains warning .out >/dev/null 2>&1; then
1044             echo "However, you might get some warnings that look like this:"
1045             $cat .out
1046         fi
1047     else
1048         echo "Hmm, you compiler has some difficulty with void.  Checking further..."
1049         if cc -S -DTRY=1 try.c >/dev/null 2>&1 ; then
1050             echo "It supports 1..."
1051             if cc -S -DTRY=3 try.c >/dev/null 2>&1 ; then
1052                 voidflags=3
1053                 echo "And it supports 2 but not 4."
1054             else
1055                 echo "It doesn't support 2..."
1056                 if cc -S -DTRY=3 try.c >/dev/null 2>&1 ; then
1057                     voidflags=5
1058                     echo "But it supports 4."
1059                 else
1060                     voidflags=1
1061                     echo "And it doesn't support 4."
1062                 fi
1063             fi
1064         else
1065             echo "There is no support at all for void."
1066             voidflags=0
1067         fi
1068     fi
1069 esac
1070 dflt="$voidflags";
1071 rp="Your void support flags add up to what? [$dflt]"
1072 $echo $n "$rp $c"
1073 . myread
1074 voidflags="$ans"
1075 $rm -f try.* .out
1076
1077 : see what type gids are declared as in the kernel
1078 case "$gidtype" in
1079 '')
1080     if $contains 'gid_t;' /usr/include/sys/types.h >/dev/null 2>&1 ; then
1081         dflt='gid_t';
1082     else
1083         set `grep 'groups\[NGROUPS\];' /usr/include/sys/user.h 2>/dev/null` unsigned short
1084         case $1 in
1085         unsigned) dflt="$1 $2" ;;
1086         *) dflt="$1" ;;
1087         esac
1088     fi
1089     ;;
1090 *)  dflt="$gidtype"
1091     ;;
1092 esac
1093 cont=true
1094 echo " "
1095 rp="What type are group ids on this system declared as? [$dflt]"
1096 $echo $n "$rp $c"
1097 . myread
1098 gidtype="$ans"
1099
1100 : set up shell script to do ~ expansion
1101 cat >filexp <<EOSS
1102 $startsh
1103 : expand filename
1104 case "\$1" in
1105  ~/*|~)
1106     echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
1107     ;;
1108  ~*)
1109     if $test -f /bin/csh; then
1110         /bin/csh -f -c "glob \$1"
1111         echo ""
1112     else
1113         name=\`$expr x\$1 : '..\([^/]*\)'\`
1114         dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
1115         if $test ! -d "\$dir"; then
1116             me=\`basename \$0\`
1117             echo "\$me: can't locate home directory for: \$name" >&2
1118             exit 1
1119         fi
1120         case "\$1" in
1121         */*)
1122             echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
1123             ;;
1124         *)
1125             echo \$dir
1126             ;;
1127         esac
1128     fi
1129     ;;
1130 *)
1131     echo \$1
1132     ;;
1133 esac
1134 EOSS
1135 chmod +x filexp
1136 $eunicefix filexp
1137
1138 : determine where private executables go
1139 case "$privlib" in
1140 '')
1141     dflt=/usr/lib/perl
1142     test -d /usr/local/lib && dflt=/usr/local/lib/perl
1143     ;;
1144 *)  dflt="$privlib"
1145     ;;
1146 esac
1147 $cat <<EOM
1148
1149 The perl package has some perl subroutine libraries that should be put in
1150 a directory that is accessible by everyone.  Where do you want to put these
1151 EOM
1152 $echo $n "libraries? [$dflt] $c"
1153 rp="Put perl libraries where? [$dflt]"
1154 . myread
1155 privlib=`filexp $ans`
1156
1157 : see what type of char stdio uses.
1158 echo " "
1159 if $contains 'unsigned.*char.*_ptr;' /usr/include/stdio.h >/dev/null 2>&1 ; then
1160     echo "Your stdio uses unsigned chars."
1161     stdchar="unsigned char"
1162 else
1163     echo "Your stdio uses signed chars."
1164     stdchar="char"
1165 fi
1166
1167 : see what type uids are declared as in the kernel
1168 case "$uidtype" in
1169 '')
1170     if $contains 'uid_t;' /usr/include/sys/types.h >/dev/null 2>&1 ; then
1171         dflt='uid_t';
1172     else
1173         set `grep '_ruid;' /usr/include/sys/user.h 2>/dev/null` unsigned short
1174         case $1 in
1175         unsigned) dflt="$1 $2" ;;
1176         *) dflt="$1" ;;
1177         esac
1178     fi
1179     ;;
1180 *)  dflt="$uidtype"
1181     ;;
1182 esac
1183 cont=true
1184 echo " "
1185 rp="What type are user ids on this system declared as? [$dflt]"
1186 $echo $n "$rp $c"
1187 . myread
1188 uidtype="$ans"
1189
1190 : preserve RCS keywords in files with variable substitution, grrr
1191 Log='$Log'
1192 Header='$Header'
1193
1194 : determine where public executables go
1195 case "$bin" in
1196 '')
1197     dflt=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin`
1198     ;;
1199 *)  dflt="$bin"
1200     ;;
1201 esac
1202 cont=true
1203 while $test "$cont" ; do
1204     echo " "
1205     rp="Where do you want to put the public executables? [$dflt]"
1206     $echo $n "$rp $c"
1207     . myread
1208     bin="$ans"
1209     bin=`filexp $bin`
1210     if test -d $bin; then
1211         cont=''
1212     else
1213         dflt=n
1214         rp="Directory $bin doesn't exist.  Use that name anyway? [$dflt]"
1215         $echo $n "$rp $c"
1216         . myread
1217         dflt=''
1218         case "$ans" in
1219         y*) cont='';;
1220         esac
1221     fi
1222 done
1223
1224 : determine where manual pages go
1225 case "$mansrc" in
1226 '')
1227     dflt=`loc . /usr/man/man1 /usr/man/mann /usr/man/local/man1 /usr/man/u_man/man1 /usr/man/man1`
1228     ;;
1229 *)  dflt="$mansrc"
1230     ;;
1231 esac
1232 cont=true
1233 while $test "$cont" ; do
1234     echo " "
1235     rp="Where do the manual pages (source) go? [$dflt]"
1236     $echo $n "$rp $c"
1237     . myread
1238     mansrc=`filexp "$ans"`
1239     if test -d $mansrc; then
1240         cont=''
1241     else
1242         dflt=n
1243         rp="Directory $mansrc doesn't exist.  Use that name anyway? [$dflt]"
1244         $echo $n "$rp $c"
1245         . myread
1246         dflt=''
1247         case "$ans" in
1248         y*) cont='';;
1249         esac
1250     fi
1251 done
1252 case "$mansrc" in
1253 *l)
1254     manext=l
1255     ;;
1256 *n)
1257     manext=n
1258     ;;
1259 *C)
1260     manext=C
1261     ;;
1262 *)
1263     manext=1
1264     ;;
1265 esac
1266
1267 : get C preprocessor symbols handy
1268 echo " "
1269 echo $attrlist | $tr '[ - ]' '[\012-\012]' >Cppsym.know
1270 $cat <<EOSS >Cppsym
1271 $startsh
1272 case "\$1" in
1273 -l) list=true
1274     shift
1275     ;;
1276 esac
1277 unknown=''
1278 case "\$list\$#" in
1279 1|2)
1280     for sym do
1281         if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
1282             exit 0
1283         elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
1284                 :
1285         else
1286             unknown="\$unknown \$sym"
1287         fi
1288     done
1289     set X \$unknown
1290     shift
1291     ;;
1292 esac
1293 case \$# in
1294 0) exit 1;;
1295 esac
1296 echo \$* | $tr '[ - ]' '[\012-\012]' | $sed -e 's/\(.*\)/\\
1297 #ifdef \1\\
1298 exit 0; _ _ _ _\1\\      \1\\
1299 #endif\\
1300 /' >/tmp/Cppsym\$\$
1301 echo exit 1 >>/tmp/Cppsym\$\$
1302 $cppstdin $cppminus </tmp/Cppsym\$\$ >/tmp/Cppsym2\$\$
1303 case "\$list" in
1304 true) awk 'NF > 5 {print substr(\$6,2,100)}' </tmp/Cppsym2\$\$ ;;
1305 *)
1306     sh /tmp/Cppsym2\$\$
1307     status=\$?
1308     ;;
1309 esac
1310 $rm -f /tmp/Cppsym\$\$ /tmp/Cppsym2\$\$
1311 exit \$status
1312 EOSS
1313 chmod +x Cppsym
1314 $eunicefix Cppsym
1315 echo "Your C preprocessor defines the following symbols:"
1316 Cppsym -l $attrlist >Cppsym.true
1317 cat Cppsym.true
1318 rmlist="$rmlist Cppsym Cppsym.know Cppsym.true"
1319
1320 : see what memory models we can support
1321 case "$models" in
1322 '')
1323     if Cppsym pdp11; then
1324         dflt='unsplit split'
1325     else
1326         ans=`loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
1327         case "$ans" in
1328         X) dflt='none';;
1329         *)  if $test -d /lib/small || $test -d /usr/lib/small; then
1330                 dflt='small'
1331             else
1332                 dflt=''
1333             fi
1334             if $test -d /lib/medium || $test -d /usr/lib/medium; then
1335                 dflt="$dflt medium"
1336             fi
1337             if $test -d /lib/large || $test -d /usr/lib/large; then
1338                 dflt="$dflt large"
1339             fi
1340             if $test -d /lib/huge || $test -d /usr/lib/huge; then
1341                 dflt="$dflt huge"
1342             fi
1343         esac
1344     fi
1345     ;;
1346 *)  dflt="$models" ;;
1347 esac
1348 $cat <<EOM
1349  
1350 Some systems have different model sizes.  On most systems they are called
1351 small, medium, large, and huge.  On the PDP11 they are called unsplit and
1352 split.  If your system doesn't support different memory models, say "none".
1353 If you wish to force everything to one memory model, say "none" here and
1354 put the appropriate flags later when it asks you for other cc and ld flags.
1355 Venix systems may wish to put "none" and let the compiler figure things out.
1356 (In the following question multiple model names should be space separated.)
1357
1358 EOM
1359 rp="Which models are supported? [$dflt]"
1360 $echo $n "$rp $c"
1361 . myread
1362 models="$ans"
1363
1364 case "$models" in
1365 none)
1366     small=''
1367     medium=''
1368     large=''
1369     huge=''
1370     unsplit=''
1371     split=''
1372     ;;
1373 *split)
1374     case "$split" in
1375     '') 
1376         if $contains '\-i' $mansrc/ld.1 >/dev/null 2>&1 || \
1377            $contains '\-i' $mansrc/cc.1 >/dev/null 2>&1; then
1378             dflt='-i'
1379         else
1380             dflt='none'
1381         fi
1382         ;;
1383     *) dflt="$split";;
1384     esac
1385     rp="What flag indicates separate I and D space? [$dflt]"
1386     $echo $n "$rp $c"
1387     . myread
1388     case "$ans" in
1389     none) ans='';;
1390     esac
1391     split="$ans"
1392     unsplit=''
1393     ;;
1394 *large*|*small*|*medium*|*huge*)
1395     case "$model" in
1396     *large*)
1397         case "$large" in
1398         '') dflt='-Ml';;
1399         *) dflt="$large";;
1400         esac
1401         rp="What flag indicates large model? [$dflt]"
1402         $echo $n "$rp $c"
1403         . myread
1404         case "$ans" in
1405         none) ans='';
1406         esac
1407         large="$ans"
1408         ;;
1409     *) large='';;
1410     esac
1411     case "$model" in
1412     *huge*)
1413         case "$huge" in
1414         '') dflt='-Mh';;
1415         *) dflt="$huge";;
1416         esac
1417         rp="What flag indicates huge model? [$dflt]"
1418         $echo $n "$rp $c"
1419         . myread
1420         case "$ans" in
1421         none) ans='';
1422         esac
1423         huge="$ans"
1424         ;;
1425     *) huge="$large";;
1426     esac
1427     case "$model" in
1428     *medium*)
1429         case "$medium" in
1430         '') dflt='-Mm';;
1431         *) dflt="$medium";;
1432         esac
1433         rp="What flag indicates medium model? [$dflt]"
1434         $echo $n "$rp $c"
1435         . myread
1436         case "$ans" in
1437         none) ans='';
1438         esac
1439         medium="$ans"
1440         ;;
1441     *) medium="$large";;
1442     esac
1443     case "$model" in
1444     *small*)
1445         case "$small" in
1446         '') dflt='none';;
1447         *) dflt="$small";;
1448         esac
1449         rp="What flag indicates small model? [$dflt]"
1450         $echo $n "$rp $c"
1451         . myread
1452         case "$ans" in
1453         none) ans='';
1454         esac
1455         small="$ans"
1456         ;;
1457     *) small='';;
1458     esac
1459     ;;
1460 *)
1461     echo "Unrecognized memory models--you may have to edit Makefile.SH"
1462     ;;
1463 esac
1464
1465 case "$ccflags" in
1466 '') dflt='none';;
1467 *) dflt="$ccflags";;
1468 esac
1469 echo " "
1470 rp="Any additional cc flags? [$dflt]"
1471 $echo $n "$rp $c"
1472 . myread
1473 case "$ans" in
1474 none) ans='';
1475 esac
1476 ccflags="$ans"
1477
1478 case "$ldflags" in
1479 '') if venix; then
1480         dflt='-i -z'
1481     else
1482         dflt='none'
1483     fi
1484     ;;
1485 *) dflt="$ldflags";;
1486 esac
1487 echo " "
1488 rp="Any additional ld flags? [$dflt]"
1489 $echo $n "$rp $c"
1490 . myread
1491 case "$ans" in
1492 none) ans='';
1493 esac
1494 ldflags="$ans"
1495
1496 : see if we need a special compiler
1497 echo " "
1498 if usg; then
1499     case "$cc" in
1500     '')
1501         case "$Mcc" in
1502         /*) dflt='Mcc'
1503             ;;
1504         *)
1505             case "$large" in
1506             -M*)
1507                 dflt='cc'
1508                 ;;
1509             *)
1510                 if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then
1511                     dflt='cc -M'
1512                 else
1513                     dflt='cc'
1514                 fi
1515                 ;;
1516             esac
1517             ;;
1518         esac
1519         ;;
1520     *)  dflt="$cc";;
1521     esac
1522     $cat <<'EOM'
1523  
1524 On some systems the default C compiler will not resolve multiple global
1525 references that happen to have the same name.  On some such systems the
1526 "Mcc" command may be used to force these to be resolved.  On other systems
1527 a "cc -M" command is required.  (Note that the -M flag on other systems
1528 indicates a memory model to use!)  What command will force resolution on
1529 EOM
1530     $echo $n "this system? [$dflt] $c"
1531     rp="Command to resolve multiple refs? [$dflt]"
1532     . myread
1533     cc="$ans"
1534 else
1535     echo "Not a USG system--assuming cc can resolve multiple definitions."
1536     cc=cc
1537 fi
1538
1539 : see if we should include -lnm
1540 echo " "
1541 if $test -r /usr/lib/libnm.a || $test -r /usr/local/lib/libnm.a ; then
1542     echo "New math library found."
1543     libnm='-lnm'
1544 else
1545     ans=`loc libnm.a x $libpth`
1546     case "$ans" in
1547     x)
1548         echo "No nm library found--the normal math library will have to do."
1549         libnm=''
1550         ;;
1551     *)
1552         echo "New math library found in $ans."
1553         libnm="$ans"
1554         ;;
1555     esac
1556 fi
1557
1558 : determine which malloc to compile in
1559 echo " "
1560 case "$usemymalloc" in
1561 '')
1562     if bsd || v7; then
1563         dflt='y'
1564     else
1565         dflt='n'
1566     fi
1567     ;;
1568 *)  dflt="$usemymalloc"
1569     ;;
1570 esac
1571 rp="Do you wish to attempt to use the malloc that comes with $package? [$dflt]"
1572 $echo $n "$rp $c"
1573 . myread
1574 case "$ans" in
1575 '') ans=$dflt;;
1576 esac
1577 usemymalloc="$ans"
1578 case "$ans" in
1579 y*) mallocsrc='malloc.c'; mallocobj='malloc.o';;
1580 *) mallocsrc=''; mallocobj='';;
1581 esac
1582
1583 echo " "
1584 echo "End of configuration questions."
1585 echo " "
1586
1587 : create config.sh file
1588 echo " "
1589 if test -d ../UU; then
1590     cd ..
1591 fi
1592 echo "Creating config.sh..."
1593 $spitshell <<EOT >config.sh
1594 $startsh
1595 # config.sh
1596 # This file was produced by running the Configure script.
1597
1598 d_eunice='$d_eunice'
1599 eunicefix='$eunicefix'
1600 define='$define'
1601 loclist='$loclist'
1602 expr='$expr'
1603 sed='$sed'
1604 echo='$echo'
1605 cat='$cat'
1606 rm='$rm'
1607 mv='$mv'
1608 cp='$cp'
1609 tail='$tail'
1610 tr='$tr'
1611 mkdir='$mkdir'
1612 sort='$sort'
1613 uniq='$uniq'
1614 grep='$grep'
1615 trylist='$trylist'
1616 test='$test'
1617 inews='$inews'
1618 egrep='$egrep'
1619 more='$more'
1620 pg='$pg'
1621 Mcc='$Mcc'
1622 vi='$vi'
1623 mailx='$mailx'
1624 mail='$mail'
1625 cpp='$cpp'
1626 Log='$Log'
1627 Header='$Header'
1628 bin='$bin'
1629 cc='$cc'
1630 contains='$contains'
1631 cppstdin='$cppstdin'
1632 cppminus='$cppminus'
1633 d_bcopy='$d_bcopy'
1634 d_charsprf='$d_charsprf'
1635 d_crypt='$d_crypt'
1636 d_dosuid='$d_dosuid'
1637 d_fchmod='$d_fchmod'
1638 d_fchown='$d_fchown'
1639 d_getgrps='$d_getgrps'
1640 d_index='$d_index'
1641 d_killpg='$d_killpg'
1642 d_memcpy='$d_memcpy'
1643 d_rename='$d_rename'
1644 d_setegid='$d_setegid'
1645 d_seteuid='$d_seteuid'
1646 d_setrgid='$d_setrgid'
1647 d_setruid='$d_setruid'
1648 d_statblks='$d_statblks'
1649 d_stdstdio='$d_stdstdio'
1650 d_strcspn='$d_strcspn'
1651 d_strctcpy='$d_strctcpy'
1652 d_symlink='$d_symlink'
1653 d_tminsys='$d_tminsys'
1654 d_vfork='$d_vfork'
1655 d_voidsig='$d_voidsig'
1656 gidtype='$gidtype'
1657 libc='$libc'
1658 libnm='$libnm'
1659 mallocsrc='$mallocsrc'
1660 mallocobj='$mallocobj'
1661 usemymalloc='$usemymalloc'
1662 mansrc='$mansrc'
1663 manext='$manext'
1664 models='$models'
1665 split='$split'
1666 small='$small'
1667 medium='$medium'
1668 large='$large'
1669 huge='$huge'
1670 ccflags='$ccflags'
1671 ldflags='$ldflags'
1672 n='$n'
1673 c='$c'
1674 package='$package'
1675 spitshell='$spitshell'
1676 shsharp='$shsharp'
1677 sharpbang='$sharpbang'
1678 startsh='$startsh'
1679 stdchar='$stdchar'
1680 uidtype='$uidtype'
1681 voidflags='$voidflags'
1682 defvoidused='$defvoidused'
1683 privlib='$privlib'
1684 CONFIG=true
1685 EOT
1686
1687 CONFIG=true
1688
1689 echo " "
1690 dflt=''
1691 fastread=''
1692 echo "If you didn't make any mistakes, then just type a carriage return here."
1693 rp="If you need to edit config.sh, do it as a shell escape here:"
1694 $echo $n "$rp $c"
1695 . UU/myread
1696 case "$ans" in
1697 '') ;;
1698 *) : in case they cannot read
1699     eval $ans;;
1700 esac
1701 . ./config.sh
1702
1703 echo " "
1704 echo "Doing variable substitutions on .SH files..."
1705 set x `awk '{print $1}' <MANIFEST | $grep '\.SH'`
1706 shift
1707 case $# in
1708 0) set x *.SH; shift;;
1709 esac
1710 if test ! -f $1; then
1711     shift
1712 fi
1713 for file in $*; do
1714     case "$file" in
1715     */*)
1716         dir=`$expr X$file : 'X\(.*\)/'`
1717         file=`$expr X$file : 'X.*/\(.*\)'`
1718         (cd $dir && . $file)
1719         ;;
1720     *)
1721         . $file
1722         ;;
1723     esac
1724 done
1725 if test -f config.h.SH; then
1726     if test ! -f config.h; then
1727         : oops, they left it out of MANIFEST, probably, so do it anyway.
1728         . config.h.SH
1729     fi
1730 fi
1731
1732 if $contains '^depend:' Makefile >/dev/null 2>&1; then
1733     dflt=n
1734     $cat <<EOM
1735
1736 Now you need to generate make dependencies by running "make depend".
1737 You might prefer to run it in background: "make depend > makedepend.out &"
1738 It can take a while, so you might not want to run it right now.
1739
1740 EOM
1741     rp="Run make depend now? [$dflt]"
1742     $echo $n "$rp $c"
1743     . UU/myread
1744     case "$ans" in
1745     y*) make depend
1746         echo "Now you must run a make."
1747         ;;
1748     *)  echo "You must run 'make depend' then 'make'."
1749         ;;
1750     esac
1751 elif test -f Makefile; then
1752     echo " "
1753     echo "Now you must run a make."
1754 else
1755     echo "Done."
1756 fi
1757
1758 $rm -f kit*isdone
1759 : the following is currently useless
1760 cd UU && $rm -f $rmlist
1761 : since this removes it all anyway
1762 cd .. && $rm -rf UU
1763 : end of Configure