Commit | Line | Data |
---|---|---|
2304df62 AD |
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, | |
7 | # I would suggest you have a look at the prototypical config_h.SH file | |
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 | # Yes, you may rip this off to use in other distribution packages. This | |
12 | # script belongs to the public domain and cannot be copyrighted. | |
13 | # | |
14 | # (Note: this Configure script was generated automatically. Rather than | |
15 | # working with this copy of Configure, you may wish to get metaconfig. | |
16 | # The dist-3.0 package (which contains metaconfig) was posted in | |
17 | # comp.sources.misc so you may fetch it yourself from your nearest | |
18 | # archive site. Check with Archie if you don't know where that can be.) | |
19 | # | |
20 | ||
21 | # $Id: Head.U,v 3.0.1.3 1993/12/15 08:15:07 ram Exp $ | |
22 | # | |
85e6fe83 | 23 | # Generated on Wed May 4 14:59:36 EDT 1994 [metaconfig 3.0 PL22] |
2304df62 AD |
24 | |
25 | cat >/tmp/c1$$ <<EOF | |
26 | ARGGGHHHH!!!!! | |
27 | ||
28 | SCO csh still thinks true is false. Write to SCO today and tell them that next | |
29 | year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-) | |
30 | ||
31 | (Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All | |
32 | we'd have to do is go in and swap the && and || tokens, wherever they are.) | |
33 | ||
34 | [End of diatribe. We now return you to your regularly scheduled programming...] | |
35 | EOF | |
36 | cat >/tmp/c2$$ <<EOF | |
37 | ||
38 | OOPS! You naughty creature! You didn't run Configure with sh! | |
39 | I will attempt to remedy the situation by running sh for you... | |
40 | EOF | |
41 | ||
42 | true || cat /tmp/c1$$ /tmp/c2$$ | |
43 | true || exec sh $0 $argv:q | |
44 | ||
45 | (exit $?0) || cat /tmp/c2$$ | |
46 | (exit $?0) || exec sh $0 $argv:q | |
47 | rm -f /tmp/c1$$ /tmp/c2$$ | |
48 | ||
49 | : Sanity checks | |
50 | PATH=".:$PATH:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin" | |
51 | PATH=$PATH:'/usr/5bin:/etc:/usr/gnu/bin:/usr/new:/usr/new/bin:/usr/nbin' | |
52 | PATH=$PATH:'/sys5.3/bin:/sys5.3/usr/bin:/bsd4.3/bin:/bsd4.3/usr/ucb' | |
53 | PATH=$PATH:'/bsd4.3/usr/bin:/usr/bsd:/bsd43/bin:/usr/ccs/bin' | |
54 | PATH=$PATH:'/etc:/usr/lib:/usr/ucblib:/lib:/usr/ccs/lib' | |
55 | PATH=$PATH:'/sbin:/usr/sbin:/usr/libexec' | |
56 | export PATH | |
57 | ||
58 | if test ! -t 0; then | |
59 | echo "Say 'sh Configure', not 'sh <Configure'" | |
60 | exit 1 | |
61 | fi | |
62 | ||
63 | : On HP-UX, large Configure scripts may exercise a bug in /bin/sh | |
64 | if test -f /hp-ux -a -f /bin/ksh; then | |
65 | if (PATH=.; alias -x) >/dev/null 2>&1; then | |
66 | : already under /bin/ksh | |
67 | else | |
68 | cat <<'EOM' | |
69 | (Feeding myself to ksh to avoid nasty sh bug in "here document" expansion.) | |
70 | EOM | |
71 | exec /bin/ksh $0 "$@" | |
72 | fi | |
73 | else | |
74 | : Warn them if they use ksh on other systems | |
75 | (PATH=.; alias -x) >/dev/null 2>&1 && \ | |
76 | cat <<'EOM' | |
77 | (I see you are using the Korn shell. Some ksh's blow up on Configure, | |
78 | especially on exotic machines. If yours does, try the Bourne shell instead.) | |
79 | EOM | |
80 | fi | |
81 | ||
82 | : Configure runs within the UU subdirectory | |
83 | test -d UU || mkdir UU | |
84 | cd UU && rm -f * | |
85 | ||
86 | extensions='' | |
2304df62 AD |
87 | d_eunice='' |
88 | d_xenix='' | |
89 | eunicefix='' | |
90 | Mcc='' | |
91 | awk='' | |
92 | bash='' | |
93 | bison='' | |
94 | byacc='' | |
95 | cat='' | |
96 | chgrp='' | |
97 | chmod='' | |
98 | chown='' | |
99 | compress='' | |
100 | cp='' | |
101 | cpio='' | |
102 | cpp='' | |
103 | csh='' | |
104 | date='' | |
105 | echo='' | |
106 | egrep='' | |
107 | emacs='' | |
108 | expr='' | |
109 | find='' | |
110 | flex='' | |
111 | gcc='' | |
112 | grep='' | |
113 | inews='' | |
114 | ksh='' | |
115 | less='' | |
116 | line='' | |
117 | lint='' | |
118 | ln='' | |
119 | lp='' | |
120 | lpr='' | |
121 | ls='' | |
122 | mail='' | |
123 | mailx='' | |
124 | make='' | |
125 | mkdir='' | |
126 | more='' | |
127 | mv='' | |
128 | nroff='' | |
129 | perl='' | |
130 | pg='' | |
131 | pmake='' | |
132 | pr='' | |
133 | rm='' | |
134 | rmail='' | |
135 | sed='' | |
136 | sendmail='' | |
137 | sh='' | |
138 | shar='' | |
139 | sleep='' | |
140 | smail='' | |
141 | sort='' | |
142 | submit='' | |
143 | tail='' | |
144 | tar='' | |
145 | tbl='' | |
146 | test='' | |
147 | touch='' | |
148 | tr='' | |
149 | troff='' | |
150 | uname='' | |
151 | uniq='' | |
152 | uuname='' | |
153 | vi='' | |
154 | zcat='' | |
155 | hint='' | |
156 | myuname='' | |
85e6fe83 LW |
157 | osname='' |
158 | osvers='' | |
2304df62 AD |
159 | Author='' |
160 | Date='' | |
161 | Header='' | |
162 | Id='' | |
163 | Locker='' | |
164 | Log='' | |
165 | RCSfile='' | |
166 | Revision='' | |
167 | Source='' | |
168 | State='' | |
169 | afs='' | |
85e6fe83 | 170 | memalignbytes='' |
2304df62 AD |
171 | bin='' |
172 | binexp='' | |
173 | installbin='' | |
174 | byteorder='' | |
175 | cc='' | |
176 | gccversion='' | |
177 | ccflags='' | |
178 | cppflags='' | |
179 | ldflags='' | |
180 | lkflags='' | |
181 | optimize='' | |
182 | cf_by='' | |
183 | cf_time='' | |
184 | contains='' | |
185 | cpplast='' | |
186 | cppminus='' | |
187 | cpprun='' | |
188 | cppstdin='' | |
189 | d_access='' | |
190 | d_bcmp='' | |
191 | d_bcopy='' | |
192 | d_bzero='' | |
193 | d_casti32='' | |
194 | castflags='' | |
195 | d_castneg='' | |
196 | d_charsprf='' | |
197 | d_chsize='' | |
198 | d_const='' | |
199 | cryptlib='' | |
200 | d_crypt='' | |
201 | d_csh='' | |
202 | d_dosuid='' | |
203 | d_dup2='' | |
204 | d_fchmod='' | |
205 | d_fchown='' | |
206 | d_fcntl='' | |
207 | d_flexfnam='' | |
208 | d_flock='' | |
209 | d_getgrps='' | |
210 | d_gethent='' | |
211 | aphostname='' | |
212 | d_gethname='' | |
213 | d_phostname='' | |
214 | d_uname='' | |
215 | d_getpgrp2='' | |
216 | d_getpgrp='' | |
217 | d_getprior='' | |
218 | d_htonl='' | |
219 | d_isascii='' | |
220 | d_killpg='' | |
221 | d_link='' | |
222 | d_lstat='' | |
223 | d_memcmp='' | |
224 | d_memcpy='' | |
225 | d_memmove='' | |
226 | d_memset='' | |
227 | d_mkdir='' | |
228 | d_msg='' | |
229 | d_msgctl='' | |
230 | d_msgget='' | |
231 | d_msgrcv='' | |
232 | d_msgsnd='' | |
233 | d_open3='' | |
234 | d_portable='' | |
235 | d_readdir='' | |
85e6fe83 LW |
236 | d_rewinddir='' |
237 | d_seekdir='' | |
238 | d_telldir='' | |
2304df62 AD |
239 | d_rename='' |
240 | d_rmdir='' | |
241 | d_safebcpy='' | |
242 | d_safemcpy='' | |
243 | d_select='' | |
244 | d_sem='' | |
245 | d_semctl='' | |
246 | d_semget='' | |
247 | d_semop='' | |
248 | d_setegid='' | |
249 | d_seteuid='' | |
250 | d_setlocale='' | |
251 | d_setpgid='' | |
252 | d_setpgrp2='' | |
253 | d_bsdpgrp='' | |
254 | d_setpgrp='' | |
255 | d_setprior='' | |
256 | d_setregid='' | |
257 | d_setresgid='' | |
258 | d_setresuid='' | |
259 | d_setreuid='' | |
260 | d_setrgid='' | |
261 | d_setruid='' | |
262 | d_setsid='' | |
263 | d_shm='' | |
264 | d_shmat='' | |
85e6fe83 | 265 | d_voidshmat='' |
2304df62 AD |
266 | d_shmctl='' |
267 | d_shmdt='' | |
268 | d_shmget='' | |
269 | d_oldsock='' | |
270 | d_socket='' | |
271 | d_sockpair='' | |
272 | sockethdr='' | |
273 | socketlib='' | |
274 | d_statblks='' | |
275 | d_stdstdio='' | |
276 | d_index='' | |
277 | d_strchr='' | |
278 | d_strctcpy='' | |
279 | d_strerrm='' | |
280 | d_strerror='' | |
281 | d_sysernlst='' | |
282 | d_syserrlst='' | |
283 | d_symlink='' | |
284 | d_syscall='' | |
285 | d_system='' | |
85e6fe83 LW |
286 | d_time='' |
287 | timetype='' | |
2304df62 AD |
288 | clocktype='' |
289 | d_times='' | |
290 | d_truncate='' | |
291 | d_usendir='' | |
292 | i_ndir='' | |
293 | ndirc='' | |
294 | ndirlib='' | |
295 | ndiro='' | |
296 | d_vfork='' | |
297 | d_voidsig='' | |
298 | signal_t='' | |
299 | d_volatile='' | |
300 | d_charvspr='' | |
301 | d_vprintf='' | |
302 | d_wait4='' | |
303 | d_waitpid='' | |
85e6fe83 LW |
304 | cccdlflags='' |
305 | ccdlflags='' | |
306 | dldir='' | |
2304df62 AD |
307 | dlobj='' |
308 | dlsrc='' | |
85e6fe83 LW |
309 | lddlflags='' |
310 | shlibsuffix='' | |
2304df62 AD |
311 | usedl='' |
312 | gidtype='' | |
313 | groupstype='' | |
314 | h_fcntl='' | |
315 | h_sysfile='' | |
316 | i_dbm='' | |
317 | d_dirnamlen='' | |
318 | i_dirent='' | |
319 | i_dlfcn='' | |
320 | i_fcntl='' | |
321 | i_gdbm='' | |
322 | i_grp='' | |
85e6fe83 | 323 | i_memory='' |
2304df62 | 324 | i_ndbm='' |
85e6fe83 | 325 | i_neterrno='' |
2304df62 AD |
326 | i_niin='' |
327 | i_sysin='' | |
328 | d_pwage='' | |
329 | d_pwchange='' | |
330 | d_pwclass='' | |
331 | d_pwcomment='' | |
332 | d_pwexpire='' | |
333 | d_pwquota='' | |
334 | i_pwd='' | |
85e6fe83 | 335 | i_sdbm='' |
2304df62 AD |
336 | i_stdarg='' |
337 | i_stddef='' | |
338 | i_string='' | |
339 | strings='' | |
340 | i_sysdir='' | |
341 | i_sysfile='' | |
342 | d_voidtty='' | |
343 | i_bsdioctl='' | |
344 | i_sysioctl='' | |
345 | i_syssockio='' | |
346 | i_sysndir='' | |
347 | i_sysselct='' | |
348 | i_sgtty='' | |
349 | i_termio='' | |
350 | i_termios='' | |
351 | i_systime='' | |
352 | i_systimek='' | |
353 | i_time='' | |
354 | timeincl='' | |
85e6fe83 | 355 | i_unistd='' |
2304df62 AD |
356 | i_utime='' |
357 | i_varargs='' | |
358 | i_varhdr='' | |
359 | i_vfork='' | |
360 | intsize='' | |
361 | lib='' | |
362 | libexp='' | |
363 | libc='' | |
364 | libpth='' | |
365 | plibpth='' | |
366 | xlibpth='' | |
367 | libs='' | |
85e6fe83 LW |
368 | lns='' |
369 | lseektype='' | |
370 | d_mymalloc='' | |
2304df62 AD |
371 | mallocobj='' |
372 | mallocsrc='' | |
373 | malloctype='' | |
374 | usemymalloc='' | |
375 | installmansrc='' | |
376 | manext='' | |
377 | mansrc='' | |
378 | mansrcexp='' | |
379 | huge='' | |
380 | large='' | |
381 | medium='' | |
382 | models='' | |
383 | small='' | |
384 | split='' | |
385 | mydomain='' | |
386 | myhostname='' | |
387 | phostname='' | |
388 | c='' | |
389 | n='' | |
390 | groupcat='' | |
391 | hostcat='' | |
392 | passcat='' | |
85e6fe83 LW |
393 | orderlib='' |
394 | ranlib='' | |
2304df62 AD |
395 | package='' |
396 | spackage='' | |
397 | installprivlib='' | |
398 | privlib='' | |
399 | privlibexp='' | |
400 | prototype='' | |
85e6fe83 | 401 | ptrsize='' |
2304df62 AD |
402 | randbits='' |
403 | installscript='' | |
404 | scriptdir='' | |
405 | scriptdirexp='' | |
406 | sig_name='' | |
407 | sharpbang='' | |
408 | shsharp='' | |
409 | spitshell='' | |
410 | startsh='' | |
411 | stdchar='' | |
412 | sysman='' | |
413 | uidtype='' | |
414 | nm_opt='' | |
415 | runnm='' | |
416 | usenm='' | |
417 | incpath='' | |
418 | mips='' | |
419 | mips_type='' | |
420 | usrinc='' | |
421 | defvoidused='' | |
422 | voidflags='' | |
423 | yacc='' | |
424 | yaccflags='' | |
425 | CONFIG='' | |
426 | ||
427 | : script used to extract .SH files with variable substitutions | |
428 | cat >extract <<'EOS' | |
429 | CONFIG=true | |
430 | echo "Doing variable substitutions on .SH files..." | |
431 | if test -f MANIFEST; then | |
432 | set x `awk '{print $1}' <MANIFEST | grep '\.SH'` | |
433 | else | |
434 | echo "(Looking for .SH files under the current directory.)" | |
435 | set x `find . -name "*.SH" -print` | |
436 | fi | |
437 | shift | |
438 | case $# in | |
439 | 0) set x *.SH; shift;; | |
440 | esac | |
441 | if test ! -f $1; then | |
442 | shift | |
443 | fi | |
444 | for file in $*; do | |
445 | case "$file" in | |
446 | */*) | |
447 | dir=`expr X$file : 'X\(.*\)/'` | |
448 | file=`expr X$file : 'X.*/\(.*\)'` | |
449 | (cd $dir && . ./$file) | |
450 | ;; | |
451 | *) | |
452 | . ./$file | |
453 | ;; | |
454 | esac | |
455 | done | |
456 | if test -f config_h.SH; then | |
457 | if test ! -f config.h; then | |
458 | : oops, they left it out of MANIFEST, probably, so do it anyway. | |
459 | . ./config_h.SH | |
460 | fi | |
461 | fi | |
462 | EOS | |
463 | ||
464 | : produce awk script to parse command line options | |
465 | cat >options.awk <<'EOF' | |
466 | BEGIN { | |
467 | optstr = "deEf:hrsSV"; # getopt-style specification | |
468 | ||
469 | len = length(optstr); | |
470 | for (i = 1; i <= len; i++) { | |
471 | c = substr(optstr, i, 1); | |
472 | if (i < len) a = substr(optstr, i + 1, 1); else a = ""; | |
473 | if (a == ":") { | |
474 | arg[c] = 1; | |
475 | i++; | |
476 | } | |
477 | opt[c] = 1; | |
478 | } | |
479 | } | |
480 | { | |
481 | expect = 0; | |
482 | str = $0; | |
483 | if (substr(str, 1, 1) != "-") { | |
484 | printf("'%s'\n", str); | |
485 | next; | |
486 | } | |
487 | len = length($0); | |
488 | for (i = 2; i <= len; i++) { | |
489 | c = substr(str, i, 1); | |
490 | if (!opt[c]) { | |
491 | printf("-%s\n", substr(str, i)); | |
492 | next; | |
493 | } | |
494 | printf("-%s\n", c); | |
495 | if (arg[c]) { | |
496 | if (i < len) | |
497 | printf("'%s'\n", substr(str, i + 1)); | |
498 | else | |
499 | expect = 1; | |
500 | next; | |
501 | } | |
502 | } | |
503 | } | |
504 | END { | |
505 | if (expect) | |
506 | print "?"; | |
507 | } | |
508 | EOF | |
509 | ||
510 | : process the command line options | |
511 | set X `for arg in "$@"; do echo $arg; done | awk -f options.awk` | |
512 | eval "set $*" | |
513 | shift | |
514 | rm -f options.awk | |
515 | ||
516 | : set up default values | |
517 | fastread='' | |
518 | reuseval=false | |
519 | config_sh='' | |
520 | alldone='' | |
521 | error='' | |
522 | silent='' | |
523 | extractsh='' | |
524 | ||
525 | : option parsing | |
526 | while test $# -gt 0; do | |
527 | case "$1" in | |
528 | -d) shift; fastread=yes;; | |
529 | -e) shift; alldone=cont;; | |
530 | -f) | |
531 | shift | |
532 | cd .. | |
533 | if test -r "$1"; then | |
534 | config_sh="$1" | |
535 | else | |
536 | echo "Configure: cannot read config file $1." >&2 | |
537 | error=true | |
538 | fi | |
539 | cd UU | |
540 | shift;; | |
541 | -h) shift; error=true;; | |
542 | -r) shift; reuseval=true;; | |
543 | -s) shift; silent=true;; | |
544 | -E) shift; alldone=exit;; | |
545 | -S) shift; extractsh=true;; | |
546 | -V) echo "Configure generated by metaconfig 3.0 PL22." >&2 | |
547 | exit 0;; | |
548 | --) break;; | |
549 | -*) echo "Configure: unknown option $1" >&2; shift; error=true;; | |
550 | *) break;; | |
551 | esac | |
552 | done | |
553 | ||
554 | case "$error" in | |
555 | true) | |
556 | cat >&2 <<EOM | |
557 | Usage: Configure [-dehrESV] [-f config.sh] | |
558 | -d : use defaults for all answers. | |
559 | -e : go on without questioning past the production of config.sh. | |
560 | -f : specify an alternate default configuration file. | |
561 | -h : print this help message and exit (with an error status). | |
562 | -r : reuse C symbols value if possible (skips costly nm extraction). | |
563 | -s : silent mode, only echoes questions and essential information. | |
564 | -E : stop at the end of questions, after having produced config.sh. | |
565 | -S : perform variable substitutions on all .SH files (can mix with -f) | |
566 | -V : print version number and exit (with a zero status). | |
567 | EOM | |
568 | exit 1 | |
569 | ;; | |
570 | esac | |
571 | ||
572 | exec 4>&1 | |
573 | case "$silent" in | |
574 | true) exec 1>/dev/null;; | |
575 | esac | |
576 | ||
577 | case "$extractsh" in | |
578 | true) | |
579 | case "$config_sh" in | |
580 | '') config_sh='config.sh'; config='./config.sh';; | |
581 | /*) config="$config_sh";; | |
582 | *) config="./$config_sh";; | |
583 | esac | |
584 | echo " " | |
585 | echo "Fetching answers from $config_sh..." | |
586 | cd .. | |
587 | . $config | |
588 | echo " " | |
589 | . ./UU/extract | |
590 | rm -rf UU | |
591 | echo "Done." | |
592 | exit 0 | |
593 | ;; | |
594 | esac | |
595 | ||
596 | : set package name | |
85e6fe83 | 597 | package=perl5 |
2304df62 AD |
598 | |
599 | : Eunice requires " " instead of "", can you believe it | |
600 | echo " " | |
601 | : Here we go... | |
602 | echo "Beginning of configuration questions for $package." | |
603 | ||
604 | define='define' | |
605 | undef='undef' | |
606 | smallmach='pdp11 i8086 z8000 i80286 iAPX286' | |
607 | rmlist='' | |
608 | ||
609 | trap 'echo " "; rm -rf $rmlist; exit 1' 1 2 3 15 | |
610 | ||
611 | : We must find out about Eunice early | |
612 | eunicefix=':' | |
613 | if test -f /etc/unixtovms; then | |
614 | eunicefix=/etc/unixtovms | |
615 | fi | |
616 | if test -f /etc/unixtovms.exe; then | |
617 | eunicefix=/etc/unixtovms.exe | |
618 | fi | |
619 | ||
620 | : list of known cpp symbols | |
621 | attrlist="__alpha __bsdi__ BSD_NET2 DGUX M_I186 M_I286 M_I386" | |
622 | attrlist="$attrlist M_I8086 M_XENIX UTS __DGUX__" | |
623 | attrlist="$attrlist _AIX __STDC__ __m88k__ ansi bsd4_2 gcos gimpel" | |
624 | attrlist="$attrlist hp9000s300 hp9000s400 hp9000s500 hp9000s700" | |
625 | attrlist="$attrlist hp9000s800 hpux" | |
626 | attrlist="$attrlist i186 i386 i486 i8086 iAPX286 ibm interdata" | |
627 | attrlist="$attrlist m88k mc300 mc500 mc68000 mc68k mc700 mert" | |
628 | attrlist="$attrlist mips NeXT ns16000 ns32000 nsc32000 os" | |
629 | attrlist="$attrlist __osf__ pdp11 posix" | |
630 | attrlist="$attrlist pyr sinix sony sparc sun tower tower32 tower32_600" | |
631 | attrlist="$attrlist tower32_800 tss u3b2 u3b20 u3b200 u3b5 ultrix unix" | |
632 | attrlist="$attrlist __unix__ vax venix xenix z8000" | |
633 | ||
634 | i_whoami='' | |
635 | : List of extensions we want: | |
636 | extensions='' | |
637 | gccversion='' | |
638 | : no include file wanted by default | |
639 | inclwanted='' | |
640 | ||
85e6fe83 LW |
641 | : File to use for dynamic loading |
642 | usedl='' | |
643 | gidtype='' | |
2304df62 AD |
644 | groupstype='' |
645 | : change the next line if compiling for Xenix/286 on Xenix/386 | |
646 | xlibpth='/usr/lib/386 /lib/386' | |
647 | ||
648 | : general looking path for locating libraries | |
649 | libpth="/usr/lib/large /lib /usr/lib $xlibpth /lib/large" | |
650 | libpth="$libpth /usr/lib/small /lib/small" | |
651 | libpth="$libpth /usr/ccs/lib /usr/ucblib /usr/local/lib" | |
652 | ||
653 | : Private path used by Configure to find libraries. Its value | |
654 | : is prepend to libpth. This variable takes care of special | |
655 | : machines, like the mips. Usually, it should be empty. | |
656 | plibpth='' | |
657 | ||
85e6fe83 | 658 | libswanted=" net socket inet nsl nm sdbm gdbm ndbm dbm malloc dl dld sun m c_s posix cposix ndir dir ucb bsd BSD PW x " |
2304df62 AD |
659 | |
660 | : full support for void wanted by default | |
661 | defvoidused=15 | |
662 | ||
663 | ||
664 | : Some greps do not return status, grrr. | |
665 | echo "grimblepritz" >grimble | |
666 | if grep blurfldyick grimble >/dev/null 2>&1 ; then | |
667 | contains=contains | |
668 | elif grep grimblepritz grimble >/dev/null 2>&1 ; then | |
669 | contains=grep | |
670 | else | |
671 | contains=contains | |
672 | fi | |
673 | rm -f grimble | |
674 | : the following should work in any shell | |
675 | case "$contains" in | |
676 | contains*) | |
677 | echo " " | |
678 | echo "AGH! Grep doesn't return a status. Attempting remedial action." | |
679 | cat >contains <<'EOSS' | |
680 | grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp | |
681 | EOSS | |
682 | chmod +x contains | |
683 | esac | |
684 | ||
685 | : first determine how to suppress newline on echo command | |
686 | echo " " | |
687 | echo "Checking echo to see how to suppress newlines..." | |
688 | (echo "hi there\c" ; echo " ") >.echotmp | |
689 | if $contains c .echotmp >/dev/null 2>&1 ; then | |
690 | echo "...using -n." | |
691 | n='-n' | |
692 | c='' | |
693 | else | |
694 | cat <<'EOM' | |
695 | ...using \c | |
696 | EOM | |
697 | n='' | |
698 | c='\c' | |
699 | fi | |
700 | echo $n "The star should be here-->$c" | |
701 | echo '*' | |
702 | rm -f .echotmp | |
703 | ||
704 | : Now test for existence of everything in MANIFEST | |
705 | echo " " | |
706 | if test -f ../MANIFEST; then | |
707 | echo "First let's make sure your kit is complete. Checking..." >&4 | |
708 | awk '$1 !~ /PACK[A-Z]+/ {print $1}' ../MANIFEST | split -50 | |
709 | rm -f missing | |
710 | for filelist in x??; do | |
711 | (cd ..; ls `cat UU/$filelist` >/dev/null 2>>UU/missing) | |
712 | done | |
713 | if test -s missing; then | |
714 | cat missing >&4 | |
715 | cat >&4 <<'EOM' | |
716 | ||
717 | THIS PACKAGE SEEMS TO BE INCOMPLETE. | |
718 | ||
719 | You have the option of continuing the configuration process, despite the | |
720 | distinct possibility that your kit is damaged, by typing 'y'es. If you | |
721 | do, don't blame me if something goes wrong. I advise you to type 'n'o | |
722 | and contact the author (lwall@netlabs.com). | |
723 | ||
724 | EOM | |
725 | echo $n "Continue? [n] $c" >&4 | |
726 | read ans | |
727 | case "$ans" in | |
728 | y*) | |
729 | echo "Continuing..." >&4 | |
730 | rm -f missing | |
731 | ;; | |
732 | *) | |
733 | echo "ABORTING..." >&4 | |
734 | kill $$ | |
735 | ;; | |
736 | esac | |
737 | else | |
738 | echo "Looks good..." >&4 | |
739 | fi | |
740 | else | |
741 | echo "There is no MANIFEST file. I hope your kit is complete !" | |
742 | fi | |
743 | rm -f missing x?? | |
744 | ||
745 | : compute the number of columns on the terminal for proper question formatting | |
746 | case "$COLUMNS" in | |
747 | '') COLUMNS='80';; | |
748 | esac | |
749 | ||
750 | : set up the echo used in my read | |
751 | myecho="case \"\$xxxm\" in | |
752 | '') echo $n \"\$rp $c\" >&4;; | |
753 | *) case \"\$rp\" in | |
754 | '') echo $n \"[\$xxxm] $c\";; | |
755 | *) | |
756 | if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then | |
757 | echo \"\$rp\" >&4 | |
758 | echo $n \"[\$xxxm] $c\" >&4 | |
759 | else | |
760 | echo $n \"\$rp [\$xxxm] $c\" >&4 | |
761 | fi | |
762 | ;; | |
763 | esac;; | |
764 | esac" | |
765 | ||
766 | : now set up to do reads with possible shell escape and default assignment | |
767 | cat <<EOSC >myread | |
768 | xxxm=\$dflt | |
769 | $myecho | |
770 | ans='!' | |
771 | case "\$fastread" in | |
772 | yes) case "\$dflt" in | |
773 | '') ;; | |
774 | *) ans=''; | |
775 | case "\$silent-\$rp" in | |
776 | true-) ;; | |
777 | *) echo " " >&4;; | |
778 | esac;; | |
779 | esac;; | |
780 | *) case "\$silent" in | |
781 | true) case "\$rp" in | |
782 | '') ans='';; | |
783 | esac;; | |
784 | esac;; | |
785 | esac | |
786 | while expr "X\$ans" : "X!" >/dev/null; do | |
787 | read answ | |
788 | set x \$xxxm | |
789 | shift | |
790 | aok=''; eval "ans=\"\$answ\"" && aok=y | |
791 | case "\$answ" in | |
792 | "\$ans") | |
793 | case "\$ans" in | |
794 | "!") | |
795 | sh 1>&4 | |
796 | echo " " | |
797 | $myecho | |
798 | ;; | |
799 | !*) | |
800 | set x \`expr "X\$ans" : "X!\(.*\)\$"\` | |
801 | shift | |
802 | sh 1>&4 -c "\$*" | |
803 | echo " " | |
804 | $myecho | |
805 | ;; | |
806 | esac;; | |
807 | *) | |
808 | case "\$aok" in | |
809 | y) | |
810 | echo "*** Substitution done -- please confirm." | |
811 | xxxm="\$ans" | |
812 | ans=\`echo $n "\$ans$c" | tr '\012' ' '\` | |
813 | xxxm="\$ans" | |
814 | ans=! | |
815 | ;; | |
816 | *) | |
817 | echo "*** Error -- try again." | |
818 | ans=! | |
819 | ;; | |
820 | esac | |
821 | $myecho | |
822 | ;; | |
823 | esac | |
824 | case "\$ans\$xxxm\$nostick" in | |
825 | '') | |
826 | ans=! | |
827 | $myecho | |
828 | ;; | |
829 | esac | |
830 | done | |
831 | case "\$ans" in | |
832 | '') ans="\$xxxm";; | |
833 | esac | |
834 | EOSC | |
835 | ||
836 | : create .config dir to save info across Configure sessions | |
837 | test -d ../.config || mkdir ../.config | |
838 | cat >../.config/README <<EOF | |
839 | This directory created by Configure to save information that should | |
840 | persist across sessions. | |
841 | ||
842 | You may safely delete it if you wish. | |
843 | EOF | |
844 | ||
845 | : general instructions | |
846 | needman=true | |
847 | firsttime=true | |
848 | user=`( (logname) 2>/dev/null || whoami) 2>&1` | |
849 | if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then | |
850 | firsttime=false | |
851 | echo " " | |
852 | rp='Would you like to see the instructions?' | |
853 | dflt=n | |
854 | . ./myread | |
855 | case "$ans" in | |
856 | [yY]*) ;; | |
857 | *) needman=false;; | |
858 | esac | |
859 | fi | |
860 | if $needman; then | |
861 | cat <<EOH | |
862 | ||
863 | This installation shell script will examine your system and ask you questions | |
864 | to determine how the perl package should be installed. If you get | |
865 | stuck on a question, you may use a ! shell escape to start a subshell or | |
866 | execute a command. Many of the questions will have default answers in square | |
867 | brackets; typing carriage return will give you the default. | |
868 | ||
869 | On some of the questions which ask for file or directory names you are allowed | |
870 | to use the ~name construct to specify the login directory belonging to "name", | |
871 | even if you don't have a shell which knows about that. Questions where this is | |
872 | allowed will be marked "(~name ok)". | |
873 | ||
874 | EOH | |
875 | rp='' | |
876 | dflt='Type carriage return to continue' | |
877 | . ./myread | |
878 | cat <<'EOH' | |
879 | ||
880 | The prompter used in this script allows you to use shell variables and | |
881 | backticks in your answers. You may use $1, $2, etc... to refer to the words | |
882 | in the default answer, as if the default line was a set of arguments given to a | |
883 | script shell. This means you may also use $* to repeat the whole default line, | |
884 | so you do not have to re-type everything to add something to the default. | |
885 | ||
886 | Everytime there is a substitution, you will have to confirm. If there is an | |
887 | error (e.g. an unmatched backtick), the default answer will remain unchanged | |
888 | and you will be prompted again. | |
889 | ||
890 | If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all | |
891 | the questions and use the computed defaults (or the previous answers if there | |
892 | was already a config.sh file). Type 'Configure -h' for a list of options. | |
893 | ||
894 | EOH | |
895 | . ./myread | |
896 | cat <<EOH | |
897 | ||
898 | Much effort has been expended to ensure that this shell script will run on any | |
899 | Unix system. If despite that it blows up on yours, your best bet is to edit | |
900 | Configure and run it again. Also, let me (lwall@netlabs.com) | |
901 | know how I blew it. If you can't run Configure for some reason, you'll have to | |
902 | generate a config.sh file by hand. | |
903 | ||
904 | This installation script affects things in two ways: | |
905 | ||
906 | 1) it may do direct variable substitutions on some of the files included | |
907 | in this kit. | |
908 | 2) it builds a config.h file for inclusion in C programs. You may edit | |
909 | any of these files as the need arises after running this script. | |
910 | ||
911 | If you make a mistake on a question, there is no easy way to back up to it | |
912 | currently. The easiest thing to do is to edit config.sh and rerun all the SH | |
913 | files. Configure will offer to let you do this before it runs the SH files. | |
914 | ||
915 | EOH | |
916 | dflt='Type carriage return to continue' | |
917 | . ./myread | |
918 | case "$firsttime" in | |
919 | true) echo $user >>../.config/instruct;; | |
920 | esac | |
921 | fi | |
922 | ||
923 | : see if sh knows # comments | |
924 | echo " " | |
925 | echo "Checking your sh to see if it knows about # comments..." >&4 | |
926 | if sh -c '#' >/dev/null 2>&1 ; then | |
927 | echo "Your sh handles # comments correctly." | |
928 | shsharp=true | |
929 | spitshell=cat | |
930 | echo " " | |
931 | echo "Okay, let's see if #! works on this system..." | |
932 | echo "#!/bin/cat" >try | |
933 | $eunicefix try | |
934 | chmod +x try | |
935 | ./try > today | |
936 | if test -s today; then | |
937 | echo "It does." | |
938 | sharpbang='#!' | |
939 | else | |
940 | echo "#! /bin/cat" > try | |
941 | $eunicefix try | |
942 | chmod +x try | |
943 | ./try > today | |
944 | if test -s today; then | |
945 | echo "It does." | |
946 | sharpbang='#! ' | |
947 | else | |
948 | echo "It's just a comment." | |
949 | sharpbang=': use ' | |
950 | fi | |
951 | fi | |
952 | else | |
953 | echo "Your sh doesn't grok # comments--I will strip them later on." | |
954 | shsharp=false | |
955 | echo "exec grep -v '^[ ]*#'" >spitshell | |
956 | chmod +x spitshell | |
957 | $eunicefix spitshell | |
958 | spitshell=`pwd`/spitshell | |
959 | echo "I presume that if # doesn't work, #! won't work either!" | |
960 | sharpbang=': use ' | |
961 | fi | |
962 | rm -f try today | |
963 | ||
964 | : figure out how to guarantee sh startup | |
965 | echo " " | |
966 | echo "Checking out how to guarantee sh startup..." >&4 | |
967 | case "$SYSTYPE" in | |
968 | *bsd*|sys5*) startsh=$sharpbang"/$SYSTYPE/bin/sh";; | |
969 | *) startsh=$sharpbang'/bin/sh';; | |
970 | esac | |
971 | echo "Let's see if '$startsh' works..." | |
972 | cat >try <<EOSS | |
973 | $startsh | |
974 | set abc | |
975 | test "$?abc" != 1 | |
976 | EOSS | |
977 | ||
978 | chmod +x try | |
979 | $eunicefix try | |
980 | if ./try; then | |
981 | echo "Yup, it does." | |
982 | else | |
983 | echo "Nope. You may have to fix up the shell scripts to make sure sh runs them." | |
984 | fi | |
985 | rm -f try | |
986 | ||
987 | : find out where common programs are | |
988 | echo " " | |
989 | echo "Locating common programs..." >&4 | |
990 | cat <<EOSC >loc | |
991 | $startsh | |
992 | case \$# in | |
993 | 0) exit 1;; | |
994 | esac | |
995 | thing=\$1 | |
996 | shift | |
997 | dflt=\$1 | |
998 | shift | |
999 | for dir in \$*; do | |
1000 | case "\$thing" in | |
1001 | .) | |
1002 | if test -d \$dir/\$thing; then | |
1003 | echo \$dir | |
1004 | exit 0 | |
1005 | fi | |
1006 | ;; | |
1007 | *) | |
1008 | if test -f \$dir/\$thing; then | |
1009 | echo \$dir/\$thing | |
1010 | exit 0 | |
1011 | elif test -f \$dir/\$thing.exe; then | |
1012 | : on Eunice apparently | |
1013 | echo \$dir/\$thing | |
1014 | exit 0 | |
1015 | fi | |
1016 | ;; | |
1017 | esac | |
1018 | done | |
1019 | echo \$dflt | |
1020 | exit 1 | |
1021 | EOSC | |
1022 | chmod +x loc | |
1023 | $eunicefix loc | |
1024 | loclist=" | |
1025 | awk | |
1026 | cat | |
1027 | cp | |
1028 | echo | |
1029 | expr | |
1030 | grep | |
85e6fe83 | 1031 | ln |
2304df62 AD |
1032 | mkdir |
1033 | mv | |
1034 | rm | |
1035 | sed | |
1036 | sort | |
85e6fe83 | 1037 | touch |
2304df62 AD |
1038 | tr |
1039 | uniq | |
1040 | " | |
1041 | trylist=" | |
1042 | Mcc | |
1043 | bison | |
1044 | byacc | |
1045 | cpp | |
1046 | csh | |
1047 | date | |
1048 | egrep | |
1049 | find | |
1050 | line | |
1051 | nroff | |
1052 | perl | |
1053 | test | |
1054 | uname | |
1055 | " | |
1056 | pth=`echo $PATH | sed -e 's/:/ /g'` | |
1057 | pth="$pth /lib /usr/lib" | |
1058 | for file in $loclist; do | |
1059 | xxx=`./loc $file $file $pth` | |
1060 | eval $file=$xxx | |
1061 | eval _$file=$xxx | |
1062 | case "$xxx" in | |
1063 | /*) | |
1064 | echo $file is in $xxx. | |
1065 | ;; | |
1066 | *) | |
1067 | echo "I don't know where $file is. I hope it's in everyone's PATH." | |
1068 | ;; | |
1069 | esac | |
1070 | done | |
1071 | echo " " | |
1072 | echo "Don't worry if any of the following aren't found..." | |
1073 | say=offhand | |
1074 | for file in $trylist; do | |
1075 | xxx=`./loc $file $file $pth` | |
1076 | eval $file=$xxx | |
1077 | eval _$file=$xxx | |
1078 | case "$xxx" in | |
1079 | /*) | |
1080 | echo $file is in $xxx. | |
1081 | ;; | |
1082 | *) | |
1083 | echo "I don't see $file out there, $say." | |
1084 | say=either | |
1085 | ;; | |
1086 | esac | |
1087 | done | |
1088 | case "$egrep" in | |
1089 | egrep) | |
1090 | echo "Substituting grep for egrep." | |
1091 | egrep=$grep | |
1092 | ;; | |
1093 | esac | |
1094 | case "$test" in | |
1095 | test) | |
1096 | echo "Hopefully test is built into your sh." | |
1097 | ;; | |
1098 | *) | |
1099 | if sh -c "PATH= test true" >/dev/null 2>&1; then | |
1100 | echo "Using the test built into your sh." | |
1101 | test=test | |
1102 | _test=test | |
1103 | fi | |
1104 | ;; | |
1105 | esac | |
1106 | case "$echo" in | |
1107 | echo) | |
1108 | echo "Hopefully echo is built into your sh." | |
1109 | ;; | |
1110 | '') ;; | |
1111 | *) | |
1112 | echo " " | |
1113 | echo "Checking compatibility between $echo and builtin echo (if any)..." >&4 | |
1114 | $echo $n "hi there$c" >foo1 | |
1115 | echo $n "hi there$c" >foo2 | |
1116 | if cmp foo1 foo2 >/dev/null 2>&1; then | |
1117 | echo "They are compatible. In fact, they may be identical." | |
1118 | else | |
1119 | case "$n" in | |
1120 | '-n') n='' c='\c';; | |
1121 | *) n='-n' c='';; | |
1122 | esac | |
1123 | cat <<FOO | |
1124 | They are not compatible! You are probably running ksh on a non-USG system. | |
1125 | I'll have to use $echo instead of the builtin, since Bourne shell doesn't | |
1126 | have echo built in and we may have to run some Bourne shell scripts. That | |
1127 | means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous. | |
1128 | ||
1129 | FOO | |
1130 | $echo $n "The star should be here-->$c" | |
1131 | $echo "*" | |
1132 | fi | |
1133 | $rm -f foo1 foo2 | |
1134 | ;; | |
1135 | esac | |
1136 | ||
1137 | : Try to determine whether config.sh was made on this system | |
1138 | case "$config_sh" in | |
1139 | '') | |
1140 | myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1` | |
1141 | myuname=`echo $myuname | $sed -e 's/^[^=]*=//' | \ | |
1142 | tr '[A-Z]' '[a-z]' | tr '\012' ' '` | |
1143 | dflt=n | |
1144 | if test "$fastread" = yes; then | |
1145 | dflt=y | |
1146 | elif test -f ../config.sh; then | |
1147 | oldmyuname='' | |
1148 | if $contains myuname= ../config.sh >/dev/null 2>&1; then | |
1149 | eval "old`grep myuname= ../config.sh`" | |
1150 | fi | |
1151 | if test "X$myuname" = "X$oldmyuname"; then | |
1152 | dflt=y | |
1153 | fi | |
1154 | fi | |
1155 | ||
1156 | : Get old answers from old config file if Configure was run on the | |
1157 | : same system, otherwise use the hints. | |
1158 | hint=default | |
1159 | cd .. | |
1160 | if test -f config.sh; then | |
1161 | echo " " | |
1162 | rp="I see a config.sh file. Shall I use it to set the defaults?" | |
1163 | . UU/myread | |
1164 | case "$ans" in | |
1165 | n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;; | |
1166 | *) echo "Fetching default answers from your old config.sh file..." >&4 | |
1167 | tmp="$n" | |
1168 | tans="$c" | |
1169 | . ./config.sh | |
1170 | cp config.sh UU | |
1171 | n="$tmp" | |
1172 | c="$tans" | |
1173 | hint=previous | |
1174 | ;; | |
1175 | esac | |
1176 | fi | |
1177 | if test ! -f config.sh; then | |
1178 | $cat <<EOM | |
1179 | ||
1180 | First time through, eh? I have some defaults handy for the following systems: | |
1181 | ||
1182 | EOM | |
1183 | cd hints; ls -C *.sh | $sed 's/\.sh/ /g' >&4 | |
1184 | dflt='' | |
1185 | : Half the following guesses are probably wrong... If you have better | |
1186 | : tests or hints, please send them to lwall@netlabs.com | |
1187 | : The metaconfig authors would also appreciate a copy... | |
85e6fe83 LW |
1188 | $test -f /irix && osname=sgi |
1189 | $test -f /xenix && osname=sco_xenix | |
1190 | $test -f /dynix && osname=dynix | |
1191 | $test -f /dnix && osname=dnix | |
1192 | $test -f /bin/mips && /bin/mips && osname=mips | |
1193 | $test -d /NextApps && test -f /usr/adm/software_version && osname=next | |
1194 | $test -d /usr/include/minix && osname=minix | |
2304df62 AD |
1195 | if $test -f $uname; then |
1196 | set X $myuname | |
1197 | shift | |
1198 | ||
1199 | $test -f $5.sh && dflt="$dflt $5" | |
1200 | ||
1201 | case "$5" in | |
85e6fe83 | 1202 | fps*) osname=fps ;; |
2304df62 AD |
1203 | mips*) |
1204 | case "$4" in | |
85e6fe83 LW |
1205 | umips) osname=umips ;; |
1206 | *) osname=mips ;; | |
2304df62 | 1207 | esac;; |
85e6fe83 LW |
1208 | [23]100) osname=mips ;; |
1209 | next*) osname=next ;; | |
1210 | news*) osname=news ;; | |
2304df62 | 1211 | i386*) if $test -f /etc/kconfig; then |
85e6fe83 | 1212 | osname=isc |
2304df62 | 1213 | if $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then |
85e6fe83 | 1214 | osvers=3.2.3 |
2304df62 | 1215 | elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then |
85e6fe83 | 1216 | osvers=3.2.2 |
2304df62 | 1217 | fi |
2304df62 AD |
1218 | fi |
1219 | ;; | |
1220 | esac | |
1221 | ||
1222 | case "$1" in | |
85e6fe83 LW |
1223 | aix) osname=aix_rs ;; |
1224 | sunos) osname=sunos | |
1225 | case "$3" in | |
1226 | [34]*) osvers=$3 ;; | |
1227 | 5*) osname=solaris | |
1228 | osvers=`echo $3 | $sed 's/^5/2/g'` ;; | |
2304df62 AD |
1229 | esac |
1230 | ;; | |
85e6fe83 LW |
1231 | solaris) osname=solaris |
1232 | case "$3" in | |
1233 | 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;; | |
2304df62 AD |
1234 | esac |
1235 | ;; | |
85e6fe83 LW |
1236 | dnix) osname=dnix ;; |
1237 | dgux) osname=dgux ;; | |
1238 | genix) osname=genix ;; | |
1239 | hp*ux) osname=hpux ;; | |
1240 | next) osname=next ;; | |
1241 | irix) osname=sgi ;; | |
1242 | ultrix) osname=ultrix | |
1243 | case "$3" in | |
1244 | 1*) osvers=1 ;; | |
1245 | 2*) osvers=2 ;; | |
1246 | 3*) osvers=3 ;; | |
1247 | 4*) osvers=4 ;; | |
2304df62 AD |
1248 | esac |
1249 | ;; | |
85e6fe83 LW |
1250 | osf1) case "$5" in |
1251 | alpha) osname=dec_osf | |
1252 | case "$3" in | |
1253 | [vt]1\.*) osvers=1 ;; | |
1254 | [vt]2\.*) osvers=2 ;; | |
1255 | [vt]3\.*) osvers=3 ;; | |
1256 | esac | |
1257 | ;; | |
1258 | hp*) osname=hp_osf1 ;; # TR | |
1259 | mips) osname=mips_osf1 ;; # TR | |
1260 | # TR = Technology Releases: (un^N)supported | |
1261 | esac | |
1262 | ;; | |
1263 | uts) osname=uts ;; | |
1264 | $2) case "$osname" in | |
2304df62 AD |
1265 | *isc*) ;; |
1266 | *) if test -f /etc/systemid; then | |
85e6fe83 LW |
1267 | osname=sco |
1268 | : Does anyone know if these next gyrations are needed | |
2304df62 AD |
1269 | set `echo $3 | $sed 's/\./ /g'` $4 |
1270 | if $test -f sco_$1_$2_$3.sh; then | |
85e6fe83 | 1271 | osvers=$1.$2.$3 |
2304df62 | 1272 | elif $test -f sco_$1_$2.sh; then |
85e6fe83 | 1273 | osvers=$1.$2 |
2304df62 | 1274 | elif $test -f sco_$1.sh; then |
85e6fe83 | 1275 | osvers=$1 |
2304df62 AD |
1276 | fi |
1277 | fi | |
1278 | ;; | |
1279 | esac | |
1280 | ;; | |
1281 | esac | |
1282 | else | |
1283 | if test -f /vmunix -a -f news_os.sh; then | |
1284 | (what /vmunix | tr '[A-Z]' '[a-z]') > ../UU/kernel.what 2>&1 | |
1285 | if $contains news-os ../UU/kernel.what >/dev/null 2>&1; then | |
85e6fe83 | 1286 | osname=news_os |
2304df62 AD |
1287 | fi |
1288 | $rm -f ../UU/kernel.what | |
1289 | fi | |
1290 | fi | |
85e6fe83 LW |
1291 | |
1292 | : Now look for a hint file osname_osvers | |
1293 | file=`echo "${osname}_${osvers}" | sed -e 's@\.@_@g' -e 's@_$@@'` | |
1294 | case "$file" in | |
1295 | '') dflt=none ;; | |
1296 | *) case "$osvers" in | |
1297 | '') dflt=$file | |
1298 | ;; | |
1299 | *) if $test -f $file.sh ; then | |
1300 | dflt=$file | |
1301 | elif $test -f "${osname}.sh" ; then | |
1302 | dflt="${osname}" | |
1303 | else | |
1304 | dflt=none | |
1305 | fi | |
1306 | ;; | |
1307 | esac | |
1308 | ;; | |
2304df62 | 1309 | esac |
85e6fe83 | 1310 | |
2304df62 AD |
1311 | $cat <<EOM |
1312 | ||
1313 | You may give one or more space-separated answers, or "none" if appropriate. | |
1314 | If your OS version has no hints, DO NOT give a wrong version -- say "none". | |
1315 | ||
1316 | EOM | |
1317 | rp="Which of these apply, if any?" | |
1318 | . ../UU/myread | |
85e6fe83 LW |
1319 | tans=$ans |
1320 | for file in $tans; do | |
2304df62 AD |
1321 | if $test -f $file.sh; then |
1322 | . ./$file.sh | |
1323 | $cat $file.sh >> ../UU/config.sh | |
85e6fe83 | 1324 | elif $test X$tans = X -o X$tans = Xnone ; then |
2304df62 AD |
1325 | : nothing |
1326 | else | |
85e6fe83 LW |
1327 | : Give one chance to correct a possible typo. |
1328 | echo "$file.sh does not exist" | |
1329 | dflt=$file | |
1330 | rp="hint to use instead?" | |
1331 | . ../UU/myread | |
1332 | for file in $ans; do | |
1333 | if $test -f "$file.sh"; then | |
1334 | . ./$file.sh | |
1335 | $cat $file.sh >> ../UU/config.sh | |
1336 | elif $test X$ans = X -o X$ans = Xnone ; then | |
1337 | : nothing | |
1338 | else | |
1339 | echo "$file.sh does not exist -- ignored." | |
1340 | fi | |
1341 | done | |
2304df62 AD |
1342 | fi |
1343 | done | |
85e6fe83 | 1344 | |
2304df62 | 1345 | hint=recommended |
85e6fe83 LW |
1346 | : Remember our hint file for later. |
1347 | if $test -f "$file.sh" ; then | |
1348 | hintfile="$file.sh" | |
1349 | else | |
1350 | hintfile=none | |
1351 | fi | |
1352 | ||
2304df62 AD |
1353 | cd .. |
1354 | fi | |
1355 | cd UU | |
1356 | ;; | |
1357 | *) | |
1358 | echo " " | |
1359 | echo "Fetching default answers from $config_sh..." >&4 | |
1360 | tmp="$n" | |
1361 | tans="$c" | |
1362 | cd .. | |
1363 | cp $config_sh config.sh 2>/dev/null | |
1364 | . ./config.sh | |
1365 | cd UU | |
1366 | cp ../config.sh . | |
1367 | n="$tmp" | |
1368 | c="$tans" | |
1369 | hint=previous | |
1370 | ;; | |
1371 | esac | |
1372 | ||
1373 | : Restore computed paths | |
1374 | for file in $loclist $trylist; do | |
1375 | eval $file="\$_$file" | |
1376 | done | |
1377 | ||
85e6fe83 LW |
1378 | cat << EOM |
1379 | Configure uses the operating system name and version to set some defaults. | |
1380 | Say "none" to leave it blank. | |
1381 | EOM | |
1382 | ||
1383 | case "$osname" in | |
1384 | ''|' ') | |
1385 | case "$hintfile" in | |
1386 | none) dflt=none ;; | |
1387 | *) dflt=`echo $hintfile | sed -e 's/\.sh$//' -e 's/_.*$//'` ;; | |
1388 | esac | |
1389 | ;; | |
1390 | *) dflt="$osname" ;; | |
1391 | esac | |
1392 | rp="Operating system name?" | |
1393 | . ./myread | |
1394 | case "$ans" in | |
1395 | none) osname='' ;; | |
1396 | *) osname="$ans" ;; | |
1397 | esac | |
1398 | ||
1399 | case "$osvers" in | |
1400 | ''|' ') | |
1401 | case "$hintfile" in | |
1402 | none) dflt=none ;; | |
1403 | *) dflt=`echo $hintfile | sed -e 's/\.sh$//' -e 's/^[^_]*//'` | |
1404 | dflt=`echo $dflt | sed -e 's/^_//' -e 's/_/./g'` ;; | |
1405 | esac | |
1406 | ;; | |
1407 | *) dflt="$osvers" ;; | |
1408 | esac | |
1409 | rp="Operating system version?" | |
1410 | . ./myread | |
1411 | case "$ans" in | |
1412 | none) osvers='' ;; | |
1413 | *) osvers="$ans" ;; | |
1414 | esac | |
2304df62 AD |
1415 | : who configured the system |
1416 | cf_time=`$date 2>&1` | |
1417 | cf_by=`( (logname) 2>/dev/null || whoami) 2>&1` | |
1418 | ||
1419 | : determine where manual pages are on this system | |
1420 | echo " " | |
1421 | case "$sysman" in | |
1422 | '') | |
1423 | syspath='/usr/man/man1 /usr/man/man1 /usr/man/mann' | |
1424 | syspath="$syspath /usr/man/manl /usr/man/local/man1" | |
1425 | syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1" | |
1426 | syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1" | |
1427 | syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1" | |
1428 | syspath="$syspath /usr/man/man.L /local/man/man1" | |
1429 | sysman=`./loc . $syspath` | |
1430 | ;; | |
1431 | esac | |
1432 | if $test -d "$sysman"; then | |
1433 | echo "System manual is in $sysman." >&4 | |
1434 | else | |
1435 | echo "Could not find manual pages in source form." >&4 | |
1436 | fi | |
1437 | ||
1438 | : see what memory models we can support | |
1439 | case "$models" in | |
1440 | '') | |
1441 | $cat >pdp11.c <<'EOP' | |
1442 | main() { | |
1443 | #ifdef pdp11 | |
1444 | exit(0); | |
1445 | #else | |
1446 | exit(1); | |
1447 | #endif | |
1448 | } | |
1449 | EOP | |
1450 | cc -o pdp11 pdp11.c >/dev/null 2>&1 | |
1451 | if ./pdp11 2>/dev/null; then | |
1452 | dflt='unsplit split' | |
1453 | else | |
1454 | tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge` | |
1455 | case "$tans" in | |
1456 | X) dflt='none';; | |
1457 | *) if $test -d /lib/small || $test -d /usr/lib/small; then | |
1458 | dflt='small' | |
1459 | else | |
1460 | dflt='' | |
1461 | fi | |
1462 | if $test -d /lib/medium || $test -d /usr/lib/medium; then | |
1463 | dflt="$dflt medium" | |
1464 | fi | |
1465 | if $test -d /lib/large || $test -d /usr/lib/large; then | |
1466 | dflt="$dflt large" | |
1467 | fi | |
1468 | if $test -d /lib/huge || $test -d /usr/lib/huge; then | |
1469 | dflt="$dflt huge" | |
1470 | fi | |
1471 | esac | |
1472 | fi;; | |
1473 | *) dflt="$models";; | |
1474 | esac | |
1475 | $cat <<EOM | |
1476 | ||
1477 | Some systems have different model sizes. On most systems they are called | |
1478 | small, medium, large, and huge. On the PDP11 they are called unsplit and | |
1479 | split. If your system doesn't support different memory models, say "none". | |
1480 | If you wish to force everything to one memory model, say "none" here and | |
1481 | put the appropriate flags later when it asks you for other cc and ld flags. | |
1482 | Venix systems may wish to put "none" and let the compiler figure things out. | |
1483 | (In the following question multiple model names should be space separated.) | |
1484 | ||
1485 | EOM | |
1486 | rp="Which memory models are supported?" | |
1487 | . ./myread | |
1488 | models="$ans" | |
1489 | ||
1490 | case "$models" in | |
1491 | none) | |
1492 | small='' | |
1493 | medium='' | |
1494 | large='' | |
1495 | huge='' | |
1496 | unsplit='' | |
1497 | split='' | |
1498 | ;; | |
1499 | *split) | |
1500 | case "$split" in | |
1501 | '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \ | |
1502 | $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then | |
1503 | dflt='-i' | |
1504 | else | |
1505 | dflt='none' | |
1506 | fi;; | |
1507 | *) dflt="$split";; | |
1508 | esac | |
1509 | rp="What flag indicates separate I and D space?" | |
1510 | . ./myread | |
1511 | tans="$ans" | |
1512 | case "$tans" in | |
1513 | none) tans='';; | |
1514 | esac | |
1515 | split="$tans" | |
1516 | unsplit='';; | |
1517 | *large*|*small*|*medium*|*huge*) | |
1518 | case "$models" in | |
1519 | *large*) | |
1520 | case "$large" in | |
1521 | '') dflt='-Ml';; | |
1522 | *) dflt="$large";; | |
1523 | esac | |
1524 | rp="What flag indicates large model?" | |
1525 | . ./myread | |
1526 | tans="$ans" | |
1527 | case "$tans" in | |
1528 | none) tans=''; | |
1529 | esac | |
1530 | large="$tans";; | |
1531 | *) large='';; | |
1532 | esac | |
1533 | case "$models" in | |
1534 | *huge*) case "$huge" in | |
1535 | '') dflt='-Mh';; | |
1536 | *) dflt="$huge";; | |
1537 | esac | |
1538 | rp="What flag indicates huge model?" | |
1539 | . ./myread | |
1540 | tans="$ans" | |
1541 | case "$tans" in | |
1542 | none) tans=''; | |
1543 | esac | |
1544 | huge="$tans";; | |
1545 | *) huge="$large";; | |
1546 | esac | |
1547 | case "$models" in | |
1548 | *medium*) case "$medium" in | |
1549 | '') dflt='-Mm';; | |
1550 | *) dflt="$medium";; | |
1551 | esac | |
1552 | rp="What flag indicates medium model?" | |
1553 | . ./myread | |
1554 | tans="$ans" | |
1555 | case "$tans" in | |
1556 | none) tans=''; | |
1557 | esac | |
1558 | medium="$tans";; | |
1559 | *) medium="$large";; | |
1560 | esac | |
1561 | case "$models" in | |
1562 | *small*) case "$small" in | |
1563 | '') dflt='none';; | |
1564 | *) dflt="$small";; | |
1565 | esac | |
1566 | rp="What flag indicates small model?" | |
1567 | . ./myread | |
1568 | tans="$ans" | |
1569 | case "$tans" in | |
1570 | none) tans=''; | |
1571 | esac | |
1572 | small="$tans";; | |
1573 | *) small='';; | |
1574 | esac | |
1575 | ;; | |
1576 | *) | |
1577 | echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4 | |
1578 | ;; | |
1579 | esac | |
1580 | ||
1581 | : make some quick guesses about what we are up against | |
1582 | echo " " | |
1583 | $echo $n "Hmm... $c" | |
1584 | echo exit 1 >bsd | |
1585 | echo exit 1 >usg | |
1586 | echo exit 1 >v7 | |
1587 | echo exit 1 >osf1 | |
1588 | echo exit 1 >eunice | |
1589 | echo exit 1 >xenix | |
1590 | echo exit 1 >venix | |
2304df62 AD |
1591 | $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null |
1592 | if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1 | |
1593 | then | |
1594 | echo "Looks kind of like an OSF/1 system, but we'll see..." | |
1595 | echo exit 0 >osf1 | |
1596 | elif test `echo abc | tr a-z A-Z` = Abc ; then | |
1597 | xxx=`./loc addbib blurfl $pth` | |
1598 | if $test -f $xxx; then | |
1599 | echo "Looks kind of like a USG system with BSD features, but we'll see..." | |
1600 | echo exit 0 >bsd | |
1601 | echo exit 0 >usg | |
1602 | else | |
1603 | if $contains SIGTSTP foo >/dev/null 2>&1 ; then | |
1604 | echo "Looks kind of like an extended USG system, but we'll see..." | |
1605 | else | |
1606 | echo "Looks kind of like a USG system, but we'll see..." | |
1607 | fi | |
1608 | echo exit 0 >usg | |
1609 | fi | |
1610 | elif $contains SIGTSTP foo >/dev/null 2>&1 ; then | |
1611 | echo "Looks kind of like a BSD system, but we'll see..." | |
2304df62 AD |
1612 | echo exit 0 >bsd |
1613 | else | |
1614 | echo "Looks kind of like a Version 7 system, but we'll see..." | |
1615 | echo exit 0 >v7 | |
1616 | fi | |
1617 | case "$eunicefix" in | |
1618 | *unixtovms*) | |
1619 | $cat <<'EOI' | |
1620 | There is, however, a strange, musty smell in the air that reminds me of | |
1621 | something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit. | |
1622 | EOI | |
1623 | echo exit 0 >eunice | |
1624 | d_eunice="$define" | |
1625 | : it so happens the Eunice I know will not run shell scripts in Unix format | |
1626 | ;; | |
1627 | *) | |
1628 | echo " " | |
1629 | echo "Congratulations. You aren't running Eunice." | |
1630 | d_eunice="$undef" | |
1631 | ;; | |
1632 | esac | |
1633 | if test -f /xenix; then | |
1634 | echo "Actually, this looks more like a XENIX system..." | |
1635 | echo exit 0 >xenix | |
1636 | d_xenix="$define" | |
1637 | else | |
1638 | echo " " | |
1639 | echo "It's not Xenix..." | |
1640 | d_xenix="$undef" | |
1641 | fi | |
1642 | chmod +x xenix | |
1643 | $eunicefix xenix | |
1644 | if test -f /venix; then | |
1645 | echo "Actually, this looks more like a VENIX system..." | |
1646 | echo exit 0 >venix | |
1647 | else | |
1648 | echo " " | |
1649 | if xenix; then | |
1650 | : null | |
1651 | else | |
1652 | echo "Nor is it Venix..." | |
1653 | fi | |
1654 | fi | |
1655 | chmod +x bsd usg v7 osf1 eunice xenix venix | |
1656 | $eunicefix bsd usg v7 osf1 eunice xenix venix | |
1657 | $rm -f foo | |
1658 | ||
1659 | : see if we need a special compiler | |
1660 | echo " " | |
1661 | if usg; then | |
1662 | case "$cc" in | |
1663 | '') case "$Mcc" in | |
1664 | /*) dflt='Mcc';; | |
1665 | *) case "$large" in | |
1666 | -M*) dflt='cc';; | |
1667 | *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then | |
1668 | if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then | |
1669 | dflt='cc' | |
1670 | else | |
1671 | dflt='cc -M' | |
1672 | fi | |
1673 | else | |
1674 | dflt='cc' | |
1675 | fi;; | |
1676 | esac;; | |
1677 | esac;; | |
1678 | *) dflt="$cc";; | |
1679 | esac | |
1680 | $cat <<'EOM' | |
1681 | On some systems the default C compiler will not resolve multiple global | |
1682 | references that happen to have the same name. On some such systems the "Mcc" | |
1683 | command may be used to force these to be resolved. On other systems a "cc -M" | |
1684 | command is required. (Note that the -M flag on other systems indicates a | |
1685 | memory model to use!) If you have the Gnu C compiler, you might wish to use | |
1686 | that instead. | |
1687 | ||
1688 | EOM | |
1689 | rp="What command will force resolution on this system?" | |
1690 | . ./myread | |
1691 | cc="$ans" | |
1692 | else | |
1693 | case "$cc" in | |
1694 | '') dflt=cc;; | |
1695 | *) dflt="$cc";; | |
1696 | esac | |
1697 | rp="Use which C compiler?" | |
1698 | . ./myread | |
1699 | cc="$ans" | |
1700 | fi | |
1701 | case "$cc" in | |
1702 | gcc*) echo "Checking out which version of gcc" | |
1703 | $cat >gccvers.c <<EOM | |
1704 | #include <stdio.h> | |
1705 | int main() | |
1706 | { | |
1707 | char *v; | |
1708 | v = "unknown"; | |
1709 | #ifdef __GNUC__ | |
1710 | # ifdef __VERSION__ | |
1711 | v = __VERSION__; | |
1712 | # endif | |
1713 | #endif | |
1714 | switch((int) v[0]) | |
1715 | { | |
1716 | case '1': printf("1\n"); break; | |
1717 | case '2': printf("2\n"); break; | |
1718 | case '3': printf("3\n"); break; | |
1719 | default: break; | |
1720 | } | |
1721 | #ifdef __GNUC__ | |
1722 | return 0; | |
1723 | #else | |
1724 | return 1; | |
1725 | #endif | |
1726 | } | |
1727 | EOM | |
85e6fe83 | 1728 | if $cc -o gccvers gccvers.c >/dev/null 2>&1; then |
2304df62 AD |
1729 | gccversion=`./gccvers` |
1730 | echo "You appear to have version $gccversion." | |
1731 | else | |
1732 | echo "Doesn't appear to be GNU cc." | |
1733 | fi | |
1734 | $rm -f gccvers* | |
1735 | if $test "$gccversion" = '1'; then | |
1736 | cpp=`./loc gcc-cpp $cpp $pth` | |
1737 | fi | |
1738 | ;; | |
1739 | esac | |
1740 | : decide how portable to be | |
1741 | case "$d_portable" in | |
1742 | "$define") dflt=y;; | |
1743 | *) dflt=n;; | |
1744 | esac | |
1745 | $cat <<'EOH' | |
1746 | ||
1747 | I can set things up so that your shell scripts and binaries are more portable, | |
1748 | at what may be a noticable cost in performance. In particular, if you | |
1749 | ask to be portable, the following happens: | |
1750 | ||
1751 | 1) Shell scripts will rely on the PATH variable rather than using | |
1752 | the paths derived above. | |
1753 | 2) ~username interpretations will be done at run time rather than | |
1754 | by Configure. | |
1755 | ||
1756 | EOH | |
1757 | rp="Do you expect to run these scripts and binaries on multiple machines?" | |
1758 | . ./myread | |
1759 | case "$ans" in | |
1760 | y*) d_portable="$define" | |
1761 | for file in $loclist $trylist; do | |
1762 | eval $file="\$file" | |
1763 | done | |
1764 | ;; | |
1765 | *) d_portable="$undef" ;; | |
1766 | esac | |
1767 | ||
1768 | : set up shell script to do ~ expansion | |
1769 | cat >filexp <<EOSS | |
1770 | $startsh | |
1771 | : expand filename | |
1772 | case "\$1" in | |
1773 | ~/*|~) | |
1774 | echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|" | |
1775 | ;; | |
1776 | ~*) | |
1777 | if $test -f /bin/csh; then | |
1778 | /bin/csh -f -c "glob \$1" | |
1779 | failed=$? | |
1780 | echo "" | |
1781 | exit \$failed | |
1782 | else | |
1783 | name=\`$expr x\$1 : '..\([^/]*\)'\` | |
1784 | dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\` | |
1785 | if $test ! -d "\$dir"; then | |
1786 | me=\`basename \$0\` | |
1787 | echo "\$me: can't locate home directory for: \$name" >&2 | |
1788 | exit 1 | |
1789 | fi | |
1790 | case "\$1" in | |
1791 | */*) | |
1792 | echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\` | |
1793 | ;; | |
1794 | *) | |
1795 | echo \$dir | |
1796 | ;; | |
1797 | esac | |
1798 | fi | |
1799 | ;; | |
1800 | *) | |
1801 | echo \$1 | |
1802 | ;; | |
1803 | esac | |
1804 | EOSS | |
1805 | chmod +x filexp | |
1806 | $eunicefix filexp | |
1807 | ||
1808 | : now set up to get a file name | |
1809 | cat <<'EOSC' >getfile | |
1810 | tilde='' | |
1811 | fullpath='' | |
1812 | already='' | |
1813 | skip='' | |
1814 | none_ok='' | |
1815 | exp_file='' | |
1816 | orig_rp="$rp" | |
1817 | orig_dflt="$dflt" | |
1818 | ||
1819 | case "$fn" in | |
1820 | *~*) tilde=true;; | |
1821 | esac | |
1822 | case "$fn" in | |
1823 | */*) fullpath=true;; | |
1824 | esac | |
1825 | case "$fn" in | |
1826 | *+*) skip=true;; | |
1827 | esac | |
1828 | case "$fn" in | |
1829 | *n*) none_ok=true;; | |
1830 | esac | |
1831 | case "$fn" in | |
1832 | *e*) exp_file=true;; | |
1833 | esac | |
1834 | ||
1835 | case "$fn" in | |
1836 | *f*) type='File';; | |
1837 | *d*) type='Directory';; | |
1838 | *l*) type='Locate'; fn=`expr $fn : '.*:\(.*\)'`;; | |
1839 | esac | |
1840 | ||
1841 | what="$type" | |
1842 | case "$what" in | |
1843 | Locate) what='File';; | |
1844 | esac | |
1845 | ||
1846 | case "$exp_file" in | |
1847 | '') | |
1848 | case "$d_portable" in | |
1849 | "$define") ;; | |
1850 | *) exp_file=true;; | |
1851 | esac | |
1852 | ;; | |
1853 | esac | |
1854 | ||
1855 | cd .. | |
1856 | while test "$type"; do | |
1857 | redo='' | |
1858 | rp="$orig_rp" | |
1859 | dflt="$orig_dflt" | |
1860 | case "$tilde" in | |
1861 | true) rp="$rp (~name ok)";; | |
1862 | esac | |
1863 | . UU/myread | |
1864 | case "$ans" in | |
1865 | none) | |
1866 | value='' | |
1867 | ansexp='' | |
1868 | case "$none_ok" in | |
1869 | true) type='';; | |
1870 | esac | |
1871 | ;; | |
1872 | *) | |
1873 | case "$tilde" in | |
1874 | '') value="$ans" | |
1875 | ansexp="$ans";; | |
1876 | *) | |
1877 | value=`UU/filexp $ans` | |
1878 | case $? in | |
1879 | 0) | |
1880 | if test "$ans" != "$value"; then | |
1881 | echo "(That is $value on this particular system.)" | |
1882 | fi | |
1883 | ;; | |
1884 | *) value="$ans";; | |
1885 | esac | |
1886 | ansexp="$value" | |
1887 | case "$exp_file" in | |
1888 | '') value="$ans";; | |
1889 | esac | |
1890 | ;; | |
1891 | esac | |
1892 | case "$fullpath" in | |
1893 | true) | |
1894 | case "$ansexp" in | |
1895 | /*) value="$ansexp" ;; | |
1896 | *) | |
1897 | redo=true | |
1898 | case "$already" in | |
1899 | true) | |
1900 | echo "I shall only accept a full path name, as in /bin/ls." >&4 | |
1901 | echo "Use a ! shell escape if you wish to check pathnames." >&4 | |
1902 | ;; | |
1903 | *) | |
1904 | echo "Please give a full path name, starting with slash." >&4 | |
1905 | case "$tilde" in | |
1906 | true) | |
1907 | echo "Note that using ~name is ok provided it expands well." >&4 | |
1908 | already=true | |
1909 | ;; | |
1910 | esac | |
1911 | esac | |
1912 | ;; | |
1913 | esac | |
1914 | ;; | |
1915 | esac | |
1916 | case "$redo" in | |
1917 | '') | |
1918 | case "$type" in | |
1919 | File) | |
1920 | if test -f "$ansexp"; then | |
1921 | type='' | |
1922 | elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1 | |
1923 | then | |
1924 | echo "($value is not a plain file, but that's ok.)" | |
1925 | type='' | |
1926 | fi | |
1927 | ;; | |
1928 | Directory) | |
1929 | if test -d "$ansexp"; then | |
1930 | type='' | |
1931 | fi | |
1932 | ;; | |
1933 | Locate) | |
1934 | if test -d "$value"; then | |
1935 | echo "(Looking for $fn in directory $value.)" | |
1936 | value="$value/$fn" | |
1937 | fi | |
1938 | if test -f "$value"; then | |
1939 | type='' | |
1940 | fi | |
1941 | ;; | |
1942 | esac | |
1943 | ||
1944 | case "$skip" in | |
1945 | true) type=''; | |
1946 | esac | |
1947 | ||
1948 | case "$type" in | |
1949 | '') ;; | |
1950 | *) | |
1951 | if test "$fastread" = yes; then | |
1952 | dflt=y | |
1953 | else | |
1954 | dflt=n | |
1955 | fi | |
1956 | rp="$what $value doesn't exist. Use that name anyway?" | |
1957 | . UU/myread | |
1958 | dflt='' | |
1959 | case "$ans" in | |
1960 | y*) type='';; | |
1961 | *) echo " ";; | |
1962 | esac | |
1963 | ;; | |
1964 | esac | |
1965 | ;; | |
1966 | esac | |
1967 | ;; | |
1968 | esac | |
1969 | done | |
1970 | cd UU | |
1971 | ans="$value" | |
1972 | rp="$orig_rp" | |
1973 | dflt="$orig_dflt" | |
1974 | EOSC | |
1975 | ||
1976 | : What should the include directory be ? | |
1977 | echo " " | |
1978 | $echo $n "Hmm... $c" | |
1979 | case "$usrinc" in | |
1980 | '') dflt='/usr/include';; | |
1981 | *) dflt=$usrinc;; | |
1982 | esac | |
1983 | incpath='' | |
1984 | mips_type='' | |
1985 | if $test -f /bin/mips && /bin/mips; then | |
1986 | echo "Looks like a MIPS system..." | |
1987 | $cat >usr.c <<'EOCP' | |
1988 | #ifdef SYSTYPE_BSD43 | |
1989 | /bsd43 | |
1990 | #endif | |
1991 | EOCP | |
1992 | if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then | |
1993 | dflt='/bsd43/usr/include' | |
1994 | incpath='/bsd43' | |
1995 | mips_type='BSD 4.3' | |
1996 | else | |
1997 | mips_type='System V' | |
1998 | fi | |
1999 | $rm -f usr.c usr.out | |
2000 | echo "and you're compiling with the $mips_type compiler and libraries." | |
2001 | else | |
2002 | echo "Doesn't look like a MIPS system." | |
2003 | echo "exit 1" >mips | |
2004 | chmod +x mips | |
2005 | $eunicefix mips | |
2006 | fi | |
2007 | echo " " | |
2008 | fn=d/ | |
2009 | rp='Where are the include files you want to use?' | |
2010 | . ./getfile | |
2011 | usrinc="$ans" | |
2012 | ||
2013 | : determine optimize, if desired, or use for debug flag also | |
2014 | case "$optimize" in | |
2015 | ' ') dflt="none";; | |
2016 | '') dflt="-g";; | |
2017 | *) dflt="$optimize";; | |
2018 | esac | |
2019 | $cat <<EOH | |
2020 | ||
2021 | Some C compilers have problems with their optimizers, by default, $package | |
2022 | compiles with the -O flag to use the optimizer. Alternately, you might want | |
2023 | to use the symbolic debugger, which uses the -g flag (on traditional Unix | |
2024 | systems). Either flag can be specified here. To use neither flag, specify | |
2025 | the word "none". | |
2026 | ||
2027 | EOH | |
2028 | rp="What optimizer/debugger flag should be used?" | |
2029 | . ./myread | |
2030 | optimize="$ans" | |
2031 | case "$optimize" in | |
2032 | 'none') optimize=" ";; | |
2033 | esac | |
2034 | ||
85e6fe83 | 2035 | dflt='' |
2304df62 AD |
2036 | case "$ccflags" in |
2037 | '') case "$cc" in | |
2038 | *gcc*) if $test "$gccversion" = "1"; then | |
2039 | dflt='-fpcc-struct-return' | |
2040 | fi ;; | |
2304df62 AD |
2041 | esac |
2042 | case "$optimize" in | |
2043 | *-g*) dflt="$dflt -DDEBUGGING";; | |
2044 | esac | |
2045 | case "$cc" in | |
2046 | *gcc*) if test -d /etc/conf/kconfig.d && | |
2047 | $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1 | |
2048 | then | |
2049 | dflt="$dflt -posix" | |
2050 | fi | |
2051 | ;; | |
2052 | esac | |
2053 | ;; | |
2304df62 AD |
2054 | esac |
2055 | ||
2056 | case "$mips_type" in | |
2057 | *BSD*) ;; | |
2058 | '') ;; | |
2059 | *) inclwanted="$inclwanted $usrinc/bsd";; | |
2060 | esac | |
2061 | for thisincl in $inclwanted; do | |
2062 | if $test -d $thisincl; then | |
2063 | if $test x$thisincl != x$usrinc; then | |
2064 | case "$dflt" in | |
2065 | *$thisincl*);; | |
2066 | *) dflt="$dflt -I$thisincl";; | |
2067 | esac | |
2068 | fi | |
2069 | fi | |
2070 | done | |
2071 | ||
2072 | inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then | |
2073 | xxx=true; | |
2074 | elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then | |
2075 | xxx=true; | |
2076 | else | |
2077 | xxx=false; | |
2078 | fi; | |
2079 | if $xxx; then | |
2080 | case "$dflt" in | |
2081 | *$2*);; | |
2082 | *) dflt="$dflt -D$2";; | |
2083 | esac; | |
2084 | fi' | |
2085 | ||
2086 | if ./osf1; then | |
2087 | set signal.h __LANGUAGE_C__; eval $inctest | |
2088 | else | |
2089 | set signal.h LANGUAGE_C; eval $inctest | |
2090 | fi | |
2091 | set signal.h NO_PROTOTYPE; eval $inctest | |
2092 | set signal.h _NO_PROTO; eval $inctest | |
2093 | ||
2094 | case "$dflt" in | |
2095 | '') dflt=none;; | |
2096 | esac | |
85e6fe83 LW |
2097 | case "$ccflags" in |
2098 | '') ;; | |
2099 | *) dflt="$ccflags";; | |
2100 | esac | |
2304df62 AD |
2101 | $cat <<EOH |
2102 | ||
2103 | Your C compiler may want other flags. For this question you should include | |
2104 | -I/whatever and -DWHATEVER flags and any other flags used by the C compiler, | |
2105 | but you should NOT include libraries or ld flags like -lwhatever. If you | |
2106 | want $package to honor its debug switch, you should include -DDEBUGGING here. | |
2107 | To use no flags, specify the word "none". | |
2108 | ||
85e6fe83 LW |
2109 | Your C compiler might also need additional flags, such as -DJMPCLOBBER, |
2110 | -DHIDEMYMALLOC or -DCRIPPLED_CC. | |
2304df62 AD |
2111 | EOH |
2112 | set X $dflt | |
2113 | shift | |
2114 | dflt=${1+"$@"} | |
2115 | rp="Any additional cc flags?" | |
2116 | . ./myread | |
2117 | case "$ans" in | |
2118 | none) ccflags='';; | |
2119 | *) ccflags="$ans";; | |
2120 | esac | |
2121 | ||
2122 | : the following weeds options from ccflags that are of no interest to cpp | |
2123 | cppflags="$ccflags" | |
2124 | case "$cc" in | |
85e6fe83 LW |
2125 | *gcc*) case "$gccversion" in |
2126 | 1) cppflags="$cppflags -D__GNUC__" ;; | |
2127 | esac | |
2128 | ;; | |
2304df62 AD |
2129 | esac |
2130 | case "$mips_type" in | |
2131 | '');; | |
2132 | *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";; | |
2133 | esac | |
2134 | case "$cppflags" in | |
2135 | '');; | |
2136 | *) set X $cppflags | |
2137 | cppflags='' | |
2138 | for flag | |
2139 | do | |
2140 | case $flag in | |
85e6fe83 | 2141 | -D*|-I*|-traditional|-ansi|-nostdinc|-posix|-Xp) cppflags="$cppflags $flag";; |
2304df62 AD |
2142 | esac |
2143 | done | |
2144 | case "$cppflags" in | |
2145 | *-*) echo "(C preprocessor flags: $cppflags)";; | |
2146 | esac | |
2147 | ;; | |
2148 | esac | |
2149 | ||
2150 | : flags used in final linking phase | |
2151 | case "$ldflags" in | |
2152 | '') if venix; then | |
2153 | dflt='-i -z' | |
2154 | else | |
2155 | dflt='none' | |
2156 | fi | |
2157 | ;; | |
2158 | *) dflt="$ldflags";; | |
2159 | esac | |
2160 | echo " " | |
2161 | rp="Any additional ld flags (NOT including libraries)?" | |
2162 | . ./myread | |
2163 | case "$ans" in | |
2164 | none) ldflags='';; | |
2165 | *) ldflags="$ans";; | |
2166 | esac | |
2167 | rmlist="$rmlist pdp11" | |
2168 | ||
2169 | : Initialize h_fcntl | |
2170 | h_fcntl=false | |
2171 | ||
2172 | : Initialize h_sysfile | |
2173 | h_sysfile=false | |
2174 | ||
2175 | : Set private lib path | |
2176 | case "$plibpth" in | |
2177 | '') if mips; then | |
2178 | plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib" | |
2179 | fi;; | |
2180 | esac | |
2181 | libpth="$plibpth $libpth" | |
2182 | : Now check and see which directories actually exist. | |
2183 | xxx='' | |
2184 | for yyy in $libpth | |
2185 | do | |
2186 | if $test -d $yyy; then | |
2187 | xxx="$xxx $yyy" | |
2188 | fi | |
2189 | done | |
2190 | libpth="$xxx" | |
2191 | $cat <<EOM | |
2192 | Some systems have incompatible or broken versions of libraries. Where | |
2193 | should I look for libraries? | |
2194 | EOM | |
2195 | ||
2196 | dflt="$libpth" | |
2197 | echo " " | |
2198 | rp="Directories to use for library searches?" | |
2199 | . ./myread | |
2200 | case "$ans" in | |
2201 | none) libpth=' ';; | |
2202 | *) libpth="$ans";; | |
2203 | esac | |
2204 | : Looking for optional libraries | |
2205 | echo " " | |
2206 | echo "Checking for optional libraries..." >&4 | |
2207 | case "$libs" in | |
2208 | ' '|'') dflt='';; | |
2209 | *) dflt="$libs";; | |
2210 | esac | |
2211 | case "$libswanted" in | |
2212 | '') libswanted='c_s';; | |
2213 | esac | |
2214 | for thislib in $libswanted; do | |
2215 | case "$thislib" in | |
2216 | dbm) thatlib=ndbm;; | |
2217 | *_s) thatlib=NONE;; | |
85e6fe83 | 2218 | *) thatlib=${thislib}_s;; |
2304df62 AD |
2219 | esac |
2220 | xxx=`./loc lib$thislib.a X $libpth` | |
2221 | yyy=`./loc lib$thatlib.a X $libpth` | |
85e6fe83 | 2222 | zzz=`./loc lib$thislib.so.[0-9]'*' X $libpth` |
2304df62 AD |
2223 | if $test -f $xxx; then |
2224 | echo "Found -l$thislib." | |
2225 | case "$dflt" in | |
85e6fe83 | 2226 | *"-l$thislib "*|*-l$thislib|*"-l$thatlib "*|*-l$thatlib) ;; |
2304df62 AD |
2227 | *) dflt="$dflt -l$thislib";; |
2228 | esac | |
2229 | elif $test -f $yyy; then | |
2230 | echo "Found -l$thatlib." | |
2231 | case "$dflt" in | |
85e6fe83 | 2232 | *"-l$thatlib "*|*-l$thatlib) ;; |
2304df62 AD |
2233 | *) dflt="$dflt -l$thatlib";; |
2234 | esac | |
2235 | elif $test -f $zzz; then | |
2236 | echo "Found -$thislib." | |
2237 | case "$dflt" in | |
85e6fe83 | 2238 | *"-l$thislib "*|*-l$thislib) ;; |
2304df62 AD |
2239 | *) dflt="$dflt -l$thislib";; |
2240 | esac | |
2241 | else | |
2242 | xxx=`./loc Slib$thislib.a X $xlibpth` | |
2243 | yyy=`./loc Slib$thatlib.a X $xlibpth` | |
2244 | if $test -f $xxx; then | |
2245 | echo "Found -l$thislib." | |
2246 | case "$dflt" in | |
85e6fe83 | 2247 | *"-l$thislib "*|*-l$thislib|*"-l$thatlib "*|*-l$thatlib) ;; |
2304df62 AD |
2248 | *) dflt="$dflt -l$thislib";; |
2249 | esac | |
2250 | elif $test -f $yyy; then | |
2251 | echo "Found -l$thatlib." | |
2252 | case "$dflt" in | |
85e6fe83 | 2253 | *"-l$thatlib "*|*-l$thatlib) ;; |
2304df62 AD |
2254 | *) dflt="$dflt -l$thatlib";; |
2255 | esac | |
2256 | else | |
2257 | echo "No -l$thislib." | |
2258 | fi | |
2259 | fi | |
2260 | done | |
2261 | set X $dflt | |
2262 | shift | |
2263 | dflt="$*" | |
2264 | case "$libs" in | |
2265 | '') dflt="$dflt";; | |
2266 | *) dflt="$libs";; | |
2267 | esac | |
2268 | case "$dflt" in | |
2269 | ' '|'') dflt='none';; | |
2270 | esac | |
2271 | ||
2272 | $cat <<EOM | |
2273 | ||
2274 | Some versions of Unix support shared libraries, which make executables smaller | |
2275 | but make load time slightly longer. | |
2276 | ||
2277 | On some systems, mostly newer Unix System V's, the shared library is included | |
2278 | by putting the option "-lc_s" as the last thing on the cc command line when | |
2279 | linking. Other systems use shared libraries by default. There may be other | |
2280 | libraries needed to compile $package on your machine as well. If your system | |
2281 | needs the "-lc_s" option, include it here. Include any other special libraries | |
2282 | here as well. Say "none" for none. | |
2283 | EOM | |
2284 | ||
2285 | echo " " | |
2286 | rp="Any additional libraries?" | |
2287 | . ./myread | |
2288 | case "$ans" in | |
2289 | none) libs=' ';; | |
2290 | *) libs="$ans";; | |
2291 | esac | |
2292 | ||
2293 | : see if nm is to be used to determine whether a symbol is defined or not | |
2294 | case "$usenm" in | |
2295 | '') | |
2296 | dflt=`egrep 'inlibc|csym' ../Configure | wc -l 2>/dev/null` | |
2297 | if $test $dflt -gt 20; then | |
2298 | dflt=y | |
2299 | else | |
2300 | dflt=n | |
2301 | fi | |
2302 | ;; | |
2303 | *) | |
2304 | case "$usenm" in | |
2305 | true) dflt=y;; | |
2306 | *) dflt=n;; | |
2307 | esac | |
2308 | ;; | |
2309 | esac | |
2310 | $cat <<EOM | |
2311 | ||
2312 | I can use 'nm' to extract the symbols from your C libraries. This is a time | |
2313 | consuming task which may generate huge output on the disk (up to 3 megabytes) | |
2314 | but that should make the symbols extraction faster. The alternative is to skip | |
2315 | the 'nm' extraction part and to compile a small test program instead to | |
2316 | determine whether each symbol is present. If you have a fast C compiler and/or | |
2317 | if your 'nm' output cannot be parsed, this may be the best solution. | |
2318 | ||
2319 | EOM | |
2320 | rp='Shall I use nm to extract C symbols from the libraries?' | |
2321 | . ./myread | |
2322 | case "$ans" in | |
2323 | n|N) usenm=false;; | |
2324 | *) usenm=true;; | |
2325 | esac | |
2326 | ||
2327 | runnm=$usenm | |
2328 | case "$reuseval" in | |
2329 | true) runnm=false;; | |
2330 | esac | |
2331 | ||
2332 | : nm options which may be necessary | |
2333 | case "$nm_opt" in | |
2334 | '') if $test -f /mach_boot; then | |
2335 | nm_opt='' | |
2336 | elif $test -d /usr/ccs/lib; then | |
2337 | nm_opt='-p' | |
2338 | elif $test -f /dgux; then | |
2339 | nm_opt='-p' | |
2340 | else | |
2341 | nm_opt='' | |
2342 | fi;; | |
2343 | esac | |
2344 | ||
2345 | case "$runnm" in | |
2346 | true) | |
2347 | : get list of predefined functions in a handy place | |
2348 | echo " " | |
2349 | case "$libc" in | |
2350 | '') libc=unknown | |
2351 | case "$libs" in | |
2352 | *-lc_s*) libc=`./loc libc_s.a $libc $libpth` | |
2353 | esac | |
2354 | ;; | |
2355 | esac | |
2356 | libpth="$plibpth $libpth" | |
2357 | libnames=''; | |
2358 | case "$libs" in | |
2359 | '') ;; | |
2360 | *) for thislib in $libs; do | |
2361 | case "$thislib" in | |
2362 | -l*) | |
2363 | thislib=`expr X$thislib : 'X-l\(.*\)'` | |
2364 | try=`./loc lib$thislib.a blurfl/dyick $libpth` | |
2365 | if test ! -f $try; then | |
2366 | try=`./loc lib$thislib blurfl/dyick $libpth` | |
2367 | if test ! -f $try; then | |
2368 | try=`./loc lib$thislib.so.'*' blurfl/dyick $libpth` | |
2369 | if test ! -f $try; then | |
2370 | try=`./loc $thislib blurfl/dyick $libpth` | |
2371 | if test ! -f $try; then | |
2372 | try=`./loc Slib$thislib.a blurfl/dyick $xlibpth` | |
2373 | if test ! -f $try; then | |
2374 | try='' | |
2375 | fi | |
2376 | fi | |
2377 | fi | |
2378 | fi | |
2379 | fi | |
2380 | libnames="$libnames $try" | |
2381 | ;; | |
2382 | *) libnames="$libnames $thislib" ;; | |
2383 | esac | |
2384 | done | |
2385 | ;; | |
2386 | esac | |
2387 | xxx=normal | |
2388 | case "$libc" in | |
2389 | unknown) | |
2390 | set /usr/ccs/lib/libc.so | |
2391 | $test -r $1 || set /usr/lib/libc.so | |
2392 | $test -r $1 || set /usr/shlib/libc.so | |
2393 | $test -r $1 || set /usr/lib/libc.so.[0-9]* | |
2394 | $test -r $1 || set /lib/libsys_s.a | |
2395 | eval set \$$# | |
2396 | ;; | |
2397 | *) | |
2398 | set blurfl | |
2399 | ;; | |
2400 | esac | |
2401 | if $test -r "$1"; then | |
2402 | echo "Your (shared) C library seems to be in $1." | |
2403 | libc="$1" | |
2404 | elif $test -r /lib/libc && $test -r /lib/clib; then | |
2405 | echo "Your C library seems to be in both /lib/clib and /lib/libc." | |
2406 | xxx=apollo | |
2407 | libc='/lib/clib /lib/libc' | |
2408 | if $test -r /lib/syslib; then | |
2409 | echo "(Your math library is in /lib/syslib.)" | |
2410 | libc="$libc /lib/syslib" | |
2411 | fi | |
2412 | elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then | |
2413 | echo "Your C library seems to be in $libc, as you said before." | |
2414 | elif $test -r $incpath/usr/lib/libc.a; then | |
2415 | libc=$incpath/usr/lib/libc.a; | |
2416 | echo "Your C library seems to be in $libc. That's fine." | |
2417 | elif $test -r /lib/libc.a; then | |
2418 | libc=/lib/libc.a; | |
2419 | echo "Your C library seems to be in $libc. You're normal." | |
2420 | else | |
2421 | if tans=`./loc libc.a blurfl/dyick $libpth`; $test -r "$tans"; then | |
2422 | : | |
2423 | elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then | |
2424 | libnames="$libnames "`./loc clib blurfl/dyick $libpth` | |
2425 | elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then | |
2426 | : | |
2427 | elif tans=`./loc Slibc.a blurfl/dyick $xlibpth`; $test -r "$tans"; then | |
2428 | : | |
2429 | elif tans=`./loc Mlibc.a blurfl/dyick $xlibpth`; $test -r "$tans"; then | |
2430 | : | |
2431 | else | |
2432 | tans=`./loc Llibc.a blurfl/dyick $xlibpth` | |
2433 | fi | |
2434 | if $test -r "$tans"; then | |
2435 | echo "Your C library seems to be in $tans, of all places." | |
2436 | libc=$tans | |
2437 | else | |
2438 | libc='blurfl' | |
2439 | fi | |
2440 | fi | |
2441 | if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then | |
2442 | dflt="$libc" | |
2443 | cat <<EOM | |
2444 | ||
2445 | If the guess above is wrong (which it might be if you're using a strange | |
2446 | compiler, or your machine supports multiple models), you can override it here. | |
2447 | ||
2448 | EOM | |
2449 | else | |
2450 | dflt='' | |
2451 | echo $libpth | tr ' ' '\012' | sort | uniq > libpath | |
2452 | cat >&4 <<EOM | |
2453 | I can't seem to find your C library. I've looked in the following places: | |
2454 | ||
2455 | EOM | |
2456 | $sed 's/^/ /' libpath | |
2457 | cat <<EOM | |
2458 | ||
2459 | None of these seems to contain your C library. I need to get its name... | |
2460 | ||
2461 | EOM | |
2462 | fi | |
2463 | fn=f | |
2464 | rp='Where is your C library?' | |
2465 | . ./getfile | |
2466 | libc="$ans" | |
2467 | ||
2468 | echo " " | |
2469 | echo $libc $libnames | tr ' ' '\012' | sort | uniq > libnames | |
2470 | set X `cat libnames` | |
2471 | shift | |
2472 | xxx=files | |
2473 | case $# in 1) xxx=file; esac | |
2474 | echo "Extracting names from the following $xxx for later perusal:" >&4 | |
2475 | echo " " | |
2476 | $sed 's/^/ /' libnames >&4 | |
2477 | echo " " | |
2478 | $echo $n "This may take a while...$c" >&4 | |
2479 | ||
2480 | nm $nm_opt $* 2>/dev/null >libc.tmp | |
2481 | $echo $n ".$c" | |
2482 | $grep fprintf libc.tmp > libc.ptf | |
2483 | xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4' | |
2484 | xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4' | |
2485 | if com="$sed -n -e 's/^.* [ADTS] *_[_.]*//p' -e 's/^.* [ADTS] //p'";\ | |
2486 | eval $xscan;\ | |
2487 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
2488 | eval $xrun | |
2489 | elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\ | |
2490 | eval $xscan;\ | |
2491 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
2492 | eval $xrun | |
2493 | elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\ | |
2494 | eval $xscan;\ | |
2495 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
2496 | eval $xrun | |
2497 | elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\ | |
2498 | eval $xscan;\ | |
2499 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
2500 | eval $xrun | |
2501 | elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\ | |
2502 | eval $xscan;\ | |
2503 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
2504 | eval $xrun | |
2505 | elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\ | |
2506 | eval $xscan;\ | |
2507 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
2508 | eval $xrun | |
2509 | elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \ | |
2510 | -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\ | |
2511 | eval $xscan;\ | |
2512 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
2513 | eval $xrun | |
2514 | elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\ | |
2515 | eval $xscan;\ | |
2516 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
2517 | eval $xrun | |
2518 | elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\ | |
2519 | eval $xscan;\ | |
2520 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
2521 | eval $xrun | |
2522 | else | |
2523 | nm -p $* 2>/dev/null >libc.tmp | |
2524 | com="$sed -n -e 's/^.* [ADTS] *_[_.]*//p' -e 's/^.* [ADTS] //p'";\ | |
2525 | eval "<libc.tmp $com >libc.list" | |
2526 | if $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
2527 | nm_opt='-p' | |
2528 | echo "done" >&4 | |
2529 | else | |
2530 | echo " " | |
2531 | echo "nm didn't seem to work right. Trying ar instead..." >&4 | |
2532 | com='' | |
2533 | if ar t $libc > libc.tmp; then | |
2534 | for thisname in $libnames; do | |
2535 | ar t $thisname >>libc.tmp | |
2536 | done | |
2537 | $sed -e 's/\.o$//' < libc.tmp > libc.list | |
2538 | echo "Ok." >&4 | |
2539 | else | |
2540 | echo "ar didn't seem to work right." >&4 | |
2541 | echo "Maybe this is a Cray...trying bld instead..." >&4 | |
2542 | if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then | |
2543 | for thisname in $libnames; do | |
2544 | bld t $libnames | \ | |
2545 | $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list | |
2546 | ar t $thisname >>libc.tmp | |
2547 | done | |
2548 | echo "Ok." >&4 | |
2549 | else | |
2550 | echo "That didn't work either. Giving up." >&4 | |
2551 | exit 1 | |
2552 | fi | |
2553 | fi | |
2554 | fi | |
2555 | fi | |
2556 | nm_extract="$com" | |
2557 | if $test -f /lib/syscalls.exp; then | |
2558 | echo " " | |
2559 | echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4 | |
2560 | $sed -n 's/^\([^ ]*\)[ ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list | |
2561 | fi | |
2562 | ;; | |
2563 | esac | |
2564 | $rm -f libnames libpath | |
2565 | ||
2566 | : is a C symbol defined? | |
2567 | csym='tlook=$1; | |
2568 | case "$3" in | |
2569 | -v) tf=libc.tmp; tc=""; tdc="";; | |
2570 | -a) tf=libc.tmp; tc="[0]"; tdc=[];; | |
2571 | *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";; | |
2572 | esac; | |
2573 | tx=yes; | |
2574 | case "$reuseval-$4" in | |
2575 | true-) ;; | |
2576 | true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;; | |
2577 | esac; | |
2578 | case "$tx" in | |
2579 | yes) | |
2580 | case "$runnm" in | |
2581 | true) | |
2582 | if $contains $tlook $tf >/dev/null 2>&1; | |
2583 | then tval=true; | |
2584 | else tval=false; | |
2585 | fi;; | |
2586 | *) | |
2587 | echo "main() { extern int $1$tdc; printf(\"%d\", $1$tc); }" > t.c; | |
2588 | if $cc $ccflags -o t t.c $ldflags $libs >/dev/null 2>&1; | |
2589 | then tval=true; | |
2590 | else tval=false; | |
2591 | fi; | |
2592 | $rm -f t t.c;; | |
2593 | esac;; | |
2594 | *) | |
2595 | case "$tval" in | |
2596 | $define) tval=true;; | |
2597 | *) tval=false;; | |
2598 | esac;; | |
2599 | esac; | |
2600 | eval "$2=$tval"' | |
2601 | ||
2602 | : set up the script used to warn in case of inconsistency | |
2603 | cat <<'EOSC' >whoa | |
2604 | dflt=y | |
2605 | echo " " | |
2606 | echo "*** WHOA THERE!!! ***" >&4 | |
2607 | echo " The $hint value for \$$var on this machine was \"$was\"!" >&4 | |
2608 | rp=" Keep the $hint value?" | |
2609 | . ./myread | |
2610 | case "$ans" in | |
2611 | y) td=$was; tu=$was;; | |
2612 | esac | |
2613 | EOSC | |
2614 | ||
2615 | : define an is-in-libc? function | |
2616 | inlibc='echo " "; td=$define; tu=$undef; | |
2617 | sym=$1; var=$2; eval "was=\$$2"; | |
2618 | tx=yes; | |
2619 | case "$reuseval$was" in | |
2620 | true) ;; | |
2621 | true*) tx=no;; | |
2622 | esac; | |
2623 | case "$tx" in | |
2624 | yes) | |
2625 | set $sym tres -f; | |
2626 | eval $csym; | |
2627 | case "$tres" in | |
2628 | true) | |
2629 | echo "$sym() found." >&4; | |
2630 | case "$was" in $undef) . whoa; esac; eval "$var=\$td";; | |
2631 | *) | |
2632 | echo "$sym() NOT found." >&4; | |
2633 | case "$was" in $define) . whoa; esac; eval "$var=\$tu";; | |
2634 | esac;; | |
2635 | *) | |
2636 | case "$was" in | |
2637 | $define) echo "$sym() found." >&4;; | |
2638 | *) echo "$sym() NOT found." >&4;; | |
2639 | esac;; | |
2640 | esac' | |
2641 | ||
2642 | : see how we invoke the C preprocessor | |
2643 | echo " " | |
2644 | echo "Now, how can we feed standard input to your C preprocessor..." >&4 | |
2645 | cat <<'EOT' >testcpp.c | |
2646 | #define ABC abc | |
2647 | #define XYZ xyz | |
2648 | ABC.XYZ | |
2649 | EOT | |
2650 | cd .. | |
2651 | echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin | |
2652 | chmod 755 cppstdin | |
2653 | wrapper=`pwd`/cppstdin | |
2654 | ok='false' | |
2655 | cd UU | |
2656 | ||
2657 | if $test "X$cppstdin" != "X" && \ | |
2658 | $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \ | |
2659 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 | |
2660 | then | |
2661 | echo "You used to use $cppstdin $cppminus so we'll use that again." | |
2662 | case "$cpprun" in | |
2663 | '') echo "But let's see if we can live without a wrapper..." ;; | |
2664 | *) | |
2665 | if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \ | |
2666 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 | |
2667 | then | |
2668 | echo "(And we'll use $cpprun $cpplast to preprocess directly.)" | |
2669 | ok='true' | |
2670 | else | |
2671 | echo "(However, $cpprun $cpplast does not work, let's see...)" | |
2672 | fi | |
2673 | ;; | |
2674 | esac | |
2675 | else | |
2676 | case "$cppstdin" in | |
2677 | '') ;; | |
2678 | *) | |
2679 | echo "Good old $cppstdin $cppminus does not seem to be of any help..." | |
2680 | ;; | |
2681 | esac | |
2682 | fi | |
2683 | ||
2684 | if $ok; then | |
2685 | : nothing | |
2686 | elif echo 'Maybe "'"$cc"' -E" will work...'; \ | |
2687 | $cc -E <testcpp.c >testcpp.out 2>&1; \ | |
2688 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
2689 | echo "Yup, it does." | |
2690 | x_cpp="$cc -E" | |
2691 | x_minus=''; | |
2692 | elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \ | |
2693 | $cc -E - <testcpp.c >testcpp.out 2>&1; \ | |
2694 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
2695 | echo "Yup, it does." | |
2696 | x_cpp="$cc -E" | |
2697 | x_minus='-'; | |
2698 | elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \ | |
2699 | $cc -P <testcpp.c >testcpp.out 2>&1; \ | |
2700 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
2701 | echo "Yipee, that works!" | |
2702 | x_cpp="$cc -P" | |
2703 | x_minus=''; | |
2704 | elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \ | |
2705 | $cc -P - <testcpp.c >testcpp.out 2>&1; \ | |
2706 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
2707 | echo "At long last!" | |
2708 | x_cpp="$cc -P" | |
2709 | x_minus='-'; | |
2710 | elif echo 'No such luck, maybe "'$cpp'" will work...'; \ | |
2711 | $cpp <testcpp.c >testcpp.out 2>&1; \ | |
2712 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
2713 | echo "It works!" | |
2714 | x_cpp="$cpp" | |
2715 | x_minus=''; | |
2716 | elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \ | |
2717 | $cpp - <testcpp.c >testcpp.out 2>&1; \ | |
2718 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
2719 | echo "Hooray, it works! I was beginning to wonder." | |
2720 | x_cpp="$cpp" | |
2721 | x_minus='-'; | |
2722 | elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \ | |
2723 | $wrapper <testcpp.c >testcpp.out 2>&1; \ | |
2724 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
2725 | x_cpp="$wrapper" | |
2726 | x_minus='' | |
2727 | echo "Eureka!" | |
2728 | else | |
2729 | dflt='' | |
2730 | rp="No dice. I can't find a C preprocessor. Name one:" | |
2731 | . ./myread | |
2732 | x_cpp="$ans" | |
2733 | x_minus='' | |
2734 | $x_cpp <testcpp.c >testcpp.out 2>&1 | |
2735 | if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
2736 | echo "OK, that will do." >&4 | |
2737 | else | |
2738 | echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4 | |
2739 | exit 1 | |
2740 | fi | |
2741 | fi | |
2742 | ||
2743 | case "$ok" in | |
2744 | false) | |
2745 | cppstdin="$x_cpp" | |
2746 | cppminus="$x_minus" | |
2747 | cpprun="$x_cpp" | |
2748 | cpplast="$x_minus" | |
2749 | set X $x_cpp | |
2750 | shift | |
2751 | case "$1" in | |
2752 | "$cpp") | |
2753 | echo "Perhaps can we force $cc -E using a wrapper..." | |
2754 | if $wrapper <testcpp.c >testcpp.out 2>&1; \ | |
2755 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 | |
2756 | then | |
2757 | echo "Yup, we can." | |
2758 | cppstdin="$wrapper" | |
2759 | cppminus=''; | |
2760 | else | |
2761 | echo "Nope, we'll have to live without it..." | |
2762 | fi | |
2763 | ;; | |
2764 | esac | |
2765 | case "$cpprun" in | |
2766 | "$wrapper") | |
2767 | cpprun='' | |
2768 | cpplast='' | |
2769 | ;; | |
2770 | esac | |
2771 | ;; | |
2772 | esac | |
2773 | ||
2774 | case "$cppstdin" in | |
2775 | "$wrapper") ;; | |
2776 | *) $rm -f $wrapper;; | |
2777 | esac | |
2778 | $rm -f testcpp.c testcpp.out | |
2779 | ||
2780 | : determine filename position in cpp output | |
2781 | echo " " | |
2782 | echo "Computing filename position in cpp output for #include directives..." >&4 | |
2783 | echo '#include <stdio.h>' > foo.c | |
2784 | $cat >fieldn <<EOF | |
2785 | $startsh | |
2786 | $cppstdin $cppminus $cppflags <foo.c 2>/dev/null | \ | |
2787 | $grep '^[ ]*#.*stdio\.h' | \ | |
2788 | while read cline; do | |
2789 | pos=1 | |
2790 | set \$cline | |
2791 | while $test \$# -gt 0; do | |
2792 | if $test -r \`echo \$1 | $tr -d '"'\`; then | |
2793 | echo "\$pos" | |
2794 | exit 0 | |
2795 | fi | |
2796 | shift | |
2797 | pos=\`expr \$pos + 1\` | |
2798 | done | |
2799 | done | |
2800 | EOF | |
2801 | chmod +x fieldn | |
2802 | fieldn=`./fieldn` | |
2803 | $rm -f foo.c fieldn | |
2804 | case $fieldn in | |
2805 | '') pos='???';; | |
2806 | 1) pos=first;; | |
2807 | 2) pos=second;; | |
2808 | 3) pos=third;; | |
2809 | *) pos="${fieldn}th";; | |
2810 | esac | |
2811 | echo "Your cpp writes the filename in the $pos field of the line." | |
2812 | ||
2813 | : locate header file | |
2814 | $cat >findhdr <<EOF | |
2815 | $startsh | |
2816 | wanted=\$1 | |
2817 | name='' | |
2818 | if test -f $usrinc/\$wanted; then | |
2819 | echo "$usrinc/\$wanted" | |
2820 | exit 0 | |
2821 | fi | |
2822 | awkprg='{ print \$$fieldn }' | |
2823 | echo "#include <\$wanted>" > foo\$\$.c | |
2824 | $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \ | |
2825 | $grep "^[ ]*#.*\$wanted" | \ | |
2826 | while read cline; do | |
2827 | name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\` | |
2828 | case "\$name" in | |
2829 | */\$wanted) echo "\$name"; exit 0;; | |
2830 | *) name='';; | |
2831 | esac; | |
2832 | done; | |
2833 | $rm -f foo\$\$.c; | |
2834 | case "\$name" in | |
2835 | '') exit 1;; | |
2836 | esac | |
2837 | EOF | |
2838 | chmod +x findhdr | |
2839 | ||
2840 | : access call always available on UNIX | |
2841 | set access d_access | |
2842 | eval $inlibc | |
2843 | ||
2844 | : locate the flags for 'access()' | |
2845 | case "$d_access" in | |
2846 | "$define") | |
2847 | echo " " | |
2848 | $cat >access.c <<'EOCP' | |
2849 | #include <sys/types.h> | |
2850 | #ifdef I_FCNTL | |
2851 | #include <fcntl.h> | |
2852 | #endif | |
2853 | #ifdef I_SYS_FILE | |
2854 | #include <sys/file.h> | |
2855 | #endif | |
2856 | #ifdef I_UNISTD | |
2857 | #include <unistd.h> | |
2858 | #endif | |
2859 | main() { | |
2860 | exit(R_OK); | |
2861 | } | |
2862 | EOCP | |
2863 | : check sys/file.h first, no particular reason here | |
2864 | if $test `./findhdr sys/file.h` && \ | |
2865 | $cc $cppflags -DI_SYS_FILE access.c -o access >/dev/null 2>&1 ; then | |
2866 | h_sysfile=true; | |
2867 | echo "<sys/file.h> defines the *_OK access constants." >&4 | |
2868 | elif $test `./findhdr fcntl.h` && \ | |
2869 | $cc $cppflags -DI_FCNTL access.c -o access >/dev/null 2>&1 ; then | |
2870 | h_fcntl=true; | |
2871 | echo "<fcntl.h> defines the *_OK access constants." >&4 | |
85e6fe83 LW |
2872 | elif $test `./findhdr unistd.h` && \ |
2873 | $cc $cppflags -DI_UNISTD access.c -o access >/dev/null 2>&1 ; then | |
2874 | echo "<unistd.h> defines the *_OK access constants." >&4 | |
2304df62 AD |
2875 | else |
2876 | echo "I can't find the four *_OK access constants--I'll use mine." >&4 | |
2877 | fi | |
2878 | ;; | |
2879 | esac | |
2880 | $rm -f access* | |
2881 | ||
2882 | : see if bcmp exists | |
2883 | set bcmp d_bcmp | |
2884 | eval $inlibc | |
2885 | ||
2886 | : see if bcopy exists | |
2887 | set bcopy d_bcopy | |
2888 | eval $inlibc | |
2889 | ||
2890 | : see if bzero exists | |
2891 | set bzero d_bzero | |
2892 | eval $inlibc | |
2893 | ||
2894 | : check for length of integer | |
2895 | echo " " | |
2896 | case "$intsize" in | |
2897 | '') | |
2898 | echo "Checking to see how big your integers are..." >&4 | |
2899 | $cat >try.c <<'EOCP' | |
2900 | #include <stdio.h> | |
2901 | main() | |
2902 | { | |
2903 | printf("%d\n", sizeof(int)); | |
2904 | } | |
2905 | EOCP | |
2906 | if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then | |
2907 | dflt=`./try` | |
2908 | else | |
2909 | dflt='4' | |
2910 | echo "(I can't seem to compile the test program. Guessing...)" | |
2911 | fi | |
2912 | ;; | |
2913 | *) | |
2914 | dflt="$intsize" | |
2915 | ;; | |
2916 | esac | |
2917 | rp="What is the size of an integer (in bytes)?" | |
2918 | . ./myread | |
2919 | intsize="$ans" | |
2920 | $rm -f try.c try | |
2921 | ||
2922 | : function used to set $1 to $val | |
2923 | setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef; | |
2924 | case "$val$was" in | |
2925 | $define$undef) . whoa; eval "$var=\$td";; | |
2926 | $undef$define) . whoa; eval "$var=\$tu";; | |
2927 | *) eval "$var=$val";; | |
2928 | esac' | |
2929 | ||
2930 | : check for ability to cast large floats to 32-bit ints. | |
2931 | echo " " | |
2932 | echo 'Checking whether your C compiler can cast large floats to int32.' >&4 | |
85e6fe83 | 2933 | if $test "$intsize" -eq 4; then |
2304df62 AD |
2934 | xxx=int |
2935 | else | |
2936 | xxx=long | |
2937 | fi | |
2938 | ||
2939 | $cat >try.c <<EOCP | |
2940 | #include <sys/types.h> | |
2941 | #include <signal.h> | |
2942 | blech() { exit(3); } | |
2943 | main() | |
2944 | { | |
2945 | $xxx i32; | |
2946 | double f; | |
2947 | int result = 0; | |
2948 | signal(SIGFPE, blech); | |
2949 | ||
2950 | f = (double) 0x7fffffff; | |
2951 | f = 10 * f; | |
2952 | i32 = ( $xxx )f; | |
2953 | ||
2954 | if (i32 != ( $xxx )f) | |
2955 | result |= 1; | |
2956 | exit(result); | |
2957 | } | |
2958 | EOCP | |
2959 | if $cc -o try $ccflags try.c >/dev/null 2>&1; then | |
2960 | ./try | |
2961 | yyy=$? | |
2962 | else | |
2963 | yyy=1 | |
2964 | fi | |
2965 | case "$yyy" in | |
2966 | 0) val="$define" | |
2967 | echo "Yup, it can." | |
2968 | ;; | |
2969 | *) val="$undef" | |
2970 | echo "Nope, it can't." | |
2971 | ;; | |
2972 | esac | |
2973 | set d_casti32 | |
2974 | eval $setvar | |
85e6fe83 | 2975 | $rm -f try try.* |
2304df62 AD |
2976 | : check for ability to cast negative floats to unsigned |
2977 | echo " " | |
2978 | echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4 | |
2979 | $cat >try.c <<'EOCP' | |
2980 | #include <signal.h> | |
2981 | blech() { exit(3); } | |
2982 | main() | |
2983 | { | |
2984 | double f = -123; | |
2985 | unsigned long along; | |
2986 | unsigned int aint; | |
2987 | unsigned short ashort; | |
2988 | int result = 0; | |
2989 | ||
2990 | signal(SIGFPE, blech); | |
2991 | along = (unsigned long)f; | |
2992 | aint = (unsigned int)f; | |
2993 | ashort = (unsigned short)f; | |
2994 | if (along != (unsigned long)-123) | |
2995 | result |= 1; | |
2996 | if (aint != (unsigned int)-123) | |
2997 | result |= 1; | |
2998 | if (ashort != (unsigned short)-123) | |
2999 | result |= 1; | |
3000 | f = (double)0x40000000; | |
3001 | f = f + f; | |
3002 | along = 0; | |
3003 | along = (unsigned long)f; | |
3004 | if (along != 0x80000000) | |
3005 | result |= 2; | |
3006 | f -= 1.; | |
3007 | along = 0; | |
3008 | along = (unsigned long)f; | |
3009 | if (along != 0x7fffffff) | |
3010 | result |= 1; | |
3011 | f += 2.; | |
3012 | along = 0; | |
3013 | along = (unsigned long)f; | |
3014 | if (along != 0x80000001) | |
3015 | result |= 2; | |
3016 | exit(result); | |
3017 | ||
3018 | } | |
3019 | EOCP | |
3020 | if $cc -o try $ccflags try.c >/dev/null 2>&1; then | |
3021 | ./try | |
3022 | castflags=$? | |
3023 | else | |
3024 | castflags=3 | |
3025 | fi | |
3026 | case "$castflags" in | |
3027 | 0) val="$define" | |
3028 | echo "Yup, it can." | |
3029 | ;; | |
3030 | *) val="$undef" | |
3031 | echo "Nope, it can't." | |
3032 | ;; | |
3033 | esac | |
3034 | set d_castneg | |
3035 | eval $setvar | |
3036 | $rm -f try.* | |
3037 | ||
3038 | : see if sprintf is declared as int or pointer to char | |
3039 | echo " " | |
3040 | $cat >ucbsprf.c <<'EOF' | |
3041 | main() | |
3042 | { | |
3043 | int sprintf(); | |
3044 | char buf[10]; | |
3045 | exit((unsigned long)sprintf(buf,"%s","foo") > 10L); | |
3046 | } | |
3047 | EOF | |
3048 | if $cc ucbsprf.c -o ucbsprf >/dev/null 2>&1 && ./ucbsprf; then | |
3049 | echo "Your sprintf() returns (int)." >&4 | |
3050 | val="$undef" | |
3051 | else | |
3052 | echo "Your sprintf() returns (char*)." >&4 | |
3053 | val="$define" | |
3054 | fi | |
3055 | set d_charsprf | |
3056 | eval $setvar | |
3057 | $rm -f ucbsprf* | |
3058 | ||
3059 | : see if vprintf exists | |
3060 | echo " " | |
3061 | if set vprintf val -f d_vprintf; eval $csym; $val; then | |
3062 | echo 'vprintf() found.' >&4 | |
3063 | val="$define" | |
3064 | $cat >vprintf.c <<'EOF' | |
3065 | #include <varargs.h> | |
3066 | ||
3067 | main() { xxx("foo"); } | |
3068 | ||
3069 | xxx(va_alist) | |
3070 | va_dcl | |
3071 | { | |
3072 | va_list args; | |
3073 | char buf[10]; | |
3074 | ||
3075 | va_start(args); | |
3076 | exit((unsigned long)vsprintf(buf,"%s",args) > 10L); | |
3077 | } | |
3078 | EOF | |
3079 | if $cc $ccflags vprintf.c -o vprintf >/dev/null 2>&1 && ./vprintf; then | |
3080 | echo "Your vsprintf() returns (int)." >&4 | |
3081 | val2="$undef" | |
3082 | else | |
3083 | echo "Your vsprintf() returns (char*)." >&4 | |
3084 | val2="$define" | |
3085 | fi | |
3086 | else | |
3087 | echo 'vprintf() NOT found.' >&4 | |
3088 | val="$undef" | |
3089 | val2="$undef" | |
3090 | fi | |
3091 | set d_vprintf | |
3092 | eval $setvar | |
3093 | val=$val2 | |
3094 | set d_charvspr | |
3095 | eval $setvar | |
3096 | ||
3097 | : see if chsize exists | |
3098 | set chsize d_chsize | |
3099 | eval $inlibc | |
3100 | ||
3101 | : check for const keyword | |
3102 | echo " " | |
3103 | echo 'Checking to see if your C compiler knows about "const"...' >&4 | |
3104 | $cat >const.c <<'EOCP' | |
3105 | typedef struct spug { int drokk; } spug; | |
3106 | main() | |
3107 | { | |
3108 | const char *foo; | |
3109 | const spug y; | |
3110 | } | |
3111 | EOCP | |
3112 | if $cc -c $ccflags const.c >/dev/null 2>&1 ; then | |
3113 | val="$define" | |
3114 | echo "Yup, it does." | |
3115 | else | |
3116 | val="$undef" | |
3117 | echo "Nope, it doesn't." | |
3118 | fi | |
3119 | set d_const | |
3120 | eval $setvar | |
3121 | ||
3122 | : see if crypt exists | |
3123 | echo " " | |
3124 | if set crypt val -f d_crypt; eval $csym; $val; then | |
3125 | echo 'crypt() found.' >&4 | |
3126 | val="$define" | |
3127 | cryptlib='' | |
3128 | else | |
3129 | cryptlib=`./loc Slibcrypt.a "" $xlibpth` | |
3130 | if $test -z "$cryptlib"; then | |
3131 | cryptlib=`./loc Mlibcrypt.a "" $xlibpth` | |
3132 | else | |
3133 | cryptlib=-lcrypt | |
3134 | fi | |
3135 | if $test -z "$cryptlib"; then | |
3136 | cryptlib=`./loc Llibcrypt.a "" $xlibpth` | |
3137 | else | |
3138 | cryptlib=-lcrypt | |
3139 | fi | |
3140 | if $test -z "$cryptlib"; then | |
3141 | cryptlib=`./loc libcrypt.a "" $libpth` | |
3142 | else | |
3143 | cryptlib=-lcrypt | |
3144 | fi | |
3145 | if $test -z "$cryptlib"; then | |
3146 | echo 'crypt() NOT found.' >&4 | |
3147 | val="$undef" | |
3148 | else | |
3149 | val="$define" | |
3150 | fi | |
3151 | fi | |
3152 | set d_crypt | |
3153 | eval $setvar | |
3154 | ||
3155 | : get csh whereabouts | |
3156 | case "$csh" in | |
3157 | 'csh') val="$undef" ;; | |
3158 | *) val="$define" ;; | |
3159 | esac | |
3160 | set d_csh | |
3161 | eval $setvar | |
3162 | ||
3163 | : see if this is a dirent system | |
3164 | echo " " | |
3165 | if xinc=`./findhdr dirent.h`; $test "$xinc"; then | |
3166 | val="$define" | |
3167 | echo "<dirent.h> found." >&4 | |
3168 | else | |
3169 | val="$undef" | |
3170 | if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then | |
3171 | echo "<sys/dir.h> found." >&4 | |
3172 | echo " " | |
3173 | else | |
3174 | xinc=`./findhdr sys/ndir.h` | |
3175 | fi | |
3176 | echo "<dirent.h> NOT found." >&4 | |
3177 | fi | |
3178 | set i_dirent | |
3179 | eval $setvar | |
3180 | ||
3181 | : see if the directory entry stores field length | |
3182 | echo " " | |
3183 | if $contains 'd_namlen' $xinc >/dev/null 2>&1; then | |
3184 | echo "Good, your directory entry keeps length information in d_namlen." >&4 | |
3185 | val="$define" | |
3186 | else | |
3187 | echo "Your directory entry does not know about the d_namlen field." >&4 | |
3188 | val="$undef" | |
3189 | fi | |
3190 | set d_dirnamlen | |
3191 | eval $setvar | |
3192 | ||
3193 | : now see if they want to do setuid emulation | |
3194 | case "$d_dosuid" in | |
3195 | '') dflt=n;; | |
3196 | "$undef") dflt=n;; | |
3197 | *) dflt=y;; | |
3198 | esac | |
3199 | cat <<EOM | |
3200 | ||
3201 | Some sites have disabled setuid #! scripts because of a bug in the kernel | |
3202 | that prevents them from being secure. If you are on such a system, the | |
3203 | setuid/setgid bits on scripts are currently useless. It is possible for | |
3204 | $package to detect those bits and emulate setuid/setgid in a secure fashion | |
3205 | until a better solution is devised for the kernel problem. | |
3206 | ||
3207 | EOM | |
3208 | rp="Do you want to do setuid/setgid emulation?" | |
3209 | . ./myread | |
3210 | case "$ans" in | |
3211 | y*) d_dosuid="$define";; | |
3212 | *) d_dosuid="$undef";; | |
3213 | esac | |
3214 | ||
3215 | : see if dup2 exists | |
3216 | set dup2 d_dup2 | |
3217 | eval $inlibc | |
3218 | ||
3219 | : see if fchmod exists | |
3220 | set fchmod d_fchmod | |
3221 | eval $inlibc | |
3222 | ||
3223 | : see if fchown exists | |
3224 | set fchown d_fchown | |
3225 | eval $inlibc | |
3226 | ||
3227 | : see if this is an fcntl system | |
3228 | set fcntl d_fcntl | |
3229 | eval $inlibc | |
3230 | ||
3231 | : see if we can have long filenames | |
3232 | echo " " | |
3233 | rmlist="$rmlist /tmp/cf$$" | |
3234 | $test -d /tmp/cf$$ || mkdir /tmp/cf$$ | |
3235 | first=123456789abcdef | |
3236 | second=/tmp/cf$$/$first | |
3237 | $rm -f $first $second | |
3238 | if (echo hi >$first) 2>/dev/null; then | |
3239 | if $test -f 123456789abcde; then | |
3240 | echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4 | |
3241 | val="$undef" | |
3242 | else | |
3243 | if (echo hi >$second) 2>/dev/null; then | |
3244 | if $test -f /tmp/cf$$/123456789abcde; then | |
3245 | $cat <<'EOM' | |
3246 | That's peculiar... You can have filenames longer than 14 characters, but only | |
3247 | on some of the filesystems. Maybe you are using NFS. Anyway, to avoid problems | |
3248 | I shall consider your system cannot support long filenames at all. | |
3249 | EOM | |
3250 | val="$undef" | |
3251 | else | |
3252 | echo 'You can have filenames longer than 14 characters.' >&4 | |
3253 | val="$define" | |
3254 | fi | |
3255 | else | |
3256 | $cat <<'EOM' | |
3257 | How confusing! Some of your filesystems are sane enough to allow filenames | |
3258 | longer than 14 characters but some others like /tmp can't even think about them. | |
3259 | So, for now on, I shall assume your kernel does not allow them at all. | |
3260 | EOM | |
3261 | val="$undef" | |
3262 | fi | |
3263 | fi | |
3264 | else | |
3265 | $cat <<'EOM' | |
3266 | You can't have filenames longer than 14 chars. You can't even think about them! | |
3267 | EOM | |
3268 | val="$undef" | |
3269 | fi | |
3270 | set d_flexfnam | |
3271 | eval $setvar | |
3272 | $rm -rf /tmp/cf$$ 123456789abcde* | |
3273 | ||
3274 | : see if flock exists | |
3275 | set flock d_flock | |
3276 | eval $inlibc | |
3277 | ||
3278 | : see if gethostent exists | |
3279 | set gethostent d_gethent | |
3280 | eval $inlibc | |
3281 | ||
3282 | : see if getpgrp exists | |
3283 | set getpgrp d_getpgrp | |
3284 | eval $inlibc | |
3285 | ||
3286 | : see if getpgrp2 exists | |
3287 | set getpgrp2 d_getpgrp2 | |
3288 | eval $inlibc | |
3289 | ||
3290 | : see if getpriority exists | |
3291 | set getpriority d_getprior | |
3292 | eval $inlibc | |
3293 | ||
85e6fe83 LW |
3294 | : define an alternate in-header-list? function |
3295 | inhdr='echo " "; td=$define; tu=$undef; yyy=$@; | |
3296 | cont=true; xxf="echo \"<\$1> found.\" >&4"; | |
3297 | case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";; | |
3298 | *) xxnf="echo \"<\$1> NOT found, ...\" >&4";; | |
3299 | esac; | |
3300 | case $# in 4) instead=instead;; *) instead="at last";; esac; | |
3301 | while $test "$cont"; do | |
3302 | xxx=`./findhdr $1` | |
3303 | var=$2; eval "was=\$$2"; | |
3304 | if $test "$xxx" && $test -r "$xxx"; | |
3305 | then eval $xxf; | |
3306 | eval "case \"\$$var\" in $undef) . whoa; esac"; eval "$var=\$td"; | |
3307 | cont=""; | |
3308 | else eval $xxnf; | |
3309 | eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu"; fi; | |
3310 | set $yyy; shift; shift; yyy=$@; | |
3311 | case $# in 0) cont="";; | |
3312 | 2) xxf="echo \"but I found <\$1> $instead.\" >&4"; | |
3313 | xxnf="echo \"and I did not find <\$1> either.\" >&4";; | |
3314 | *) xxf="echo \"but I found <\$1\> instead.\" >&4"; | |
3315 | xxnf="echo \"there is no <\$1>, ...\" >&4";; | |
3316 | esac; | |
3317 | done; | |
3318 | while $test "$yyy"; | |
3319 | do set $yyy; var=$2; eval "was=\$$2"; | |
3320 | eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu"; | |
3321 | set $yyy; shift; shift; yyy=$@; | |
3322 | done' | |
3323 | ||
3324 | : see if this is a netinet/in.h or sys/in.h system | |
3325 | set netinet/in.h i_niin sys/in.h i_sysin | |
3326 | eval $inhdr | |
3327 | ||
2304df62 AD |
3328 | : see if htonl --and friends-- exists |
3329 | set htonl d_htonl | |
3330 | eval $inlibc | |
85e6fe83 LW |
3331 | : Maybe they are macros. |
3332 | case "$d_htonl" in | |
3333 | 'define') ;; | |
3334 | *) cat > try.c <<EOM | |
3335 | #include <stdio.h> | |
3336 | #include <sys/types.h> | |
3337 | #$i_niin I_NETINET_IN | |
3338 | #$i_sysin I_SYS_IN | |
3339 | #ifdef I_NETINET_IN | |
3340 | # include <netinet/in.h> | |
3341 | #endif | |
3342 | #ifdef I_SYS_IN | |
3343 | # include <sys/in.h> | |
3344 | #endif | |
3345 | int main() | |
3346 | { | |
3347 | int x; | |
3348 | printf("x = ", htonl(7)); | |
3349 | } | |
3350 | EOM | |
3351 | if $cc $ccflags -c try.c >/dev/null 2>&1; then | |
3352 | d_htonl="$define" | |
3353 | echo "But it seems to be defined as a macro." | |
3354 | fi | |
3355 | $rm -f try.* try | |
3356 | ;; | |
3357 | esac | |
2304df62 AD |
3358 | : Look for isascii |
3359 | echo " " | |
3360 | $cat >isascii.c <<'EOCP' | |
3361 | #include <stdio.h> | |
3362 | #include <ctype.h> | |
3363 | main() { | |
3364 | int c = 'A'; | |
3365 | if (isascii(c)) | |
3366 | exit(0); | |
3367 | else | |
3368 | exit(1); | |
3369 | } | |
3370 | EOCP | |
3371 | if $cc $cppflags -o isascii isascii.c >/dev/null 2>&1 ; then | |
3372 | echo "isascii() found." | |
3373 | val="$define" | |
3374 | else | |
3375 | echo "isascii() NOT found." | |
3376 | val="$undef" | |
3377 | fi | |
3378 | set d_isascii | |
3379 | eval $setvar | |
3380 | $rm -f isascii* | |
3381 | : see if killpg exists | |
3382 | set killpg d_killpg | |
3383 | eval $inlibc | |
3384 | ||
3385 | : see if link exists | |
3386 | set link d_link | |
3387 | eval $inlibc | |
3388 | ||
3389 | : see if lstat exists | |
3390 | set lstat d_lstat | |
3391 | eval $inlibc | |
3392 | ||
3393 | : see if memcmp exists | |
3394 | set memcmp d_memcmp | |
3395 | eval $inlibc | |
3396 | ||
3397 | : see if memcpy exists | |
3398 | set memcpy d_memcpy | |
3399 | eval $inlibc | |
3400 | ||
3401 | : see if memmove exists | |
3402 | set memmove d_memmove | |
3403 | eval $inlibc | |
3404 | ||
3405 | : see if memset exists | |
3406 | set memset d_memset | |
3407 | eval $inlibc | |
3408 | ||
3409 | : see if mkdir exists | |
3410 | set mkdir d_mkdir | |
3411 | eval $inlibc | |
3412 | ||
3413 | : see if msgctl exists | |
3414 | set msgctl d_msgctl | |
3415 | eval $inlibc | |
3416 | ||
3417 | : see if msgget exists | |
3418 | set msgget d_msgget | |
3419 | eval $inlibc | |
3420 | ||
3421 | : see if msgsnd exists | |
3422 | set msgsnd d_msgsnd | |
3423 | eval $inlibc | |
3424 | ||
3425 | : see if msgrcv exists | |
3426 | set msgrcv d_msgrcv | |
3427 | eval $inlibc | |
3428 | ||
3429 | : see how much of the 'msg*(2)' library is present. | |
3430 | h_msg=true | |
3431 | echo " " | |
3432 | case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in | |
3433 | *"$undef"*) h_msg=false;; | |
3434 | esac | |
3435 | : we could also check for sys/ipc.h ... | |
3436 | if $h_msg && $test `./findhdr sys/msg.h`; then | |
3437 | echo "You have the full msg*(2) library." >&4 | |
3438 | val="$define" | |
3439 | else | |
3440 | echo "You don't have the full msg*(2) library." >&4 | |
3441 | val="$undef" | |
3442 | fi | |
3443 | set d_msg | |
3444 | eval $setvar | |
3445 | ||
85e6fe83 LW |
3446 | : determine which malloc to compile in |
3447 | : Old versions had dflt='y' only for bsd or v7. | |
3448 | echo " " | |
3449 | case "$usemymalloc" in | |
3450 | '') | |
3451 | if bsd || v7; then | |
3452 | dflt='y' | |
3453 | else | |
3454 | dflt='y' | |
3455 | fi | |
3456 | ;; | |
3457 | *) dflt="$usemymalloc" | |
3458 | ;; | |
3459 | esac | |
3460 | rp="Do you wish to attempt to use the malloc that comes with $package?" | |
3461 | . ./myread | |
3462 | usemymalloc="$ans" | |
3463 | case "$ans" in | |
3464 | y*) mallocsrc='malloc.c' | |
3465 | mallocobj='malloc.o' | |
3466 | d_mymalloc="$define" | |
3467 | ;; | |
3468 | *) mallocsrc='' | |
3469 | mallocobj='' | |
3470 | d_mymalloc="$undef" | |
3471 | ;; | |
3472 | esac | |
3473 | ||
3474 | : compute the type returned by malloc | |
3475 | echo " " | |
3476 | case "$malloctype" in | |
3477 | '') | |
3478 | if $test `./findhdr malloc.h`; then | |
3479 | echo "#include <malloc.h>" > malloc.c | |
3480 | fi | |
3481 | #include <malloc.h> | |
3482 | $cat >>malloc.c <<'END' | |
3483 | void *malloc(); | |
3484 | END | |
3485 | if $cc $ccflags -c malloc.c >/dev/null 2>&1; then | |
3486 | malloctype='void *' | |
3487 | else | |
3488 | malloctype='char *' | |
3489 | fi | |
3490 | $rm -f malloc.[co] | |
3491 | ;; | |
3492 | esac | |
3493 | echo "Your system wants malloc to return '$malloctype', it would seem." >&4 | |
3494 | ||
2304df62 AD |
3495 | socketlib='' |
3496 | sockethdr='' | |
3497 | : see whether socket exists | |
3498 | echo " " | |
3499 | $echo $n "Hmm... $c" >&4 | |
3500 | if set socket val -f d_socket; eval $csym; $val; then | |
3501 | echo "Looks like you have Berkeley networking support." >&4 | |
3502 | d_socket="$define" | |
3503 | if set setsockopt val -f; eval $csym; $val; then | |
3504 | d_oldsock="$undef" | |
3505 | else | |
3506 | echo "...but it uses the old 4.1c interface, rather than 4.2" >&4 | |
3507 | d_oldsock="$define" | |
3508 | fi | |
3509 | else | |
3510 | if $contains socklib libc.list >/dev/null 2>&1; then | |
3511 | echo "Looks like you have Berkeley networking support." >&4 | |
3512 | d_socket="$define" | |
3513 | : we will have to assume that it supports the 4.2 BSD interface | |
3514 | d_oldsock="$undef" | |
3515 | else | |
3516 | echo "You don't have Berkeley networking in libc.a..." >&4 | |
3517 | if test -f /usr/lib/libnet.a; then | |
3518 | ( (nm $nm_opt /usr/lib/libnet.a | eval $nm_extract) || \ | |
3519 | ar t /usr/lib/libnet.a) 2>/dev/null >> libc.list | |
3520 | if $contains socket libc.list >/dev/null 2>&1; then | |
3521 | echo "...but the Wollongong group seems to have hacked it in." >&4 | |
3522 | socketlib="-lnet" | |
3523 | sockethdr="-I/usr/netinclude" | |
3524 | d_socket="$define" | |
3525 | if $contains setsockopt libc.list >/dev/null 2>&1; then | |
3526 | d_oldsock="$undef" | |
3527 | else | |
3528 | echo "...using the old 4.1c interface, rather than 4.2" >&4 | |
3529 | d_oldsock="$define" | |
3530 | fi | |
3531 | else | |
3532 | echo "or even in libnet.a, which is peculiar." >&4 | |
3533 | d_socket="$undef" | |
3534 | d_oldsock="$undef" | |
3535 | fi | |
3536 | else | |
3537 | echo "or anywhere else I see." >&4 | |
3538 | d_socket="$undef" | |
3539 | d_oldsock="$undef" | |
3540 | fi | |
3541 | fi | |
3542 | fi | |
3543 | ||
3544 | : see if socketpair exists | |
3545 | set socketpair d_sockpair | |
3546 | eval $inlibc | |
3547 | ||
3548 | : Locate the flags for 'open()' | |
3549 | echo " " | |
3550 | $cat >open3.c <<'EOCP' | |
3551 | #include <sys/types.h> | |
3552 | #ifdef I_FCNTL | |
3553 | #include <fcntl.h> | |
3554 | #endif | |
3555 | #ifdef I_SYS_FILE | |
3556 | #include <sys/file.h> | |
3557 | #endif | |
3558 | main() { | |
3559 | if(O_RDONLY); | |
3560 | #ifdef O_TRUNC | |
3561 | exit(0); | |
3562 | #else | |
3563 | exit(1); | |
3564 | #endif | |
3565 | } | |
3566 | EOCP | |
3567 | : check sys/file.h first to get FREAD on Sun | |
3568 | if $test `./findhdr sys/file.h` && \ | |
3569 | $cc $cppflags "-DI_SYS_FILE" open3.c -o open3 >/dev/null 2>&1 ; then | |
3570 | h_sysfile=true; | |
3571 | echo "<sys/file.h> defines the O_* constants..." >&4 | |
3572 | if ./open3; then | |
3573 | echo "and you have the 3 argument form of open()." >&4 | |
3574 | val="$define" | |
3575 | else | |
3576 | echo "but not the 3 argument form of open(). Oh, well." >&4 | |
3577 | val="$undef" | |
3578 | fi | |
3579 | elif $test `./findhdr fcntl.h` && \ | |
3580 | $cc "-DI_FCNTL" open3.c -o open3 >/dev/null 2>&1 ; then | |
3581 | h_fcntl=true; | |
3582 | echo "<fcntl.h> defines the O_* constants..." >&4 | |
3583 | if ./open3; then | |
3584 | echo "and you have the 3 argument form of open()." >&4 | |
3585 | val="$define" | |
3586 | else | |
3587 | echo "but not the 3 argument form of open(). Oh, well." >&4 | |
3588 | val="$undef" | |
3589 | fi | |
3590 | else | |
3591 | val="$undef" | |
3592 | echo "I can't find the O_* constant definitions! You got problems." >&4 | |
3593 | fi | |
3594 | set d_open3 | |
3595 | eval $setvar | |
3596 | $rm -f open3* | |
3597 | ||
3598 | : see if this is a pwd system | |
3599 | echo " " | |
3600 | xxx=`./findhdr pwd.h` | |
3601 | if $test "$xxx"; then | |
3602 | i_pwd="$define" | |
3603 | echo "<pwd.h> found." >&4 | |
85e6fe83 | 3604 | $cppstdin $cppflags $cppminus < $xxx >$$.h |
2304df62 AD |
3605 | if $contains 'pw_quota' $$.h >/dev/null 2>&1; then |
3606 | d_pwquota="$define" | |
3607 | else | |
3608 | d_pwquota="$undef" | |
3609 | fi | |
3610 | if $contains 'pw_age' $$.h >/dev/null 2>&1; then | |
3611 | d_pwage="$define" | |
3612 | else | |
3613 | d_pwage="$undef" | |
3614 | fi | |
3615 | if $contains 'pw_change' $$.h >/dev/null 2>&1; then | |
3616 | d_pwchange="$define" | |
3617 | else | |
3618 | d_pwchange="$undef" | |
3619 | fi | |
3620 | if $contains 'pw_class' $$.h >/dev/null 2>&1; then | |
3621 | d_pwclass="$define" | |
3622 | else | |
3623 | d_pwclass="$undef" | |
3624 | fi | |
3625 | if $contains 'pw_expire' $$.h >/dev/null 2>&1; then | |
3626 | d_pwexpire="$define" | |
3627 | else | |
3628 | d_pwexpire="$undef" | |
3629 | fi | |
3630 | if $contains 'pw_comment' $$.h >/dev/null 2>&1; then | |
3631 | d_pwcomment="$define" | |
3632 | else | |
3633 | d_pwcomment="$undef" | |
3634 | fi | |
3635 | $rm -f $$.h | |
3636 | else | |
3637 | i_pwd="$undef" | |
3638 | d_pwquota="$undef" | |
3639 | d_pwage="$undef" | |
3640 | d_pwchange="$undef" | |
3641 | d_pwclass="$undef" | |
3642 | d_pwexpire="$undef" | |
3643 | d_pwcomment="$undef" | |
3644 | echo "<pwd.h> NOT found." >&4 | |
3645 | fi | |
3646 | ||
85e6fe83 | 3647 | : see if readdir and friends exist |
2304df62 AD |
3648 | set readdir d_readdir |
3649 | eval $inlibc | |
85e6fe83 LW |
3650 | set seekdir d_seekdir |
3651 | eval $inlibc | |
3652 | set telldir d_telldir | |
3653 | eval $inlibc | |
3654 | set rewinddir d_rewinddir | |
3655 | eval $inlibc | |
2304df62 AD |
3656 | |
3657 | : see if rename exists | |
3658 | set rename d_rename | |
3659 | eval $inlibc | |
3660 | ||
3661 | : see if rmdir exists | |
3662 | set rmdir d_rmdir | |
3663 | eval $inlibc | |
3664 | ||
3665 | : can bcopy handle overlapping blocks? | |
3666 | val="$undef" | |
3667 | case "$d_bcopy" in | |
3668 | "$define") | |
3669 | echo " " | |
3670 | echo "Checking to see if your bcopy() can do overlapping copies..." >&4 | |
3671 | $cat >foo.c <<'EOCP' | |
3672 | main() | |
3673 | { | |
85e6fe83 LW |
3674 | char buf[128], abc[128]; |
3675 | char *b; | |
3676 | int len; | |
3677 | int off; | |
3678 | int align; | |
3679 | bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36); | |
2304df62 AD |
3680 | |
3681 | for (align = 7; align >= 0; align--) { | |
3682 | for (len = 36; len; len--) { | |
3683 | b = buf+align; | |
85e6fe83 | 3684 | bcopy(abc, b, len); |
2304df62 AD |
3685 | for (off = 1; off <= len; off++) { |
3686 | bcopy(b, b+off, len); | |
3687 | bcopy(b+off, b, len); | |
85e6fe83 | 3688 | if (bcmp(b, abc, len)) |
2304df62 AD |
3689 | exit(1); |
3690 | } | |
3691 | } | |
3692 | } | |
3693 | exit(0); | |
3694 | } | |
3695 | EOCP | |
3696 | if $cc foo.c -o safebcpy $ccflags $libs >/dev/null 2>&1 ; then | |
3697 | if ./safebcpy 2>/dev/null; then | |
3698 | echo "Yes, it can." | |
3699 | val="$define" | |
3700 | else | |
3701 | echo "It can't, sorry." | |
3702 | fi | |
3703 | else | |
3704 | echo "(I can't compile the test program, so we'll assume not...)" | |
3705 | fi | |
3706 | ;; | |
3707 | esac | |
3708 | $rm -f foo.* safebcpy core | |
3709 | set d_safebcpy | |
3710 | eval $setvar | |
3711 | ||
3712 | : can memcpy handle overlapping blocks? | |
3713 | val="$undef" | |
3714 | case "$d_memcpy" in | |
3715 | "$define") | |
3716 | echo " " | |
3717 | echo "Checking to see if your memcpy() can do overlapping copies..." >&4 | |
3718 | $cat >foo.c <<'EOCP' | |
3719 | main() | |
3720 | { | |
85e6fe83 LW |
3721 | char buf[128], abc[128]; |
3722 | char *b; | |
3723 | int len; | |
3724 | int off; | |
3725 | int align; | |
3726 | ||
3727 | memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36); | |
2304df62 AD |
3728 | |
3729 | for (align = 7; align >= 0; align--) { | |
3730 | for (len = 36; len; len--) { | |
3731 | b = buf+align; | |
85e6fe83 | 3732 | memcpy(abc, b, len); |
2304df62 AD |
3733 | for (off = 1; off <= len; off++) { |
3734 | memcpy(b, b+off, len); | |
3735 | memcpy(b+off, b, len); | |
85e6fe83 | 3736 | if (memcmp(b, abc, len)) |
2304df62 AD |
3737 | exit(1); |
3738 | } | |
3739 | } | |
3740 | } | |
3741 | exit(0); | |
3742 | } | |
3743 | EOCP | |
3744 | if $cc foo.c -o safemcpy $ccflags $libs >/dev/null 2>&1 ; then | |
3745 | if ./safemcpy 2>/dev/null; then | |
3746 | echo "Yes, it can." | |
3747 | val="$define" | |
3748 | else | |
3749 | echo "It can't, sorry." | |
3750 | fi | |
3751 | else | |
3752 | echo "(I can't compile the test program, so we'll assume not...)" | |
3753 | fi | |
3754 | ;; | |
3755 | esac | |
3756 | $rm -f foo.* safemcpy core | |
3757 | set d_safemcpy | |
3758 | eval $setvar | |
3759 | ||
3760 | : see if select exists | |
3761 | set select d_select | |
3762 | eval $inlibc | |
3763 | ||
3764 | : see if semctl exists | |
3765 | set semctl d_semctl | |
3766 | eval $inlibc | |
3767 | ||
3768 | : see if semget exists | |
3769 | set semget d_semget | |
3770 | eval $inlibc | |
3771 | ||
3772 | : see if semop exists | |
3773 | set semop d_semop | |
3774 | eval $inlibc | |
3775 | ||
3776 | : see how much of the 'sem*(2)' library is present. | |
3777 | h_sem=true | |
3778 | echo " " | |
3779 | case "$d_semctl$d_semget$d_semop" in | |
3780 | *"$undef"*) h_sem=false;; | |
3781 | esac | |
3782 | : we could also check for sys/ipc.h ... | |
3783 | if $h_sem && $test `./findhdr sys/sem.h`; then | |
3784 | echo "You have the full sem*(2) library." >&4 | |
3785 | val="$define" | |
3786 | else | |
3787 | echo "You don't have the full sem*(2) library." >&4 | |
3788 | val="$undef" | |
3789 | fi | |
3790 | set d_sem | |
3791 | eval $setvar | |
3792 | ||
3793 | : see if setegid exists | |
3794 | set setegid d_setegid | |
3795 | eval $inlibc | |
3796 | ||
3797 | : see if seteuid exists | |
3798 | set seteuid d_seteuid | |
3799 | eval $inlibc | |
3800 | ||
3801 | : see if setlocale exists | |
3802 | set setlocale d_setlocale | |
3803 | eval $inlibc | |
3804 | : see if setpgid exists | |
3805 | set setpgid d_setpgid | |
3806 | eval $inlibc | |
3807 | ||
3808 | : see if setpgrp exists | |
3809 | set setpgrp d_setpgrp | |
3810 | eval $inlibc | |
3811 | ||
3812 | : see if setpgrp2 exists | |
3813 | set setpgrp2 d_setpgrp2 | |
3814 | eval $inlibc | |
3815 | ||
3816 | : see if setpriority exists | |
3817 | set setpriority d_setprior | |
3818 | eval $inlibc | |
3819 | ||
3820 | : see if setregid exists | |
3821 | set setregid d_setregid | |
3822 | eval $inlibc | |
3823 | set setresgid d_setresgid | |
3824 | eval $inlibc | |
3825 | ||
3826 | : see if setreuid exists | |
3827 | set setreuid d_setreuid | |
3828 | eval $inlibc | |
3829 | set setresuid d_setresuid | |
3830 | eval $inlibc | |
3831 | ||
3832 | : see if setrgid exists | |
3833 | set setrgid d_setrgid | |
3834 | eval $inlibc | |
3835 | ||
3836 | : see if setruid exists | |
3837 | set setruid d_setruid | |
3838 | eval $inlibc | |
3839 | ||
3840 | : see if setsid exists | |
3841 | set setsid d_setsid | |
3842 | eval $inlibc | |
3843 | ||
3844 | : see if shmctl exists | |
3845 | set shmctl d_shmctl | |
3846 | eval $inlibc | |
3847 | ||
3848 | : see if shmget exists | |
3849 | set shmget d_shmget | |
3850 | eval $inlibc | |
3851 | ||
3852 | : see if shmat exists | |
3853 | set shmat d_shmat | |
3854 | eval $inlibc | |
85e6fe83 LW |
3855 | : see what shmat returns |
3856 | d_voidshmat="$undef" | |
3857 | case "$d_shmat" in | |
3858 | define) | |
3859 | $cppstdin $cppflags $cppminus < $usrinc/sys/shm.h >voidshmat.txt 2>/dev/null | |
3860 | if $contains "void.*shmat" voidshmat.txt >/dev/null 2>&1; then | |
3861 | echo "and shmat returns (void*)" | |
3862 | d_voidshmat="$define" | |
3863 | else | |
3864 | echo "and shmat returns (char*)" | |
3865 | fi | |
3866 | ;; | |
3867 | esac | |
2304df62 AD |
3868 | : see if shmdt exists |
3869 | set shmdt d_shmdt | |
3870 | eval $inlibc | |
3871 | ||
3872 | : see how much of the 'shm*(2)' library is present. | |
3873 | h_shm=true | |
3874 | echo " " | |
3875 | case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in | |
3876 | *"$undef"*) h_shm=false;; | |
3877 | esac | |
3878 | : we could also check for sys/ipc.h ... | |
3879 | if $h_shm && $test `./findhdr sys/shm.h`; then | |
3880 | echo "You have the full shm*(2) library." >&4 | |
3881 | val="$define" | |
3882 | else | |
3883 | echo "You don't have the full shm*(2) library." >&4 | |
3884 | val="$undef" | |
3885 | fi | |
3886 | set d_shm | |
3887 | eval $setvar | |
3888 | ||
3889 | : see if stat knows about block sizes | |
3890 | echo " " | |
3891 | xxx=`./findhdr sys/stat.h` | |
3892 | if $contains 'st_blocks;' "$xxx" >/dev/null 2>&1 ; then | |
3893 | if $contains 'st_blksize;' "$xxx" >/dev/null 2>&1 ; then | |
3894 | echo "Your stat() knows about block sizes." >&4 | |
3895 | val="$define" | |
3896 | else | |
3897 | echo "Your stat() doesn't know about block sizes." >&4 | |
3898 | val="$undef" | |
3899 | fi | |
3900 | else | |
3901 | echo "Your stat() doesn't know about block sizes." >&4 | |
3902 | val="$undef" | |
3903 | fi | |
3904 | set d_statblks | |
3905 | eval $setvar | |
3906 | ||
3907 | : see if stdio is really std | |
3908 | echo " " | |
3909 | xxx=`./findhdr stdio.h` | |
3910 | if $contains 'char.*_ptr;' "$xxx" >/dev/null 2>&1 ; then | |
3911 | if $contains '_cnt;' "$xxx" >/dev/null 2>&1 ; then | |
3912 | echo "Your stdio is pretty std." >&4 | |
3913 | val="$define" | |
3914 | else | |
3915 | echo "Your stdio isn't very std." >&4 | |
3916 | val="$undef" | |
3917 | fi | |
3918 | else | |
3919 | echo "Your stdio isn't very std." >&4 | |
3920 | val="$undef" | |
3921 | fi | |
3922 | set d_stdstdio | |
3923 | eval $setvar | |
3924 | ||
3925 | : see which of string.h or strings.h is needed | |
3926 | echo " " | |
3927 | strings=`./findhdr string.h` | |
3928 | if $test "$strings" && $test -r "$strings"; then | |
3929 | echo "Using <string.h> instead of <strings.h>." >&4 | |
3930 | val="$define" | |
3931 | else | |
3932 | val="$undef" | |
3933 | strings=`./findhdr strings.h` | |
3934 | if $test "$strings" && $test -r "$strings"; then | |
3935 | echo "Using <strings.h> instead of <string.h>." >&4 | |
3936 | else | |
3937 | echo "No string header found -- You'll surely have problems." >&4 | |
3938 | fi | |
3939 | fi | |
3940 | set i_string | |
3941 | eval $setvar | |
3942 | case "$i_string" in | |
3943 | "$undef") strings=`./findhdr strings.h`;; | |
3944 | *) strings=`./findhdr string.h`;; | |
3945 | esac | |
3946 | ||
3947 | : index or strchr | |
3948 | echo " " | |
3949 | if set index val -f; eval $csym; $val; then | |
3950 | if set strchr val -f d_strchr; eval $csym; $val; then | |
3951 | if $contains strchr "$strings" >/dev/null 2>&1 ; then | |
3952 | val="$define" | |
3953 | vali="$undef" | |
3954 | echo "strchr() found." >&4 | |
3955 | else | |
3956 | val="$undef" | |
3957 | vali="$define" | |
3958 | echo "index() found." >&4 | |
3959 | fi | |
3960 | else | |
3961 | val="$undef" | |
3962 | vali="$define" | |
3963 | echo "index() found." >&4 | |
3964 | fi | |
3965 | else | |
3966 | if set strchr val -f d_strchr; eval $csym; $val; then | |
3967 | val="$define" | |
3968 | vali="$undef" | |
3969 | echo "strchr() found." >&4 | |
3970 | else | |
3971 | echo "No index() or strchr() found!" >&4 | |
3972 | val="$undef" | |
3973 | vali="$undef" | |
3974 | fi | |
3975 | fi | |
3976 | set d_strchr; eval $setvar | |
3977 | val="$vali" | |
3978 | set d_index; eval $setvar | |
3979 | ||
3980 | : check for structure copying | |
3981 | echo " " | |
3982 | echo "Checking to see if your C compiler can copy structs..." >&4 | |
3983 | $cat >try.c <<'EOCP' | |
3984 | main() | |
3985 | { | |
3986 | struct blurfl { | |
3987 | int dyick; | |
3988 | } foo, bar; | |
3989 | ||
3990 | foo = bar; | |
3991 | } | |
3992 | EOCP | |
3993 | if $cc -c try.c >/dev/null 2>&1 ; then | |
3994 | val="$define" | |
3995 | echo "Yup, it can." | |
3996 | else | |
3997 | val="$undef" | |
3998 | echo "Nope, it can't." | |
3999 | fi | |
4000 | set d_strctcpy | |
4001 | eval $setvar | |
4002 | $rm -f try.* | |
4003 | ||
4004 | : see if strerror and/or sys_errlist[] exist | |
4005 | echo " " | |
4006 | if set strerror val -f d_strerror; eval $csym; $val; then | |
4007 | echo 'strerror() found.' >&4 | |
4008 | d_strerror="$define" | |
4009 | d_strerrm="$undef" | |
4010 | if set sys_errlist val -a d_syserrlst; eval $csym; $val; then | |
4011 | echo "(You also have sys_errlist[], so we could roll our own strerror.)" | |
4012 | d_syserrlst="$define" | |
4013 | else | |
4014 | echo "(Since you don't have sys_errlist[], sterror() is welcome.)" | |
4015 | d_syserrlst="$undef" | |
4016 | fi | |
4017 | elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \ | |
4018 | $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then | |
4019 | echo 'strerror() found in string header.' >&4 | |
4020 | d_strerror="$define" | |
4021 | d_strerrm="$undef" | |
4022 | if set sys_errlist val -a d_syserrlst; eval $csym; $val; then | |
4023 | echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)" | |
4024 | d_syserrlst="$define" | |
4025 | else | |
4026 | echo "(You don't appear to have any sys_errlist[], how can this be?)" | |
4027 | d_syserrlst="$undef" | |
4028 | fi | |
4029 | elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then | |
4030 | echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4 | |
4031 | d_strerror="$undef" | |
4032 | d_syserrlst="$define" | |
4033 | d_strerrm="$define" | |
4034 | else | |
4035 | echo 'strerror() and sys_errlist[] NOT found.' >&4 | |
4036 | d_strerror="$undef" | |
4037 | d_syserrlst="$undef" | |
4038 | d_strerrm="$undef" | |
4039 | fi | |
4040 | ||
4041 | : see if symlink exists | |
4042 | set symlink d_symlink | |
4043 | eval $inlibc | |
4044 | ||
4045 | : see if syscall exists | |
4046 | set syscall d_syscall | |
4047 | eval $inlibc | |
4048 | ||
4049 | : see if system exists | |
4050 | set system d_system | |
4051 | eval $inlibc | |
4052 | ||
4053 | : see if times exists | |
4054 | echo " " | |
4055 | if set times val -f d_times; eval $csym; $val; then | |
4056 | echo 'times() found.' >&4 | |
4057 | d_times="$define" | |
4058 | case "$clocktype" in | |
4059 | '') | |
4060 | if $contains 'clock_t;' `./findhdr sys/types.h` >/dev/null 2>&1 ; then | |
4061 | dflt='clock_t'; | |
4062 | elif $contains 'clock_t;' `./findhdr sys/times.h` >/dev/null 2>&1; then | |
4063 | dflt='clock_t'; | |
4064 | else | |
4065 | dflt='long'; | |
4066 | fi | |
4067 | ;; | |
4068 | *) dflt="$clocktype" | |
4069 | ;; | |
4070 | esac | |
4071 | echo " " | |
4072 | rp="What type is returned by times() on this sytem?" | |
4073 | . ./myread | |
4074 | clocktype="$ans" | |
4075 | else | |
4076 | echo 'times() not found, hope that will do.' >&4 | |
4077 | d_times="$undef" | |
4078 | clocktype='int' | |
4079 | fi | |
4080 | ||
4081 | : see if truncate exists | |
4082 | set truncate d_truncate | |
4083 | eval $inlibc | |
4084 | ||
4085 | : see if we have to deal with yellow pages, now NIS. | |
4086 | if $test -d /usr/etc/yp || $test -d /etc/yp; then | |
4087 | if $test -f /usr/etc/nibindd; then | |
4088 | echo " " | |
4089 | echo "I'm fairly confident you're on a NeXT." | |
4090 | echo " " | |
4091 | rp='Do you get the hosts file via NetInfo?' | |
4092 | dflt=y | |
4093 | case "$hostcat" in | |
4094 | nidump*) ;; | |
4095 | '') ;; | |
4096 | *) dflt=n;; | |
4097 | esac | |
4098 | . ./myread | |
4099 | case "$ans" in | |
4100 | y*) hostcat='nidump hosts .';; | |
4101 | *) hostcat='cat /etc/hosts';; | |
4102 | esac | |
4103 | fi | |
4104 | case "$hostcat" in | |
4105 | nidump*) ;; | |
4106 | *) | |
4107 | case "$hostcat" in | |
4108 | *ypcat*) dflt=y;; | |
4109 | '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then | |
4110 | dflt=y | |
4111 | else | |
4112 | dflt=n | |
4113 | fi;; | |
4114 | *) dflt=n;; | |
4115 | esac | |
4116 | echo " " | |
4117 | rp='Are you getting the hosts file via yellow pages?' | |
4118 | . ./myread | |
4119 | case "$ans" in | |
4120 | y*) hostcat='ypcat hosts';; | |
4121 | *) hostcat='cat /etc/hosts';; | |
4122 | esac | |
4123 | ;; | |
4124 | esac | |
4125 | fi | |
4126 | ||
4127 | : now get the host name | |
4128 | echo " " | |
4129 | echo "Figuring out host name..." >&4 | |
4130 | case "$myhostname" in | |
4131 | '') cont=true | |
4132 | echo 'Maybe "hostname" will work...' | |
4133 | if tans=`sh -c hostname 2>&1` ; then | |
4134 | myhostname=$tans | |
4135 | phostname=hostname | |
4136 | cont='' | |
4137 | fi | |
4138 | ;; | |
4139 | *) cont='';; | |
4140 | esac | |
4141 | if $test "$cont"; then | |
4142 | if xenix; then | |
4143 | echo 'Oh, dear. Maybe "/etc/systemid" is the key...' | |
4144 | if tans=`cat /etc/systemid 2>&1` ; then | |
4145 | myhostname=$tans | |
4146 | phostname='cat /etc/systemid' | |
4147 | echo "Whadyaknow. Xenix always was a bit strange..." | |
4148 | cont='' | |
4149 | fi | |
4150 | elif $test -r /etc/systemid; then | |
4151 | echo "(What is a non-Xenix system doing with /etc/systemid?)" | |
4152 | fi | |
4153 | fi | |
4154 | if $test "$cont"; then | |
4155 | echo 'No, maybe "uuname -l" will work...' | |
4156 | if tans=`sh -c 'uuname -l' 2>&1` ; then | |
4157 | myhostname=$tans | |
4158 | phostname='uuname -l' | |
4159 | else | |
4160 | echo 'Strange. Maybe "uname -n" will work...' | |
4161 | if tans=`sh -c 'uname -n' 2>&1` ; then | |
4162 | myhostname=$tans | |
4163 | phostname='uname -n' | |
4164 | else | |
4165 | echo 'Oh well, maybe I can mine it out of whoami.h...' | |
4166 | if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then | |
4167 | myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'` | |
4168 | phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h" | |
4169 | else | |
4170 | case "$myhostname" in | |
4171 | '') echo "Does this machine have an identity crisis or something?" | |
4172 | phostname='';; | |
4173 | *) | |
4174 | echo "Well, you said $myhostname before..." | |
4175 | phostname='echo $myhostname';; | |
4176 | esac | |
4177 | fi | |
4178 | fi | |
4179 | fi | |
4180 | fi | |
4181 | : you do not want to know about this | |
4182 | set $myhostname | |
4183 | myhostname=$1 | |
4184 | ||
4185 | : translate upper to lower if necessary | |
4186 | case "$myhostname" in | |
4187 | *[A-Z]*) | |
4188 | myhostname=`echo $myhostname | tr '[A-Z]' '[a-z]'` | |
4189 | echo "(Normalizing case in your host name)" | |
4190 | ;; | |
4191 | esac | |
4192 | ||
4193 | : verify guess | |
4194 | if $test "$myhostname" ; then | |
4195 | dflt=y | |
4196 | rp='Your host name appears to be "'$myhostname'".'" Right?" | |
4197 | . ./myread | |
4198 | case "$ans" in | |
4199 | y*) ;; | |
4200 | *) myhostname='';; | |
4201 | esac | |
4202 | fi | |
4203 | ||
4204 | : bad guess or no guess | |
4205 | while $test "X$myhostname" = X ; do | |
4206 | dflt='' | |
4207 | rp="Please type the (one word) name of your host:" | |
4208 | . ./myread | |
4209 | myhostname="$ans" | |
4210 | done | |
4211 | ||
4212 | : a little sanity check here | |
4213 | case "$phostname" in | |
4214 | '') ;; | |
4215 | *) | |
4216 | case `$phostname` in | |
4217 | $myhostname$mydomain|$myhostname) ;; | |
4218 | *) | |
4219 | case "$phostname" in | |
4220 | sed*) | |
4221 | echo "(That doesn't agree with your whoami.h file, by the way.)" | |
4222 | ;; | |
4223 | *) | |
4224 | echo "(That doesn't agree with your $phostname command, by the way.)" | |
4225 | ;; | |
4226 | esac | |
4227 | ;; | |
4228 | esac | |
4229 | ;; | |
4230 | esac | |
4231 | ||
4232 | : see how we will look up host name | |
4233 | echo " " | |
4234 | if false; then | |
4235 | : dummy stub to allow use of elif | |
4236 | elif set uname val -f d_uname; eval $csym; $val; then | |
4237 | if xenix; then | |
4238 | $cat <<'EOM' | |
4239 | uname() was found, but you're running xenix, and older versions of xenix | |
4240 | have a broken uname(). If you don't really know whether your xenix is old | |
4241 | enough to have a broken system call, use the default answer. | |
4242 | ||
4243 | EOM | |
4244 | dflt=y | |
4245 | case "$d_uname" in | |
4246 | "$define") dflt=n;; | |
4247 | esac | |
4248 | rp='Is your uname() broken?' | |
4249 | . ./myread | |
4250 | case "$ans" in | |
4251 | n*) d_uname="$define"; call=uname;; | |
4252 | esac | |
4253 | else | |
4254 | echo 'uname() found.' >&4 | |
4255 | d_uname="$define" | |
4256 | call=uname | |
4257 | fi | |
4258 | fi | |
4259 | case "$d_gethname" in | |
4260 | '') d_gethname="$undef";; | |
4261 | esac | |
4262 | case "$d_uname" in | |
4263 | '') d_uname="$undef";; | |
4264 | esac | |
4265 | case "$d_phostname" in | |
4266 | '') d_phostname="$undef";; | |
4267 | esac | |
4268 | ||
2304df62 AD |
4269 | : see if there is a vfork |
4270 | set vfork d_vfork | |
4271 | eval $inlibc | |
85e6fe83 LW |
4272 | : But do we want to use it. vfork is reportedly unreliable in |
4273 | : perl in Solaris 2.x, and probably elsewhere. | |
4274 | case "$d_vfork" in | |
4275 | define) | |
4276 | dflt='n' | |
4277 | rp="Some systems have problems with vork. Do you want to use it?" | |
4278 | . ./myread | |
4279 | case "$ans" in | |
4280 | y|Y) ;; | |
4281 | *) echo "Ok, we won't use vfork." | |
4282 | d_vfork="$undef" | |
4283 | ;; | |
4284 | esac | |
4285 | ;; | |
4286 | esac | |
2304df62 AD |
4287 | : see if signal is declared as pointer to function returning int or void |
4288 | echo " " | |
4289 | xxx=`./findhdr signal.h` | |
4290 | $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null | |
4291 | if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then | |
4292 | echo "You have int (*signal())() instead of void." >&4 | |
4293 | val="$undef" | |
4294 | signal_t="int" | |
4295 | elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then | |
4296 | echo "You have void (*signal())() instead of int." >&4 | |
4297 | val="$define" | |
4298 | signal_t="void" | |
4299 | elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then | |
4300 | echo "You have int (*signal())() instead of void." >&4 | |
4301 | val="$undef" | |
4302 | signal_t="int" | |
4303 | else | |
4304 | case "$d_voidsig" in | |
4305 | '') | |
4306 | echo "I can't determine whether signal handler returns void or int..." >&4 | |
4307 | dflt=void | |
4308 | rp="What type does your signal handler returns?" | |
4309 | . ./myread | |
4310 | case "$ans" in | |
4311 | void) val="$define"; signal_t="void";; | |
4312 | *) val="$undef"; signal_t="int";; | |
4313 | esac;; | |
4314 | *) echo "As you already told me, signal handler returns $signal_t." >&4;; | |
4315 | esac | |
4316 | fi | |
4317 | set d_voidsig | |
4318 | eval $setvar | |
4319 | $rm -f $$.tmp | |
4320 | ||
4321 | : check for volatile keyword | |
4322 | echo " " | |
4323 | echo 'Checking to see if your C compiler knows about "volatile"...' >&4 | |
4324 | $cat >try.c <<'EOCP' | |
4325 | main() | |
4326 | { | |
4327 | typedef struct _goo_struct goo_struct; | |
4328 | goo_struct * volatile goo = ((goo_struct *)0); | |
4329 | struct _goo_struct { | |
4330 | long long_int; | |
4331 | int reg_int; | |
4332 | char char_var; | |
4333 | }; | |
4334 | typedef unsigned short foo_t; | |
4335 | char *volatile foo; | |
4336 | volatile int bar; | |
4337 | volatile foo_t blech; | |
4338 | foo = foo; | |
4339 | } | |
4340 | EOCP | |
4341 | if $cc -c $ccflags try.c >/dev/null 2>&1 ; then | |
4342 | val="$define" | |
4343 | echo "Yup, it does." | |
4344 | else | |
4345 | val="$undef" | |
4346 | echo "Nope, it doesn't." | |
4347 | fi | |
4348 | set d_volatile | |
4349 | eval $setvar | |
4350 | $rm -f try.* | |
4351 | ||
4352 | : see if there is a wait4 | |
4353 | set wait4 d_wait4 | |
4354 | eval $inlibc | |
4355 | ||
4356 | : see if waitpid exists | |
4357 | set waitpid d_waitpid | |
4358 | eval $inlibc | |
4359 | ||
4360 | : preserve RCS keywords in files with variable substitution, grrr | |
4361 | Date='$Date' | |
4362 | Id='$Id' | |
4363 | Log='$Log' | |
4364 | RCSfile='$RCSfile' | |
4365 | Revision='$Revision' | |
4366 | ||
2304df62 AD |
4367 | : is AFS running? |
4368 | echo " " | |
4369 | if test -d /afs; then | |
4370 | echo "AFS may be running... I'll be extra cautious then..." >&4 | |
4371 | afs=true | |
4372 | else | |
4373 | echo "AFS does not seem to be running..." >&4 | |
4374 | afs=false | |
4375 | fi | |
4376 | ||
4377 | : determine where public executables go | |
4378 | echo " " | |
4379 | case "$bin" in | |
4380 | '') | |
4381 | dflt=`./loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin` | |
4382 | ;; | |
4383 | *) | |
4384 | dflt="$bin" | |
4385 | ;; | |
4386 | esac | |
4387 | fn=d~ | |
4388 | rp='Pathname where the public executables will reside?' | |
4389 | . ./getfile | |
4390 | bin="$ans" | |
4391 | binexp="$ansexp" | |
4392 | if $afs; then | |
4393 | $cat <<EOM | |
4394 | ||
4395 | Since you are running AFS, I need to distinguish the directory in which | |
4396 | executables reside from the directory in which they are installed (and from | |
4397 | which they are presumably copied to the former directory by occult means). | |
4398 | ||
4399 | EOM | |
4400 | case "$installbin" in | |
4401 | '') dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;; | |
4402 | *) dflt="$installbin";; | |
4403 | esac | |
4404 | fn=de~ | |
4405 | rp='Where will public executables be installed?' | |
4406 | . ./getfile | |
4407 | installbin="$ans" | |
4408 | else | |
4409 | installbin="$binexp" | |
4410 | fi | |
4411 | ||
4412 | : check for ordering of bytes in a long | |
4413 | case "$byteorder" in | |
4414 | '') | |
4415 | $cat <<'EOM' | |
4416 | ||
4417 | In the following, larger digits indicate more significance. A big-endian | |
4418 | machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A | |
4419 | little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other | |
4420 | machines may have weird orders like 3412. A Cray will report 87654321. If | |
4421 | the test program works the default is probably right. | |
4422 | I'm now running the test program... | |
4423 | EOM | |
4424 | $cat >try.c <<'EOCP' | |
4425 | #include <stdio.h> | |
4426 | main() | |
4427 | { | |
4428 | int i; | |
4429 | union { | |
4430 | unsigned long l; | |
4431 | char c[sizeof(long)]; | |
4432 | } u; | |
4433 | ||
4434 | if (sizeof(long) > 4) | |
4435 | u.l = (0x08070605L << 32) | 0x04030201L; | |
4436 | else | |
4437 | u.l = 0x04030201L; | |
4438 | for (i = 0; i < sizeof(long); i++) | |
4439 | printf("%c", u.c[i]+'0'); | |
4440 | printf("\n"); | |
4441 | } | |
4442 | EOCP | |
4443 | if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then | |
4444 | dflt=`./try` | |
4445 | case "$dflt" in | |
4446 | ????|????????) echo "(The test program ran ok.)";; | |
4447 | *) echo "(The test program didn't run right for some reason.)";; | |
4448 | esac | |
4449 | else | |
4450 | dflt='4321' | |
4451 | cat <<'EOM' | |
4452 | (I can't seem to compile the test program. Guessing big-endian...) | |
4453 | EOM | |
4454 | fi | |
4455 | ;; | |
4456 | *) | |
4457 | echo " " | |
4458 | dflt="$byteorder" | |
4459 | ;; | |
4460 | esac | |
4461 | rp="What is the order of bytes in a long?" | |
4462 | . ./myread | |
4463 | byteorder="$ans" | |
4464 | $rm -f try.c try | |
4465 | ||
2304df62 AD |
4466 | : see if dlfcn is available |
4467 | set dlfcn.h i_dlfcn | |
4468 | eval $inhdr | |
2304df62 AD |
4469 | : determine which dynamic loading, if any, to compile in |
4470 | echo " " | |
4471 | case "$usedl" in | |
85e6fe83 LW |
4472 | '') case "$i_dlfcn" in |
4473 | define) dflt='y' ;; | |
4474 | *) dflt='n' ;; | |
4475 | esac | |
4476 | : Does a dl.c file exist for this operating system | |
4477 | $test -f ../ext/dl/dl_${osname}.c && dflt='y' | |
4478 | ;; | |
4479 | define|y|true) dflt='y' | |
4480 | usedl="$define" | |
4481 | ;; | |
4482 | *) dflt='n' | |
4483 | ;; | |
2304df62 AD |
4484 | esac |
4485 | rp="Do you wish to attempt to use dynamic loading?" | |
4486 | . ./myread | |
4487 | usedl="$ans" | |
4488 | case "$ans" in | |
85e6fe83 LW |
4489 | y*) usedl="$define" |
4490 | if $test -f ../ext/dl/dl_${osname}.c ; then | |
4491 | dflt="ext/dl/dl_${osname}.c" | |
4492 | else | |
4493 | dflt='ext/dl/dl.c' | |
4494 | fi | |
4495 | echo "The following dynamic loading files are available:" | |
4496 | cd ..; ls -C ext/dl/dl*.c; cd UU | |
4497 | rp="Source file to use for dynamic loading" | |
4498 | fn="fne~" | |
4499 | . ./getfile | |
4500 | : emulate basename and dirname | |
4501 | xxx=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@' -e 's@\.c$@@'` | |
4502 | dlobj=$xxx.o | |
4503 | dlsrc=$xxx.c | |
4504 | dldir=`echo $ans | $sed 's@\(.*\)/[^/]*$@\1@'` | |
4505 | case "$dldir" in | |
4506 | '') dldir="." ;; | |
4507 | *) ;; | |
4508 | esac | |
4509 | if $test -f ../$dldir/$dlsrc; then | |
4510 | usedl="$define" | |
4511 | else | |
4512 | echo "File $dlsrc does not exist -- ignored" | |
4513 | usedl="$undef" | |
4514 | fi | |
4515 | ||
4516 | cat << EOM | |
4517 | ||
4518 | Some systems may require passing special flags to $cc -c to | |
4519 | compile modules that will be used to create a shared library. | |
4520 | To use no flags, say "none". | |
4521 | EOM | |
4522 | case "$cccdlflags" in | |
4523 | ''|' ') case "$osname" in | |
4524 | hpux) dflt='+z' ;; | |
4525 | next) dflt='none' ;; | |
4526 | sunos) dflt='none' ;; | |
4527 | *) dflt='none' ;; | |
4528 | esac | |
4529 | ;; | |
4530 | *) dflt="$cccdlflags" ;; | |
4531 | esac | |
4532 | rp="Any special flags to pass to $cc -c to compile shared library modules?" | |
4533 | . ./myread | |
4534 | case "$ans" in | |
4535 | none) cccdlflags='' ;; | |
4536 | *) cccdlflags="$ans" ;; | |
4537 | esac | |
4538 | ||
4539 | cat << 'EOM' | |
4540 | ||
4541 | Some systems may require passing special flags to ld to | |
4542 | create a shared library. To use no flags, say "none". | |
4543 | EOM | |
4544 | case "$lddlflags" in | |
4545 | ''|' ') case "$osname" in | |
4546 | hpux) dflt='-b' ;; | |
4547 | next) dflt='none' ;; | |
4548 | sunos) dflt='none' ;; | |
4549 | *) dflt='none' ;; | |
4550 | esac | |
4551 | ;; | |
4552 | *) dflt="$lddlflags" ;; | |
4553 | esac | |
4554 | rp="Any special flags to pass to ld to create a shared library?" | |
4555 | . ./myread | |
4556 | case "$ans" in | |
4557 | none) lddlflags='' ;; | |
4558 | *) lddlflags="$ans" ;; | |
4559 | esac | |
4560 | ||
4561 | cat <<EOM | |
4562 | ||
4563 | Some systems may require passing special flags to $cc to indicate that | |
4564 | dynamic linking will be used. To use no flags, say "none". | |
4565 | EOM | |
4566 | case "$ccdlflags" in | |
4567 | ''|' ') | |
4568 | case "$osname" in | |
4569 | hpux) dflt='none' ;; | |
4570 | next) dflt='none' ;; | |
4571 | sunos) dflt='none' ;; | |
4572 | *) dflt='none' ;; | |
4573 | esac | |
4574 | ;; | |
4575 | *) dflt="$ccdlflags" | |
4576 | ;; | |
4577 | esac | |
4578 | rp="Any special flags to pass to $cc to use dynamic loading?" | |
4579 | . ./myread | |
4580 | case "$ans" in | |
4581 | none) ccdlflags='' ;; | |
4582 | *) ccdlflags="$ans" ;; | |
4583 | esac | |
4584 | cat <<EOM | |
4585 | ||
4586 | Some systems may require using a special suffix for shared libraries. | |
4587 | To create the shared library for POSIX, for example, you may need to | |
4588 | actually build the file POSIX.so. | |
4589 | ||
4590 | EOM | |
4591 | case "$shlibsuffix" in | |
4592 | '') | |
4593 | case "$osname" in | |
4594 | hpux) dflt='.sl' ;; | |
4595 | next) dflt='.so' ;; | |
4596 | sunos) dflt='.so' ;; | |
4597 | *) dflt='.so' ;; | |
4598 | esac | |
4599 | ;; | |
4600 | *) dflt="$shlibsuffix" | |
4601 | ;; | |
4602 | esac | |
4603 | rp="What is the suffix used for shared libraries?" | |
4604 | . ./myread | |
4605 | case "$ans" in | |
4606 | none) shlibsuffix='' ;; | |
4607 | *) shlibsuffix="$ans" ;; | |
4608 | esac | |
4609 | ;; | |
4610 | *) usedl="$undef" | |
4611 | : These are currently not used. | |
4612 | dlsrc='' | |
4613 | dlobj='' | |
4614 | dldir='' | |
4615 | lddlflags='' | |
4616 | ccdlflags='' | |
4617 | shlibsuffix='.o' | |
4618 | ;; | |
2304df62 | 4619 | esac |
85e6fe83 LW |
4620 | : see if we have the old dbm |
4621 | set dbm.h i_dbm | |
4622 | eval $inhdr | |
4623 | ||
4624 | : see if ndbm.h is available | |
4625 | set ndbm.h i_ndbm | |
4626 | eval $inhdr | |
4627 | ||
4628 | : see if gdbm.h is available | |
4629 | set gdbm.h i_gdbm | |
4630 | eval $inhdr | |
4631 | ||
4632 | : see if sdbm.h is wanted | |
2304df62 | 4633 | echo " " |
85e6fe83 LW |
4634 | echo "$package includes an implementation of sdbm in ext/dbm/sdbm." |
4635 | case "$i_sdbm" in | |
4636 | ''|' ') val="$define" ;; | |
4637 | *) val="$i_sdbm" ;; | |
4638 | esac | |
4639 | set i_sdbm | |
4640 | eval $setvar | |
2304df62 AD |
4641 | case "$extensions" in |
4642 | ' '|'') echo "Looking for extensions..." | |
4643 | case "$find" in | |
4644 | *find*) | |
4645 | cd .. | |
85e6fe83 LW |
4646 | extensions=`$find ext -type f -name \*.xs -print` |
4647 | set X $extensions | |
4648 | shift | |
4649 | extensions="$*" | |
2304df62 AD |
4650 | cd UU |
4651 | ;; | |
85e6fe83 | 4652 | *) extensions='ext/dbm/NDBM_File.xs ext/dbm/ODBM_File.xs ext/dbm/GDBM_File.xs ext/dbm/SDBM_File.xs ext/posix/POSIX.xs' |
2304df62 AD |
4653 | ;; |
4654 | esac | |
4655 | ;; | |
85e6fe83 LW |
4656 | none) extensions='' ;; |
4657 | *) ;; | |
2304df62 | 4658 | esac |
85e6fe83 LW |
4659 | : Now see which are supported on this system. |
4660 | dflt="" | |
4661 | for xxx in $extensions ; do | |
4662 | case "$xxx" in | |
4663 | *ODBM*) case "$i_dbm" in | |
4664 | define) dflt="$dflt $xxx" ;; | |
4665 | *) ;; | |
4666 | esac | |
4667 | ;; | |
4668 | *NDBM*) case "$i_ndbm" in | |
4669 | define) dflt="$dflt $xxx" ;; | |
4670 | *) ;; | |
4671 | esac | |
4672 | ;; | |
4673 | *GDBM*) case "$i_gdbm" in | |
4674 | define) dflt="$dflt $xxx" ;; | |
4675 | *) ;; | |
4676 | esac | |
4677 | ;; | |
4678 | *SDBM*) case "$i_sdbm" in | |
4679 | define) dflt="$dflt $xxx" ;; | |
4680 | *) ;; | |
4681 | esac | |
4682 | ;; | |
4683 | *) dflt="$dflt $xxx" | |
4684 | ;; | |
4685 | esac | |
4686 | done | |
4687 | ||
2304df62 AD |
4688 | rp="What extensions do you wish to include?" |
4689 | . ./myread | |
4690 | extensions="$ans" | |
4691 | ||
4692 | : see what type gids are declared as in the kernel | |
4693 | case "$gidtype" in | |
4694 | '') | |
4695 | if $contains 'gid_t;' `./findhdr sys/types.h` >/dev/null 2>&1 ; then | |
4696 | dflt='gid_t'; | |
4697 | else | |
4698 | xxx=`./findhdr sys/user.h` | |
4699 | set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short | |
4700 | case $1 in | |
4701 | unsigned) dflt="$1 $2" ;; | |
4702 | *) dflt="$1" ;; | |
4703 | esac | |
4704 | fi | |
4705 | ;; | |
4706 | *) dflt="$gidtype";; | |
4707 | esac | |
4708 | echo " " | |
4709 | rp="What is the type for group ids returned by getgid()?" | |
4710 | . ./myread | |
85e6fe83 LW |
4711 | val="$ans" |
4712 | set gidtype | |
4713 | eval $setvar | |
2304df62 AD |
4714 | : see if getgroups exists |
4715 | set getgroups d_getgrps | |
4716 | eval $inlibc | |
4717 | ||
4718 | case "$d_getgrps" in | |
4719 | 'define') | |
4720 | case "$groupstype" in | |
4721 | '') dflt="$gidtype" ;; | |
4722 | *) dflt="$groupstype" ;; | |
4723 | esac | |
4724 | echo " " | |
4725 | $cat <<EOM | |
4726 | What is the type of the second argument to getgroups()? Usually this | |
85e6fe83 | 4727 | is the same as group ids, $gidtype, but not always. |
2304df62 AD |
4728 | EOM |
4729 | rp="What type is the second arguement to getgroups()?" | |
4730 | . ./myread | |
85e6fe83 | 4731 | val="$ans" |
2304df62 | 4732 | ;; |
85e6fe83 | 4733 | *) val="$gidtype";; |
2304df62 | 4734 | esac |
85e6fe83 LW |
4735 | set groupstype |
4736 | eval $setvar | |
2304df62 AD |
4737 | : determine where private executables go |
4738 | case "$privlib" in | |
4739 | '') | |
4740 | dflt=/usr/lib/$package | |
4741 | $test -d /usr/local/lib && dflt=/usr/local/lib/$package | |
4742 | $test -d /local/lib && dflt=/local/lib/$package | |
4743 | ;; | |
4744 | *) dflt="$privlib" | |
4745 | ;; | |
4746 | esac | |
4747 | $cat <<EOM | |
4748 | ||
4749 | There are some auxiliary files for $package that need to be put into a | |
4750 | private library directory that is accessible by everyone. | |
4751 | ||
4752 | EOM | |
4753 | fn=d~+ | |
4754 | rp='Pathname where private library files will reside?' | |
4755 | . ./getfile | |
4756 | privlib="$ans" | |
4757 | privlibexp="$ansexp" | |
4758 | if $afs; then | |
4759 | $cat <<EOM | |
4760 | ||
4761 | Since you are running AFS, I need to distinguish the directory in which | |
4762 | private files reside from the directory in which they are installed (and from | |
4763 | which they are presumably copied to the former directory by occult means). | |
4764 | ||
4765 | EOM | |
4766 | case "$installprivlib" in | |
4767 | '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;; | |
4768 | *) dflt="$installprivlib";; | |
4769 | esac | |
4770 | fn=de~ | |
4771 | rp='Where will private files be installed?' | |
4772 | . ./getfile | |
4773 | installprivlib="$ans" | |
4774 | else | |
4775 | installprivlib="$privlibexp" | |
4776 | fi | |
4777 | ||
4778 | : determine where public libraries go | |
4779 | case "$lib" in | |
4780 | '') dflt=`./loc . "." /usr/local/lib /usr/lib /lib`;; | |
4781 | *) dflt="$lib";; | |
4782 | esac | |
4783 | echo " " | |
4784 | fn=d~ | |
4785 | rp='Where do you want to put the public libraries?' | |
4786 | . ./getfile | |
4787 | lib="$ans" | |
4788 | libexp="$ansexp" | |
4789 | ||
85e6fe83 LW |
4790 | : determine whether symbolic links are supported |
4791 | $touch blurfl | |
4792 | if $ln -s blurfl sym > /dev/null 2>&1 ; then | |
4793 | lns="$ln -s" | |
4794 | else | |
4795 | lns="$ln" | |
4796 | fi | |
4797 | rm -f blurfl sym | |
4798 | : see what type lseek is declared as in the kernel | |
4799 | case "$lseektype" in | |
2304df62 | 4800 | '') |
85e6fe83 LW |
4801 | if $contains 'off_t;' `./findhdr sys/types.h` >/dev/null 2>&1 ; then |
4802 | dflt='off_t'; | |
2304df62 | 4803 | else |
85e6fe83 | 4804 | dflt='long'; |
2304df62 AD |
4805 | fi |
4806 | ;; | |
85e6fe83 | 4807 | *) dflt="$lseektype" |
2304df62 AD |
4808 | ;; |
4809 | esac | |
2304df62 | 4810 | echo " " |
85e6fe83 LW |
4811 | rp="What type is lseek's offset on this system declared as?" |
4812 | . ./myread | |
4813 | lseektype="$ans" | |
2304df62 AD |
4814 | |
4815 | : determine where manual pages go | |
4816 | $cat <<EOM | |
4817 | ||
4818 | $package has manual pages available in source form. | |
4819 | EOM | |
4820 | case "$_nroff" in | |
4821 | nroff) | |
4822 | echo "However, you don't have nroff, so they're probably useless to you." | |
4823 | case "$mansrc" in | |
4824 | '') mansrc="none";; | |
4825 | esac;; | |
4826 | esac | |
4827 | echo "If you don't want the manual sources installed, answer 'none'." | |
4828 | case "$mansrc" in | |
4829 | '') | |
4830 | lookpath='/usr/local/man/man1 /usr/local/man/man1 /usr/man/manl' | |
4831 | lookpath="$lookpath /usr/man/local/man1 /usr/man/l_man/man1" | |
4832 | lookpath="$lookpath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1" | |
4833 | lookpath="$lookpath /usr/man/man.L" | |
4834 | mansrc=`./loc . $lookpath` | |
4835 | if $test -d "$mansrc"; then | |
4836 | dflt="$mansrc" | |
4837 | else | |
4838 | dflt="$sysman" | |
4839 | fi | |
4840 | ;; | |
4841 | *) dflt="$mansrc" | |
4842 | ;; | |
4843 | esac | |
4844 | echo " " | |
4845 | fn=dn~ | |
4846 | rp='Where do the manual pages (source) go?' | |
4847 | . ./getfile | |
4848 | mansrc="$ans" | |
4849 | mansrcexp="$ansexp" | |
4850 | if $afs; then | |
4851 | $cat <<EOM | |
4852 | ||
4853 | Since you are running AFS, I need to distinguish the directory in which | |
4854 | manual pages reside from the directory in which they are installed (and from | |
4855 | which they are presumably copied to the former directory by occult means). | |
4856 | ||
4857 | EOM | |
4858 | case "$installmansrc" in | |
4859 | '') dflt=`echo $mansrcexp | sed 's#^/afs/#/afs/.#'`;; | |
4860 | *) dflt="$installmansrc";; | |
4861 | esac | |
4862 | fn=de~ | |
4863 | rp='Where will man pages be installed?' | |
4864 | . ./getfile | |
4865 | installmansrc="$ans" | |
4866 | else | |
4867 | installmansrc="$mansrcexp" | |
4868 | fi | |
4869 | ||
4870 | ||
4871 | case "$mansrc" in | |
4872 | '') manext='0';; | |
4873 | *l) manext=l;; | |
4874 | *n) manext=n;; | |
4875 | *o) manext=l;; | |
4876 | *p) manext=n;; | |
4877 | *C) manext=C;; | |
4878 | *L) manext=L;; | |
4879 | *L1) manext=L1;; | |
4880 | *) manext=1;; | |
4881 | esac | |
4882 | ||
85e6fe83 LW |
4883 | : check for alignment requirements |
4884 | echo " " | |
4885 | case "$memalignbytes" in | |
4886 | '') echo "Checking alignment constraints..." >&4 | |
4887 | $cat >try.c <<'EOCP' | |
4888 | struct foobar { | |
4889 | char foo; | |
4890 | double bar; | |
4891 | } try; | |
4892 | main() | |
4893 | { | |
4894 | printf("%d\n", (char *)&try.bar - (char *)&try.foo); | |
4895 | } | |
4896 | EOCP | |
4897 | if $cc $ccflags try.c -o try >/dev/null 2>&1; then | |
4898 | dflt=`./try` | |
4899 | else | |
4900 | dflt='8' | |
4901 | echo"(I can't seem to compile the test program...)" | |
4902 | fi | |
4903 | ;; | |
4904 | *) dflt="$memalignbytes" | |
4905 | ;; | |
4906 | esac | |
4907 | rp="Doubles must be aligned on a how-many-byte boundary?" | |
4908 | . ./myread | |
4909 | memalignbytes="$ans" | |
4910 | $rm -f try.c try | |
4911 | ||
2304df62 AD |
4912 | : Cruising for prototypes |
4913 | echo " " | |
4914 | echo "Checking out function prototypes..." >&4 | |
4915 | $cat >prototype.c <<'EOCP' | |
4916 | main(int argc, char *argv[]) { | |
4917 | exit(0);} | |
4918 | EOCP | |
4919 | if $cc -c prototype.c >prototype.out 2>&1 ; then | |
4920 | echo "Your C compiler appears to support function prototypes." | |
4921 | val="$define" | |
4922 | else | |
4923 | echo "Your C compiler doesn't seem to understand function prototypes." | |
4924 | val="$undef" | |
4925 | fi | |
4926 | set prototype | |
4927 | eval $setvar | |
4928 | $rm -f prototype* | |
4929 | ||
85e6fe83 LW |
4930 | : check for length of pointer |
4931 | echo " " | |
4932 | case "$ptrsize" in | |
4933 | '') | |
4934 | echo "Checking to see how big your pointers are..." >&4 | |
4935 | $cat >try.c <<'EOCP' | |
4936 | #include <stdio.h> | |
4937 | main() | |
4938 | { | |
4939 | printf("%d\n", sizeof(char *)); | |
4940 | } | |
4941 | EOCP | |
4942 | if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then | |
4943 | dflt=`./try` | |
4944 | else | |
4945 | dflt='4' | |
4946 | echo "(I can't seem to compile the test program. Guessing...)" | |
4947 | fi | |
4948 | ;; | |
4949 | *) | |
4950 | dflt="$ptrsize" | |
4951 | ;; | |
4952 | esac | |
4953 | rp="What is the size of a pointer (in bytes)?" | |
4954 | . ./myread | |
4955 | ptrsize="$ans" | |
4956 | $rm -f try.c try | |
4957 | ||
2304df62 AD |
4958 | : check for size of random number generator |
4959 | echo " " | |
4960 | case "$randbits" in | |
4961 | '') | |
4962 | echo "Checking to see how many bits your rand function produces..." >&4 | |
4963 | $cat >try.c <<'EOCP' | |
4964 | #include <stdio.h> | |
4965 | main() | |
4966 | { | |
4967 | register int i; | |
4968 | register unsigned long tmp; | |
4969 | register unsigned long max = 0L; | |
4970 | ||
4971 | for (i = 1000; i; i--) { | |
4972 | tmp = (unsigned long)rand(); | |
4973 | if (tmp > max) max = tmp; | |
4974 | } | |
4975 | for (i = 0; max; i++) | |
4976 | max /= 2; | |
4977 | printf("%d\n",i); | |
4978 | } | |
4979 | EOCP | |
4980 | if $cc try.c -o try >/dev/null 2>&1 ; then | |
4981 | dflt=`try` | |
4982 | else | |
4983 | dflt='?' | |
4984 | echo "(I can't seem to compile the test program...)" | |
4985 | fi | |
4986 | ;; | |
4987 | *) | |
4988 | dflt="$randbits" | |
4989 | ;; | |
4990 | esac | |
4991 | rp='How many bits does your rand() function produce?' | |
4992 | . ./myread | |
4993 | randbits="$ans" | |
4994 | $rm -f try.c try | |
4995 | ||
85e6fe83 LW |
4996 | : see if ar generates random libraries by itself |
4997 | echo " " | |
4998 | echo "Checking how to generate random libraries on your machine..." >&4 | |
4999 | $cat >a.c <<EOP | |
5000 | f() { exit(0); } | |
5001 | EOP | |
5002 | cc -c a.c >/dev/null 2>&1 | |
5003 | ar rc ran.a a.o >/dev/null 2>&1 | |
5004 | $cat >b.c <<EOP | |
5005 | main() { f(); } | |
5006 | EOP | |
5007 | cp ran.a lib.a | |
5008 | if ar ts ran.a >/dev/null 2>&1; then | |
5009 | if $cc -o b b.c lib.a >/dev/null 2>&1; then | |
5010 | echo "ar appears to generate random libraries itself." | |
5011 | orderlib=false | |
5012 | ranlib=":" | |
5013 | else | |
5014 | echo "a table of contents needs to be added with 'ar ts'." | |
5015 | orderlib=false | |
5016 | ranlib="ar ts" | |
5017 | fi | |
5018 | else | |
5019 | if $test -f /usr/bin/ranlib; then | |
5020 | ranlib=/usr/bin/ranlib | |
5021 | elif $test -f /bin/ranlib; then | |
5022 | ranlib=/bin/ranlib | |
5023 | fi | |
5024 | ||
5025 | if $test -n "$ranlib"; then | |
5026 | echo "your system has $ranlib; we'll use that." | |
5027 | orderlib=false | |
5028 | else | |
5029 | echo "your system doesn't seem to support random libraries" | |
5030 | echo "so we'll use lorder and tsort to order the libraries." | |
5031 | orderlib=true | |
5032 | ranlib=":" | |
5033 | fi | |
5034 | fi | |
5035 | $rm -f a.* b.c b.o b ran.a lib.a | |
5036 | ||
2304df62 AD |
5037 | : determine where public executables go |
5038 | case "$scriptdir" in | |
5039 | '') | |
5040 | dflt="$bin" | |
5041 | : guess some guesses | |
5042 | $test -d /usr/share/scripts && dflt=/usr/share/scripts | |
5043 | $test -d /usr/share/bin && dflt=/usr/share/bin | |
5044 | $test -d /usr/local/script && dflt=/usr/local/script | |
5045 | ;; | |
5046 | *) dflt="$scriptdir" | |
5047 | ;; | |
5048 | esac | |
5049 | $cat <<EOM | |
5050 | ||
5051 | Some installations have a separate directory just for executable scripts so | |
5052 | that they can mount it across multiple architectures but keep the scripts in | |
5053 | one spot. You might, for example, have a subdirectory of /usr/share for this. | |
5054 | Or you might just lump your scripts in with all your other executables. | |
5055 | ||
5056 | EOM | |
5057 | fn=d~ | |
5058 | rp='Where do you keep publicly executable scripts?' | |
5059 | . ./getfile | |
5060 | scriptdir="$ans" | |
5061 | scriptdirexp="$ansexp" | |
5062 | if $afs; then | |
5063 | $cat <<EOM | |
5064 | ||
5065 | Since you are running AFS, I need to distinguish the directory in which | |
5066 | scripts reside from the directory in which they are installed (and from | |
5067 | which they are presumably copied to the former directory by occult means). | |
5068 | ||
5069 | EOM | |
5070 | case "$installscript" in | |
5071 | '') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;; | |
5072 | *) dflt="$installscript";; | |
5073 | esac | |
5074 | fn=de~ | |
5075 | rp='Where will public scripts be installed?' | |
5076 | . ./getfile | |
5077 | installscript="$ans" | |
5078 | else | |
5079 | installscript="$scriptdirexp" | |
5080 | fi | |
5081 | ||
5082 | : generate list of signal names | |
5083 | echo " " | |
5084 | case "$sig_name" in | |
5085 | '') | |
5086 | echo "Generating a list of signal names..." >&4 | |
5087 | xxx=`./findhdr signal.h`" "`./findhdr sys/signal.h` | |
5088 | set X `cat $xxx 2>&1 | $awk ' | |
5089 | $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ { | |
5090 | sig[$3] = substr($2,4,20) | |
5091 | if (max < $3 && $3 < 60) { | |
5092 | max = $3 | |
5093 | } | |
5094 | } | |
5095 | ||
5096 | END { | |
5097 | for (i = 1; i <= max; i++) { | |
5098 | if (sig[i] == "") | |
5099 | printf "%d", i | |
5100 | else | |
5101 | printf "%s", sig[i] | |
5102 | if (i < max) | |
5103 | printf " " | |
5104 | } | |
5105 | printf "\n" | |
5106 | } | |
5107 | '` | |
5108 | shift | |
5109 | case $# in | |
5110 | 0) | |
5111 | echo 'kill -l' >/tmp/foo$$ | |
5112 | set X `csh -f </tmp/foo$$` | |
5113 | $rm -f /tmp/foo$$ | |
5114 | shift | |
5115 | case $# in | |
5116 | 0)set HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM | |
5117 | ;; | |
5118 | esac | |
5119 | ;; | |
5120 | esac | |
5121 | sig_name="ZERO $*" | |
5122 | ;; | |
5123 | esac | |
5124 | echo "The following signals are available:" | |
85e6fe83 LW |
5125 | echo $sig_name | |
5126 | $awk 'BEGIN { linelen = 0 } | |
5127 | { for (i = 1; i < NF; i++) | |
5128 | { | |
5129 | name = "SIG" $i " " | |
5130 | linelen = linelen + length(name) | |
5131 | if (linelen > 70) | |
5132 | { | |
5133 | printf "\n" | |
5134 | linelen = length(name) | |
5135 | } | |
5136 | printf "%s", name } }' | |
2304df62 AD |
5137 | : see what type of char stdio uses. |
5138 | echo " " | |
5139 | if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then | |
5140 | echo "Your stdio uses unsigned chars." >&4 | |
5141 | stdchar="unsigned char" | |
5142 | else | |
5143 | echo "Your stdio uses signed chars." >&4 | |
5144 | stdchar="char" | |
5145 | fi | |
5146 | ||
85e6fe83 LW |
5147 | : see if time exists |
5148 | echo " " | |
5149 | if set time val -f d_time; eval $csym; $val; then | |
5150 | echo 'time() found.' >&4 | |
5151 | val="$define" | |
5152 | case "$timetype" in | |
5153 | '') | |
5154 | if $contains 'time_t;' `./findhdr sys/types.h` >/dev/null 2>&1 ; then | |
5155 | dflt='time_t'; | |
5156 | else | |
5157 | dflt='long'; | |
5158 | fi | |
5159 | ;; | |
5160 | *) dflt="$timetype" | |
5161 | ;; | |
5162 | esac | |
5163 | echo " " | |
5164 | rp="What type is returned by time() on this sytem?" | |
5165 | . ./myread | |
5166 | timetype="$ans" | |
5167 | else | |
5168 | echo 'time() not found, hope that will do.' >&4 | |
5169 | val="$undef" | |
5170 | timetype='int'; | |
5171 | fi | |
5172 | set d_time | |
5173 | eval $setvar | |
5174 | ||
2304df62 AD |
5175 | : see what type uids are declared as in the kernel |
5176 | case "$uidtype" in | |
5177 | '') | |
5178 | if $contains 'uid_t;' `./findhdr sys/types.h` >/dev/null 2>&1 ; then | |
5179 | dflt='uid_t'; | |
5180 | else | |
5181 | xxx=`./findhdr sys/user.h` | |
5182 | set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short | |
5183 | case $1 in | |
5184 | unsigned) dflt="$1 $2" ;; | |
5185 | *) dflt="$1" ;; | |
5186 | esac | |
5187 | fi | |
5188 | ;; | |
5189 | *) dflt="$uidtype";; | |
5190 | esac | |
5191 | echo " " | |
5192 | rp="What type are user ids on this system declared as?" | |
5193 | . ./myread | |
5194 | uidtype="$ans" | |
5195 | ||
5196 | : check for void type | |
5197 | echo " " | |
5198 | $cat >&4 <<EOM | |
5199 | Checking to see how well your C compiler groks the void type... | |
5200 | ||
5201 | Support flag bits are: | |
5202 | 1: basic void declarations. | |
5203 | 2: arrays of pointers to functions returning void. | |
5204 | 4: operations between pointers to and addresses of void functions. | |
5205 | 8: generic void pointers. | |
5206 | ||
5207 | EOM | |
5208 | case "$voidflags" in | |
5209 | '') | |
5210 | $cat >try.c <<'EOCP' | |
5211 | #if TRY & 1 | |
5212 | void main() { | |
5213 | #else | |
5214 | main() { | |
5215 | #endif | |
5216 | extern void moo(); /* function returning void */ | |
5217 | void (*goo)(); /* ptr to func returning void */ | |
5218 | #if TRY & 8 | |
5219 | void *hue; /* generic ptr */ | |
5220 | #endif | |
5221 | #if TRY & 2 | |
5222 | void (*foo[10])(); | |
5223 | #endif | |
5224 | ||
5225 | #if TRY & 4 | |
5226 | if(goo == moo) { | |
5227 | exit(0); | |
5228 | } | |
5229 | #endif | |
5230 | exit(0); | |
5231 | } | |
5232 | EOCP | |
5233 | if $cc -c -DTRY=$defvoidused try.c >.out 2>&1 ; then | |
5234 | voidflags=$defvoidused | |
5235 | echo "It appears to support void to the level $package wants ($defvoidused)." | |
5236 | if $contains warning .out >/dev/null 2>&1; then | |
5237 | echo "However, you might get some warnings that look like this:" | |
5238 | $cat .out | |
5239 | fi | |
5240 | else | |
5241 | echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4 | |
5242 | if $cc -c -DTRY=1 try.c >/dev/null 2>&1 ; then | |
5243 | echo "It supports 1..." | |
5244 | if $cc -c -DTRY=3 try.c >/dev/null 2>&1 ; then | |
5245 | echo "It also supports 2..." | |
5246 | if $cc -c -DTRY=7 try.c >/dev/null 2>&1 ; then | |
5247 | voidflags=7 | |
5248 | echo "And it supports 4 but not 8 definitely." | |
5249 | else | |
5250 | echo "It doesn't support 4..." | |
5251 | if $cc -c -DTRY=11 try.c >/dev/null 2>&1 ; then | |
5252 | voidflags=11 | |
5253 | echo "But it supports 8." | |
5254 | else | |
5255 | voidflags=3 | |
5256 | echo "Neither does it support 8." | |
5257 | fi | |
5258 | fi | |
5259 | else | |
5260 | echo "It does not support 2..." | |
5261 | if $cc -c -DTRY=13 try.c >/dev/null 2>&1 ; then | |
5262 | voidflags=13 | |
5263 | echo "But it supports 4 and 8." | |
5264 | else | |
5265 | if $cc -c -DTRY=5 try.c >/dev/null 2>&1 ; then | |
5266 | voidflags=5 | |
5267 | echo "And it supports 4 but has not heard about 8." | |
5268 | else | |
5269 | echo "However it supports 8 but not 4." | |
5270 | fi | |
5271 | fi | |
5272 | fi | |
5273 | else | |
5274 | echo "There is no support at all for void." | |
5275 | voidflags=0 | |
5276 | fi | |
5277 | fi | |
5278 | esac | |
5279 | dflt="$voidflags"; | |
5280 | rp="Your void support flags add up to what?" | |
5281 | . ./myread | |
5282 | voidflags="$ans" | |
5283 | $rm -f try.* .out | |
5284 | ||
5285 | : determine compiler compiler | |
5286 | case "$yacc" in | |
5287 | '') | |
5288 | dflt=yacc;; | |
5289 | *) | |
5290 | dflt="$yacc";; | |
5291 | esac | |
5292 | echo " " | |
5293 | rp="yacc" | |
5294 | if $test -f "$byacc"; then | |
5295 | dflt="$byacc" | |
5296 | rp="byacc or $rp" | |
5297 | fi | |
5298 | if $test -f "$bison"; then | |
5299 | rp="$rp or bison -y" | |
5300 | fi | |
5301 | $cat <<EOM | |
85e6fe83 | 5302 | $package no longer requires a compiler compiler, so the following is optional. |
2304df62 AD |
5303 | EOM |
5304 | rp="Which compiler compiler ($rp) shall I use?" | |
5305 | . ./myread | |
5306 | yacc="$ans" | |
5307 | case "$yacc" in | |
5308 | *bis*) | |
5309 | case "$yacc" in | |
5310 | *-y*) ;; | |
5311 | *) | |
5312 | yacc="$yacc -y" | |
5313 | echo "(Adding -y option to bison to get yacc-compatible behaviour.)" | |
5314 | ;; | |
5315 | esac | |
5316 | ;; | |
5317 | esac | |
5318 | ||
2304df62 AD |
5319 | : see if this is a sys/file.h system |
5320 | val='' | |
5321 | set sys/file.h val | |
5322 | eval $inhdr | |
5323 | ||
5324 | : do we need to #include <sys/file.h> ? | |
5325 | case "$val" in | |
5326 | "$define") | |
5327 | echo " " | |
5328 | if $h_sysfile; then | |
5329 | val="$define" | |
5330 | echo "We'll be including <sys/file.h>." >&4 | |
5331 | else | |
5332 | val="$undef" | |
5333 | echo "We won't be including <sys/file.h>." >&4 | |
5334 | fi | |
5335 | ;; | |
5336 | *) | |
5337 | h_sysfile=false | |
5338 | ;; | |
5339 | esac | |
5340 | set i_sysfile | |
5341 | eval $setvar | |
5342 | ||
5343 | : see if fcntl.h is there | |
5344 | val='' | |
5345 | set fcntl.h val | |
5346 | eval $inhdr | |
5347 | ||
5348 | : see if we can include fcntl.h | |
5349 | case "$val" in | |
5350 | "$define") | |
5351 | echo " " | |
5352 | if $h_fcntl; then | |
5353 | val="$define" | |
5354 | echo "We'll be including <fcntl.h>." >&4 | |
5355 | else | |
5356 | val="$undef" | |
5357 | if $h_sysfile; then | |
5358 | echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4 | |
5359 | else | |
5360 | echo "We won't be including <fcntl.h>." >&4 | |
5361 | fi | |
5362 | fi | |
5363 | ;; | |
5364 | *) | |
5365 | h_fcntl=false | |
5366 | val="$undef" | |
5367 | ;; | |
5368 | esac | |
5369 | set i_fcntl | |
5370 | eval $setvar | |
5371 | ||
2304df62 AD |
5372 | : see if this is an grp system |
5373 | set grp.h i_grp | |
5374 | eval $inhdr | |
5375 | ||
85e6fe83 LW |
5376 | : see if memory.h is available. |
5377 | set memory.h i_memory | |
2304df62 | 5378 | eval $inhdr |
85e6fe83 LW |
5379 | : See if it conflicts with string.h |
5380 | case "$i_memory" in | |
5381 | define) | |
5382 | case "$strings" in | |
5383 | '') ;; | |
5384 | *) $cppstdin $cppflags $cppminus < $strings > mem.h | |
5385 | if $contains 'memcpy' mem.h >/dev/null 2>&1; then | |
5386 | echo "We won't be including <memory.h>" | |
5387 | i_memory="$undef" | |
5388 | fi | |
5389 | rm -f mem.h | |
5390 | ;; | |
5391 | esac | |
5392 | esac | |
2304df62 AD |
5393 | : see if there are directory access routines out there |
5394 | echo " " | |
5395 | if $test `./findhdr ndir.h` && \ | |
5396 | ( $test -r /usr/lib/libndir.a || $test -r /usr/local/lib/libndir.a ); then | |
5397 | echo "Ndir library found." >&4 | |
5398 | if $test -r /usr/lib/libndir.a; then | |
5399 | ndirlib='-lndir' | |
5400 | else | |
5401 | ndirlib="/usr/local/lib/libndir.a" | |
5402 | fi | |
5403 | i_ndir="$define" | |
5404 | d_usendir="$undef" | |
5405 | ndirc='' | |
5406 | ndiro='' | |
5407 | else | |
5408 | ndirlib='' | |
5409 | i_ndir="$undef" | |
5410 | if set readdir val -f; eval $csym; $val; then | |
5411 | echo "No ndir library found, but you have readdir() so we'll use that." >&4 | |
5412 | d_usendir="$undef" | |
5413 | ndirc='' | |
5414 | ndiro='' | |
5415 | else | |
5416 | echo "No ndir library found--using ./ndir.c." >&4 | |
5417 | d_usendir="$define" | |
5418 | ndirc='ndir.c' | |
5419 | ndiro='ndir.o' | |
5420 | fi | |
5421 | fi | |
5422 | ||
85e6fe83 LW |
5423 | : see if net/errno.h is available |
5424 | set net/errno.h i_neterrno | |
2304df62 | 5425 | eval $inhdr |
85e6fe83 LW |
5426 | : Unfortunately, it causes problems on some systems. Arrgh. |
5427 | case '$i_neterrno' in | |
5428 | 'define') echo "<net/errno.h> found." | |
5429 | cat > try.c <<'EOM' | |
5430 | #include <stdio.h> | |
5431 | #include <errno.h> | |
5432 | #include <net/errno.h> | |
5433 | int func() | |
5434 | { | |
5435 | int x; | |
5436 | x = ENOTSOCK; | |
5437 | return x; | |
5438 | } | |
5439 | EOM | |
5440 | if $cc $ccflags -c try.c >/dev/null 2>&1; then | |
5441 | i_neterrno="$define" | |
5442 | else | |
5443 | echo "But it causes problems, so we won't include it" | |
5444 | i_neterrno="$undef" | |
5445 | fi | |
5446 | $rm -f try.* try | |
5447 | ;; | |
5448 | esac | |
2304df62 AD |
5449 | : see if stdarg is available |
5450 | set stdarg.h i_stdarg | |
5451 | eval $inhdr | |
5452 | ||
5453 | : see if stddef is available | |
5454 | set stddef.h i_stddef | |
5455 | eval $inhdr | |
5456 | ||
5457 | : see if this is an sysdir system | |
5458 | set sys/dir.h i_sysdir | |
5459 | eval $inhdr | |
5460 | ||
5461 | : get C preprocessor symbols handy | |
5462 | echo " " | |
5463 | echo $attrlist | $tr ' ' '\012' >Cppsym.know | |
5464 | $cat <<EOSS >Cppsym | |
5465 | $startsh | |
5466 | case "\$1" in | |
5467 | -l) list=true | |
5468 | shift | |
5469 | ;; | |
5470 | esac | |
5471 | unknown='' | |
5472 | case "\$list\$#" in | |
5473 | 1|2) | |
5474 | for sym do | |
5475 | if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then | |
5476 | exit 0 | |
5477 | elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then | |
5478 | : | |
5479 | else | |
5480 | unknown="\$unknown \$sym" | |
5481 | fi | |
5482 | done | |
5483 | set X \$unknown | |
5484 | shift | |
5485 | ;; | |
5486 | esac | |
5487 | case \$# in | |
5488 | 0) exit 1;; | |
5489 | esac | |
5490 | echo \$* | $tr ' ' '\012' | $sed -e 's/\(.*\)/\\ | |
5491 | #ifdef \1\\ | |
5492 | exit 0; _ _ _ _\1\\ \1\\ | |
5493 | #endif\\ | |
5494 | /' >Cppsym\$\$ | |
5495 | echo "exit 1; _ _ _" >>Cppsym\$\$ | |
5496 | $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _' >Cppsym2\$\$ | |
5497 | case "\$list" in | |
5498 | true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;; | |
5499 | *) | |
5500 | sh Cppsym2\$\$ | |
5501 | status=\$? | |
5502 | ;; | |
5503 | esac | |
5504 | $rm -f Cppsym\$\$ Cppsym2\$\$ | |
5505 | exit \$status | |
5506 | EOSS | |
5507 | chmod +x Cppsym | |
5508 | $eunicefix Cppsym | |
5509 | echo "Your C preprocessor defines the following symbols:" | |
5510 | Cppsym -l $attrlist >Cppsym.true | |
5511 | $cat Cppsym.true | |
5512 | ||
5513 | : see if this is a termio system | |
5514 | val="$undef" | |
5515 | val2="$undef" | |
5516 | val3="$undef" | |
5517 | if $test `./findhdr termios.h`; then | |
5518 | set tcsetattr i_termios | |
5519 | eval $inlibc | |
5520 | val3="$i_termios" | |
5521 | fi | |
5522 | echo " " | |
5523 | case "$val3" in | |
5524 | "$define") echo "You have POSIX termios.h... good!" >&4;; | |
5525 | *) if Cppsym pyr; then | |
5526 | case "`/bin/universe`" in | |
5527 | ucb) if $test `./findhdr sgtty.h`; then | |
5528 | val2="$define" | |
5529 | echo "<sgtty.h> found." >&4 | |
5530 | else | |
5531 | echo "System is pyramid with BSD universe." | |
5532 | echo "<sgtty.h> not found--you could have problems." >&4 | |
5533 | fi;; | |
5534 | *) if $test `./findhdr termio.h`; then | |
5535 | val="$define" | |
5536 | echo "<termio.h> found." >&4 | |
5537 | else | |
5538 | echo "System is pyramid with USG universe." | |
5539 | echo "<termio.h> not found--you could have problems." >&4 | |
5540 | fi;; | |
5541 | esac | |
5542 | elif usg; then | |
5543 | if $test `./findhdr termio.h`; then | |
5544 | echo "<termio.h> found." >&4 | |
5545 | val="$define" | |
5546 | elif $test `./findhdr sgtty.h`; then | |
5547 | echo "<sgtty.h> found." >&4 | |
5548 | val2="$define" | |
5549 | else | |
5550 | echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4 | |
5551 | fi | |
5552 | else | |
5553 | if $test `./findhdr sgtty.h`; then | |
5554 | echo "<sgtty.h> found." >&4 | |
5555 | val2="$define" | |
5556 | elif $test `./findhdr termio.h`; then | |
5557 | echo "<termio.h> found." >&4 | |
5558 | val="$define" | |
5559 | else | |
5560 | echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4 | |
5561 | fi | |
5562 | fi;; | |
5563 | esac | |
5564 | set i_termio; eval $setvar | |
5565 | val=$val2; set i_sgtty; eval $setvar | |
5566 | val=$val3; set i_termios; eval $setvar | |
5567 | ||
5568 | : see if ioctl defs are in sgtty/termio or sys/ioctl | |
5569 | echo " " | |
5570 | if $test `./findhdr sys/ioctl.h`; then | |
5571 | val="$define" | |
5572 | echo "<sys/ioctl.h> found." >&4 | |
5573 | else | |
5574 | val="$undef" | |
5575 | $test $i_termio = "$define" && xxx="termio.h" | |
5576 | $test $i_termios = "$define" && xxx="termios.h" | |
5577 | $test $i_sgtty = "$define" && xxx="sgtty.h" | |
5578 | echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4 | |
5579 | fi | |
5580 | set i_sysioctl | |
5581 | eval $setvar | |
5582 | ||
5583 | : see if this is an sysndir system | |
5584 | set sys/ndir.h i_sysndir | |
5585 | eval $inhdr | |
5586 | ||
5587 | : see if sys/select.h has to be included | |
5588 | set sys/select.h i_sysselct | |
5589 | eval $inhdr | |
5590 | ||
5591 | : see if we should include time.h, sys/time.h, or both | |
5592 | echo " " | |
5593 | echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4 | |
5594 | $echo $n "I'm now running the test program...$c" | |
5595 | $cat >try.c <<'EOCP' | |
5596 | #include <sys/types.h> | |
5597 | #ifdef I_TIME | |
5598 | #include <time.h> | |
5599 | #endif | |
5600 | #ifdef I_SYSTIME | |
5601 | #ifdef SYSTIMEKERNEL | |
5602 | #define KERNEL | |
5603 | #endif | |
5604 | #include <sys/time.h> | |
5605 | #endif | |
5606 | #ifdef I_SYSSELECT | |
5607 | #include <sys/select.h> | |
5608 | #endif | |
5609 | main() | |
5610 | { | |
5611 | struct tm foo; | |
5612 | #ifdef S_TIMEVAL | |
5613 | struct timeval bar; | |
5614 | #endif | |
5615 | #ifdef S_TIMEZONE | |
5616 | struct timezone tzp; | |
5617 | #endif | |
5618 | if (foo.tm_sec == foo.tm_sec) | |
5619 | exit(0); | |
5620 | #ifdef S_TIMEVAL | |
5621 | if (bar.tv_sec == bar.tv_sec) | |
5622 | exit(0); | |
5623 | #endif | |
5624 | exit(1); | |
5625 | } | |
5626 | EOCP | |
5627 | flags='' | |
5628 | s_timezone='' | |
5629 | sysselect='' | |
5630 | for s_timeval in '-DS_TIMEVAL' ''; do | |
5631 | for i_systimek in '' '-DSYSTIMEKERNEL'; do | |
5632 | for i_time in '' '-DI_TIME'; do | |
5633 | for i_systime in '-DI_SYSTIME' ''; do | |
5634 | case "$flags" in | |
5635 | '') $echo $n ".$c" | |
5636 | if $cc $ccflags \ | |
5637 | $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone \ | |
5638 | try.c -o try >/dev/null 2>&1 ; then | |
5639 | set X $i_time $i_systime $i_systimek $sysselect $s_timeval | |
5640 | shift | |
5641 | flags="$*" | |
5642 | echo " " | |
5643 | $echo $n "Succeeded with $flags$c" | |
5644 | fi | |
5645 | ;; | |
5646 | esac | |
5647 | done | |
5648 | done | |
5649 | done | |
5650 | done | |
5651 | timeincl='' | |
5652 | echo " " | |
5653 | case "$flags" in | |
5654 | *SYSTIMEKERNEL*) i_systimek="$define" | |
5655 | timeincl=`./findhdr sys/time.h` | |
5656 | echo "We'll include <sys/time.h> with KERNEL defined." >&4;; | |
5657 | *) i_systimek="$undef";; | |
5658 | esac | |
5659 | case "$flags" in | |
5660 | *I_TIME*) i_time="$define" | |
5661 | timeincl=`./findhdr time.h`" $timeincl" | |
5662 | echo "We'll include <time.h>." >&4;; | |
5663 | *) i_time="$undef";; | |
5664 | esac | |
5665 | case "$flags" in | |
5666 | *I_SYSTIME*) i_systime="$define" | |
5667 | timeincl=`./findhdr sys/time.h`" $timeincl" | |
5668 | echo "We'll include <sys/time.h>." >&4;; | |
5669 | *) i_systime="$undef";; | |
5670 | esac | |
5671 | $rm -f try.c try | |
5672 | ||
85e6fe83 LW |
5673 | : see if this is a unistd.h system |
5674 | set unistd.h i_unistd | |
5675 | eval $inhdr | |
5676 | ||
2304df62 AD |
5677 | : see if this is an utime system |
5678 | set utime.h i_utime | |
5679 | eval $inhdr | |
5680 | ||
5681 | : see if this is a varargs system | |
5682 | echo " " | |
5683 | if $test `./findhdr varargs.h`; then | |
5684 | val="$define" | |
5685 | echo "<varargs.h> found." >&4 | |
5686 | else | |
5687 | val="$undef" | |
5688 | echo "<varargs.h> NOT found, but that's ok (I hope)." >&4 | |
5689 | fi | |
5690 | set i_varargs | |
5691 | eval $setvar | |
5692 | ||
5693 | : set up the varargs testing programs | |
5694 | $cat > varargs.c <<EOP | |
5695 | #ifdef I_STDARG | |
5696 | #include <stdarg.h> | |
5697 | #endif | |
5698 | #ifdef I_VARARGS | |
5699 | #include <varargs.h> | |
5700 | #endif | |
5701 | ||
5702 | #ifdef I_STDARG | |
5703 | int f(char *p, ...) | |
5704 | #else | |
5705 | int f(va_alist) | |
5706 | va_dcl | |
5707 | #endif | |
5708 | { | |
5709 | va_list ap; | |
5710 | #ifndef I_STDARG | |
5711 | char *p; | |
5712 | #endif | |
5713 | #ifdef I_STDARG | |
5714 | va_start(ap,p); | |
5715 | #else | |
5716 | va_start(ap); | |
5717 | p = va_arg(ap, char *); | |
5718 | #endif | |
5719 | va_end(ap); | |
5720 | } | |
5721 | EOP | |
5722 | $cat > varargs <<EOP | |
5723 | if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then | |
5724 | echo "true" | |
5725 | else | |
5726 | echo "false" | |
5727 | fi | |
5728 | $rm -f varargs.o | |
5729 | EOP | |
5730 | chmod +x varargs | |
5731 | ||
5732 | : now check which varargs header should be included | |
5733 | echo " " | |
5734 | i_varhdr='' | |
5735 | case "$i_stdarg" in | |
5736 | "$define") | |
5737 | if `./varargs I_STDARG`; then | |
5738 | i_varhdr='stdarg.h' | |
5739 | i_varargs="$undef" | |
5740 | elif `./varargs I_VARARGS`; then | |
5741 | i_varhdr='varargs.h' | |
5742 | i_stdarg="$undef" | |
5743 | fi | |
5744 | ;; | |
5745 | *) | |
5746 | if `./varargs I_VARARGS`; then | |
5747 | i_varhdr='varargs.h' | |
5748 | fi | |
5749 | ;; | |
5750 | esac | |
5751 | case "$i_varhdr" in | |
5752 | '') | |
5753 | echo "I could not find the definition for va_dcl... You have problems..." >&4 | |
5754 | ;; | |
5755 | *) echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;; | |
5756 | esac | |
5757 | $rm -f varargs* | |
5758 | ||
5759 | : see if this is a vfork system | |
85e6fe83 LW |
5760 | case "$d_vfork" in |
5761 | define) set vfork.h i_vfork | |
5762 | eval $inhdr | |
5763 | ;; | |
5764 | *) i_vfork="$undef";; | |
5765 | esac | |
2304df62 AD |
5766 | : end of configuration questions |
5767 | echo " " | |
5768 | echo "End of configuration questions." | |
5769 | echo " " | |
5770 | ||
5771 | : back to where it started | |
5772 | if test -d ../UU; then | |
5773 | cd .. | |
5774 | fi | |
5775 | ||
5776 | : configuration may be patched via a 'config.over' file | |
5777 | if $test -f config.over; then | |
5778 | echo " " | |
5779 | dflt=y | |
5780 | rp='I see a config.over file. Do you wish to load it?' | |
5781 | . UU/myread | |
5782 | case "$ans" in | |
5783 | n*) echo "OK, I'll ignore it.";; | |
5784 | *) . ./config.over | |
5785 | echo "Configuration override changes have been loaded." | |
5786 | ;; | |
5787 | esac | |
5788 | fi | |
5789 | ||
5790 | : create config.sh file | |
5791 | echo " " | |
5792 | echo "Creating config.sh..." >&4 | |
5793 | $spitshell <<EOT >config.sh | |
5794 | $startsh | |
5795 | # | |
5796 | # This file was produced by running the Configure script. It holds all the | |
5797 | # definitions figured out by Configure. Should you modify one of these values, | |
5798 | # do not forget to propagate your changes by running "Configure -der". You may | |
5799 | # instead choose to run each of the .SH files by yourself, or "Configure -S". | |
5800 | # | |
5801 | ||
5802 | # Configuration time: $cf_time | |
5803 | # Configured by: $cf_by | |
5804 | # Target system: $myuname | |
5805 | ||
5806 | extensions='$extensions' | |
2304df62 AD |
5807 | d_eunice='$d_eunice' |
5808 | d_xenix='$d_xenix' | |
5809 | eunicefix='$eunicefix' | |
5810 | Mcc='$Mcc' | |
5811 | awk='$awk' | |
5812 | bash='$bash' | |
5813 | bison='$bison' | |
5814 | byacc='$byacc' | |
5815 | cat='$cat' | |
5816 | chgrp='$chgrp' | |
5817 | chmod='$chmod' | |
5818 | chown='$chown' | |
5819 | compress='$compress' | |
5820 | cp='$cp' | |
5821 | cpio='$cpio' | |
5822 | cpp='$cpp' | |
5823 | csh='$csh' | |
5824 | date='$date' | |
5825 | echo='$echo' | |
5826 | egrep='$egrep' | |
5827 | emacs='$emacs' | |
5828 | expr='$expr' | |
5829 | find='$find' | |
5830 | flex='$flex' | |
5831 | gcc='$gcc' | |
5832 | grep='$grep' | |
5833 | inews='$inews' | |
5834 | ksh='$ksh' | |
5835 | less='$less' | |
5836 | line='$line' | |
5837 | lint='$lint' | |
5838 | ln='$ln' | |
5839 | lp='$lp' | |
5840 | lpr='$lpr' | |
5841 | ls='$ls' | |
5842 | mail='$mail' | |
5843 | mailx='$mailx' | |
5844 | make='$make' | |
5845 | mkdir='$mkdir' | |
5846 | more='$more' | |
5847 | mv='$mv' | |
5848 | nroff='$nroff' | |
5849 | perl='$perl' | |
5850 | pg='$pg' | |
5851 | pmake='$pmake' | |
5852 | pr='$pr' | |
5853 | rm='$rm' | |
5854 | rmail='$rmail' | |
5855 | sed='$sed' | |
5856 | sendmail='$sendmail' | |
5857 | sh='$sh' | |
5858 | shar='$shar' | |
5859 | sleep='$sleep' | |
5860 | smail='$smail' | |
5861 | sort='$sort' | |
5862 | submit='$submit' | |
5863 | tail='$tail' | |
5864 | tar='$tar' | |
5865 | tbl='$tbl' | |
5866 | test='$test' | |
5867 | touch='$touch' | |
5868 | tr='$tr' | |
5869 | troff='$troff' | |
5870 | uname='$uname' | |
5871 | uniq='$uniq' | |
5872 | uuname='$uuname' | |
5873 | vi='$vi' | |
5874 | zcat='$zcat' | |
5875 | hint='$hint' | |
5876 | myuname='$myuname' | |
85e6fe83 LW |
5877 | osname='$osname' |
5878 | osvers='$osvers' | |
2304df62 AD |
5879 | Author='$Author' |
5880 | Date='$Date' | |
5881 | Header='$Header' | |
5882 | Id='$Id' | |
5883 | Locker='$Locker' | |
5884 | Log='$Log' | |
5885 | RCSfile='$RCSfile' | |
5886 | Revision='$Revision' | |
5887 | Source='$Source' | |
5888 | State='$State' | |
5889 | afs='$afs' | |
85e6fe83 | 5890 | memalignbytes='$memalignbytes' |
2304df62 AD |
5891 | bin='$bin' |
5892 | binexp='$binexp' | |
5893 | installbin='$installbin' | |
5894 | byteorder='$byteorder' | |
5895 | cc='$cc' | |
5896 | gccversion='$gccversion' | |
5897 | ccflags='$ccflags' | |
5898 | cppflags='$cppflags' | |
5899 | ldflags='$ldflags' | |
5900 | lkflags='$lkflags' | |
5901 | optimize='$optimize' | |
5902 | cf_by='$cf_by' | |
5903 | cf_time='$cf_time' | |
5904 | contains='$contains' | |
5905 | cpplast='$cpplast' | |
5906 | cppminus='$cppminus' | |
5907 | cpprun='$cpprun' | |
5908 | cppstdin='$cppstdin' | |
5909 | d_access='$d_access' | |
5910 | d_bcmp='$d_bcmp' | |
5911 | d_bcopy='$d_bcopy' | |
5912 | d_bzero='$d_bzero' | |
5913 | d_casti32='$d_casti32' | |
5914 | castflags='$castflags' | |
5915 | d_castneg='$d_castneg' | |
5916 | d_charsprf='$d_charsprf' | |
5917 | d_chsize='$d_chsize' | |
5918 | d_const='$d_const' | |
5919 | cryptlib='$cryptlib' | |
5920 | d_crypt='$d_crypt' | |
5921 | d_csh='$d_csh' | |
5922 | d_dosuid='$d_dosuid' | |
5923 | d_dup2='$d_dup2' | |
5924 | d_fchmod='$d_fchmod' | |
5925 | d_fchown='$d_fchown' | |
5926 | d_fcntl='$d_fcntl' | |
5927 | d_flexfnam='$d_flexfnam' | |
5928 | d_flock='$d_flock' | |
5929 | d_getgrps='$d_getgrps' | |
5930 | d_gethent='$d_gethent' | |
5931 | aphostname='$aphostname' | |
5932 | d_gethname='$d_gethname' | |
5933 | d_phostname='$d_phostname' | |
5934 | d_uname='$d_uname' | |
5935 | d_getpgrp2='$d_getpgrp2' | |
5936 | d_getpgrp='$d_getpgrp' | |
5937 | d_getprior='$d_getprior' | |
5938 | d_htonl='$d_htonl' | |
5939 | d_isascii='$d_isascii' | |
5940 | d_killpg='$d_killpg' | |
5941 | d_link='$d_link' | |
5942 | d_lstat='$d_lstat' | |
5943 | d_memcmp='$d_memcmp' | |
5944 | d_memcpy='$d_memcpy' | |
5945 | d_memmove='$d_memmove' | |
5946 | d_memset='$d_memset' | |
5947 | d_mkdir='$d_mkdir' | |
5948 | d_msg='$d_msg' | |
5949 | d_msgctl='$d_msgctl' | |
5950 | d_msgget='$d_msgget' | |
5951 | d_msgrcv='$d_msgrcv' | |
5952 | d_msgsnd='$d_msgsnd' | |
5953 | d_open3='$d_open3' | |
5954 | d_portable='$d_portable' | |
5955 | d_readdir='$d_readdir' | |
85e6fe83 LW |
5956 | d_rewinddir='$d_rewinddir' |
5957 | d_seekdir='$d_seekdir' | |
5958 | d_telldir='$d_telldir' | |
2304df62 AD |
5959 | d_rename='$d_rename' |
5960 | d_rmdir='$d_rmdir' | |
5961 | d_safebcpy='$d_safebcpy' | |
5962 | d_safemcpy='$d_safemcpy' | |
5963 | d_select='$d_select' | |
5964 | d_sem='$d_sem' | |
5965 | d_semctl='$d_semctl' | |
5966 | d_semget='$d_semget' | |
5967 | d_semop='$d_semop' | |
5968 | d_setegid='$d_setegid' | |
5969 | d_seteuid='$d_seteuid' | |
5970 | d_setlocale='$d_setlocale' | |
5971 | d_setpgid='$d_setpgid' | |
5972 | d_setpgrp2='$d_setpgrp2' | |
5973 | d_bsdpgrp='$d_bsdpgrp' | |
5974 | d_setpgrp='$d_setpgrp' | |
5975 | d_setprior='$d_setprior' | |
5976 | d_setregid='$d_setregid' | |
5977 | d_setresgid='$d_setresgid' | |
5978 | d_setresuid='$d_setresuid' | |
5979 | d_setreuid='$d_setreuid' | |
5980 | d_setrgid='$d_setrgid' | |
5981 | d_setruid='$d_setruid' | |
5982 | d_setsid='$d_setsid' | |
5983 | d_shm='$d_shm' | |
5984 | d_shmat='$d_shmat' | |
85e6fe83 | 5985 | d_voidshmat='$d_voidshmat' |
2304df62 AD |
5986 | d_shmctl='$d_shmctl' |
5987 | d_shmdt='$d_shmdt' | |
5988 | d_shmget='$d_shmget' | |
5989 | d_oldsock='$d_oldsock' | |
5990 | d_socket='$d_socket' | |
5991 | d_sockpair='$d_sockpair' | |
5992 | sockethdr='$sockethdr' | |
5993 | socketlib='$socketlib' | |
5994 | d_statblks='$d_statblks' | |
5995 | d_stdstdio='$d_stdstdio' | |
5996 | d_index='$d_index' | |
5997 | d_strchr='$d_strchr' | |
5998 | d_strctcpy='$d_strctcpy' | |
5999 | d_strerrm='$d_strerrm' | |
6000 | d_strerror='$d_strerror' | |
6001 | d_sysernlst='$d_sysernlst' | |
6002 | d_syserrlst='$d_syserrlst' | |
6003 | d_symlink='$d_symlink' | |
6004 | d_syscall='$d_syscall' | |
6005 | d_system='$d_system' | |
85e6fe83 LW |
6006 | d_time='$d_time' |
6007 | timetype='$timetype' | |
2304df62 AD |
6008 | clocktype='$clocktype' |
6009 | d_times='$d_times' | |
6010 | d_truncate='$d_truncate' | |
6011 | d_usendir='$d_usendir' | |
6012 | i_ndir='$i_ndir' | |
6013 | ndirc='$ndirc' | |
6014 | ndirlib='$ndirlib' | |
6015 | ndiro='$ndiro' | |
6016 | d_vfork='$d_vfork' | |
6017 | d_voidsig='$d_voidsig' | |
6018 | signal_t='$signal_t' | |
6019 | d_volatile='$d_volatile' | |
6020 | d_charvspr='$d_charvspr' | |
6021 | d_vprintf='$d_vprintf' | |
6022 | d_wait4='$d_wait4' | |
6023 | d_waitpid='$d_waitpid' | |
85e6fe83 LW |
6024 | cccdlflags='$cccdlflags' |
6025 | ccdlflags='$ccdlflags' | |
6026 | dldir='$dldir' | |
2304df62 AD |
6027 | dlobj='$dlobj' |
6028 | dlsrc='$dlsrc' | |
85e6fe83 LW |
6029 | lddlflags='$lddlflags' |
6030 | shlibsuffix='$shlibsuffix' | |
2304df62 AD |
6031 | usedl='$usedl' |
6032 | gidtype='$gidtype' | |
6033 | groupstype='$groupstype' | |
6034 | h_fcntl='$h_fcntl' | |
6035 | h_sysfile='$h_sysfile' | |
6036 | i_dbm='$i_dbm' | |
6037 | d_dirnamlen='$d_dirnamlen' | |
6038 | i_dirent='$i_dirent' | |
6039 | i_dlfcn='$i_dlfcn' | |
6040 | i_fcntl='$i_fcntl' | |
6041 | i_gdbm='$i_gdbm' | |
6042 | i_grp='$i_grp' | |
85e6fe83 | 6043 | i_memory='$i_memory' |
2304df62 | 6044 | i_ndbm='$i_ndbm' |
85e6fe83 | 6045 | i_neterrno='$i_neterrno' |
2304df62 AD |
6046 | i_niin='$i_niin' |
6047 | i_sysin='$i_sysin' | |
6048 | d_pwage='$d_pwage' | |
6049 | d_pwchange='$d_pwchange' | |
6050 | d_pwclass='$d_pwclass' | |
6051 | d_pwcomment='$d_pwcomment' | |
6052 | d_pwexpire='$d_pwexpire' | |
6053 | d_pwquota='$d_pwquota' | |
6054 | i_pwd='$i_pwd' | |
85e6fe83 | 6055 | i_sdbm='$i_sdbm' |
2304df62 AD |
6056 | i_stdarg='$i_stdarg' |
6057 | i_stddef='$i_stddef' | |
6058 | i_string='$i_string' | |
6059 | strings='$strings' | |
6060 | i_sysdir='$i_sysdir' | |
6061 | i_sysfile='$i_sysfile' | |
6062 | d_voidtty='$d_voidtty' | |
6063 | i_bsdioctl='$i_bsdioctl' | |
6064 | i_sysioctl='$i_sysioctl' | |
6065 | i_syssockio='$i_syssockio' | |
6066 | i_sysndir='$i_sysndir' | |
6067 | i_sysselct='$i_sysselct' | |
6068 | i_sgtty='$i_sgtty' | |
6069 | i_termio='$i_termio' | |
6070 | i_termios='$i_termios' | |
6071 | i_systime='$i_systime' | |
6072 | i_systimek='$i_systimek' | |
6073 | i_time='$i_time' | |
6074 | timeincl='$timeincl' | |
85e6fe83 | 6075 | i_unistd='$i_unistd' |
2304df62 AD |
6076 | i_utime='$i_utime' |
6077 | i_varargs='$i_varargs' | |
6078 | i_varhdr='$i_varhdr' | |
6079 | i_vfork='$i_vfork' | |
6080 | intsize='$intsize' | |
6081 | lib='$lib' | |
6082 | libexp='$libexp' | |
6083 | libc='$libc' | |
6084 | libpth='$libpth' | |
6085 | plibpth='$plibpth' | |
6086 | xlibpth='$xlibpth' | |
6087 | libs='$libs' | |
85e6fe83 LW |
6088 | lns='$lns' |
6089 | lseektype='$lseektype' | |
6090 | d_mymalloc='$d_mymalloc' | |
2304df62 AD |
6091 | mallocobj='$mallocobj' |
6092 | mallocsrc='$mallocsrc' | |
6093 | malloctype='$malloctype' | |
6094 | usemymalloc='$usemymalloc' | |
6095 | installmansrc='$installmansrc' | |
6096 | manext='$manext' | |
6097 | mansrc='$mansrc' | |
6098 | mansrcexp='$mansrcexp' | |
6099 | huge='$huge' | |
6100 | large='$large' | |
6101 | medium='$medium' | |
6102 | models='$models' | |
6103 | small='$small' | |
6104 | split='$split' | |
6105 | mydomain='$mydomain' | |
6106 | myhostname='$myhostname' | |
6107 | phostname='$phostname' | |
6108 | c='$c' | |
6109 | n='$n' | |
6110 | groupcat='$groupcat' | |
6111 | hostcat='$hostcat' | |
6112 | passcat='$passcat' | |
85e6fe83 LW |
6113 | orderlib='$orderlib' |
6114 | ranlib='$ranlib' | |
2304df62 AD |
6115 | package='$package' |
6116 | spackage='$spackage' | |
6117 | installprivlib='$installprivlib' | |
6118 | privlib='$privlib' | |
6119 | privlibexp='$privlibexp' | |
6120 | prototype='$prototype' | |
85e6fe83 | 6121 | ptrsize='$ptrsize' |
2304df62 AD |
6122 | randbits='$randbits' |
6123 | installscript='$installscript' | |
6124 | scriptdir='$scriptdir' | |
6125 | scriptdirexp='$scriptdirexp' | |
6126 | sig_name='$sig_name' | |
6127 | sharpbang='$sharpbang' | |
6128 | shsharp='$shsharp' | |
6129 | spitshell='$spitshell' | |
6130 | startsh='$startsh' | |
6131 | stdchar='$stdchar' | |
6132 | sysman='$sysman' | |
6133 | uidtype='$uidtype' | |
6134 | nm_opt='$nm_opt' | |
6135 | runnm='$runnm' | |
6136 | usenm='$usenm' | |
6137 | incpath='$incpath' | |
6138 | mips='$mips' | |
6139 | mips_type='$mips_type' | |
6140 | usrinc='$usrinc' | |
6141 | defvoidused='$defvoidused' | |
6142 | voidflags='$voidflags' | |
6143 | yacc='$yacc' | |
6144 | yaccflags='$yaccflags' | |
6145 | EOT | |
6146 | ||
6147 | : add special variables | |
6148 | $test -f patchlevel.h && \ | |
6149 | awk '/^#define/ {printf "%s=%s\n",$2,$3}' patchlevel.h >>config.sh | |
6150 | echo "CONFIG=true" >>config.sh | |
6151 | ||
6152 | : propagate old symbols | |
6153 | if $test -f UU/config.sh; then | |
6154 | <UU/config.sh sort | uniq >UU/oldconfig.sh | |
6155 | sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\ | |
6156 | sort | uniq -u >UU/oldsyms | |
6157 | set X `cat UU/oldsyms` | |
6158 | shift | |
6159 | case $# in | |
6160 | 0) ;; | |
6161 | *) | |
6162 | cat <<EOM | |
6163 | Hmm...You had some extra variables I don't know about...I'll try to keep 'em... | |
6164 | EOM | |
6165 | echo "# Variables propagated from previous config.sh file." >>config.sh | |
6166 | for sym in `cat UU/oldsyms`; do | |
6167 | echo " Propagating $hint variable "'$'"$sym..." | |
6168 | eval 'tmp="$'"${sym}"'"' | |
6169 | echo "$tmp" | \ | |
6170 | sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh | |
6171 | done | |
6172 | ;; | |
6173 | esac | |
6174 | fi | |
6175 | ||
6176 | : Finish up by extracting the .SH files | |
6177 | case "$alldone" in | |
6178 | exit) | |
6179 | $rm -rf UU | |
6180 | echo "Done." | |
6181 | exit 0 | |
6182 | ;; | |
6183 | cont) | |
6184 | ;; | |
6185 | '') | |
6186 | echo " " | |
6187 | dflt='' | |
6188 | nostick=true | |
6189 | echo "If you didn't make any mistakes, then just type a carriage return here." | |
6190 | rp="If you need to edit config.sh, do it as a shell escape here:" | |
6191 | . UU/myread | |
6192 | nostick='' | |
6193 | case "$ans" in | |
6194 | '') ;; | |
6195 | *) : in case they cannot read | |
6196 | sh 1>&4 -c "$ans";; | |
6197 | esac | |
6198 | ;; | |
6199 | esac | |
6200 | ||
6201 | : if this fails, just run all the .SH files by hand | |
6202 | . ./config.sh | |
6203 | ||
6204 | echo " " | |
6205 | exec 1>&4 | |
6206 | . ./UU/extract | |
6207 | ||
6208 | if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then | |
6209 | dflt=y | |
6210 | case "$silent" in | |
6211 | true) ;; | |
6212 | *) | |
6213 | $cat <<EOM | |
6214 | ||
6215 | Now you need to generate make dependencies by running "make depend". | |
6216 | You might prefer to run it in background: "make depend > makedepend.out &" | |
6217 | It can take a while, so you might not want to run it right now. | |
6218 | ||
6219 | EOM | |
6220 | ;; | |
6221 | esac | |
6222 | rp="Run make depend now?" | |
6223 | . UU/myread | |
6224 | case "$ans" in | |
6225 | y*) | |
6226 | make depend && echo "Now you must run a make." | |
6227 | ;; | |
6228 | *) | |
6229 | echo "You must run 'make depend' then 'make'." | |
6230 | ;; | |
6231 | esac | |
6232 | elif test -f [Mm]akefile; then | |
6233 | echo " " | |
6234 | echo "Now you must run a make." | |
6235 | else | |
6236 | echo "Done." | |
6237 | fi | |
6238 | ||
6239 | $rm -f kit*isdone ark*isdone | |
6240 | $rm -rf UU | |
6241 | : End of Configure |