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