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