perl 2.0 patch 1: removed redundant debugging code in regexp.c
[p5sagit/p5-mst-13.2.git] / Configure
CommitLineData
8d063cd8 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#
13281fa4 11# $Header: Configure,v 2.0.1.1 88/06/28 16:24:02 root Exp $
8d063cd8 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
378cc40b 18PATH='.:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc:/usr/new:/usr/new/bin:/usr/nbin'
8d063cd8 19export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0; kill $$)
20
21if test ! -t 0; then
22 echo "Say 'sh Configure', not 'sh <Configure'"
23 exit 1
24fi
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
30if test ! -d ../UU; then
31 if test ! -d UU; then
32 mkdir UU
33 fi
34 cd UU
35fi
36
378cc40b 37case "$1" in
38-d) shift; fastread='yes';;
39esac
40
8d063cd8 41d_eunice=''
42eunicefix=''
43define=''
44loclist=''
45expr=''
46sed=''
47echo=''
48cat=''
49rm=''
50mv=''
51cp=''
52tail=''
53tr=''
54mkdir=''
55sort=''
56uniq=''
57grep=''
58trylist=''
59test=''
60inews=''
61egrep=''
62more=''
63pg=''
64Mcc=''
65vi=''
66mailx=''
67mail=''
378cc40b 68cpp=''
8d063cd8 69Log=''
70Header=''
71bin=''
72cc=''
73contains=''
378cc40b 74cppstdin=''
36ce8bec 75cppminus=''
135863df 76d_bcopy=''
8d063cd8 77d_charsprf=''
2e1b3b7e 78d_crypt=''
13281fa4 79d_dosuid=''
378cc40b 80d_fchmod=''
81d_fchown=''
82d_getgrps=''
8d063cd8 83d_index=''
378cc40b 84d_killpg=''
85d_memcpy=''
86d_rename=''
87d_setegid=''
88d_seteuid=''
89d_setrgid=''
90d_setruid=''
135863df 91d_statblks=''
36ce8bec 92d_stdstdio=''
378cc40b 93d_strcspn=''
8d063cd8 94d_strctcpy=''
2e1b3b7e 95d_symlink=''
135863df 96d_tminsys=''
8d063cd8 97d_vfork=''
36ce8bec 98d_voidsig=''
378cc40b 99gidtype=''
8d063cd8 100libc=''
101libnm=''
a1cc2bdc 102mallocsrc=''
103mallocobj=''
104usemymalloc=''
8d063cd8 105mansrc=''
106manext=''
107models=''
108split=''
109small=''
110medium=''
111large=''
112huge=''
113ccflags=''
114ldflags=''
115n=''
116c=''
117package=''
118spitshell=''
119shsharp=''
120sharpbang=''
121startsh=''
36ce8bec 122stdchar=''
378cc40b 123uidtype=''
8d063cd8 124voidflags=''
125defvoidused=''
378cc40b 126privlib=''
8d063cd8 127CONFIG=''
8d063cd8 128: set package name
129package=perl
130
131echo " "
132echo "Beginning of configuration questions for $package kit."
133: Eunice requires " " instead of "", can you believe it
134echo " "
135
136define='define'
13281fa4 137undef='undef'
8d063cd8 138libpth='/usr/lib /usr/local/lib /lib'
139smallmach='pdp11 i8086 z8000 i80286 iAPX286'
140rmlist='kit[1-9]isdone kit[1-9][0-9]isdone'
141trap 'echo " "; rm -f $rmlist; exit 1' 1 2 3
378cc40b 142
143: We must find out about Eunice early
144eunicefix=':'
145if test -f /etc/unixtovms; then
146 eunicefix=/etc/unixtovms
147fi
148if test -f /etc/unixtovms.exe; then
149 eunicefix=/etc/unixtovms.exe
150fi
151
8d063cd8 152attrlist="mc68000 sun gcos unix ibm gimpel interdata tss os mert pyr"
153attrlist="$attrlist vax pdp11 i8086 z8000 u3b2 u3b5 u3b20 u3b200"
36ce8bec 154attrlist="$attrlist ns32000 ns16000 iAPX286 mc300 mc500 mc700 sparc"
378cc40b 155attrlist="$attrlist nsc32000 sinix xenix venix posix ansi M_XENIX"
156attrlist="$attrlist $mc68k __STDC__"
157pth="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /etc /usr/lib /lib"
158d_newshome="../../NeWS"
8d063cd8 159defvoidused=7
160
161: some greps do not return status, grrr.
162echo "grimblepritz" >grimble
163if grep blurfldyick grimble >/dev/null 2>&1 ; then
164 contains=contains
165elif grep grimblepritz grimble >/dev/null 2>&1 ; then
166 contains=grep
167else
168 contains=contains
169fi
170rm -f grimble
171: the following should work in any shell
172case "$contains" in
173contains*)
174 echo " "
175 echo "AGH! Grep doesn't return a status. Attempting remedial action."
176 cat >contains <<'EOSS'
177grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
178EOSS
378cc40b 179chmod +x contains
8d063cd8 180esac
181
182: first determine how to suppress newline on echo command
183echo "Checking echo to see how to suppress newlines..."
184(echo "hi there\c" ; echo " ") >.echotmp
185if $contains c .echotmp >/dev/null 2>&1 ; then
186 echo "...using -n."
187 n='-n'
188 c=''
189else
190 cat <<'EOM'
191...using \c
192EOM
193 n=''
194 c='\c'
195fi
196echo $n "Type carriage return to continue. Your cursor should be here-->$c"
197read ans
198rm -f .echotmp
199
200: now set up to do reads with possible shell escape and default assignment
201cat <<EOSC >myread
378cc40b 202case "\$fastread" in
203yes) ans=''; echo " " ;;
204*) ans='!';;
205esac
8d063cd8 206while 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
221done
222rp='Your answer:'
223case "\$ans" in
224'') ans="\$dflt";;
225esac
226EOSC
227
228: general instructions
229cat <<EOH
230
231This installation shell script will examine your system and ask you questions
232to determine how the $package package should be installed. If you get stuck
233on a question, you may use a ! shell escape to start a subshell or execute
234a command. Many of the questions will have default answers in square
235brackets--typing carriage return will give you the default.
236
237On some of the questions which ask for file or directory names you are
238allowed to use the ~name construct to specify the login directory belonging
239to "name", even if you don't have a shell which knows about that. Questions
240where this is allowed will be marked "(~name ok)".
241
242EOH
243rp="[Type carriage return to continue]"
244echo $n "$rp $c"
245. myread
246cat <<EOH
247
248Much effort has been expended to ensure that this shell script will run
249on any Unix system. If despite that it blows up on you, your best bet is
36ce8bec 250to edit Configure and run it again. Also, let me (lwall@jpl-devvax.jpl.nasa.gov)
251know how I blew it. If you can't run Configure for some reason, you'll have
8d063cd8 252to generate a config.sh file by hand.
253
254This installation script affects things in two ways: 1) it may do direct
255variable substitutions on some of the files included in this kit, and
2562) it builds a config.h file for inclusion in C programs. You may edit
257any of these files as the need arises after running this script.
258
259If you make a mistake on a question, there is no easy way to back up to it
260currently. The easiest thing to do is to edit config.sh and rerun all the
261SH files. Configure will offer to let you do this before it runs the SH files.
262
263EOH
264rp="[Type carriage return to continue]"
265echo $n "$rp $c"
266. myread
267
268: get old answers, if there is a config file out there
269if 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
285fi
286
287: find out where common programs are
288echo " "
289echo "Locating common programs..."
290cat <<EOSC >loc
291$startsh
292case \$# in
2930) exit 1;;
294esac
295thing=\$1
296shift
297dflt=\$1
298shift
299for 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
378cc40b 311 elif test -f \$dir/\$thing.exe; then
312 : on Eunice apparently
313 echo \$dir/\$thing
314 exit 0
8d063cd8 315 fi
316 ;;
317 esac
318done
319echo \$dflt
320exit 1
321EOSC
378cc40b 322chmod +x loc
8d063cd8 323$eunicefix loc
324loclist="
325expr
326sed
327echo
328cat
329rm
330mv
331cp
332tr
333mkdir
334sort
335uniq
336grep
337"
338trylist="
339test
340egrep
341Mcc
378cc40b 342cpp
8d063cd8 343"
344for 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
356done
357echo " "
358echo "Don't worry if any of the following aren't found..."
359ans=offhand
360for 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
373done
374case "$egrep" in
375egrep)
376 echo "Substituting grep for egrep."
377 egrep=$grep
378 ;;
379esac
380case "$test" in
381test)
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 ;;
397esac
398case "$echo" in
399echo)
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
415They are not compatible! You are probably running ksh on a non-USG system.
416I'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
417have echo built in and we may have to run some Bourne shell scripts. That
418means I'll have to use $ans to suppress newlines now. Life is ridiculous.
419
420FOO
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 ;;
431esac
432rmlist="$rmlist loc"
433
434: get list of predefined functions in a handy place
435echo " "
436if test -f /lib/libc.a; then
437 echo "Your C library is in /lib/libc.a. You're normal."
438 libc=/lib/libc.a
439else
440 ans=`loc libc.a blurfl/dyick $libpth`
378cc40b 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
8d063cd8 447 if test -f $ans; then
448 echo "Your C library is in $ans, of all places."
725c4100 449 libc=$ans
8d063cd8 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
456I can't seem to find your C library. I've looked in the following places:
457
458 $libpth
459
460None of these seems to contain your C library. What is the full name
461EOM
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
469fi
470echo " "
471$echo $n "Extracting names from $libc for later perusal...$c"
378cc40b 472nm $libc 2>/dev/null | sed -n -e 's/^.* T _//p' -e 's/^.* T //p' > libc.list
473if $contains '^printf$' libc.list >/dev/null 2>&1; then
8d063cd8 474 echo "done"
475else
378cc40b 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"
8d063cd8 479 else
378cc40b 480 echo " "
481 echo "nm didn't seem to work right."
482 echo "Trying ar instead..."
13281fa4 483 rmlist="$rmlist libc.tmp"
484 if ar t $libc > libc.tmp; then
485 sed -e 's/\.o$//' < libc.tmp > libc.list
378cc40b 486 echo "Ok."
487 else
13281fa4 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
378cc40b 496 fi
8d063cd8 497 fi
498fi
499rmlist="$rmlist libc.list"
500
501: make some quick guesses about what we are up against
502echo " "
503$echo $n "Hmm... $c"
504if $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
378cc40b 509elif $contains '^fcntl$' libc.list >/dev/null 2>&1 ; then
8d063cd8 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
514else
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
519fi
378cc40b 520if $contains '^vmssystem$' libc.list >/dev/null 2>&1 ; then
8d063cd8 521 cat <<'EOI'
522There is, however, a strange, musty smell in the air that reminds me of
523something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
524EOI
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
529else
530 echo " "
531 echo "Congratulations. You aren't running Eunice."
532 eunicefix=':'
533 d_eunice="$undef"
534 echo "exit 1" >eunice
535fi
536if test -f /xenix; then
537 echo "Actually, this looks more like a XENIX system..."
538 echo "exit 0" >xenix
539else
540 echo " "
541 echo "It's not Xenix..."
542 echo "exit 1" >xenix
543fi
378cc40b 544chmod +x xenix
545$eunicefix xenix
8d063cd8 546if test -f /venix; then
547 echo "Actually, this looks more like a VENIX system..."
548 echo "exit 0" >venix
549else
550 echo " "
551 if xenix; then
552 : null
553 else
554 echo "Nor is it Venix..."
555 fi
556 echo "exit 1" >venix
557fi
378cc40b 558chmod +x bsd usg v7 eunice venix
559$eunicefix bsd usg v7 eunice venix
8d063cd8 560rmlist="$rmlist bsd usg v7 eunice venix xenix"
561
562: see if sh knows # comments
563echo " "
564echo "Checking your sh to see if it knows about # comments..."
565if 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
378cc40b 573 chmod +x try
8d063cd8 574 try > today
378cc40b 575 if $contains hi today >/dev/null 2>&1; then
8d063cd8 576 echo "It does."
577 sharpbang='#!'
578 else
579 echo "#! /bin/echo hi" > try
580 $eunicefix try
378cc40b 581 chmod +x try
8d063cd8 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
591else
592 echo "Your sh doesn't grok # comments--I will strip them later on."
593 shsharp=false
594 echo "exec grep -v '^#'" >spitshell
378cc40b 595 chmod +x spitshell
8d063cd8 596 $eunicefix spitshell
597 spitshell=`pwd`/spitshell
598 echo "I presume that if # doesn't work, #! won't work either!"
599 sharpbang=': use '
600fi
601
602: figure out how to guarantee sh startup
603echo " "
604echo "Checking out how to guarantee sh startup..."
605startsh=$sharpbang'/bin/sh'
606echo "Let's see if '$startsh' works..."
607cat >try <<EOSS
608$startsh
609set abc
610test "$?abc" != 1
611EOSS
612
378cc40b 613chmod +x try
8d063cd8 614$eunicefix try
615if try; then
616 echo "Yup, it does."
617else
618 echo "Nope. You may have to fix up the shell scripts to make sure sh runs them."
619fi
620rm -f try today
621
36ce8bec 622: see how we invoke the C preprocessor
623echo " "
624echo "Now, how can we feed standard input to your C preprocessor..."
625cat <<'EOT' >testcpp.c
626#define ABC abc
627#define XYZ xyz
628ABC.XYZ
629EOT
378cc40b 630echo 'Maybe "'$cpp'" will work...'
631$cpp <testcpp.c >testcpp.out 2>&1
13281fa4 632if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
36ce8bec 633 echo "Yup, it does."
378cc40b 634 cppstdin="$cpp"
36ce8bec 635 cppminus='';
636else
378cc40b 637 echo 'Nope, maybe "'$cpp' -" will work...'
638 $cpp - <testcpp.c >testcpp.out 2>&1
13281fa4 639 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
36ce8bec 640 echo "Yup, it does."
378cc40b 641 cppstdin="$cpp"
36ce8bec 642 cppminus='-';
643 else
644 echo 'No such luck...maybe "cc -E" will work...'
645 cc -E <testcpp.c >testcpp.out 2>&1
13281fa4 646 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
36ce8bec 647 echo "It works!"
378cc40b 648 cppstdin='cc -E'
36ce8bec 649 cppminus='';
650 else
651 echo 'Nixed again...maybe "cc -E -" will work...'
652 cc -E - <testcpp.c >testcpp.out 2>&1
13281fa4 653 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
36ce8bec 654 echo "Hooray, it works! I was beginning to wonder."
378cc40b 655 cppstdin='cc -E'
36ce8bec 656 cppminus='-';
657 else
658 echo 'Nope...maybe "cc -P" will work...'
659 cc -P <testcpp.c >testcpp.out 2>&1
13281fa4 660 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
36ce8bec 661 echo "Yup, that does."
378cc40b 662 cppstdin='cc -P'
36ce8bec 663 cppminus='';
664 else
665 echo 'Nope...maybe "cc -P -" will work...'
666 cc -P - <testcpp.c >testcpp.out 2>&1
13281fa4 667 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
36ce8bec 668 echo "Yup, that does."
378cc40b 669 cppstdin='cc -P'
36ce8bec 670 cppminus='-';
671 else
672 echo 'Hmm...perhaps you already told me...'
378cc40b 673 case "$cppstdin" in
36ce8bec 674 '') ;;
378cc40b 675 *) $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1;;
36ce8bec 676 esac
13281fa4 677 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
36ce8bec 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)'
378cc40b 682 cppstdin='(cat >/tmp/$$.c; cc -E /tmp/$$.c; rm /tmp/$$.c)'
36ce8bec 683 cppminus='';
378cc40b 684 $cppstdin <testcpp.c >testcpp.out 2>&1
13281fa4 685 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
36ce8bec 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
378cc40b 692 cppstdin="$ans"
693 $cppstdin <testcpp.c >testcpp.out 2>&1
13281fa4 694 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
36ce8bec 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
707fi
708rm -f testcpp.c testcpp.out
709
135863df 710: see if bcopy exists
711echo " "
378cc40b 712if $contains '^bcopy$' libc.list >/dev/null 2>&1; then
135863df 713 echo 'bcopy() found.'
714 d_bcopy="$define"
715else
716 echo 'bcopy() not found.'
717 d_bcopy="$undef"
718fi
719
8d063cd8 720: see if sprintf is declared as int or pointer to char
721echo " "
378cc40b 722cat >.ucbsprf.c <<'EOF'
723main() { char buf[10]; exit((unsigned long)sprintf(buf,"%s","foo") > 10L); }
724EOF
725if cc .ucbsprf.c -o .ucbsprf >/dev/null 2>&1 && .ucbsprf; then
8d063cd8 726 echo "Your sprintf() returns (int)."
727 d_charsprf="$undef"
378cc40b 728else
729 echo "Your sprintf() returns (char*)."
730 d_charsprf="$define"
8d063cd8 731fi
378cc40b 732/bin/rm -f .ucbsprf.c .ucbsprf
8d063cd8 733
2e1b3b7e 734: see if crypt exists
735echo " "
378cc40b 736if $contains '^crypt$' libc.list >/dev/null 2>&1; then
2e1b3b7e 737 echo 'crypt() found.'
738 d_crypt="$define"
739else
740 echo 'crypt() not found.'
741 d_crypt="$undef"
742fi
743
13281fa4 744: now see if they want to do setuid emulation
745case "$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;;
754esac
755cat <<EOM
756
757Some sites have disabled setuid #! scripts because of a bug in the kernel
758that prevents them from being secure. If you are on such a system, the
759setuid/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
761until a better solution is devised for the kernel problem.
762
763EOM
764rp="Do you want to do setuid/setgid emulation? [$dflt]"
765echo $n "$rp $c"
766. myread
767case "$ans" in
768'') $ans="$dflt";;
769esac
770case "$ans" in
771y*) d_dosuid="$define";;
772*) d_dosuid="$undef";;
773esac
774
378cc40b 775: see if fchmod exists
776echo " "
777if $contains '^fchmod$' libc.list >/dev/null 2>&1; then
778 echo 'fchmod() found.'
779 d_fchmod="$define"
780else
781 echo 'fchmod() not found.'
782 d_fchmod="$undef"
783fi
784
785: see if fchown exists
786echo " "
787if $contains '^fchown$' libc.list >/dev/null 2>&1; then
788 echo 'fchown() found.'
789 d_fchown="$define"
790else
791 echo 'fchown() not found.'
792 d_fchown="$undef"
793fi
794
795: see if getgroups exists
796echo " "
797if $contains '^getgroups$' libc.list >/dev/null 2>&1; then
798 echo 'getgroups() found.'
799 d_getgrps="$define"
800else
801 echo 'getgroups() not found.'
802 d_getgrps="$undef"
803fi
804
8d063cd8 805: index or strcpy
806echo " "
378cc40b 807case "$d_index" in
808n) dflt=n;;
809*) dflt=y;;
810esac
811if $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
8d063cd8 825else
378cc40b 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
833fi
834
835: see if killpg exists
836echo " "
837if $contains '^killpg$' libc.list >/dev/null 2>&1; then
838 echo 'killpg() found.'
839 d_killpg="$define"
840else
841 echo 'killpg() not found.'
842 d_killpg="$undef"
843fi
844
845: see if memcpy exists
846echo " "
847if $contains '^memcpy$' libc.list >/dev/null 2>&1; then
848 echo 'memcpy() found.'
849 d_memcpy="$define"
850else
851 echo 'memcpy() not found.'
852 d_memcpy="$undef"
853fi
854
855: see if rename exists
856echo " "
857if $contains '^rename$' libc.list >/dev/null 2>&1; then
858 echo 'rename() found.'
859 d_rename="$define"
860else
861 echo 'rename() not found.'
862 d_rename="$undef"
863fi
864
865: see if setegid exists
866echo " "
867if $contains '^setegid$' libc.list >/dev/null 2>&1; then
868 echo 'setegid() found.'
869 d_setegid="$define"
870else
871 echo 'setegid() not found.'
872 d_setegid="$undef"
873fi
874
875: see if seteuid exists
876echo " "
877if $contains '^seteuid$' libc.list >/dev/null 2>&1; then
878 echo 'seteuid() found.'
879 d_seteuid="$define"
880else
881 echo 'seteuid() not found.'
882 d_seteuid="$undef"
883fi
884
885: see if setrgid exists
886echo " "
887if $contains '^setrgid$' libc.list >/dev/null 2>&1; then
888 echo 'setrgid() found.'
889 d_setrgid="$define"
890else
891 echo 'setrgid() not found.'
892 d_setrgid="$undef"
893fi
894
895: see if setruid exists
896echo " "
897if $contains '^setruid$' libc.list >/dev/null 2>&1; then
898 echo 'setruid() found.'
899 d_setruid="$define"
900else
901 echo 'setruid() not found.'
902 d_setruid="$undef"
8d063cd8 903fi
904
135863df 905: see if stat knows about block sizes
906echo " "
907if $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
915else
916 echo "Your stat doesn't know about block sizes."
917 d_statblks="$undef"
918fi
919
36ce8bec 920: see if stdio is really std
921echo " "
922if $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
930else
931 echo "Your stdio isn't very std."
932 d_stdstdio="$undef"
933fi
934
378cc40b 935: see if strcspn exists
936echo " "
937if $contains '^strcspn$' libc.list >/dev/null 2>&1; then
938 echo 'strcspn() found.'
939 d_strcspn="$define"
940else
941 echo 'strcspn() not found.'
942 d_strcspn="$undef"
943fi
944
8d063cd8 945: check for structure copying
946echo " "
947echo "Checking to see if your C compiler can copy structs..."
948$cat >try.c <<'EOCP'
949main()
950{
951 struct blurfl {
952 int dyick;
953 } foo, bar;
954
955 foo = bar;
956}
957EOCP
958if cc -c try.c >/dev/null 2>&1 ; then
959 d_strctcpy="$define"
960 echo "Yup, it can."
961else
962 d_strctcpy="$undef"
963 echo "Nope, it can't."
964fi
965$rm -f try.*
966
378cc40b 967: see if symlink exists
968echo " "
969if $contains '^symlink$' libc.list >/dev/null 2>&1; then
970 echo 'symlink() found.'
971 d_symlink="$define"
972else
973 echo 'symlink() not found.'
974 d_symlink="$undef"
975fi
976
135863df 977: see if struct tm is defined in sys/time.h
978echo " "
979if $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"
982else
983 echo "You have struct tm defined in <sys/time.h> rather than <time.h>."
984 d_tminsys="$define"
985fi
986
8d063cd8 987: see if there is a vfork
988echo " "
378cc40b 989if $contains '^vfork$' libc.list >/dev/null 2>&1 ; then
8d063cd8 990 echo "vfork() found."
991 d_vfork="$undef"
992else
993 echo "No vfork() found--will use fork() instead."
994 d_vfork="$define"
995fi
996
36ce8bec 997: see if signal is declared as pointer to function returning int or void
998echo " "
999if $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"
1002else
1003 echo "You have int (*signal())() instead of void."
1004 d_voidsig="$undef"
1005fi
1006
8d063cd8 1007: check for void type
1008echo " "
1009$cat <<EOM
1010Checking 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
1017EOM
1018case "$voidflags" in
1019'')
1020 $cat >try.c <<'EOCP'
1021#if TRY & 1
1022void main() {
1023#else
1024main() {
1025#endif
1026 extern void *moo();
378cc40b 1027 void *(*goo)();
8d063cd8 1028#if TRY & 2
1029 void (*foo[10])();
1030#endif
1031
1032#if TRY & 4
378cc40b 1033 if(*goo == moo) {
8d063cd8 1034 exit(0);
1035 }
1036#endif
1037 exit(0);
1038}
1039EOCP
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
1069esac
1070dflt="$voidflags";
1071rp="Your void support flags add up to what? [$dflt]"
1072$echo $n "$rp $c"
1073. myread
1074voidflags="$ans"
1075$rm -f try.* .out
1076
378cc40b 1077: see what type gids are declared as in the kernel
1078case "$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 ;;
1092esac
1093cont=true
36ce8bec 1094echo " "
378cc40b 1095rp="What type are group ids on this system declared as? [$dflt]"
1096$echo $n "$rp $c"
1097. myread
1098gidtype="$ans"
8d063cd8 1099
1100: set up shell script to do ~ expansion
1101cat >filexp <<EOSS
1102$startsh
1103: expand filename
1104case "\$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 ;;
1133esac
1134EOSS
378cc40b 1135chmod +x filexp
8d063cd8 1136$eunicefix filexp
1137
378cc40b 1138: determine where private executables go
1139case "$privlib" in
1140'')
1141 dflt=/usr/lib/perl
1142 test -d /usr/local/lib && dflt=/usr/local/lib/perl
1143 ;;
1144*) dflt="$privlib"
1145 ;;
1146esac
1147$cat <<EOM
1148
1149The perl package has some perl subroutine libraries that should be put in
1150a directory that is accessible by everyone. Where do you want to put these
1151EOM
1152$echo $n "libraries? [$dflt] $c"
1153rp="Put perl libraries where? [$dflt]"
1154. myread
1155privlib=`filexp $ans`
1156
1157: see what type of char stdio uses.
1158echo " "
1159if $contains 'unsigned.*char.*_ptr;' /usr/include/stdio.h >/dev/null 2>&1 ; then
1160 echo "Your stdio uses unsigned chars."
1161 stdchar="unsigned char"
1162else
1163 echo "Your stdio uses signed chars."
1164 stdchar="char"
1165fi
1166
1167: see what type uids are declared as in the kernel
1168case "$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 ;;
1182esac
1183cont=true
1184echo " "
1185rp="What type are user ids on this system declared as? [$dflt]"
1186$echo $n "$rp $c"
1187. myread
1188uidtype="$ans"
1189
1190: preserve RCS keywords in files with variable substitution, grrr
1191Log='$Log'
1192Header='$Header'
1193
8d063cd8 1194: determine where public executables go
1195case "$bin" in
1196'')
1197 dflt=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin`
1198 ;;
1199*) dflt="$bin"
1200 ;;
1201esac
1202cont=true
1203while $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
1222done
1223
1224: determine where manual pages go
1225case "$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 ;;
1231esac
1232cont=true
1233while $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
1251done
1252case "$mansrc" in
1253*l)
1254 manext=l
1255 ;;
1256*n)
1257 manext=n
1258 ;;
378cc40b 1259*C)
1260 manext=C
1261 ;;
8d063cd8 1262*)
1263 manext=1
1264 ;;
1265esac
1266
8d063cd8 1267: get C preprocessor symbols handy
1268echo " "
36ce8bec 1269echo $attrlist | $tr '[ - ]' '[\012-\012]' >Cppsym.know
8d063cd8 1270$cat <<EOSS >Cppsym
1271$startsh
1272case "\$1" in
1273-l) list=true
1274 shift
1275 ;;
1276esac
1277unknown=''
1278case "\$list\$#" in
12791|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 ;;
1292esac
1293case \$# in
12940) exit 1;;
1295esac
36ce8bec 1296echo \$* | $tr '[ - ]' '[\012-\012]' | $sed -e 's/\(.*\)/\\
8d063cd8 1297#ifdef \1\\
1298exit 0; _ _ _ _\1\\ \1\\
1299#endif\\
1300/' >/tmp/Cppsym\$\$
1301echo exit 1 >>/tmp/Cppsym\$\$
378cc40b 1302$cppstdin $cppminus </tmp/Cppsym\$\$ >/tmp/Cppsym2\$\$
8d063cd8 1303case "\$list" in
d96024cf 1304true) awk 'NF > 5 {print substr(\$6,2,100)}' </tmp/Cppsym2\$\$ ;;
8d063cd8 1305*)
1306 sh /tmp/Cppsym2\$\$
1307 status=\$?
1308 ;;
1309esac
1310$rm -f /tmp/Cppsym\$\$ /tmp/Cppsym2\$\$
1311exit \$status
1312EOSS
378cc40b 1313chmod +x Cppsym
8d063cd8 1314$eunicefix Cppsym
1315echo "Your C preprocessor defines the following symbols:"
1316Cppsym -l $attrlist >Cppsym.true
1317cat Cppsym.true
1318rmlist="$rmlist Cppsym Cppsym.know Cppsym.true"
1319
1320: see what memory models we can support
1321case "$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" ;;
1347esac
1348$cat <<EOM
1349
1350Some systems have different model sizes. On most systems they are called
1351small, medium, large, and huge. On the PDP11 they are called unsplit and
1352split. If your system doesn't support different memory models, say "none".
1353If you wish to force everything to one memory model, say "none" here and
1354put the appropriate flags later when it asks you for other cc and ld flags.
1355Venix 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
1358EOM
1359rp="Which models are supported? [$dflt]"
1360$echo $n "$rp $c"
1361. myread
1362models="$ans"
1363
1364case "$models" in
1365none)
1366 small=''
1367 medium=''
1368 large=''
1369 huge=''
1370 unsplit=''
1371 split=''
1372 ;;
1373*split)
1374 case "$split" in
1375 '')
13281fa4 1376 if $contains '\-i' $mansrc/ld.1 >/dev/null 2>&1 || \
1377 $contains '\-i' $mansrc/cc.1 >/dev/null 2>&1; then
8d063cd8 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 ;;
1463esac
1464
1465case "$ccflags" in
1466'') dflt='none';;
1467*) dflt="$ccflags";;
1468esac
1469echo " "
1470rp="Any additional cc flags? [$dflt]"
1471$echo $n "$rp $c"
1472. myread
1473case "$ans" in
1474none) ans='';
1475esac
1476ccflags="$ans"
1477
1478case "$ldflags" in
1479'') if venix; then
1480 dflt='-i -z'
1481 else
1482 dflt='none'
1483 fi
1484 ;;
1485*) dflt="$ldflags";;
1486esac
1487echo " "
1488rp="Any additional ld flags? [$dflt]"
1489$echo $n "$rp $c"
1490. myread
1491case "$ans" in
1492none) ans='';
1493esac
1494ldflags="$ans"
1495
1496: see if we need a special compiler
1497echo " "
1498if 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
1524On some systems the default C compiler will not resolve multiple global
1525references 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
1527a "cc -M" command is required. (Note that the -M flag on other systems
1528indicates a memory model to use!) What command will force resolution on
1529EOM
1530 $echo $n "this system? [$dflt] $c"
1531 rp="Command to resolve multiple refs? [$dflt]"
1532 . myread
1533 cc="$ans"
1534else
1535 echo "Not a USG system--assuming cc can resolve multiple definitions."
1536 cc=cc
1537fi
1538
1539: see if we should include -lnm
1540echo " "
1541if $test -r /usr/lib/libnm.a || $test -r /usr/local/lib/libnm.a ; then
1542 echo "New math library found."
1543 libnm='-lnm'
1544else
36ce8bec 1545 ans=`loc libnm.a x $libpth`
8d063cd8 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
1556fi
1557
a1cc2bdc 1558: determine which malloc to compile in
1559echo " "
1560case "$usemymalloc" in
1561'')
1562 if bsd || v7; then
1563 dflt='y'
1564 else
1565 dflt='n'
1566 fi
1567 ;;
1568*) dflt="$usemymalloc"
1569 ;;
1570esac
1571rp="Do you wish to attempt to use the malloc that comes with $package? [$dflt]"
1572$echo $n "$rp $c"
1573. myread
1574case "$ans" in
1575'') ans=$dflt;;
1576esac
1577usemymalloc="$ans"
1578case "$ans" in
1579y*) mallocsrc='malloc.c'; mallocobj='malloc.o';;
1580*) mallocsrc=''; mallocobj='';;
1581esac
1582
8d063cd8 1583echo " "
1584echo "End of configuration questions."
1585echo " "
1586
1587: create config.sh file
1588echo " "
1589if test -d ../UU; then
1590 cd ..
1591fi
1592echo "Creating config.sh..."
1593$spitshell <<EOT >config.sh
1594$startsh
1595# config.sh
1596# This file was produced by running the Configure script.
1597
1598d_eunice='$d_eunice'
1599eunicefix='$eunicefix'
1600define='$define'
1601loclist='$loclist'
1602expr='$expr'
1603sed='$sed'
1604echo='$echo'
1605cat='$cat'
1606rm='$rm'
1607mv='$mv'
1608cp='$cp'
1609tail='$tail'
1610tr='$tr'
1611mkdir='$mkdir'
1612sort='$sort'
1613uniq='$uniq'
1614grep='$grep'
1615trylist='$trylist'
1616test='$test'
1617inews='$inews'
1618egrep='$egrep'
1619more='$more'
1620pg='$pg'
1621Mcc='$Mcc'
1622vi='$vi'
1623mailx='$mailx'
1624mail='$mail'
378cc40b 1625cpp='$cpp'
8d063cd8 1626Log='$Log'
1627Header='$Header'
1628bin='$bin'
1629cc='$cc'
1630contains='$contains'
378cc40b 1631cppstdin='$cppstdin'
36ce8bec 1632cppminus='$cppminus'
135863df 1633d_bcopy='$d_bcopy'
8d063cd8 1634d_charsprf='$d_charsprf'
2e1b3b7e 1635d_crypt='$d_crypt'
13281fa4 1636d_dosuid='$d_dosuid'
378cc40b 1637d_fchmod='$d_fchmod'
1638d_fchown='$d_fchown'
1639d_getgrps='$d_getgrps'
8d063cd8 1640d_index='$d_index'
378cc40b 1641d_killpg='$d_killpg'
1642d_memcpy='$d_memcpy'
1643d_rename='$d_rename'
1644d_setegid='$d_setegid'
1645d_seteuid='$d_seteuid'
1646d_setrgid='$d_setrgid'
1647d_setruid='$d_setruid'
135863df 1648d_statblks='$d_statblks'
36ce8bec 1649d_stdstdio='$d_stdstdio'
378cc40b 1650d_strcspn='$d_strcspn'
8d063cd8 1651d_strctcpy='$d_strctcpy'
2e1b3b7e 1652d_symlink='$d_symlink'
135863df 1653d_tminsys='$d_tminsys'
8d063cd8 1654d_vfork='$d_vfork'
36ce8bec 1655d_voidsig='$d_voidsig'
378cc40b 1656gidtype='$gidtype'
8d063cd8 1657libc='$libc'
1658libnm='$libnm'
a1cc2bdc 1659mallocsrc='$mallocsrc'
1660mallocobj='$mallocobj'
1661usemymalloc='$usemymalloc'
8d063cd8 1662mansrc='$mansrc'
1663manext='$manext'
1664models='$models'
1665split='$split'
1666small='$small'
1667medium='$medium'
1668large='$large'
1669huge='$huge'
1670ccflags='$ccflags'
1671ldflags='$ldflags'
1672n='$n'
1673c='$c'
1674package='$package'
1675spitshell='$spitshell'
1676shsharp='$shsharp'
1677sharpbang='$sharpbang'
1678startsh='$startsh'
36ce8bec 1679stdchar='$stdchar'
378cc40b 1680uidtype='$uidtype'
8d063cd8 1681voidflags='$voidflags'
1682defvoidused='$defvoidused'
378cc40b 1683privlib='$privlib'
8d063cd8 1684CONFIG=true
1685EOT
13281fa4 1686
8d063cd8 1687CONFIG=true
1688
1689echo " "
1690dflt=''
378cc40b 1691fastread=''
8d063cd8 1692echo "If you didn't make any mistakes, then just type a carriage return here."
1693rp="If you need to edit config.sh, do it as a shell escape here:"
1694$echo $n "$rp $c"
1695. UU/myread
1696case "$ans" in
1697'') ;;
1698*) : in case they cannot read
1699 eval $ans;;
1700esac
378cc40b 1701. ./config.sh
8d063cd8 1702
1703echo " "
1704echo "Doing variable substitutions on .SH files..."
d96024cf 1705set x `awk '{print $1}' <MANIFEST | $grep '\.SH'`
36ce8bec 1706shift
1707case $# in
17080) set x *.SH; shift;;
1709esac
1710if test ! -f $1; then
1711 shift
1712fi
8d063cd8 1713for 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
1724done
1725if 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
1730fi
1731
1732if $contains '^depend:' Makefile >/dev/null 2>&1; then
1733 dflt=n
1734 $cat <<EOM
1735
1736Now you need to generate make dependencies by running "make depend".
1737You might prefer to run it in background: "make depend > makedepend.out &"
1738It can take a while, so you might not want to run it right now.
1739
1740EOM
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
1751elif test -f Makefile; then
1752 echo " "
1753 echo "Now you must run a make."
1754else
1755 echo "Done."
1756fi
1757
1758$rm -f kit*isdone
13281fa4 1759: the following is currently useless
8d063cd8 1760cd UU && $rm -f $rmlist
13281fa4 1761: since this removes it all anyway
1762cd .. && $rm -rf UU
8d063cd8 1763: end of Configure