a "replacement" for awk and sed
[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#
11# $Header: Configure,v 1.0 87/12/18 15:05:56 root Exp $
12#
13# Yes, you may rip this off to use in other distribution packages.
14# (Note: this Configure script was generated automatically. Rather than
15# working with this copy of Configure, you may wish to get metaconfig.)
16
17: sanity checks
18PATH='.:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc'
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
37d_eunice=''
38eunicefix=''
39define=''
40loclist=''
41expr=''
42sed=''
43echo=''
44cat=''
45rm=''
46mv=''
47cp=''
48tail=''
49tr=''
50mkdir=''
51sort=''
52uniq=''
53grep=''
54trylist=''
55test=''
56inews=''
57egrep=''
58more=''
59pg=''
60Mcc=''
61vi=''
62mailx=''
63mail=''
64Log=''
65Header=''
66bin=''
67cc=''
68contains=''
69cpp=''
70d_charsprf=''
71d_index=''
72d_strctcpy=''
73d_vfork=''
74libc=''
75libnm=''
76mansrc=''
77manext=''
78models=''
79split=''
80small=''
81medium=''
82large=''
83huge=''
84ccflags=''
85ldflags=''
86n=''
87c=''
88package=''
89spitshell=''
90shsharp=''
91sharpbang=''
92startsh=''
93voidflags=''
94defvoidused=''
95CONFIG=''
96
97: set package name
98package=perl
99
100echo " "
101echo "Beginning of configuration questions for $package kit."
102: Eunice requires " " instead of "", can you believe it
103echo " "
104
105define='define'
106undef='/*undef'
107libpth='/usr/lib /usr/local/lib /lib'
108smallmach='pdp11 i8086 z8000 i80286 iAPX286'
109rmlist='kit[1-9]isdone kit[1-9][0-9]isdone'
110trap 'echo " "; rm -f $rmlist; exit 1' 1 2 3
111attrlist="mc68000 sun gcos unix ibm gimpel interdata tss os mert pyr"
112attrlist="$attrlist vax pdp11 i8086 z8000 u3b2 u3b5 u3b20 u3b200"
113attrlist="$attrlist ns32000 ns16000 iAPX286"
114pth="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /etc /usr/lib"
115defvoidused=7
116
117: some greps do not return status, grrr.
118echo "grimblepritz" >grimble
119if grep blurfldyick grimble >/dev/null 2>&1 ; then
120 contains=contains
121elif grep grimblepritz grimble >/dev/null 2>&1 ; then
122 contains=grep
123else
124 contains=contains
125fi
126rm -f grimble
127: the following should work in any shell
128case "$contains" in
129contains*)
130 echo " "
131 echo "AGH! Grep doesn't return a status. Attempting remedial action."
132 cat >contains <<'EOSS'
133grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
134EOSS
135chmod 755 contains
136esac
137
138: first determine how to suppress newline on echo command
139echo "Checking echo to see how to suppress newlines..."
140(echo "hi there\c" ; echo " ") >.echotmp
141if $contains c .echotmp >/dev/null 2>&1 ; then
142 echo "...using -n."
143 n='-n'
144 c=''
145else
146 cat <<'EOM'
147...using \c
148EOM
149 n=''
150 c='\c'
151fi
152echo $n "Type carriage return to continue. Your cursor should be here-->$c"
153read ans
154rm -f .echotmp
155
156: now set up to do reads with possible shell escape and default assignment
157cat <<EOSC >myread
158ans='!'
159while expr "X\$ans" : "X!" >/dev/null; do
160 read ans
161 case "\$ans" in
162 !)
163 sh
164 echo " "
165 echo $n "\$rp $c"
166 ;;
167 !*)
168 set \`expr "X\$ans" : "X!\(.*\)\$"\`
169 sh -c "\$*"
170 echo " "
171 echo $n "\$rp $c"
172 ;;
173 esac
174done
175rp='Your answer:'
176case "\$ans" in
177'') ans="\$dflt";;
178esac
179EOSC
180
181: general instructions
182cat <<EOH
183
184This installation shell script will examine your system and ask you questions
185to determine how the $package package should be installed. If you get stuck
186on a question, you may use a ! shell escape to start a subshell or execute
187a command. Many of the questions will have default answers in square
188brackets--typing carriage return will give you the default.
189
190On some of the questions which ask for file or directory names you are
191allowed to use the ~name construct to specify the login directory belonging
192to "name", even if you don't have a shell which knows about that. Questions
193where this is allowed will be marked "(~name ok)".
194
195EOH
196rp="[Type carriage return to continue]"
197echo $n "$rp $c"
198. myread
199cat <<EOH
200
201Much effort has been expended to ensure that this shell script will run
202on any Unix system. If despite that it blows up on you, your best bet is
203to edit Configure and run it again. Also, let me (lwall@sdcrdcf.UUCP) know
204how I blew it. If you can't run Configure for some reason, you'll have
205to generate a config.sh file by hand.
206
207This installation script affects things in two ways: 1) it may do direct
208variable substitutions on some of the files included in this kit, and
2092) it builds a config.h file for inclusion in C programs. You may edit
210any of these files as the need arises after running this script.
211
212If you make a mistake on a question, there is no easy way to back up to it
213currently. The easiest thing to do is to edit config.sh and rerun all the
214SH files. Configure will offer to let you do this before it runs the SH files.
215
216EOH
217rp="[Type carriage return to continue]"
218echo $n "$rp $c"
219. myread
220
221: get old answers, if there is a config file out there
222if test -f ../config.sh; then
223 echo " "
224 dflt=y
225 rp="I see a config.sh file. Did Configure make it on THIS system? [$dflt]"
226 echo $n "$rp $c"
227 . myread
228 case "$ans" in
229 n*) echo "OK, I'll ignore it.";;
230 *) echo "Fetching default answers from your old config.sh file..."
231 tmp="$n"
232 ans="$c"
233 . ../config.sh
234 n="$tmp"
235 c="$ans"
236 ;;
237 esac
238fi
239
240: find out where common programs are
241echo " "
242echo "Locating common programs..."
243cat <<EOSC >loc
244$startsh
245case \$# in
2460) exit 1;;
247esac
248thing=\$1
249shift
250dflt=\$1
251shift
252for dir in \$*; do
253 case "\$thing" in
254 .)
255 if test -d \$dir/\$thing; then
256 echo \$dir
257 exit 0
258 fi
259 ;;
260 *)
261 if test -f \$dir/\$thing; then
262 echo \$dir/\$thing
263 exit 0
264 fi
265 ;;
266 esac
267done
268echo \$dflt
269exit 1
270EOSC
271chmod 755 loc
272$eunicefix loc
273loclist="
274expr
275sed
276echo
277cat
278rm
279mv
280cp
281tr
282mkdir
283sort
284uniq
285grep
286"
287trylist="
288test
289egrep
290Mcc
291"
292for file in $loclist; do
293 xxx=`loc $file $file $pth`
294 eval $file=$xxx
295 eval _$file=$xxx
296 case "$xxx" in
297 /*)
298 echo $file is in $xxx.
299 ;;
300 *)
301 echo "I don't know where $file is. I hope it's in everyone's PATH."
302 ;;
303 esac
304done
305echo " "
306echo "Don't worry if any of the following aren't found..."
307ans=offhand
308for file in $trylist; do
309 xxx=`loc $file $file $pth`
310 eval $file=$xxx
311 eval _$file=$xxx
312 case "$xxx" in
313 /*)
314 echo $file is in $xxx.
315 ;;
316 *)
317 echo "I don't see $file out there, $ans."
318 ans=either
319 ;;
320 esac
321done
322case "$egrep" in
323egrep)
324 echo "Substituting grep for egrep."
325 egrep=$grep
326 ;;
327esac
328case "$test" in
329test)
330 echo "Hopefully test is built into your sh."
331 ;;
332/bin/test)
333 echo " "
334 dflt=n
335 rp="Is your "'"'"test"'"'" built into sh? [$dflt] (OK to guess)"
336 echo $n "$rp $c"
337 . myread
338 case "$ans" in
339 y*) test=test ;;
340 esac
341 ;;
342*)
343 test=test
344 ;;
345esac
346case "$echo" in
347echo)
348 echo "Hopefully echo is built into your sh."
349 ;;
350/bin/echo)
351 echo " "
352 echo "Checking compatibility between /bin/echo and builtin echo (if any)..."
353 $echo $n "hi there$c" >foo1
354 echo $n "hi there$c" >foo2
355 if cmp foo1 foo2 >/dev/null 2>&1; then
356 echo "They are compatible. In fact, they may be identical."
357 else
358 case "$n" in
359 '-n') n='' c='\c' ans='\c' ;;
360 *) n='-n' c='' ans='-n' ;;
361 esac
362 cat <<FOO
363They are not compatible! You are probably running ksh on a non-USG system.
364I'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
365have echo built in and we may have to run some Bourne shell scripts. That
366means I'll have to use $ans to suppress newlines now. Life is ridiculous.
367
368FOO
369 rp="Your cursor should be here-->"
370 $echo $n "$rp$c"
371 . myread
372 fi
373 $rm -f foo1 foo2
374 ;;
375*)
376 : cross your fingers
377 echo=echo
378 ;;
379esac
380rmlist="$rmlist loc"
381
382: get list of predefined functions in a handy place
383echo " "
384if test -f /lib/libc.a; then
385 echo "Your C library is in /lib/libc.a. You're normal."
386 libc=/lib/libc.a
387else
388 ans=`loc libc.a blurfl/dyick $libpth`
389 if test -f $ans; then
390 echo "Your C library is in $ans, of all places."
391 libc=ans
392 else
393 if test -f "$libc"; then
394 echo "Your C library is in $libc, like you said before."
395 else
396 cat <<EOM
397
398I can't seem to find your C library. I've looked in the following places:
399
400 $libpth
401
402None of these seems to contain your C library. What is the full name
403EOM
404 dflt=None
405 $echo $n "of your C library? $c"
406 rp='C library full name?'
407 . myread
408 libc="$ans"
409 fi
410 fi
411fi
412echo " "
413$echo $n "Extracting names from $libc for later perusal...$c"
414if ar t $libc > libc.list; then
415 echo "done"
416else
417 echo " "
418 echo "The archiver doesn't think $libc is a reasonable library."
419 echo "Trying nm instead..."
420 if nm -g $libc > libc.list; then
421 echo "Done. Maybe this is Unicos, or an Apollo?"
422 else
423 echo "That didn't work either. Giving up."
424 exit 1
425 fi
426fi
427rmlist="$rmlist libc.list"
428
429: make some quick guesses about what we are up against
430echo " "
431$echo $n "Hmm... $c"
432if $contains SIGTSTP /usr/include/signal.h >/dev/null 2>&1 ; then
433 echo "Looks kind of like a BSD system, but we'll see..."
434 echo exit 0 >bsd
435 echo exit 1 >usg
436 echo exit 1 >v7
437elif $contains fcntl libc.list >/dev/null 2>&1 ; then
438 echo "Looks kind of like a USG system, but we'll see..."
439 echo exit 1 >bsd
440 echo exit 0 >usg
441 echo exit 1 >v7
442else
443 echo "Looks kind of like a version 7 system, but we'll see..."
444 echo exit 1 >bsd
445 echo exit 1 >usg
446 echo exit 0 >v7
447fi
448if $contains vmssystem libc.list >/dev/null 2>&1 ; then
449 cat <<'EOI'
450There is, however, a strange, musty smell in the air that reminds me of
451something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
452EOI
453 echo "exit 0" >eunice
454 eunicefix=unixtovms
455 d_eunice="$define"
456: it so happens the Eunice I know will not run shell scripts in Unix format
457else
458 echo " "
459 echo "Congratulations. You aren't running Eunice."
460 eunicefix=':'
461 d_eunice="$undef"
462 echo "exit 1" >eunice
463fi
464if test -f /xenix; then
465 echo "Actually, this looks more like a XENIX system..."
466 echo "exit 0" >xenix
467else
468 echo " "
469 echo "It's not Xenix..."
470 echo "exit 1" >xenix
471fi
472chmod 755 xenix
473if test -f /venix; then
474 echo "Actually, this looks more like a VENIX system..."
475 echo "exit 0" >venix
476else
477 echo " "
478 if xenix; then
479 : null
480 else
481 echo "Nor is it Venix..."
482 fi
483 echo "exit 1" >venix
484fi
485chmod 755 bsd usg v7 eunice venix xenix
486$eunicefix bsd usg v7 eunice venix xenix
487rmlist="$rmlist bsd usg v7 eunice venix xenix"
488
489: see if sh knows # comments
490echo " "
491echo "Checking your sh to see if it knows about # comments..."
492if sh -c '#' >/dev/null 2>&1 ; then
493 echo "Your sh handles # comments correctly."
494 shsharp=true
495 spitshell=cat
496 echo " "
497 echo "Okay, let's see if #! works on this system..."
498 echo "#!/bin/echo hi" > try
499 $eunicefix try
500 chmod 755 try
501 try > today
502 if test -s today; then
503 echo "It does."
504 sharpbang='#!'
505 else
506 echo "#! /bin/echo hi" > try
507 $eunicefix try
508 chmod 755 try
509 try > today
510 if test -s today; then
511 echo "It does."
512 sharpbang='#! '
513 else
514 echo "It doesn't."
515 sharpbang=': use '
516 fi
517 fi
518else
519 echo "Your sh doesn't grok # comments--I will strip them later on."
520 shsharp=false
521 echo "exec grep -v '^#'" >spitshell
522 chmod 755 spitshell
523 $eunicefix spitshell
524 spitshell=`pwd`/spitshell
525 echo "I presume that if # doesn't work, #! won't work either!"
526 sharpbang=': use '
527fi
528
529: figure out how to guarantee sh startup
530echo " "
531echo "Checking out how to guarantee sh startup..."
532startsh=$sharpbang'/bin/sh'
533echo "Let's see if '$startsh' works..."
534cat >try <<EOSS
535$startsh
536set abc
537test "$?abc" != 1
538EOSS
539
540chmod 755 try
541$eunicefix try
542if try; then
543 echo "Yup, it does."
544else
545 echo "Nope. You may have to fix up the shell scripts to make sure sh runs them."
546fi
547rm -f try today
548
549: see if sprintf is declared as int or pointer to char
550echo " "
551if $contains 'char.*sprintf' /usr/include/stdio.h >/dev/null 2>&1 ; then
552 echo "Your sprintf() returns (char*)."
553 d_charsprf="$define"
554else
555 echo "Your sprintf() returns (int)."
556 d_charsprf="$undef"
557fi
558
559: index or strcpy
560echo " "
561dflt=y
562if $contains index libc.list >/dev/null 2>&1 ; then
563 echo "Your system appears to use index() and rindex() rather than strchr()"
564 $echo $n "and strrchr(). Is this correct? [$dflt] $c"
565 rp='index() rather than strchr()? [$dflt]'
566 . myread
567 case "$ans" in
568 n*|f*) d_index="$define" ;;
569 *) d_index="$undef" ;;
570 esac
571else
572 echo "Your system appears to use strchr() and strrchr() rather than index()"
573 $echo $n "and rindex(). Is this correct? [$dflt] $c"
574 rp='strchr() rather than index()? [$dflt]'
575 . myread
576 case "$ans" in
577 n*|f*) d_index="$undef" ;;
578 *) d_index="$define" ;;
579 esac
580fi
581
582: check for structure copying
583echo " "
584echo "Checking to see if your C compiler can copy structs..."
585$cat >try.c <<'EOCP'
586main()
587{
588 struct blurfl {
589 int dyick;
590 } foo, bar;
591
592 foo = bar;
593}
594EOCP
595if cc -c try.c >/dev/null 2>&1 ; then
596 d_strctcpy="$define"
597 echo "Yup, it can."
598else
599 d_strctcpy="$undef"
600 echo "Nope, it can't."
601fi
602$rm -f try.*
603
604: see if there is a vfork
605echo " "
606if $contains vfork libc.list >/dev/null 2>&1 ; then
607 echo "vfork() found."
608 d_vfork="$undef"
609else
610 echo "No vfork() found--will use fork() instead."
611 d_vfork="$define"
612fi
613
614: check for void type
615echo " "
616$cat <<EOM
617Checking to see how well your C compiler groks the void type...
618
619 Support flag bits are:
620 1: basic void declarations.
621 2: arrays of pointers to functions returning void.
622 4: operations between pointers to and addresses of void functions.
623
624EOM
625case "$voidflags" in
626'')
627 $cat >try.c <<'EOCP'
628#if TRY & 1
629void main() {
630#else
631main() {
632#endif
633 extern void *moo();
634 void (*goo)();
635#if TRY & 2
636 void (*foo[10])();
637#endif
638
639#if TRY & 4
640 if(goo == moo) {
641 exit(0);
642 }
643#endif
644 exit(0);
645}
646EOCP
647 if cc -S -DTRY=7 try.c >.out 2>&1 ; then
648 voidflags=7
649 echo "It appears to support void fully."
650 if $contains warning .out >/dev/null 2>&1; then
651 echo "However, you might get some warnings that look like this:"
652 $cat .out
653 fi
654 else
655 echo "Hmm, you compiler has some difficulty with void. Checking further..."
656 if cc -S -DTRY=1 try.c >/dev/null 2>&1 ; then
657 echo "It supports 1..."
658 if cc -S -DTRY=3 try.c >/dev/null 2>&1 ; then
659 voidflags=3
660 echo "And it supports 2 but not 4."
661 else
662 echo "It doesn't support 2..."
663 if cc -S -DTRY=3 try.c >/dev/null 2>&1 ; then
664 voidflags=5
665 echo "But it supports 4."
666 else
667 voidflags=1
668 echo "And it doesn't support 4."
669 fi
670 fi
671 else
672 echo "There is no support at all for void."
673 voidflags=0
674 fi
675 fi
676esac
677dflt="$voidflags";
678rp="Your void support flags add up to what? [$dflt]"
679$echo $n "$rp $c"
680. myread
681voidflags="$ans"
682$rm -f try.* .out
683
684: preserve RCS keywords in files with variable substitution, grrr
685Log='$Log'
686Header='$Header'
687
688: set up shell script to do ~ expansion
689cat >filexp <<EOSS
690$startsh
691: expand filename
692case "\$1" in
693 ~/*|~)
694 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
695 ;;
696 ~*)
697 if $test -f /bin/csh; then
698 /bin/csh -f -c "glob \$1"
699 echo ""
700 else
701 name=\`$expr x\$1 : '..\([^/]*\)'\`
702 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
703 if $test ! -d "\$dir"; then
704 me=\`basename \$0\`
705 echo "\$me: can't locate home directory for: \$name" >&2
706 exit 1
707 fi
708 case "\$1" in
709 */*)
710 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
711 ;;
712 *)
713 echo \$dir
714 ;;
715 esac
716 fi
717 ;;
718*)
719 echo \$1
720 ;;
721esac
722EOSS
723chmod 755 filexp
724$eunicefix filexp
725
726: determine where public executables go
727case "$bin" in
728'')
729 dflt=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin`
730 ;;
731*) dflt="$bin"
732 ;;
733esac
734cont=true
735while $test "$cont" ; do
736 echo " "
737 rp="Where do you want to put the public executables? [$dflt]"
738 $echo $n "$rp $c"
739 . myread
740 bin="$ans"
741 bin=`filexp $bin`
742 if test -d $bin; then
743 cont=''
744 else
745 dflt=n
746 rp="Directory $bin doesn't exist. Use that name anyway? [$dflt]"
747 $echo $n "$rp $c"
748 . myread
749 dflt=''
750 case "$ans" in
751 y*) cont='';;
752 esac
753 fi
754done
755
756: determine where manual pages go
757case "$mansrc" in
758'')
759 dflt=`loc . /usr/man/man1 /usr/man/mann /usr/man/local/man1 /usr/man/u_man/man1 /usr/man/man1`
760 ;;
761*) dflt="$mansrc"
762 ;;
763esac
764cont=true
765while $test "$cont" ; do
766 echo " "
767 rp="Where do the manual pages (source) go? [$dflt]"
768 $echo $n "$rp $c"
769 . myread
770 mansrc=`filexp "$ans"`
771 if test -d $mansrc; then
772 cont=''
773 else
774 dflt=n
775 rp="Directory $mansrc doesn't exist. Use that name anyway? [$dflt]"
776 $echo $n "$rp $c"
777 . myread
778 dflt=''
779 case "$ans" in
780 y*) cont='';;
781 esac
782 fi
783done
784case "$mansrc" in
785*l)
786 manext=l
787 ;;
788*n)
789 manext=n
790 ;;
791*)
792 manext=1
793 ;;
794esac
795
796: see how we invoke the C preprocessor
797echo " "
798echo "Checking to see how your C preprocessor is invoked..."
799cat <<'EOT' >testcpp.c
800#define ABC abc
801#define XYZ xyz
802ABC.XYZ
803EOT
804echo 'Maybe "cc -E" will work...'
805cc -E testcpp.c >testcpp.out 2>&1
806if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
807 echo "Yup, it does."
808 cpp='cc -E'
809else
810 echo 'Nope...maybe "cc -P" will work...'
811 cc -P testcpp.c >testcpp.out 2>&1
812 if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
813 echo "Yup, that does."
814 cpp='cc -P'
815 else
816 echo 'Nixed again...maybe "/lib/cpp" will work...'
817 /lib/cpp testcpp.c >testcpp.out 2>&1
818 if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
819 echo "Hooray, it works! I was beginning to wonder."
820 cpp='/lib/cpp'
821 else
822 echo 'Hmm...maybe you already told me...'
823 case "$cpp" in
824 '') ;;
825 *) $cpp testcpp.c >testcpp.out 2>&1;;
826 esac
827 if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
828 echo "Hooray, you did! I was beginning to wonder."
829 else
830 dflt=blurfl
831 $echo $n "Nope. I can't find a C preprocessor. Name one: $c"
832 rp='Name a C preprocessor:'
833 . myread
834 cpp="$ans"
835 $cpp testcpp.c >testcpp.out 2>&1
836 if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then
837 echo "OK, that will do."
838 else
839 echo "Sorry, I can't get that to work. Go find one."
840 exit 1
841 fi
842 fi
843 fi
844 fi
845fi
846rm -f testcpp.c testcpp.out
847
848: get C preprocessor symbols handy
849echo " "
850echo $attrlist | $tr '[ ]' '[\012]' >Cppsym.know
851$cat <<EOSS >Cppsym
852$startsh
853case "\$1" in
854-l) list=true
855 shift
856 ;;
857esac
858unknown=''
859case "\$list\$#" in
8601|2)
861 for sym do
862 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
863 exit 0
864 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
865 :
866 else
867 unknown="\$unknown \$sym"
868 fi
869 done
870 set X \$unknown
871 shift
872 ;;
873esac
874case \$# in
8750) exit 1;;
876esac
877echo \$* | $tr '[ ]' '[\012]' | $sed -e 's/\(.*\)/\\
878#ifdef \1\\
879exit 0; _ _ _ _\1\\ \1\\
880#endif\\
881/' >/tmp/Cppsym\$\$
882echo exit 1 >>/tmp/Cppsym\$\$
883$cpp /tmp/Cppsym\$\$ >/tmp/Cppsym2\$\$
884case "\$list" in
885true) awk '\$6 != "" {print substr(\$6,2,100)}' </tmp/Cppsym2\$\$ ;;
886*)
887 sh /tmp/Cppsym2\$\$
888 status=\$?
889 ;;
890esac
891$rm -f /tmp/Cppsym\$\$ /tmp/Cppsym2\$\$
892exit \$status
893EOSS
894chmod 755 Cppsym
895$eunicefix Cppsym
896echo "Your C preprocessor defines the following symbols:"
897Cppsym -l $attrlist >Cppsym.true
898cat Cppsym.true
899rmlist="$rmlist Cppsym Cppsym.know Cppsym.true"
900
901: see what memory models we can support
902case "$models" in
903'')
904 if Cppsym pdp11; then
905 dflt='unsplit split'
906 else
907 ans=`loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
908 case "$ans" in
909 X) dflt='none';;
910 *) if $test -d /lib/small || $test -d /usr/lib/small; then
911 dflt='small'
912 else
913 dflt=''
914 fi
915 if $test -d /lib/medium || $test -d /usr/lib/medium; then
916 dflt="$dflt medium"
917 fi
918 if $test -d /lib/large || $test -d /usr/lib/large; then
919 dflt="$dflt large"
920 fi
921 if $test -d /lib/huge || $test -d /usr/lib/huge; then
922 dflt="$dflt huge"
923 fi
924 esac
925 fi
926 ;;
927*) dflt="$models" ;;
928esac
929$cat <<EOM
930
931Some systems have different model sizes. On most systems they are called
932small, medium, large, and huge. On the PDP11 they are called unsplit and
933split. If your system doesn't support different memory models, say "none".
934If you wish to force everything to one memory model, say "none" here and
935put the appropriate flags later when it asks you for other cc and ld flags.
936Venix systems may wish to put "none" and let the compiler figure things out.
937(In the following question multiple model names should be space separated.)
938
939EOM
940rp="Which models are supported? [$dflt]"
941$echo $n "$rp $c"
942. myread
943models="$ans"
944
945case "$models" in
946none)
947 small=''
948 medium=''
949 large=''
950 huge=''
951 unsplit=''
952 split=''
953 ;;
954*split)
955 case "$split" in
956 '')
957 if $contains '-i' $mansrc/ld.1 >/dev/null 2>&1 || \
958 $contains '-i' $mansrc/cc.1 >/dev/null 2>&1; then
959 dflt='-i'
960 else
961 dflt='none'
962 fi
963 ;;
964 *) dflt="$split";;
965 esac
966 rp="What flag indicates separate I and D space? [$dflt]"
967 $echo $n "$rp $c"
968 . myread
969 case "$ans" in
970 none) ans='';;
971 esac
972 split="$ans"
973 unsplit=''
974 ;;
975*large*|*small*|*medium*|*huge*)
976 case "$model" in
977 *large*)
978 case "$large" in
979 '') dflt='-Ml';;
980 *) dflt="$large";;
981 esac
982 rp="What flag indicates large model? [$dflt]"
983 $echo $n "$rp $c"
984 . myread
985 case "$ans" in
986 none) ans='';
987 esac
988 large="$ans"
989 ;;
990 *) large='';;
991 esac
992 case "$model" in
993 *huge*)
994 case "$huge" in
995 '') dflt='-Mh';;
996 *) dflt="$huge";;
997 esac
998 rp="What flag indicates huge model? [$dflt]"
999 $echo $n "$rp $c"
1000 . myread
1001 case "$ans" in
1002 none) ans='';
1003 esac
1004 huge="$ans"
1005 ;;
1006 *) huge="$large";;
1007 esac
1008 case "$model" in
1009 *medium*)
1010 case "$medium" in
1011 '') dflt='-Mm';;
1012 *) dflt="$medium";;
1013 esac
1014 rp="What flag indicates medium model? [$dflt]"
1015 $echo $n "$rp $c"
1016 . myread
1017 case "$ans" in
1018 none) ans='';
1019 esac
1020 medium="$ans"
1021 ;;
1022 *) medium="$large";;
1023 esac
1024 case "$model" in
1025 *small*)
1026 case "$small" in
1027 '') dflt='none';;
1028 *) dflt="$small";;
1029 esac
1030 rp="What flag indicates small model? [$dflt]"
1031 $echo $n "$rp $c"
1032 . myread
1033 case "$ans" in
1034 none) ans='';
1035 esac
1036 small="$ans"
1037 ;;
1038 *) small='';;
1039 esac
1040 ;;
1041*)
1042 echo "Unrecognized memory models--you may have to edit Makefile.SH"
1043 ;;
1044esac
1045
1046case "$ccflags" in
1047'') dflt='none';;
1048*) dflt="$ccflags";;
1049esac
1050echo " "
1051rp="Any additional cc flags? [$dflt]"
1052$echo $n "$rp $c"
1053. myread
1054case "$ans" in
1055none) ans='';
1056esac
1057ccflags="$ans"
1058
1059case "$ldflags" in
1060'') if venix; then
1061 dflt='-i -z'
1062 else
1063 dflt='none'
1064 fi
1065 ;;
1066*) dflt="$ldflags";;
1067esac
1068echo " "
1069rp="Any additional ld flags? [$dflt]"
1070$echo $n "$rp $c"
1071. myread
1072case "$ans" in
1073none) ans='';
1074esac
1075ldflags="$ans"
1076
1077: see if we need a special compiler
1078echo " "
1079if usg; then
1080 case "$cc" in
1081 '')
1082 case "$Mcc" in
1083 /*) dflt='Mcc'
1084 ;;
1085 *)
1086 case "$large" in
1087 -M*)
1088 dflt='cc'
1089 ;;
1090 *)
1091 if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then
1092 dflt='cc -M'
1093 else
1094 dflt='cc'
1095 fi
1096 ;;
1097 esac
1098 ;;
1099 esac
1100 ;;
1101 *) dflt="$cc";;
1102 esac
1103 $cat <<'EOM'
1104
1105On some systems the default C compiler will not resolve multiple global
1106references that happen to have the same name. On some such systems the
1107"Mcc" command may be used to force these to be resolved. On other systems
1108a "cc -M" command is required. (Note that the -M flag on other systems
1109indicates a memory model to use!) What command will force resolution on
1110EOM
1111 $echo $n "this system? [$dflt] $c"
1112 rp="Command to resolve multiple refs? [$dflt]"
1113 . myread
1114 cc="$ans"
1115else
1116 echo "Not a USG system--assuming cc can resolve multiple definitions."
1117 cc=cc
1118fi
1119
1120: see if we should include -lnm
1121echo " "
1122if $test -r /usr/lib/libnm.a || $test -r /usr/local/lib/libnm.a ; then
1123 echo "New math library found."
1124 libnm='-lnm'
1125else
1126 ans=`loc libtermlib.a x $libpth`
1127 case "$ans" in
1128 x)
1129 echo "No nm library found--the normal math library will have to do."
1130 libnm=''
1131 ;;
1132 *)
1133 echo "New math library found in $ans."
1134 libnm="$ans"
1135 ;;
1136 esac
1137fi
1138
1139echo " "
1140echo "End of configuration questions."
1141echo " "
1142
1143: create config.sh file
1144echo " "
1145if test -d ../UU; then
1146 cd ..
1147fi
1148echo "Creating config.sh..."
1149$spitshell <<EOT >config.sh
1150$startsh
1151# config.sh
1152# This file was produced by running the Configure script.
1153
1154d_eunice='$d_eunice'
1155eunicefix='$eunicefix'
1156define='$define'
1157loclist='$loclist'
1158expr='$expr'
1159sed='$sed'
1160echo='$echo'
1161cat='$cat'
1162rm='$rm'
1163mv='$mv'
1164cp='$cp'
1165tail='$tail'
1166tr='$tr'
1167mkdir='$mkdir'
1168sort='$sort'
1169uniq='$uniq'
1170grep='$grep'
1171trylist='$trylist'
1172test='$test'
1173inews='$inews'
1174egrep='$egrep'
1175more='$more'
1176pg='$pg'
1177Mcc='$Mcc'
1178vi='$vi'
1179mailx='$mailx'
1180mail='$mail'
1181Log='$Log'
1182Header='$Header'
1183bin='$bin'
1184cc='$cc'
1185contains='$contains'
1186cpp='$cpp'
1187d_charsprf='$d_charsprf'
1188d_index='$d_index'
1189d_strctcpy='$d_strctcpy'
1190d_vfork='$d_vfork'
1191libc='$libc'
1192libnm='$libnm'
1193mansrc='$mansrc'
1194manext='$manext'
1195models='$models'
1196split='$split'
1197small='$small'
1198medium='$medium'
1199large='$large'
1200huge='$huge'
1201ccflags='$ccflags'
1202ldflags='$ldflags'
1203n='$n'
1204c='$c'
1205package='$package'
1206spitshell='$spitshell'
1207shsharp='$shsharp'
1208sharpbang='$sharpbang'
1209startsh='$startsh'
1210voidflags='$voidflags'
1211defvoidused='$defvoidused'
1212CONFIG=true
1213EOT
1214
1215CONFIG=true
1216
1217echo " "
1218dflt=''
1219echo "If you didn't make any mistakes, then just type a carriage return here."
1220rp="If you need to edit config.sh, do it as a shell escape here:"
1221$echo $n "$rp $c"
1222. UU/myread
1223case "$ans" in
1224'') ;;
1225*) : in case they cannot read
1226 eval $ans;;
1227esac
1228
1229echo " "
1230echo "Doing variable substitutions on .SH files..."
1231set `$grep '\.SH' <MANIFEST | awk '{print $1}'`
1232for file in $*; do
1233 case "$file" in
1234 */*)
1235 dir=`$expr X$file : 'X\(.*\)/'`
1236 file=`$expr X$file : 'X.*/\(.*\)'`
1237 (cd $dir && . $file)
1238 ;;
1239 *)
1240 . $file
1241 ;;
1242 esac
1243done
1244if test -f config.h.SH; then
1245 if test ! -f config.h; then
1246 : oops, they left it out of MANIFEST, probably, so do it anyway.
1247 . config.h.SH
1248 fi
1249fi
1250
1251if $contains '^depend:' Makefile >/dev/null 2>&1; then
1252 dflt=n
1253 $cat <<EOM
1254
1255Now you need to generate make dependencies by running "make depend".
1256You might prefer to run it in background: "make depend > makedepend.out &"
1257It can take a while, so you might not want to run it right now.
1258
1259EOM
1260 rp="Run make depend now? [$dflt]"
1261 $echo $n "$rp $c"
1262 . UU/myread
1263 case "$ans" in
1264 y*) make depend
1265 echo "Now you must run a make."
1266 ;;
1267 *) echo "You must run 'make depend' then 'make'."
1268 ;;
1269 esac
1270elif test -f Makefile; then
1271 echo " "
1272 echo "Now you must run a make."
1273else
1274 echo "Done."
1275fi
1276
1277$rm -f kit*isdone
1278cd UU && $rm -f $rmlist
1279: end of Configure