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