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