Commit | Line | Data |
---|---|---|
c58f7dd3 EA |
1 | #! /bin/sh |
2 | # | |
3 | # If these # comments don't work, trim them. Don't worry about any other | |
4 | # shell scripts, Configure will trim # comments from them for you. | |
5 | # | |
6 | # (If you are trying to port this package to a machine without sh, I would | |
7 | # suggest you cut out the prototypical config.h from the end of Configure | |
8 | # and edit it to reflect your system. Some packages may include samples | |
9 | # of config.h for certain machines, so you might look for one of those.) | |
10 | # | |
11 | # $RCSfile: Configure,v $$Revision: 4.0.1.9 $$Date: 92/06/23 12:28:33 $ | |
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 | cat >/tmp/c1$$ <<EOF | |
18 | ARGGGHHHH!!!!! | |
19 | ||
20 | Your csh still thinks true is false. Write to your vendor today and tell | |
21 | them that next year Configure ought to "rm /bin/csh" unless they fix their | |
22 | blasted shell. :-) | |
23 | ||
24 | [End of diatribe. We now return you to your regularly scheduled | |
25 | programming...] | |
26 | ||
27 | EOF | |
28 | cat >/tmp/c2$$ <<EOF | |
29 | OOPS! You naughty creature! You didn't run Configure with sh! | |
30 | I will attempt to remedy the situation by running sh for you... | |
31 | ||
32 | EOF | |
33 | ||
34 | true || cat /tmp/c1$$ /tmp/c2$$ | |
35 | true || exec sh $0 | |
36 | ||
37 | export PATH || cat /tmp/c2$$ | |
38 | export PATH || exec sh $0 | |
39 | rm -f /tmp/c1$$ /tmp/c2$$ | |
40 | ||
41 | PATH=".:$PATH:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc:/usr/new:/usr/new/bin:/usr/nbin" | |
42 | ||
43 | if test ! -t 0; then | |
44 | echo "Say 'sh Configure', not 'sh <Configure'" | |
45 | exit 1 | |
46 | fi | |
47 | ||
48 | (alias) >/dev/null 2>&1 && \ | |
49 | echo "(I see you are using the Korn shell. Some ksh's blow up on Configure," && \ | |
50 | echo "especially on exotic machines. If yours does, try the Bourne shell instead.)" | |
51 | ||
52 | unset CDPATH | |
53 | if test ! -d ../UU; then | |
54 | if test ! -d UU; then | |
55 | mkdir UU | |
56 | fi | |
57 | cd UU | |
58 | fi | |
59 | ||
60 | case "$1" in | |
61 | -d) shift; fastread='yes';; | |
62 | esac | |
63 | ||
64 | d_eunice='' | |
65 | define='' | |
66 | eunicefix='' | |
67 | loclist='' | |
68 | expr='' | |
69 | sed='' | |
70 | echo='' | |
71 | cat='' | |
72 | rm='' | |
73 | mv='' | |
74 | cp='' | |
75 | tail='' | |
76 | tr='' | |
77 | mkdir='' | |
78 | sort='' | |
79 | uniq='' | |
80 | grep='' | |
81 | trylist='' | |
82 | test='' | |
83 | inews='' | |
84 | egrep='' | |
85 | more='' | |
86 | pg='' | |
87 | Mcc='' | |
88 | vi='' | |
89 | mailx='' | |
90 | mail='' | |
91 | cpp='' | |
92 | perl='' | |
93 | emacs='' | |
94 | ls='' | |
95 | rmail='' | |
96 | sendmail='' | |
97 | shar='' | |
98 | smail='' | |
99 | tbl='' | |
100 | troff='' | |
101 | nroff='' | |
102 | uname='' | |
103 | uuname='' | |
104 | line='' | |
105 | chgrp='' | |
106 | chmod='' | |
107 | lint='' | |
108 | sleep='' | |
109 | pr='' | |
110 | tar='' | |
111 | ln='' | |
112 | lpr='' | |
113 | lp='' | |
114 | touch='' | |
115 | make='' | |
116 | date='' | |
117 | csh='' | |
118 | bash='' | |
119 | ksh='' | |
120 | lex='' | |
121 | flex='' | |
122 | bison='' | |
123 | Log='' | |
124 | Header='' | |
125 | Id='' | |
126 | lastuname='' | |
127 | alignbytes='' | |
128 | bin='' | |
129 | installbin='' | |
130 | byteorder='' | |
131 | contains='' | |
132 | cppstdin='' | |
133 | cppminus='' | |
134 | d_bcmp='' | |
135 | d_bcopy='' | |
136 | d_safebcpy='' | |
137 | d_bzero='' | |
138 | d_castneg='' | |
139 | castflags='' | |
140 | d_charsprf='' | |
141 | d_chsize='' | |
142 | d_crypt='' | |
143 | cryptlib='' | |
144 | d_csh='' | |
145 | d_dosuid='' | |
146 | d_dup2='' | |
147 | d_fchmod='' | |
148 | d_fchown='' | |
149 | d_fcntl='' | |
150 | d_flexfnam='' | |
151 | d_flock='' | |
152 | d_getgrps='' | |
153 | d_gethent='' | |
154 | d_getpgrp='' | |
155 | d_getpgrp2='' | |
156 | d_getprior='' | |
157 | d_htonl='' | |
158 | d_index='' | |
159 | d_isascii='' | |
160 | d_killpg='' | |
161 | d_lstat='' | |
162 | d_memcmp='' | |
163 | d_memcpy='' | |
164 | d_safemcpy='' | |
165 | d_memmove='' | |
166 | d_memset='' | |
167 | d_mkdir='' | |
168 | d_msg='' | |
169 | d_msgctl='' | |
170 | d_msgget='' | |
171 | d_msgrcv='' | |
172 | d_msgsnd='' | |
173 | d_ndbm='' | |
174 | d_odbm='' | |
175 | d_open3='' | |
176 | d_readdir='' | |
177 | d_rename='' | |
178 | d_rewindir='' | |
179 | d_rmdir='' | |
180 | d_seekdir='' | |
181 | d_select='' | |
182 | d_sem='' | |
183 | d_semctl='' | |
184 | d_semget='' | |
185 | d_semop='' | |
186 | d_setegid='' | |
187 | d_seteuid='' | |
188 | d_setpgrp='' | |
189 | d_setpgrp2='' | |
190 | d_setprior='' | |
191 | d_setregid='' | |
192 | d_setresgid='' | |
193 | d_setreuid='' | |
194 | d_setresuid='' | |
195 | d_setrgid='' | |
196 | d_setruid='' | |
197 | d_shm='' | |
198 | d_shmat='' | |
199 | d_voidshmat='' | |
200 | d_shmctl='' | |
201 | d_shmdt='' | |
202 | d_shmget='' | |
203 | d_socket='' | |
204 | d_sockpair='' | |
205 | d_oldsock='' | |
206 | socketlib='' | |
207 | d_statblks='' | |
208 | d_stdstdio='' | |
209 | d_strctcpy='' | |
210 | d_strerror='' | |
211 | d_symlink='' | |
212 | d_syscall='' | |
213 | d_telldir='' | |
214 | d_truncate='' | |
215 | d_vfork='' | |
216 | d_voidsig='' | |
217 | d_tosignal='' | |
218 | d_volatile='' | |
219 | d_vprintf='' | |
220 | d_charvspr='' | |
221 | d_wait4='' | |
222 | d_waitpid='' | |
223 | gidtype='' | |
224 | groupstype='' | |
225 | i_fcntl='' | |
226 | i_gdbm='' | |
227 | i_grp='' | |
228 | i_niin='' | |
229 | i_sysin='' | |
230 | i_pwd='' | |
231 | d_pwquota='' | |
232 | d_pwage='' | |
233 | d_pwchange='' | |
234 | d_pwclass='' | |
235 | d_pwexpire='' | |
236 | d_pwcomment='' | |
237 | i_sys_file='' | |
238 | i_sysioctl='' | |
239 | i_time='' | |
240 | i_sys_time='' | |
241 | i_sys_select='' | |
242 | d_systimekernel='' | |
243 | i_utime='' | |
244 | i_varargs='' | |
245 | i_vfork='' | |
246 | intsize='' | |
247 | libc='' | |
248 | nm_opts='' | |
249 | libndir='' | |
250 | i_my_dir='' | |
251 | i_ndir='' | |
252 | i_sys_ndir='' | |
253 | i_dirent='' | |
254 | i_sys_dir='' | |
255 | d_dirnamlen='' | |
256 | ndirc='' | |
257 | ndiro='' | |
258 | mallocsrc='' | |
259 | mallocobj='' | |
260 | d_mymalloc='' | |
261 | mallocptrtype='' | |
262 | mansrc='' | |
263 | manext='' | |
264 | models='' | |
265 | split='' | |
266 | small='' | |
267 | medium='' | |
268 | large='' | |
269 | huge='' | |
270 | optimize='' | |
271 | ccflags='' | |
272 | cppflags='' | |
273 | ldflags='' | |
274 | cc='' | |
275 | nativegcc='' | |
276 | libs='' | |
277 | n='' | |
278 | c='' | |
279 | package='' | |
280 | randbits='' | |
281 | scriptdir='' | |
282 | installscr='' | |
283 | sig_name='' | |
284 | spitshell='' | |
285 | shsharp='' | |
286 | sharpbang='' | |
287 | startsh='' | |
288 | stdchar='' | |
289 | uidtype='' | |
290 | usrinclude='' | |
291 | inclPath='' | |
292 | void='' | |
293 | voidhave='' | |
294 | voidwant='' | |
295 | w_localtim='' | |
296 | w_s_timevl='' | |
297 | w_s_tm='' | |
298 | yacc='' | |
299 | lib='' | |
300 | privlib='' | |
301 | installprivlib='' | |
302 | CONFIG='' | |
303 | : get the name of the package | |
304 | package=perl | |
305 | : Here we go... | |
306 | echo " " | |
307 | echo "Beginning of configuration questions for $package kit." | |
308 | : Eunice requires " " instead of "", can you believe it | |
309 | echo " " | |
310 | ||
311 | define='define' | |
312 | undef='undef' | |
313 | : change the next line if compiling for Xenix/286 on Xenix/386 | |
314 | xlibpth='/usr/lib/386 /lib/386' | |
315 | ||
316 | : the hints files may add more components to libpth | |
317 | test -d /usr/cs/lib && libpth="$libpth /usr/cs/lib" | |
318 | test -d /usr/ccs/lib && libpth="$libpth /usr/ccs/lib" | |
319 | test -d /usr/lib && libpth="$libpth /usr/lib" | |
320 | test -d /usr/ucblib && libpth="$libpth /usr/ucblib" | |
321 | test -d /usr/local/lib && libpth="$libpth /usr/local/lib" | |
322 | test -d /usr/lib/large && libpth="$libpth /usr/lib/large" | |
323 | test -d /lib && libpth="$libpth /lib" | |
324 | libpth="$libpth $xlibpth" | |
325 | test -d /lib/large && libpth="$libpth /lib/large" | |
326 | test -d /usr/lib/small && libpth="$libpth /usr/lib/small" | |
327 | test -d /lib/small && libpth="$libpth /lib/small" | |
328 | test -d /usr/lib/cmplrs/cc && libpth="$libpth /usr/lib/cmplrs/cc" | |
329 | ||
330 | smallmach='pdp11 i8086 z8000 i80286 iAPX286' | |
331 | trap 'echo " "; exit 1' 1 2 3 | |
332 | ||
333 | : We must find out about Eunice early | |
334 | eunicefix=':' | |
335 | if test -f /etc/unixtovms; then | |
336 | eunicefix=/etc/unixtovms | |
337 | fi | |
338 | if test -f /etc/unixtovms.exe; then | |
339 | eunicefix=/etc/unixtovms.exe | |
340 | fi | |
341 | ||
342 | attrlist="DGUX M_I186 M_I286 M_I386 M_I8086 M_XENIX UTS __DGUX__" | |
343 | attrlist="$attrlist __STDC__ __m88k__ ansi bsd4_2 gcos gimpel" | |
344 | attrlist="$attrlist hp9000s300 hp9000s500 hp9000s800 hpux" | |
345 | attrlist="$attrlist i186 i386 i8086 iAPX286 ibm interdata" | |
346 | attrlist="$attrlist m68k m88k mc300 mc500 mc68000 mc68k mc700 mert" | |
347 | attrlist="$attrlist ns16000 ns32000 nsc32000 os pdp11 posix pyr sinix" | |
348 | attrlist="$attrlist sparc sun tower tower32 tower32_600 tower32_800 tss" | |
349 | attrlist="$attrlist u3b2 u3b20 u3b200 u3b5 ultrix unix vax venix xenix" | |
350 | attrlist="$attrlist z8000" | |
351 | boPATH="" | |
352 | eoPATH="/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 /bsd43/usr/bin /usr/ccs/lib /opt/SUNWste/bin /usr/opt/SUNWste/bin" | |
353 | d_newshome="/usr/NeWS" | |
354 | errnolist=errnolist | |
355 | h_fcntl=false | |
356 | h_sys_file=false | |
357 | serve_shm="" | |
358 | serve_msg="$undef" | |
359 | serve_inet_udp="" | |
360 | serve_inet_tcp="" | |
361 | serve_unix_udp="" | |
362 | serve_unix_tcp="" | |
363 | d_ndir=ndir | |
364 | voidwant=1 | |
365 | voidwant=7 | |
366 | libswanted="c_s net_s net socket nsl_s nsl nm ndir dir ndbm dbm PW malloc sun m bsd BSD x posix ucb" | |
367 | inclwanted='/usr/include /usr/netinclude /usr/include/sun /usr/include/bsd /usr/include/lan /usr/ucbinclude' | |
368 | ||
369 | : Now test for existence of everything in MANIFEST | |
370 | ||
371 | echo "First let's make sure your kit is complete. Checking..." | |
372 | awk '$1 !~ /PACKINGLIST/ {print $1}' ../MANIFEST | split -100 | |
373 | rm -f missing | |
374 | for filelist in x??; do | |
375 | (cd ..; ls `cat UU/$filelist` >/dev/null 2>>UU/missing) | |
376 | done | |
377 | if test -s missing; then | |
378 | echo "WARNING: the following files are missing:" | |
379 | cat missing | |
380 | echo "INTERRUPT NOW, OR HIT RETURN TO PROCEED AT YOUR OWN RISK" | |
381 | read junk | |
382 | else | |
383 | echo "Looks good..." | |
384 | fi | |
385 | ||
386 | : some greps do not return status, grrr. | |
387 | echo "grimblepritz" >contains.txt | |
388 | if grep blurfldyick contains.txt >/dev/null 2>&1 ; then | |
389 | contains=contains | |
390 | elif grep grimblepritz contains.txt >/dev/null 2>&1 ; then | |
391 | contains=grep | |
392 | else | |
393 | contains=contains | |
394 | fi | |
395 | : the following should work in any shell | |
396 | case "$contains" in | |
397 | contains*) | |
398 | echo " " | |
399 | echo "AGH! Grep doesn't return a status. Attempting remedial action." | |
400 | cat >contains <<'EOSS' | |
401 | grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp | |
402 | EOSS | |
403 | chmod +x contains | |
404 | esac | |
405 | ||
406 | : see if sh knows # comments | |
407 | echo " " | |
408 | echo "Checking your sh to see if it knows about # comments..." | |
409 | if sh -c '#' >/dev/null 2>&1 ; then | |
410 | echo "Your sh handles # comments correctly." | |
411 | shsharp=true | |
412 | spitshell=cat | |
413 | echo " " | |
414 | echo "Okay, let's see if #! works on this system..." | |
415 | if test -f /bsd43/bin/echo; then | |
416 | echo "#!/bsd43/bin/echo hi" > spit.sh | |
417 | else | |
418 | echo "#!/bin/echo hi" > spit.sh | |
419 | fi | |
420 | $eunicefix spit.sh | |
421 | chmod +x spit.sh | |
422 | ./spit.sh > today | |
423 | if $contains hi today >/dev/null 2>&1; then | |
424 | echo "It does." | |
425 | sharpbang='#!' | |
426 | else | |
427 | echo "#! /bin/echo hi" > spit.sh | |
428 | $eunicefix spit.sh | |
429 | chmod +x spit.sh | |
430 | ./spit.sh > today | |
431 | if test -s today; then | |
432 | echo "It does." | |
433 | sharpbang='#! ' | |
434 | else | |
435 | echo "It doesn't." | |
436 | sharpbang=': use ' | |
437 | fi | |
438 | fi | |
439 | else | |
440 | echo "Your sh doesn't grok # comments--I will strip them later on." | |
441 | shsharp=false | |
442 | echo "exec grep -v '^#'" >spitshell | |
443 | chmod +x spitshell | |
444 | $eunicefix spitshell | |
445 | spitshell=`pwd`/spitshell | |
446 | echo "I presume that if # doesn't work, #! won't work either!" | |
447 | sharpbang=': use ' | |
448 | fi | |
449 | ||
450 | : figure out how to guarantee sh startup | |
451 | echo " " | |
452 | echo "Checking out how to guarantee sh startup..." | |
453 | startsh=$sharpbang'/bin/sh' | |
454 | echo "Let's see if '$startsh' works..." | |
455 | cat >start.sh <<EOSS | |
456 | $startsh | |
457 | set abc | |
458 | test "$?abc" != 1 | |
459 | EOSS | |
460 | ||
461 | chmod +x start.sh | |
462 | $eunicefix start.sh | |
463 | if ./start.sh; then | |
464 | echo "Yup, it does." | |
465 | else | |
466 | echo "Nope. You may have to fix up the shell scripts to make sure sh runs them." | |
467 | fi | |
468 | ||
469 | : first determine how to suppress newline on echo command | |
470 | echo "Checking echo to see how to suppress newlines..." | |
471 | (echo "hi there\c" ; echo " ") >echotmp | |
472 | if $contains c echotmp >/dev/null 2>&1 ; then | |
473 | echo "...using -n." | |
474 | n='-n' | |
475 | c='' | |
476 | else | |
477 | cat <<'EOM' | |
478 | ...using \c | |
479 | EOM | |
480 | n='' | |
481 | c='\c' | |
482 | fi | |
483 | echo $n "Type carriage return to continue. Your cursor should be here-->$c" | |
484 | read ans | |
485 | ||
486 | : now set up to do reads with possible shell escape and default assignment | |
487 | cat <<EOSC >myread | |
488 | case "\$fastread" in | |
489 | yes) ans=''; echo " " ;; | |
490 | *) ans='!';; | |
491 | esac | |
492 | while expr "X\$ans" : "X!" >/dev/null; do | |
493 | read ans | |
494 | case "\$ans" in | |
495 | !) | |
496 | sh | |
497 | echo " " | |
498 | echo $n "\$rp $c" | |
499 | ;; | |
500 | !*) | |
501 | set \`expr "X\$ans" : "X!\(.*\)\$"\` | |
502 | sh -c "\$*" | |
503 | echo " " | |
504 | echo $n "\$rp $c" | |
505 | ;; | |
506 | esac | |
507 | done | |
508 | rp='Your answer:' | |
509 | case "\$ans" in | |
510 | '') ans="\$dflt";; | |
511 | esac | |
512 | EOSC | |
513 | ||
514 | : general instructions | |
515 | cat <<EOH | |
516 | ||
517 | This installation shell script will examine your system and ask you questions | |
518 | to determine how the $package package should be installed. If you get stuck | |
519 | on a question, you may use a ! shell escape to start a subshell or execute | |
520 | a command. Many of the questions will have default answers in square | |
521 | brackets--typing carriage return will give you the default. | |
522 | ||
523 | On some of the questions which ask for file or directory names you are | |
524 | allowed to use the ~name construct to specify the login directory belonging | |
525 | to "name", even if you don't have a shell which knows about that. Questions | |
526 | where this is allowed will be marked "(~name ok)". | |
527 | ||
528 | EOH | |
529 | rp="[Type carriage return to continue]" | |
530 | echo $n "$rp $c" | |
531 | . myread | |
532 | cat <<EOH | |
533 | ||
534 | Much effort has been expended to ensure that this shell script will run on any | |
535 | Unix system. If despite that it blows up on you, your best bet is to edit | |
536 | Configure and run it again. Also, let me (lwall@netlabs.com) | |
537 | know how I blew it. If you can't run Configure for some reason, you'll have | |
538 | to generate a config.sh file by hand. | |
539 | ||
540 | This installation script affects things in two ways: 1) it may do direct | |
541 | variable substitutions on some of the files included in this kit, and | |
542 | 2) it builds a config.h file for inclusion in C programs. You may edit | |
543 | any of these files as the need arises after running this script. | |
544 | ||
545 | If you make a mistake on a question, there is no easy way to back up to it | |
546 | currently. The easiest thing to do is to edit config.sh and rerun all the | |
547 | SH files. Configure will offer to let you do this before it runs the SH files. | |
548 | ||
549 | EOH | |
550 | rp="[Type carriage return to continue]" | |
551 | echo $n "$rp $c" | |
552 | . myread | |
553 | ||
554 | : find out where common programs are | |
555 | echo " " | |
556 | echo "Locating common programs..." | |
557 | cat <<EOSC >loc | |
558 | $startsh | |
559 | case \$# in | |
560 | 0) exit 1;; | |
561 | esac | |
562 | thing=\$1 | |
563 | shift | |
564 | dflt=\$1 | |
565 | shift | |
566 | for dir in \$*; do | |
567 | case "\$thing" in | |
568 | .) | |
569 | if test -d \$dir/\$thing; then | |
570 | echo \$dir | |
571 | exit 0 | |
572 | fi | |
573 | ;; | |
574 | *) | |
575 | if test -f \$dir/\$thing; then | |
576 | echo \$dir/\$thing | |
577 | exit 0 | |
578 | elif test -f \$dir/\$thing.exe; then | |
579 | : on Eunice apparently | |
580 | echo \$dir/\$thing | |
581 | exit 0 | |
582 | fi | |
583 | ;; | |
584 | esac | |
585 | done | |
586 | echo \$dflt | |
587 | exit 1 | |
588 | EOSC | |
589 | chmod +x loc | |
590 | $eunicefix loc | |
591 | loclist=" | |
592 | cat | |
593 | cp | |
594 | echo | |
595 | expr | |
596 | grep | |
597 | mkdir | |
598 | mv | |
599 | rm | |
600 | sed | |
601 | sort | |
602 | tr | |
603 | uniq | |
604 | " | |
605 | trylist=" | |
606 | Mcc | |
607 | bison | |
608 | cpp | |
609 | csh | |
610 | egrep | |
611 | line | |
612 | nroff | |
613 | perl | |
614 | test | |
615 | uname | |
616 | yacc | |
617 | " | |
618 | pth=`echo :$boPATH:$PATH:$eoPATH: | sed -e 's/:/ /g'` | |
619 | for file in $loclist; do | |
620 | xxx=`./loc $file $file $pth` | |
621 | eval $file=$xxx | |
622 | eval _$file=$xxx | |
623 | case "$xxx" in | |
624 | /*) | |
625 | echo $file is in $xxx. | |
626 | ;; | |
627 | *) | |
628 | echo "I don't know where $file is. I hope it's in everyone's PATH." | |
629 | ;; | |
630 | esac | |
631 | done | |
632 | echo " " | |
633 | echo "Don't worry if any of the following aren't found..." | |
634 | ans=offhand | |
635 | for file in $trylist; do | |
636 | xxx=`./loc $file $file $pth` | |
637 | eval $file=$xxx | |
638 | eval _$file=$xxx | |
639 | case "$xxx" in | |
640 | /*) | |
641 | echo $file is in $xxx. | |
642 | ;; | |
643 | *) | |
644 | echo "I don't see $file out there, $ans." | |
645 | ans=either | |
646 | ;; | |
647 | esac | |
648 | done | |
649 | case "$egrep" in | |
650 | egrep) | |
651 | echo "Substituting grep for egrep." | |
652 | egrep=$grep | |
653 | ;; | |
654 | esac | |
655 | case "$test" in | |
656 | test) | |
657 | echo "Hopefully test is built into your sh." | |
658 | ;; | |
659 | /bin/test) | |
660 | if sh -c "PATH= test true" >/dev/null 2>&1; then | |
661 | echo "Using the test built into your sh." | |
662 | test=test | |
663 | fi | |
664 | ;; | |
665 | *) | |
666 | test=test | |
667 | ;; | |
668 | esac | |
669 | case "$echo" in | |
670 | echo) | |
671 | echo "Hopefully echo is built into your sh." | |
672 | ;; | |
673 | /bin/echo) | |
674 | echo " " | |
675 | echo "Checking compatibility between /bin/echo and builtin echo (if any)..." | |
676 | $echo $n "hi there$c" >Loc1.txt | |
677 | echo $n "hi there$c" >Loc2.txt | |
678 | if cmp Loc1.txt Loc2.txt >/dev/null 2>&1; then | |
679 | echo "They are compatible. In fact, they may be identical." | |
680 | else | |
681 | case "$n" in | |
682 | '-n') n='' c='\c' ans='\c' ;; | |
683 | *) n='-n' c='' ans='-n' ;; | |
684 | esac | |
685 | cat <<FOO | |
686 | They are not compatible! You are probably running ksh on a non-USG system. | |
687 | I'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't | |
688 | have echo built in and we may have to run some Bourne shell scripts. That | |
689 | means I'll have to use $ans to suppress newlines now. Life is ridiculous. | |
690 | ||
691 | FOO | |
692 | rp="Your cursor should be here-->" | |
693 | $echo $n "$rp$c" | |
694 | . myread | |
695 | fi | |
696 | ;; | |
697 | *) | |
698 | : cross your fingers | |
699 | echo=echo | |
700 | ;; | |
701 | esac | |
702 | ||
703 | : set up shell script to do ~ expansion | |
704 | cat >filexp <<EOSS | |
705 | $startsh | |
706 | : expand filename | |
707 | case "\$1" in | |
708 | ~/*|~) | |
709 | echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|" | |
710 | ;; | |
711 | ~*) | |
712 | if $test -f /bin/csh; then | |
713 | /bin/csh -f -c "glob \$1" | |
714 | echo "" | |
715 | else | |
716 | name=\`$expr x\$1 : '..\([^/]*\)'\` | |
717 | dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\` | |
718 | if $test ! -d "\$dir"; then | |
719 | me=\`basename \$0\` | |
720 | echo "\$me: can't locate home directory for: \$name" >&2 | |
721 | exit 1 | |
722 | fi | |
723 | case "\$1" in | |
724 | */*) | |
725 | echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\` | |
726 | ;; | |
727 | *) | |
728 | echo \$dir | |
729 | ;; | |
730 | esac | |
731 | fi | |
732 | ;; | |
733 | *) | |
734 | echo \$1 | |
735 | ;; | |
736 | esac | |
737 | EOSS | |
738 | chmod +x filexp | |
739 | $eunicefix filexp | |
740 | ||
741 | : get old answers, if there is a config file out there | |
742 | hint=default | |
743 | if test -f ../config.sh; then | |
744 | echo " " | |
745 | eval "`grep lastuname ../config.sh`" | |
746 | tmp=`(uname -a) 2>&1` | |
747 | if test "X$tmp" = "X$lastuname"; then | |
748 | dflt=y | |
749 | else | |
750 | dflt=n | |
751 | fi | |
752 | lastuname="$tmp" | |
753 | rp="I see a config.sh file. Did Configure make it on THIS system? [$dflt]" | |
754 | echo $n "$rp $c" | |
755 | . myread | |
756 | case "$ans" in | |
757 | n*) echo "OK, I'll ignore it."; mv ../config.sh ../config.sh.old;; | |
758 | *) echo "Fetching default answers from your old config.sh file..." | |
759 | tmp="$n" | |
760 | ans="$c" | |
761 | . ../config.sh | |
762 | n="$tmp" | |
763 | c="$ans" | |
764 | hint=previous | |
765 | ;; | |
766 | esac | |
767 | else | |
768 | lastuname=`(uname -a) 2>&1` | |
769 | fi | |
770 | if test -d ../hints && test ! -f ../config.sh; then | |
771 | echo ' ' | |
772 | echo "First time through, eh? I have some defaults handy for the following systems:" | |
773 | (cd ../hints; ls -C *.sh | sed 's/\.sh/ /g') | |
774 | dflt='' | |
775 | : Half the following guesses are probably wrong... | |
776 | test -f /irix && dflt="$dflt sgi" | |
777 | test -f /xenix && dflt="$dflt sco_xenix" | |
778 | test -f /dynix && dflt="$dflt dynix" | |
779 | test -f /dnix && dflt="$dflt dnix" | |
780 | test -f /bin/mips && /bin/mips && dflt="$dflt mips" | |
781 | test -d /NextApps && test -f /usr/adm/software_version && dflt="$dflt next" | |
782 | if test -f /bin/uname || test -f /usr/bin/uname; then | |
783 | set `uname -a | tr '[A-Z]' '[a-z]'` | |
784 | ||
785 | test -f "../hints/$5.sh" && dflt="$dflt $5" | |
786 | ||
787 | case "$5" in | |
788 | 3b2) dflt="$dflt 3b2";; | |
789 | fps*) dflt="$dflt fps";; | |
790 | mips*) dflt="$dflt mips";; | |
791 | [23]100) dflt="$dflt mips";; | |
792 | next*) dflt="$dflt next" ;; | |
793 | 6000) dflt="$dflt mc6000";; | |
794 | esac | |
795 | ||
796 | test -f "../hints/$1.sh" && dflt="$dflt $1" | |
797 | ||
798 | case "$1" in | |
799 | aix) dflt="$dflt aix_rs" ;; | |
800 | sunos) case "$3" in | |
801 | 3.4) dflt="$dflt sunos_3_4" ;; | |
802 | 3.5) dflt="$dflt sunos_3_5" ;; | |
803 | 4.0.1) dflt="$dflt sunos_4_0_1" ;; | |
804 | 4.0.2) dflt="$dflt sunos_4_0_2" ;; | |
805 | esac | |
806 | ;; | |
807 | hp*ux) dflt="$dflt hpux" | |
808 | extra_hints="hp"`echo $5 | sed -e s#/#_#g -e s/..$/00/` | |
809 | if test -f ../hints/$extra_hints.sh; then | |
810 | dflt="$dflt $extra_hints" | |
811 | fi;; | |
812 | irix) dflt="$dflt sgi" ;; | |
813 | ultrix) case "$3" in | |
814 | 1*) dflt="$dflt ultrix_1" ;; | |
815 | 3*) dflt="$dflt ultrix_3" ;; | |
816 | 4*) dflt="$dflt ultrix_4" ;; | |
817 | esac | |
818 | ;; | |
819 | uts) dflt="$dflt uts" ;; | |
820 | $2) if test -f /etc/systemid; then | |
821 | set `echo $3 | sed 's/\./ /'` $4 | |
822 | if test -f ../hints/sco_$1_$2_$3.sh; then | |
823 | dflt="$dflt sco_$1_$2_$3" | |
824 | elif test -f ../hints/sco_$1_$2.sh; then | |
825 | dflt="$dflt sco_$1_$2" | |
826 | elif test -f ../hints/sco_$1.sh; then | |
827 | dflt="$dflt sco_$1" | |
828 | fi | |
829 | fi | |
830 | ;; | |
831 | esac | |
832 | fi | |
833 | set X `echo $dflt | tr ' ' '\012' | sort | uniq` | |
834 | shift | |
835 | dflt=${1+"$@"} | |
836 | case "$dflt" in | |
837 | '') dflt=none;; | |
838 | esac | |
839 | echo '(You may give one or more space-separated answers, or "none" if appropriate.' | |
840 | echo 'If your OS version has no hints, do not give a wrong version--say "none".)' | |
841 | rp="Which of these apply, if any? [$dflt]" | |
842 | echo $n "$rp $c" | |
843 | . myread | |
844 | for file in $ans; do | |
845 | if test -f ../hints/$file.sh; then | |
846 | . ../hints/$file.sh | |
847 | cat ../hints/$file.sh >>../config.sh | |
848 | hint=recommended | |
849 | fi | |
850 | done | |
851 | fi | |
852 | ||
853 | cat >whoa <<'EOF' | |
854 | eval "was=\$$2" | |
855 | dflt=y | |
856 | echo ' ' | |
857 | echo "*** WHOA THERE!!! ***" | |
858 | echo " The $hint value for \$$2 on this machine was \"$was\"!" | |
859 | rp=" Keep the $hint value? [y]" | |
860 | echo $n "$rp $c" | |
861 | . myread | |
862 | case "$ans" in | |
863 | y) td=$was; tu=$was;; | |
864 | esac | |
865 | EOF | |
866 | ||
867 | setvar='td=$define; tu=$undef; set X $1; eval "was=\$$2"; | |
868 | case "$val$was" in | |
869 | defineundef) . whoa; eval "$2=\$td";; | |
870 | undefdefine) . whoa; eval "$2=\$tu";; | |
871 | *) eval "$2=$val";; | |
872 | esac' | |
873 | ||
874 | : determine where manual pages go | |
875 | $cat <<EOM | |
876 | ||
877 | $package has manual pages available in source form. | |
878 | EOM | |
879 | case "$nroff" in | |
880 | 'nroff') | |
881 | echo "However, you don't have nroff, so they're probably useless to you." | |
882 | case "$mansrc" in | |
883 | '') | |
884 | mansrc="none" | |
885 | ;; | |
886 | esac | |
887 | esac | |
888 | echo "If you don't want the manual sources installed, answer 'none'." | |
889 | case "$mansrc" in | |
890 | '') | |
891 | dflt=`./loc . none /usr/man/local/man1 /usr/man/man.L /usr/man/manl /usr/man/mann /usr/man/u_man/man1 /usr/man/man1 /usr/local/man/man1` | |
892 | ;; | |
893 | *) dflt="$mansrc" | |
894 | ;; | |
895 | esac | |
896 | cont=true | |
897 | while $test "$cont" ; do | |
898 | echo " " | |
899 | rp="Where do the manual pages (source) go (~name ok)? [$dflt]" | |
900 | $echo $n "$rp $c" | |
901 | . myread | |
902 | case "$ans" in | |
903 | 'none') | |
904 | mansrc='' | |
905 | cont='' | |
906 | ;; | |
907 | *) | |
908 | mansrc=`./filexp "$ans"` | |
909 | if $test -d "$mansrc"; then | |
910 | cont='' | |
911 | else | |
912 | if $test "$fastread" = yes; then | |
913 | dflt=y | |
914 | else | |
915 | dflt=n | |
916 | fi | |
917 | rp="Directory $mansrc doesn't exist. Use that name anyway? [$dflt]" | |
918 | $echo $n "$rp $c" | |
919 | . myread | |
920 | dflt='' | |
921 | case "$ans" in | |
922 | y*) cont='';; | |
923 | esac | |
924 | fi | |
925 | ;; | |
926 | esac | |
927 | done | |
928 | case "$mansrc" in | |
929 | '') | |
930 | manext='' | |
931 | ;; | |
932 | *l) | |
933 | manext=l | |
934 | ;; | |
935 | *n) | |
936 | manext=n | |
937 | ;; | |
938 | *o) | |
939 | manext=l | |
940 | ;; | |
941 | *p) | |
942 | manext=n | |
943 | ;; | |
944 | *C) | |
945 | manext=C | |
946 | ;; | |
947 | *L) | |
948 | manext=L | |
949 | ;; | |
950 | *) | |
951 | manext=1 | |
952 | ;; | |
953 | esac | |
954 | ||
955 | : Sigh. Well, at least the box is fast... | |
956 | echo " " | |
957 | $echo $n "Hmm... $c" | |
958 | case "$usrinclude" in | |
959 | '') dflt='/usr/include';; | |
960 | *) dflt=$usrinclude;; | |
961 | esac | |
962 | inclPath='' | |
963 | if $test -f /bin/mips && /bin/mips; then | |
964 | echo "Looks like a MIPS system..." | |
965 | $cat >usrinclude.c <<'EOCP' | |
966 | #ifdef SYSTYPE_BSD43 | |
967 | /bsd43 | |
968 | #endif | |
969 | EOCP | |
970 | if cc -E usrinclude.c > usrinclude.out && $contains / usrinclude.out >/dev/null 2>&1 ; then | |
971 | echo "and you're compiling with the BSD43 compiler and libraries." | |
972 | dflt='/bsd43/usr/include' | |
973 | inclPath='/bsd43' | |
974 | else | |
975 | echo "and you're compiling with the SysV compiler and libraries." | |
976 | fi | |
977 | else | |
978 | echo "Doesn't look like a MIPS system." | |
979 | echo "exit 1" >mips | |
980 | chmod +x mips | |
981 | $eunicefix mips | |
982 | fi | |
983 | ||
984 | cont=true | |
985 | while $test "$cont" ; do | |
986 | echo " " | |
987 | rp="Where are the include files you want to use? [$dflt]" | |
988 | $echo $n "$rp $c" | |
989 | . myread | |
990 | usrinclude="$ans" | |
991 | if $test -d $ans; then | |
992 | cont='' | |
993 | else | |
994 | if $test "$fastread" = yes; then | |
995 | dflt=y | |
996 | else | |
997 | dflt=n | |
998 | fi | |
999 | rp="Directory $ans doesn't exist. Use that name anyway? [$dflt]" | |
1000 | $echo $n "$rp $c" | |
1001 | . myread | |
1002 | dflt='' | |
1003 | case "$ans" in | |
1004 | y*) cont='';; | |
1005 | esac | |
1006 | fi | |
1007 | done | |
1008 | ||
1009 | : make some quick guesses about what we are up against | |
1010 | echo " " | |
1011 | echo exit 1 >bsd | |
1012 | echo exit 1 >usg | |
1013 | echo exit 1 >v7 | |
1014 | echo exit 1 >osf1 | |
1015 | echo exit 1 >eunice | |
1016 | echo exit 1 >xenix | |
1017 | echo exit 1 >venix | |
1018 | cat $usrinclude/signal.h $usrinclude/sys/signal.h >guess.txt 2>/dev/null | |
1019 | if test "$usrinclude" = "/bsd43/usr/include" ; then | |
1020 | echo "Looks kind of like a SysV MIPS running BSD, but we'll see..." | |
1021 | echo exit 0 >bsd | |
1022 | elif test -f /osf_boot || $contains "OSF/1" /usr/include/ctype.h; then | |
1023 | echo "Looks like an OSF/1 system, but we'll see..." | |
1024 | echo exit 0 >osf1 | |
1025 | elif test `echo abc | tr a-z A-Z` = Abc ; then | |
1026 | echo "Looks kind of like a USG system, but we'll see..." | |
1027 | echo exit 0 >usg | |
1028 | elif $contains SIGTSTP guess.txt >/dev/null 2>&1 ; then | |
1029 | echo "Looks kind of like a BSD system, but we'll see..." | |
1030 | echo exit 0 >bsd | |
1031 | else | |
1032 | echo "Looks kind of like a version 7 system, but we'll see..." | |
1033 | echo exit 0 >v7 | |
1034 | fi | |
1035 | case "$eunicefix" in | |
1036 | *unixtovms*) | |
1037 | cat <<'EOI' | |
1038 | There is, however, a strange, musty smell in the air that reminds me of | |
1039 | something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit. | |
1040 | EOI | |
1041 | echo "exit 0" >eunice | |
1042 | d_eunice="$define" | |
1043 | ;; | |
1044 | *) | |
1045 | echo " " | |
1046 | echo "Congratulations. You aren't running Eunice." | |
1047 | d_eunice="$undef" | |
1048 | ;; | |
1049 | esac | |
1050 | if test -f /xenix; then | |
1051 | echo "Actually, this looks more like a XENIX system..." | |
1052 | echo "exit 0" >xenix | |
1053 | else | |
1054 | echo " " | |
1055 | echo "It's not Xenix..." | |
1056 | fi | |
1057 | chmod +x xenix | |
1058 | $eunicefix xenix | |
1059 | if test -f /venix; then | |
1060 | echo "Actually, this looks more like a VENIX system..." | |
1061 | echo "exit 0" >venix | |
1062 | else | |
1063 | echo " " | |
1064 | if xenix; then | |
1065 | : null | |
1066 | else | |
1067 | echo "Nor is it Venix..." | |
1068 | fi | |
1069 | fi | |
1070 | chmod +x bsd usg v7 osf1 eunice venix | |
1071 | $eunicefix bsd usg v7 eunice venix | |
1072 | ||
1073 | : see what memory models we can support | |
1074 | case "$models" in | |
1075 | '') | |
1076 | : We may not use Cppsym or we get a circular dependency through cc. | |
1077 | : But this should work regardless of which cc we eventually use. | |
1078 | cat >pdp11.c <<'EOP' | |
1079 | main() { | |
1080 | #ifdef pdp11 | |
1081 | exit(0); | |
1082 | #else | |
1083 | exit(1); | |
1084 | #endif | |
1085 | } | |
1086 | EOP | |
1087 | cc -o pdp11 pdp11.c >/dev/null 2>&1 | |
1088 | if pdp11 2>/dev/null; then | |
1089 | dflt='unsplit split' | |
1090 | else | |
1091 | ans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge` | |
1092 | case "$ans" in | |
1093 | X) dflt='none';; | |
1094 | *) if $test -d /lib/small || $test -d /usr/lib/small; then | |
1095 | dflt='small' | |
1096 | else | |
1097 | dflt='' | |
1098 | fi | |
1099 | if $test -d /lib/medium || $test -d /usr/lib/medium; then | |
1100 | dflt="$dflt medium" | |
1101 | fi | |
1102 | if $test -d /lib/large || $test -d /usr/lib/large; then | |
1103 | dflt="$dflt large" | |
1104 | fi | |
1105 | if $test -d /lib/huge || $test -d /usr/lib/huge; then | |
1106 | dflt="$dflt huge" | |
1107 | fi | |
1108 | esac | |
1109 | fi | |
1110 | ;; | |
1111 | *) dflt="$models" ;; | |
1112 | esac | |
1113 | $cat <<EOM | |
1114 | ||
1115 | Some systems have different model sizes. On most systems they are called | |
1116 | small, medium, large, and huge. On the PDP11 they are called unsplit and | |
1117 | split. If your system doesn't support different memory models, say "none". | |
1118 | If you wish to force everything to one memory model, say "none" here and | |
1119 | put the appropriate flags later when it asks you for other cc and ld flags. | |
1120 | Venix systems may wish to put "none" and let the compiler figure things out. | |
1121 | (In the following question multiple model names should be space separated.) | |
1122 | ||
1123 | EOM | |
1124 | rp="Which models are supported? [$dflt]" | |
1125 | $echo $n "$rp $c" | |
1126 | . myread | |
1127 | models="$ans" | |
1128 | ||
1129 | case "$models" in | |
1130 | none) | |
1131 | small='' | |
1132 | medium='' | |
1133 | large='' | |
1134 | huge='' | |
1135 | unsplit='' | |
1136 | split='' | |
1137 | ;; | |
1138 | *split) | |
1139 | case "$split" in | |
1140 | '') | |
1141 | if $contains '\-i' $mansrc/man1/ld.1 >/dev/null 2>&1 || \ | |
1142 | $contains '\-i' $mansrc/man1/cc.1 >/dev/null 2>&1; then | |
1143 | dflt='-i' | |
1144 | else | |
1145 | dflt='none' | |
1146 | fi | |
1147 | ;; | |
1148 | *) dflt="$split";; | |
1149 | esac | |
1150 | rp="What flag indicates separate I and D space? [$dflt]" | |
1151 | $echo $n "$rp $c" | |
1152 | . myread | |
1153 | case "$ans" in | |
1154 | none) ans='';; | |
1155 | esac | |
1156 | split="$ans" | |
1157 | unsplit='' | |
1158 | ;; | |
1159 | *large*|*small*|*medium*|*huge*) | |
1160 | case "$models" in | |
1161 | *large*) | |
1162 | case "$large" in | |
1163 | '') dflt='-Ml';; | |
1164 | *) dflt="$large";; | |
1165 | esac | |
1166 | rp="What flag indicates large model? [$dflt]" | |
1167 | $echo $n "$rp $c" | |
1168 | . myread | |
1169 | case "$ans" in | |
1170 | none) ans=''; | |
1171 | esac | |
1172 | large="$ans" | |
1173 | ;; | |
1174 | *) large='';; | |
1175 | esac | |
1176 | case "$models" in | |
1177 | *huge*) | |
1178 | case "$huge" in | |
1179 | '') dflt='-Mh';; | |
1180 | *) dflt="$huge";; | |
1181 | esac | |
1182 | rp="What flag indicates huge model? [$dflt]" | |
1183 | $echo $n "$rp $c" | |
1184 | . myread | |
1185 | case "$ans" in | |
1186 | none) ans=''; | |
1187 | esac | |
1188 | huge="$ans" | |
1189 | ;; | |
1190 | *) huge="$large";; | |
1191 | esac | |
1192 | case "$models" in | |
1193 | *medium*) | |
1194 | case "$medium" in | |
1195 | '') dflt='-Mm';; | |
1196 | *) dflt="$medium";; | |
1197 | esac | |
1198 | rp="What flag indicates medium model? [$dflt]" | |
1199 | $echo $n "$rp $c" | |
1200 | . myread | |
1201 | case "$ans" in | |
1202 | none) ans=''; | |
1203 | esac | |
1204 | medium="$ans" | |
1205 | ;; | |
1206 | *) medium="$large";; | |
1207 | esac | |
1208 | case "$models" in | |
1209 | *small*) | |
1210 | case "$small" in | |
1211 | '') dflt='none';; | |
1212 | *) dflt="$small";; | |
1213 | esac | |
1214 | rp="What flag indicates small model? [$dflt]" | |
1215 | $echo $n "$rp $c" | |
1216 | . myread | |
1217 | case "$ans" in | |
1218 | none) ans=''; | |
1219 | esac | |
1220 | small="$ans" | |
1221 | ;; | |
1222 | *) small='';; | |
1223 | esac | |
1224 | ;; | |
1225 | *) | |
1226 | echo "Unrecognized memory models--you may have to edit Makefile.SH" | |
1227 | ;; | |
1228 | esac | |
1229 | ||
1230 | : see if we need a special compiler | |
1231 | echo " " | |
1232 | if usg; then | |
1233 | case "$cc" in | |
1234 | '') | |
1235 | case "$Mcc" in | |
1236 | /*) dflt='Mcc' | |
1237 | ;; | |
1238 | *) | |
1239 | case "$large" in | |
1240 | -M*) | |
1241 | dflt='cc' | |
1242 | ;; | |
1243 | *) | |
1244 | if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then | |
1245 | dflt='cc -M' | |
1246 | else | |
1247 | dflt='cc' | |
1248 | fi | |
1249 | ;; | |
1250 | esac | |
1251 | ;; | |
1252 | esac | |
1253 | ;; | |
1254 | *) dflt="$cc";; | |
1255 | esac | |
1256 | $cat <<'EOM' | |
1257 | ||
1258 | On some systems the default C compiler will not resolve multiple global | |
1259 | references that happen to have the same name. On some such systems the | |
1260 | "Mcc" command may be used to force these to be resolved. On other systems | |
1261 | a "cc -M" command is required. (Note that the -M flag on other systems | |
1262 | indicates a memory model to use!) If you have the Gnu C compiler, you | |
1263 | might wish to use that instead. What command will force resolution on | |
1264 | EOM | |
1265 | $echo $n "this system? [$dflt] $c" | |
1266 | rp="Command to resolve multiple refs? [$dflt]" | |
1267 | . myread | |
1268 | cc="$ans" | |
1269 | else | |
1270 | case "$cc" in | |
1271 | '') dflt=cc;; | |
1272 | *) dflt="$cc";; | |
1273 | esac | |
1274 | rp="Use which C compiler? [$dflt]" | |
1275 | $echo $n "$rp $c" | |
1276 | . myread | |
1277 | cc="$ans" | |
1278 | fi | |
1279 | case "$cc" in | |
1280 | *gcc*) cpp=`./loc gcc-cpp $cpp $pth` | |
1281 | case "$nativegcc" in | |
1282 | '') case "$ccflags" in | |
1283 | *-fpcc-struct-return*) dflt=n;; | |
1284 | *) dflt=y;; | |
1285 | esac | |
1286 | ;; | |
1287 | undef) dflt=n;; | |
1288 | *) dflt=y;; | |
1289 | esac | |
1290 | echo " " | |
1291 | rp="Are your system (especially dbm) libraries compiled with gcc? [$dflt]" | |
1292 | $echo $n "$rp $c" | |
1293 | . myread | |
1294 | case "$ans" in | |
1295 | n*) nativegcc="$undef"; gccflags='-fpcc-struct-return';; | |
1296 | *) nativegcc="$define"; gccflags='';; | |
1297 | esac | |
1298 | case "$gccflags" in | |
1299 | *-ansi*) ;; | |
1300 | *-traditional*) ;; | |
1301 | *) gccflags="$gccflags -traditional -Dvolatile=__volatile__" ;; | |
1302 | esac | |
1303 | ;; | |
1304 | esac | |
1305 | ||
1306 | : determine optimize, if desired, or use for debug flag also | |
1307 | case "$optimize" in | |
1308 | ' ') dflt="none" | |
1309 | ;; | |
1310 | '') dflt="-O"; | |
1311 | ;; | |
1312 | *) dflt="$optimize" | |
1313 | ;; | |
1314 | esac | |
1315 | cat <<EOH | |
1316 | ||
1317 | Some C compilers have problems with their optimizers, by default, $package | |
1318 | compiles with the -O flag to use the optimizer. Alternately, you might | |
1319 | want to use the symbolic debugger, which uses the -g flag (on traditional | |
1320 | Unix systems). Either flag can be specified here. To use neither flag, | |
1321 | specify the word "none". | |
1322 | ||
1323 | EOH | |
1324 | rp="What optimizer/debugger flag should be used? [$dflt]" | |
1325 | $echo $n "$rp $c" | |
1326 | . myread | |
1327 | optimize="$ans" | |
1328 | case "$optimize" in | |
1329 | 'none') optimize=" " | |
1330 | ;; | |
1331 | esac | |
1332 | ||
1333 | case "$ccflags" in | |
1334 | '') case "$cc" in | |
1335 | *gcc*) dflt="$gccflags";; | |
1336 | *) dflt='';; | |
1337 | esac | |
1338 | ;; | |
1339 | *-fpcc-struct-return*) dflt="$ccflags";; | |
1340 | *) case "$cc" in | |
1341 | *gcc*) dflt="$ccflags $gccflags";; | |
1342 | *) dflt="$ccflags";; | |
1343 | esac | |
1344 | ;; | |
1345 | esac | |
1346 | for thisincl in $inclwanted; do | |
1347 | if test -d $thisincl; then | |
1348 | if test "x$thisincl" != "x$usrinclude"; then | |
1349 | case "$dflt" in | |
1350 | *$thisincl*);; | |
1351 | *) dflt="$dflt -I$thisincl";; | |
1352 | esac | |
1353 | fi | |
1354 | fi | |
1355 | done | |
1356 | case "$optimize" in | |
1357 | -g*) | |
1358 | case "$dflt" in | |
1359 | *DEBUGGING*);; | |
1360 | *) dflt="$dflt -DDEBUGGING";; | |
1361 | esac | |
1362 | ;; | |
1363 | esac | |
1364 | if $contains 'LANGUAGE_C' $usrinclude/signal.h >/dev/null 2>&1; then | |
1365 | case "$dflt" in | |
1366 | *LANGUAGE_C*);; | |
1367 | *) dflt="$dflt -DLANGUAGE_C";; | |
1368 | *) if osf1; then | |
1369 | dflt="$dflt -D__LANGUAGE_C__" | |
1370 | else | |
1371 | dflt="$dflt -DLANGUAGE_C" | |
1372 | fi | |
1373 | ;; | |
1374 | esac | |
1375 | fi | |
1376 | if $contains '_NO_PROTO' $usrinclude/signal.h >/dev/null 2>&1; then | |
1377 | case "$dflt" in | |
1378 | *_NO_PROTO*);; | |
1379 | *) osf1 || dflt="$dflt -D_NO_PROTO";; | |
1380 | esac | |
1381 | fi | |
1382 | case "$dflt" in | |
1383 | '') dflt=none;; | |
1384 | esac | |
1385 | cat <<EOH | |
1386 | ||
1387 | Your C compiler may want other flags. For this question you should | |
1388 | include -I/whatever and -DWHATEVER flags and any other flags used by | |
1389 | the C compiler, but you should NOT include libraries or ld flags like | |
1390 | -lwhatever. For instance, this would be a good place to specify | |
1391 | -DDEBUGGING. To use no flags, specify the word "none". | |
1392 | ||
1393 | EOH | |
1394 | rp="Any additional cc flags? [$dflt]" | |
1395 | $echo $n "$rp $c" | |
1396 | . myread | |
1397 | case "$ans" in | |
1398 | none) ans=''; | |
1399 | esac | |
1400 | ccflags="$ans" | |
1401 | ||
1402 | : the following weeds options from ccflags that are of no interest to cpp | |
1403 | cppflags="$ccflags" | |
1404 | case "$cc" in | |
1405 | *gcc*) cppflags="$cppflags -D__GNUC__";; | |
1406 | esac | |
1407 | case "$cppflags" in | |
1408 | '');; | |
1409 | *) set X $cppflags | |
1410 | cppflags='' | |
1411 | for flag do | |
1412 | case $flag in | |
1413 | -D*|-U*|-I*|-traditional|-ansi|-nostdinc) cppflags="$cppflags $flag";; | |
1414 | esac | |
1415 | done | |
1416 | case "$cppflags" in | |
1417 | *-*) echo "(C preprocessor flags: $cppflags)";; | |
1418 | esac | |
1419 | ;; | |
1420 | esac | |
1421 | ||
1422 | case "$ldflags" in | |
1423 | '') if venix; then | |
1424 | dflt='-i -z' | |
1425 | else | |
1426 | dflt='none' | |
1427 | fi | |
1428 | ;; | |
1429 | *) dflt="$ldflags";; | |
1430 | esac | |
1431 | echo " " | |
1432 | rp="Any additional ld flags (NOT including libraries)? [$dflt]" | |
1433 | $echo $n "$rp $c" | |
1434 | . myread | |
1435 | case "$ans" in | |
1436 | none) ans=''; | |
1437 | esac | |
1438 | ldflags="$ans" | |
1439 | ||
1440 | echo " " | |
1441 | echo "Checking for optional libraries..." | |
1442 | case "$libs" in | |
1443 | '') dflt=' ';; | |
1444 | *) dflt="$libs ";; | |
1445 | esac | |
1446 | case "$libswanted" in | |
1447 | '') libswanted='c_s';; | |
1448 | esac | |
1449 | for thislib in $libswanted; do | |
1450 | case "$thislib" in | |
1451 | dbm) thatlib=ndbm;; | |
1452 | *_s) thatlib=NONE;; | |
1453 | *) thatlib="${thislib}_s";; | |
1454 | *) thatlib=NONE;; | |
1455 | esac | |
1456 | xxx=`./loc lib$thislib.a X /usr/ccs/lib /usr/lib /usr/ucblib /usr/local/lib /lib` | |
1457 | if test -f $xxx; then | |
1458 | echo "Found -l$thislib." | |
1459 | case "$dflt" in | |
1460 | *-l$thislib\ *|*-l$thatlib\ *);; | |
1461 | *) dflt="$dflt -l$thislib ";; | |
1462 | esac | |
1463 | else | |
1464 | xxx=`./loc lib$thislib.a X $libpth` | |
1465 | if test -f $xxx; then | |
1466 | echo "Found $xxx." | |
1467 | case "$dflt" in | |
1468 | *"$xxx "*);; | |
1469 | *) dflt="$dflt $xxx ";; | |
1470 | esac | |
1471 | else | |
1472 | xxx=`./loc Slib$thislib.a X $xlibpth` | |
1473 | if test -f $xxx; then | |
1474 | echo "Found -l$thislib." | |
1475 | case "$dflt" in | |
1476 | *-l$thislib\ *|*-l$thatlib\ *);; | |
1477 | *) dflt="$dflt -l$thislib ";; | |
1478 | esac | |
1479 | else | |
1480 | xxx=`./loc lib$thislib.so X /usr/ccs/lib /usr/lib /usr/ucblib /usr/local/lib /lib` | |
1481 | if test -f $xxx; then | |
1482 | echo "Found -l$thislib as a shared object only." | |
1483 | case "$dflt" in | |
1484 | *-l$thislib\ *|*-l$thatlib\ *);; | |
1485 | *) dflt="$dflt -l$thislib ";; | |
1486 | esac | |
1487 | else | |
1488 | echo "No -l$thislib." | |
1489 | fi | |
1490 | fi | |
1491 | fi | |
1492 | fi | |
1493 | done | |
1494 | set X $dflt | |
1495 | shift | |
1496 | dflt="$*" | |
1497 | case "$dflt" in | |
1498 | '') dflt='none';; | |
1499 | esac | |
1500 | ||
1501 | $cat <<EOM | |
1502 | ||
1503 | Some versions of Unix support shared libraries, which make | |
1504 | executables smaller but make load time slightly longer. | |
1505 | ||
1506 | On some systems, mostly newer Unix System V's, the shared library | |
1507 | is included by putting the option "-lc_s" as the last thing on the | |
1508 | cc command line when linking. Other systems use shared libraries | |
1509 | by default. There may be other libraries needed to compile $package | |
1510 | on your machine as well. If your system needs the "-lc_s" option, | |
1511 | include it here. Include any other special libraries here as well. | |
1512 | Say "none" for none. | |
1513 | EOM | |
1514 | ||
1515 | echo " " | |
1516 | rp="Any additional libraries? [$dflt]" | |
1517 | $echo $n "$rp $c" | |
1518 | . myread | |
1519 | case "$ans" in | |
1520 | none) ans=''; | |
1521 | esac | |
1522 | libs="$ans" | |
1523 | ||
1524 | : check for size of random number generator | |
1525 | echo " " | |
1526 | case "$alignbytes" in | |
1527 | '') | |
1528 | echo "Checking alignment constraints..." | |
1529 | $cat >try.c <<'EOCP' | |
1530 | struct foobar { | |
1531 | char foo; | |
1532 | double bar; | |
1533 | } try; | |
1534 | main() | |
1535 | { | |
1536 | printf("%d\n", (char*)&try.bar - (char*)&try.foo); | |
1537 | } | |
1538 | EOCP | |
1539 | if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then | |
1540 | dflt=`./try` | |
1541 | else | |
1542 | dflt='?' | |
1543 | echo "(I can't seem to compile the test program...)" | |
1544 | fi | |
1545 | ;; | |
1546 | *) | |
1547 | dflt="$alignbytes" | |
1548 | ;; | |
1549 | esac | |
1550 | rp="Doubles must be aligned on a how-many-byte boundary? [$dflt]" | |
1551 | $echo $n "$rp $c" | |
1552 | . myread | |
1553 | alignbytes="$ans" | |
1554 | $rm -f try.c try | |
1555 | ||
1556 | : determine where public executables go | |
1557 | cat <<EOF | |
1558 | ||
1559 | The following questions distinguish the directory in which executables | |
1560 | reside from the directory in which they are installed (and from which they | |
1561 | are presumably copied to the former directory by occult means). This | |
1562 | distinction is often necessary under afs. On most other systems, however, | |
1563 | the two directories are the same. | |
1564 | ||
1565 | EOF | |
1566 | case "$bin" in | |
1567 | '') | |
1568 | dflt=`./loc . /usr/local/bin /usr/local/bin /usr/lbin /usr/local /usr/bin /bin` | |
1569 | ;; | |
1570 | *) dflt="$bin" | |
1571 | ;; | |
1572 | esac | |
1573 | cont=true | |
1574 | while $test "$cont" ; do | |
1575 | rp="In which directory will public executables reside (~name ok)? [$dflt]" | |
1576 | $echo "In which directory will public executables reside (~name ok)?" | |
1577 | $echo $n "[$dflt] $c" | |
1578 | . myread | |
1579 | bin="$ans" | |
1580 | bin=`./filexp $bin` | |
1581 | if test -d $bin; then | |
1582 | cont='' | |
1583 | else | |
1584 | case "$fastread" in | |
1585 | yes) dflt=y;; | |
1586 | *) dflt=n;; | |
1587 | esac | |
1588 | rp="Directory $bin doesn't exist. Use that name anyway? [$dflt]" | |
1589 | $echo $n "$rp $c" | |
1590 | . myread | |
1591 | dflt='' | |
1592 | case "$ans" in | |
1593 | y*) cont='';; | |
1594 | esac | |
1595 | fi | |
1596 | done | |
1597 | ||
1598 | case "$bin" in | |
1599 | ?????????????????????????) | |
1600 | cat <<EOF | |
1601 | ||
1602 | NOTE: you have a fairly long path name there. Some systems have trouble | |
1603 | executing a script if the #! line ends up longer than 32 characters. If | |
1604 | you have this trouble you may have to reinstall somewhere else, or make | |
1605 | a symbolic link from someplace with a shorter name. | |
1606 | ||
1607 | EOF | |
1608 | ;; | |
1609 | esac | |
1610 | ||
1611 | case "$installbin" in | |
1612 | '') | |
1613 | dflt=`echo $bin | sed 's#^/afs/#/afs/.#'` | |
1614 | test -d $dflt || dflt="$bin" | |
1615 | ;; | |
1616 | *) dflt="$installbin" | |
1617 | ;; | |
1618 | esac | |
1619 | cont=true | |
1620 | while $test "$cont" ; do | |
1621 | rp="In which directory will public executables be installed (~name ok)? [$dflt]" | |
1622 | $echo "In which directory will public executables be installed (~name ok)?" | |
1623 | $echo $n "[$dflt] $c" | |
1624 | . myread | |
1625 | installbin="$ans" | |
1626 | installbin=`./filexp $installbin` | |
1627 | if test -d $installbin; then | |
1628 | cont='' | |
1629 | else | |
1630 | case "$fastread" in | |
1631 | yes) dflt=y;; | |
1632 | *) dflt=n;; | |
1633 | esac | |
1634 | rp="Directory $installbin doesn't exist. Use that name anyway? [$dflt]" | |
1635 | $echo $n "$rp $c" | |
1636 | . myread | |
1637 | dflt='' | |
1638 | case "$ans" in | |
1639 | y*) cont='';; | |
1640 | esac | |
1641 | fi | |
1642 | done | |
1643 | ||
1644 | : check for ordering of bytes in a long | |
1645 | case "$byteorder" in | |
1646 | '') | |
1647 | cat <<'EOM' | |
1648 | ||
1649 | In the following, larger digits indicate more significance. A big-endian | |
1650 | machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A | |
1651 | little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other | |
1652 | machines may have weird orders like 3412. A Cray will report 87654321. If | |
1653 | the test program works the default is probably right. | |
1654 | I'm now running the test program... | |
1655 | EOM | |
1656 | $cat >byteorder.c <<'EOCP' | |
1657 | #include <stdio.h> | |
1658 | main() | |
1659 | { | |
1660 | int i; | |
1661 | union { | |
1662 | unsigned long l; | |
1663 | char c[sizeof(long)]; | |
1664 | } u; | |
1665 | ||
1666 | if (sizeof(long) > 4) | |
1667 | u.l = (0x08070605L << 32) | 0x04030201L; | |
1668 | else | |
1669 | u.l = 0x04030201L; | |
1670 | for (i=0; i < sizeof(long); i++) | |
1671 | printf("%c",u.c[i]+'0'); | |
1672 | printf("\n"); | |
1673 | } | |
1674 | EOCP | |
1675 | if $cc byteorder.c -o byteorder >/dev/null 2>&1 ; then | |
1676 | dflt=`./byteorder` | |
1677 | case "$dflt" in | |
1678 | ????|????????) echo "(The test program ran ok.)";; | |
1679 | *) echo "(The test program didn't run right for some reason.)";; | |
1680 | esac | |
1681 | else | |
1682 | dflt='4321' | |
1683 | echo "(I can't seem to compile the test program. Guessing big-endian...)" | |
1684 | fi | |
1685 | ;; | |
1686 | *) | |
1687 | echo " " | |
1688 | dflt="$byteorder" | |
1689 | ;; | |
1690 | esac | |
1691 | rp="What is the order of bytes in a long? [$dflt]" | |
1692 | $echo $n "$rp $c" | |
1693 | . myread | |
1694 | byteorder="$ans" | |
1695 | ||
1696 | : check for ability to cast negative floats to unsigned | |
1697 | echo " " | |
1698 | echo 'Checking to see if your C compiler can cast weird floats to unsigned' | |
1699 | $cat >try.c <<'EOCP' | |
1700 | #include <signal.h> | |
1701 | ||
1702 | blech() { exit(3); } | |
1703 | ||
1704 | main() | |
1705 | { | |
1706 | double f = -123; | |
1707 | unsigned long along; | |
1708 | unsigned int aint; | |
1709 | unsigned short ashort; | |
1710 | int result = 0; | |
1711 | ||
1712 | signal(SIGFPE, blech); | |
1713 | along = (unsigned long)f; | |
1714 | aint = (unsigned int)f; | |
1715 | ashort = (unsigned short)f; | |
1716 | if (along != (unsigned long)-123) | |
1717 | result |= 1; | |
1718 | if (aint != (unsigned int)-123) | |
1719 | result |= 1; | |
1720 | if (ashort != (unsigned short)-123) | |
1721 | result |= 1; | |
1722 | f = (double)0x40000000; | |
1723 | f = f + f; | |
1724 | along = 0; | |
1725 | along = (unsigned long)f; | |
1726 | if (along != 0x80000000) | |
1727 | result |= 2; | |
1728 | f -= 1; | |
1729 | along = 0; | |
1730 | along = (unsigned long)f; | |
1731 | if (along != 0x7fffffff) | |
1732 | result |= 1; | |
1733 | f += 2; | |
1734 | along = 0; | |
1735 | along = (unsigned long)f; | |
1736 | if (along != 0x80000001) | |
1737 | result |= 2; | |
1738 | exit(result); | |
1739 | } | |
1740 | EOCP | |
1741 | if $cc -o try $ccflags try.c >/dev/null 2>&1; then | |
1742 | ./try | |
1743 | castflags=$? | |
1744 | else | |
1745 | castflags=3 | |
1746 | fi | |
1747 | case "$castflags" in | |
1748 | 0) val="$define" | |
1749 | echo "Yup, it does." | |
1750 | ;; | |
1751 | *) val="$undef" | |
1752 | echo "Nope, it doesn't." | |
1753 | ;; | |
1754 | esac | |
1755 | set d_castneg | |
1756 | eval $setvar | |
1757 | $rm -f try.* | |
1758 | ||
1759 | : see how we invoke the C preprocessor | |
1760 | echo " " | |
1761 | echo "Now, how can we feed standard input to your C preprocessor..." | |
1762 | cat <<'EOT' >testcpp.c | |
1763 | #define ABC abc | |
1764 | #define XYZ xyz | |
1765 | ABC.XYZ | |
1766 | EOT | |
1767 | ||
1768 | cd .. | |
1769 | echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin | |
1770 | chmod 755 cppstdin | |
1771 | wrapper=cppstdin | |
1772 | ||
1773 | case "$cppstdin" in | |
1774 | /*cppstdin) cppstdin=cppstdin;; | |
1775 | esac | |
1776 | cp cppstdin UU | |
1777 | cd UU | |
1778 | ||
1779 | if test "X$cppstdin" != "X" && \ | |
1780 | $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \ | |
1781 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
1782 | echo "You used to use $cppstdin $cppminus so we'll use that again." | |
1783 | elif test "$cc" = gcc && \ | |
1784 | (echo "Using gcc, eh? We'll try to force gcc -E using a wrapper..."; \ | |
1785 | $wrapper <testcpp.c >testcpp.out 2>&1; \ | |
1786 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1) ; then | |
1787 | echo "Yup, we can." | |
1788 | cppstdin="$wrapper" | |
1789 | cppminus=''; | |
1790 | elif echo 'Maybe "'"$cc"' -E" will work...'; \ | |
1791 | $cc -E <testcpp.c >testcpp.out 2>&1; \ | |
1792 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
1793 | echo "Yup, it does." | |
1794 | cppstdin="$cc -E" | |
1795 | cppminus=''; | |
1796 | elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \ | |
1797 | $cc -E - <testcpp.c >testcpp.out 2>&1; \ | |
1798 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
1799 | echo "Yup, it does." | |
1800 | cppstdin="$cc -E" | |
1801 | cppminus='-'; | |
1802 | elif echo 'No such luck, maybe "'$cpp'" will work...'; \ | |
1803 | $cpp <testcpp.c >testcpp.out 2>&1; \ | |
1804 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
1805 | echo "It works!" | |
1806 | cppstdin="$cpp" | |
1807 | cppminus=''; | |
1808 | elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \ | |
1809 | $cpp - <testcpp.c >testcpp.out 2>&1; \ | |
1810 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
1811 | echo "Hooray, it works! I was beginning to wonder." | |
1812 | cppstdin="$cpp" | |
1813 | cppminus='-'; | |
1814 | elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \ | |
1815 | $wrapper <testcpp.c >testcpp.out 2>&1; \ | |
1816 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
1817 | cppstdin="$wrapper" | |
1818 | cppminus='' | |
1819 | echo "Eureka!." | |
1820 | elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \ | |
1821 | $cc -P <testcpp.c >testcpp.out 2>&1; \ | |
1822 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
1823 | echo "Yipee, that works!" | |
1824 | cppstdin="$cc -P" | |
1825 | cppminus=''; | |
1826 | elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \ | |
1827 | $cc -P - <testcpp.c >testcpp.out 2>&1; \ | |
1828 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
1829 | echo "At long last!" | |
1830 | cppstdin="$cc -P" | |
1831 | cppminus='-'; | |
1832 | else | |
1833 | dflt=blurfl | |
1834 | $echo $n "No dice. I can't find a C preprocessor. Name one: $c" | |
1835 | rp='Name a C preprocessor:' | |
1836 | . myread | |
1837 | cppstdin="$ans" | |
1838 | $cppstdin <testcpp.c >testcpp.out 2>&1 | |
1839 | if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
1840 | echo "OK, that will do." | |
1841 | else | |
1842 | echo "Sorry, I can't get that to work. Go find one and rerun Configure." | |
1843 | exit 1 | |
1844 | fi | |
1845 | fi | |
1846 | ||
1847 | : get list of predefined functions in a handy place | |
1848 | echo " " | |
1849 | case "$libc" in | |
1850 | '') libc=unknown;; | |
1851 | esac | |
1852 | case "$nm_opts" in | |
1853 | '') if test -f /mach_boot; then | |
1854 | nm_opts='' | |
1855 | elif test -d /usr/ccs/lib; then | |
1856 | nm_opts='-p' | |
1857 | else | |
1858 | nm_opts='' | |
1859 | fi | |
1860 | ;; | |
1861 | esac | |
1862 | : on mips, we DO NOT want /lib, and we want inclPath/usr/lib | |
1863 | case "$libpth" in | |
1864 | '') if mips; then | |
1865 | libpth='$inclPath/usr/lib /usr/local/lib' | |
1866 | nm_opts="-B" | |
1867 | else | |
1868 | libpth='/usr/ccs/lib /lib /usr/lib /usr/ucblib /usr/local/lib' | |
1869 | fi | |
1870 | ;; | |
1871 | esac | |
1872 | case "$libs" in | |
1873 | *-lc_s*) libc=`./loc libc_s.a $libc $libpth` | |
1874 | esac | |
1875 | libnames=''; | |
1876 | case "$libs" in | |
1877 | '') ;; | |
1878 | *) for thislib in $libs; do | |
1879 | case "$thislib" in | |
1880 | -l*) thislib=`expr X$thislib : 'X-l\(.*\)'` | |
1881 | try=`./loc lib$thislib.a blurfl/dyick $libpth` | |
1882 | if test ! -f $try; then | |
1883 | try=`./loc lib$thislib blurfl/dyick $libpth` | |
1884 | if test ! -f $try; then | |
1885 | try=`./loc $thislib blurfl/dyick $libpth` | |
1886 | if test ! -f $try; then | |
1887 | try=`./loc Slib$thislib.a blurfl/dyick $xlibpth` | |
1888 | if test ! -f $try; then | |
1889 | try='' | |
1890 | fi | |
1891 | fi | |
1892 | fi | |
1893 | fi | |
1894 | libnames="$libnames $try" | |
1895 | ;; | |
1896 | *) libnames="$libnames $thislib" ;; | |
1897 | esac | |
1898 | done | |
1899 | ;; | |
1900 | esac | |
1901 | set /usr/ccs/lib/libc.so | |
1902 | test -f $1 || set /usr/lib/libc.so | |
1903 | test -f $1 || set /usr/shlib/libc.so | |
1904 | test -f $1 || set /usr/lib/libc.so.[0-9]* | |
1905 | test -f $1 || set /lib/libsys_s.a | |
1906 | eval set \$$# | |
1907 | if test -f "$1"; then | |
1908 | echo "Your (shared) C library seems to be in $1." | |
1909 | libc="$1" | |
1910 | elif test -f "$libc"; then | |
1911 | echo "Your C library seems to be in $libc." | |
1912 | elif test -f /lib/libc.a; then | |
1913 | echo "Your C library seems to be in /lib/libc.a. You're normal." | |
1914 | libc=/lib/libc.a | |
1915 | else | |
1916 | if ans=`./loc libc.a blurfl/dyick $libpth`; test -f "$ans"; then | |
1917 | : | |
1918 | elif ans=`./loc libc blurfl/dyick $libpth`; test -f "$ans"; then | |
1919 | libnames="$libnames "`./loc clib blurfl/dyick $libpth` | |
1920 | elif ans=`./loc clib blurfl/dyick $libpth`; test -f "$ans"; then | |
1921 | : | |
1922 | elif ans=`./loc Slibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then | |
1923 | : | |
1924 | elif ans=`./loc Mlibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then | |
1925 | : | |
1926 | elif ans=`./loc Llibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then | |
1927 | : | |
1928 | fi | |
1929 | if test -f "$ans"; then | |
1930 | echo "Your C library seems to be in $ans, of all places." | |
1931 | libc=$ans | |
1932 | else | |
1933 | cat <<EOM | |
1934 | ||
1935 | I can't seem to find your C library. I've looked in the following places: | |
1936 | ||
1937 | $libpth | |
1938 | ||
1939 | None of these seems to contain your C library. What is the full name | |
1940 | EOM | |
1941 | dflt=None | |
1942 | $echo $n "of your C library? $c" | |
1943 | rp='C library full name?' | |
1944 | . myread | |
1945 | libc="$ans" | |
1946 | fi | |
1947 | fi | |
1948 | echo " " | |
1949 | if test $libc = "/lib/libc"; then | |
1950 | libc="$libc /lib/clib" | |
1951 | fi | |
1952 | cat <<END | |
1953 | ||
1954 | If the guess above is wrong (which it might be if you're using a strange | |
1955 | compiler, or your machine supports multiple models), you can override it here. | |
1956 | END | |
1957 | dflt="$libc"; | |
1958 | rp="Your C library is where? [$dflt]" | |
1959 | $echo $n "$rp $c" | |
1960 | . myread | |
1961 | libc="$ans" | |
1962 | echo " " | |
1963 | echo $libc $libnames | tr ' ' '\012' | sort | uniq >libnames | |
1964 | $echo "Extracting names from the following files for later perusal:" | |
1965 | sed 's/^/ /' libnames | |
1966 | echo $n "This may take a while...$c" | |
1967 | set X `cat libnames` | |
1968 | shift | |
1969 | nm $nm_opts $* 2>/dev/null >libc.tmp | |
1970 | $sed -n -e 's/^.* [ATDS] *[_.]*//p' -e 's/^.* [ATDS] //p' <libc.tmp >libc.list | |
1971 | if $contains '^printf$' libc.list >/dev/null 2>&1; then | |
1972 | echo done | |
1973 | elif $sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p' \ | |
1974 | <libc.tmp >libc.list; \ | |
1975 | $contains '^printf$' libc.list >/dev/null 2>&1; then | |
1976 | echo done | |
1977 | elif $sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p' <libc.tmp >libc.list; \ | |
1978 | $contains '^printf$' libc.list >/dev/null 2>&1; then | |
1979 | echo done | |
1980 | elif $sed -n -e 's/^.* D __*//p' -e 's/^.* D //p' <libc.tmp >libc.list; \ | |
1981 | $contains '^printf$' libc.list >/dev/null 2>&1; then | |
1982 | echo done | |
1983 | elif $sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p' \ | |
1984 | <libc.tmp >libc.list; \ | |
1985 | $contains '^printf$' libc.list >/dev/null 2>&1; then | |
1986 | echo done | |
1987 | elif $grep '|' <libc.tmp | $sed -n -e '/|COMMON/d' -e '/|DATA/d' -e '/ file/d' \ | |
1988 | -e 's/^\([^ ]*\).*/\1/p' >libc.list | |
1989 | $contains '^printf$' libc.list >/dev/null 2>&1; then | |
1990 | echo done | |
1991 | elif $sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p' \ | |
1992 | <libc.tmp >libc.list; \ | |
1993 | $contains '^printf$' libc.list >/dev/null 2>&1; then | |
1994 | echo done | |
1995 | elif $sed -n -e 's/^[ ]*[0-9][0-9a-f]*[ ]*Def. Text[ ]*//p' \ | |
1996 | < libc.tmp | $sed -e 's/\[.*\]//' > libc.list; \ | |
1997 | $contains '^printf$' libc.list >/dev/null 2>&1; then | |
1998 | echo done | |
1999 | else | |
2000 | nm -p $* 2>/dev/null >libc.tmp | |
2001 | $sed -n -e 's/^.* [AT] *_[_.]*//p' -e 's/^.* [AT] //p' <libc.tmp >libc.list | |
2002 | if $contains '^printf$' libc.list >/dev/null 2>&1; then | |
2003 | nm_opts='-p' | |
2004 | echo "done" | |
2005 | else | |
2006 | echo " " | |
2007 | echo "nm didn't seem to work right." | |
2008 | echo "Trying ar instead..." | |
2009 | if ar t $libc > libc.tmp; then | |
2010 | for thisname in $libnames; do | |
2011 | ar t $thisname >>libc.tmp | |
2012 | done | |
2013 | $sed -e 's/\.o$//' < libc.tmp > libc.list | |
2014 | echo "Ok." | |
2015 | else | |
2016 | echo "ar didn't seem to work right." | |
2017 | echo "Maybe this is a Cray...trying bld instead..." | |
2018 | if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then | |
2019 | for thisname in $libnames; do | |
2020 | bld t $libnames | \ | |
2021 | $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list | |
2022 | ar t $thisname >>libc.tmp | |
2023 | done | |
2024 | echo "Ok." | |
2025 | else | |
2026 | echo "That didn't work either. Giving up." | |
2027 | exit 1 | |
2028 | fi | |
2029 | fi | |
2030 | fi | |
2031 | fi | |
2032 | if test -f /lib/syscalls.exp; then | |
2033 | echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." | |
2034 | sed -n 's/^\([^ ]*\)[ ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list | |
2035 | fi | |
2036 | ||
2037 | inlibc='echo " "; td=$define; tu=$undef; | |
2038 | if $contains "^$1\$" libc.list >/dev/null 2>&1; | |
2039 | then echo "$1() found"; | |
2040 | eval "case \"\$$2\" in undef) . whoa; esac"; eval "$2=\$td"; | |
2041 | else echo "$1() NOT found"; | |
2042 | eval "case \"\$$2\" in define) . whoa; esac"; eval "$2=\$tu"; fi' | |
2043 | ||
2044 | : see if bcmp exists | |
2045 | set bcmp d_bcmp | |
2046 | eval $inlibc | |
2047 | ||
2048 | : see if bcopy exists | |
2049 | set bcopy d_bcopy | |
2050 | eval $inlibc | |
2051 | ||
2052 | case "$d_safebcpy" in | |
2053 | '') | |
2054 | : assume the worst | |
2055 | d_safebcpy=undef | |
2056 | case "$d_bcopy" in | |
2057 | define) | |
2058 | echo "Checking to see if your bcopy() can do overlapping copies..." | |
2059 | $cat >safebcpy.c <<'EOCP' | |
2060 | main() | |
2061 | { | |
2062 | char buf[128]; | |
2063 | register char *b; | |
2064 | register int len; | |
2065 | register int off; | |
2066 | register int align; | |
2067 | ||
2068 | for (align = 7; align >= 0; align--) { | |
2069 | for (len = 36; len; len--) { | |
2070 | b = buf+align; | |
2071 | bcopy("abcdefghijklmnopqrstuvwxyz0123456789", b, len); | |
2072 | for (off = 1; off <= len; off++) { | |
2073 | bcopy(b, b+off, len); | |
2074 | bcopy(b+off, b, len); | |
2075 | if (bcmp(b, "abcdefghijklmnopqrstuvwxyz0123456789", len)) | |
2076 | exit(1); | |
2077 | } | |
2078 | } | |
2079 | } | |
2080 | exit(0); | |
2081 | } | |
2082 | EOCP | |
2083 | if $cc safebcpy.c -o safebcpy $ccflags $libs >/dev/null 2>&1 ; then | |
2084 | if ./safebcpy; then | |
2085 | echo "It can." | |
2086 | d_safebcpy=define | |
2087 | else | |
2088 | echo "It can't." | |
2089 | fi | |
2090 | else | |
2091 | echo "(I can't compile the test program, so we'll assume not...)" | |
2092 | fi | |
2093 | ;; | |
2094 | esac | |
2095 | ;; | |
2096 | esac | |
2097 | ||
2098 | : see if bzero exists | |
2099 | set bzero d_bzero | |
2100 | eval $inlibc | |
2101 | ||
2102 | : see if sprintf is declared as int or pointer to char | |
2103 | echo " " | |
2104 | cat >ucbsprf.c <<'EOF' | |
2105 | #include <stdio.h> | |
2106 | main() | |
2107 | { | |
2108 | int sprintf(); | |
2109 | char buf[10]; | |
2110 | exit((unsigned long)sprintf(buf,"%s","foo") > 10L); | |
2111 | } | |
2112 | EOF | |
2113 | if $cc $ccflags ucbsprf.c -o ucbsprf >/dev/null 2>&1 && ./ucbsprf; then | |
2114 | echo "Your sprintf() returns (int)." | |
2115 | val="$undef" | |
2116 | else | |
2117 | echo "Your sprintf() returns (char*)." | |
2118 | val="$define" | |
2119 | fi | |
2120 | set d_charsprf | |
2121 | eval $setvar | |
2122 | ||
2123 | : see if vprintf exists | |
2124 | echo " " | |
2125 | if $contains '^vprintf$' libc.list >/dev/null 2>&1; then | |
2126 | echo 'vprintf() found.' | |
2127 | val="$define" | |
2128 | cat >vprintf.c <<'EOF' | |
2129 | #include <varargs.h> | |
2130 | ||
2131 | main() { xxx("foo"); } | |
2132 | ||
2133 | xxx(va_alist) | |
2134 | va_dcl | |
2135 | { | |
2136 | va_list args; | |
2137 | char buf[10]; | |
2138 | ||
2139 | va_start(args); | |
2140 | exit((unsigned long)vsprintf(buf,"%s",args) > 10L); | |
2141 | } | |
2142 | EOF | |
2143 | if $cc $ccflags vprintf.c -o vprintf >/dev/null 2>&1 && ./vprintf; then | |
2144 | echo "Your vsprintf() returns (int)." | |
2145 | val2="$undef" | |
2146 | else | |
2147 | echo "Your vsprintf() returns (char*)." | |
2148 | val2="$define" | |
2149 | fi | |
2150 | else | |
2151 | echo 'vprintf() NOT found.' | |
2152 | val="$undef" | |
2153 | val2="$undef" | |
2154 | fi | |
2155 | set d_vprintf | |
2156 | eval $setvar | |
2157 | val=$val2 | |
2158 | set d_charvspr | |
2159 | eval $setvar | |
2160 | ||
2161 | : see if chsize exists | |
2162 | set chsize d_chsize | |
2163 | eval $inlibc | |
2164 | ||
2165 | : see if crypt exists | |
2166 | echo " " | |
2167 | if $contains '^crypt$' libc.list >/dev/null 2>&1; then | |
2168 | echo 'crypt() found.' | |
2169 | val="$define" | |
2170 | cryptlib='' | |
2171 | else | |
2172 | cryptlib=`./loc Slibcrypt.a "" $xlibpth` | |
2173 | if $test -z "$cryptlib"; then | |
2174 | cryptlib=`./loc Mlibcrypt.a "" $xlibpth` | |
2175 | else | |
2176 | cryptlib=-lcrypt | |
2177 | fi | |
2178 | if $test -z "$cryptlib"; then | |
2179 | cryptlib=`./loc Llibcrypt.a "" $xlibpth` | |
2180 | else | |
2181 | cryptlib=-lcrypt | |
2182 | fi | |
2183 | if $test -z "$cryptlib"; then | |
2184 | cryptlib=`./loc libcrypt.a "" $libpth` | |
2185 | else | |
2186 | cryptlib=-lcrypt | |
2187 | fi | |
2188 | if $test -z "$cryptlib"; then | |
2189 | echo 'crypt() NOT found.' | |
2190 | val="$undef" | |
2191 | else | |
2192 | val="$define" | |
2193 | fi | |
2194 | fi | |
2195 | set d_crypt | |
2196 | eval $setvar | |
2197 | ||
2198 | : get csh whereabouts | |
2199 | case "$csh" in | |
2200 | 'csh') val="$undef" ;; | |
2201 | *) val="$define" ;; | |
2202 | esac | |
2203 | set d_csh | |
2204 | eval $setvar | |
2205 | ||
2206 | : see if readdir exists | |
2207 | set readdir d_readdir | |
2208 | eval $inlibc | |
2209 | ||
2210 | : see if there are directory access routines out there | |
2211 | echo " " | |
2212 | xxx=`./loc ndir.h x $usrinclude /usr/local/include $inclwanted` | |
2213 | case "$xxx" in | |
2214 | x) | |
2215 | xxx=`./loc sys/ndir.h x $usrinclude /usr/local/include $inclwanted` | |
2216 | ;; | |
2217 | esac | |
2218 | D_dirnamlen="$undef" | |
2219 | I_dirent="$undef" | |
2220 | I_sys_dir="$undef" | |
2221 | I_my_dir="$undef" | |
2222 | I_ndir="$undef" | |
2223 | I_sys_ndir="$undef" | |
2224 | libndir='' | |
2225 | ndirc='' | |
2226 | ndiro='' | |
2227 | if $test -r $usrinclude/dirent.h; then | |
2228 | echo "dirent.h found." | |
2229 | if $contains 'd_namlen' $usrinclude/dirent.h >/dev/null 2>&1; then | |
2230 | D_dirnamlen="$define" | |
2231 | fi | |
2232 | I_dirent="$define" | |
2233 | elif $test -r $xxx; then | |
2234 | echo "You seem to use <$xxx>," | |
2235 | if $test "$d_readdir" = "$define"; then | |
2236 | echo "and I can get readdir() from your C library." | |
2237 | elif $test -r /usr/lib/libndir.a || $test -r /usr/local/lib/libndir.a; then | |
2238 | echo "and I'll get the routines using -lndir ." | |
2239 | libndir='-lndir' | |
2240 | else | |
2241 | ans=`./loc libndir.a x $libpth` | |
2242 | case "$ans" in | |
2243 | x) | |
2244 | echo "but I can't find the ndir library!" | |
2245 | ;; | |
2246 | *) | |
2247 | echo "and I found the directory library in $ans." | |
2248 | libndir="$ans" | |
2249 | ;; | |
2250 | esac | |
2251 | fi | |
2252 | if $contains 'd_namlen' $xxx >/dev/null 2>&1; then | |
2253 | D_dirnamlen="$define" | |
2254 | fi | |
2255 | case "$xxx" in | |
2256 | sys/) | |
2257 | I_sys_ndir="$define" | |
2258 | ;; | |
2259 | *) | |
2260 | I_ndir="$define" | |
2261 | ;; | |
2262 | esac | |
2263 | else | |
2264 | : The next line used to require this to be a bsd system. | |
2265 | if $contains '^readdir$' libc.list >/dev/null 2>&1 ; then | |
2266 | echo "No ndir library found, but you have readdir() so we'll use that." | |
2267 | if $contains 'd_namlen' $usrinclude/sys/dir.h >/dev/null 2>&1; then | |
2268 | D_dirnamlen="$define" | |
2269 | fi | |
2270 | I_sys_dir="$define" | |
2271 | else | |
2272 | echo "No ndir library found--using ./$d_ndir.c." | |
2273 | : This will lose since $d_ndir.h is in another directory. | |
2274 | : I doubt we can rely on it being in ../$d_ndir.h . | |
2275 | : At least it will fail in a conservative manner. | |
2276 | if $contains 'd_namlen' $d_ndir.h >/dev/null 2>&1; then | |
2277 | D_dirnamlen="$define" | |
2278 | fi | |
2279 | I_my_dir="$define" | |
2280 | ndirc="$d_ndir.c" | |
2281 | ndiro="$d_ndir.o" | |
2282 | fi | |
2283 | fi | |
2284 | val=$D_dirnamlen; set d_dirnamlen; eval $setvar | |
2285 | val=$I_dirent; set i_dirent; eval $setvar | |
2286 | val=$I_sys_dir; set i_sys_dir; eval $setvar | |
2287 | val=$I_my_dir; set i_my_dir; eval $setvar | |
2288 | val=$I_ndir; set i_ndir; eval $setvar | |
2289 | val=$I_sys_ndir; set i_sys_ndir; eval $setvar | |
2290 | ||
2291 | : now see if they want to do setuid emulation | |
2292 | case "$d_dosuid" in | |
2293 | '') dflt=n;; | |
2294 | *undef*) dflt=n;; | |
2295 | *) dflt=y;; | |
2296 | esac | |
2297 | cat <<EOM | |
2298 | ||
2299 | Some sites have disabled setuid #! scripts because of a bug in the kernel | |
2300 | that prevents them from being secure. If you are on such a system, the | |
2301 | setuid/setgid bits on scripts are currently useless. It is possible for | |
2302 | $package to detect those bits and emulate setuid/setgid in a secure fashion | |
2303 | until a better solution is devised for the kernel problem. | |
2304 | ||
2305 | EOM | |
2306 | rp="Do you want to do setuid/setgid emulation? [$dflt]" | |
2307 | $echo $n "$rp $c" | |
2308 | . myread | |
2309 | case "$ans" in | |
2310 | '') $ans="$dflt";; | |
2311 | esac | |
2312 | case "$ans" in | |
2313 | y*) d_dosuid="$define";; | |
2314 | *) d_dosuid="$undef";; | |
2315 | esac | |
2316 | ||
2317 | : see if dup2 exists | |
2318 | set dup2 d_dup2 | |
2319 | eval $inlibc | |
2320 | ||
2321 | : see if fchmod exists | |
2322 | set fchmod d_fchmod | |
2323 | eval $inlibc | |
2324 | ||
2325 | : see if fchown exists | |
2326 | set fchown d_fchown | |
2327 | eval $inlibc | |
2328 | ||
2329 | : see if this is an fcntl system | |
2330 | set fcntl d_fcntl | |
2331 | eval $inlibc | |
2332 | ||
2333 | : see if we can have long filenames | |
2334 | echo " " | |
2335 | rm -f 123456789abcde | |
2336 | if (echo hi >123456789abcdef) 2>/dev/null; then | |
2337 | : not version 8 | |
2338 | if test -f 123456789abcde; then | |
2339 | echo 'You cannot have filenames longer than 14 characters. Sigh.' | |
2340 | val="$undef" | |
2341 | else | |
2342 | echo 'You can have filenames longer than 14 characters.' | |
2343 | val="$define" | |
2344 | fi | |
2345 | else | |
2346 | : version 8 probably | |
2347 | echo "You can't have filenames longer than 14 chars. You can't even think about them!" | |
2348 | val="$undef" | |
2349 | fi | |
2350 | set d_flexfnam | |
2351 | eval $setvar | |
2352 | ||
2353 | : see if flock exists | |
2354 | set flock d_flock | |
2355 | eval $inlibc | |
2356 | ||
2357 | : see if getgroups exists | |
2358 | set getgroups d_getgrps | |
2359 | eval $inlibc | |
2360 | ||
2361 | : see if gethostent exists | |
2362 | set gethostent d_gethent | |
2363 | eval $inlibc | |
2364 | ||
2365 | : see if getpgrp exists | |
2366 | set getpgrp d_getpgrp | |
2367 | eval $inlibc | |
2368 | ||
2369 | : see if getpgrp2 exists | |
2370 | set getpgrp2 d_getpgrp2 | |
2371 | eval $inlibc | |
2372 | ||
2373 | : see if getpriority exists | |
2374 | set getpriority d_getprior | |
2375 | eval $inlibc | |
2376 | ||
2377 | : see if htonl exists | |
2378 | set htonl d_htonl | |
2379 | eval $inlibc | |
2380 | ||
2381 | : index or strcpy | |
2382 | echo " " | |
2383 | case "$d_index" in | |
2384 | undef) dflt=y;; | |
2385 | define) dflt=n;; | |
2386 | *) if $test -f /unix; then | |
2387 | dflt=n | |
2388 | else | |
2389 | dflt=y | |
2390 | fi | |
2391 | ;; | |
2392 | esac | |
2393 | if $contains '^index$' libc.list >/dev/null 2>&1 ; then | |
2394 | if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then | |
2395 | echo "Your system has both index() and strchr(). Shall I use" | |
2396 | rp="index() rather than strchr()? [$dflt]" | |
2397 | $echo $n "$rp $c" | |
2398 | . myread | |
2399 | case "$ans" in | |
2400 | n*) d_index="$define" ;; | |
2401 | *) d_index="$undef" ;; | |
2402 | esac | |
2403 | else | |
2404 | d_index="$undef" | |
2405 | echo "index() found." | |
2406 | fi | |
2407 | else | |
2408 | if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then | |
2409 | d_index="$define" | |
2410 | echo "strchr() found." | |
2411 | else | |
2412 | echo "No index() or strchr() found!" | |
2413 | d_index="$undef" | |
2414 | fi | |
2415 | fi | |
2416 | ||
2417 | : see if isascii exists | |
2418 | set isascii d_isascii | |
2419 | eval $inlibc | |
2420 | ||
2421 | : see if killpg exists | |
2422 | set killpg d_killpg | |
2423 | eval $inlibc | |
2424 | ||
2425 | : see if lstat exists | |
2426 | set lstat d_lstat | |
2427 | eval $inlibc | |
2428 | ||
2429 | : see if memcmp exists | |
2430 | set memcmp d_memcmp | |
2431 | eval $inlibc | |
2432 | ||
2433 | : see if memcpy exists | |
2434 | set memcpy d_memcpy | |
2435 | eval $inlibc | |
2436 | ||
2437 | case "$d_safemcpy" in | |
2438 | '') | |
2439 | : assume the worst | |
2440 | d_safemcpy=undef | |
2441 | case "$d_memcpy" in | |
2442 | define) | |
2443 | echo "Checking to see if your memcpy() can do overlapping copies..." | |
2444 | $cat >safemcpy.c <<'EOCP' | |
2445 | main() | |
2446 | { | |
2447 | char buf[128]; | |
2448 | register char *b; | |
2449 | register int len; | |
2450 | register int off; | |
2451 | register int align; | |
2452 | ||
2453 | for (align = 7; align >= 0; align--) { | |
2454 | for (len = 36; len; len--) { | |
2455 | b = buf+align; | |
2456 | memcpy(b,"abcdefghijklmnopqrstuvwxyz0123456789", len); | |
2457 | for (off = 1; off <= len; off++) { | |
2458 | memcpy(b+off, b, len); | |
2459 | memcpy(b, b+off, len); | |
2460 | if (memcmp(b, "abcdefghijklmnopqrstuvwxyz0123456789", len)) | |
2461 | exit(1); | |
2462 | } | |
2463 | } | |
2464 | } | |
2465 | exit(0); | |
2466 | } | |
2467 | EOCP | |
2468 | if $cc safemcpy.c -o safemcpy $ccflags $libs >/dev/null 2>&1 ; then | |
2469 | if ./safemcpy; then | |
2470 | echo "It can." | |
2471 | d_safemcpy=define | |
2472 | else | |
2473 | echo "It can't." | |
2474 | fi | |
2475 | else | |
2476 | echo "(I can't compile the test program, so we'll assume not...)" | |
2477 | fi | |
2478 | ;; | |
2479 | esac | |
2480 | ;; | |
2481 | esac | |
2482 | ||
2483 | : see if memmove exists | |
2484 | set memmove d_memmove | |
2485 | eval $inlibc | |
2486 | ||
2487 | : see if memset exists | |
2488 | set memset d_memset | |
2489 | eval $inlibc | |
2490 | ||
2491 | : see if mkdir exists | |
2492 | set mkdir d_mkdir | |
2493 | eval $inlibc | |
2494 | ||
2495 | : see if msgctl exists | |
2496 | set msgctl d_msgctl | |
2497 | eval $inlibc | |
2498 | ||
2499 | : see if msgget exists | |
2500 | set msgget d_msgget | |
2501 | eval $inlibc | |
2502 | ||
2503 | : see if msgsnd exists | |
2504 | set msgsnd d_msgsnd | |
2505 | eval $inlibc | |
2506 | ||
2507 | : see if msgrcv exists | |
2508 | set msgrcv d_msgrcv | |
2509 | eval $inlibc | |
2510 | ||
2511 | : see how much of the 'msg*(2)' library is present. | |
2512 | h_msg=true | |
2513 | echo " " | |
2514 | case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in | |
2515 | *undef*) h_msg=false;; | |
2516 | esac | |
2517 | : we could also check for sys/ipc.h ... | |
2518 | if $h_msg && $test -r $usrinclude/sys/msg.h; then | |
2519 | echo "You have the full msg*(2) library." | |
2520 | val="$define" | |
2521 | else | |
2522 | echo "You don't have the full msg*(2) library." | |
2523 | val="$undef" | |
2524 | fi | |
2525 | set d_msg | |
2526 | eval $setvar | |
2527 | ||
2528 | : determine which malloc to compile in | |
2529 | echo " " | |
2530 | case "$d_mymalloc" in | |
2531 | '') | |
2532 | case "$usemymalloc" in | |
2533 | '') | |
2534 | if bsd || v7; then | |
2535 | dflt='y' | |
2536 | else | |
2537 | dflt='n' | |
2538 | fi | |
2539 | ;; | |
2540 | n*) dflt=n;; | |
2541 | *) dflt=y;; | |
2542 | esac | |
2543 | ;; | |
2544 | define) dflt="y" | |
2545 | ;; | |
2546 | *) dflt="n" | |
2547 | ;; | |
2548 | esac | |
2549 | rp="Do you wish to attempt to use the malloc that comes with $package? [$dflt]" | |
2550 | $echo $n "$rp $c" | |
2551 | . myread | |
2552 | case "$ans" in | |
2553 | '') ans=$dflt;; | |
2554 | esac | |
2555 | case "$ans" in | |
2556 | y*) mallocsrc='malloc.c'; mallocobj='malloc.o' | |
2557 | libs=`echo $libs | sed 's/-lmalloc//'` | |
2558 | val="$define" | |
2559 | case "$mallocptrtype" in | |
2560 | '') | |
2561 | cat >usemymalloc.c <<'END' | |
2562 | #ifdef __STDC__ | |
2563 | #include <stdlib.h> | |
2564 | #else | |
2565 | #include <malloc.h> | |
2566 | #endif | |
2567 | void *malloc(); | |
2568 | END | |
2569 | if $cc $ccflags -c usemymalloc.c >/dev/null 2>&1; then | |
2570 | mallocptrtype=void | |
2571 | else | |
2572 | mallocptrtype=char | |
2573 | fi | |
2574 | ;; | |
2575 | esac | |
2576 | echo " " | |
2577 | echo "Your system wants malloc to return $mallocptrtype*, it would seem." | |
2578 | ;; | |
2579 | *) mallocsrc=''; | |
2580 | mallocobj=''; | |
2581 | mallocptrtype=void | |
2582 | val="$undef" | |
2583 | ;; | |
2584 | esac | |
2585 | set d_mymalloc | |
2586 | eval $setvar | |
2587 | ||
2588 | : see if ndbm is available | |
2589 | echo " " | |
2590 | xxx=`./loc ndbm.h x $usrinclude /usr/local/include $inclwanted` | |
2591 | if test -f $xxx; then | |
2592 | val="$define" | |
2593 | echo "ndbm.h found." | |
2594 | else | |
2595 | val="$undef" | |
2596 | echo "ndbm.h NOT found." | |
2597 | fi | |
2598 | set d_ndbm | |
2599 | eval $setvar | |
2600 | ||
2601 | : see if we have the old dbm | |
2602 | echo " " | |
2603 | xxx=`./loc dbm.h x $usrinclude /usr/local/include $inclwanted` | |
2604 | if test -f $xxx; then | |
2605 | val="$define" | |
2606 | echo "dbm.h found." | |
2607 | else | |
2608 | val="$undef" | |
2609 | echo "dbm.h NOT found." | |
2610 | fi | |
2611 | set d_odbm | |
2612 | eval $setvar | |
2613 | ||
2614 | : see whether socket exists | |
2615 | echo " " | |
2616 | socketlib='' | |
2617 | if $contains socket libc.list >/dev/null 2>&1; then | |
2618 | echo "Looks like you have Berkeley networking support." | |
2619 | val="$define" | |
2620 | : now check for advanced features | |
2621 | if $contains setsockopt libc.list >/dev/null 2>&1; then | |
2622 | val2="$undef" | |
2623 | else | |
2624 | echo "...but it uses the old 4.1c interface, rather than 4.2" | |
2625 | val2="$define" | |
2626 | fi | |
2627 | else | |
2628 | : hpux, for one, puts all the socket stuff in socklib.o | |
2629 | if $contains socklib libc.list >/dev/null 2>&1; then | |
2630 | echo "Looks like you have Berkeley networking support." | |
2631 | val="$define" | |
2632 | : we will have to assume that it supports the 4.2 BSD interface | |
2633 | val2="$undef" | |
2634 | else | |
2635 | echo "Hmmm...you don't have Berkeley networking in libc.a..." | |
2636 | : look for an optional networking library | |
2637 | if test -f /usr/lib/libnet.a; then | |
2638 | (ar t /usr/lib/libnet.a || | |
2639 | nm -g /usr/lib/libnet.a) 2>/dev/null >> libc.list | |
2640 | if $contains socket libc.list >/dev/null 2>&1; then | |
2641 | echo "but the Wollongong group seems to have hacked it in." | |
2642 | socketlib="-lnet -lnsl_s" | |
2643 | val="$define" | |
2644 | : now check for advanced features | |
2645 | if $contains setsockopt libc.list >/dev/null 2>&1; then | |
2646 | val2="$undef" | |
2647 | else | |
2648 | echo "...using the old 4.1c interface, rather than 4.2" | |
2649 | val2="$define" | |
2650 | fi | |
2651 | else | |
2652 | echo "or even in libnet.a, which is peculiar." | |
2653 | val="$undef" | |
2654 | val2="$undef" | |
2655 | fi | |
2656 | else | |
2657 | echo "or anywhere else I see." | |
2658 | val="$undef" | |
2659 | val2="$undef" | |
2660 | fi | |
2661 | fi | |
2662 | fi | |
2663 | set d_socket | |
2664 | eval $setvar | |
2665 | ||
2666 | if $contains socketpair libc.list >/dev/null 2>&1; then | |
2667 | val="$define" | |
2668 | else | |
2669 | val="$undef" | |
2670 | fi | |
2671 | set d_sockpair | |
2672 | eval $setvar | |
2673 | val=$val2 | |
2674 | set d_oldsock | |
2675 | eval $setvar | |
2676 | ||
2677 | : Locate the flags for 'open()' | |
2678 | echo " " | |
2679 | $cat >open3.c <<'EOCP' | |
2680 | #include <sys/types.h> | |
2681 | #ifdef I_FCNTL | |
2682 | #include <fcntl.h> | |
2683 | #endif | |
2684 | #ifdef I_SYS_FILE | |
2685 | #include <sys/file.h> | |
2686 | #endif | |
2687 | main() { | |
2688 | ||
2689 | if(O_RDONLY); | |
2690 | ||
2691 | #ifdef O_TRUNC | |
2692 | exit(0); | |
2693 | #else | |
2694 | exit(1); | |
2695 | #endif | |
2696 | } | |
2697 | EOCP | |
2698 | : check sys/file.h first to get FREAD on Sun | |
2699 | if $test -r $usrinclude/sys/file.h && \ | |
2700 | $cc $cppflags "-DI_SYS_FILE" open3.c -o open3 >/dev/null 2>&1 ; then | |
2701 | h_sys_file=true; | |
2702 | echo "sys/file.h defines the O_* constants..." | |
2703 | if ./open3; then | |
2704 | echo "and you have the 3 argument form of open()." | |
2705 | val="$define" | |
2706 | else | |
2707 | echo "but not the 3 argument form of open(). Oh, well." | |
2708 | val="$undef" | |
2709 | fi | |
2710 | elif $test -r $usrinclude/fcntl.h && \ | |
2711 | $cc "-DI_FCNTL" open3.c -o open3 >/dev/null 2>&1 ; then | |
2712 | h_fcntl=true; | |
2713 | echo "fcntl.h defines the O_* constants..." | |
2714 | if ./open3; then | |
2715 | echo "and you have the 3 argument form of open()." | |
2716 | val="$define" | |
2717 | else | |
2718 | echo "but not the 3 argument form of open(). Oh, well." | |
2719 | val="$undef" | |
2720 | fi | |
2721 | else | |
2722 | val="$undef" | |
2723 | echo "I can't find the O_* constant definitions! You got problems." | |
2724 | fi | |
2725 | set d_open3 | |
2726 | eval $setvar | |
2727 | ||
2728 | : see if how pwd stuff is defined | |
2729 | echo " " | |
2730 | if $test -r $usrinclude/pwd.h ; then | |
2731 | i_pwd="$define" | |
2732 | echo "pwd.h found." | |
2733 | $cppstdin $cppflags $cppminus <$usrinclude/pwd.h | \ | |
2734 | sed -n '/struct[ ][ ]*passwd/,/^};/p' >pwd.txt | |
2735 | if $contains 'pw_quota' pwd.txt >/dev/null 2>&1; then | |
2736 | d_pwquota="$define" | |
2737 | else | |
2738 | d_pwquota="$undef" | |
2739 | fi | |
2740 | if $contains 'pw_age' pwd.txt >/dev/null 2>&1; then | |
2741 | d_pwage="$define" | |
2742 | else | |
2743 | d_pwage="$undef" | |
2744 | fi | |
2745 | if $contains 'pw_change' pwd.txt >/dev/null 2>&1; then | |
2746 | d_pwchange="$define" | |
2747 | else | |
2748 | d_pwchange="$undef" | |
2749 | fi | |
2750 | if $contains 'pw_class' pwd.txt >/dev/null 2>&1; then | |
2751 | d_pwclass="$define" | |
2752 | else | |
2753 | d_pwclass="$undef" | |
2754 | fi | |
2755 | if $contains 'pw_expire' pwd.txt >/dev/null 2>&1; then | |
2756 | d_pwexpire="$define" | |
2757 | else | |
2758 | d_pwexpire="$undef" | |
2759 | fi | |
2760 | if $contains 'pw_comment' pwd.txt >/dev/null 2>&1; then | |
2761 | d_pwcomment="$define" | |
2762 | else | |
2763 | d_pwcomment="$undef" | |
2764 | fi | |
2765 | else | |
2766 | i_pwd="$undef" | |
2767 | d_pwquota="$undef" | |
2768 | d_pwage="$undef" | |
2769 | d_pwchange="$undef" | |
2770 | d_pwclass="$undef" | |
2771 | d_pwexpire="$undef" | |
2772 | d_pwcomment="$undef" | |
2773 | echo "No pwd.h found." | |
2774 | fi | |
2775 | ||
2776 | : see if rename exists | |
2777 | set rename d_rename | |
2778 | eval $inlibc | |
2779 | ||
2780 | : see if rewindir exists | |
2781 | set rewinddir d_rewindir | |
2782 | eval $inlibc | |
2783 | ||
2784 | : see if rmdir exists | |
2785 | set rmdir d_rmdir | |
2786 | eval $inlibc | |
2787 | ||
2788 | : see if seekdir exists | |
2789 | set seekdir d_seekdir | |
2790 | eval $inlibc | |
2791 | ||
2792 | : see if select exists | |
2793 | set select d_select | |
2794 | eval $inlibc | |
2795 | ||
2796 | : see if semctl exists | |
2797 | set semctl d_semctl | |
2798 | eval $inlibc | |
2799 | ||
2800 | : see if semget exists | |
2801 | set semget d_semget | |
2802 | eval $inlibc | |
2803 | ||
2804 | : see if semop exists | |
2805 | set semop d_semop | |
2806 | eval $inlibc | |
2807 | ||
2808 | : see how much of the 'sem*(2)' library is present. | |
2809 | h_sem=true | |
2810 | echo " " | |
2811 | case "$d_semctl$d_semget$d_semop" in | |
2812 | *undef*) h_sem=false;; | |
2813 | esac | |
2814 | : we could also check for sys/ipc.h ... | |
2815 | if $h_sem && $test -r $usrinclude/sys/sem.h; then | |
2816 | echo "You have the full sem*(2) library." | |
2817 | val="$define" | |
2818 | else | |
2819 | echo "You don't have the full sem*(2) library." | |
2820 | val="$undef" | |
2821 | fi | |
2822 | set d_sem | |
2823 | eval $setvar | |
2824 | ||
2825 | : see if setegid exists | |
2826 | set setegid d_setegid | |
2827 | eval $inlibc | |
2828 | ||
2829 | : see if seteuid exists | |
2830 | set seteuid d_seteuid | |
2831 | eval $inlibc | |
2832 | ||
2833 | : see if setpgrp exists | |
2834 | set setpgrp d_setpgrp | |
2835 | eval $inlibc | |
2836 | ||
2837 | : see if setpgrp2 exists | |
2838 | set setpgrp2 d_setpgrp2 | |
2839 | eval $inlibc | |
2840 | ||
2841 | : see if setpriority exists | |
2842 | set setpriority d_setprior | |
2843 | eval $inlibc | |
2844 | ||
2845 | : see if setregid exists | |
2846 | set setregid d_setregid | |
2847 | eval $inlibc | |
2848 | set setresgid d_setresgid | |
2849 | eval $inlibc | |
2850 | ||
2851 | : see if setreuid exists | |
2852 | set setreuid d_setreuid | |
2853 | eval $inlibc | |
2854 | set setresuid d_setresuid | |
2855 | eval $inlibc | |
2856 | ||
2857 | : see if setrgid exists | |
2858 | set setrgid d_setrgid | |
2859 | eval $inlibc | |
2860 | ||
2861 | : see if setruid exists | |
2862 | set setruid d_setruid | |
2863 | eval $inlibc | |
2864 | ||
2865 | : see if shmctl exists | |
2866 | set shmctl d_shmctl | |
2867 | eval $inlibc | |
2868 | ||
2869 | : see if shmget exists | |
2870 | set shmget d_shmget | |
2871 | eval $inlibc | |
2872 | ||
2873 | : see if shmat exists | |
2874 | set shmat d_shmat | |
2875 | eval $inlibc | |
2876 | ||
2877 | d_voidshmat="$undef" | |
2878 | case "$d_shmat" in | |
2879 | define) | |
2880 | $cppstdin $cppflags $cppminus < $usrinclude/sys/shm.h >voidshmat.txt 2>/dev/null | |
2881 | if $contains "void.*shmat" voidshmat.txt >/dev/null 2>&1; then | |
2882 | echo "and shmat returns (void*)" | |
2883 | d_voidshmat="$define" | |
2884 | else | |
2885 | echo "and shmat returns (char*)" | |
2886 | fi | |
2887 | ;; | |
2888 | esac | |
2889 | ||
2890 | : see if shmdt exists | |
2891 | set shmdt d_shmdt | |
2892 | eval $inlibc | |
2893 | ||
2894 | : see how much of the 'shm*(2)' library is present. | |
2895 | h_shm=true | |
2896 | echo " " | |
2897 | case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in | |
2898 | *undef*) h_shm=false;; | |
2899 | esac | |
2900 | : we could also check for sys/ipc.h ... | |
2901 | if $h_shm && $test -r $usrinclude/sys/shm.h; then | |
2902 | echo "You have the full shm*(2) library." | |
2903 | val="$define" | |
2904 | else | |
2905 | echo "You don't have the full shm*(2) library." | |
2906 | val="$undef" | |
2907 | fi | |
2908 | set d_shm | |
2909 | eval $setvar | |
2910 | ||
2911 | : see if stat knows about block sizes | |
2912 | echo " " | |
2913 | if $contains 'st_blocks;' $usrinclude/sys/stat.h >/dev/null 2>&1 ; then | |
2914 | if $contains 'st_blksize;' $usrinclude/sys/stat.h >/dev/null 2>&1 ; then | |
2915 | echo "Your stat knows about block sizes." | |
2916 | val="$define" | |
2917 | else | |
2918 | echo "Your stat doesn't know about block sizes." | |
2919 | val="$undef" | |
2920 | fi | |
2921 | else | |
2922 | echo "Your stat doesn't know about block sizes." | |
2923 | val="$undef" | |
2924 | fi | |
2925 | set d_statblks | |
2926 | eval $setvar | |
2927 | ||
2928 | : see if stdio is really std | |
2929 | echo " " | |
2930 | if $contains 'char.*_ptr.*;' $usrinclude/stdio.h >/dev/null 2>&1 ; then | |
2931 | if $contains '_cnt;' $usrinclude/stdio.h >/dev/null 2>&1 ; then | |
2932 | echo "Your stdio is pretty std." | |
2933 | val="$define" | |
2934 | else | |
2935 | echo "Your stdio isn't very std." | |
2936 | val="$undef" | |
2937 | fi | |
2938 | else | |
2939 | echo "Your stdio isn't very std." | |
2940 | val="$undef" | |
2941 | fi | |
2942 | set d_stdstdio | |
2943 | eval $setvar | |
2944 | ||
2945 | : check for structure copying | |
2946 | echo " " | |
2947 | echo "Checking to see if your C compiler can copy structs..." | |
2948 | $cat >strctcpy.c <<'EOCP' | |
2949 | main() | |
2950 | { | |
2951 | struct blurfl { | |
2952 | int dyick; | |
2953 | } foo, bar; | |
2954 | ||
2955 | foo = bar; | |
2956 | } | |
2957 | EOCP | |
2958 | if $cc -c strctcpy.c >/dev/null 2>&1 ; then | |
2959 | val="$define" | |
2960 | echo "Yup, it can." | |
2961 | else | |
2962 | val="$undef" | |
2963 | echo "Nope, it can't." | |
2964 | fi | |
2965 | set d_strctcpy | |
2966 | eval $setvar | |
2967 | ||
2968 | : see if strerror exists | |
2969 | set strerror d_strerror | |
2970 | eval $inlibc | |
2971 | ||
2972 | : see if symlink exists | |
2973 | set symlink d_symlink | |
2974 | eval $inlibc | |
2975 | ||
2976 | : see if syscall exists | |
2977 | set syscall d_syscall | |
2978 | eval $inlibc | |
2979 | ||
2980 | : set if package uses struct tm | |
2981 | w_s_tm=1 | |
2982 | ||
2983 | : set if package uses struct timeval | |
2984 | case "$d_select" in | |
2985 | define) w_s_timevl=1 ;; | |
2986 | esac | |
2987 | ||
2988 | : set if package uses localtime function | |
2989 | w_localtim=1 | |
2990 | ||
2991 | : see which of time.h, sys/time.h, and sys/select should be included. | |
2992 | idefs='' | |
2993 | cat <<'EOM' | |
2994 | ||
2995 | Testing to see which of <time.h>, <sys/time.h>, and <sys/select.h> | |
2996 | should be included, because this application wants: | |
2997 | ||
2998 | EOM | |
2999 | case "$w_s_itimer" in | |
3000 | 1) | |
3001 | echo " struct itimerval" | |
3002 | idefs="-DS_ITIMERVAL $idefs" | |
3003 | ;; | |
3004 | esac | |
3005 | case "$w_s_timevl" in | |
3006 | 1) | |
3007 | echo " struct timeval" | |
3008 | idefs="-DS_TIMEVAL $idefs" | |
3009 | ;; | |
3010 | esac | |
3011 | case "$w_s_tm" in | |
3012 | 1) | |
3013 | echo " struct tm" | |
3014 | idefs="-DS_TM $idefs" | |
3015 | ;; | |
3016 | esac | |
3017 | case "$w_localtim" in | |
3018 | 1) | |
3019 | echo " ctime(3) declarations" | |
3020 | idefs="-DD_CTIME $idefs" | |
3021 | ;; | |
3022 | esac | |
3023 | case "$idefs" in | |
3024 | '') | |
3025 | echo " (something I don't know about)" | |
3026 | ;; | |
3027 | esac | |
3028 | echo " " | |
3029 | echo "I'm now running the test program..." | |
3030 | $cat >i_time.c <<'EOCP' | |
3031 | #include <sys/types.h> | |
3032 | #ifdef I_TIME | |
3033 | #include <time.h> | |
3034 | #endif | |
3035 | #ifdef I_SYS_TIME | |
3036 | #ifdef SYSTIMEKERNEL | |
3037 | #define KERNEL | |
3038 | #endif | |
3039 | #include <sys/time.h> | |
3040 | #endif | |
3041 | #ifdef I_SYS_SELECT | |
3042 | #include <sys/select.h> | |
3043 | #endif | |
3044 | main() | |
3045 | { | |
3046 | struct tm foo; | |
3047 | struct tm *tmp; | |
3048 | #ifdef S_TIMEVAL | |
3049 | struct timeval bar; | |
3050 | #endif | |
3051 | #ifdef S_ITIMERVAL | |
3052 | struct itimerval baz; | |
3053 | #endif | |
3054 | ||
3055 | if (foo.tm_sec == foo.tm_sec) | |
3056 | exit(0); | |
3057 | #ifdef S_TIMEVAL | |
3058 | if (bar.tv_sec == bar.tv_sec) | |
3059 | exit(0); | |
3060 | #endif | |
3061 | #ifdef S_ITIMERVAL | |
3062 | if (baz.it_interval == baz.it_interval) | |
3063 | exit(0); | |
3064 | #endif | |
3065 | #ifdef S_TIMEVAL | |
3066 | if (bar.tv_sec == bar.tv_sec) | |
3067 | exit(0); | |
3068 | #endif | |
3069 | #ifdef D_CTIME | |
3070 | /* this might not do anything for us... */ | |
3071 | tmp = localtime((time_t *)0); | |
3072 | #endif | |
3073 | exit(1); | |
3074 | } | |
3075 | EOCP | |
3076 | flags='' | |
3077 | for i_sys_select in '' '-DI_SYS_SELECT'; do | |
3078 | for d_systimekernel in '' '-DSYSTIMEKERNEL'; do | |
3079 | for i_time in '' '-DI_TIME'; do | |
3080 | for i_systime in '-DI_SYS_TIME' ''; do | |
3081 | case "$flags" in | |
3082 | '') echo Trying $i_time $i_systime $d_systimekernel $i_sys_select | |
3083 | if $cc $ccflags $idefs \ | |
3084 | $i_time $i_systime $d_systimekernel $i_sys_select \ | |
3085 | i_time.c -o i_time >/dev/null 2>&1 ; then | |
3086 | set X $i_time $i_systime $d_systimekernel $i_sys_select | |
3087 | shift | |
3088 | flags="$*" | |
3089 | echo Succeeded with $flags | |
3090 | fi | |
3091 | ;; | |
3092 | esac | |
3093 | done | |
3094 | done | |
3095 | done | |
3096 | done | |
3097 | case "$flags" in | |
3098 | *SYSTIMEKERNEL*) val="$define";; | |
3099 | *) val="$undef";; | |
3100 | esac | |
3101 | set d_systimekernel | |
3102 | eval $setvar | |
3103 | case "$flags" in | |
3104 | *I_TIME*) val="$define";; | |
3105 | *) val="$undef";; | |
3106 | esac | |
3107 | set i_time | |
3108 | eval $setvar | |
3109 | case "$flags" in | |
3110 | *I_SYS_SELECT*) val="$define";; | |
3111 | *) val="$undef";; | |
3112 | esac | |
3113 | set i_sys_select | |
3114 | eval $setvar | |
3115 | case "$flags" in | |
3116 | *I_SYS_TIME*) val="$define";; | |
3117 | *) val="$undef";; | |
3118 | esac | |
3119 | set i_sys_time | |
3120 | eval $setvar | |
3121 | case "$flags$i_sys_time$i_time" in | |
3122 | undefundef) i_sys_time="$define"; i_time="$define"; | |
3123 | echo "ICK, NOTHING WORKED!!! You may have to diddle the includes.";; | |
3124 | esac | |
3125 | ||
3126 | : see if telldir exists | |
3127 | set telldir d_telldir | |
3128 | eval $inlibc | |
3129 | ||
3130 | : see if signal is declared as pointer to function returning int or void | |
3131 | echo " " | |
3132 | $cppstdin $cppflags $cppminus < $usrinclude/signal.h >d_voidsig.txt | |
3133 | if $contains 'int[^A-Za-z]*signal' d_voidsig.txt >/dev/null 2>&1 ; then | |
3134 | echo "You have int (*signal())() instead of void." | |
3135 | val="$undef" | |
3136 | else | |
3137 | echo "You have void (*signal())() instead of int." | |
3138 | val="$define" | |
3139 | fi | |
3140 | set d_voidsig | |
3141 | eval $setvar | |
3142 | case $voidsig in | |
3143 | define) d_tosignal=void;; | |
3144 | *) d_tosignal=int;; | |
3145 | esac | |
3146 | ||
3147 | : see if truncate exists | |
3148 | set truncate d_truncate | |
3149 | eval $inlibc | |
3150 | ||
3151 | : see if there is a vfork | |
3152 | set vfork d_vfork | |
3153 | eval $inlibc | |
3154 | ||
3155 | : check for volatile keyword | |
3156 | echo " " | |
3157 | echo 'Checking to see if your C compiler knows about "volatile"...' | |
3158 | $cat >try.c <<'EOCP' | |
3159 | main() | |
3160 | { | |
3161 | typedef unsigned short foo_t; | |
3162 | char *volatile foo; | |
3163 | volatile int bar; | |
3164 | volatile foo_t blech; | |
3165 | foo = foo; | |
3166 | } | |
3167 | EOCP | |
3168 | if $cc -c $ccflags try.c >/dev/null 2>&1 ; then | |
3169 | val="$define" | |
3170 | echo "Yup, it does." | |
3171 | else | |
3172 | val="$undef" | |
3173 | echo "Nope, it doesn't." | |
3174 | fi | |
3175 | set d_volatile | |
3176 | eval $setvar | |
3177 | $rm -f try.* | |
3178 | ||
3179 | : see if there is a wait4 | |
3180 | set wait4 d_wait4 | |
3181 | eval $inlibc | |
3182 | ||
3183 | : see if there is a waitpid | |
3184 | set waitpid d_waitpid | |
3185 | eval $inlibc | |
3186 | ||
3187 | : see what type gids are declared as in the kernel | |
3188 | case "$gidtype" in | |
3189 | '') | |
3190 | if $contains 'gid_t;' $usrinclude/sys/types.h >/dev/null 2>&1 ; then | |
3191 | dflt='gid_t'; | |
3192 | else | |
3193 | set `grep '_rgid;' $usrinclude/sys/user.h 2>/dev/null` unsigned short | |
3194 | case $1 in | |
3195 | unsigned) dflt="$1 $2" ;; | |
3196 | *) dflt="$1" ;; | |
3197 | esac | |
3198 | fi | |
3199 | ;; | |
3200 | *) dflt="$gidtype" | |
3201 | ;; | |
3202 | esac | |
3203 | cont=true | |
3204 | echo " " | |
3205 | rp="What type are groups ids returned by getgid(), etc.? [$dflt]" | |
3206 | $echo $n "$rp $c" | |
3207 | . myread | |
3208 | gidtype="$ans" | |
3209 | ||
3210 | : see what type gids are returned by getgroups | |
3211 | echo " " | |
3212 | case "$groupstype" in | |
3213 | '') | |
3214 | if $contains 'getgroups.*short' /usr/lib/lint/llib-lc >/dev/null 2>&1; then | |
3215 | dflt='short' | |
3216 | elif $contains 'getgroups.*int' /usr/lib/lint/llib-lc >/dev/null 2>&1; then | |
3217 | dflt='int' | |
3218 | elif $contains 'getgroups.*short' /usr/include/libc.h >/dev/null 2>&1; then | |
3219 | dflt='short' | |
3220 | elif $contains 'getgroups.*int' /usr/include/libc.h >/dev/null 2>&1; then | |
3221 | dflt='int' | |
3222 | elif $contains 'getgroups.*short' /usr/lib/lint/llib-lbsd >/dev/null 2>&1; then | |
3223 | dflt='short' | |
3224 | elif $contains 'getgroups.*int' /usr/lib/lint/llib-lbsd >/dev/null 2>&1; then | |
3225 | dflt='int' | |
3226 | elif $contains 'int.*gidset' /usr/man/man2/getgroups.2 >/dev/null 2>&1; then | |
3227 | dflt='int' | |
3228 | elif $contains 'gid_t;' $usrinclude/sys/types.h >/dev/null 2>&1 ; then | |
3229 | dflt='gid_t' | |
3230 | else | |
3231 | set `grep 'groups\[NGROUPS\];' $usrinclude/sys/user.h 2>/dev/null` unsigned short | |
3232 | case $1 in | |
3233 | unsigned) dflt="$1 $2" ;; | |
3234 | *) dflt="$1" ;; | |
3235 | esac | |
3236 | fi | |
3237 | ;; | |
3238 | *) dflt="$groupstype" | |
3239 | ;; | |
3240 | esac | |
3241 | cont=true | |
3242 | echo "(The following only matters if you have getgroups().)" | |
3243 | rp="What type are the group ids returned by getgroups()? [$dflt]" | |
3244 | $echo $n "$rp $c" | |
3245 | . myread | |
3246 | groupstype="$ans" | |
3247 | ||
3248 | : check for length of integer | |
3249 | echo " " | |
3250 | case "$intsize" in | |
3251 | '') | |
3252 | echo "Checking to see how big your integers are..." | |
3253 | $cat >intsize.c <<'EOCP' | |
3254 | #include <stdio.h> | |
3255 | main() | |
3256 | { | |
3257 | printf("%d\n", sizeof(int)); | |
3258 | } | |
3259 | EOCP | |
3260 | if $cc intsize.c -o intsize >/dev/null 2>&1 ; then | |
3261 | dflt=`./intsize` | |
3262 | else | |
3263 | dflt='4' | |
3264 | echo "(I can't seem to compile the test program. Guessing...)" | |
3265 | fi | |
3266 | ;; | |
3267 | *) | |
3268 | dflt="$intsize" | |
3269 | ;; | |
3270 | esac | |
3271 | rp="What is the size of an integer (in bytes)? [$dflt]" | |
3272 | $echo $n "$rp $c" | |
3273 | . myread | |
3274 | intsize="$ans" | |
3275 | ||
3276 | : determine where private executables go | |
3277 | case "$privlib" in | |
3278 | '') | |
3279 | dflt=/usr/lib/$package | |
3280 | test -d /usr/local/lib && dflt=/usr/local/lib/$package | |
3281 | ;; | |
3282 | *) dflt="$privlib" | |
3283 | ;; | |
3284 | esac | |
3285 | $cat <<EOM | |
3286 | ||
3287 | The $package package has some auxiliary files that should be reside in a library | |
3288 | that is accessible by everyone. Where should these "private" but accessible | |
3289 | EOM | |
3290 | $echo $n "files reside? (~name ok) [$dflt] $c" | |
3291 | rp="Private files will reside where? [$dflt]" | |
3292 | . myread | |
3293 | privlib=`./filexp "$ans"` | |
3294 | ||
3295 | case "$installprivlib" in | |
3296 | '') | |
3297 | dflt=`echo $privlib | sed 's#^/afs/#/afs/.#'` | |
3298 | test -d $dflt || dflt="$privlib" | |
3299 | ;; | |
3300 | *) dflt="$installprivlib" | |
3301 | ;; | |
3302 | esac | |
3303 | $cat <<EOM | |
3304 | ||
3305 | On some systems (such as afs) you have to install the library files in a | |
3306 | different directory to get them to go to the right place. Where should the | |
3307 | EOM | |
3308 | $echo $n "library files be installed? (~name ok) [$dflt] $c" | |
3309 | rp="Install private files where? [$dflt]" | |
3310 | . myread | |
3311 | installprivlib=`./filexp "$ans"` | |
3312 | ||
3313 | : check for size of random number generator | |
3314 | echo " " | |
3315 | case "$randbits" in | |
3316 | '') | |
3317 | echo "Checking to see how many bits your rand function produces..." | |
3318 | $cat >randbits.c <<'EOCP' | |
3319 | #include <stdio.h> | |
3320 | main() | |
3321 | { | |
3322 | register int i; | |
3323 | register unsigned long tmp; | |
3324 | register unsigned long max = 0L; | |
3325 | ||
3326 | for (i=1000; i; i--) { | |
3327 | tmp = (unsigned long)rand(); | |
3328 | if (tmp > max) max = tmp; | |
3329 | } | |
3330 | for (i=0; max; i++) | |
3331 | max /= 2; | |
3332 | printf("%d\n",i); | |
3333 | } | |
3334 | EOCP | |
3335 | if $cc randbits.c -o randbits >/dev/null 2>&1 ; then | |
3336 | dflt=`./randbits` | |
3337 | else | |
3338 | dflt='?' | |
3339 | echo "(I can't seem to compile the test program...)" | |
3340 | fi | |
3341 | ;; | |
3342 | *) | |
3343 | dflt="$randbits" | |
3344 | ;; | |
3345 | esac | |
3346 | rp="How many bits does your rand() function produce? [$dflt]" | |
3347 | $echo $n "$rp $c" | |
3348 | . myread | |
3349 | randbits="$ans" | |
3350 | ||
3351 | : determine where publicly executable scripts go | |
3352 | case "$scriptdir" in | |
3353 | '') | |
3354 | dflt="$bin" | |
3355 | : guess some guesses | |
3356 | test -d /usr/share/scripts && dflt=/usr/share/scripts | |
3357 | test -d /usr/share/bin && dflt=/usr/share/bin | |
3358 | ;; | |
3359 | *) dflt="$scriptdir" | |
3360 | ;; | |
3361 | esac | |
3362 | cont=true | |
3363 | $cat <<EOM | |
3364 | ||
3365 | Some installations have a separate directory just for executable scripts so | |
3366 | that they can mount it across multiple architectures but keep the scripts in | |
3367 | one spot. You might, for example, have a subdirectory of /usr/share for this. | |
3368 | Or you might just lump your scripts in with all your other executables. | |
3369 | ||
3370 | EOM | |
3371 | while $test "$cont" ; do | |
3372 | rp="Where will publicly executable scripts reside (~name ok)? [$dflt]" | |
3373 | $echo $n "$rp $c" | |
3374 | . myread | |
3375 | scriptdir="$ans" | |
3376 | scriptdir=`./filexp "$scriptdir"` | |
3377 | if test -d $scriptdir; then | |
3378 | cont='' | |
3379 | else | |
3380 | case "$fastread" in | |
3381 | yes) dflt=y;; | |
3382 | *) dflt=n;; | |
3383 | esac | |
3384 | rp="Directory $scriptdir doesn't exist. Use that name anyway? [$dflt]" | |
3385 | $echo $n "$rp $c" | |
3386 | . myread | |
3387 | dflt='' | |
3388 | case "$ans" in | |
3389 | y*) cont='';; | |
3390 | esac | |
3391 | fi | |
3392 | done | |
3393 | ||
3394 | case "$installscr" in | |
3395 | '') | |
3396 | dflt=`echo $scriptdir | sed 's#^/afs/#/afs/.#'` | |
3397 | test -d $dflt || dflt="$scriptdir" | |
3398 | ;; | |
3399 | *) dflt="$scriptdir" | |
3400 | ;; | |
3401 | esac | |
3402 | cont=true | |
3403 | $cat <<EOM | |
3404 | ||
3405 | Some installations must install scripts in a different directory than where | |
3406 | they will eventually reside. On most systems they're the same directory. | |
3407 | EOM | |
3408 | while $test "$cont" ; do | |
3409 | rp="Where do you install publicly executable scripts (~name ok)? [$dflt]" | |
3410 | $echo $n "$rp $c" | |
3411 | . myread | |
3412 | installscr="$ans" | |
3413 | installscr=`./filexp "$installscr"` | |
3414 | if test -d $installscr; then | |
3415 | cont='' | |
3416 | else | |
3417 | case "$fastread" in | |
3418 | yes) dflt=y;; | |
3419 | *) dflt=n;; | |
3420 | esac | |
3421 | rp="Directory $installscr doesn't exist. Use that name anyway? [$dflt]" | |
3422 | $echo $n "$rp $c" | |
3423 | . myread | |
3424 | dflt='' | |
3425 | case "$ans" in | |
3426 | y*) cont='';; | |
3427 | esac | |
3428 | fi | |
3429 | done | |
3430 | ||
3431 | : generate list of signal names | |
3432 | echo " " | |
3433 | case "$sig_name" in | |
3434 | '') | |
3435 | echo "Generating a list of signal names..." | |
3436 | set X `cat $usrinclude/signal.h $usrinclude/sys/signal.h 2>&1 | awk ' | |
3437 | $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ { | |
3438 | sig[$3] = substr($2,4,20) | |
3439 | if (max < $3 && $3 < 60) { | |
3440 | max = $3 | |
3441 | } | |
3442 | } | |
3443 | ||
3444 | END { | |
3445 | for (i=1; i<=max; i++) { | |
3446 | if (sig[i] == "") | |
3447 | printf "%d", i | |
3448 | else | |
3449 | printf "%s", sig[i] | |
3450 | if (i < max) | |
3451 | printf " " | |
3452 | } | |
3453 | printf "\n" | |
3454 | } | |
3455 | '` | |
3456 | shift | |
3457 | case $# in | |
3458 | 0) echo 'kill -l' >/tmp/foo$$ | |
3459 | set X `$csh -f </tmp/foo$$` | |
3460 | shift | |
3461 | case $# in | |
3462 | 0)set HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM | |
3463 | ;; | |
3464 | esac | |
3465 | ;; | |
3466 | esac | |
3467 | sig_name="ZERO $*" | |
3468 | ;; | |
3469 | esac | |
3470 | echo "Signals are: $sig_name" | |
3471 | ||
3472 | : see what type of char stdio uses. | |
3473 | echo " " | |
3474 | if $contains 'unsigned.*char.*\*.*_ptr.*;' $usrinclude/stdio.h >/dev/null 2>&1 ; then | |
3475 | echo "Your stdio uses unsigned chars." | |
3476 | stdchar="unsigned char" | |
3477 | else | |
3478 | echo "Your stdio uses signed chars." | |
3479 | stdchar="char" | |
3480 | fi | |
3481 | ||
3482 | : see what type uids are declared as in the kernel | |
3483 | case "$uidtype" in | |
3484 | '') | |
3485 | if $contains 'uid_t;' $usrinclude/sys/types.h >/dev/null 2>&1 ; then | |
3486 | dflt='uid_t'; | |
3487 | else | |
3488 | set `grep '_ruid;' $usrinclude/sys/user.h 2>/dev/null` unsigned short | |
3489 | case $1 in | |
3490 | unsigned) dflt="$1 $2" ;; | |
3491 | *) dflt="$1" ;; | |
3492 | esac | |
3493 | fi | |
3494 | ;; | |
3495 | *) dflt="$uidtype" | |
3496 | ;; | |
3497 | esac | |
3498 | cont=true | |
3499 | echo " " | |
3500 | rp="What type are user ids returned by getuid(), etc.? [$dflt]" | |
3501 | $echo $n "$rp $c" | |
3502 | . myread | |
3503 | uidtype="$ans" | |
3504 | ||
3505 | : check for void type | |
3506 | echo " " | |
3507 | $cat <<EOM | |
3508 | Checking to see how well your C compiler groks the void type... | |
3509 | ||
3510 | Support flag bits are: | |
3511 | 1: basic void declarations. | |
3512 | 2: arrays of pointers to functions returning void. | |
3513 | 4: operations between pointers to and addresses of void functions. | |
3514 | ||
3515 | EOM | |
3516 | case "$voidhave" in | |
3517 | '') | |
3518 | $cat >void.c <<'EOCP' | |
3519 | #if TRY & 1 | |
3520 | void main() { | |
3521 | #else | |
3522 | main() { | |
3523 | #endif | |
3524 | extern void moo(); /* function returning void */ | |
3525 | void (*goo)(); /* ptr to func returning void */ | |
3526 | #if TRY & 2 | |
3527 | void (*foo[10])(); | |
3528 | #endif | |
3529 | ||
3530 | #if TRY & 4 | |
3531 | if(goo == moo) { | |
3532 | exit(0); | |
3533 | } | |
3534 | #endif | |
3535 | exit(0); | |
3536 | } | |
3537 | EOCP | |
3538 | if $cc -c -DTRY=$voidwant void.c >void.out 2>&1 ; then | |
3539 | voidhave=$voidwant | |
3540 | echo "It appears to support void to the level $package wants ($voidwant)." | |
3541 | if $contains warning void.out >/dev/null 2>&1; then | |
3542 | echo "However, you might get some warnings that look like this:" | |
3543 | $cat void.out | |
3544 | fi | |
3545 | else | |
3546 | echo "Hmm, your compiler has some difficulty with void. Checking further..." | |
3547 | if $cc -c -DTRY=1 void.c >/dev/null 2>&1 ; then | |
3548 | echo "It supports 1..." | |
3549 | if $cc -c -DTRY=3 void.c >/dev/null 2>&1 ; then | |
3550 | voidhave=3 | |
3551 | echo "And it supports 2 but not 4." | |
3552 | else | |
3553 | echo "It doesn't support 2..." | |
3554 | if $cc -c -DTRY=5 void.c >/dev/null 2>&1 ; then | |
3555 | voidhave=5 | |
3556 | echo "But it supports 4." | |
3557 | else | |
3558 | voidhave=1 | |
3559 | echo "And it doesn't support 4." | |
3560 | fi | |
3561 | fi | |
3562 | else | |
3563 | echo "There is no support at all for void." | |
3564 | voidhave=0 | |
3565 | fi | |
3566 | fi | |
3567 | esac | |
3568 | dflt="$voidhave"; | |
3569 | rp="Your void support flags add up to what? [$dflt]" | |
3570 | $echo $n "$rp $c" | |
3571 | . myread | |
3572 | voidhave="$ans" | |
3573 | ||
3574 | : preserve RCS keywords in files with variable substitution, grrr | |
3575 | Log='$Log' | |
3576 | Header='$Header' | |
3577 | Id='$Id' | |
3578 | Author='$Author' | |
3579 | Date='$Date' | |
3580 | Locker='$Locker' | |
3581 | RCSfile='$RCSfile' | |
3582 | Revision='$Revision' | |
3583 | Source='$Source' | |
3584 | State='$State' | |
3585 | ||
3586 | ||
3587 | : determine compiler compiler | |
3588 | case "$yacc" in | |
3589 | '') if xenix; then | |
3590 | dflt=yacc | |
3591 | else | |
3592 | dflt='yacc -Sm25000' | |
3593 | fi | |
3594 | ;; | |
3595 | *) dflt="$yacc";; | |
3596 | esac | |
3597 | cont=true | |
3598 | echo " " | |
3599 | rp="Which compiler compiler (yacc or bison -y) will you use? [$dflt]" | |
3600 | $echo $n "$rp $c" | |
3601 | . myread | |
3602 | case "$ans" in | |
3603 | '') ans="$dflt";; | |
3604 | esac | |
3605 | yacc="$ans" | |
3606 | ||
3607 | : see if we can include fcntl.h | |
3608 | echo " " | |
3609 | if $h_fcntl; then | |
3610 | val="$define" | |
3611 | echo "We'll be including <fcntl.h>." | |
3612 | else | |
3613 | val="$undef" | |
3614 | if $h_sys_file; then | |
3615 | echo "We don't need to <fcntl.h> if we include <sys/file.h>." | |
3616 | else | |
3617 | echo "We won't be including <fcntl.h>." | |
3618 | fi | |
3619 | fi | |
3620 | set i_fcntl | |
3621 | eval $setvar | |
3622 | ||
3623 | : see if gdbm is available | |
3624 | echo " " | |
3625 | xxx=`./loc gdbm.h x $usrinclude /usr/local/include $inclwanted` | |
3626 | if test -f $xxx; then | |
3627 | val="$define" | |
3628 | echo "gdbm.h found." | |
3629 | else | |
3630 | val="$undef" | |
3631 | echo "gdbm.h NOT found." | |
3632 | fi | |
3633 | set i_gdbm | |
3634 | eval $setvar | |
3635 | ||
3636 | : see if this is an grp system | |
3637 | echo " " | |
3638 | if $test -r $usrinclude/grp.h ; then | |
3639 | val="$define" | |
3640 | echo "grp.h found." | |
3641 | else | |
3642 | val="$undef" | |
3643 | echo "No grp.h found." | |
3644 | fi | |
3645 | set i_grp | |
3646 | eval $setvar | |
3647 | ||
3648 | : see if this is a netinet/in.h or sys/in.h system | |
3649 | echo " " | |
3650 | xxx=`./loc netinet/in.h x $usrinclude /usr/local/include $inclwanted` | |
3651 | if test -f $xxx; then | |
3652 | val="$define" | |
3653 | val2="$undef" | |
3654 | echo "netinet/in.h found." | |
3655 | else | |
3656 | val="$undef" | |
3657 | echo "No netinet/in.h found, ..." | |
3658 | xxx=`./loc sys/in.h x $usrinclude /usr/local/include $inclwanted` | |
3659 | if test -f $xxx; then | |
3660 | val2="$define" | |
3661 | echo "but I found sys/in.h instead." | |
3662 | else | |
3663 | val2="$undef" | |
3664 | echo "and I didn't find sys/in.h either." | |
3665 | fi | |
3666 | fi | |
3667 | set i_niin | |
3668 | eval $setvar | |
3669 | val=$val2 | |
3670 | set i_sysin | |
3671 | eval $setvar | |
3672 | ||
3673 | : Do we need to #include <sys/file.h> ? | |
3674 | echo " " | |
3675 | if $h_sys_file; then | |
3676 | val="$define" | |
3677 | echo "We'll be including <sys/file.h>." | |
3678 | else | |
3679 | val="$undef" | |
3680 | echo "We won't be including <sys/file.h>." | |
3681 | fi | |
3682 | set i_sys_file | |
3683 | eval $setvar | |
3684 | ||
3685 | : see if ioctl defs are in sgtty/termio or sys/ioctl | |
3686 | echo " " | |
3687 | if $test -r $usrinclude/sys/ioctl.h ; then | |
3688 | val="$define" | |
3689 | echo "sys/ioctl.h found." | |
3690 | else | |
3691 | val="$undef" | |
3692 | echo "sys/ioctl.h NOT found, assuming ioctl args are defined in sgtty.h." | |
3693 | fi | |
3694 | set i_sysioctl | |
3695 | eval $setvar | |
3696 | ||
3697 | : see if we should include utime.h | |
3698 | echo " " | |
3699 | if $test -r $usrinclude/utime.h ; then | |
3700 | val="$define" | |
3701 | echo "utime.h found." | |
3702 | else | |
3703 | val="$undef" | |
3704 | echo "No utime.h found, but that's ok." | |
3705 | fi | |
3706 | set i_utime | |
3707 | eval $setvar | |
3708 | ||
3709 | : see if this is a varargs system | |
3710 | echo " " | |
3711 | if $test -r $usrinclude/varargs.h ; then | |
3712 | val="$define" | |
3713 | echo "varargs.h found." | |
3714 | else | |
3715 | val="$undef" | |
3716 | echo "No varargs.h found, but that's ok (I hope)." | |
3717 | fi | |
3718 | set i_varargs | |
3719 | eval $setvar | |
3720 | ||
3721 | : see if this is a vfork system | |
3722 | echo " " | |
3723 | if $test -r $usrinclude/vfork.h ; then | |
3724 | val="$define" | |
3725 | echo "vfork.h found." | |
3726 | else | |
3727 | val="$undef" | |
3728 | echo "No vfork.h found." | |
3729 | fi | |
3730 | set i_vfork | |
3731 | eval $setvar | |
3732 | ||
3733 | : end of configuration questions | |
3734 | echo " " | |
3735 | echo "End of configuration questions." | |
3736 | echo " " | |
3737 | ||
3738 | : create config.sh file | |
3739 | echo " " | |
3740 | if test -d ../UU; then | |
3741 | cd .. | |
3742 | fi | |
3743 | echo "Creating config.sh..." | |
3744 | test -f config.sh && cp config.sh UU/oldconfig.sh | |
3745 | $spitshell <<EOT >config.sh | |
3746 | $startsh | |
3747 | # config.sh | |
3748 | # This file was produced by running the Configure script. | |
3749 | d_eunice='$d_eunice' | |
3750 | define='$define' | |
3751 | eunicefix='$eunicefix' | |
3752 | loclist='$loclist' | |
3753 | expr='$expr' | |
3754 | sed='$sed' | |
3755 | echo='$echo' | |
3756 | cat='$cat' | |
3757 | rm='$rm' | |
3758 | mv='$mv' | |
3759 | cp='$cp' | |
3760 | tail='$tail' | |
3761 | tr='$tr' | |
3762 | mkdir='$mkdir' | |
3763 | sort='$sort' | |
3764 | uniq='$uniq' | |
3765 | grep='$grep' | |
3766 | trylist='$trylist' | |
3767 | test='$test' | |
3768 | inews='$inews' | |
3769 | egrep='$egrep' | |
3770 | more='$more' | |
3771 | pg='$pg' | |
3772 | Mcc='$Mcc' | |
3773 | vi='$vi' | |
3774 | mailx='$mailx' | |
3775 | mail='$mail' | |
3776 | cpp='$cpp' | |
3777 | perl='$perl' | |
3778 | emacs='$emacs' | |
3779 | ls='$ls' | |
3780 | rmail='$rmail' | |
3781 | sendmail='$sendmail' | |
3782 | shar='$shar' | |
3783 | smail='$smail' | |
3784 | tbl='$tbl' | |
3785 | troff='$troff' | |
3786 | nroff='$nroff' | |
3787 | uname='$uname' | |
3788 | uuname='$uuname' | |
3789 | line='$line' | |
3790 | chgrp='$chgrp' | |
3791 | chmod='$chmod' | |
3792 | lint='$lint' | |
3793 | sleep='$sleep' | |
3794 | pr='$pr' | |
3795 | tar='$tar' | |
3796 | ln='$ln' | |
3797 | lpr='$lpr' | |
3798 | lp='$lp' | |
3799 | touch='$touch' | |
3800 | make='$make' | |
3801 | date='$date' | |
3802 | csh='$csh' | |
3803 | bash='$bash' | |
3804 | ksh='$ksh' | |
3805 | lex='$lex' | |
3806 | flex='$flex' | |
3807 | bison='$bison' | |
3808 | Log='$Log' | |
3809 | Header='$Header' | |
3810 | Id='$Id' | |
3811 | lastuname='$lastuname' | |
3812 | alignbytes='$alignbytes' | |
3813 | bin='$bin' | |
3814 | installbin='$installbin' | |
3815 | byteorder='$byteorder' | |
3816 | contains='$contains' | |
3817 | cppstdin='$cppstdin' | |
3818 | cppminus='$cppminus' | |
3819 | d_bcmp='$d_bcmp' | |
3820 | d_bcopy='$d_bcopy' | |
3821 | d_safebcpy='$d_safebcpy' | |
3822 | d_bzero='$d_bzero' | |
3823 | d_castneg='$d_castneg' | |
3824 | castflags='$castflags' | |
3825 | d_charsprf='$d_charsprf' | |
3826 | d_chsize='$d_chsize' | |
3827 | d_crypt='$d_crypt' | |
3828 | cryptlib='$cryptlib' | |
3829 | d_csh='$d_csh' | |
3830 | d_dosuid='$d_dosuid' | |
3831 | d_dup2='$d_dup2' | |
3832 | d_fchmod='$d_fchmod' | |
3833 | d_fchown='$d_fchown' | |
3834 | d_fcntl='$d_fcntl' | |
3835 | d_flexfnam='$d_flexfnam' | |
3836 | d_flock='$d_flock' | |
3837 | d_getgrps='$d_getgrps' | |
3838 | d_gethent='$d_gethent' | |
3839 | d_getpgrp='$d_getpgrp' | |
3840 | d_getpgrp2='$d_getpgrp2' | |
3841 | d_getprior='$d_getprior' | |
3842 | d_htonl='$d_htonl' | |
3843 | d_index='$d_index' | |
3844 | d_isascii='$d_isascii' | |
3845 | d_killpg='$d_killpg' | |
3846 | d_lstat='$d_lstat' | |
3847 | d_memcmp='$d_memcmp' | |
3848 | d_memcpy='$d_memcpy' | |
3849 | d_safemcpy='$d_safemcpy' | |
3850 | d_memmove='$d_memmove' | |
3851 | d_memset='$d_memset' | |
3852 | d_mkdir='$d_mkdir' | |
3853 | d_msg='$d_msg' | |
3854 | d_msgctl='$d_msgctl' | |
3855 | d_msgget='$d_msgget' | |
3856 | d_msgrcv='$d_msgrcv' | |
3857 | d_msgsnd='$d_msgsnd' | |
3858 | d_ndbm='$d_ndbm' | |
3859 | d_odbm='$d_odbm' | |
3860 | d_open3='$d_open3' | |
3861 | d_readdir='$d_readdir' | |
3862 | d_rename='$d_rename' | |
3863 | d_rewindir='$d_rewindir' | |
3864 | d_rmdir='$d_rmdir' | |
3865 | d_seekdir='$d_seekdir' | |
3866 | d_select='$d_select' | |
3867 | d_sem='$d_sem' | |
3868 | d_semctl='$d_semctl' | |
3869 | d_semget='$d_semget' | |
3870 | d_semop='$d_semop' | |
3871 | d_setegid='$d_setegid' | |
3872 | d_seteuid='$d_seteuid' | |
3873 | d_setpgrp='$d_setpgrp' | |
3874 | d_setpgrp2='$d_setpgrp2' | |
3875 | d_setprior='$d_setprior' | |
3876 | d_setregid='$d_setregid' | |
3877 | d_setresgid='$d_setresgid' | |
3878 | d_setreuid='$d_setreuid' | |
3879 | d_setresuid='$d_setresuid' | |
3880 | d_setrgid='$d_setrgid' | |
3881 | d_setruid='$d_setruid' | |
3882 | d_shm='$d_shm' | |
3883 | d_shmat='$d_shmat' | |
3884 | d_voidshmat='$d_voidshmat' | |
3885 | d_shmctl='$d_shmctl' | |
3886 | d_shmdt='$d_shmdt' | |
3887 | d_shmget='$d_shmget' | |
3888 | d_socket='$d_socket' | |
3889 | d_sockpair='$d_sockpair' | |
3890 | d_oldsock='$d_oldsock' | |
3891 | socketlib='$socketlib' | |
3892 | d_statblks='$d_statblks' | |
3893 | d_stdstdio='$d_stdstdio' | |
3894 | d_strctcpy='$d_strctcpy' | |
3895 | d_strerror='$d_strerror' | |
3896 | d_symlink='$d_symlink' | |
3897 | d_syscall='$d_syscall' | |
3898 | d_telldir='$d_telldir' | |
3899 | d_truncate='$d_truncate' | |
3900 | d_vfork='$d_vfork' | |
3901 | d_voidsig='$d_voidsig' | |
3902 | d_tosignal='$d_tosignal' | |
3903 | d_volatile='$d_volatile' | |
3904 | d_vprintf='$d_vprintf' | |
3905 | d_charvspr='$d_charvspr' | |
3906 | d_wait4='$d_wait4' | |
3907 | d_waitpid='$d_waitpid' | |
3908 | gidtype='$gidtype' | |
3909 | groupstype='$groupstype' | |
3910 | i_fcntl='$i_fcntl' | |
3911 | i_gdbm='$i_gdbm' | |
3912 | i_grp='$i_grp' | |
3913 | i_niin='$i_niin' | |
3914 | i_sysin='$i_sysin' | |
3915 | i_pwd='$i_pwd' | |
3916 | d_pwquota='$d_pwquota' | |
3917 | d_pwage='$d_pwage' | |
3918 | d_pwchange='$d_pwchange' | |
3919 | d_pwclass='$d_pwclass' | |
3920 | d_pwexpire='$d_pwexpire' | |
3921 | d_pwcomment='$d_pwcomment' | |
3922 | i_sys_file='$i_sys_file' | |
3923 | i_sysioctl='$i_sysioctl' | |
3924 | i_time='$i_time' | |
3925 | i_sys_time='$i_sys_time' | |
3926 | i_sys_select='$i_sys_select' | |
3927 | d_systimekernel='$d_systimekernel' | |
3928 | i_utime='$i_utime' | |
3929 | i_varargs='$i_varargs' | |
3930 | i_vfork='$i_vfork' | |
3931 | intsize='$intsize' | |
3932 | libc='$libc' | |
3933 | nm_opts='$nm_opts' | |
3934 | libndir='$libndir' | |
3935 | i_my_dir='$i_my_dir' | |
3936 | i_ndir='$i_ndir' | |
3937 | i_sys_ndir='$i_sys_ndir' | |
3938 | i_dirent='$i_dirent' | |
3939 | i_sys_dir='$i_sys_dir' | |
3940 | d_dirnamlen='$d_dirnamlen' | |
3941 | ndirc='$ndirc' | |
3942 | ndiro='$ndiro' | |
3943 | mallocsrc='$mallocsrc' | |
3944 | mallocobj='$mallocobj' | |
3945 | d_mymalloc='$d_mymalloc' | |
3946 | mallocptrtype='$mallocptrtype' | |
3947 | mansrc='$mansrc' | |
3948 | manext='$manext' | |
3949 | models='$models' | |
3950 | split='$split' | |
3951 | small='$small' | |
3952 | medium='$medium' | |
3953 | large='$large' | |
3954 | huge='$huge' | |
3955 | optimize='$optimize' | |
3956 | ccflags='$ccflags' | |
3957 | cppflags='$cppflags' | |
3958 | ldflags='$ldflags' | |
3959 | cc='$cc' | |
3960 | nativegcc='$nativegcc' | |
3961 | libs='$libs' | |
3962 | n='$n' | |
3963 | c='$c' | |
3964 | package='$package' | |
3965 | randbits='$randbits' | |
3966 | scriptdir='$scriptdir' | |
3967 | installscr='$installscr' | |
3968 | sig_name='$sig_name' | |
3969 | spitshell='$spitshell' | |
3970 | shsharp='$shsharp' | |
3971 | sharpbang='$sharpbang' | |
3972 | startsh='$startsh' | |
3973 | stdchar='$stdchar' | |
3974 | uidtype='$uidtype' | |
3975 | usrinclude='$usrinclude' | |
3976 | inclPath='$inclPath' | |
3977 | void='$void' | |
3978 | voidhave='$voidhave' | |
3979 | voidwant='$voidwant' | |
3980 | w_localtim='$w_localtim' | |
3981 | w_s_timevl='$w_s_timevl' | |
3982 | w_s_tm='$w_s_tm' | |
3983 | yacc='$yacc' | |
3984 | lib='$lib' | |
3985 | privlib='$privlib' | |
3986 | installprivlib='$installprivlib' | |
3987 | EOT | |
3988 | ||
3989 | test -f patchlevel.h && awk '{printf "%s=%s\n",$2,$3}' patchlevel.h >>config.sh | |
3990 | echo "CONFIG=true" >>config.sh | |
3991 | ||
3992 | if test -f UU/oldconfig.sh; then | |
3993 | sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\ | |
3994 | sort | uniq -u >UU/oldsyms | |
3995 | set X `cat UU/oldsyms` | |
3996 | shift | |
3997 | case $# in | |
3998 | 0) ;; | |
3999 | *) echo "Hmm...You had some extra variables I don't know about...I'll try to keep 'em..." | |
4000 | for sym in `cat UU/oldsyms`; do | |
4001 | echo " Propagating $hint variable "'$'"$sym..." | |
4002 | eval 'tmp="$'"${sym}"'"' | |
4003 | echo "$tmp" | \ | |
4004 | sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh | |
4005 | done | |
4006 | ;; | |
4007 | esac | |
4008 | fi | |
4009 | ||
4010 | : Finish up | |
4011 | CONFIG=true | |
4012 | ||
4013 | echo " " | |
4014 | dflt='' | |
4015 | fastread='' | |
4016 | echo "If you didn't make any mistakes, then just type a carriage return here." | |
4017 | rp="If you need to edit config.sh, do it as a shell escape here:" | |
4018 | $echo $n "$rp $c" | |
4019 | . UU/myread | |
4020 | case "$ans" in | |
4021 | '') ;; | |
4022 | *) : in case they cannot read | |
4023 | eval $ans;; | |
4024 | esac | |
4025 | chmod +x doSH | |
4026 | ./doSH | |
4027 | ||
4028 | if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then | |
4029 | dflt=n | |
4030 | $cat <<EOM | |
4031 | ||
4032 | Now you need to generate make dependencies by running "make depend". | |
4033 | You might prefer to run it in background: "make depend > makedepend.out &" | |
4034 | It can take a while, so you might not want to run it right now. | |
4035 | ||
4036 | EOM | |
4037 | rp="Run make depend now? [$dflt]" | |
4038 | $echo $n "$rp $c" | |
4039 | . UU/myread | |
4040 | case "$ans" in | |
4041 | y*) make depend && echo "Now you must run a make." | |
4042 | ;; | |
4043 | *) echo "You must run 'make depend' then 'make'." | |
4044 | ;; | |
4045 | esac | |
4046 | elif test -f [Mm]akefile; then | |
4047 | echo " " | |
4048 | echo "Now you must run a make." | |
4049 | else | |
4050 | echo "Done." | |
4051 | fi | |
4052 | ||
4053 | $rm -f kit*isdone | |
4054 | $rm -rf UU | |
4055 | : end of Configure |