perl 3.0 patch #4 Patch #2 continued
[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#
91407755 11# $Header: Configure,v 3.0.1.2 89/11/11 04:05:37 lwall Locked $
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
03a14243 18PATH=".:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc:/usr/new:/usr/new/bin:/usr/nbin:$PATH"
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=''
8d063cd8 42define=''
91407755 43eunicefix=''
8d063cd8 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=''
a687059c 69perl=''
70emacs=''
71ls=''
72rmail=''
73sendmail=''
74shar=''
75smail=''
76tbl=''
77troff=''
78nroff=''
79uname=''
80uuname=''
81line=''
82chgrp=''
83chmod=''
84lint=''
85sleep=''
86pr=''
87tar=''
88ln=''
89lpr=''
90lp=''
91touch=''
92make=''
93date=''
91407755 94csh=''
8d063cd8 95Log=''
96Header=''
97bin=''
a687059c 98byteorder=''
8d063cd8 99contains=''
378cc40b 100cppstdin=''
36ce8bec 101cppminus=''
a687059c 102d_bcmp=''
135863df 103d_bcopy=''
8d063cd8 104d_charsprf=''
2e1b3b7e 105d_crypt=''
a687059c 106cryptlib=''
91407755 107d_csh=''
13281fa4 108d_dosuid=''
a687059c 109d_dup2=''
378cc40b 110d_fchmod=''
111d_fchown=''
a687059c 112d_fcntl=''
113d_flock=''
378cc40b 114d_getgrps=''
a687059c 115d_gethent=''
116d_getpgrp=''
117d_getprior=''
118d_htonl=''
8d063cd8 119d_index=''
a687059c 120d_ioctl=''
378cc40b 121d_killpg=''
a687059c 122d_memcmp=''
378cc40b 123d_memcpy=''
a687059c 124d_mkdir=''
125d_ndbm=''
126d_odbm=''
127d_readdir=''
378cc40b 128d_rename=''
a687059c 129d_rmdir=''
378cc40b 130d_setegid=''
131d_seteuid=''
a687059c 132d_setpgrp=''
133d_setprior=''
134d_setregid=''
135d_setresgid=''
136d_setreuid=''
137d_setresuid=''
378cc40b 138d_setrgid=''
139d_setruid=''
a687059c 140d_socket=''
141d_sockpair=''
142d_oldsock=''
143socketlib=''
135863df 144d_statblks=''
36ce8bec 145d_stdstdio=''
8d063cd8 146d_strctcpy=''
2e1b3b7e 147d_symlink=''
a687059c 148d_syscall=''
135863df 149d_tminsys=''
a687059c 150i_systime=''
91407755 151i_timetoo=''
a687059c 152d_varargs=''
8d063cd8 153d_vfork=''
36ce8bec 154d_voidsig=''
a687059c 155d_vprintf=''
156d_charvspr=''
91407755 157d_wait4=''
378cc40b 158gidtype=''
a687059c 159i_dirent=''
160d_dirnamlen=''
161i_fcntl=''
162i_grp=''
03a14243 163i_niin=''
a687059c 164i_pwd=''
165d_pwquota=''
166d_pwage=''
91407755 167d_pwchange=''
168d_pwclass=''
169d_pwexpire=''
a687059c 170i_sysdir=''
171i_sysioctl=''
172i_varargs=''
173i_vfork=''
174intsize=''
8d063cd8 175libc=''
176libnm=''
a1cc2bdc 177mallocsrc=''
178mallocobj=''
179usemymalloc=''
8d063cd8 180mansrc=''
181manext=''
182models=''
183split=''
184small=''
185medium=''
186large=''
187huge=''
a687059c 188optimize=''
8d063cd8 189ccflags=''
91407755 190cppflags=''
8d063cd8 191ldflags=''
a687059c 192cc=''
193libs=''
8d063cd8 194n=''
195c=''
196package=''
a687059c 197randbits=''
198sig_name=''
8d063cd8 199spitshell=''
200shsharp=''
201sharpbang=''
202startsh=''
36ce8bec 203stdchar=''
378cc40b 204uidtype=''
8d063cd8 205voidflags=''
206defvoidused=''
a687059c 207lib=''
378cc40b 208privlib=''
8d063cd8 209CONFIG=''
8d063cd8 210: set package name
211package=perl
212
213echo " "
214echo "Beginning of configuration questions for $package kit."
215: Eunice requires " " instead of "", can you believe it
216echo " "
217
218define='define'
13281fa4 219undef='undef'
a687059c 220libpth='/usr/lib /usr/local/lib /usr/lib/386 /usr/lib/large /lib /lib/386 /lib/large /usr/lib/small /lib/small'
8d063cd8 221smallmach='pdp11 i8086 z8000 i80286 iAPX286'
222rmlist='kit[1-9]isdone kit[1-9][0-9]isdone'
223trap 'echo " "; rm -f $rmlist; exit 1' 1 2 3
378cc40b 224
225: We must find out about Eunice early
226eunicefix=':'
227if test -f /etc/unixtovms; then
228 eunicefix=/etc/unixtovms
229fi
230if test -f /etc/unixtovms.exe; then
231 eunicefix=/etc/unixtovms.exe
232fi
233
a687059c 234: Now test for existence of everything in MANIFEST
235
236echo "First let's make sure your kit is complete. Checking..."
237(cd ..; awk '' `awk '$1 !~ /PACKINGLIST/ {print $1}' MANIFEST` >/dev/null || kill $$)
91407755 238echo "Looks good..."
a687059c 239
8d063cd8 240attrlist="mc68000 sun gcos unix ibm gimpel interdata tss os mert pyr"
241attrlist="$attrlist vax pdp11 i8086 z8000 u3b2 u3b5 u3b20 u3b200"
a687059c 242attrlist="$attrlist hpux hp9000s300 hp9000s500 hp9000s800"
36ce8bec 243attrlist="$attrlist ns32000 ns16000 iAPX286 mc300 mc500 mc700 sparc"
378cc40b 244attrlist="$attrlist nsc32000 sinix xenix venix posix ansi M_XENIX"
a687059c 245attrlist="$attrlist $mc68k __STDC__ UTS M_I8086 M_I186 M_I286 M_I386"
246attrlist="$attrlist i186"
247pth="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /usr/plx /usr/5bin /vol/local/bin /etc /usr/lib /lib /usr/local/lib /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/bin /bsd4.3/usr/ucb"
248d_newshome="/usr/NeWS"
8d063cd8 249defvoidused=7
91407755 250libswanted="net nm ndir ndbm dbm c_s"
8d063cd8 251
252: some greps do not return status, grrr.
253echo "grimblepritz" >grimble
254if grep blurfldyick grimble >/dev/null 2>&1 ; then
255 contains=contains
256elif grep grimblepritz grimble >/dev/null 2>&1 ; then
257 contains=grep
258else
259 contains=contains
260fi
261rm -f grimble
262: the following should work in any shell
263case "$contains" in
264contains*)
265 echo " "
266 echo "AGH! Grep doesn't return a status. Attempting remedial action."
267 cat >contains <<'EOSS'
268grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
269EOSS
378cc40b 270chmod +x contains
8d063cd8 271esac
272
91407755 273: see if sh knows # comments
274echo " "
275echo "Checking your sh to see if it knows about # comments..."
276if sh -c '#' >/dev/null 2>&1 ; then
277 echo "Your sh handles # comments correctly."
278 shsharp=true
279 spitshell=cat
280 echo " "
281 echo "Okay, let's see if #! works on this system..."
282 echo "#!/bin/echo hi" > try
283 $eunicefix try
284 chmod +x try
285 try > today
286 if $contains hi today >/dev/null 2>&1; then
287 echo "It does."
288 sharpbang='#!'
289 else
290 echo "#! /bin/echo hi" > try
291 $eunicefix try
292 chmod +x try
293 try > today
294 if test -s today; then
295 echo "It does."
296 sharpbang='#! '
297 else
298 echo "It doesn't."
299 sharpbang=': use '
300 fi
301 fi
302else
303 echo "Your sh doesn't grok # comments--I will strip them later on."
304 shsharp=false
305 echo "exec grep -v '^#'" >spitshell
306 chmod +x spitshell
307 $eunicefix spitshell
308 spitshell=`pwd`/spitshell
309 echo "I presume that if # doesn't work, #! won't work either!"
310 sharpbang=': use '
311fi
312
313: figure out how to guarantee sh startup
314echo " "
315echo "Checking out how to guarantee sh startup..."
316startsh=$sharpbang'/bin/sh'
317echo "Let's see if '$startsh' works..."
318cat >try <<EOSS
319$startsh
320set abc
321test "$?abc" != 1
322EOSS
323
324chmod +x try
325$eunicefix try
326if try; then
327 echo "Yup, it does."
328else
329 echo "Nope. You may have to fix up the shell scripts to make sure sh runs them."
330fi
331rm -f try today
332
8d063cd8 333: first determine how to suppress newline on echo command
334echo "Checking echo to see how to suppress newlines..."
335(echo "hi there\c" ; echo " ") >.echotmp
336if $contains c .echotmp >/dev/null 2>&1 ; then
337 echo "...using -n."
338 n='-n'
339 c=''
340else
341 cat <<'EOM'
342...using \c
343EOM
344 n=''
345 c='\c'
346fi
347echo $n "Type carriage return to continue. Your cursor should be here-->$c"
348read ans
349rm -f .echotmp
350
351: now set up to do reads with possible shell escape and default assignment
352cat <<EOSC >myread
378cc40b 353case "\$fastread" in
354yes) ans=''; echo " " ;;
355*) ans='!';;
356esac
8d063cd8 357while expr "X\$ans" : "X!" >/dev/null; do
358 read ans
359 case "\$ans" in
360 !)
361 sh
362 echo " "
363 echo $n "\$rp $c"
364 ;;
365 !*)
366 set \`expr "X\$ans" : "X!\(.*\)\$"\`
367 sh -c "\$*"
368 echo " "
369 echo $n "\$rp $c"
370 ;;
371 esac
372done
373rp='Your answer:'
374case "\$ans" in
375'') ans="\$dflt";;
376esac
377EOSC
378
379: general instructions
380cat <<EOH
381
382This installation shell script will examine your system and ask you questions
383to determine how the $package package should be installed. If you get stuck
384on a question, you may use a ! shell escape to start a subshell or execute
385a command. Many of the questions will have default answers in square
386brackets--typing carriage return will give you the default.
387
388On some of the questions which ask for file or directory names you are
389allowed to use the ~name construct to specify the login directory belonging
390to "name", even if you don't have a shell which knows about that. Questions
391where this is allowed will be marked "(~name ok)".
392
393EOH
394rp="[Type carriage return to continue]"
395echo $n "$rp $c"
396. myread
397cat <<EOH
398
399Much effort has been expended to ensure that this shell script will run
400on any Unix system. If despite that it blows up on you, your best bet is
36ce8bec 401to edit Configure and run it again. Also, let me (lwall@jpl-devvax.jpl.nasa.gov)
402know how I blew it. If you can't run Configure for some reason, you'll have
8d063cd8 403to generate a config.sh file by hand.
404
405This installation script affects things in two ways: 1) it may do direct
406variable substitutions on some of the files included in this kit, and
4072) it builds a config.h file for inclusion in C programs. You may edit
408any of these files as the need arises after running this script.
409
410If you make a mistake on a question, there is no easy way to back up to it
411currently. The easiest thing to do is to edit config.sh and rerun all the
412SH files. Configure will offer to let you do this before it runs the SH files.
413
414EOH
415rp="[Type carriage return to continue]"
416echo $n "$rp $c"
417. myread
418
419: get old answers, if there is a config file out there
420if test -f ../config.sh; then
421 echo " "
422 dflt=y
423 rp="I see a config.sh file. Did Configure make it on THIS system? [$dflt]"
424 echo $n "$rp $c"
425 . myread
426 case "$ans" in
427 n*) echo "OK, I'll ignore it.";;
428 *) echo "Fetching default answers from your old config.sh file..."
429 tmp="$n"
430 ans="$c"
431 . ../config.sh
432 n="$tmp"
433 c="$ans"
434 ;;
435 esac
436fi
437
438: find out where common programs are
439echo " "
440echo "Locating common programs..."
441cat <<EOSC >loc
442$startsh
443case \$# in
4440) exit 1;;
445esac
446thing=\$1
447shift
448dflt=\$1
449shift
450for dir in \$*; do
451 case "\$thing" in
452 .)
453 if test -d \$dir/\$thing; then
454 echo \$dir
455 exit 0
456 fi
457 ;;
458 *)
459 if test -f \$dir/\$thing; then
460 echo \$dir/\$thing
461 exit 0
378cc40b 462 elif test -f \$dir/\$thing.exe; then
463 : on Eunice apparently
464 echo \$dir/\$thing
465 exit 0
8d063cd8 466 fi
467 ;;
468 esac
469done
470echo \$dflt
471exit 1
472EOSC
378cc40b 473chmod +x loc
8d063cd8 474$eunicefix loc
475loclist="
8d063cd8 476cat
8d063cd8 477cp
a687059c 478echo
479expr
480grep
8d063cd8 481mkdir
a687059c 482mv
483rm
484sed
8d063cd8 485sort
a687059c 486tr
8d063cd8 487uniq
8d063cd8 488"
489trylist="
8d063cd8 490Mcc
378cc40b 491cpp
91407755 492csh
a687059c 493egrep
494test
8d063cd8 495"
496for file in $loclist; do
497 xxx=`loc $file $file $pth`
498 eval $file=$xxx
499 eval _$file=$xxx
500 case "$xxx" in
501 /*)
502 echo $file is in $xxx.
503 ;;
504 *)
505 echo "I don't know where $file is. I hope it's in everyone's PATH."
506 ;;
507 esac
508done
509echo " "
510echo "Don't worry if any of the following aren't found..."
511ans=offhand
512for file in $trylist; do
513 xxx=`loc $file $file $pth`
514 eval $file=$xxx
515 eval _$file=$xxx
516 case "$xxx" in
517 /*)
518 echo $file is in $xxx.
519 ;;
520 *)
521 echo "I don't see $file out there, $ans."
522 ans=either
523 ;;
524 esac
525done
526case "$egrep" in
527egrep)
528 echo "Substituting grep for egrep."
529 egrep=$grep
530 ;;
531esac
532case "$test" in
533test)
534 echo "Hopefully test is built into your sh."
535 ;;
536/bin/test)
a687059c 537 if sh -c "PATH= test true" >/dev/null 2>&1; then
538 echo "Using the test built into your sh."
539 test=test
540 fi
8d063cd8 541 ;;
542*)
543 test=test
544 ;;
545esac
546case "$echo" in
547echo)
548 echo "Hopefully echo is built into your sh."
549 ;;
550/bin/echo)
551 echo " "
552 echo "Checking compatibility between /bin/echo and builtin echo (if any)..."
553 $echo $n "hi there$c" >foo1
554 echo $n "hi there$c" >foo2
555 if cmp foo1 foo2 >/dev/null 2>&1; then
556 echo "They are compatible. In fact, they may be identical."
557 else
558 case "$n" in
559 '-n') n='' c='\c' ans='\c' ;;
560 *) n='-n' c='' ans='-n' ;;
561 esac
562 cat <<FOO
563They are not compatible! You are probably running ksh on a non-USG system.
564I'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
565have echo built in and we may have to run some Bourne shell scripts. That
566means I'll have to use $ans to suppress newlines now. Life is ridiculous.
567
568FOO
569 rp="Your cursor should be here-->"
570 $echo $n "$rp$c"
571 . myread
572 fi
573 $rm -f foo1 foo2
574 ;;
575*)
576 : cross your fingers
577 echo=echo
578 ;;
579esac
580rmlist="$rmlist loc"
581
a687059c 582: set up shell script to do ~ expansion
583cat >filexp <<EOSS
584$startsh
585: expand filename
586case "\$1" in
587 ~/*|~)
588 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
589 ;;
590 ~*)
591 if $test -f /bin/csh; then
592 /bin/csh -f -c "glob \$1"
593 echo ""
36ce8bec 594 else
a687059c 595 name=\`$expr x\$1 : '..\([^/]*\)'\`
596 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
597 if $test ! -d "\$dir"; then
598 me=\`basename \$0\`
599 echo "\$me: can't locate home directory for: \$name" >&2
600 exit 1
36ce8bec 601 fi
a687059c 602 case "\$1" in
603 */*)
604 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
605 ;;
606 *)
607 echo \$dir
608 ;;
609 esac
13281fa4 610 fi
611 ;;
a687059c 612*)
613 echo \$1
614 ;;
13281fa4 615esac
a687059c 616EOSS
617chmod +x filexp
618$eunicefix filexp
13281fa4 619
a687059c 620: determine where public executables go
621case "$bin" in
622'')
623 dflt=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin`
624 ;;
625*) dflt="$bin"
626 ;;
378cc40b 627esac
a687059c 628cont=true
629while $test "$cont" ; do
630 echo " "
631 rp="Where do you want to put the public executables? [$dflt]"
632 $echo $n "$rp $c"
633 . myread
634 bin="$ans"
635 bin=`filexp $bin`
636 if test -d $bin; then
637 cont=''
638 else
639 case "$fastread" in
640 yes) dflt=y;;
641 *) dflt=n;;
642 esac
643 rp="Directory $bin doesn't exist. Use that name anyway? [$dflt]"
378cc40b 644 $echo $n "$rp $c"
645 . myread
a687059c 646 dflt=''
378cc40b 647 case "$ans" in
a687059c 648 y*) cont='';;
378cc40b 649 esac
378cc40b 650 fi
a687059c 651done
378cc40b 652
a687059c 653: determine where manual pages go
654$cat <<EOM
655
656$package has manual pages that need to be installed in source form.
657EOM
658case "$mansrc" in
659'')
660 dflt=`loc . /usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1 /usr/man/u_man/man1 /usr/man/man1 /usr/man/man.L`
661 ;;
662*) dflt="$mansrc"
663 ;;
664esac
665cont=true
666while $test "$cont" ; do
667 echo " "
668 rp="Where do the manual pages (source) go? [$dflt]"
669 $echo $n "$rp $c"
670 . myread
671 mansrc=`filexp "$ans"`
672 if $test -d "$mansrc"; then
673 cont=''
674 else
675 if $test "$fastread" = yes; then
676 dflt=y
677 else
678 dflt=n
679 fi
680 rp="Directory $mansrc doesn't exist. Use that name anyway? [$dflt]"
681 $echo $n "$rp $c"
682 . myread
683 dflt=''
684 case "$ans" in
685 y*) cont='';;
686 esac
687 fi
688done
689case "$mansrc" in
690*l)
691 manext=l
692 ;;
693*n)
694 manext=n
695 ;;
696*o)
697 manext=l
698 ;;
699*p)
700 manext=n
701 ;;
702*C)
703 manext=C
704 ;;
705*L)
706 manext=L
707 ;;
708*)
709 manext=1
710 ;;
711esac
712
91407755 713: make some quick guesses about what we are up against
714echo " "
715$echo $n "Hmm... $c"
716cat /usr/include/signal.h /usr/include/sys/signal.h >foo
717if test `echo abc | tr a-z A-Z` = Abc ; then
718 echo "Looks kind of like a USG system, but we'll see..."
719 echo exit 1 >bsd
720 echo exit 0 >usg
721 echo exit 1 >v7
722elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
723 echo "Looks kind of like a BSD system, but we'll see..."
724 echo exit 0 >bsd
725 echo exit 1 >usg
726 echo exit 1 >v7
727else
728 echo "Looks kind of like a version 7 system, but we'll see..."
729 echo exit 1 >bsd
730 echo exit 1 >usg
731 echo exit 0 >v7
732fi
733case "$eunicefix" in
734*unixtovms*)
735 cat <<'EOI'
736There is, however, a strange, musty smell in the air that reminds me of
737something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
738EOI
739 echo "exit 0" >eunice
740 d_eunice="$define"
741 ;;
742*)
743 echo " "
744 echo "Congratulations. You aren't running Eunice."
745 d_eunice="$undef"
746 echo "exit 1" >eunice
747 ;;
748esac
749if test -f /xenix; then
750 echo "Actually, this looks more like a XENIX system..."
751 echo "exit 0" >xenix
752else
753 echo " "
754 echo "It's not Xenix..."
755 echo "exit 1" >xenix
756fi
757chmod +x xenix
758$eunicefix xenix
759if test -f /venix; then
760 echo "Actually, this looks more like a VENIX system..."
761 echo "exit 0" >venix
762else
763 echo " "
764 if xenix; then
765 : null
766 else
767 echo "Nor is it Venix..."
768 fi
769 echo "exit 1" >venix
770fi
771chmod +x bsd usg v7 eunice venix
772$eunicefix bsd usg v7 eunice venix
773rm -rf foo
774rmlist="$rmlist bsd usg v7 eunice venix xenix"
775
a687059c 776: see what memory models we can support
777case "$models" in
778'')
779 : We may not use Cppsym or we get a circular dependency through cc.
780 : But this should work regardless of which cc we eventually use.
781 cat >pdp11.c <<'EOP'
782main() {
783#ifdef pdp11
784 exit(0);
785#else
786 exit(1);
787#endif
788}
789EOP
790 cc -o pdp11 pdp11.c >/dev/null 2>&1
791 if pdp11 2>/dev/null; then
792 dflt='unsplit split'
793 else
794 ans=`loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
795 case "$ans" in
796 X) dflt='none';;
797 *) if $test -d /lib/small || $test -d /usr/lib/small; then
798 dflt='small'
799 else
800 dflt=''
801 fi
802 if $test -d /lib/medium || $test -d /usr/lib/medium; then
803 dflt="$dflt medium"
804 fi
805 if $test -d /lib/large || $test -d /usr/lib/large; then
806 dflt="$dflt large"
807 fi
808 if $test -d /lib/huge || $test -d /usr/lib/huge; then
809 dflt="$dflt huge"
810 fi
811 esac
812 fi
813 ;;
814*) dflt="$models" ;;
815esac
816$cat <<EOM
817
818Some systems have different model sizes. On most systems they are called
819small, medium, large, and huge. On the PDP11 they are called unsplit and
820split. If your system doesn't support different memory models, say "none".
821If you wish to force everything to one memory model, say "none" here and
822put the appropriate flags later when it asks you for other cc and ld flags.
823Venix systems may wish to put "none" and let the compiler figure things out.
824(In the following question multiple model names should be space separated.)
825
826EOM
827rp="Which models are supported? [$dflt]"
828$echo $n "$rp $c"
829. myread
830models="$ans"
831
832case "$models" in
833none)
834 small=''
835 medium=''
836 large=''
837 huge=''
838 unsplit=''
839 split=''
840 ;;
841*split)
842 case "$split" in
843 '')
844 if $contains '\-i' $mansrc/man1/ld.1 >/dev/null 2>&1 || \
845 $contains '\-i' $mansrc/man1/cc.1 >/dev/null 2>&1; then
846 dflt='-i'
847 else
848 dflt='none'
849 fi
850 ;;
851 *) dflt="$split";;
852 esac
853 rp="What flag indicates separate I and D space? [$dflt]"
854 $echo $n "$rp $c"
855 . myread
856 case "$ans" in
857 none) ans='';;
858 esac
859 split="$ans"
860 unsplit=''
861 ;;
862*large*|*small*|*medium*|*huge*)
863 case "$models" in
864 *large*)
865 case "$large" in
866 '') dflt='-Ml';;
867 *) dflt="$large";;
868 esac
869 rp="What flag indicates large model? [$dflt]"
870 $echo $n "$rp $c"
871 . myread
872 case "$ans" in
873 none) ans='';
874 esac
875 large="$ans"
876 ;;
877 *) large='';;
878 esac
879 case "$models" in
880 *huge*)
881 case "$huge" in
882 '') dflt='-Mh';;
883 *) dflt="$huge";;
884 esac
885 rp="What flag indicates huge model? [$dflt]"
886 $echo $n "$rp $c"
887 . myread
888 case "$ans" in
889 none) ans='';
890 esac
891 huge="$ans"
892 ;;
893 *) huge="$large";;
894 esac
895 case "$models" in
896 *medium*)
897 case "$medium" in
898 '') dflt='-Mm';;
899 *) dflt="$medium";;
900 esac
901 rp="What flag indicates medium model? [$dflt]"
902 $echo $n "$rp $c"
903 . myread
904 case "$ans" in
905 none) ans='';
906 esac
907 medium="$ans"
908 ;;
909 *) medium="$large";;
910 esac
911 case "$models" in
912 *small*)
913 case "$small" in
914 '') dflt='none';;
915 *) dflt="$small";;
916 esac
917 rp="What flag indicates small model? [$dflt]"
918 $echo $n "$rp $c"
919 . myread
920 case "$ans" in
921 none) ans='';
922 esac
923 small="$ans"
924 ;;
925 *) small='';;
926 esac
927 ;;
928*)
929 echo "Unrecognized memory models--you may have to edit Makefile.SH"
930 ;;
931esac
932
933: see if we need a special compiler
934echo " "
935if usg; then
936 case "$cc" in
937 '')
938 case "$Mcc" in
939 /*) dflt='Mcc'
940 ;;
941 *)
942 case "$large" in
943 -M*)
944 dflt='cc'
945 ;;
946 *)
947 if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then
948 dflt='cc -M'
949 else
950 dflt='cc'
951 fi
952 ;;
953 esac
954 ;;
955 esac
956 ;;
957 *) dflt="$cc";;
958 esac
959 $cat <<'EOM'
960
961On some systems the default C compiler will not resolve multiple global
962references that happen to have the same name. On some such systems the
963"Mcc" command may be used to force these to be resolved. On other systems
964a "cc -M" command is required. (Note that the -M flag on other systems
965indicates a memory model to use!) If you have the Gnu C compiler, you
966might wish to use that instead. What command will force resolution on
967EOM
968 $echo $n "this system? [$dflt] $c"
969 rp="Command to resolve multiple refs? [$dflt]"
970 . myread
971 cc="$ans"
972else
973 case "$cc" in
974 '') dflt=cc;;
975 *) dflt="$cc";;
976 esac
977 rp="Use which C compiler? [$dflt]"
978 $echo $n "$rp $c"
979 . myread
980 cc="$ans"
981fi
982case "$cc" in
983gcc*) cpp=`loc gcc-cpp $cpp $pth`;;
984esac
985
986: determine optimize, if desired, or use for debug flag also
987case "$optimize" in
988' ') dflt="none"
989 ;;
990'') dflt="-O";
991 ;;
992*) dflt="$optimize"
993 ;;
994esac
995cat <<EOH
91407755 996
a687059c 997Some C compilers have problems with their optimizers, by default, $package
998compiles with the -O flag to use the optimizer. Alternately, you might
999want to use the symbolic debugger, which uses the -g flag (on traditional
1000Unix systems). Either flag can be specified here. To use neither flag,
1001specify the word "none".
1002
1003EOH
1004rp="What optimizer/debugger flag should be used? [$dflt]"
1005$echo $n "$rp $c"
1006. myread
1007optimize="$ans"
1008case "$optimize" in
1009'none') optimize=" "
1010 ;;
1011esac
1012
1013case "$ccflags" in
1014'') case "$cc" in
91407755 1015 *gcc*) dflt='-fpcc-struct-return';;
a687059c 1016 *) dflt='none';;
1017 esac
1018 ;;
1019*) dflt="$ccflags";;
1020esac
91407755 1021if test -d /usr/netinclude; then
1022 case "$dflt" in
1023 *netinclude*);;
1024 *) dflt="$dflt -I/usr/netinclude";;
1025 esac
1026fi
1027case "$optimize" in
1028-g*)
1029 case "$dflt" in
1030 *DEBUGGING*);;
1031 *) dflt="$dflt -DDEBUGGING";;
1032 esac
1033 ;;
1034esac
1035cat <<EOH
1036
1037Your C compiler may want other flags. For this question you should
1038include -I/whatever and -DWHATEVER flags and any other flags used by
1039the C compiler, but you should NOT include libraries or ld flags like
1040-lwhatever. To use no flags, specify the word "none".
1041
1042EOH
a687059c 1043rp="Any additional cc flags? [$dflt]"
1044$echo $n "$rp $c"
1045. myread
1046case "$ans" in
1047none) ans='';
1048esac
1049ccflags="$ans"
1050
91407755 1051: the following weeds options from ccflags that are of no interest to cpp
1052cppflags="$ccflags"
1053case "$cc" in
1054*gcc*) cppflags="$cppflags -D__GNUC__";;
1055esac
1056case "$cppflags" in
1057'');;
1058*) set X $cppflags
1059 cppflags=''
1060 for flag do
1061 case $flag in
1062 -D*|-I*) cppflags="$cppflags $flag";;
1063 esac
1064 done
1065 case "$cppflags" in
1066 *-*) echo "(C preprocessor flags: $cppflags)";;
1067 esac
1068 ;;
1069esac
1070
a687059c 1071case "$ldflags" in
1072'') if venix; then
1073 dflt='-i -z'
1074 else
1075 dflt='none'
1076 fi
1077 ;;
1078*) dflt="$ldflags";;
1079esac
1080echo " "
1081rp="Any additional ld flags (NOT including libraries)? [$dflt]"
1082$echo $n "$rp $c"
1083. myread
1084case "$ans" in
1085none) ans='';
1086esac
1087ldflags="$ans"
1088rmlist="$rmlist pdp11"
1089
91407755 1090echo " "
1091echo "Checking for optional libraries..."
a687059c 1092case "$libs" in
91407755 1093'') dflt='';;
a687059c 1094*) dflt="$libs";;
1095esac
91407755 1096case "$libswanted" in
1097'') libswanted='c_s';;
1098esac
1099for thislib in $libswanted; do
1100 if xxx=`loc lib$thislib.a X /usr/lib /usr/local/lib /lib`; then
1101 echo "Found -l$thislib."
1102 case "$dflt" in
1103 *-l$thislib*);;
1104 *) dflt="$dflt -l$thislib";;
1105 esac
1106 elif xxx=`loc lib$thislib.a X $libpth`; then
1107 echo "Found $xxx."
1108 case "$dflt" in
1109 *$xxx*);;
1110 *) dflt="$dflt $xxx";;
1111 esac
1112 else
1113 echo "No -l$thislib."
1114 fi
1115done
1116set X $dflt
1117shift
1118dflt="$*"
1119case "$dflt" in
1120'') dflt='none';;
1121esac
a687059c 1122
1123$cat <<EOM
1124
1125Some versions of Unix support shared libraries, which make
1126executables smaller but make load time slightly longer.
1127
1128On some systems, mostly newer Unix System V's, the shared library
1129is included by putting the option "-lc_s" as the last thing on the
1130cc command line when linking. Other systems use shared libraries
1131by default. There may be other libraries needed to compile $package
1132on your machine as well. If your system needs the "-lc_s" option,
1133include it here. Include any other special libraries here as well.
1134EOM
1135
1136echo " "
1137rp="Any additional libraries? [$dflt]"
1138$echo $n "$rp $c"
1139. myread
1140case "$ans" in
1141none) ans='';
1142esac
1143libs="$ans"
1144
1145: check for ordering of bytes in a long
1146case "$byteorder" in
1147'')
1148cat <<'EOM'
1149
1150In the following, larger digits indicate more significance. A big-endian
1151machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
1152little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
91407755 1153machines may have weird orders like 3412. A Cray will report 87654321. If
1154the test program works the default is probably right.
1155I'm now running the test program...
a687059c 1156EOM
1157 $cat >try.c <<'EOCP'
1158#include <stdio.h>
1159main()
1160{
1161 int i;
1162 union {
1163 unsigned long l;
91407755 1164 char c[8];
a687059c 1165 } u;
1166
91407755 1167 u.l = 0x0807060504030201;
1168 for (i=0; i < sizeof(long); i++)
1169 printf("%c",u.c[i]+'0');
1170 printf("\n");
a687059c 1171}
1172EOCP
1173 if $cc try.c -o try >/dev/null 2>&1 ; then
1174 dflt=`try`
1175 case "$dflt" in
91407755 1176 ????|????????) echo "(The test program ran ok.)";;
a687059c 1177 *) echo "(The test program didn't run right for some reason.)";;
1178 esac
1179 else
1180 dflt='4321'
1181 echo "(I can't seem to compile the test program. Guessing big-endian...)"
1182 fi
1183 ;;
1184*)
1185 echo " "
1186 dflt="$byteorder"
1187 ;;
1188esac
1189rp="What is the order of bytes in a long? [$dflt]"
1190$echo $n "$rp $c"
1191. myread
1192byteorder="$ans"
1193$rm -f try.c try
1194
1195: see how we invoke the C preprocessor
1196echo " "
1197echo "Now, how can we feed standard input to your C preprocessor..."
1198cat <<'EOT' >testcpp.c
1199#define ABC abc
1200#define XYZ xyz
1201ABC.XYZ
1202EOT
1203echo 'Maybe "'"$cc"' -E" will work...'
1204$cc -E <testcpp.c >testcpp.out 2>&1
91407755 1205: try to force gcc preprocessor if that is the compiler they are using
1206case $? in
12070) cppstdin="$cc -E";;
1208*) case "$cc" in
1209 *gcc*)
1210 cd ..
1211 echo 'Trying (cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c)'
1212 echo 'cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c' >cppstdin
1213 chmod 755 cppstdin
1214 cppstdin=`pwd`/cppstdin
1215 cppminus='';
1216 cd UU
1217 $cppstdin <testcpp.c >testcpp.out 2>&1
1218 ;;
1219 esac
1220 ;;
1221esac
a687059c 1222if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1223 echo "Yup, it does."
1224 cppstdin="$cc -E"
1225 cppminus='';
1226else
1227 echo 'Nope, maybe "'$cpp'" will work...'
1228 $cpp <testcpp.c >testcpp.out 2>&1
1229 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1230 echo "Yup, it does."
1231 cppstdin="$cpp"
1232 cppminus='';
1233 else
1234 echo 'No such luck...maybe "'$cpp' -" will work...'
1235 $cpp - <testcpp.c >testcpp.out 2>&1
1236 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1237 echo "It works!"
1238 cppstdin="$cpp"
1239 cppminus='-';
1240 else
1241 echo 'Nixed again...maybe "'"$cc"' -E -" will work...'
1242 $cc -E - <testcpp.c >testcpp.out 2>&1
1243 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1244 echo "Hooray, it works! I was beginning to wonder."
1245 cppstdin="$cc -E"
1246 cppminus='-';
1247 else
1248 echo 'Nope...maybe "'"$cc"' -P" will work...'
1249 $cc -P <testcpp.c >testcpp.out 2>&1
1250 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1251 echo "Yup, that does."
1252 cppstdin="$cc -P"
1253 cppminus='';
1254 else
1255 echo 'Nope...maybe "'"$cc"' -P -" will work...'
1256 $cc -P - <testcpp.c >testcpp.out 2>&1
1257 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1258 echo "Yup, that does."
1259 cppstdin="$cc -P"
1260 cppminus='-';
1261 else
1262 echo 'Hmm...perhaps you already told me...'
1263 case "$cppstdin" in
1264 '') ;;
1265 *) $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1;;
1266 esac
1267 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1268 echo "Hooray, you did! I was beginning to wonder."
1269 else
1270 echo 'Uh-uh. Time to get fancy...'
1271 cd ..
1272 echo 'Trying (cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c)'
1273 echo 'cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c' >cppstdin
1274 chmod 755 cppstdin
1275 cppstdin=`pwd`/cppstdin
1276 cppminus='';
1277 cd UU
1278 $cppstdin <testcpp.c >testcpp.out 2>&1
1279 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1280 echo "Eureka!."
1281 else
1282 dflt=blurfl
1283 $echo $n "No dice. I can't find a C preprocessor. Name one: $c"
1284 rp='Name a C preprocessor:'
1285 . myread
1286 cppstdin="$ans"
1287 $cppstdin <testcpp.c >testcpp.out 2>&1
1288 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1289 echo "OK, that will do."
1290 else
1291 echo "Sorry, I can't get that to work. Go find one."
1292 exit 1
1293 fi
1294 fi
1295 fi
1296 fi
1297 fi
1298 fi
1299 fi
1300 fi
1301fi
1302rm -f testcpp.c testcpp.out
1303
91407755 1304: get list of predefined functions in a handy place
1305echo " "
1306case "$libc" in
1307'') libc=unknown;;
1308esac
1309case "$libpth" in
1310'') libpth='/lib /usr/lib /usr/local/lib';;
1311esac
1312case "$libs" in
1313*-lc_s*) libc=`loc libc_s.a $libc $libpth`
1314esac
1315libnames='';
1316case "$libs" in
1317'') ;;
1318*) for thislib in $libs; do
1319 case "$thislib" in
1320 -l*) thislib=`expr X$thislib : 'X-l\(.*\)'`
1321 try=`loc lib$thislib.a blurfl/dyick $libpth`
1322 if test ! -f $try; then
1323 try=`loc lib$thislib blurfl/dyick $libpth`
1324 if test ! -f $try; then
1325 try=`loc $thislib blurfl/dyick $libpth`
1326 if test ! -f $try; then
1327 try=''
1328 fi
1329 fi
1330 fi
1331 libnames="$libnames $try"
1332 ;;
1333 *) libnames="$libnames $thisname" ;;
1334 esac
1335 done
1336 ;;
1337esac
1338set /usr/lib/libc.so.[0-9]*
1339eval set \$$#
1340if test -f "$1"; then
1341 echo "Your shared C library is in $1."
1342 libc="$1"
1343elif test -f $libc; then
1344 echo "Your C library is in $libc, like you said before."
1345elif test -f /lib/libc.a; then
1346 echo "Your C library is in /lib/libc.a. You're normal."
1347 libc=/lib/libc.a
1348else
1349 ans=`loc libc.a blurfl/dyick $libpth`
1350 if test ! -f "$ans"; then
1351 ans=`loc libc blurfl/dyick $libpth`
1352 fi
1353 if test ! -f "$ans"; then
1354 ans=`loc clib blurfl/dyick $libpth`
1355 fi
1356 if test ! -f "$ans"; then
1357 ans=`loc Slibc.a blurfl/dyick /usr/lib/386 /lib/386 $libpth`
1358 fi
1359 if test ! -f "$ans"; then
1360 ans=`loc Mlibc.a blurfl/dyick $libpth`
1361 fi
1362 if test ! -f "$ans"; then
1363 ans=`loc Llibc.a blurfl/dyick $libpth`
1364 fi
1365 if test -f "$ans"; then
1366 echo "Your C library is in $ans, of all places."
1367 libc=$ans
1368 else
1369 cat <<EOM
1370
1371I can't seem to find your C library. I've looked in the following places:
1372
1373 $libpth
1374
1375None of these seems to contain your C library. What is the full name
1376EOM
1377 dflt=None
1378 $echo $n "of your C library? $c"
1379 rp='C library full name?'
1380 . myread
1381 libc="$ans"
1382 fi
1383fi
1384echo " "
1385set $libc $libnames
1386$echo $n "Extracting names from $* for later perusal...$c"
1387nm $* 2>/dev/null >libc.tmp
1388$sed -n -e 's/^.* [AT] *_[_.]*//p' -e 's/^.* [AT] //p' <libc.tmp >libc.list
1389if $contains '^printf$' libc.list >/dev/null 2>&1; then
1390 echo "done"
1391else
1392 $sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p' <libc.tmp >libc.list
1393 $contains '^printf$' libc.list >/dev/null 2>&1 || \
1394 $sed -n -e 's/^.* D __*//p' -e 's/^.* D //p' <libc.tmp >libc.list
1395 $contains '^printf$' libc.list >/dev/null 2>&1 || \
1396 $sed -n -e 's/^_//' \
1397 -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p' <libc.tmp >libc.list
1398 if $contains '^printf$' libc.list >/dev/null 2>&1; then
1399 echo "done"
1400 else
1401 echo " "
1402 echo "nm didn't seem to work right."
1403 echo "Trying ar instead..."
1404 if ar t $libc > libc.tmp; then
1405 for thisname in $libnames; do
1406 ar t $thisname >>libc.tmp
1407 done
1408 $sed -e 's/\.o$//' < libc.tmp > libc.list
1409 echo "Ok."
1410 else
1411 echo "ar didn't seem to work right."
1412 echo "Maybe this is a Cray...trying bld instead..."
1413 if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
1414 for thisname in $libnames; do
1415 bld t $libnames | \
1416 $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
1417 ar t $thisname >>libc.tmp
1418 done
1419 echo "Ok."
1420 else
1421 echo "That didn't work either. Giving up."
1422 exit 1
1423 fi
1424 fi
1425 fi
1426fi
1427
1428inlibc='echo " ";
1429if $contains "^$1\$" libc.list >/dev/null 2>&1;
1430then echo "$1() found"; eval "$2=$define";
1431else echo "$1() not found"; eval "$2=$undef"; fi'
1432
1433rmlist="$rmlist libc.tmp libc.list"
1434
a687059c 1435: see if bcmp exists
1436set bcmp d_bcmp
1437eval $inlibc
1438
1439: see if bcopy exists
1440set bcopy d_bcopy
1441eval $inlibc
1442
1443: see if sprintf is declared as int or pointer to char
1444echo " "
1445cat >.ucbsprf.c <<'EOF'
1446main() { char buf[10]; exit((unsigned long)sprintf(buf,"%s","foo") > 10L); }
1447EOF
1448if $cc $ccflags .ucbsprf.c -o .ucbsprf >/dev/null 2>&1 && .ucbsprf; then
1449 echo "Your sprintf() returns (int)."
1450 d_charsprf="$undef"
1451else
1452 echo "Your sprintf() returns (char*)."
1453 d_charsprf="$define"
1454fi
1455/bin/rm -f .ucbsprf.c .ucbsprf
1456
1457: see if vprintf exists
1458echo " "
1459if $contains '^vprintf$' libc.list >/dev/null 2>&1; then
1460 echo 'vprintf() found.'
1461 d_vprintf="$define"
1462 cat >.ucbsprf.c <<'EOF'
1463#include <varargs.h>
1464
1465main() { xxx("foo"); }
1466
1467xxx(va_alist)
1468va_dcl
1469{
1470 va_list args;
1471 char buf[10];
1472
1473 va_start(args);
1474 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
1475}
1476EOF
1477 if $cc $ccflags .ucbsprf.c -o .ucbsprf >/dev/null 2>&1 && .ucbsprf; then
1478 echo "Your vsprintf() returns (int)."
1479 d_charvspr="$undef"
1480 else
1481 echo "Your vsprintf() returns (char*)."
1482 d_charvspr="$define"
1483 fi
1484 /bin/rm -f .ucbsprf.c .ucbsprf
1485else
1486 echo 'vprintf() not found.'
1487 d_vprintf="$undef"
1488 d_charvspr="$undef"
1489fi
1490
1491: see if crypt exists
1492echo " "
1493if $contains '^crypt$' libc.list >/dev/null 2>&1; then
1494 echo 'crypt() found.'
1495 d_crypt="$define"
1496 cryptlib=''
1497else
1498 cryptlib=`loc Slibcrypt.a "" /lib/386 /lib`
1499 if $test -z "$cryptlib"; then
1500 cryptlib=`loc Mlibcrypt.a "" /lib/386 /lib`
1501 else
1502 cryptlib=-lcrypt
1503 fi
1504 if $test -z "$cryptlib"; then
1505 cryptlib=`loc Llibcrypt.a "" /lib/386 /lib`
1506 else
1507 cryptlib=-lcrypt
1508 fi
1509 if $test -z "$cryptlib"; then
1510 cryptlib=`loc libcrypt.a "" $libpth`
1511 else
1512 cryptlib=-lcrypt
1513 fi
1514 if $test -z "$cryptlib"; then
1515 echo 'crypt() not found.'
1516 d_crypt="$undef"
1517 else
1518 d_crypt="$define"
1519 fi
1520fi
1521
91407755 1522: get csh whereabouts
1523case "$csh" in
1524'csh') d_csh="$undef" ;;
1525*) d_csh="$define" ;;
1526esac
1527
a687059c 1528: see if this is a dirent system
1529echo " "
1530if $test -r /usr/include/dirent.h ; then
1531 i_dirent="$define"
1532 echo "dirent.h found."
1533 if $contains 'd_namlen' /usr/include/sys/dirent.h >/dev/null 2>&1; then
1534 d_dirnamlen="$define"
1535 else
1536 d_dirnamlen="$undef"
1537 fi
1538else
1539 i_dirent="$undef"
1540 d_dirnamlen="$define"
1541 echo "No dirent.h found."
1542fi
1543
1544: now see if they want to do setuid emulation
1545case "$d_dosuid" in
1546'') dflt=n;;
1547*undef*) dflt=n;;
1548*) dflt=y;;
1549esac
1550cat <<EOM
1551
1552Some sites have disabled setuid #! scripts because of a bug in the kernel
1553that prevents them from being secure. If you are on such a system, the
1554setuid/setgid bits on scripts are currently useless. It is possible for
1555$package to detect those bits and emulate setuid/setgid in a secure fashion
1556until a better solution is devised for the kernel problem.
1557
1558EOM
1559rp="Do you want to do setuid/setgid emulation? [$dflt]"
1560echo $n "$rp $c"
1561. myread
1562case "$ans" in
1563'') $ans="$dflt";;
1564esac
1565case "$ans" in
1566y*) d_dosuid="$define";;
1567*) d_dosuid="$undef";;
1568esac
1569
1570: see if dup2 exists
1571set dup2 d_dup2
1572eval $inlibc
1573
1574: see if fchmod exists
1575set fchmod d_fchmod
1576eval $inlibc
1577
1578: see if fchown exists
1579set fchown d_fchown
1580eval $inlibc
1581
1582: see if this is an fcntl system
1583echo " "
1584if $test -r /usr/include/fcntl.h ; then
1585 d_fcntl="$define"
1586 echo "fcntl.h found."
1587else
1588 d_fcntl="$undef"
1589 echo "No fcntl.h found, but that's ok."
1590fi
1591
1592: see if flock exists
1593set flock d_flock
1594eval $inlibc
1595
1596: see if getgroups exists
1597set getgroups d_getgrps
1598eval $inlibc
1599
1600: see if gethostent exists
1601set gethostent d_gethent
1602eval $inlibc
1603
1604: see if getpgrp exists
1605set getpgrp d_getpgrp
1606eval $inlibc
1607
1608: see if getpriority exists
1609set getpriority d_getprior
1610eval $inlibc
1611
1612: see if htonl exists
1613set htonl d_htonl
1614eval $inlibc
1615
1616: index or strcpy
378cc40b 1617echo " "
a687059c 1618case "$d_index" in
1619n) dflt=n;;
1620*) dflt=y;;
1621esac
1622if $contains '^index$' libc.list >/dev/null 2>&1 ; then
1623 if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
1624 echo "Your system has both index() and strchr(). Shall I use"
1625 rp="index() rather than strchr()? [$dflt]"
1626 $echo $n "$rp $c"
1627 . myread
1628 case "$ans" in
1629 n*) d_index="$define" ;;
1630 *) d_index="$undef" ;;
1631 esac
1632 else
1633 d_index="$undef"
1634 echo "index() found."
1635 fi
378cc40b 1636else
a687059c 1637 if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
1638 d_index="$define"
1639 echo "strchr() found."
1640 else
1641 echo "No index() or strchr() found!"
1642 d_index="$undef"
1643 fi
378cc40b 1644fi
1645
a687059c 1646: see if ioctl defs are in sgtty/termio or sys/ioctl
378cc40b 1647echo " "
a687059c 1648if $test -r /usr/include/sys/ioctl.h ; then
1649 d_ioctl="$define"
1650 echo "sys/ioctl.h found."
378cc40b 1651else
a687059c 1652 d_ioctl="$undef"
1653 echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h."
378cc40b 1654fi
1655
a687059c 1656: see if killpg exists
1657set killpg d_killpg
1658eval $inlibc
1659
1660: see if memcmp exists
1661set memcmp d_memcmp
1662eval $inlibc
1663
1664: see if memcpy exists
1665set memcpy d_memcpy
1666eval $inlibc
1667
1668: see if mkdir exists
1669set mkdir d_mkdir
1670eval $inlibc
1671
1672: see if ndbm is available
378cc40b 1673echo " "
91407755 1674if xxx=`loc ndbm.h x /usr/include /usr/local/include /usr/netinclude`; then
a687059c 1675 d_ndbm="$define"
1676 echo "ndbm.h found."
378cc40b 1677else
a687059c 1678 d_ndbm="$undef"
1679 echo "ndbm.h not found."
378cc40b 1680fi
1681
a687059c 1682: see if we have the old dbm
378cc40b 1683echo " "
91407755 1684if xxx=`loc dbm.h x /usr/include /usr/local/include /usr/netinclude`; then
a687059c 1685 d_odbm="$define"
1686 echo "dbm.h found."
378cc40b 1687else
a687059c 1688 d_odbm="$undef"
1689 echo "dbm.h not found."
378cc40b 1690fi
1691
03a14243 1692: see if this is a pwd system
378cc40b 1693echo " "
a687059c 1694if $test -r /usr/include/pwd.h ; then
1695 i_pwd="$define"
1696 echo "pwd.h found."
91407755 1697 $cppstdin $cppflags </usr/include/pwd.h >$$.h
1698 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
a687059c 1699 d_pwquota="$define"
1700 else
1701 d_pwquota="$undef"
1702 fi
91407755 1703 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
a687059c 1704 d_pwage="$define"
1705 else
1706 d_pwage="$undef"
1707 fi
91407755 1708 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
03a14243 1709 d_pwchange="$define"
1710 else
1711 d_pwchange="$undef"
1712 fi
91407755 1713 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
03a14243 1714 d_pwclass="$define"
1715 else
1716 d_pwclass="$undef"
1717 fi
91407755 1718 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
03a14243 1719 d_pwexpire="$define"
1720 else
1721 d_pwexpire="$undef"
1722 fi
91407755 1723 rm -f $$.h
378cc40b 1724else
a687059c 1725 i_pwd="$undef"
1726 d_pwquota="$undef"
1727 d_pwage="$undef"
03a14243 1728 d_pwchange="$undef"
1729 d_pwclass="$undef"
1730 d_pwexpire="$undef"
a687059c 1731 echo "No pwd.h found."
378cc40b 1732fi
1733
a687059c 1734: see if readdir exists
1735set readdir d_readdir
1736eval $inlibc
1737
1738: see if rename exists
1739set rename d_rename
1740eval $inlibc
1741
1742: see if rmdir exists
1743set rmdir d_rmdir
1744eval $inlibc
1745
1746: see if setegid exists
1747set setegid d_setegid
1748eval $inlibc
1749
1750: see if seteuid exists
1751set seteuid d_seteuid
1752eval $inlibc
1753
1754: see if setpgrp exists
1755set setpgrp d_setpgrp
1756eval $inlibc
1757
1758: see if setpriority exists
1759set setpriority d_setprior
1760eval $inlibc
1761
1762: see if setregid exists
1763set setregid d_setregid
1764eval $inlibc
1765set setresgid d_setresgid
1766eval $inlibc
1767
1768: see if setreuid exists
1769set setreuid d_setreuid
1770eval $inlibc
1771set setresuid d_setresuid
1772eval $inlibc
1773
1774: see if setrgid exists
1775set setrgid d_setrgid
1776eval $inlibc
1777
378cc40b 1778: see if setruid exists
a687059c 1779set setruid d_setruid
1780eval $inlibc
1781
1782socketlib=''
a687059c 1783: see whether socket exists
378cc40b 1784echo " "
a687059c 1785if $contains socket libc.list >/dev/null 2>&1; then
1786 echo "Looks like you have Berkeley networking support."
1787 d_socket="$define"
1788 : now check for advanced features
1789 if $contains setsockopt libc.list >/dev/null 2>&1; then
1790 d_oldsock="$undef"
1791 else
1792 echo "...but it uses the old 4.1c interface, rather than 4.2"
1793 d_oldsock="$define"
1794 fi
1795else
1796 : hpux, for one, puts all the socket stuff in socklib.o
1797 if $contains socklib libc.list >/dev/null 2>&1; then
1798 echo "Looks like you have Berkeley networking support."
1799 d_socket="$define"
1800 : we will have to assume that it supports the 4.2 BSD interface
1801 d_oldsock="$undef"
1802 else
1803 echo "Hmmm...you don't have Berkeley networking in libc.a..."
1804 : look for an optional networking library
1805 if test -f /usr/lib/libnet.a; then
1806 (ar t /usr/lib/libnet.a ||
1807 nm -g /usr/lib/libnet.a) 2>/dev/null >> libc.list
1808 if $contains socket libc.list >/dev/null 2>&1; then
1809 echo "but the Wollongong group seems to have hacked it in."
1810 socketlib="-lnet"
a687059c 1811 d_socket="$define"
1812 : now check for advanced features
1813 if $contains setsockopt libc.list >/dev/null 2>&1; then
1814 d_oldsock="$undef"
1815 else
1816 echo "...using the old 4.1c interface, rather than 4.2"
1817 d_oldsock="$define"
1818 fi
1819 else
1820 echo "or even in libnet.a, which is peculiar."
1821 d_socket="$undef"
1822 d_oldsock="$undef"
1823 fi
1824 else
1825 echo "or anywhere else I see."
1826 d_socket="$undef"
1827 d_oldsock="$undef"
1828 fi
1829 fi
1830fi
1831if $contains socketpair libc.list >/dev/null 2>&1; then
1832 d_sockpair="$define"
378cc40b 1833else
a687059c 1834 d_sockpair="$undef"
8d063cd8 1835fi
1836
135863df 1837: see if stat knows about block sizes
1838echo " "
1839if $contains 'st_blocks;' /usr/include/sys/stat.h >/dev/null 2>&1 ; then
1840 if $contains 'st_blksize;' /usr/include/sys/stat.h >/dev/null 2>&1 ; then
1841 echo "Your stat knows about block sizes."
1842 d_statblks="$define"
1843 else
1844 echo "Your stat doesn't know about block sizes."
1845 d_statblks="$undef"
1846 fi
1847else
1848 echo "Your stat doesn't know about block sizes."
1849 d_statblks="$undef"
1850fi
1851
36ce8bec 1852: see if stdio is really std
1853echo " "
1854if $contains 'char.*_ptr;' /usr/include/stdio.h >/dev/null 2>&1 ; then
1855 if $contains '_cnt;' /usr/include/stdio.h >/dev/null 2>&1 ; then
1856 echo "Your stdio is pretty std."
1857 d_stdstdio="$define"
1858 else
1859 echo "Your stdio isn't very std."
1860 d_stdstdio="$undef"
1861 fi
1862else
1863 echo "Your stdio isn't very std."
1864 d_stdstdio="$undef"
1865fi
1866
8d063cd8 1867: check for structure copying
1868echo " "
1869echo "Checking to see if your C compiler can copy structs..."
1870$cat >try.c <<'EOCP'
1871main()
1872{
1873 struct blurfl {
1874 int dyick;
1875 } foo, bar;
1876
1877 foo = bar;
1878}
1879EOCP
a687059c 1880if $cc -c try.c >/dev/null 2>&1 ; then
8d063cd8 1881 d_strctcpy="$define"
1882 echo "Yup, it can."
1883else
1884 d_strctcpy="$undef"
1885 echo "Nope, it can't."
1886fi
1887$rm -f try.*
1888
378cc40b 1889: see if symlink exists
a687059c 1890set symlink d_symlink
1891eval $inlibc
1892
1893: see if syscall exists
1894set syscall d_syscall
1895eval $inlibc
378cc40b 1896
135863df 1897: see if struct tm is defined in sys/time.h
1898echo " "
1899if $contains 'struct tm' /usr/include/time.h >/dev/null 2>&1 ; then
1900 echo "You have struct tm defined in <time.h> rather than <sys/time.h>."
1901 d_tminsys="$undef"
a687059c 1902 if test -f /usr/include/sys/time.h; then
1903 i_systime="$define"
1904 else
1905 i_systime="$undef"
1906 fi
135863df 1907else
1908 echo "You have struct tm defined in <sys/time.h> rather than <time.h>."
1909 d_tminsys="$define"
a687059c 1910 i_systime="$define"
135863df 1911fi
91407755 1912if $contains '^#.*include.*<time\.h>' /usr/include/sys/time.h >/dev/null 2>&1 ; then
1913 i_timetoo="$undef"
1914else
1915 i_timetoo="$define"
1916fi
135863df 1917
a687059c 1918: see if this is a varargs system
8d063cd8 1919echo " "
a687059c 1920if $test -r /usr/include/varargs.h ; then
1921 d_varargs="$define"
1922 echo "varargs.h found."
8d063cd8 1923else
a687059c 1924 d_varargs="$undef"
1925 echo "No varargs.h found, but that's ok (I hope)."
8d063cd8 1926fi
1927
a687059c 1928: see if there is a vfork
1929set vfork d_vfork
1930eval $inlibc
1931
36ce8bec 1932: see if signal is declared as pointer to function returning int or void
1933echo " "
1934if $contains 'void.*signal' /usr/include/signal.h >/dev/null 2>&1 ; then
1935 echo "You have void (*signal())() instead of int."
1936 d_voidsig="$define"
1937else
1938 echo "You have int (*signal())() instead of void."
1939 d_voidsig="$undef"
1940fi
1941
91407755 1942: see if there is a wait4
1943set wait4 d_wait4
1944eval $inlibc
1945
8d063cd8 1946: check for void type
1947echo " "
1948$cat <<EOM
1949Checking to see how well your C compiler groks the void type...
1950
1951 Support flag bits are:
1952 1: basic void declarations.
1953 2: arrays of pointers to functions returning void.
1954 4: operations between pointers to and addresses of void functions.
1955
1956EOM
1957case "$voidflags" in
1958'')
1959 $cat >try.c <<'EOCP'
1960#if TRY & 1
1961void main() {
1962#else
1963main() {
1964#endif
a687059c 1965 extern void moo(); /* function returning void */
1966 void (*goo)(); /* ptr to func returning void */
8d063cd8 1967#if TRY & 2
1968 void (*foo[10])();
1969#endif
1970
1971#if TRY & 4
a687059c 1972 if(goo == moo) {
8d063cd8 1973 exit(0);
1974 }
1975#endif
1976 exit(0);
1977}
1978EOCP
a687059c 1979 if $cc -S -DTRY=$defvoidused try.c >.out 2>&1 ; then
1980 voidflags=$defvoidused
1981 echo "It appears to support void."
8d063cd8 1982 if $contains warning .out >/dev/null 2>&1; then
1983 echo "However, you might get some warnings that look like this:"
1984 $cat .out
1985 fi
1986 else
a687059c 1987 echo "Hmm, your compiler has some difficulty with void. Checking further..."
1988 if $cc -S -DTRY=1 try.c >/dev/null 2>&1 ; then
8d063cd8 1989 echo "It supports 1..."
a687059c 1990 if $cc -S -DTRY=3 try.c >/dev/null 2>&1 ; then
8d063cd8 1991 voidflags=3
1992 echo "And it supports 2 but not 4."
1993 else
1994 echo "It doesn't support 2..."
a687059c 1995 if $cc -S -DTRY=5 try.c >/dev/null 2>&1 ; then
8d063cd8 1996 voidflags=5
1997 echo "But it supports 4."
1998 else
1999 voidflags=1
2000 echo "And it doesn't support 4."
2001 fi
2002 fi
2003 else
2004 echo "There is no support at all for void."
2005 voidflags=0
2006 fi
2007 fi
2008esac
2009dflt="$voidflags";
2010rp="Your void support flags add up to what? [$dflt]"
2011$echo $n "$rp $c"
2012. myread
2013voidflags="$ans"
2014$rm -f try.* .out
2015
378cc40b 2016: see what type gids are declared as in the kernel
2017case "$gidtype" in
2018'')
2019 if $contains 'gid_t;' /usr/include/sys/types.h >/dev/null 2>&1 ; then
2020 dflt='gid_t';
2021 else
2022 set `grep 'groups\[NGROUPS\];' /usr/include/sys/user.h 2>/dev/null` unsigned short
2023 case $1 in
2024 unsigned) dflt="$1 $2" ;;
2025 *) dflt="$1" ;;
2026 esac
2027 fi
2028 ;;
2029*) dflt="$gidtype"
2030 ;;
2031esac
2032cont=true
36ce8bec 2033echo " "
91407755 2034echo "(The following only matters if you have getgroups().)"
2035rp="What type are the group ids returned by getgroups()? [$dflt]"
378cc40b 2036$echo $n "$rp $c"
2037. myread
2038gidtype="$ans"
8d063cd8 2039
a687059c 2040: see if this is an fcntl system
2041echo " "
2042if $test -r /usr/include/fcntl.h ; then
2043 i_fcntl="$define"
2044 echo "fcntl.h found."
2045else
2046 i_fcntl="$undef"
2047 echo "No fcntl.h found, but that's ok."
2048fi
378cc40b 2049
a687059c 2050: see if this is an grp system
2051echo " "
2052if $test -r /usr/include/grp.h ; then
2053 i_grp="$define"
2054 echo "grp.h found."
2055else
2056 i_grp="$undef"
2057 echo "No grp.h found."
2058fi
378cc40b 2059
03a14243 2060: see if this is a netinet/in.h system
2061echo " "
91407755 2062if xxx=`loc netinet/in.h x /usr/include /usr/local/include /usr/netinclude`; then
03a14243 2063 i_niin="$define"
2064 echo "netinet/in.h found."
2065else
2066 i_niin="$undef"
2067 echo "No netinet/in.h found."
2068fi
2069
a687059c 2070: see if this is a sys/dir.h system
378cc40b 2071echo " "
a687059c 2072if $test -r /usr/include/sys/dir.h ; then
2073 i_sysdir="$define"
2074 echo "sysdir.h found."
378cc40b 2075else
a687059c 2076 i_sysdir="$undef"
2077 echo "No sysdir.h found."
378cc40b 2078fi
2079
a687059c 2080: see if ioctl defs are in sgtty/termio or sys/ioctl
378cc40b 2081echo " "
a687059c 2082if $test -r /usr/include/sys/ioctl.h ; then
2083 i_sysioctl="$define"
2084 echo "sys/ioctl.h found."
2085else
2086 i_sysioctl="$undef"
2087 echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h."
2088fi
378cc40b 2089
a687059c 2090: see if this is a varargs system
2091echo " "
2092if $test -r /usr/include/varargs.h ; then
2093 i_varargs="$define"
2094 echo "varargs.h found."
2095else
2096 i_varargs="$undef"
2097 echo "No varargs.h found, but that's ok (I hope)."
2098fi
378cc40b 2099
a687059c 2100: see if this is a vfork system
2101echo " "
2102if $test -r /usr/include/vfork.h ; then
2103 i_vfork="$define"
2104 echo "vfork.h found."
2105else
2106 i_vfork="$undef"
2107 echo "No vfork.h found."
2108fi
8d063cd8 2109
a687059c 2110: check for length of integer
2111echo " "
2112case "$intsize" in
8d063cd8 2113'')
a687059c 2114 echo "Checking to see how big your integers are..."
2115 $cat >try.c <<'EOCP'
2116#include <stdio.h>
2117main()
2118{
2119 printf("%d\n", sizeof(int));
2120}
2121EOCP
2122 if $cc try.c -o try >/dev/null 2>&1 ; then
2123 dflt=`try`
8d063cd8 2124 else
a687059c 2125 dflt='4'
2126 echo "(I can't seem to compile the test program. Guessing...)"
2127 fi
8d063cd8 2128 ;;
8d063cd8 2129*)
a687059c 2130 dflt="$intsize"
8d063cd8 2131 ;;
2132esac
a687059c 2133rp="What is the size of an integer (in bytes)? [$dflt]"
2134$echo $n "$rp $c"
2135. myread
2136intsize="$ans"
2137$rm -f try.c try
8d063cd8 2138
a687059c 2139: determine where private executables go
2140case "$privlib" in
8d063cd8 2141'')
a687059c 2142 dflt=/usr/lib/$package
2143 test -d /usr/local/lib && dflt=/usr/local/lib/$package
2144 ;;
2145*) dflt="$privlib"
8d063cd8 2146 ;;
8d063cd8 2147esac
2148$cat <<EOM
8d063cd8 2149
a687059c 2150The $package package has some auxiliary files that should be put in a library
2151that is accessible by everyone. Where do you want to put these "private"
8d063cd8 2152EOM
a687059c 2153$echo $n "but accessible files? [$dflt] $c"
2154rp="Put private files where? [$dflt]"
8d063cd8 2155. myread
a687059c 2156privlib="$ans"
8d063cd8 2157
a687059c 2158: check for size of random number generator
2159echo " "
2160case "$randbits" in
2161'')
2162 echo "Checking to see how many bits your rand function produces..."
2163 $cat >try.c <<'EOCP'
2164#include <stdio.h>
2165main()
2166{
2167 register int i;
2168 register unsigned long tmp;
2169 register unsigned long max = 0L;
2170
2171 for (i=1000; i; i--) {
2172 tmp = (unsigned long)rand();
2173 if (tmp > max) max = tmp;
2174 }
2175 for (i=0; max; i++)
2176 max /= 2;
2177 printf("%d\n",i);
2178}
2179EOCP
2180 if $cc try.c -o try >/dev/null 2>&1 ; then
2181 dflt=`try`
2182 else
2183 dflt='?'
2184 echo "(I can't seem to compile the test program...)"
2185 fi
8d063cd8 2186 ;;
a687059c 2187*)
2188 dflt="$randbits"
8d063cd8 2189 ;;
a687059c 2190esac
2191rp="How many bits does your rand() function produce? [$dflt]"
2192$echo $n "$rp $c"
2193. myread
2194randbits="$ans"
2195$rm -f try.c try
2196
2197: generate list of signal names
2198echo " "
2199case "$sig_name" in
2200'')
2201 echo "Generating a list of signal names..."
91407755 2202 set X `cat /usr/include/signal.h /usr/include/sys/signal.h 2>&1 | awk '
2203$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ {
2204 sig[$3] = substr($2,4,20)
2205 if (max < $3 && $3 < 60) {
2206 max = $3
2207 }
2208}
2209
2210END {
2211 for (i=1; i<=max; i++) {
2212 if (sig[i] == "")
2213 printf "%d", i
2214 else
2215 printf "%s", sig[i]
2216 if (i < max)
2217 printf " "
2218 }
2219 printf "\n"
2220}
2221'`
a687059c 2222 shift
2223 case $# in
2224 0) echo 'kill -l' >/tmp/foo$$
91407755 2225 set X `$csh -f </tmp/foo$$`
a687059c 2226 shift
2227 case $# in
2228 0)set HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM
2229 ;;
8d063cd8 2230 esac
8d063cd8 2231 ;;
8d063cd8 2232 esac
a687059c 2233 sig_name="ZERO $*"
8d063cd8 2234 ;;
2235esac
a687059c 2236echo "Signals are: $sig_name"
8d063cd8 2237
a687059c 2238: see what type of char stdio uses.
8d063cd8 2239echo " "
a687059c 2240if $contains 'unsigned.*char.*_ptr;' /usr/include/stdio.h >/dev/null 2>&1 ; then
2241 echo "Your stdio uses unsigned chars."
2242 stdchar="unsigned char"
2243else
2244 echo "Your stdio uses signed chars."
2245 stdchar="char"
2246fi
8d063cd8 2247
a687059c 2248: see what type uids are declared as in the kernel
2249case "$uidtype" in
2250'')
2251 if $contains 'uid_t;' /usr/include/sys/types.h >/dev/null 2>&1 ; then
2252 dflt='uid_t';
8d063cd8 2253 else
a687059c 2254 set `grep '_ruid;' /usr/include/sys/user.h 2>/dev/null` unsigned short
2255 case $1 in
2256 unsigned) dflt="$1 $2" ;;
2257 *) dflt="$1" ;;
2258 esac
8d063cd8 2259 fi
2260 ;;
a687059c 2261*) dflt="$uidtype"
2262 ;;
8d063cd8 2263esac
a687059c 2264cont=true
8d063cd8 2265echo " "
03a14243 2266rp="What type are user ids returned by getuid(), etc.? [$dflt]"
8d063cd8 2267$echo $n "$rp $c"
2268. myread
a687059c 2269uidtype="$ans"
8d063cd8 2270
a687059c 2271: preserve RCS keywords in files with variable substitution, grrr
2272Log='$Log'
2273Header='$Header'
2274
2275
8d063cd8 2276: see if we should include -lnm
2277echo " "
2278if $test -r /usr/lib/libnm.a || $test -r /usr/local/lib/libnm.a ; then
2279 echo "New math library found."
2280 libnm='-lnm'
2281else
36ce8bec 2282 ans=`loc libnm.a x $libpth`
8d063cd8 2283 case "$ans" in
2284 x)
2285 echo "No nm library found--the normal math library will have to do."
2286 libnm=''
2287 ;;
2288 *)
2289 echo "New math library found in $ans."
2290 libnm="$ans"
2291 ;;
2292 esac
2293fi
2294
a1cc2bdc 2295: determine which malloc to compile in
2296echo " "
2297case "$usemymalloc" in
2298'')
2299 if bsd || v7; then
2300 dflt='y'
2301 else
2302 dflt='n'
2303 fi
2304 ;;
2305*) dflt="$usemymalloc"
2306 ;;
2307esac
2308rp="Do you wish to attempt to use the malloc that comes with $package? [$dflt]"
2309$echo $n "$rp $c"
2310. myread
2311case "$ans" in
2312'') ans=$dflt;;
2313esac
2314usemymalloc="$ans"
2315case "$ans" in
2316y*) mallocsrc='malloc.c'; mallocobj='malloc.o';;
2317*) mallocsrc=''; mallocobj='';;
2318esac
2319
8d063cd8 2320echo " "
2321echo "End of configuration questions."
2322echo " "
2323
2324: create config.sh file
2325echo " "
2326if test -d ../UU; then
2327 cd ..
2328fi
2329echo "Creating config.sh..."
2330$spitshell <<EOT >config.sh
2331$startsh
2332# config.sh
2333# This file was produced by running the Configure script.
2334
2335d_eunice='$d_eunice'
8d063cd8 2336define='$define'
91407755 2337eunicefix='$eunicefix'
8d063cd8 2338loclist='$loclist'
2339expr='$expr'
2340sed='$sed'
2341echo='$echo'
2342cat='$cat'
2343rm='$rm'
2344mv='$mv'
2345cp='$cp'
2346tail='$tail'
2347tr='$tr'
2348mkdir='$mkdir'
2349sort='$sort'
2350uniq='$uniq'
2351grep='$grep'
2352trylist='$trylist'
2353test='$test'
2354inews='$inews'
2355egrep='$egrep'
2356more='$more'
2357pg='$pg'
2358Mcc='$Mcc'
2359vi='$vi'
2360mailx='$mailx'
2361mail='$mail'
378cc40b 2362cpp='$cpp'
a687059c 2363perl='$perl'
2364emacs='$emacs'
2365ls='$ls'
2366rmail='$rmail'
2367sendmail='$sendmail'
2368shar='$shar'
2369smail='$smail'
2370tbl='$tbl'
2371troff='$troff'
2372nroff='$nroff'
2373uname='$uname'
2374uuname='$uuname'
2375line='$line'
2376chgrp='$chgrp'
2377chmod='$chmod'
2378lint='$lint'
2379sleep='$sleep'
2380pr='$pr'
2381tar='$tar'
2382ln='$ln'
2383lpr='$lpr'
2384lp='$lp'
2385touch='$touch'
2386make='$make'
2387date='$date'
91407755 2388csh='$csh'
8d063cd8 2389Log='$Log'
2390Header='$Header'
2391bin='$bin'
a687059c 2392byteorder='$byteorder'
8d063cd8 2393contains='$contains'
378cc40b 2394cppstdin='$cppstdin'
36ce8bec 2395cppminus='$cppminus'
a687059c 2396d_bcmp='$d_bcmp'
135863df 2397d_bcopy='$d_bcopy'
8d063cd8 2398d_charsprf='$d_charsprf'
2e1b3b7e 2399d_crypt='$d_crypt'
a687059c 2400cryptlib='$cryptlib'
91407755 2401d_csh='$d_csh'
13281fa4 2402d_dosuid='$d_dosuid'
a687059c 2403d_dup2='$d_dup2'
378cc40b 2404d_fchmod='$d_fchmod'
2405d_fchown='$d_fchown'
a687059c 2406d_fcntl='$d_fcntl'
2407d_flock='$d_flock'
378cc40b 2408d_getgrps='$d_getgrps'
a687059c 2409d_gethent='$d_gethent'
2410d_getpgrp='$d_getpgrp'
2411d_getprior='$d_getprior'
2412d_htonl='$d_htonl'
8d063cd8 2413d_index='$d_index'
a687059c 2414d_ioctl='$d_ioctl'
378cc40b 2415d_killpg='$d_killpg'
a687059c 2416d_memcmp='$d_memcmp'
378cc40b 2417d_memcpy='$d_memcpy'
a687059c 2418d_mkdir='$d_mkdir'
2419d_ndbm='$d_ndbm'
2420d_odbm='$d_odbm'
2421d_readdir='$d_readdir'
378cc40b 2422d_rename='$d_rename'
a687059c 2423d_rmdir='$d_rmdir'
378cc40b 2424d_setegid='$d_setegid'
2425d_seteuid='$d_seteuid'
a687059c 2426d_setpgrp='$d_setpgrp'
2427d_setprior='$d_setprior'
2428d_setregid='$d_setregid'
2429d_setresgid='$d_setresgid'
2430d_setreuid='$d_setreuid'
2431d_setresuid='$d_setresuid'
378cc40b 2432d_setrgid='$d_setrgid'
2433d_setruid='$d_setruid'
a687059c 2434d_socket='$d_socket'
2435d_sockpair='$d_sockpair'
2436d_oldsock='$d_oldsock'
2437socketlib='$socketlib'
135863df 2438d_statblks='$d_statblks'
36ce8bec 2439d_stdstdio='$d_stdstdio'
8d063cd8 2440d_strctcpy='$d_strctcpy'
2e1b3b7e 2441d_symlink='$d_symlink'
a687059c 2442d_syscall='$d_syscall'
135863df 2443d_tminsys='$d_tminsys'
a687059c 2444i_systime='$i_systime'
91407755 2445i_timetoo='$i_timetoo'
a687059c 2446d_varargs='$d_varargs'
8d063cd8 2447d_vfork='$d_vfork'
36ce8bec 2448d_voidsig='$d_voidsig'
a687059c 2449d_vprintf='$d_vprintf'
2450d_charvspr='$d_charvspr'
91407755 2451d_wait4='$d_wait4'
378cc40b 2452gidtype='$gidtype'
a687059c 2453i_dirent='$i_dirent'
2454d_dirnamlen='$d_dirnamlen'
2455i_fcntl='$i_fcntl'
2456i_grp='$i_grp'
03a14243 2457i_niin='$i_niin'
a687059c 2458i_pwd='$i_pwd'
2459d_pwquota='$d_pwquota'
2460d_pwage='$d_pwage'
91407755 2461d_pwchange='$d_pwchange'
2462d_pwclass='$d_pwclass'
2463d_pwexpire='$d_pwexpire'
a687059c 2464i_sysdir='$i_sysdir'
2465i_sysioctl='$i_sysioctl'
2466i_varargs='$i_varargs'
2467i_vfork='$i_vfork'
2468intsize='$intsize'
8d063cd8 2469libc='$libc'
2470libnm='$libnm'
a1cc2bdc 2471mallocsrc='$mallocsrc'
2472mallocobj='$mallocobj'
2473usemymalloc='$usemymalloc'
8d063cd8 2474mansrc='$mansrc'
2475manext='$manext'
2476models='$models'
2477split='$split'
2478small='$small'
2479medium='$medium'
2480large='$large'
2481huge='$huge'
a687059c 2482optimize='$optimize'
8d063cd8 2483ccflags='$ccflags'
91407755 2484cppflags='$cppflags'
8d063cd8 2485ldflags='$ldflags'
a687059c 2486cc='$cc'
2487libs='$libs'
8d063cd8 2488n='$n'
2489c='$c'
2490package='$package'
a687059c 2491randbits='$randbits'
2492sig_name='$sig_name'
8d063cd8 2493spitshell='$spitshell'
2494shsharp='$shsharp'
2495sharpbang='$sharpbang'
2496startsh='$startsh'
36ce8bec 2497stdchar='$stdchar'
378cc40b 2498uidtype='$uidtype'
8d063cd8 2499voidflags='$voidflags'
2500defvoidused='$defvoidused'
a687059c 2501lib='$lib'
378cc40b 2502privlib='$privlib'
8d063cd8 2503CONFIG=true
2504EOT
13281fa4 2505
8d063cd8 2506CONFIG=true
2507
2508echo " "
2509dflt=''
378cc40b 2510fastread=''
8d063cd8 2511echo "If you didn't make any mistakes, then just type a carriage return here."
2512rp="If you need to edit config.sh, do it as a shell escape here:"
2513$echo $n "$rp $c"
2514. UU/myread
2515case "$ans" in
2516'') ;;
2517*) : in case they cannot read
2518 eval $ans;;
2519esac
378cc40b 2520. ./config.sh
8d063cd8 2521
2522echo " "
2523echo "Doing variable substitutions on .SH files..."
d96024cf 2524set x `awk '{print $1}' <MANIFEST | $grep '\.SH'`
36ce8bec 2525shift
2526case $# in
25270) set x *.SH; shift;;
2528esac
2529if test ! -f $1; then
2530 shift
2531fi
8d063cd8 2532for file in $*; do
2533 case "$file" in
2534 */*)
2535 dir=`$expr X$file : 'X\(.*\)/'`
2536 file=`$expr X$file : 'X.*/\(.*\)'`
2537 (cd $dir && . $file)
2538 ;;
2539 *)
2540 . $file
2541 ;;
2542 esac
2543done
2544if test -f config.h.SH; then
2545 if test ! -f config.h; then
2546 : oops, they left it out of MANIFEST, probably, so do it anyway.
2547 . config.h.SH
2548 fi
2549fi
2550
2551if $contains '^depend:' Makefile >/dev/null 2>&1; then
2552 dflt=n
2553 $cat <<EOM
2554
2555Now you need to generate make dependencies by running "make depend".
2556You might prefer to run it in background: "make depend > makedepend.out &"
2557It can take a while, so you might not want to run it right now.
2558
2559EOM
2560 rp="Run make depend now? [$dflt]"
2561 $echo $n "$rp $c"
2562 . UU/myread
2563 case "$ans" in
a687059c 2564 y*) make depend && echo "Now you must run a make."
8d063cd8 2565 ;;
2566 *) echo "You must run 'make depend' then 'make'."
2567 ;;
2568 esac
2569elif test -f Makefile; then
2570 echo " "
2571 echo "Now you must run a make."
2572else
2573 echo "Done."
2574fi
2575
2576$rm -f kit*isdone
13281fa4 2577: the following is currently useless
8d063cd8 2578cd UU && $rm -f $rmlist
13281fa4 2579: since this removes it all anyway
2580cd .. && $rm -rf UU
8d063cd8 2581: end of Configure