Commit | Line | Data |
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 | # |
ff2452de |
11 | # $Header: Configure,v 3.0.1.6 90/03/12 16:10:23 lwall Locked $ |
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 |
03a14243 |
18 | PATH=".:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc:/usr/new:/usr/new/bin:/usr/nbin:$PATH" |
8d063cd8 |
19 | export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0; kill $$) |
20 | |
21 | if test ! -t 0; then |
22 | echo "Say 'sh Configure', not 'sh <Configure'" |
23 | exit 1 |
24 | fi |
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 | |
30 | if test ! -d ../UU; then |
31 | if test ! -d UU; then |
32 | mkdir UU |
33 | fi |
34 | cd UU |
35 | fi |
36 | |
378cc40b |
37 | case "$1" in |
38 | -d) shift; fastread='yes';; |
39 | esac |
40 | |
8d063cd8 |
41 | d_eunice='' |
8d063cd8 |
42 | define='' |
91407755 |
43 | eunicefix='' |
8d063cd8 |
44 | loclist='' |
45 | expr='' |
46 | sed='' |
47 | echo='' |
48 | cat='' |
49 | rm='' |
50 | mv='' |
51 | cp='' |
52 | tail='' |
53 | tr='' |
54 | mkdir='' |
55 | sort='' |
56 | uniq='' |
57 | grep='' |
58 | trylist='' |
59 | test='' |
60 | inews='' |
61 | egrep='' |
62 | more='' |
63 | pg='' |
64 | Mcc='' |
65 | vi='' |
66 | mailx='' |
67 | mail='' |
378cc40b |
68 | cpp='' |
a687059c |
69 | perl='' |
70 | emacs='' |
71 | ls='' |
72 | rmail='' |
73 | sendmail='' |
74 | shar='' |
75 | smail='' |
76 | tbl='' |
77 | troff='' |
78 | nroff='' |
79 | uname='' |
80 | uuname='' |
81 | line='' |
82 | chgrp='' |
83 | chmod='' |
84 | lint='' |
85 | sleep='' |
86 | pr='' |
87 | tar='' |
88 | ln='' |
89 | lpr='' |
90 | lp='' |
91 | touch='' |
92 | make='' |
93 | date='' |
91407755 |
94 | csh='' |
8d063cd8 |
95 | Log='' |
96 | Header='' |
97 | bin='' |
a687059c |
98 | byteorder='' |
8d063cd8 |
99 | contains='' |
378cc40b |
100 | cppstdin='' |
36ce8bec |
101 | cppminus='' |
a687059c |
102 | d_bcmp='' |
135863df |
103 | d_bcopy='' |
0d3e774c |
104 | d_bzero='' |
8d063cd8 |
105 | d_charsprf='' |
2e1b3b7e |
106 | d_crypt='' |
a687059c |
107 | cryptlib='' |
91407755 |
108 | d_csh='' |
13281fa4 |
109 | d_dosuid='' |
a687059c |
110 | d_dup2='' |
378cc40b |
111 | d_fchmod='' |
112 | d_fchown='' |
a687059c |
113 | d_fcntl='' |
114 | d_flock='' |
378cc40b |
115 | d_getgrps='' |
a687059c |
116 | d_gethent='' |
117 | d_getpgrp='' |
d8f2e4cc |
118 | d_getpgrp2='' |
a687059c |
119 | d_getprior='' |
120 | d_htonl='' |
8d063cd8 |
121 | d_index='' |
a687059c |
122 | d_ioctl='' |
378cc40b |
123 | d_killpg='' |
0d3e774c |
124 | d_lstat='' |
a687059c |
125 | d_memcmp='' |
378cc40b |
126 | d_memcpy='' |
a687059c |
127 | d_mkdir='' |
128 | d_ndbm='' |
129 | d_odbm='' |
130 | d_readdir='' |
378cc40b |
131 | d_rename='' |
a687059c |
132 | d_rmdir='' |
378cc40b |
133 | d_setegid='' |
134 | d_seteuid='' |
a687059c |
135 | d_setpgrp='' |
d8f2e4cc |
136 | d_setpgrp2='' |
a687059c |
137 | d_setprior='' |
138 | d_setregid='' |
139 | d_setresgid='' |
140 | d_setreuid='' |
141 | d_setresuid='' |
378cc40b |
142 | d_setrgid='' |
143 | d_setruid='' |
a687059c |
144 | d_socket='' |
145 | d_sockpair='' |
146 | d_oldsock='' |
147 | socketlib='' |
135863df |
148 | d_statblks='' |
36ce8bec |
149 | d_stdstdio='' |
8d063cd8 |
150 | d_strctcpy='' |
d8f2e4cc |
151 | d_strerror='' |
2e1b3b7e |
152 | d_symlink='' |
a687059c |
153 | d_syscall='' |
a687059c |
154 | d_varargs='' |
8d063cd8 |
155 | d_vfork='' |
36ce8bec |
156 | d_voidsig='' |
449aadca |
157 | d_volatile='' |
a687059c |
158 | d_vprintf='' |
159 | d_charvspr='' |
91407755 |
160 | d_wait4='' |
378cc40b |
161 | gidtype='' |
a687059c |
162 | i_dirent='' |
163 | d_dirnamlen='' |
164 | i_fcntl='' |
165 | i_grp='' |
03a14243 |
166 | i_niin='' |
a687059c |
167 | i_pwd='' |
168 | d_pwquota='' |
169 | d_pwage='' |
91407755 |
170 | d_pwchange='' |
171 | d_pwclass='' |
172 | d_pwexpire='' |
a687059c |
173 | i_sysdir='' |
174 | i_sysioctl='' |
d8f2e4cc |
175 | i_sysndir='' |
176 | i_time='' |
177 | i_systime='' |
178 | d_systimekernel='' |
179 | i_utime='' |
a687059c |
180 | i_varargs='' |
181 | i_vfork='' |
182 | intsize='' |
8d063cd8 |
183 | libc='' |
a1cc2bdc |
184 | mallocsrc='' |
185 | mallocobj='' |
186 | usemymalloc='' |
8d063cd8 |
187 | mansrc='' |
188 | manext='' |
189 | models='' |
190 | split='' |
191 | small='' |
192 | medium='' |
193 | large='' |
194 | huge='' |
a687059c |
195 | optimize='' |
8d063cd8 |
196 | ccflags='' |
91407755 |
197 | cppflags='' |
8d063cd8 |
198 | ldflags='' |
a687059c |
199 | cc='' |
200 | libs='' |
8d063cd8 |
201 | n='' |
202 | c='' |
203 | package='' |
a687059c |
204 | randbits='' |
205 | sig_name='' |
8d063cd8 |
206 | spitshell='' |
207 | shsharp='' |
208 | sharpbang='' |
209 | startsh='' |
36ce8bec |
210 | stdchar='' |
378cc40b |
211 | uidtype='' |
8d063cd8 |
212 | voidflags='' |
213 | defvoidused='' |
d8f2e4cc |
214 | yacc='' |
378cc40b |
215 | privlib='' |
d8f2e4cc |
216 | lib='' |
8d063cd8 |
217 | CONFIG='' |
8d063cd8 |
218 | : set package name |
219 | package=perl |
220 | |
221 | echo " " |
222 | echo "Beginning of configuration questions for $package kit." |
223 | : Eunice requires " " instead of "", can you believe it |
224 | echo " " |
225 | |
226 | define='define' |
13281fa4 |
227 | undef='undef' |
d8f2e4cc |
228 | : change the next line if compiling for Xenix/286 on Xenix/386 |
229 | xlibpth='/usr/lib/386 /lib/386' |
230 | libpth='/usr/lib /usr/local/lib /usr/lib/large /lib '$xlibpth' /lib/large /usr/lib/small /lib/small' |
8d063cd8 |
231 | smallmach='pdp11 i8086 z8000 i80286 iAPX286' |
232 | rmlist='kit[1-9]isdone kit[1-9][0-9]isdone' |
233 | trap 'echo " "; rm -f $rmlist; exit 1' 1 2 3 |
378cc40b |
234 | |
235 | : We must find out about Eunice early |
236 | eunicefix=':' |
237 | if test -f /etc/unixtovms; then |
238 | eunicefix=/etc/unixtovms |
239 | fi |
240 | if test -f /etc/unixtovms.exe; then |
241 | eunicefix=/etc/unixtovms.exe |
242 | fi |
243 | |
a687059c |
244 | : Now test for existence of everything in MANIFEST |
245 | |
246 | echo "First let's make sure your kit is complete. Checking..." |
247 | (cd ..; awk '' `awk '$1 !~ /PACKINGLIST/ {print $1}' MANIFEST` >/dev/null || kill $$) |
91407755 |
248 | echo "Looks good..." |
a687059c |
249 | |
8d063cd8 |
250 | attrlist="mc68000 sun gcos unix ibm gimpel interdata tss os mert pyr" |
251 | attrlist="$attrlist vax pdp11 i8086 z8000 u3b2 u3b5 u3b20 u3b200" |
a687059c |
252 | attrlist="$attrlist hpux hp9000s300 hp9000s500 hp9000s800" |
36ce8bec |
253 | attrlist="$attrlist ns32000 ns16000 iAPX286 mc300 mc500 mc700 sparc" |
378cc40b |
254 | attrlist="$attrlist nsc32000 sinix xenix venix posix ansi M_XENIX" |
a687059c |
255 | attrlist="$attrlist $mc68k __STDC__ UTS M_I8086 M_I186 M_I286 M_I386" |
d8f2e4cc |
256 | attrlist="$attrlist i186 __m88k__ m88k DGUX __DGUX__" |
a687059c |
257 | pth="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /usr/plx /usr/5bin /vol/local/bin /etc /usr/lib /lib /usr/local/lib /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/bin /bsd4.3/usr/ucb" |
258 | d_newshome="/usr/NeWS" |
8d063cd8 |
259 | defvoidused=7 |
ff2452de |
260 | libswanted="net_s net nsl_s nsl socket nm ndir ndbm dbm sun bsd BSD x c_s" |
d8f2e4cc |
261 | inclwanted='/usr/netinclude /usr/include/sun /usr/include/bsd /usr/include/lan' |
8d063cd8 |
262 | : some greps do not return status, grrr. |
263 | echo "grimblepritz" >grimble |
264 | if grep blurfldyick grimble >/dev/null 2>&1 ; then |
265 | contains=contains |
266 | elif grep grimblepritz grimble >/dev/null 2>&1 ; then |
267 | contains=grep |
268 | else |
269 | contains=contains |
270 | fi |
271 | rm -f grimble |
272 | : the following should work in any shell |
273 | case "$contains" in |
274 | contains*) |
275 | echo " " |
276 | echo "AGH! Grep doesn't return a status. Attempting remedial action." |
277 | cat >contains <<'EOSS' |
278 | grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp |
279 | EOSS |
378cc40b |
280 | chmod +x contains |
8d063cd8 |
281 | esac |
282 | |
91407755 |
283 | : see if sh knows # comments |
284 | echo " " |
285 | echo "Checking your sh to see if it knows about # comments..." |
286 | if sh -c '#' >/dev/null 2>&1 ; then |
287 | echo "Your sh handles # comments correctly." |
288 | shsharp=true |
289 | spitshell=cat |
290 | echo " " |
291 | echo "Okay, let's see if #! works on this system..." |
292 | echo "#!/bin/echo hi" > try |
293 | $eunicefix try |
294 | chmod +x try |
449aadca |
295 | ./try > today |
91407755 |
296 | if $contains hi today >/dev/null 2>&1; then |
297 | echo "It does." |
298 | sharpbang='#!' |
299 | else |
300 | echo "#! /bin/echo hi" > try |
301 | $eunicefix try |
302 | chmod +x try |
449aadca |
303 | ./try > today |
91407755 |
304 | if test -s today; then |
305 | echo "It does." |
306 | sharpbang='#! ' |
307 | else |
308 | echo "It doesn't." |
309 | sharpbang=': use ' |
310 | fi |
311 | fi |
312 | else |
313 | echo "Your sh doesn't grok # comments--I will strip them later on." |
314 | shsharp=false |
315 | echo "exec grep -v '^#'" >spitshell |
316 | chmod +x spitshell |
317 | $eunicefix spitshell |
318 | spitshell=`pwd`/spitshell |
319 | echo "I presume that if # doesn't work, #! won't work either!" |
320 | sharpbang=': use ' |
321 | fi |
322 | |
323 | : figure out how to guarantee sh startup |
324 | echo " " |
325 | echo "Checking out how to guarantee sh startup..." |
326 | startsh=$sharpbang'/bin/sh' |
327 | echo "Let's see if '$startsh' works..." |
328 | cat >try <<EOSS |
329 | $startsh |
330 | set abc |
331 | test "$?abc" != 1 |
332 | EOSS |
333 | |
334 | chmod +x try |
335 | $eunicefix try |
449aadca |
336 | if ./try; then |
91407755 |
337 | echo "Yup, it does." |
338 | else |
339 | echo "Nope. You may have to fix up the shell scripts to make sure sh runs them." |
340 | fi |
341 | rm -f try today |
342 | |
8d063cd8 |
343 | : first determine how to suppress newline on echo command |
344 | echo "Checking echo to see how to suppress newlines..." |
345 | (echo "hi there\c" ; echo " ") >.echotmp |
346 | if $contains c .echotmp >/dev/null 2>&1 ; then |
347 | echo "...using -n." |
348 | n='-n' |
349 | c='' |
350 | else |
351 | cat <<'EOM' |
352 | ...using \c |
353 | EOM |
354 | n='' |
355 | c='\c' |
356 | fi |
357 | echo $n "Type carriage return to continue. Your cursor should be here-->$c" |
358 | read ans |
359 | rm -f .echotmp |
360 | |
361 | : now set up to do reads with possible shell escape and default assignment |
362 | cat <<EOSC >myread |
378cc40b |
363 | case "\$fastread" in |
364 | yes) ans=''; echo " " ;; |
365 | *) ans='!';; |
366 | esac |
8d063cd8 |
367 | while expr "X\$ans" : "X!" >/dev/null; do |
368 | read ans |
369 | case "\$ans" in |
370 | !) |
371 | sh |
372 | echo " " |
373 | echo $n "\$rp $c" |
374 | ;; |
375 | !*) |
376 | set \`expr "X\$ans" : "X!\(.*\)\$"\` |
377 | sh -c "\$*" |
378 | echo " " |
379 | echo $n "\$rp $c" |
380 | ;; |
381 | esac |
382 | done |
383 | rp='Your answer:' |
384 | case "\$ans" in |
385 | '') ans="\$dflt";; |
386 | esac |
387 | EOSC |
388 | |
389 | : general instructions |
390 | cat <<EOH |
391 | |
392 | This installation shell script will examine your system and ask you questions |
393 | to determine how the $package package should be installed. If you get stuck |
394 | on a question, you may use a ! shell escape to start a subshell or execute |
395 | a command. Many of the questions will have default answers in square |
396 | brackets--typing carriage return will give you the default. |
397 | |
398 | On some of the questions which ask for file or directory names you are |
399 | allowed to use the ~name construct to specify the login directory belonging |
400 | to "name", even if you don't have a shell which knows about that. Questions |
401 | where this is allowed will be marked "(~name ok)". |
402 | |
403 | EOH |
404 | rp="[Type carriage return to continue]" |
405 | echo $n "$rp $c" |
406 | . myread |
407 | cat <<EOH |
408 | |
409 | Much effort has been expended to ensure that this shell script will run |
410 | on any Unix system. If despite that it blows up on you, your best bet is |
36ce8bec |
411 | to edit Configure and run it again. Also, let me (lwall@jpl-devvax.jpl.nasa.gov) |
412 | know how I blew it. If you can't run Configure for some reason, you'll have |
8d063cd8 |
413 | to generate a config.sh file by hand. |
414 | |
415 | This installation script affects things in two ways: 1) it may do direct |
416 | variable substitutions on some of the files included in this kit, and |
417 | 2) it builds a config.h file for inclusion in C programs. You may edit |
418 | any of these files as the need arises after running this script. |
419 | |
420 | If you make a mistake on a question, there is no easy way to back up to it |
421 | currently. The easiest thing to do is to edit config.sh and rerun all the |
422 | SH files. Configure will offer to let you do this before it runs the SH files. |
423 | |
424 | EOH |
425 | rp="[Type carriage return to continue]" |
426 | echo $n "$rp $c" |
427 | . myread |
428 | |
429 | : get old answers, if there is a config file out there |
430 | if test -f ../config.sh; then |
431 | echo " " |
432 | dflt=y |
433 | rp="I see a config.sh file. Did Configure make it on THIS system? [$dflt]" |
434 | echo $n "$rp $c" |
435 | . myread |
436 | case "$ans" in |
437 | n*) echo "OK, I'll ignore it.";; |
438 | *) echo "Fetching default answers from your old config.sh file..." |
439 | tmp="$n" |
440 | ans="$c" |
441 | . ../config.sh |
442 | n="$tmp" |
443 | c="$ans" |
444 | ;; |
445 | esac |
446 | fi |
447 | |
448 | : find out where common programs are |
449 | echo " " |
450 | echo "Locating common programs..." |
451 | cat <<EOSC >loc |
452 | $startsh |
453 | case \$# in |
454 | 0) exit 1;; |
455 | esac |
456 | thing=\$1 |
457 | shift |
458 | dflt=\$1 |
459 | shift |
460 | for dir in \$*; do |
461 | case "\$thing" in |
462 | .) |
463 | if test -d \$dir/\$thing; then |
464 | echo \$dir |
465 | exit 0 |
466 | fi |
467 | ;; |
468 | *) |
469 | if test -f \$dir/\$thing; then |
470 | echo \$dir/\$thing |
471 | exit 0 |
378cc40b |
472 | elif test -f \$dir/\$thing.exe; then |
473 | : on Eunice apparently |
474 | echo \$dir/\$thing |
475 | exit 0 |
8d063cd8 |
476 | fi |
477 | ;; |
478 | esac |
479 | done |
480 | echo \$dflt |
481 | exit 1 |
482 | EOSC |
378cc40b |
483 | chmod +x loc |
8d063cd8 |
484 | $eunicefix loc |
485 | loclist=" |
8d063cd8 |
486 | cat |
8d063cd8 |
487 | cp |
a687059c |
488 | echo |
489 | expr |
490 | grep |
8d063cd8 |
491 | mkdir |
a687059c |
492 | mv |
493 | rm |
494 | sed |
8d063cd8 |
495 | sort |
a687059c |
496 | tr |
8d063cd8 |
497 | uniq |
8d063cd8 |
498 | " |
499 | trylist=" |
8d063cd8 |
500 | Mcc |
378cc40b |
501 | cpp |
91407755 |
502 | csh |
a687059c |
503 | egrep |
504 | test |
8d063cd8 |
505 | " |
506 | for file in $loclist; do |
507 | xxx=`loc $file $file $pth` |
508 | eval $file=$xxx |
509 | eval _$file=$xxx |
510 | case "$xxx" in |
511 | /*) |
512 | echo $file is in $xxx. |
513 | ;; |
514 | *) |
515 | echo "I don't know where $file is. I hope it's in everyone's PATH." |
516 | ;; |
517 | esac |
518 | done |
519 | echo " " |
520 | echo "Don't worry if any of the following aren't found..." |
521 | ans=offhand |
522 | for file in $trylist; do |
523 | xxx=`loc $file $file $pth` |
524 | eval $file=$xxx |
525 | eval _$file=$xxx |
526 | case "$xxx" in |
527 | /*) |
528 | echo $file is in $xxx. |
529 | ;; |
530 | *) |
531 | echo "I don't see $file out there, $ans." |
532 | ans=either |
533 | ;; |
534 | esac |
535 | done |
536 | case "$egrep" in |
537 | egrep) |
538 | echo "Substituting grep for egrep." |
539 | egrep=$grep |
540 | ;; |
541 | esac |
542 | case "$test" in |
543 | test) |
544 | echo "Hopefully test is built into your sh." |
545 | ;; |
546 | /bin/test) |
a687059c |
547 | if sh -c "PATH= test true" >/dev/null 2>&1; then |
548 | echo "Using the test built into your sh." |
549 | test=test |
550 | fi |
8d063cd8 |
551 | ;; |
552 | *) |
553 | test=test |
554 | ;; |
555 | esac |
556 | case "$echo" in |
557 | echo) |
558 | echo "Hopefully echo is built into your sh." |
559 | ;; |
560 | /bin/echo) |
561 | echo " " |
562 | echo "Checking compatibility between /bin/echo and builtin echo (if any)..." |
563 | $echo $n "hi there$c" >foo1 |
564 | echo $n "hi there$c" >foo2 |
565 | if cmp foo1 foo2 >/dev/null 2>&1; then |
566 | echo "They are compatible. In fact, they may be identical." |
567 | else |
568 | case "$n" in |
569 | '-n') n='' c='\c' ans='\c' ;; |
570 | *) n='-n' c='' ans='-n' ;; |
571 | esac |
572 | cat <<FOO |
573 | They are not compatible! You are probably running ksh on a non-USG system. |
574 | I'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't |
575 | have echo built in and we may have to run some Bourne shell scripts. That |
576 | means I'll have to use $ans to suppress newlines now. Life is ridiculous. |
577 | |
578 | FOO |
579 | rp="Your cursor should be here-->" |
580 | $echo $n "$rp$c" |
581 | . myread |
582 | fi |
583 | $rm -f foo1 foo2 |
584 | ;; |
585 | *) |
586 | : cross your fingers |
587 | echo=echo |
588 | ;; |
589 | esac |
590 | rmlist="$rmlist loc" |
591 | |
a687059c |
592 | : set up shell script to do ~ expansion |
593 | cat >filexp <<EOSS |
594 | $startsh |
595 | : expand filename |
596 | case "\$1" in |
597 | ~/*|~) |
598 | echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|" |
599 | ;; |
600 | ~*) |
601 | if $test -f /bin/csh; then |
602 | /bin/csh -f -c "glob \$1" |
603 | echo "" |
36ce8bec |
604 | else |
a687059c |
605 | name=\`$expr x\$1 : '..\([^/]*\)'\` |
606 | dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\` |
607 | if $test ! -d "\$dir"; then |
608 | me=\`basename \$0\` |
609 | echo "\$me: can't locate home directory for: \$name" >&2 |
610 | exit 1 |
36ce8bec |
611 | fi |
a687059c |
612 | case "\$1" in |
613 | */*) |
614 | echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\` |
615 | ;; |
616 | *) |
617 | echo \$dir |
618 | ;; |
619 | esac |
13281fa4 |
620 | fi |
621 | ;; |
a687059c |
622 | *) |
623 | echo \$1 |
624 | ;; |
13281fa4 |
625 | esac |
a687059c |
626 | EOSS |
627 | chmod +x filexp |
628 | $eunicefix filexp |
13281fa4 |
629 | |
a687059c |
630 | : determine where public executables go |
631 | case "$bin" in |
632 | '') |
633 | dflt=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin` |
634 | ;; |
635 | *) dflt="$bin" |
636 | ;; |
378cc40b |
637 | esac |
a687059c |
638 | cont=true |
639 | while $test "$cont" ; do |
640 | echo " " |
ff2452de |
641 | rp="Where do you want to put the public executables? (~name ok) [$dflt]" |
a687059c |
642 | $echo $n "$rp $c" |
643 | . myread |
644 | bin="$ans" |
ff2452de |
645 | bin=`./filexp "$bin"` |
a687059c |
646 | if test -d $bin; then |
647 | cont='' |
648 | else |
649 | case "$fastread" in |
650 | yes) dflt=y;; |
651 | *) dflt=n;; |
652 | esac |
653 | rp="Directory $bin doesn't exist. Use that name anyway? [$dflt]" |
378cc40b |
654 | $echo $n "$rp $c" |
655 | . myread |
a687059c |
656 | dflt='' |
378cc40b |
657 | case "$ans" in |
a687059c |
658 | y*) cont='';; |
378cc40b |
659 | esac |
378cc40b |
660 | fi |
a687059c |
661 | done |
378cc40b |
662 | |
a687059c |
663 | : determine where manual pages go |
664 | $cat <<EOM |
665 | |
666 | $package has manual pages that need to be installed in source form. |
667 | EOM |
668 | case "$mansrc" in |
669 | '') |
670 | dflt=`loc . /usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1 /usr/man/u_man/man1 /usr/man/man1 /usr/man/man.L` |
671 | ;; |
672 | *) dflt="$mansrc" |
673 | ;; |
674 | esac |
675 | cont=true |
676 | while $test "$cont" ; do |
677 | echo " " |
ff2452de |
678 | rp="Where do the manual pages (source) go? (~name ok) [$dflt]" |
a687059c |
679 | $echo $n "$rp $c" |
680 | . myread |
ff2452de |
681 | mansrc=`./filexp "$ans"` |
a687059c |
682 | if $test -d "$mansrc"; then |
683 | cont='' |
684 | else |
685 | if $test "$fastread" = yes; then |
686 | dflt=y |
687 | else |
688 | dflt=n |
689 | fi |
690 | rp="Directory $mansrc doesn't exist. Use that name anyway? [$dflt]" |
691 | $echo $n "$rp $c" |
692 | . myread |
693 | dflt='' |
694 | case "$ans" in |
695 | y*) cont='';; |
696 | esac |
697 | fi |
698 | done |
699 | case "$mansrc" in |
700 | *l) |
701 | manext=l |
702 | ;; |
703 | *n) |
704 | manext=n |
705 | ;; |
706 | *o) |
707 | manext=l |
708 | ;; |
709 | *p) |
ff2452de |
710 | manext=p |
a687059c |
711 | ;; |
712 | *C) |
713 | manext=C |
714 | ;; |
715 | *L) |
716 | manext=L |
717 | ;; |
718 | *) |
719 | manext=1 |
720 | ;; |
721 | esac |
722 | |
91407755 |
723 | : make some quick guesses about what we are up against |
724 | echo " " |
725 | $echo $n "Hmm... $c" |
726 | cat /usr/include/signal.h /usr/include/sys/signal.h >foo |
727 | if test `echo abc | tr a-z A-Z` = Abc ; then |
728 | echo "Looks kind of like a USG system, but we'll see..." |
729 | echo exit 1 >bsd |
730 | echo exit 0 >usg |
731 | echo exit 1 >v7 |
732 | elif $contains SIGTSTP foo >/dev/null 2>&1 ; then |
733 | echo "Looks kind of like a BSD system, but we'll see..." |
734 | echo exit 0 >bsd |
735 | echo exit 1 >usg |
736 | echo exit 1 >v7 |
737 | else |
738 | echo "Looks kind of like a version 7 system, but we'll see..." |
739 | echo exit 1 >bsd |
740 | echo exit 1 >usg |
741 | echo exit 0 >v7 |
742 | fi |
743 | case "$eunicefix" in |
744 | *unixtovms*) |
745 | cat <<'EOI' |
746 | There is, however, a strange, musty smell in the air that reminds me of |
747 | something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit. |
748 | EOI |
749 | echo "exit 0" >eunice |
750 | d_eunice="$define" |
751 | ;; |
752 | *) |
753 | echo " " |
754 | echo "Congratulations. You aren't running Eunice." |
755 | d_eunice="$undef" |
756 | echo "exit 1" >eunice |
757 | ;; |
758 | esac |
759 | if test -f /xenix; then |
760 | echo "Actually, this looks more like a XENIX system..." |
761 | echo "exit 0" >xenix |
762 | else |
763 | echo " " |
764 | echo "It's not Xenix..." |
765 | echo "exit 1" >xenix |
766 | fi |
767 | chmod +x xenix |
768 | $eunicefix xenix |
769 | if test -f /venix; then |
770 | echo "Actually, this looks more like a VENIX system..." |
771 | echo "exit 0" >venix |
772 | else |
773 | echo " " |
774 | if xenix; then |
775 | : null |
776 | else |
777 | echo "Nor is it Venix..." |
778 | fi |
779 | echo "exit 1" >venix |
780 | fi |
781 | chmod +x bsd usg v7 eunice venix |
782 | $eunicefix bsd usg v7 eunice venix |
783 | rm -rf foo |
784 | rmlist="$rmlist bsd usg v7 eunice venix xenix" |
785 | |
a687059c |
786 | : see what memory models we can support |
787 | case "$models" in |
788 | '') |
789 | : We may not use Cppsym or we get a circular dependency through cc. |
790 | : But this should work regardless of which cc we eventually use. |
791 | cat >pdp11.c <<'EOP' |
792 | main() { |
793 | #ifdef pdp11 |
794 | exit(0); |
795 | #else |
796 | exit(1); |
797 | #endif |
798 | } |
799 | EOP |
800 | cc -o pdp11 pdp11.c >/dev/null 2>&1 |
801 | if pdp11 2>/dev/null; then |
802 | dflt='unsplit split' |
803 | else |
804 | ans=`loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge` |
805 | case "$ans" in |
806 | X) dflt='none';; |
807 | *) if $test -d /lib/small || $test -d /usr/lib/small; then |
808 | dflt='small' |
809 | else |
810 | dflt='' |
811 | fi |
812 | if $test -d /lib/medium || $test -d /usr/lib/medium; then |
813 | dflt="$dflt medium" |
814 | fi |
815 | if $test -d /lib/large || $test -d /usr/lib/large; then |
816 | dflt="$dflt large" |
817 | fi |
818 | if $test -d /lib/huge || $test -d /usr/lib/huge; then |
819 | dflt="$dflt huge" |
820 | fi |
821 | esac |
822 | fi |
823 | ;; |
824 | *) dflt="$models" ;; |
825 | esac |
826 | $cat <<EOM |
827 | |
828 | Some systems have different model sizes. On most systems they are called |
829 | small, medium, large, and huge. On the PDP11 they are called unsplit and |
830 | split. If your system doesn't support different memory models, say "none". |
831 | If you wish to force everything to one memory model, say "none" here and |
832 | put the appropriate flags later when it asks you for other cc and ld flags. |
833 | Venix systems may wish to put "none" and let the compiler figure things out. |
834 | (In the following question multiple model names should be space separated.) |
835 | |
836 | EOM |
837 | rp="Which models are supported? [$dflt]" |
838 | $echo $n "$rp $c" |
839 | . myread |
840 | models="$ans" |
841 | |
842 | case "$models" in |
843 | none) |
844 | small='' |
845 | medium='' |
846 | large='' |
847 | huge='' |
848 | unsplit='' |
849 | split='' |
850 | ;; |
851 | *split) |
852 | case "$split" in |
853 | '') |
854 | if $contains '\-i' $mansrc/man1/ld.1 >/dev/null 2>&1 || \ |
855 | $contains '\-i' $mansrc/man1/cc.1 >/dev/null 2>&1; then |
856 | dflt='-i' |
857 | else |
858 | dflt='none' |
859 | fi |
860 | ;; |
861 | *) dflt="$split";; |
862 | esac |
863 | rp="What flag indicates separate I and D space? [$dflt]" |
864 | $echo $n "$rp $c" |
865 | . myread |
866 | case "$ans" in |
867 | none) ans='';; |
868 | esac |
869 | split="$ans" |
870 | unsplit='' |
871 | ;; |
872 | *large*|*small*|*medium*|*huge*) |
873 | case "$models" in |
874 | *large*) |
875 | case "$large" in |
876 | '') dflt='-Ml';; |
877 | *) dflt="$large";; |
878 | esac |
879 | rp="What flag indicates large model? [$dflt]" |
880 | $echo $n "$rp $c" |
881 | . myread |
882 | case "$ans" in |
883 | none) ans=''; |
884 | esac |
885 | large="$ans" |
886 | ;; |
887 | *) large='';; |
888 | esac |
889 | case "$models" in |
890 | *huge*) |
891 | case "$huge" in |
892 | '') dflt='-Mh';; |
893 | *) dflt="$huge";; |
894 | esac |
895 | rp="What flag indicates huge model? [$dflt]" |
896 | $echo $n "$rp $c" |
897 | . myread |
898 | case "$ans" in |
899 | none) ans=''; |
900 | esac |
901 | huge="$ans" |
902 | ;; |
903 | *) huge="$large";; |
904 | esac |
905 | case "$models" in |
906 | *medium*) |
907 | case "$medium" in |
908 | '') dflt='-Mm';; |
909 | *) dflt="$medium";; |
910 | esac |
911 | rp="What flag indicates medium model? [$dflt]" |
912 | $echo $n "$rp $c" |
913 | . myread |
914 | case "$ans" in |
915 | none) ans=''; |
916 | esac |
917 | medium="$ans" |
918 | ;; |
919 | *) medium="$large";; |
920 | esac |
921 | case "$models" in |
922 | *small*) |
923 | case "$small" in |
924 | '') dflt='none';; |
925 | *) dflt="$small";; |
926 | esac |
927 | rp="What flag indicates small model? [$dflt]" |
928 | $echo $n "$rp $c" |
929 | . myread |
930 | case "$ans" in |
931 | none) ans=''; |
932 | esac |
933 | small="$ans" |
934 | ;; |
935 | *) small='';; |
936 | esac |
937 | ;; |
938 | *) |
939 | echo "Unrecognized memory models--you may have to edit Makefile.SH" |
940 | ;; |
941 | esac |
942 | |
943 | : see if we need a special compiler |
944 | echo " " |
945 | if usg; then |
946 | case "$cc" in |
947 | '') |
948 | case "$Mcc" in |
949 | /*) dflt='Mcc' |
950 | ;; |
951 | *) |
952 | case "$large" in |
953 | -M*) |
954 | dflt='cc' |
955 | ;; |
956 | *) |
957 | if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then |
958 | dflt='cc -M' |
959 | else |
960 | dflt='cc' |
961 | fi |
962 | ;; |
963 | esac |
964 | ;; |
965 | esac |
966 | ;; |
967 | *) dflt="$cc";; |
968 | esac |
969 | $cat <<'EOM' |
970 | |
971 | On some systems the default C compiler will not resolve multiple global |
972 | references that happen to have the same name. On some such systems the |
973 | "Mcc" command may be used to force these to be resolved. On other systems |
974 | a "cc -M" command is required. (Note that the -M flag on other systems |
975 | indicates a memory model to use!) If you have the Gnu C compiler, you |
976 | might wish to use that instead. What command will force resolution on |
977 | EOM |
978 | $echo $n "this system? [$dflt] $c" |
979 | rp="Command to resolve multiple refs? [$dflt]" |
980 | . myread |
981 | cc="$ans" |
982 | else |
983 | case "$cc" in |
984 | '') dflt=cc;; |
985 | *) dflt="$cc";; |
986 | esac |
987 | rp="Use which C compiler? [$dflt]" |
988 | $echo $n "$rp $c" |
989 | . myread |
990 | cc="$ans" |
991 | fi |
992 | case "$cc" in |
993 | gcc*) cpp=`loc gcc-cpp $cpp $pth`;; |
994 | esac |
995 | |
996 | : determine optimize, if desired, or use for debug flag also |
997 | case "$optimize" in |
998 | ' ') dflt="none" |
999 | ;; |
1000 | '') dflt="-O"; |
1001 | ;; |
1002 | *) dflt="$optimize" |
1003 | ;; |
1004 | esac |
1005 | cat <<EOH |
91407755 |
1006 | |
a687059c |
1007 | Some C compilers have problems with their optimizers, by default, $package |
1008 | compiles with the -O flag to use the optimizer. Alternately, you might |
1009 | want to use the symbolic debugger, which uses the -g flag (on traditional |
1010 | Unix systems). Either flag can be specified here. To use neither flag, |
1011 | specify the word "none". |
1012 | |
1013 | EOH |
1014 | rp="What optimizer/debugger flag should be used? [$dflt]" |
1015 | $echo $n "$rp $c" |
1016 | . myread |
1017 | optimize="$ans" |
1018 | case "$optimize" in |
1019 | 'none') optimize=" " |
1020 | ;; |
1021 | esac |
1022 | |
1023 | case "$ccflags" in |
1024 | '') case "$cc" in |
91407755 |
1025 | *gcc*) dflt='-fpcc-struct-return';; |
0d3e774c |
1026 | *) dflt='';; |
a687059c |
1027 | esac |
1028 | ;; |
1029 | *) dflt="$ccflags";; |
1030 | esac |
0d3e774c |
1031 | for thisincl in $inclwanted; do |
1032 | if test -d $thisincl; then |
1033 | case "$dflt" in |
1034 | *$thisincl*);; |
1035 | *) dflt="$dflt -I$thisincl";; |
1036 | esac |
1037 | fi |
1038 | done |
91407755 |
1039 | case "$optimize" in |
1040 | -g*) |
1041 | case "$dflt" in |
1042 | *DEBUGGING*);; |
1043 | *) dflt="$dflt -DDEBUGGING";; |
1044 | esac |
1045 | ;; |
1046 | esac |
449aadca |
1047 | if $contains 'LANGUAGE_C' /usr/include/signal.h >/dev/null 2>&1; then |
1048 | case "$dflt" in |
1049 | *LANGUAGE_C*);; |
1050 | *) dflt="$dflt -DLANGUAGE_C";; |
1051 | esac |
1052 | fi |
0d3e774c |
1053 | case "$dflt" in |
1054 | '') dflt=none;; |
1055 | esac |
91407755 |
1056 | cat <<EOH |
1057 | |
1058 | Your C compiler may want other flags. For this question you should |
1059 | include -I/whatever and -DWHATEVER flags and any other flags used by |
1060 | the C compiler, but you should NOT include libraries or ld flags like |
1061 | -lwhatever. To use no flags, specify the word "none". |
1062 | |
1063 | EOH |
a687059c |
1064 | rp="Any additional cc flags? [$dflt]" |
1065 | $echo $n "$rp $c" |
1066 | . myread |
1067 | case "$ans" in |
1068 | none) ans=''; |
1069 | esac |
1070 | ccflags="$ans" |
1071 | |
91407755 |
1072 | : the following weeds options from ccflags that are of no interest to cpp |
1073 | cppflags="$ccflags" |
1074 | case "$cc" in |
1075 | *gcc*) cppflags="$cppflags -D__GNUC__";; |
1076 | esac |
1077 | case "$cppflags" in |
1078 | '');; |
1079 | *) set X $cppflags |
1080 | cppflags='' |
1081 | for flag do |
1082 | case $flag in |
1083 | -D*|-I*) cppflags="$cppflags $flag";; |
1084 | esac |
1085 | done |
1086 | case "$cppflags" in |
1087 | *-*) echo "(C preprocessor flags: $cppflags)";; |
1088 | esac |
1089 | ;; |
1090 | esac |
1091 | |
a687059c |
1092 | case "$ldflags" in |
1093 | '') if venix; then |
1094 | dflt='-i -z' |
1095 | else |
1096 | dflt='none' |
1097 | fi |
1098 | ;; |
1099 | *) dflt="$ldflags";; |
1100 | esac |
1101 | echo " " |
1102 | rp="Any additional ld flags (NOT including libraries)? [$dflt]" |
1103 | $echo $n "$rp $c" |
1104 | . myread |
1105 | case "$ans" in |
1106 | none) ans=''; |
1107 | esac |
1108 | ldflags="$ans" |
1109 | rmlist="$rmlist pdp11" |
1110 | |
91407755 |
1111 | echo " " |
1112 | echo "Checking for optional libraries..." |
91407755 |
1113 | case "$libswanted" in |
1114 | '') libswanted='c_s';; |
1115 | esac |
1116 | for thislib in $libswanted; do |
d8f2e4cc |
1117 | case "$thislib" in |
1118 | dbm) thatlib=ndbm;; |
1119 | *_s) thatlib=NONE;; |
1120 | *) thatlib="${thislib}_s";; |
1121 | *) thatlib=NONE;; |
1122 | esac |
0d3e774c |
1123 | xxx=`loc lib$thislib.a X /usr/lib /usr/local/lib /lib` |
1124 | if test -f $xxx; then |
91407755 |
1125 | echo "Found -l$thislib." |
1126 | case "$dflt" in |
d8f2e4cc |
1127 | *-l$thislib*|*-l$thatlib*);; |
91407755 |
1128 | *) dflt="$dflt -l$thislib";; |
1129 | esac |
91407755 |
1130 | else |
0d3e774c |
1131 | xxx=`loc lib$thislib.a X $libpth` |
1132 | if test -f $xxx; then |
1133 | echo "Found $xxx." |
1134 | case "$dflt" in |
1135 | *$xxx*);; |
1136 | *) dflt="$dflt $xxx";; |
1137 | esac |
1138 | else |
d8f2e4cc |
1139 | xxx=`loc Slib$thislib.a X $xlibpth` |
0d3e774c |
1140 | if test -f $xxx; then |
1141 | echo "Found -l$thislib." |
1142 | case "$dflt" in |
d8f2e4cc |
1143 | *-l$thislib*|*-l$thatlib*);; |
0d3e774c |
1144 | *) dflt="$dflt -l$thislib";; |
1145 | esac |
1146 | else |
1147 | echo "No -l$thislib." |
1148 | fi |
1149 | fi |
91407755 |
1150 | fi |
1151 | done |
1152 | set X $dflt |
1153 | shift |
1154 | dflt="$*" |
ff2452de |
1155 | case "$libs" in |
1156 | *) dflt="$libs";; |
1157 | esac |
91407755 |
1158 | case "$dflt" in |
1159 | '') dflt='none';; |
1160 | esac |
a687059c |
1161 | |
1162 | $cat <<EOM |
1163 | |
1164 | Some versions of Unix support shared libraries, which make |
1165 | executables smaller but make load time slightly longer. |
1166 | |
1167 | On some systems, mostly newer Unix System V's, the shared library |
1168 | is included by putting the option "-lc_s" as the last thing on the |
1169 | cc command line when linking. Other systems use shared libraries |
1170 | by default. There may be other libraries needed to compile $package |
1171 | on your machine as well. If your system needs the "-lc_s" option, |
1172 | include it here. Include any other special libraries here as well. |
d8f2e4cc |
1173 | Say "none" for none. |
a687059c |
1174 | EOM |
1175 | |
1176 | echo " " |
1177 | rp="Any additional libraries? [$dflt]" |
1178 | $echo $n "$rp $c" |
1179 | . myread |
1180 | case "$ans" in |
1181 | none) ans=''; |
1182 | esac |
1183 | libs="$ans" |
1184 | |
1185 | : check for ordering of bytes in a long |
1186 | case "$byteorder" in |
1187 | '') |
1188 | cat <<'EOM' |
1189 | |
1190 | In the following, larger digits indicate more significance. A big-endian |
1191 | machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A |
1192 | little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other |
91407755 |
1193 | machines may have weird orders like 3412. A Cray will report 87654321. If |
1194 | the test program works the default is probably right. |
1195 | I'm now running the test program... |
a687059c |
1196 | EOM |
1197 | $cat >try.c <<'EOCP' |
1198 | #include <stdio.h> |
1199 | main() |
1200 | { |
1201 | int i; |
1202 | union { |
1203 | unsigned long l; |
0d3e774c |
1204 | char c[sizeof(long)]; |
a687059c |
1205 | } u; |
1206 | |
0d3e774c |
1207 | if (sizeof(long) > 4) |
ff2452de |
1208 | u.l = (0x08070605<<32) | 0x04030201; |
0d3e774c |
1209 | else |
1210 | u.l = 0x04030201; |
91407755 |
1211 | for (i=0; i < sizeof(long); i++) |
1212 | printf("%c",u.c[i]+'0'); |
1213 | printf("\n"); |
a687059c |
1214 | } |
1215 | EOCP |
ff2452de |
1216 | if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then |
449aadca |
1217 | dflt=`./try` |
a687059c |
1218 | case "$dflt" in |
91407755 |
1219 | ????|????????) echo "(The test program ran ok.)";; |
a687059c |
1220 | *) echo "(The test program didn't run right for some reason.)";; |
1221 | esac |
1222 | else |
1223 | dflt='4321' |
1224 | echo "(I can't seem to compile the test program. Guessing big-endian...)" |
1225 | fi |
1226 | ;; |
1227 | *) |
1228 | echo " " |
1229 | dflt="$byteorder" |
1230 | ;; |
1231 | esac |
1232 | rp="What is the order of bytes in a long? [$dflt]" |
1233 | $echo $n "$rp $c" |
1234 | . myread |
1235 | byteorder="$ans" |
1236 | $rm -f try.c try |
1237 | |
1238 | : see how we invoke the C preprocessor |
1239 | echo " " |
1240 | echo "Now, how can we feed standard input to your C preprocessor..." |
1241 | cat <<'EOT' >testcpp.c |
1242 | #define ABC abc |
1243 | #define XYZ xyz |
1244 | ABC.XYZ |
1245 | EOT |
1246 | echo 'Maybe "'"$cc"' -E" will work...' |
1247 | $cc -E <testcpp.c >testcpp.out 2>&1 |
91407755 |
1248 | : try to force gcc preprocessor if that is the compiler they are using |
1249 | case $? in |
1250 | 0) cppstdin="$cc -E";; |
1251 | *) case "$cc" in |
1252 | *gcc*) |
1253 | cd .. |
1254 | echo 'Trying (cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c)' |
1255 | echo 'cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c' >cppstdin |
1256 | chmod 755 cppstdin |
1257 | cppstdin=`pwd`/cppstdin |
1258 | cppminus=''; |
1259 | cd UU |
1260 | $cppstdin <testcpp.c >testcpp.out 2>&1 |
1261 | ;; |
1262 | esac |
1263 | ;; |
1264 | esac |
a687059c |
1265 | if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then |
1266 | echo "Yup, it does." |
1267 | cppstdin="$cc -E" |
1268 | cppminus=''; |
1269 | else |
1270 | echo 'Nope, maybe "'$cpp'" will work...' |
1271 | $cpp <testcpp.c >testcpp.out 2>&1 |
1272 | if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then |
1273 | echo "Yup, it does." |
1274 | cppstdin="$cpp" |
1275 | cppminus=''; |
1276 | else |
1277 | echo 'No such luck...maybe "'$cpp' -" will work...' |
1278 | $cpp - <testcpp.c >testcpp.out 2>&1 |
1279 | if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then |
1280 | echo "It works!" |
1281 | cppstdin="$cpp" |
1282 | cppminus='-'; |
1283 | else |
1284 | echo 'Nixed again...maybe "'"$cc"' -E -" will work...' |
1285 | $cc -E - <testcpp.c >testcpp.out 2>&1 |
1286 | if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then |
1287 | echo "Hooray, it works! I was beginning to wonder." |
1288 | cppstdin="$cc -E" |
1289 | cppminus='-'; |
1290 | else |
1291 | echo 'Nope...maybe "'"$cc"' -P" will work...' |
1292 | $cc -P <testcpp.c >testcpp.out 2>&1 |
1293 | if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then |
1294 | echo "Yup, that does." |
1295 | cppstdin="$cc -P" |
1296 | cppminus=''; |
1297 | else |
1298 | echo 'Nope...maybe "'"$cc"' -P -" will work...' |
1299 | $cc -P - <testcpp.c >testcpp.out 2>&1 |
1300 | if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then |
1301 | echo "Yup, that does." |
1302 | cppstdin="$cc -P" |
1303 | cppminus='-'; |
1304 | else |
1305 | echo 'Hmm...perhaps you already told me...' |
1306 | case "$cppstdin" in |
1307 | '') ;; |
1308 | *) $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1;; |
1309 | esac |
1310 | if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then |
1311 | echo "Hooray, you did! I was beginning to wonder." |
1312 | else |
1313 | echo 'Uh-uh. Time to get fancy...' |
1314 | cd .. |
1315 | echo 'Trying (cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c)' |
1316 | echo 'cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c' >cppstdin |
1317 | chmod 755 cppstdin |
1318 | cppstdin=`pwd`/cppstdin |
1319 | cppminus=''; |
1320 | cd UU |
1321 | $cppstdin <testcpp.c >testcpp.out 2>&1 |
1322 | if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then |
1323 | echo "Eureka!." |
1324 | else |
1325 | dflt=blurfl |
1326 | $echo $n "No dice. I can't find a C preprocessor. Name one: $c" |
1327 | rp='Name a C preprocessor:' |
1328 | . myread |
1329 | cppstdin="$ans" |
1330 | $cppstdin <testcpp.c >testcpp.out 2>&1 |
1331 | if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then |
1332 | echo "OK, that will do." |
1333 | else |
1334 | echo "Sorry, I can't get that to work. Go find one." |
1335 | exit 1 |
1336 | fi |
1337 | fi |
1338 | fi |
1339 | fi |
1340 | fi |
1341 | fi |
1342 | fi |
1343 | fi |
1344 | fi |
1345 | rm -f testcpp.c testcpp.out |
1346 | |
91407755 |
1347 | : get list of predefined functions in a handy place |
1348 | echo " " |
1349 | case "$libc" in |
1350 | '') libc=unknown;; |
1351 | esac |
1352 | case "$libpth" in |
1353 | '') libpth='/lib /usr/lib /usr/local/lib';; |
1354 | esac |
1355 | case "$libs" in |
1356 | *-lc_s*) libc=`loc libc_s.a $libc $libpth` |
1357 | esac |
1358 | libnames=''; |
1359 | case "$libs" in |
1360 | '') ;; |
1361 | *) for thislib in $libs; do |
1362 | case "$thislib" in |
1363 | -l*) thislib=`expr X$thislib : 'X-l\(.*\)'` |
1364 | try=`loc lib$thislib.a blurfl/dyick $libpth` |
1365 | if test ! -f $try; then |
1366 | try=`loc lib$thislib blurfl/dyick $libpth` |
1367 | if test ! -f $try; then |
1368 | try=`loc $thislib blurfl/dyick $libpth` |
1369 | if test ! -f $try; then |
d8f2e4cc |
1370 | try=`loc Slib$thislib.a blurfl/dyick $xlibpth` |
1371 | if test ! -f $try; then |
1372 | try='' |
1373 | fi |
91407755 |
1374 | fi |
1375 | fi |
1376 | fi |
1377 | libnames="$libnames $try" |
1378 | ;; |
0d3e774c |
1379 | *) libnames="$libnames $thislib" ;; |
91407755 |
1380 | esac |
1381 | done |
1382 | ;; |
1383 | esac |
1384 | set /usr/lib/libc.so.[0-9]* |
1385 | eval set \$$# |
1386 | if test -f "$1"; then |
1387 | echo "Your shared C library is in $1." |
1388 | libc="$1" |
1389 | elif test -f $libc; then |
1390 | echo "Your C library is in $libc, like you said before." |
1391 | elif test -f /lib/libc.a; then |
1392 | echo "Your C library is in /lib/libc.a. You're normal." |
1393 | libc=/lib/libc.a |
1394 | else |
1395 | ans=`loc libc.a blurfl/dyick $libpth` |
1396 | if test ! -f "$ans"; then |
1397 | ans=`loc libc blurfl/dyick $libpth` |
1398 | fi |
1399 | if test ! -f "$ans"; then |
1400 | ans=`loc clib blurfl/dyick $libpth` |
1401 | fi |
1402 | if test ! -f "$ans"; then |
d8f2e4cc |
1403 | ans=`loc Slibc.a blurfl/dyick $xlibpth` |
91407755 |
1404 | fi |
1405 | if test ! -f "$ans"; then |
d8f2e4cc |
1406 | ans=`loc Mlibc.a blurfl/dyick $xlibpth` |
91407755 |
1407 | fi |
1408 | if test ! -f "$ans"; then |
d8f2e4cc |
1409 | ans=`loc Llibc.a blurfl/dyick $xlibpth` |
91407755 |
1410 | fi |
1411 | if test -f "$ans"; then |
1412 | echo "Your C library is in $ans, of all places." |
1413 | libc=$ans |
1414 | else |
1415 | cat <<EOM |
1416 | |
1417 | I can't seem to find your C library. I've looked in the following places: |
1418 | |
1419 | $libpth |
1420 | |
1421 | None of these seems to contain your C library. What is the full name |
1422 | EOM |
1423 | dflt=None |
1424 | $echo $n "of your C library? $c" |
1425 | rp='C library full name?' |
1426 | . myread |
1427 | libc="$ans" |
1428 | fi |
1429 | fi |
1430 | echo " " |
449aadca |
1431 | set `echo $libc $libnames | tr ' ' '\012' | sort | uniq` |
91407755 |
1432 | $echo $n "Extracting names from $* for later perusal...$c" |
1433 | nm $* 2>/dev/null >libc.tmp |
1434 | $sed -n -e 's/^.* [AT] *_[_.]*//p' -e 's/^.* [AT] //p' <libc.tmp >libc.list |
1435 | if $contains '^printf$' libc.list >/dev/null 2>&1; then |
1436 | echo "done" |
1437 | else |
1438 | $sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p' <libc.tmp >libc.list |
1439 | $contains '^printf$' libc.list >/dev/null 2>&1 || \ |
1440 | $sed -n -e 's/^.* D __*//p' -e 's/^.* D //p' <libc.tmp >libc.list |
1441 | $contains '^printf$' libc.list >/dev/null 2>&1 || \ |
1442 | $sed -n -e 's/^_//' \ |
1443 | -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p' <libc.tmp >libc.list |
449aadca |
1444 | $contains '^printf$' libc.list >/dev/null 2>&1 || \ |
1445 | $sed -n -e 's/^.*|FUNC |GLOB .*|//p' <libc.tmp >libc.list |
91407755 |
1446 | if $contains '^printf$' libc.list >/dev/null 2>&1; then |
1447 | echo "done" |
1448 | else |
1449 | echo " " |
1450 | echo "nm didn't seem to work right." |
1451 | echo "Trying ar instead..." |
1452 | if ar t $libc > libc.tmp; then |
1453 | for thisname in $libnames; do |
1454 | ar t $thisname >>libc.tmp |
1455 | done |
1456 | $sed -e 's/\.o$//' < libc.tmp > libc.list |
1457 | echo "Ok." |
1458 | else |
1459 | echo "ar didn't seem to work right." |
1460 | echo "Maybe this is a Cray...trying bld instead..." |
1461 | if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then |
1462 | for thisname in $libnames; do |
1463 | bld t $libnames | \ |
1464 | $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list |
1465 | ar t $thisname >>libc.tmp |
1466 | done |
1467 | echo "Ok." |
1468 | else |
1469 | echo "That didn't work either. Giving up." |
1470 | exit 1 |
1471 | fi |
1472 | fi |
1473 | fi |
1474 | fi |
1475 | |
1476 | inlibc='echo " "; |
1477 | if $contains "^$1\$" libc.list >/dev/null 2>&1; |
1478 | then echo "$1() found"; eval "$2=$define"; |
1479 | else echo "$1() not found"; eval "$2=$undef"; fi' |
1480 | |
1481 | rmlist="$rmlist libc.tmp libc.list" |
1482 | |
a687059c |
1483 | : see if bcmp exists |
1484 | set bcmp d_bcmp |
1485 | eval $inlibc |
1486 | |
1487 | : see if bcopy exists |
1488 | set bcopy d_bcopy |
1489 | eval $inlibc |
1490 | |
0d3e774c |
1491 | : see if bzero exists |
1492 | set bzero d_bzero |
1493 | eval $inlibc |
1494 | |
a687059c |
1495 | : see if sprintf is declared as int or pointer to char |
1496 | echo " " |
1497 | cat >.ucbsprf.c <<'EOF' |
1498 | main() { char buf[10]; exit((unsigned long)sprintf(buf,"%s","foo") > 10L); } |
1499 | EOF |
1500 | if $cc $ccflags .ucbsprf.c -o .ucbsprf >/dev/null 2>&1 && .ucbsprf; then |
1501 | echo "Your sprintf() returns (int)." |
1502 | d_charsprf="$undef" |
1503 | else |
1504 | echo "Your sprintf() returns (char*)." |
1505 | d_charsprf="$define" |
1506 | fi |
1507 | /bin/rm -f .ucbsprf.c .ucbsprf |
1508 | |
1509 | : see if vprintf exists |
1510 | echo " " |
1511 | if $contains '^vprintf$' libc.list >/dev/null 2>&1; then |
1512 | echo 'vprintf() found.' |
1513 | d_vprintf="$define" |
1514 | cat >.ucbsprf.c <<'EOF' |
ff2452de |
1515 | #include <stdio.h> |
a687059c |
1516 | #include <varargs.h> |
1517 | |
1518 | main() { xxx("foo"); } |
1519 | |
1520 | xxx(va_alist) |
1521 | va_dcl |
1522 | { |
1523 | va_list args; |
1524 | char buf[10]; |
1525 | |
1526 | va_start(args); |
1527 | exit((unsigned long)vsprintf(buf,"%s",args) > 10L); |
1528 | } |
1529 | EOF |
1530 | if $cc $ccflags .ucbsprf.c -o .ucbsprf >/dev/null 2>&1 && .ucbsprf; then |
1531 | echo "Your vsprintf() returns (int)." |
1532 | d_charvspr="$undef" |
1533 | else |
1534 | echo "Your vsprintf() returns (char*)." |
1535 | d_charvspr="$define" |
1536 | fi |
1537 | /bin/rm -f .ucbsprf.c .ucbsprf |
1538 | else |
1539 | echo 'vprintf() not found.' |
1540 | d_vprintf="$undef" |
1541 | d_charvspr="$undef" |
1542 | fi |
1543 | |
1544 | : see if crypt exists |
1545 | echo " " |
1546 | if $contains '^crypt$' libc.list >/dev/null 2>&1; then |
1547 | echo 'crypt() found.' |
1548 | d_crypt="$define" |
1549 | cryptlib='' |
1550 | else |
d8f2e4cc |
1551 | cryptlib=`loc Slibcrypt.a "" $xlibpth` |
a687059c |
1552 | if $test -z "$cryptlib"; then |
d8f2e4cc |
1553 | cryptlib=`loc Mlibcrypt.a "" $xlibpth` |
a687059c |
1554 | else |
1555 | cryptlib=-lcrypt |
1556 | fi |
1557 | if $test -z "$cryptlib"; then |
d8f2e4cc |
1558 | cryptlib=`loc Llibcrypt.a "" $xlibpth` |
a687059c |
1559 | else |
1560 | cryptlib=-lcrypt |
1561 | fi |
1562 | if $test -z "$cryptlib"; then |
1563 | cryptlib=`loc libcrypt.a "" $libpth` |
1564 | else |
1565 | cryptlib=-lcrypt |
1566 | fi |
1567 | if $test -z "$cryptlib"; then |
1568 | echo 'crypt() not found.' |
1569 | d_crypt="$undef" |
1570 | else |
1571 | d_crypt="$define" |
1572 | fi |
1573 | fi |
1574 | |
91407755 |
1575 | : get csh whereabouts |
1576 | case "$csh" in |
1577 | 'csh') d_csh="$undef" ;; |
1578 | *) d_csh="$define" ;; |
1579 | esac |
1580 | |
a687059c |
1581 | : see if this is a dirent system |
1582 | echo " " |
1583 | if $test -r /usr/include/dirent.h ; then |
1584 | i_dirent="$define" |
1585 | echo "dirent.h found." |
1586 | if $contains 'd_namlen' /usr/include/sys/dirent.h >/dev/null 2>&1; then |
1587 | d_dirnamlen="$define" |
1588 | else |
1589 | d_dirnamlen="$undef" |
1590 | fi |
1591 | else |
1592 | i_dirent="$undef" |
0d3e774c |
1593 | if $contains 'd_namlen' /usr/include/sys/dir.h >/dev/null 2>&1; then |
1594 | d_dirnamlen="$define" |
1595 | else |
1596 | d_dirnamlen="$undef" |
1597 | fi |
a687059c |
1598 | echo "No dirent.h found." |
1599 | fi |
1600 | |
1601 | : now see if they want to do setuid emulation |
1602 | case "$d_dosuid" in |
1603 | '') dflt=n;; |
1604 | *undef*) dflt=n;; |
1605 | *) dflt=y;; |
1606 | esac |
1607 | cat <<EOM |
1608 | |
1609 | Some sites have disabled setuid #! scripts because of a bug in the kernel |
1610 | that prevents them from being secure. If you are on such a system, the |
1611 | setuid/setgid bits on scripts are currently useless. It is possible for |
1612 | $package to detect those bits and emulate setuid/setgid in a secure fashion |
1613 | until a better solution is devised for the kernel problem. |
1614 | |
1615 | EOM |
1616 | rp="Do you want to do setuid/setgid emulation? [$dflt]" |
449aadca |
1617 | $echo $n "$rp $c" |
a687059c |
1618 | . myread |
1619 | case "$ans" in |
1620 | '') $ans="$dflt";; |
1621 | esac |
1622 | case "$ans" in |
1623 | y*) d_dosuid="$define";; |
1624 | *) d_dosuid="$undef";; |
1625 | esac |
1626 | |
1627 | : see if dup2 exists |
1628 | set dup2 d_dup2 |
1629 | eval $inlibc |
1630 | |
1631 | : see if fchmod exists |
1632 | set fchmod d_fchmod |
1633 | eval $inlibc |
1634 | |
1635 | : see if fchown exists |
1636 | set fchown d_fchown |
1637 | eval $inlibc |
1638 | |
1639 | : see if this is an fcntl system |
1640 | echo " " |
1641 | if $test -r /usr/include/fcntl.h ; then |
1642 | d_fcntl="$define" |
1643 | echo "fcntl.h found." |
1644 | else |
1645 | d_fcntl="$undef" |
1646 | echo "No fcntl.h found, but that's ok." |
1647 | fi |
1648 | |
1649 | : see if flock exists |
1650 | set flock d_flock |
1651 | eval $inlibc |
1652 | |
1653 | : see if getgroups exists |
1654 | set getgroups d_getgrps |
1655 | eval $inlibc |
1656 | |
1657 | : see if gethostent exists |
1658 | set gethostent d_gethent |
1659 | eval $inlibc |
1660 | |
1661 | : see if getpgrp exists |
1662 | set getpgrp d_getpgrp |
1663 | eval $inlibc |
1664 | |
d8f2e4cc |
1665 | : see if getpgrp2 exists |
1666 | set getpgrp2 d_getpgrp2 |
1667 | eval $inlibc |
1668 | |
a687059c |
1669 | : see if getpriority exists |
1670 | set getpriority d_getprior |
1671 | eval $inlibc |
1672 | |
1673 | : see if htonl exists |
1674 | set htonl d_htonl |
1675 | eval $inlibc |
1676 | |
1677 | : index or strcpy |
378cc40b |
1678 | echo " " |
a687059c |
1679 | case "$d_index" in |
1680 | n) dflt=n;; |
1681 | *) dflt=y;; |
1682 | esac |
1683 | if $contains '^index$' libc.list >/dev/null 2>&1 ; then |
1684 | if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then |
1685 | echo "Your system has both index() and strchr(). Shall I use" |
1686 | rp="index() rather than strchr()? [$dflt]" |
1687 | $echo $n "$rp $c" |
1688 | . myread |
1689 | case "$ans" in |
1690 | n*) d_index="$define" ;; |
1691 | *) d_index="$undef" ;; |
1692 | esac |
1693 | else |
1694 | d_index="$undef" |
1695 | echo "index() found." |
1696 | fi |
378cc40b |
1697 | else |
a687059c |
1698 | if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then |
1699 | d_index="$define" |
1700 | echo "strchr() found." |
1701 | else |
1702 | echo "No index() or strchr() found!" |
1703 | d_index="$undef" |
1704 | fi |
378cc40b |
1705 | fi |
1706 | |
a687059c |
1707 | : see if ioctl defs are in sgtty/termio or sys/ioctl |
378cc40b |
1708 | echo " " |
a687059c |
1709 | if $test -r /usr/include/sys/ioctl.h ; then |
1710 | d_ioctl="$define" |
1711 | echo "sys/ioctl.h found." |
378cc40b |
1712 | else |
a687059c |
1713 | d_ioctl="$undef" |
1714 | echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h." |
378cc40b |
1715 | fi |
1716 | |
a687059c |
1717 | : see if killpg exists |
1718 | set killpg d_killpg |
1719 | eval $inlibc |
1720 | |
0d3e774c |
1721 | : see if lstat exists |
1722 | set lstat d_lstat |
1723 | eval $inlibc |
1724 | |
a687059c |
1725 | : see if memcmp exists |
1726 | set memcmp d_memcmp |
1727 | eval $inlibc |
1728 | |
1729 | : see if memcpy exists |
1730 | set memcpy d_memcpy |
1731 | eval $inlibc |
1732 | |
1733 | : see if mkdir exists |
1734 | set mkdir d_mkdir |
1735 | eval $inlibc |
1736 | |
1737 | : see if ndbm is available |
378cc40b |
1738 | echo " " |
0d3e774c |
1739 | xxx=`loc ndbm.h x /usr/include /usr/local/include $inclwanted` |
1740 | if test -f $xxx; then |
a687059c |
1741 | d_ndbm="$define" |
1742 | echo "ndbm.h found." |
378cc40b |
1743 | else |
a687059c |
1744 | d_ndbm="$undef" |
1745 | echo "ndbm.h not found." |
378cc40b |
1746 | fi |
1747 | |
a687059c |
1748 | : see if we have the old dbm |
378cc40b |
1749 | echo " " |
0d3e774c |
1750 | xxx=`loc dbm.h x /usr/include /usr/local/include $inclwanted` |
1751 | if test -f $xxx; then |
a687059c |
1752 | d_odbm="$define" |
1753 | echo "dbm.h found." |
378cc40b |
1754 | else |
a687059c |
1755 | d_odbm="$undef" |
1756 | echo "dbm.h not found." |
378cc40b |
1757 | fi |
1758 | |
03a14243 |
1759 | : see if this is a pwd system |
378cc40b |
1760 | echo " " |
a687059c |
1761 | if $test -r /usr/include/pwd.h ; then |
1762 | i_pwd="$define" |
1763 | echo "pwd.h found." |
91407755 |
1764 | $cppstdin $cppflags </usr/include/pwd.h >$$.h |
1765 | if $contains 'pw_quota' $$.h >/dev/null 2>&1; then |
a687059c |
1766 | d_pwquota="$define" |
1767 | else |
1768 | d_pwquota="$undef" |
1769 | fi |
91407755 |
1770 | if $contains 'pw_age' $$.h >/dev/null 2>&1; then |
a687059c |
1771 | d_pwage="$define" |
1772 | else |
1773 | d_pwage="$undef" |
1774 | fi |
91407755 |
1775 | if $contains 'pw_change' $$.h >/dev/null 2>&1; then |
03a14243 |
1776 | d_pwchange="$define" |
1777 | else |
1778 | d_pwchange="$undef" |
1779 | fi |
91407755 |
1780 | if $contains 'pw_class' $$.h >/dev/null 2>&1; then |
03a14243 |
1781 | d_pwclass="$define" |
1782 | else |
1783 | d_pwclass="$undef" |
1784 | fi |
91407755 |
1785 | if $contains 'pw_expire' $$.h >/dev/null 2>&1; then |
03a14243 |
1786 | d_pwexpire="$define" |
1787 | else |
1788 | d_pwexpire="$undef" |
1789 | fi |
91407755 |
1790 | rm -f $$.h |
378cc40b |
1791 | else |
a687059c |
1792 | i_pwd="$undef" |
1793 | d_pwquota="$undef" |
1794 | d_pwage="$undef" |
03a14243 |
1795 | d_pwchange="$undef" |
1796 | d_pwclass="$undef" |
1797 | d_pwexpire="$undef" |
a687059c |
1798 | echo "No pwd.h found." |
378cc40b |
1799 | fi |
1800 | |
a687059c |
1801 | : see if readdir exists |
1802 | set readdir d_readdir |
1803 | eval $inlibc |
1804 | |
1805 | : see if rename exists |
1806 | set rename d_rename |
1807 | eval $inlibc |
1808 | |
1809 | : see if rmdir exists |
1810 | set rmdir d_rmdir |
1811 | eval $inlibc |
1812 | |
1813 | : see if setegid exists |
1814 | set setegid d_setegid |
1815 | eval $inlibc |
1816 | |
1817 | : see if seteuid exists |
1818 | set seteuid d_seteuid |
1819 | eval $inlibc |
1820 | |
1821 | : see if setpgrp exists |
1822 | set setpgrp d_setpgrp |
1823 | eval $inlibc |
1824 | |
d8f2e4cc |
1825 | : see if setpgrp2 exists |
1826 | set setpgrp2 d_setpgrp2 |
1827 | eval $inlibc |
1828 | |
a687059c |
1829 | : see if setpriority exists |
1830 | set setpriority d_setprior |
1831 | eval $inlibc |
1832 | |
1833 | : see if setregid exists |
1834 | set setregid d_setregid |
1835 | eval $inlibc |
1836 | set setresgid d_setresgid |
1837 | eval $inlibc |
1838 | |
1839 | : see if setreuid exists |
1840 | set setreuid d_setreuid |
1841 | eval $inlibc |
1842 | set setresuid d_setresuid |
1843 | eval $inlibc |
1844 | |
1845 | : see if setrgid exists |
1846 | set setrgid d_setrgid |
1847 | eval $inlibc |
1848 | |
378cc40b |
1849 | : see if setruid exists |
a687059c |
1850 | set setruid d_setruid |
1851 | eval $inlibc |
1852 | |
1853 | socketlib='' |
a687059c |
1854 | : see whether socket exists |
378cc40b |
1855 | echo " " |
a687059c |
1856 | if $contains socket libc.list >/dev/null 2>&1; then |
1857 | echo "Looks like you have Berkeley networking support." |
1858 | d_socket="$define" |
1859 | : now check for advanced features |
1860 | if $contains setsockopt libc.list >/dev/null 2>&1; then |
1861 | d_oldsock="$undef" |
1862 | else |
1863 | echo "...but it uses the old 4.1c interface, rather than 4.2" |
1864 | d_oldsock="$define" |
1865 | fi |
1866 | else |
1867 | : hpux, for one, puts all the socket stuff in socklib.o |
1868 | if $contains socklib libc.list >/dev/null 2>&1; then |
1869 | echo "Looks like you have Berkeley networking support." |
1870 | d_socket="$define" |
1871 | : we will have to assume that it supports the 4.2 BSD interface |
1872 | d_oldsock="$undef" |
1873 | else |
1874 | echo "Hmmm...you don't have Berkeley networking in libc.a..." |
1875 | : look for an optional networking library |
1876 | if test -f /usr/lib/libnet.a; then |
1877 | (ar t /usr/lib/libnet.a || |
1878 | nm -g /usr/lib/libnet.a) 2>/dev/null >> libc.list |
1879 | if $contains socket libc.list >/dev/null 2>&1; then |
1880 | echo "but the Wollongong group seems to have hacked it in." |
1881 | socketlib="-lnet" |
a687059c |
1882 | d_socket="$define" |
1883 | : now check for advanced features |
1884 | if $contains setsockopt libc.list >/dev/null 2>&1; then |
1885 | d_oldsock="$undef" |
1886 | else |
1887 | echo "...using the old 4.1c interface, rather than 4.2" |
1888 | d_oldsock="$define" |
1889 | fi |
1890 | else |
1891 | echo "or even in libnet.a, which is peculiar." |
1892 | d_socket="$undef" |
1893 | d_oldsock="$undef" |
1894 | fi |
1895 | else |
1896 | echo "or anywhere else I see." |
1897 | d_socket="$undef" |
1898 | d_oldsock="$undef" |
1899 | fi |
1900 | fi |
1901 | fi |
1902 | if $contains socketpair libc.list >/dev/null 2>&1; then |
1903 | d_sockpair="$define" |
378cc40b |
1904 | else |
a687059c |
1905 | d_sockpair="$undef" |
8d063cd8 |
1906 | fi |
1907 | |
135863df |
1908 | : see if stat knows about block sizes |
1909 | echo " " |
1910 | if $contains 'st_blocks;' /usr/include/sys/stat.h >/dev/null 2>&1 ; then |
1911 | if $contains 'st_blksize;' /usr/include/sys/stat.h >/dev/null 2>&1 ; then |
1912 | echo "Your stat knows about block sizes." |
1913 | d_statblks="$define" |
1914 | else |
1915 | echo "Your stat doesn't know about block sizes." |
1916 | d_statblks="$undef" |
1917 | fi |
1918 | else |
1919 | echo "Your stat doesn't know about block sizes." |
1920 | d_statblks="$undef" |
1921 | fi |
1922 | |
36ce8bec |
1923 | : see if stdio is really std |
1924 | echo " " |
449aadca |
1925 | if $contains 'char.*_ptr.*;' /usr/include/stdio.h >/dev/null 2>&1 ; then |
36ce8bec |
1926 | if $contains '_cnt;' /usr/include/stdio.h >/dev/null 2>&1 ; then |
1927 | echo "Your stdio is pretty std." |
1928 | d_stdstdio="$define" |
1929 | else |
1930 | echo "Your stdio isn't very std." |
1931 | d_stdstdio="$undef" |
1932 | fi |
1933 | else |
1934 | echo "Your stdio isn't very std." |
1935 | d_stdstdio="$undef" |
1936 | fi |
1937 | |
8d063cd8 |
1938 | : check for structure copying |
1939 | echo " " |
1940 | echo "Checking to see if your C compiler can copy structs..." |
1941 | $cat >try.c <<'EOCP' |
1942 | main() |
1943 | { |
1944 | struct blurfl { |
1945 | int dyick; |
1946 | } foo, bar; |
1947 | |
1948 | foo = bar; |
1949 | } |
1950 | EOCP |
ff2452de |
1951 | if $cc -c $ccflags try.c >/dev/null 2>&1 ; then |
8d063cd8 |
1952 | d_strctcpy="$define" |
1953 | echo "Yup, it can." |
1954 | else |
1955 | d_strctcpy="$undef" |
1956 | echo "Nope, it can't." |
1957 | fi |
1958 | $rm -f try.* |
1959 | |
d8f2e4cc |
1960 | : see if strerror exists |
1961 | set strerror d_strerror |
1962 | eval $inlibc |
1963 | |
378cc40b |
1964 | : see if symlink exists |
a687059c |
1965 | set symlink d_symlink |
1966 | eval $inlibc |
1967 | |
1968 | : see if syscall exists |
1969 | set syscall d_syscall |
1970 | eval $inlibc |
378cc40b |
1971 | |
d8f2e4cc |
1972 | : see if we should include time.h, sys/time.h, or both |
1973 | cat <<'EOM' |
1974 | |
1975 | Testing to see if we should include <time.h>, <sys/time.h> or both. |
1976 | I'm now running the test program... |
1977 | EOM |
1978 | $cat >try.c <<'EOCP' |
1979 | #ifdef I_TIME |
1980 | #include <time.h> |
1981 | #endif |
1982 | #ifdef I_SYSTIME |
1983 | #ifdef SYSTIMEKERNEL |
1984 | #define KERNEL |
1985 | #endif |
1986 | #include <sys/time.h> |
1987 | #endif |
1988 | main() |
1989 | { |
1990 | struct tm foo; |
1991 | #ifdef S_TIMEVAL |
1992 | struct timeval bar; |
1993 | #endif |
1994 | if (foo.tm_sec == foo.tm_sec) |
1995 | exit(0); |
1996 | #ifdef S_TIMEVAL |
1997 | if (bar.tv_sec == bar.tv_sec) |
1998 | exit(0); |
1999 | #endif |
2000 | exit(1); |
2001 | } |
2002 | EOCP |
2003 | flags='' |
2004 | for s_timeval in '-DS_TIMEVAL' ''; do |
2005 | for d_systimekernel in '' '-DSYSTIMEKERNEL'; do |
2006 | for i_time in '' '-DI_TIME'; do |
2007 | for i_systime in '-DI_SYSTIME' ''; do |
2008 | case "$flags" in |
2009 | '') echo Trying $i_time $i_systime $d_systimekernel $s_timeval |
ff2452de |
2010 | if $cc $ccflags \ |
d8f2e4cc |
2011 | $i_time $i_systime $d_systimekernel $s_timeval \ |
ff2452de |
2012 | try.c -o try >/dev/null 2>&1 ; then |
d8f2e4cc |
2013 | set X $i_time $i_systime $d_systimekernel $s_timeval |
2014 | shift |
2015 | flags="$*" |
2016 | echo Succeeded with $flags |
2017 | fi |
2018 | ;; |
2019 | esac |
2020 | done |
2021 | done |
2022 | done |
2023 | done |
2024 | case "$flags" in |
2025 | *SYSTIMEKERNEL*) d_systimekernel="$define";; |
2026 | *) d_systimekernel="$undef";; |
2027 | esac |
2028 | case "$flags" in |
2029 | *I_TIME*) i_time="$define";; |
2030 | *) i_time="$undef";; |
2031 | esac |
2032 | case "$flags" in |
2033 | *I_SYSTIME*) i_systime="$define";; |
2034 | *) i_systime="$undef";; |
2035 | esac |
2036 | $rm -f try.c try |
135863df |
2037 | |
a687059c |
2038 | : see if this is a varargs system |
8d063cd8 |
2039 | echo " " |
a687059c |
2040 | if $test -r /usr/include/varargs.h ; then |
2041 | d_varargs="$define" |
2042 | echo "varargs.h found." |
8d063cd8 |
2043 | else |
a687059c |
2044 | d_varargs="$undef" |
2045 | echo "No varargs.h found, but that's ok (I hope)." |
8d063cd8 |
2046 | fi |
2047 | |
a687059c |
2048 | : see if there is a vfork |
2049 | set vfork d_vfork |
2050 | eval $inlibc |
2051 | |
36ce8bec |
2052 | : see if signal is declared as pointer to function returning int or void |
2053 | echo " " |
0d3e774c |
2054 | $cppstdin $cppflags < /usr/include/signal.h >$$.tmp |
2055 | if $contains 'void.*signal' $$.tmp >/dev/null 2>&1 ; then |
36ce8bec |
2056 | echo "You have void (*signal())() instead of int." |
2057 | d_voidsig="$define" |
2058 | else |
2059 | echo "You have int (*signal())() instead of void." |
2060 | d_voidsig="$undef" |
2061 | fi |
0d3e774c |
2062 | rm -f $$.tmp |
36ce8bec |
2063 | |
449aadca |
2064 | : check for volatile keyword |
2065 | echo " " |
2066 | echo 'Checking to see if your C compiler knows about "volatile"...' |
2067 | $cat >try.c <<'EOCP' |
2068 | main() |
2069 | { |
ff2452de |
2070 | char *volatile foo; |
2071 | volatile int bar; |
449aadca |
2072 | foo = foo; |
2073 | } |
2074 | EOCP |
ff2452de |
2075 | if $cc -c $ccflags try.c >/dev/null 2>&1 ; then |
449aadca |
2076 | d_volatile="$define" |
2077 | echo "Yup, it does." |
2078 | else |
2079 | d_volatile="$undef" |
2080 | echo "Nope, it doesn't." |
2081 | fi |
2082 | $rm -f try.* |
2083 | |
91407755 |
2084 | : see if there is a wait4 |
2085 | set wait4 d_wait4 |
2086 | eval $inlibc |
2087 | |
8d063cd8 |
2088 | : check for void type |
2089 | echo " " |
2090 | $cat <<EOM |
2091 | Checking to see how well your C compiler groks the void type... |
2092 | |
2093 | Support flag bits are: |
2094 | 1: basic void declarations. |
2095 | 2: arrays of pointers to functions returning void. |
2096 | 4: operations between pointers to and addresses of void functions. |
2097 | |
2098 | EOM |
2099 | case "$voidflags" in |
2100 | '') |
2101 | $cat >try.c <<'EOCP' |
2102 | #if TRY & 1 |
2103 | void main() { |
2104 | #else |
2105 | main() { |
2106 | #endif |
a687059c |
2107 | extern void moo(); /* function returning void */ |
2108 | void (*goo)(); /* ptr to func returning void */ |
8d063cd8 |
2109 | #if TRY & 2 |
2110 | void (*foo[10])(); |
2111 | #endif |
2112 | |
2113 | #if TRY & 4 |
a687059c |
2114 | if(goo == moo) { |
8d063cd8 |
2115 | exit(0); |
2116 | } |
2117 | #endif |
2118 | exit(0); |
2119 | } |
2120 | EOCP |
ff2452de |
2121 | if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then |
a687059c |
2122 | voidflags=$defvoidused |
2123 | echo "It appears to support void." |
8d063cd8 |
2124 | if $contains warning .out >/dev/null 2>&1; then |
2125 | echo "However, you might get some warnings that look like this:" |
2126 | $cat .out |
2127 | fi |
2128 | else |
a687059c |
2129 | echo "Hmm, your compiler has some difficulty with void. Checking further..." |
ff2452de |
2130 | if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1 ; then |
8d063cd8 |
2131 | echo "It supports 1..." |
ff2452de |
2132 | if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1 ; then |
8d063cd8 |
2133 | voidflags=3 |
2134 | echo "And it supports 2 but not 4." |
2135 | else |
2136 | echo "It doesn't support 2..." |
ff2452de |
2137 | if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1 ; then |
8d063cd8 |
2138 | voidflags=5 |
2139 | echo "But it supports 4." |
2140 | else |
2141 | voidflags=1 |
2142 | echo "And it doesn't support 4." |
2143 | fi |
2144 | fi |
2145 | else |
2146 | echo "There is no support at all for void." |
2147 | voidflags=0 |
2148 | fi |
2149 | fi |
2150 | esac |
2151 | dflt="$voidflags"; |
2152 | rp="Your void support flags add up to what? [$dflt]" |
2153 | $echo $n "$rp $c" |
2154 | . myread |
2155 | voidflags="$ans" |
2156 | $rm -f try.* .out |
2157 | |
378cc40b |
2158 | : see what type gids are declared as in the kernel |
0d3e774c |
2159 | echo " " |
378cc40b |
2160 | case "$gidtype" in |
2161 | '') |
0d3e774c |
2162 | if $contains 'getgroups.*short' /usr/lib/lint/llib-lc >/dev/null 2>&1; then |
2163 | dflt='short' |
2164 | elif $contains 'getgroups.*int' /usr/lib/lint/llib-lc >/dev/null 2>&1; then |
2165 | dflt='int' |
2166 | elif $contains 'gid_t;' /usr/include/sys/types.h >/dev/null 2>&1 ; then |
2167 | dflt='gid_t' |
378cc40b |
2168 | else |
2169 | set `grep 'groups\[NGROUPS\];' /usr/include/sys/user.h 2>/dev/null` unsigned short |
2170 | case $1 in |
2171 | unsigned) dflt="$1 $2" ;; |
2172 | *) dflt="$1" ;; |
2173 | esac |
2174 | fi |
2175 | ;; |
2176 | *) dflt="$gidtype" |
2177 | ;; |
2178 | esac |
2179 | cont=true |
91407755 |
2180 | echo "(The following only matters if you have getgroups().)" |
2181 | rp="What type are the group ids returned by getgroups()? [$dflt]" |
378cc40b |
2182 | $echo $n "$rp $c" |
2183 | . myread |
2184 | gidtype="$ans" |
8d063cd8 |
2185 | |
a687059c |
2186 | : see if this is an fcntl system |
2187 | echo " " |
2188 | if $test -r /usr/include/fcntl.h ; then |
2189 | i_fcntl="$define" |
2190 | echo "fcntl.h found." |
2191 | else |
2192 | i_fcntl="$undef" |
2193 | echo "No fcntl.h found, but that's ok." |
2194 | fi |
378cc40b |
2195 | |
a687059c |
2196 | : see if this is an grp system |
2197 | echo " " |
2198 | if $test -r /usr/include/grp.h ; then |
2199 | i_grp="$define" |
2200 | echo "grp.h found." |
2201 | else |
2202 | i_grp="$undef" |
2203 | echo "No grp.h found." |
2204 | fi |
378cc40b |
2205 | |
03a14243 |
2206 | : see if this is a netinet/in.h system |
2207 | echo " " |
0d3e774c |
2208 | xxx=`loc netinet/in.h x /usr/include /usr/local/include $inclwanted` |
2209 | if test -f $xxx; then |
03a14243 |
2210 | i_niin="$define" |
2211 | echo "netinet/in.h found." |
2212 | else |
2213 | i_niin="$undef" |
2214 | echo "No netinet/in.h found." |
2215 | fi |
2216 | |
a687059c |
2217 | : see if this is a sys/dir.h system |
378cc40b |
2218 | echo " " |
a687059c |
2219 | if $test -r /usr/include/sys/dir.h ; then |
2220 | i_sysdir="$define" |
d8f2e4cc |
2221 | echo "sys/dir.h found." |
378cc40b |
2222 | else |
a687059c |
2223 | i_sysdir="$undef" |
d8f2e4cc |
2224 | echo "No sys/dir.h found." |
378cc40b |
2225 | fi |
2226 | |
a687059c |
2227 | : see if ioctl defs are in sgtty/termio or sys/ioctl |
378cc40b |
2228 | echo " " |
a687059c |
2229 | if $test -r /usr/include/sys/ioctl.h ; then |
2230 | i_sysioctl="$define" |
2231 | echo "sys/ioctl.h found." |
2232 | else |
2233 | i_sysioctl="$undef" |
2234 | echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h." |
2235 | fi |
378cc40b |
2236 | |
d8f2e4cc |
2237 | : see if this is a sys/ndir.h system |
2238 | echo " " |
2239 | xxx=`loc sys/ndir.h x /usr/include /usr/local/include $inclwanted` |
2240 | if test -f $xxx; then |
2241 | i_sysndir="$define" |
2242 | echo "sys/ndir.h found." |
2243 | else |
2244 | i_sysndir="$undef" |
2245 | echo "No sys/ndir.h found." |
2246 | fi |
2247 | |
449aadca |
2248 | : see if we should include utime.h |
d8f2e4cc |
2249 | echo " " |
2250 | if $test -r /usr/include/utime.h ; then |
2251 | i_utime="$define" |
2252 | echo "utime.h found." |
2253 | else |
2254 | i_utime="$undef" |
2255 | echo "No utime.h found, but that's ok." |
2256 | fi |
2257 | |
a687059c |
2258 | : see if this is a varargs system |
2259 | echo " " |
2260 | if $test -r /usr/include/varargs.h ; then |
2261 | i_varargs="$define" |
2262 | echo "varargs.h found." |
2263 | else |
2264 | i_varargs="$undef" |
2265 | echo "No varargs.h found, but that's ok (I hope)." |
2266 | fi |
378cc40b |
2267 | |
a687059c |
2268 | : see if this is a vfork system |
2269 | echo " " |
2270 | if $test -r /usr/include/vfork.h ; then |
2271 | i_vfork="$define" |
2272 | echo "vfork.h found." |
2273 | else |
2274 | i_vfork="$undef" |
2275 | echo "No vfork.h found." |
2276 | fi |
8d063cd8 |
2277 | |
a687059c |
2278 | : check for length of integer |
2279 | echo " " |
2280 | case "$intsize" in |
8d063cd8 |
2281 | '') |
a687059c |
2282 | echo "Checking to see how big your integers are..." |
2283 | $cat >try.c <<'EOCP' |
2284 | #include <stdio.h> |
2285 | main() |
2286 | { |
2287 | printf("%d\n", sizeof(int)); |
2288 | } |
2289 | EOCP |
ff2452de |
2290 | if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then |
449aadca |
2291 | dflt=`./try` |
8d063cd8 |
2292 | else |
a687059c |
2293 | dflt='4' |
2294 | echo "(I can't seem to compile the test program. Guessing...)" |
2295 | fi |
8d063cd8 |
2296 | ;; |
8d063cd8 |
2297 | *) |
a687059c |
2298 | dflt="$intsize" |
8d063cd8 |
2299 | ;; |
2300 | esac |
a687059c |
2301 | rp="What is the size of an integer (in bytes)? [$dflt]" |
2302 | $echo $n "$rp $c" |
2303 | . myread |
2304 | intsize="$ans" |
2305 | $rm -f try.c try |
8d063cd8 |
2306 | |
a687059c |
2307 | : determine where private executables go |
2308 | case "$privlib" in |
8d063cd8 |
2309 | '') |
a687059c |
2310 | dflt=/usr/lib/$package |
2311 | test -d /usr/local/lib && dflt=/usr/local/lib/$package |
2312 | ;; |
2313 | *) dflt="$privlib" |
8d063cd8 |
2314 | ;; |
8d063cd8 |
2315 | esac |
2316 | $cat <<EOM |
8d063cd8 |
2317 | |
a687059c |
2318 | The $package package has some auxiliary files that should be put in a library |
2319 | that is accessible by everyone. Where do you want to put these "private" |
8d063cd8 |
2320 | EOM |
ff2452de |
2321 | $echo $n "but accessible files? (~name ok) [$dflt] $c" |
a687059c |
2322 | rp="Put private files where? [$dflt]" |
8d063cd8 |
2323 | . myread |
ff2452de |
2324 | privlib=`./filexp "$ans"` |
8d063cd8 |
2325 | |
a687059c |
2326 | : check for size of random number generator |
2327 | echo " " |
2328 | case "$randbits" in |
2329 | '') |
2330 | echo "Checking to see how many bits your rand function produces..." |
2331 | $cat >try.c <<'EOCP' |
2332 | #include <stdio.h> |
2333 | main() |
2334 | { |
2335 | register int i; |
2336 | register unsigned long tmp; |
2337 | register unsigned long max = 0L; |
2338 | |
2339 | for (i=1000; i; i--) { |
2340 | tmp = (unsigned long)rand(); |
2341 | if (tmp > max) max = tmp; |
2342 | } |
2343 | for (i=0; max; i++) |
2344 | max /= 2; |
2345 | printf("%d\n",i); |
2346 | } |
2347 | EOCP |
ff2452de |
2348 | if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then |
449aadca |
2349 | dflt=`./try` |
a687059c |
2350 | else |
2351 | dflt='?' |
2352 | echo "(I can't seem to compile the test program...)" |
2353 | fi |
8d063cd8 |
2354 | ;; |
a687059c |
2355 | *) |
2356 | dflt="$randbits" |
8d063cd8 |
2357 | ;; |
a687059c |
2358 | esac |
2359 | rp="How many bits does your rand() function produce? [$dflt]" |
2360 | $echo $n "$rp $c" |
2361 | . myread |
2362 | randbits="$ans" |
2363 | $rm -f try.c try |
2364 | |
2365 | : generate list of signal names |
2366 | echo " " |
2367 | case "$sig_name" in |
2368 | '') |
2369 | echo "Generating a list of signal names..." |
91407755 |
2370 | set X `cat /usr/include/signal.h /usr/include/sys/signal.h 2>&1 | awk ' |
2371 | $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ { |
2372 | sig[$3] = substr($2,4,20) |
2373 | if (max < $3 && $3 < 60) { |
2374 | max = $3 |
2375 | } |
2376 | } |
2377 | |
2378 | END { |
2379 | for (i=1; i<=max; i++) { |
2380 | if (sig[i] == "") |
2381 | printf "%d", i |
2382 | else |
2383 | printf "%s", sig[i] |
2384 | if (i < max) |
2385 | printf " " |
2386 | } |
2387 | printf "\n" |
2388 | } |
2389 | '` |
a687059c |
2390 | shift |
2391 | case $# in |
2392 | 0) echo 'kill -l' >/tmp/foo$$ |
91407755 |
2393 | set X `$csh -f </tmp/foo$$` |
a687059c |
2394 | shift |
2395 | case $# in |
2396 | 0)set HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM |
2397 | ;; |
8d063cd8 |
2398 | esac |
8d063cd8 |
2399 | ;; |
8d063cd8 |
2400 | esac |
a687059c |
2401 | sig_name="ZERO $*" |
8d063cd8 |
2402 | ;; |
2403 | esac |
a687059c |
2404 | echo "Signals are: $sig_name" |
8d063cd8 |
2405 | |
a687059c |
2406 | : see what type of char stdio uses. |
8d063cd8 |
2407 | echo " " |
449aadca |
2408 | if $contains 'unsigned.*char.*_ptr.*;' /usr/include/stdio.h >/dev/null 2>&1 ; then |
a687059c |
2409 | echo "Your stdio uses unsigned chars." |
2410 | stdchar="unsigned char" |
2411 | else |
2412 | echo "Your stdio uses signed chars." |
2413 | stdchar="char" |
2414 | fi |
8d063cd8 |
2415 | |
a687059c |
2416 | : see what type uids are declared as in the kernel |
2417 | case "$uidtype" in |
2418 | '') |
2419 | if $contains 'uid_t;' /usr/include/sys/types.h >/dev/null 2>&1 ; then |
2420 | dflt='uid_t'; |
8d063cd8 |
2421 | else |
a687059c |
2422 | set `grep '_ruid;' /usr/include/sys/user.h 2>/dev/null` unsigned short |
2423 | case $1 in |
2424 | unsigned) dflt="$1 $2" ;; |
2425 | *) dflt="$1" ;; |
2426 | esac |
8d063cd8 |
2427 | fi |
2428 | ;; |
a687059c |
2429 | *) dflt="$uidtype" |
2430 | ;; |
8d063cd8 |
2431 | esac |
a687059c |
2432 | cont=true |
8d063cd8 |
2433 | echo " " |
03a14243 |
2434 | rp="What type are user ids returned by getuid(), etc.? [$dflt]" |
8d063cd8 |
2435 | $echo $n "$rp $c" |
2436 | . myread |
a687059c |
2437 | uidtype="$ans" |
8d063cd8 |
2438 | |
a687059c |
2439 | : preserve RCS keywords in files with variable substitution, grrr |
2440 | Log='$Log' |
2441 | Header='$Header' |
2442 | |
2443 | |
a1cc2bdc |
2444 | : determine which malloc to compile in |
2445 | echo " " |
2446 | case "$usemymalloc" in |
2447 | '') |
2448 | if bsd || v7; then |
2449 | dflt='y' |
2450 | else |
2451 | dflt='n' |
2452 | fi |
2453 | ;; |
2454 | *) dflt="$usemymalloc" |
2455 | ;; |
2456 | esac |
2457 | rp="Do you wish to attempt to use the malloc that comes with $package? [$dflt]" |
2458 | $echo $n "$rp $c" |
2459 | . myread |
2460 | case "$ans" in |
2461 | '') ans=$dflt;; |
2462 | esac |
2463 | usemymalloc="$ans" |
2464 | case "$ans" in |
2465 | y*) mallocsrc='malloc.c'; mallocobj='malloc.o';; |
2466 | *) mallocsrc=''; mallocobj='';; |
2467 | esac |
2468 | |
d8f2e4cc |
2469 | : determine compiler compiler |
2470 | case "$yacc" in |
2471 | '') dflt=yacc;; |
2472 | *) dflt="$yacc";; |
2473 | esac |
2474 | cont=true |
2475 | echo " " |
449aadca |
2476 | rp="Which compiler compiler (yacc or bison -y) will you use? [$dflt]" |
d8f2e4cc |
2477 | $echo $n "$rp $c" |
2478 | . myread |
2479 | case "$ans" in |
2480 | '') ans="$dflt";; |
2481 | esac |
2482 | yacc="$ans" |
2483 | |
8d063cd8 |
2484 | echo " " |
2485 | echo "End of configuration questions." |
2486 | echo " " |
2487 | |
2488 | : create config.sh file |
2489 | echo " " |
2490 | if test -d ../UU; then |
2491 | cd .. |
2492 | fi |
2493 | echo "Creating config.sh..." |
2494 | $spitshell <<EOT >config.sh |
2495 | $startsh |
2496 | # config.sh |
2497 | # This file was produced by running the Configure script. |
2498 | |
2499 | d_eunice='$d_eunice' |
8d063cd8 |
2500 | define='$define' |
91407755 |
2501 | eunicefix='$eunicefix' |
8d063cd8 |
2502 | loclist='$loclist' |
2503 | expr='$expr' |
2504 | sed='$sed' |
2505 | echo='$echo' |
2506 | cat='$cat' |
2507 | rm='$rm' |
2508 | mv='$mv' |
2509 | cp='$cp' |
2510 | tail='$tail' |
2511 | tr='$tr' |
2512 | mkdir='$mkdir' |
2513 | sort='$sort' |
2514 | uniq='$uniq' |
2515 | grep='$grep' |
2516 | trylist='$trylist' |
2517 | test='$test' |
2518 | inews='$inews' |
2519 | egrep='$egrep' |
2520 | more='$more' |
2521 | pg='$pg' |
2522 | Mcc='$Mcc' |
2523 | vi='$vi' |
2524 | mailx='$mailx' |
2525 | mail='$mail' |
378cc40b |
2526 | cpp='$cpp' |
a687059c |
2527 | perl='$perl' |
2528 | emacs='$emacs' |
2529 | ls='$ls' |
2530 | rmail='$rmail' |
2531 | sendmail='$sendmail' |
2532 | shar='$shar' |
2533 | smail='$smail' |
2534 | tbl='$tbl' |
2535 | troff='$troff' |
2536 | nroff='$nroff' |
2537 | uname='$uname' |
2538 | uuname='$uuname' |
2539 | line='$line' |
2540 | chgrp='$chgrp' |
2541 | chmod='$chmod' |
2542 | lint='$lint' |
2543 | sleep='$sleep' |
2544 | pr='$pr' |
2545 | tar='$tar' |
2546 | ln='$ln' |
2547 | lpr='$lpr' |
2548 | lp='$lp' |
2549 | touch='$touch' |
2550 | make='$make' |
2551 | date='$date' |
91407755 |
2552 | csh='$csh' |
8d063cd8 |
2553 | Log='$Log' |
2554 | Header='$Header' |
2555 | bin='$bin' |
a687059c |
2556 | byteorder='$byteorder' |
8d063cd8 |
2557 | contains='$contains' |
378cc40b |
2558 | cppstdin='$cppstdin' |
36ce8bec |
2559 | cppminus='$cppminus' |
a687059c |
2560 | d_bcmp='$d_bcmp' |
135863df |
2561 | d_bcopy='$d_bcopy' |
0d3e774c |
2562 | d_bzero='$d_bzero' |
8d063cd8 |
2563 | d_charsprf='$d_charsprf' |
2e1b3b7e |
2564 | d_crypt='$d_crypt' |
a687059c |
2565 | cryptlib='$cryptlib' |
91407755 |
2566 | d_csh='$d_csh' |
13281fa4 |
2567 | d_dosuid='$d_dosuid' |
a687059c |
2568 | d_dup2='$d_dup2' |
378cc40b |
2569 | d_fchmod='$d_fchmod' |
2570 | d_fchown='$d_fchown' |
a687059c |
2571 | d_fcntl='$d_fcntl' |
2572 | d_flock='$d_flock' |
378cc40b |
2573 | d_getgrps='$d_getgrps' |
a687059c |
2574 | d_gethent='$d_gethent' |
2575 | d_getpgrp='$d_getpgrp' |
d8f2e4cc |
2576 | d_getpgrp2='$d_getpgrp2' |
a687059c |
2577 | d_getprior='$d_getprior' |
2578 | d_htonl='$d_htonl' |
8d063cd8 |
2579 | d_index='$d_index' |
a687059c |
2580 | d_ioctl='$d_ioctl' |
378cc40b |
2581 | d_killpg='$d_killpg' |
0d3e774c |
2582 | d_lstat='$d_lstat' |
a687059c |
2583 | d_memcmp='$d_memcmp' |
378cc40b |
2584 | d_memcpy='$d_memcpy' |
a687059c |
2585 | d_mkdir='$d_mkdir' |
2586 | d_ndbm='$d_ndbm' |
2587 | d_odbm='$d_odbm' |
2588 | d_readdir='$d_readdir' |
378cc40b |
2589 | d_rename='$d_rename' |
a687059c |
2590 | d_rmdir='$d_rmdir' |
378cc40b |
2591 | d_setegid='$d_setegid' |
2592 | d_seteuid='$d_seteuid' |
a687059c |
2593 | d_setpgrp='$d_setpgrp' |
d8f2e4cc |
2594 | d_setpgrp2='$d_setpgrp2' |
a687059c |
2595 | d_setprior='$d_setprior' |
2596 | d_setregid='$d_setregid' |
2597 | d_setresgid='$d_setresgid' |
2598 | d_setreuid='$d_setreuid' |
2599 | d_setresuid='$d_setresuid' |
378cc40b |
2600 | d_setrgid='$d_setrgid' |
2601 | d_setruid='$d_setruid' |
a687059c |
2602 | d_socket='$d_socket' |
2603 | d_sockpair='$d_sockpair' |
2604 | d_oldsock='$d_oldsock' |
2605 | socketlib='$socketlib' |
135863df |
2606 | d_statblks='$d_statblks' |
36ce8bec |
2607 | d_stdstdio='$d_stdstdio' |
8d063cd8 |
2608 | d_strctcpy='$d_strctcpy' |
d8f2e4cc |
2609 | d_strerror='$d_strerror' |
2e1b3b7e |
2610 | d_symlink='$d_symlink' |
a687059c |
2611 | d_syscall='$d_syscall' |
a687059c |
2612 | d_varargs='$d_varargs' |
8d063cd8 |
2613 | d_vfork='$d_vfork' |
36ce8bec |
2614 | d_voidsig='$d_voidsig' |
449aadca |
2615 | d_volatile='$d_volatile' |
a687059c |
2616 | d_vprintf='$d_vprintf' |
2617 | d_charvspr='$d_charvspr' |
91407755 |
2618 | d_wait4='$d_wait4' |
378cc40b |
2619 | gidtype='$gidtype' |
a687059c |
2620 | i_dirent='$i_dirent' |
2621 | d_dirnamlen='$d_dirnamlen' |
2622 | i_fcntl='$i_fcntl' |
2623 | i_grp='$i_grp' |
03a14243 |
2624 | i_niin='$i_niin' |
a687059c |
2625 | i_pwd='$i_pwd' |
2626 | d_pwquota='$d_pwquota' |
2627 | d_pwage='$d_pwage' |
91407755 |
2628 | d_pwchange='$d_pwchange' |
2629 | d_pwclass='$d_pwclass' |
2630 | d_pwexpire='$d_pwexpire' |
a687059c |
2631 | i_sysdir='$i_sysdir' |
2632 | i_sysioctl='$i_sysioctl' |
d8f2e4cc |
2633 | i_sysndir='$i_sysndir' |
2634 | i_time='$i_time' |
2635 | i_systime='$i_systime' |
2636 | d_systimekernel='$d_systimekernel' |
2637 | i_utime='$i_utime' |
a687059c |
2638 | i_varargs='$i_varargs' |
2639 | i_vfork='$i_vfork' |
2640 | intsize='$intsize' |
8d063cd8 |
2641 | libc='$libc' |
a1cc2bdc |
2642 | mallocsrc='$mallocsrc' |
2643 | mallocobj='$mallocobj' |
2644 | usemymalloc='$usemymalloc' |
8d063cd8 |
2645 | mansrc='$mansrc' |
2646 | manext='$manext' |
2647 | models='$models' |
2648 | split='$split' |
2649 | small='$small' |
2650 | medium='$medium' |
2651 | large='$large' |
2652 | huge='$huge' |
a687059c |
2653 | optimize='$optimize' |
8d063cd8 |
2654 | ccflags='$ccflags' |
91407755 |
2655 | cppflags='$cppflags' |
8d063cd8 |
2656 | ldflags='$ldflags' |
a687059c |
2657 | cc='$cc' |
2658 | libs='$libs' |
8d063cd8 |
2659 | n='$n' |
2660 | c='$c' |
2661 | package='$package' |
a687059c |
2662 | randbits='$randbits' |
2663 | sig_name='$sig_name' |
8d063cd8 |
2664 | spitshell='$spitshell' |
2665 | shsharp='$shsharp' |
2666 | sharpbang='$sharpbang' |
2667 | startsh='$startsh' |
36ce8bec |
2668 | stdchar='$stdchar' |
378cc40b |
2669 | uidtype='$uidtype' |
8d063cd8 |
2670 | voidflags='$voidflags' |
2671 | defvoidused='$defvoidused' |
d8f2e4cc |
2672 | yacc='$yacc' |
378cc40b |
2673 | privlib='$privlib' |
d8f2e4cc |
2674 | lib='$lib' |
8d063cd8 |
2675 | CONFIG=true |
2676 | EOT |
13281fa4 |
2677 | |
8d063cd8 |
2678 | CONFIG=true |
2679 | |
2680 | echo " " |
2681 | dflt='' |
378cc40b |
2682 | fastread='' |
8d063cd8 |
2683 | echo "If you didn't make any mistakes, then just type a carriage return here." |
2684 | rp="If you need to edit config.sh, do it as a shell escape here:" |
2685 | $echo $n "$rp $c" |
2686 | . UU/myread |
2687 | case "$ans" in |
2688 | '') ;; |
2689 | *) : in case they cannot read |
2690 | eval $ans;; |
2691 | esac |
d8f2e4cc |
2692 | : if this fails, just run all the .SH files by hand |
378cc40b |
2693 | . ./config.sh |
8d063cd8 |
2694 | |
2695 | echo " " |
2696 | echo "Doing variable substitutions on .SH files..." |
d96024cf |
2697 | set x `awk '{print $1}' <MANIFEST | $grep '\.SH'` |
36ce8bec |
2698 | shift |
2699 | case $# in |
2700 | 0) set x *.SH; shift;; |
2701 | esac |
2702 | if test ! -f $1; then |
2703 | shift |
2704 | fi |
8d063cd8 |
2705 | for file in $*; do |
2706 | case "$file" in |
2707 | */*) |
2708 | dir=`$expr X$file : 'X\(.*\)/'` |
2709 | file=`$expr X$file : 'X.*/\(.*\)'` |
2710 | (cd $dir && . $file) |
2711 | ;; |
2712 | *) |
2713 | . $file |
2714 | ;; |
2715 | esac |
2716 | done |
2717 | if test -f config.h.SH; then |
2718 | if test ! -f config.h; then |
2719 | : oops, they left it out of MANIFEST, probably, so do it anyway. |
2720 | . config.h.SH |
2721 | fi |
2722 | fi |
2723 | |
2724 | if $contains '^depend:' Makefile >/dev/null 2>&1; then |
2725 | dflt=n |
2726 | $cat <<EOM |
2727 | |
2728 | Now you need to generate make dependencies by running "make depend". |
2729 | You might prefer to run it in background: "make depend > makedepend.out &" |
2730 | It can take a while, so you might not want to run it right now. |
2731 | |
2732 | EOM |
2733 | rp="Run make depend now? [$dflt]" |
2734 | $echo $n "$rp $c" |
2735 | . UU/myread |
2736 | case "$ans" in |
a687059c |
2737 | y*) make depend && echo "Now you must run a make." |
8d063cd8 |
2738 | ;; |
2739 | *) echo "You must run 'make depend' then 'make'." |
2740 | ;; |
2741 | esac |
2742 | elif test -f Makefile; then |
2743 | echo " " |
2744 | echo "Now you must run a make." |
2745 | else |
2746 | echo "Done." |
2747 | fi |
2748 | |
2749 | $rm -f kit*isdone |
13281fa4 |
2750 | : the following is currently useless |
8d063cd8 |
2751 | cd UU && $rm -f $rmlist |
13281fa4 |
2752 | : since this removes it all anyway |
2753 | cd .. && $rm -rf UU |
8d063cd8 |
2754 | : end of Configure |