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