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