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 | ||
ecfc5424 | 21 | # $Id: Head.U,v 3.0.1.6 1994/10/29 15:54:19 ram Exp $ |
2304df62 | 22 | # |
40000a8c | 23 | # Generated on Tue Feb 21 11:46:04 EST 1995 [metaconfig 3.0 PL51] |
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 | ||
a0d0e21e LW |
49 | : compute my invocation name |
50 | me=$0 | |
51 | case "$0" in | |
52 | */*) | |
53 | me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null` | |
54 | test "$me" || me=$0 | |
55 | ;; | |
56 | esac | |
57 | ||
58 | ||
59 | : Proper PATH setting | |
60 | paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin' | |
61 | paths=$paths:'/usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin' | |
62 | paths=$paths:'/sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb' | |
63 | paths=$paths:'/bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin' | |
64 | paths=$paths:'/etc /usr/lib /usr/ucblib /lib /usr/ccs/lib' | |
65 | paths=$paths:'/sbin /usr/sbin /usr/libexec' | |
66 | ||
67 | for p in $paths | |
68 | do | |
69 | case ":$PATH:" in | |
70 | *:$p:*) ;; | |
71 | *) test -d $p && PATH=$PATH:$p ;; | |
72 | esac | |
73 | done | |
74 | ||
75 | PATH=.:$PATH | |
2304df62 AD |
76 | export PATH |
77 | ||
a0d0e21e | 78 | : Sanity checks |
2304df62 | 79 | if test ! -t 0; then |
a0d0e21e | 80 | echo "Say 'sh $me', not 'sh <$me'" |
2304df62 AD |
81 | exit 1 |
82 | fi | |
83 | ||
84 | : On HP-UX, large Configure scripts may exercise a bug in /bin/sh | |
85 | if test -f /hp-ux -a -f /bin/ksh; then | |
86 | if (PATH=.; alias -x) >/dev/null 2>&1; then | |
87 | : already under /bin/ksh | |
88 | else | |
89 | cat <<'EOM' | |
90 | (Feeding myself to ksh to avoid nasty sh bug in "here document" expansion.) | |
91 | EOM | |
ecfc5424 | 92 | unset ENV |
2304df62 AD |
93 | exec /bin/ksh $0 "$@" |
94 | fi | |
95 | else | |
96 | : Warn them if they use ksh on other systems | |
97 | (PATH=.; alias -x) >/dev/null 2>&1 && \ | |
a0d0e21e LW |
98 | cat <<EOM |
99 | (I see you are using the Korn shell. Some ksh's blow up on $me, | |
2304df62 AD |
100 | especially on exotic machines. If yours does, try the Bourne shell instead.) |
101 | EOM | |
102 | fi | |
103 | ||
104 | : Configure runs within the UU subdirectory | |
105 | test -d UU || mkdir UU | |
106 | cd UU && rm -f * | |
107 | ||
a0d0e21e | 108 | dynamic_ext='' |
2304df62 | 109 | extensions='' |
a0d0e21e LW |
110 | known_extensions='' |
111 | static_ext='' | |
112 | useposix='' | |
ecfc5424 | 113 | d_bsd='' |
2304df62 AD |
114 | d_eunice='' |
115 | d_xenix='' | |
116 | eunicefix='' | |
117 | Mcc='' | |
118 | awk='' | |
119 | bash='' | |
120 | bison='' | |
121 | byacc='' | |
122 | cat='' | |
123 | chgrp='' | |
124 | chmod='' | |
125 | chown='' | |
ecfc5424 | 126 | comm='' |
2304df62 AD |
127 | compress='' |
128 | cp='' | |
129 | cpio='' | |
130 | cpp='' | |
131 | csh='' | |
132 | date='' | |
133 | echo='' | |
134 | egrep='' | |
135 | emacs='' | |
136 | expr='' | |
137 | find='' | |
138 | flex='' | |
139 | gcc='' | |
140 | grep='' | |
141 | inews='' | |
142 | ksh='' | |
143 | less='' | |
144 | line='' | |
145 | lint='' | |
146 | ln='' | |
147 | lp='' | |
148 | lpr='' | |
149 | ls='' | |
150 | mail='' | |
151 | mailx='' | |
152 | make='' | |
153 | mkdir='' | |
154 | more='' | |
155 | mv='' | |
156 | nroff='' | |
157 | perl='' | |
158 | pg='' | |
159 | pmake='' | |
160 | pr='' | |
161 | rm='' | |
162 | rmail='' | |
163 | sed='' | |
164 | sendmail='' | |
165 | sh='' | |
166 | shar='' | |
167 | sleep='' | |
168 | smail='' | |
169 | sort='' | |
170 | submit='' | |
171 | tail='' | |
172 | tar='' | |
173 | tbl='' | |
174 | test='' | |
175 | touch='' | |
176 | tr='' | |
177 | troff='' | |
178 | uname='' | |
179 | uniq='' | |
180 | uuname='' | |
181 | vi='' | |
182 | zcat='' | |
1aef975c | 183 | full_sed='' |
a0d0e21e | 184 | libswanted='' |
2304df62 AD |
185 | hint='' |
186 | myuname='' | |
85e6fe83 LW |
187 | osname='' |
188 | osvers='' | |
2304df62 AD |
189 | Author='' |
190 | Date='' | |
191 | Header='' | |
192 | Id='' | |
193 | Locker='' | |
194 | Log='' | |
195 | RCSfile='' | |
196 | Revision='' | |
197 | Source='' | |
198 | State='' | |
199 | afs='' | |
a0d0e21e LW |
200 | alignbytes='' |
201 | archlib='' | |
202 | archlibexp='' | |
a0d0e21e LW |
203 | d_archlib='' |
204 | installarchlib='' | |
40000a8c AD |
205 | archname='' |
206 | myarchname='' | |
ecfc5424 | 207 | baserev='' |
2304df62 AD |
208 | bin='' |
209 | binexp='' | |
210 | installbin='' | |
211 | byteorder='' | |
212 | cc='' | |
213 | gccversion='' | |
214 | ccflags='' | |
215 | cppflags='' | |
216 | ldflags='' | |
217 | lkflags='' | |
218 | optimize='' | |
219 | cf_by='' | |
220 | cf_time='' | |
221 | contains='' | |
a0d0e21e | 222 | cpp_stuff='' |
2304df62 AD |
223 | cpplast='' |
224 | cppminus='' | |
225 | cpprun='' | |
226 | cppstdin='' | |
227 | d_access='' | |
a0d0e21e | 228 | d_alarm='' |
ecfc5424 | 229 | d_attribut='' |
2304df62 AD |
230 | d_bcmp='' |
231 | d_bcopy='' | |
1aef975c | 232 | d_byacc='' |
2304df62 AD |
233 | d_bzero='' |
234 | d_casti32='' | |
235 | castflags='' | |
236 | d_castneg='' | |
a0d0e21e LW |
237 | d_chown='' |
238 | d_chroot='' | |
2304df62 | 239 | d_chsize='' |
a0d0e21e LW |
240 | d_closedir='' |
241 | d_void_closedir='' | |
2304df62 AD |
242 | d_const='' |
243 | cryptlib='' | |
244 | d_crypt='' | |
245 | d_csh='' | |
1aef975c | 246 | full_csh='' |
a0d0e21e LW |
247 | d_cuserid='' |
248 | d_dbl_dig='' | |
249 | d_difftime='' | |
250 | d_dlerror='' | |
251 | d_dlopen='' | |
252 | d_dlsymun='' | |
2304df62 | 253 | d_dosuid='' |
a0d0e21e LW |
254 | d_suidsafe='' |
255 | d_drem='' | |
2304df62 AD |
256 | d_dup2='' |
257 | d_fchmod='' | |
258 | d_fchown='' | |
259 | d_fcntl='' | |
a0d0e21e LW |
260 | d_fd_macros='' |
261 | d_fd_set='' | |
262 | d_fds_bits='' | |
263 | d_fgetpos='' | |
2304df62 AD |
264 | d_flexfnam='' |
265 | d_flock='' | |
a0d0e21e LW |
266 | d_fmod='' |
267 | d_fork='' | |
268 | d_fsetpos='' | |
269 | d_Gconvert='' | |
2304df62 AD |
270 | d_getgrps='' |
271 | d_gethent='' | |
272 | aphostname='' | |
273 | d_gethname='' | |
274 | d_phostname='' | |
275 | d_uname='' | |
a0d0e21e | 276 | d_getlogin='' |
2304df62 AD |
277 | d_getpgrp2='' |
278 | d_getpgrp='' | |
a0d0e21e | 279 | d_getppid='' |
2304df62 AD |
280 | d_getprior='' |
281 | d_htonl='' | |
282 | d_isascii='' | |
283 | d_killpg='' | |
284 | d_link='' | |
a0d0e21e LW |
285 | d_linuxstd='' |
286 | d_locconv='' | |
287 | d_lockf='' | |
2304df62 | 288 | d_lstat='' |
a0d0e21e LW |
289 | d_mblen='' |
290 | d_mbstowcs='' | |
291 | d_mbtowc='' | |
2304df62 AD |
292 | d_memcmp='' |
293 | d_memcpy='' | |
294 | d_memmove='' | |
295 | d_memset='' | |
296 | d_mkdir='' | |
a0d0e21e LW |
297 | d_mkfifo='' |
298 | d_mktime='' | |
2304df62 AD |
299 | d_msg='' |
300 | d_msgctl='' | |
301 | d_msgget='' | |
302 | d_msgrcv='' | |
303 | d_msgsnd='' | |
a0d0e21e | 304 | d_nice='' |
2304df62 | 305 | d_open3='' |
a0d0e21e LW |
306 | d_fpathconf='' |
307 | d_pathconf='' | |
308 | d_pause='' | |
309 | d_pipe='' | |
2304df62 AD |
310 | d_portable='' |
311 | d_readdir='' | |
85e6fe83 LW |
312 | d_rewinddir='' |
313 | d_seekdir='' | |
314 | d_telldir='' | |
a0d0e21e | 315 | d_readlink='' |
2304df62 AD |
316 | d_rename='' |
317 | d_rmdir='' | |
318 | d_safebcpy='' | |
319 | d_safemcpy='' | |
320 | d_select='' | |
321 | d_sem='' | |
322 | d_semctl='' | |
323 | d_semget='' | |
324 | d_semop='' | |
325 | d_setegid='' | |
326 | d_seteuid='' | |
a0d0e21e | 327 | d_setlinebuf='' |
2304df62 AD |
328 | d_setlocale='' |
329 | d_setpgid='' | |
330 | d_setpgrp2='' | |
331 | d_bsdpgrp='' | |
332 | d_setpgrp='' | |
333 | d_setprior='' | |
334 | d_setregid='' | |
335 | d_setresgid='' | |
336 | d_setresuid='' | |
337 | d_setreuid='' | |
338 | d_setrgid='' | |
339 | d_setruid='' | |
340 | d_setsid='' | |
341 | d_shm='' | |
342 | d_shmat='' | |
a0d0e21e LW |
343 | d_shmatprototype='' |
344 | shmattype='' | |
2304df62 AD |
345 | d_shmctl='' |
346 | d_shmdt='' | |
347 | d_shmget='' | |
348 | d_oldsock='' | |
349 | d_socket='' | |
350 | d_sockpair='' | |
351 | sockethdr='' | |
352 | socketlib='' | |
353 | d_statblks='' | |
354 | d_stdstdio='' | |
355 | d_index='' | |
356 | d_strchr='' | |
a0d0e21e | 357 | d_strcoll='' |
2304df62 AD |
358 | d_strctcpy='' |
359 | d_strerrm='' | |
360 | d_strerror='' | |
361 | d_sysernlst='' | |
362 | d_syserrlst='' | |
a0d0e21e | 363 | d_strxfrm='' |
2304df62 AD |
364 | d_symlink='' |
365 | d_syscall='' | |
a0d0e21e | 366 | d_sysconf='' |
2304df62 | 367 | d_system='' |
a0d0e21e LW |
368 | d_tcgetpgrp='' |
369 | d_tcsetpgrp='' | |
85e6fe83 LW |
370 | d_time='' |
371 | timetype='' | |
2304df62 AD |
372 | clocktype='' |
373 | d_times='' | |
374 | d_truncate='' | |
a0d0e21e LW |
375 | d_tzname='' |
376 | d_umask='' | |
2304df62 | 377 | d_vfork='' |
a0d0e21e | 378 | usevfork='' |
2304df62 AD |
379 | d_voidsig='' |
380 | signal_t='' | |
381 | d_volatile='' | |
382 | d_charvspr='' | |
383 | d_vprintf='' | |
384 | d_wait4='' | |
385 | d_waitpid='' | |
a0d0e21e LW |
386 | d_wcstombs='' |
387 | d_wctomb='' | |
388 | dlext='' | |
85e6fe83 LW |
389 | cccdlflags='' |
390 | ccdlflags='' | |
ecfc5424 | 391 | d_shrplib='' |
2304df62 | 392 | dlsrc='' |
85e6fe83 | 393 | lddlflags='' |
ecfc5424 | 394 | shrpdir='' |
2304df62 | 395 | usedl='' |
a0d0e21e | 396 | fpostype='' |
2304df62 AD |
397 | gidtype='' |
398 | groupstype='' | |
399 | h_fcntl='' | |
400 | h_sysfile='' | |
ecfc5424 AD |
401 | db_hashtype='' |
402 | db_prefixtype='' | |
a0d0e21e | 403 | i_db='' |
2304df62 AD |
404 | i_dbm='' |
405 | d_dirnamlen='' | |
a0d0e21e | 406 | direntrytype='' |
2304df62 | 407 | i_dirent='' |
a0d0e21e | 408 | i_dld='' |
2304df62 AD |
409 | i_dlfcn='' |
410 | i_fcntl='' | |
a0d0e21e | 411 | i_float='' |
2304df62 AD |
412 | i_gdbm='' |
413 | i_grp='' | |
a0d0e21e LW |
414 | i_limits='' |
415 | i_malloc='' | |
416 | i_math='' | |
85e6fe83 | 417 | i_memory='' |
2304df62 | 418 | i_ndbm='' |
85e6fe83 | 419 | i_neterrno='' |
2304df62 AD |
420 | i_niin='' |
421 | i_sysin='' | |
422 | d_pwage='' | |
423 | d_pwchange='' | |
424 | d_pwclass='' | |
425 | d_pwcomment='' | |
426 | d_pwexpire='' | |
427 | d_pwquota='' | |
428 | i_pwd='' | |
2304df62 | 429 | i_stddef='' |
a0d0e21e | 430 | i_stdlib='' |
2304df62 AD |
431 | i_string='' |
432 | strings='' | |
433 | i_sysdir='' | |
434 | i_sysfile='' | |
435 | d_voidtty='' | |
436 | i_bsdioctl='' | |
a0d0e21e | 437 | i_sysfilio='' |
2304df62 AD |
438 | i_sysioctl='' |
439 | i_syssockio='' | |
440 | i_sysndir='' | |
a0d0e21e | 441 | i_sysparam='' |
2304df62 | 442 | i_sysselct='' |
1aef975c | 443 | i_sysstat='' |
a0d0e21e | 444 | i_systimes='' |
fed7345c | 445 | i_systypes='' |
2304df62 AD |
446 | i_sgtty='' |
447 | i_termio='' | |
448 | i_termios='' | |
449 | i_systime='' | |
450 | i_systimek='' | |
451 | i_time='' | |
452 | timeincl='' | |
85e6fe83 | 453 | i_unistd='' |
2304df62 | 454 | i_utime='' |
a0d0e21e | 455 | i_stdarg='' |
2304df62 AD |
456 | i_varargs='' |
457 | i_varhdr='' | |
458 | i_vfork='' | |
459 | intsize='' | |
2304df62 | 460 | libc='' |
a0d0e21e | 461 | glibpth='' |
2304df62 AD |
462 | libpth='' |
463 | plibpth='' | |
464 | xlibpth='' | |
465 | libs='' | |
85e6fe83 LW |
466 | lns='' |
467 | lseektype='' | |
468 | d_mymalloc='' | |
2304df62 AD |
469 | mallocobj='' |
470 | mallocsrc='' | |
471 | malloctype='' | |
472 | usemymalloc='' | |
473 | installmansrc='' | |
474 | manext='' | |
475 | mansrc='' | |
476 | mansrcexp='' | |
477 | huge='' | |
478 | large='' | |
479 | medium='' | |
480 | models='' | |
481 | small='' | |
482 | split='' | |
a0d0e21e | 483 | modetype='' |
2304df62 AD |
484 | mydomain='' |
485 | myhostname='' | |
486 | phostname='' | |
487 | c='' | |
488 | n='' | |
489 | groupcat='' | |
490 | hostcat='' | |
491 | passcat='' | |
85e6fe83 LW |
492 | orderlib='' |
493 | ranlib='' | |
2304df62 AD |
494 | package='' |
495 | spackage='' | |
ecfc5424 | 496 | patchlevel='' |
a0d0e21e | 497 | prefix='' |
1aef975c | 498 | prefixexp='' |
2304df62 AD |
499 | installprivlib='' |
500 | privlib='' | |
501 | privlibexp='' | |
502 | prototype='' | |
503 | randbits='' | |
504 | installscript='' | |
505 | scriptdir='' | |
506 | scriptdirexp='' | |
a0d0e21e | 507 | selecttype='' |
2304df62 | 508 | sig_name='' |
a0d0e21e LW |
509 | sizetype='' |
510 | so='' | |
2304df62 AD |
511 | sharpbang='' |
512 | shsharp='' | |
513 | spitshell='' | |
a0d0e21e | 514 | ssizetype='' |
2304df62 AD |
515 | startsh='' |
516 | stdchar='' | |
517 | sysman='' | |
518 | uidtype='' | |
519 | nm_opt='' | |
520 | runnm='' | |
521 | usenm='' | |
522 | incpath='' | |
523 | mips='' | |
524 | mips_type='' | |
525 | usrinc='' | |
526 | defvoidused='' | |
527 | voidflags='' | |
2304df62 AD |
528 | CONFIG='' |
529 | ||
ecfc5424 AD |
530 | define='define' |
531 | undef='undef' | |
532 | smallmach='pdp11 i8086 z8000 i80286 iAPX286' | |
533 | rmlist='' | |
534 | ||
535 | : We must find out about Eunice early | |
536 | eunicefix=':' | |
537 | if test -f /etc/unixtovms; then | |
538 | eunicefix=/etc/unixtovms | |
539 | fi | |
540 | if test -f /etc/unixtovms.exe; then | |
541 | eunicefix=/etc/unixtovms.exe | |
542 | fi | |
543 | ||
544 | : list of known cpp symbols, sorted alphabetically | |
545 | al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2" | |
546 | al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH" | |
547 | al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS" | |
548 | al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM" | |
549 | al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX" | |
550 | al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX" | |
551 | al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4" | |
552 | al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300" | |
553 | al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek" | |
554 | al="$al VMS Xenix286" | |
555 | al="$al _AIX _AIX32 _AIX370 _AM29000 _COFF _CRAY _CX_UX _EPI" | |
556 | al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET" | |
557 | al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3" | |
558 | al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000" | |
559 | al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4" | |
560 | al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS" | |
561 | al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__" | |
562 | al="$al __DGUX__ __DPX2__ __H3050R __H3050RX" | |
563 | al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__" | |
564 | al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__" | |
565 | al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__" | |
566 | al="$al __SVR4_2__ __UMAXV__" | |
567 | al="$al ____386BSD____ __alpha __alpha__ __amiga" | |
568 | al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__" | |
569 | al="$al __host_mips__" | |
570 | al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500" | |
571 | al="$al __hp9000s500 __hp9000s700 __hp9000s800" | |
572 | al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__" | |
573 | al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__" | |
574 | al="$al __m68k __m68k__ __m88100__ __m88k __m88k__" | |
575 | al="$al __mc68000 __mc68000__ __mc68020 __mc68020__" | |
576 | al="$al __mc68030 __mc68030__ __mc68040 __mc68040__" | |
577 | al="$al __mc88100 __mc88100__ __mips __mips__" | |
578 | al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__" | |
579 | al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__" | |
580 | al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__" | |
581 | al="$al _host_mips _mips _unix" | |
582 | al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent" | |
583 | al="$al apollo ardent att386 att3b" | |
584 | al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull" | |
585 | al="$al cadmus clipper concurrent convex cray ctix" | |
586 | al="$al dmert encore gcos gcx gimpel gould" | |
587 | al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800" | |
588 | al="$al hp9000 hp9000s300 hp9000s400 hp9000s500" | |
589 | al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux" | |
590 | al="$al i186 i286 i386 i486 i8086" | |
591 | al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k" | |
592 | al="$al ksr1 linux luna luna88k m68k m88100 m88k" | |
593 | al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030" | |
594 | al="$al mc68040 mc68060 mc68k mc68k32 mc700" | |
595 | al="$al mc88000 mc88100 merlin mert mips mvs n16" | |
596 | al="$al ncl_el ncl_mr" | |
597 | al="$al news1500 news1700 news1800 news1900 news3700" | |
598 | al="$al news700 news800 news900 ns16000 ns32000" | |
599 | al="$al ns32016 ns32332 ns32k nsc32000 os osf" | |
600 | al="$al parisc pc532 pdp11 plexus posix pyr" | |
601 | al="$al riscix riscos scs sequent sgi sinix sony sony_news" | |
602 | al="$al sonyrisc sparc sparclite spectrum stardent stratos" | |
603 | al="$al sun sun3 sun386 svr4 sysV68 sysV88" | |
604 | al="$al titan tower tower32 tower32_200 tower32_600 tower32_700" | |
605 | al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200" | |
606 | al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms" | |
607 | al="$al xenix z8000" | |
608 | ||
609 | gccversion='' | |
610 | groupstype='' | |
611 | i_whoami='' | |
612 | : change the next line if compiling for Xenix/286 on Xenix/386 | |
613 | xlibpth='/usr/lib/386 /lib/386' | |
614 | ||
615 | : general looking path for locating libraries | |
616 | glibpth="/lib/pa1.1 /usr/lib/large /lib /usr/lib $xlibpth" | |
617 | glibpth="$glibpth /lib/large /usr/lib/small /lib/small" | |
618 | glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib /usr/shlib" | |
619 | ||
620 | : Private path used by Configure to find libraries. Its value | |
621 | : is prepended to libpth. This variable takes care of special | |
622 | : machines, like the mips. Usually, it should be empty. | |
623 | plibpth='' | |
624 | ||
625 | : default library list | |
626 | libswanted='' | |
627 | : full support for void wanted by default | |
628 | defvoidused=15 | |
629 | ||
630 | : set useposix=false in your hint file to disable the POSIX extension. | |
631 | useposix=true | |
632 | : no include file wanted by default | |
633 | inclwanted='' | |
634 | ||
635 | : List of libraries we want. | |
636 | libswanted='net socket inet nsl nm ndbm gdbm dbm db malloc dl' | |
637 | libswanted="$libswanted dld ld sun m c cposix posix ndir dir crypt" | |
638 | libswanted="$libswanted ucb bsd BSD PW x" | |
1aef975c | 639 | : We probably want to search /usr/shlib before most other libraries. |
ecfc5424 AD |
640 | : This is only used by ext/util/extliblist |
641 | glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'` | |
642 | glibpth="/usr/shlib $glibpth" | |
643 | : Do not use vfork unless overridden by a hint file. | |
644 | usevfork=false | |
1aef975c AD |
645 | : We might as well always be portable. It makes no difference for |
646 | : perl5, and makes people happy. | |
647 | d_portable=define | |
ecfc5424 | 648 | |
2304df62 AD |
649 | : script used to extract .SH files with variable substitutions |
650 | cat >extract <<'EOS' | |
651 | CONFIG=true | |
652 | echo "Doing variable substitutions on .SH files..." | |
653 | if test -f MANIFEST; then | |
a0d0e21e LW |
654 | shlist=`awk '{print $1}' <MANIFEST | grep '\.SH'` |
655 | : Pick up possible extension manifests. | |
656 | for dir in ext/* ; do | |
657 | if test -f $dir/MANIFEST; then | |
658 | xxx=`awk '{print $1}' < $dir/MANIFEST | | |
659 | sed -n "/\.SH$/ s@^@$dir/@p"` | |
660 | shlist="$shlist $xxx" | |
661 | fi | |
662 | done | |
663 | set x $shlist | |
2304df62 AD |
664 | else |
665 | echo "(Looking for .SH files under the current directory.)" | |
666 | set x `find . -name "*.SH" -print` | |
667 | fi | |
668 | shift | |
669 | case $# in | |
670 | 0) set x *.SH; shift;; | |
671 | esac | |
672 | if test ! -f $1; then | |
673 | shift | |
674 | fi | |
675 | for file in $*; do | |
676 | case "$file" in | |
677 | */*) | |
678 | dir=`expr X$file : 'X\(.*\)/'` | |
679 | file=`expr X$file : 'X.*/\(.*\)'` | |
680 | (cd $dir && . ./$file) | |
681 | ;; | |
682 | *) | |
683 | . ./$file | |
684 | ;; | |
685 | esac | |
686 | done | |
687 | if test -f config_h.SH; then | |
688 | if test ! -f config.h; then | |
689 | : oops, they left it out of MANIFEST, probably, so do it anyway. | |
690 | . ./config_h.SH | |
691 | fi | |
692 | fi | |
693 | EOS | |
694 | ||
695 | : produce awk script to parse command line options | |
696 | cat >options.awk <<'EOF' | |
697 | BEGIN { | |
ecfc5424 | 698 | optstr = "dD:eEf:hOrsSU:V"; # getopt-style specification |
2304df62 AD |
699 | |
700 | len = length(optstr); | |
701 | for (i = 1; i <= len; i++) { | |
702 | c = substr(optstr, i, 1); | |
703 | if (i < len) a = substr(optstr, i + 1, 1); else a = ""; | |
704 | if (a == ":") { | |
705 | arg[c] = 1; | |
706 | i++; | |
707 | } | |
708 | opt[c] = 1; | |
709 | } | |
710 | } | |
711 | { | |
712 | expect = 0; | |
713 | str = $0; | |
714 | if (substr(str, 1, 1) != "-") { | |
715 | printf("'%s'\n", str); | |
716 | next; | |
717 | } | |
718 | len = length($0); | |
719 | for (i = 2; i <= len; i++) { | |
720 | c = substr(str, i, 1); | |
721 | if (!opt[c]) { | |
722 | printf("-%s\n", substr(str, i)); | |
723 | next; | |
724 | } | |
725 | printf("-%s\n", c); | |
726 | if (arg[c]) { | |
727 | if (i < len) | |
728 | printf("'%s'\n", substr(str, i + 1)); | |
729 | else | |
730 | expect = 1; | |
731 | next; | |
732 | } | |
733 | } | |
734 | } | |
735 | END { | |
736 | if (expect) | |
737 | print "?"; | |
738 | } | |
739 | EOF | |
740 | ||
741 | : process the command line options | |
742 | set X `for arg in "$@"; do echo $arg; done | awk -f options.awk` | |
743 | eval "set $*" | |
744 | shift | |
745 | rm -f options.awk | |
746 | ||
747 | : set up default values | |
748 | fastread='' | |
749 | reuseval=false | |
750 | config_sh='' | |
751 | alldone='' | |
752 | error='' | |
753 | silent='' | |
754 | extractsh='' | |
ecfc5424 | 755 | override='' |
1aef975c | 756 | rm -f optdef.sh |
2304df62 AD |
757 | |
758 | : option parsing | |
759 | while test $# -gt 0; do | |
760 | case "$1" in | |
761 | -d) shift; fastread=yes;; | |
762 | -e) shift; alldone=cont;; | |
763 | -f) | |
764 | shift | |
765 | cd .. | |
766 | if test -r "$1"; then | |
767 | config_sh="$1" | |
768 | else | |
a0d0e21e | 769 | echo "$me: cannot read config file $1." >&2 |
2304df62 AD |
770 | error=true |
771 | fi | |
772 | cd UU | |
773 | shift;; | |
774 | -h) shift; error=true;; | |
775 | -r) shift; reuseval=true;; | |
776 | -s) shift; silent=true;; | |
777 | -E) shift; alldone=exit;; | |
ecfc5424 | 778 | -O) shift; override=true;; |
2304df62 | 779 | -S) shift; extractsh=true;; |
a0d0e21e LW |
780 | -D) |
781 | shift | |
782 | case "$1" in | |
783 | *=) | |
784 | echo "$me: use '-U symbol=', not '-D symbol='." >&2 | |
785 | echo "$me: ignoring -D $1" >&2 | |
786 | ;; | |
ecfc5424 | 787 | *=*) echo "$1" | \ |
1aef975c AD |
788 | sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;; |
789 | *) echo "$1='define'" >> optdef.sh;; | |
a0d0e21e LW |
790 | esac |
791 | shift | |
792 | ;; | |
793 | -U) | |
794 | shift | |
795 | case "$1" in | |
1aef975c | 796 | *=) echo "$1" >> optdef.sh;; |
a0d0e21e LW |
797 | *=*) |
798 | echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2 | |
799 | echo "$me: ignoring -U $1" >&2 | |
800 | ;; | |
1aef975c | 801 | *) echo "$1='undef'" >> optdef.sh;; |
a0d0e21e LW |
802 | esac |
803 | shift | |
804 | ;; | |
40000a8c | 805 | -V) echo "$me generated by metaconfig 3.0 PL51." >&2 |
2304df62 AD |
806 | exit 0;; |
807 | --) break;; | |
a0d0e21e | 808 | -*) echo "$me: unknown option $1" >&2; shift; error=true;; |
2304df62 AD |
809 | *) break;; |
810 | esac | |
811 | done | |
812 | ||
813 | case "$error" in | |
814 | true) | |
815 | cat >&2 <<EOM | |
ecfc5424 | 816 | Usage: $me [-dehrEOSV] [-f config.sh] [-D symbol] [-D symbol=value] |
a0d0e21e | 817 | [-U symbol] [-U symbol=] |
2304df62 AD |
818 | -d : use defaults for all answers. |
819 | -e : go on without questioning past the production of config.sh. | |
820 | -f : specify an alternate default configuration file. | |
821 | -h : print this help message and exit (with an error status). | |
822 | -r : reuse C symbols value if possible (skips costly nm extraction). | |
823 | -s : silent mode, only echoes questions and essential information. | |
a0d0e21e LW |
824 | -D : define symbol to have some value: |
825 | -D symbol symbol gets the value 'define' | |
826 | -D symbol=value symbol gets the value 'value' | |
2304df62 | 827 | -E : stop at the end of questions, after having produced config.sh. |
ecfc5424 | 828 | -O : let -D and -U override definitions from loaded configuration file. |
2304df62 | 829 | -S : perform variable substitutions on all .SH files (can mix with -f) |
a0d0e21e LW |
830 | -U : undefine symbol: |
831 | -U symbol symbol gets the value 'undef' | |
832 | -U symbol= symbol gets completely empty | |
2304df62 AD |
833 | -V : print version number and exit (with a zero status). |
834 | EOM | |
835 | exit 1 | |
836 | ;; | |
837 | esac | |
838 | ||
839 | exec 4>&1 | |
840 | case "$silent" in | |
841 | true) exec 1>/dev/null;; | |
842 | esac | |
843 | ||
ecfc5424 | 844 | : run the defines and the undefines, if any, but leave the file out there... |
1aef975c AD |
845 | touch optdef.sh |
846 | . ./optdef.sh | |
a0d0e21e | 847 | |
2304df62 AD |
848 | case "$extractsh" in |
849 | true) | |
850 | case "$config_sh" in | |
851 | '') config_sh='config.sh'; config='./config.sh';; | |
852 | /*) config="$config_sh";; | |
853 | *) config="./$config_sh";; | |
854 | esac | |
855 | echo " " | |
856 | echo "Fetching answers from $config_sh..." | |
857 | cd .. | |
858 | . $config | |
1aef975c | 859 | test "$override" && . ./optdef.sh |
2304df62 AD |
860 | echo " " |
861 | . ./UU/extract | |
862 | rm -rf UU | |
863 | echo "Done." | |
864 | exit 0 | |
865 | ;; | |
866 | esac | |
867 | ||
868 | : set package name | |
85e6fe83 | 869 | package=perl5 |
1aef975c AD |
870 | first=`echo $package | sed -e 's/^\(.\).*/\1/'` |
871 | last=`echo $package | sed -e 's/^.\(.*\)/\1/'` | |
872 | case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in | |
873 | ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;; | |
874 | *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;; | |
875 | esac | |
2304df62 AD |
876 | |
877 | : Eunice requires " " instead of "", can you believe it | |
878 | echo " " | |
879 | : Here we go... | |
880 | echo "Beginning of configuration questions for $package." | |
881 | ||
1aef975c | 882 | trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15 |
2304df62 | 883 | |
2304df62 AD |
884 | : Some greps do not return status, grrr. |
885 | echo "grimblepritz" >grimble | |
886 | if grep blurfldyick grimble >/dev/null 2>&1 ; then | |
887 | contains=contains | |
888 | elif grep grimblepritz grimble >/dev/null 2>&1 ; then | |
889 | contains=grep | |
890 | else | |
891 | contains=contains | |
892 | fi | |
893 | rm -f grimble | |
894 | : the following should work in any shell | |
895 | case "$contains" in | |
896 | contains*) | |
897 | echo " " | |
898 | echo "AGH! Grep doesn't return a status. Attempting remedial action." | |
899 | cat >contains <<'EOSS' | |
900 | grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp | |
901 | EOSS | |
902 | chmod +x contains | |
903 | esac | |
904 | ||
905 | : first determine how to suppress newline on echo command | |
906 | echo " " | |
907 | echo "Checking echo to see how to suppress newlines..." | |
908 | (echo "hi there\c" ; echo " ") >.echotmp | |
909 | if $contains c .echotmp >/dev/null 2>&1 ; then | |
910 | echo "...using -n." | |
911 | n='-n' | |
912 | c='' | |
913 | else | |
914 | cat <<'EOM' | |
915 | ...using \c | |
916 | EOM | |
917 | n='' | |
918 | c='\c' | |
919 | fi | |
920 | echo $n "The star should be here-->$c" | |
921 | echo '*' | |
922 | rm -f .echotmp | |
923 | ||
924 | : Now test for existence of everything in MANIFEST | |
925 | echo " " | |
926 | if test -f ../MANIFEST; then | |
927 | echo "First let's make sure your kit is complete. Checking..." >&4 | |
928 | awk '$1 !~ /PACK[A-Z]+/ {print $1}' ../MANIFEST | split -50 | |
929 | rm -f missing | |
930 | for filelist in x??; do | |
931 | (cd ..; ls `cat UU/$filelist` >/dev/null 2>>UU/missing) | |
932 | done | |
933 | if test -s missing; then | |
934 | cat missing >&4 | |
935 | cat >&4 <<'EOM' | |
936 | ||
937 | THIS PACKAGE SEEMS TO BE INCOMPLETE. | |
938 | ||
939 | You have the option of continuing the configuration process, despite the | |
940 | distinct possibility that your kit is damaged, by typing 'y'es. If you | |
941 | do, don't blame me if something goes wrong. I advise you to type 'n'o | |
942 | and contact the author (lwall@netlabs.com). | |
943 | ||
944 | EOM | |
945 | echo $n "Continue? [n] $c" >&4 | |
946 | read ans | |
947 | case "$ans" in | |
948 | y*) | |
949 | echo "Continuing..." >&4 | |
950 | rm -f missing | |
951 | ;; | |
952 | *) | |
953 | echo "ABORTING..." >&4 | |
954 | kill $$ | |
955 | ;; | |
956 | esac | |
957 | else | |
958 | echo "Looks good..." >&4 | |
959 | fi | |
960 | else | |
961 | echo "There is no MANIFEST file. I hope your kit is complete !" | |
962 | fi | |
963 | rm -f missing x?? | |
964 | ||
965 | : compute the number of columns on the terminal for proper question formatting | |
966 | case "$COLUMNS" in | |
967 | '') COLUMNS='80';; | |
968 | esac | |
969 | ||
970 | : set up the echo used in my read | |
971 | myecho="case \"\$xxxm\" in | |
972 | '') echo $n \"\$rp $c\" >&4;; | |
973 | *) case \"\$rp\" in | |
974 | '') echo $n \"[\$xxxm] $c\";; | |
975 | *) | |
976 | if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then | |
977 | echo \"\$rp\" >&4 | |
978 | echo $n \"[\$xxxm] $c\" >&4 | |
979 | else | |
980 | echo $n \"\$rp [\$xxxm] $c\" >&4 | |
981 | fi | |
982 | ;; | |
983 | esac;; | |
984 | esac" | |
985 | ||
986 | : now set up to do reads with possible shell escape and default assignment | |
987 | cat <<EOSC >myread | |
988 | xxxm=\$dflt | |
989 | $myecho | |
990 | ans='!' | |
991 | case "\$fastread" in | |
992 | yes) case "\$dflt" in | |
993 | '') ;; | |
994 | *) ans=''; | |
995 | case "\$silent-\$rp" in | |
996 | true-) ;; | |
997 | *) echo " " >&4;; | |
998 | esac;; | |
999 | esac;; | |
1000 | *) case "\$silent" in | |
1001 | true) case "\$rp" in | |
1002 | '') ans='';; | |
1003 | esac;; | |
1004 | esac;; | |
1005 | esac | |
1006 | while expr "X\$ans" : "X!" >/dev/null; do | |
1007 | read answ | |
1008 | set x \$xxxm | |
1009 | shift | |
1010 | aok=''; eval "ans=\"\$answ\"" && aok=y | |
1011 | case "\$answ" in | |
1012 | "\$ans") | |
1013 | case "\$ans" in | |
ecfc5424 AD |
1014 | \\&*) |
1015 | set x \`expr "X\$ans" : "X&\(.*\)\$"\` | |
1016 | shift | |
1017 | case "\$1" in | |
1018 | -d) | |
1019 | fastread=yes | |
1020 | echo "(OK, I'll run with -d after this question.)" | |
1021 | ;; | |
1022 | -*) | |
1023 | echo "*** Sorry, \$1 not supported yet." | |
1024 | ;; | |
1025 | esac | |
1026 | $myecho | |
1027 | ans=! | |
1028 | ;; | |
2304df62 AD |
1029 | "!") |
1030 | sh 1>&4 | |
1031 | echo " " | |
1032 | $myecho | |
1033 | ;; | |
1034 | !*) | |
1035 | set x \`expr "X\$ans" : "X!\(.*\)\$"\` | |
1036 | shift | |
1037 | sh 1>&4 -c "\$*" | |
1038 | echo " " | |
1039 | $myecho | |
1040 | ;; | |
1041 | esac;; | |
1042 | *) | |
1043 | case "\$aok" in | |
1044 | y) | |
1045 | echo "*** Substitution done -- please confirm." | |
1046 | xxxm="\$ans" | |
1047 | ans=\`echo $n "\$ans$c" | tr '\012' ' '\` | |
1048 | xxxm="\$ans" | |
1049 | ans=! | |
1050 | ;; | |
1051 | *) | |
1052 | echo "*** Error -- try again." | |
1053 | ans=! | |
1054 | ;; | |
1055 | esac | |
1056 | $myecho | |
1057 | ;; | |
1058 | esac | |
1059 | case "\$ans\$xxxm\$nostick" in | |
1060 | '') | |
1061 | ans=! | |
1062 | $myecho | |
1063 | ;; | |
1064 | esac | |
1065 | done | |
1066 | case "\$ans" in | |
1067 | '') ans="\$xxxm";; | |
1068 | esac | |
1069 | EOSC | |
1070 | ||
1071 | : create .config dir to save info across Configure sessions | |
1072 | test -d ../.config || mkdir ../.config | |
1073 | cat >../.config/README <<EOF | |
1074 | This directory created by Configure to save information that should | |
1075 | persist across sessions. | |
1076 | ||
1077 | You may safely delete it if you wish. | |
1078 | EOF | |
1079 | ||
1080 | : general instructions | |
1081 | needman=true | |
1082 | firsttime=true | |
1083 | user=`( (logname) 2>/dev/null || whoami) 2>&1` | |
1084 | if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then | |
1085 | firsttime=false | |
1086 | echo " " | |
1087 | rp='Would you like to see the instructions?' | |
1088 | dflt=n | |
1089 | . ./myread | |
1090 | case "$ans" in | |
1091 | [yY]*) ;; | |
1092 | *) needman=false;; | |
1093 | esac | |
1094 | fi | |
1095 | if $needman; then | |
1096 | cat <<EOH | |
1097 | ||
1098 | This installation shell script will examine your system and ask you questions | |
a0d0e21e | 1099 | to determine how the perl5 package should be installed. If you get |
2304df62 AD |
1100 | stuck on a question, you may use a ! shell escape to start a subshell or |
1101 | execute a command. Many of the questions will have default answers in square | |
1102 | brackets; typing carriage return will give you the default. | |
1103 | ||
1104 | On some of the questions which ask for file or directory names you are allowed | |
1105 | to use the ~name construct to specify the login directory belonging to "name", | |
1106 | even if you don't have a shell which knows about that. Questions where this is | |
1107 | allowed will be marked "(~name ok)". | |
1108 | ||
1109 | EOH | |
1110 | rp='' | |
1111 | dflt='Type carriage return to continue' | |
1112 | . ./myread | |
1113 | cat <<'EOH' | |
1114 | ||
1115 | The prompter used in this script allows you to use shell variables and | |
1116 | backticks in your answers. You may use $1, $2, etc... to refer to the words | |
1117 | in the default answer, as if the default line was a set of arguments given to a | |
1118 | script shell. This means you may also use $* to repeat the whole default line, | |
1119 | so you do not have to re-type everything to add something to the default. | |
1120 | ||
1121 | Everytime there is a substitution, you will have to confirm. If there is an | |
1122 | error (e.g. an unmatched backtick), the default answer will remain unchanged | |
1123 | and you will be prompted again. | |
1124 | ||
1125 | If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all | |
1126 | the questions and use the computed defaults (or the previous answers if there | |
1127 | was already a config.sh file). Type 'Configure -h' for a list of options. | |
ecfc5424 AD |
1128 | You may also start interactively and then answer '& -d' at any prompt to turn |
1129 | on the non-interactive behaviour for the remaining of the execution. | |
2304df62 AD |
1130 | |
1131 | EOH | |
1132 | . ./myread | |
1133 | cat <<EOH | |
1134 | ||
1135 | Much effort has been expended to ensure that this shell script will run on any | |
1136 | Unix system. If despite that it blows up on yours, your best bet is to edit | |
40000a8c AD |
1137 | Configure and run it again. If you can't run Configure for some reason, |
1138 | you'll have to generate a config.sh file by hand. Whatever problems you | |
1139 | have, let me (lwall@netlabs.com) know how I blew it. | |
2304df62 AD |
1140 | |
1141 | This installation script affects things in two ways: | |
1142 | ||
1143 | 1) it may do direct variable substitutions on some of the files included | |
1144 | in this kit. | |
1145 | 2) it builds a config.h file for inclusion in C programs. You may edit | |
1146 | any of these files as the need arises after running this script. | |
1147 | ||
1148 | If you make a mistake on a question, there is no easy way to back up to it | |
1149 | currently. The easiest thing to do is to edit config.sh and rerun all the SH | |
1150 | files. Configure will offer to let you do this before it runs the SH files. | |
1151 | ||
1152 | EOH | |
1153 | dflt='Type carriage return to continue' | |
1154 | . ./myread | |
1155 | case "$firsttime" in | |
1156 | true) echo $user >>../.config/instruct;; | |
1157 | esac | |
1158 | fi | |
1159 | ||
1160 | : see if sh knows # comments | |
1161 | echo " " | |
1162 | echo "Checking your sh to see if it knows about # comments..." >&4 | |
ecfc5424 | 1163 | if `sh -c '#' >/dev/null 2>&1`; then |
2304df62 AD |
1164 | echo "Your sh handles # comments correctly." |
1165 | shsharp=true | |
1166 | spitshell=cat | |
1167 | echo " " | |
1168 | echo "Okay, let's see if #! works on this system..." | |
a0d0e21e | 1169 | xcat=/bin/cat |
ecfc5424 | 1170 | test -f $xcat || xcat=/usr/bin/cat |
a0d0e21e | 1171 | echo "#!$xcat" >try |
2304df62 AD |
1172 | $eunicefix try |
1173 | chmod +x try | |
1174 | ./try > today | |
1175 | if test -s today; then | |
1176 | echo "It does." | |
1177 | sharpbang='#!' | |
1178 | else | |
a0d0e21e | 1179 | echo "#! $xcat" > try |
2304df62 AD |
1180 | $eunicefix try |
1181 | chmod +x try | |
1182 | ./try > today | |
1183 | if test -s today; then | |
1184 | echo "It does." | |
1185 | sharpbang='#! ' | |
1186 | else | |
1187 | echo "It's just a comment." | |
1188 | sharpbang=': use ' | |
1189 | fi | |
1190 | fi | |
1191 | else | |
1192 | echo "Your sh doesn't grok # comments--I will strip them later on." | |
1193 | shsharp=false | |
a0d0e21e | 1194 | cd .. |
2304df62 AD |
1195 | echo "exec grep -v '^[ ]*#'" >spitshell |
1196 | chmod +x spitshell | |
1197 | $eunicefix spitshell | |
1198 | spitshell=`pwd`/spitshell | |
a0d0e21e | 1199 | cd UU |
2304df62 AD |
1200 | echo "I presume that if # doesn't work, #! won't work either!" |
1201 | sharpbang=': use ' | |
1202 | fi | |
1203 | rm -f try today | |
1204 | ||
1205 | : figure out how to guarantee sh startup | |
1206 | echo " " | |
1207 | echo "Checking out how to guarantee sh startup..." >&4 | |
1208 | case "$SYSTYPE" in | |
1209 | *bsd*|sys5*) startsh=$sharpbang"/$SYSTYPE/bin/sh";; | |
1210 | *) startsh=$sharpbang'/bin/sh';; | |
1211 | esac | |
1212 | echo "Let's see if '$startsh' works..." | |
1213 | cat >try <<EOSS | |
1214 | $startsh | |
1215 | set abc | |
1216 | test "$?abc" != 1 | |
1217 | EOSS | |
1218 | ||
1219 | chmod +x try | |
1220 | $eunicefix try | |
1221 | if ./try; then | |
1222 | echo "Yup, it does." | |
1223 | else | |
1224 | echo "Nope. You may have to fix up the shell scripts to make sure sh runs them." | |
1225 | fi | |
1226 | rm -f try | |
1227 | ||
1228 | : find out where common programs are | |
1229 | echo " " | |
1230 | echo "Locating common programs..." >&4 | |
1231 | cat <<EOSC >loc | |
1232 | $startsh | |
1233 | case \$# in | |
1234 | 0) exit 1;; | |
1235 | esac | |
1236 | thing=\$1 | |
1237 | shift | |
1238 | dflt=\$1 | |
1239 | shift | |
1240 | for dir in \$*; do | |
1241 | case "\$thing" in | |
1242 | .) | |
1243 | if test -d \$dir/\$thing; then | |
1244 | echo \$dir | |
1245 | exit 0 | |
1246 | fi | |
1247 | ;; | |
1248 | *) | |
a0d0e21e | 1249 | for thisthing in \$dir/\$thing; do |
ecfc5424 | 1250 | : just loop through to pick last item |
a0d0e21e LW |
1251 | done |
1252 | if test -f \$thisthing; then | |
1253 | echo \$thisthing | |
2304df62 AD |
1254 | exit 0 |
1255 | elif test -f \$dir/\$thing.exe; then | |
1256 | : on Eunice apparently | |
1257 | echo \$dir/\$thing | |
1258 | exit 0 | |
1259 | fi | |
1260 | ;; | |
1261 | esac | |
1262 | done | |
1263 | echo \$dflt | |
1264 | exit 1 | |
1265 | EOSC | |
1266 | chmod +x loc | |
1267 | $eunicefix loc | |
1268 | loclist=" | |
1269 | awk | |
1270 | cat | |
ecfc5424 | 1271 | comm |
2304df62 AD |
1272 | cp |
1273 | echo | |
1274 | expr | |
a0d0e21e | 1275 | find |
2304df62 | 1276 | grep |
85e6fe83 | 1277 | ln |
a0d0e21e | 1278 | ls |
2304df62 | 1279 | mkdir |
2304df62 AD |
1280 | rm |
1281 | sed | |
1282 | sort | |
85e6fe83 | 1283 | touch |
2304df62 AD |
1284 | tr |
1285 | uniq | |
1286 | " | |
1287 | trylist=" | |
1288 | Mcc | |
2304df62 AD |
1289 | byacc |
1290 | cpp | |
1291 | csh | |
1292 | date | |
1293 | egrep | |
2304df62 AD |
1294 | line |
1295 | nroff | |
1296 | perl | |
1297 | test | |
1298 | uname | |
1299 | " | |
1300 | pth=`echo $PATH | sed -e 's/:/ /g'` | |
1301 | pth="$pth /lib /usr/lib" | |
1302 | for file in $loclist; do | |
1303 | xxx=`./loc $file $file $pth` | |
1304 | eval $file=$xxx | |
1305 | eval _$file=$xxx | |
1306 | case "$xxx" in | |
1307 | /*) | |
1308 | echo $file is in $xxx. | |
1309 | ;; | |
1310 | *) | |
1311 | echo "I don't know where $file is. I hope it's in everyone's PATH." | |
1312 | ;; | |
1313 | esac | |
1314 | done | |
1315 | echo " " | |
1316 | echo "Don't worry if any of the following aren't found..." | |
1317 | say=offhand | |
1318 | for file in $trylist; do | |
1319 | xxx=`./loc $file $file $pth` | |
1320 | eval $file=$xxx | |
1321 | eval _$file=$xxx | |
1322 | case "$xxx" in | |
1323 | /*) | |
1324 | echo $file is in $xxx. | |
1325 | ;; | |
1326 | *) | |
1327 | echo "I don't see $file out there, $say." | |
1328 | say=either | |
1329 | ;; | |
1330 | esac | |
1331 | done | |
1332 | case "$egrep" in | |
1333 | egrep) | |
1334 | echo "Substituting grep for egrep." | |
1335 | egrep=$grep | |
1336 | ;; | |
1337 | esac | |
1338 | case "$test" in | |
1339 | test) | |
1340 | echo "Hopefully test is built into your sh." | |
1341 | ;; | |
1342 | *) | |
ecfc5424 | 1343 | if `sh -c "PATH= test true" >/dev/null 2>&1`; then |
2304df62 AD |
1344 | echo "Using the test built into your sh." |
1345 | test=test | |
1346 | _test=test | |
1347 | fi | |
1348 | ;; | |
1349 | esac | |
1350 | case "$echo" in | |
1351 | echo) | |
1352 | echo "Hopefully echo is built into your sh." | |
1353 | ;; | |
1354 | '') ;; | |
1355 | *) | |
1356 | echo " " | |
1357 | echo "Checking compatibility between $echo and builtin echo (if any)..." >&4 | |
1358 | $echo $n "hi there$c" >foo1 | |
1359 | echo $n "hi there$c" >foo2 | |
1360 | if cmp foo1 foo2 >/dev/null 2>&1; then | |
1361 | echo "They are compatible. In fact, they may be identical." | |
1362 | else | |
1363 | case "$n" in | |
1364 | '-n') n='' c='\c';; | |
1365 | *) n='-n' c='';; | |
1366 | esac | |
1367 | cat <<FOO | |
1368 | They are not compatible! You are probably running ksh on a non-USG system. | |
1369 | I'll have to use $echo instead of the builtin, since Bourne shell doesn't | |
1370 | have echo built in and we may have to run some Bourne shell scripts. That | |
1371 | means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous. | |
1372 | ||
1373 | FOO | |
1374 | $echo $n "The star should be here-->$c" | |
1375 | $echo "*" | |
1376 | fi | |
1377 | $rm -f foo1 foo2 | |
1378 | ;; | |
1379 | esac | |
1380 | ||
a0d0e21e LW |
1381 | : determine whether symbolic links are supported |
1382 | echo " " | |
1383 | $touch blurfl | |
1384 | if $ln -s blurfl sym > /dev/null 2>&1 ; then | |
1385 | echo "Symbolic links are supported." >&4 | |
1386 | lns="$ln -s" | |
1387 | else | |
1388 | echo "Symbolic links are NOT supported." >&4 | |
1389 | lns="$ln" | |
1390 | fi | |
1391 | $rm -f blurfl sym | |
1392 | ||
ecfc5424 AD |
1393 | : see whether [:lower:] and [:upper:] are supported character classes |
1394 | echo " " | |
1395 | up='[A-Z]' | |
1396 | low='[a-z]' | |
1397 | case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in | |
1398 | ABYZ) | |
1399 | echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4 | |
1400 | up='[:upper:]' | |
1401 | low='[:lower:]' | |
1402 | ;; | |
1403 | *) | |
1404 | echo "Your tr only supports [a-z] and [A-Z] to convert case." >&4 | |
1405 | ;; | |
1406 | esac | |
1407 | : set up the translation script tr, must be called with ./tr of course | |
1408 | cat >tr <<EOSC | |
1409 | $startsh | |
1410 | case "\$1\$2" in | |
1411 | '[A-Z][a-z]') exec $tr '$up' '$low';; | |
1412 | '[a-z][A-Z]') exec $tr '$low' '$up';; | |
1413 | esac | |
1414 | exec $tr "\$@" | |
1415 | EOSC | |
1416 | chmod +x tr | |
1417 | $eunicefix tr | |
1418 | ||
2304df62 AD |
1419 | : Try to determine whether config.sh was made on this system |
1420 | case "$config_sh" in | |
1421 | '') | |
1422 | myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1` | |
a0d0e21e | 1423 | myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \ |
ecfc5424 | 1424 | ./tr '[A-Z]' '[a-z]' | tr '\012' ' '` |
1aef975c | 1425 | newmyuname="$myuname" |
2304df62 | 1426 | dflt=n |
ecfc5424 AD |
1427 | if test "$fastread" = yes; then |
1428 | dflt=y | |
1429 | elif test -f ../config.sh; then | |
2304df62 | 1430 | if $contains myuname= ../config.sh >/dev/null 2>&1; then |
1aef975c | 1431 | eval "`grep myuname= ../config.sh`" |
2304df62 | 1432 | fi |
1aef975c | 1433 | if test "X$myuname" = "X$newmyuname"; then |
2304df62 AD |
1434 | dflt=y |
1435 | fi | |
1436 | fi | |
1437 | ||
1438 | : Get old answers from old config file if Configure was run on the | |
1439 | : same system, otherwise use the hints. | |
1440 | hint=default | |
1441 | cd .. | |
1442 | if test -f config.sh; then | |
1443 | echo " " | |
1444 | rp="I see a config.sh file. Shall I use it to set the defaults?" | |
1445 | . UU/myread | |
1446 | case "$ans" in | |
1447 | n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;; | |
1448 | *) echo "Fetching default answers from your old config.sh file..." >&4 | |
ecfc5424 AD |
1449 | tmp_n="$n" |
1450 | tmp_c="$c" | |
2304df62 AD |
1451 | . ./config.sh |
1452 | cp config.sh UU | |
ecfc5424 AD |
1453 | n="$tmp_n" |
1454 | c="$tmp_c" | |
2304df62 AD |
1455 | hint=previous |
1456 | ;; | |
1457 | esac | |
1458 | fi | |
1459 | if test ! -f config.sh; then | |
1460 | $cat <<EOM | |
1461 | ||
1462 | First time through, eh? I have some defaults handy for the following systems: | |
1463 | ||
1464 | EOM | |
1465 | cd hints; ls -C *.sh | $sed 's/\.sh/ /g' >&4 | |
1466 | dflt='' | |
1467 | : Half the following guesses are probably wrong... If you have better | |
1468 | : tests or hints, please send them to lwall@netlabs.com | |
1469 | : The metaconfig authors would also appreciate a copy... | |
a0d0e21e | 1470 | $test -f /irix && osname=irix |
85e6fe83 LW |
1471 | $test -f /xenix && osname=sco_xenix |
1472 | $test -f /dynix && osname=dynix | |
1473 | $test -f /dnix && osname=dnix | |
a0d0e21e | 1474 | $test -f /unicos && osname=unicos && osvers=`$uname -r` |
85e6fe83 | 1475 | $test -f /bin/mips && /bin/mips && osname=mips |
ecfc5424 AD |
1476 | $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \ |
1477 | $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4 | |
a0d0e21e LW |
1478 | $test -d /usr/apollo/bin && osname=apollo |
1479 | $test -f /etc/saf/_sactab && osname=svr4 | |
85e6fe83 | 1480 | $test -d /usr/include/minix && osname=minix |
2304df62 AD |
1481 | if $test -f $uname; then |
1482 | set X $myuname | |
1483 | shift | |
1484 | ||
2304df62 | 1485 | case "$5" in |
85e6fe83 | 1486 | fps*) osname=fps ;; |
2304df62 AD |
1487 | mips*) |
1488 | case "$4" in | |
85e6fe83 LW |
1489 | umips) osname=umips ;; |
1490 | *) osname=mips ;; | |
2304df62 | 1491 | esac;; |
85e6fe83 LW |
1492 | [23]100) osname=mips ;; |
1493 | next*) osname=next ;; | |
1494 | news*) osname=news ;; | |
ecfc5424 AD |
1495 | i386*) |
1496 | if $test -f /etc/kconfig; then | |
1497 | osname=isc | |
a0d0e21e LW |
1498 | if test "$lns" = "ln -s"; then |
1499 | osvers=4 | |
1500 | elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then | |
1501 | osvers=3 | |
2304df62 | 1502 | elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then |
a0d0e21e | 1503 | osvers=2 |
ecfc5424 AD |
1504 | fi |
1505 | fi | |
1506 | ;; | |
2304df62 AD |
1507 | esac |
1508 | ||
1509 | case "$1" in | |
a0d0e21e LW |
1510 | aix) osname=aix |
1511 | tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1` | |
1512 | case "$tmp" in | |
1aef975c | 1513 | 'not found') osvers="$4"."$3" ;; |
a0d0e21e LW |
1514 | '<3240'|'<>3240') osvers=3.2.0 ;; |
1515 | '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;; | |
1516 | '=3250'|'>3250') osvers=3.2.5 ;; | |
1aef975c | 1517 | *) osvers=$tmp;; |
a0d0e21e LW |
1518 | esac |
1519 | ;; | |
1520 | dnix) osname=dnix | |
1521 | osvers="$3" | |
1522 | ;; | |
1523 | domainos) osname=apollo | |
1524 | osvers="$3" | |
1525 | ;; | |
1526 | dgux) osname=dgux | |
1527 | osvers="$3" | |
1528 | ;; | |
1529 | freebsd) osname=freebsd | |
1530 | osvers="$3" ;; | |
1531 | genix) osname=genix ;; | |
1532 | hp*) osname=hpux | |
1533 | case "$3" in | |
1534 | *.08.*) osvers=9 ;; | |
1535 | *.09.*) osvers=9 ;; | |
1536 | *.10.*) osvers=10 ;; | |
ecfc5424 | 1537 | *) osvers="$3" ;; |
a0d0e21e LW |
1538 | esac |
1539 | ;; | |
1540 | irix) osname=irix | |
1541 | case "$3" in | |
1542 | 4*) osvers=4 ;; | |
1543 | 5*) osvers=5 ;; | |
ecfc5424 | 1544 | *) osvers="$3" ;; |
a0d0e21e LW |
1545 | esac |
1546 | ;; | |
1547 | linux) osname=linux | |
1548 | case "$3" in | |
1549 | 1*) osvers=1 ;; | |
1550 | *) osvers="$3" ;; | |
1551 | esac | |
1552 | ;; | |
1553 | netbsd*) osname=netbsd | |
ecfc5424 AD |
1554 | osvers="$3" |
1555 | ;; | |
a0d0e21e LW |
1556 | bsd386) osname=bsd386 |
1557 | osvers=`$uname -r` | |
1558 | ;; | |
1559 | next*) osname=next ;; | |
1560 | solaris) osname=solaris | |
1561 | case "$3" in | |
1562 | 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;; | |
ecfc5424 | 1563 | *) osvers="$3" ;; |
a0d0e21e LW |
1564 | esac |
1565 | ;; | |
85e6fe83 LW |
1566 | sunos) osname=sunos |
1567 | case "$3" in | |
85e6fe83 LW |
1568 | 5*) osname=solaris |
1569 | osvers=`echo $3 | $sed 's/^5/2/g'` ;; | |
a0d0e21e | 1570 | *) osvers="$3" ;; |
2304df62 AD |
1571 | esac |
1572 | ;; | |
a0d0e21e | 1573 | titanos) osname=titanos |
85e6fe83 | 1574 | case "$3" in |
a0d0e21e LW |
1575 | 1*) osvers=1 ;; |
1576 | 2*) osvers=2 ;; | |
1577 | 3*) osvers=3 ;; | |
1578 | 4*) osvers=4 ;; | |
ecfc5424 | 1579 | *) osvers="$3" ;; |
2304df62 AD |
1580 | esac |
1581 | ;; | |
85e6fe83 | 1582 | ultrix) osname=ultrix |
ecfc5424 | 1583 | osvers="$3" |
2304df62 | 1584 | ;; |
85e6fe83 | 1585 | osf1) case "$5" in |
fed7345c AD |
1586 | alpha) |
1587 | osname=dec_osf | |
1588 | osvers=`echo "$3" | sed 's/^[vt]//'` | |
ecfc5424 AD |
1589 | ;; |
1590 | hp*) osname=hp_osf1 ;; | |
1591 | mips) osname=mips_osf1 ;; | |
85e6fe83 LW |
1592 | esac |
1593 | ;; | |
a0d0e21e LW |
1594 | uts) osname=uts |
1595 | osvers="$3" | |
1596 | ;; | |
85e6fe83 | 1597 | $2) case "$osname" in |
2304df62 | 1598 | *isc*) ;; |
a0d0e21e LW |
1599 | *freebsd*) ;; |
1600 | svr*) | |
1601 | : svr4.x or possibly later | |
1602 | case "svr$3" in | |
1603 | ${osname}*) | |
1604 | osname=svr$3 | |
1605 | osvers=$4 | |
1606 | ;; | |
1607 | esac | |
1608 | case "$osname" in | |
1609 | svr4.0) | |
1610 | : Check for ESIX | |
1611 | if test -f /stand/boot ; then | |
1612 | eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot` | |
ecfc5424 AD |
1613 | if test -n "$INITPROG" -a -f "$INITPROG"; then |
1614 | isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'` | |
1615 | if test -n "$isesix"; then | |
a0d0e21e LW |
1616 | osname=esix4 |
1617 | fi | |
1618 | fi | |
1619 | fi | |
1620 | ;; | |
1621 | esac | |
1622 | ;; | |
2304df62 | 1623 | *) if test -f /etc/systemid; then |
a0d0e21e LW |
1624 | osname=sco |
1625 | set `echo $3 | $sed 's/\./ /g'` $4 | |
2304df62 | 1626 | if $test -f sco_$1_$2_$3.sh; then |
85e6fe83 | 1627 | osvers=$1.$2.$3 |
2304df62 | 1628 | elif $test -f sco_$1_$2.sh; then |
85e6fe83 | 1629 | osvers=$1.$2 |
2304df62 | 1630 | elif $test -f sco_$1.sh; then |
85e6fe83 | 1631 | osvers=$1 |
2304df62 | 1632 | fi |
a0d0e21e LW |
1633 | else |
1634 | case "$osname" in | |
1635 | '') : Still unknown. Probably a generic Sys V. | |
1636 | osname="sysv" | |
1637 | osvers="$3" | |
1638 | ;; | |
1639 | esac | |
2304df62 AD |
1640 | fi |
1641 | ;; | |
1642 | esac | |
1643 | ;; | |
a0d0e21e LW |
1644 | *) case "$osname" in |
1645 | '') : Still unknown. Probably a generic BSD. | |
1646 | osname="$1" | |
1647 | osvers="$3" | |
1648 | ;; | |
1649 | esac | |
1650 | ;; | |
2304df62 AD |
1651 | esac |
1652 | else | |
1653 | if test -f /vmunix -a -f news_os.sh; then | |
ecfc5424 | 1654 | (what /vmunix | ../UU/tr '[A-Z]' '[a-z]') > ../UU/kernel.what 2>&1 |
2304df62 | 1655 | if $contains news-os ../UU/kernel.what >/dev/null 2>&1; then |
85e6fe83 | 1656 | osname=news_os |
2304df62 AD |
1657 | fi |
1658 | $rm -f ../UU/kernel.what | |
1659 | fi | |
1660 | fi | |
85e6fe83 | 1661 | |
a0d0e21e LW |
1662 | : Now look for a hint file osname_osvers, unless one has been |
1663 | : specified already. | |
1664 | case "$hintfile" in | |
1665 | ''|' ') | |
ecfc5424 | 1666 | file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'` |
a0d0e21e | 1667 | : Also try without trailing minor version numbers. |
ecfc5424 AD |
1668 | xfile=`echo $file | $sed -e 's@_[^_]*$@@'` |
1669 | xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'` | |
1670 | xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'` | |
1671 | xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'` | |
a0d0e21e LW |
1672 | case "$file" in |
1673 | '') dflt=none ;; | |
1674 | *) case "$osvers" in | |
1675 | '') dflt=$file | |
1676 | ;; | |
1677 | *) if $test -f $file.sh ; then | |
1678 | dflt=$file | |
1679 | elif $test -f $xfile.sh ; then | |
1680 | dflt=$xfile | |
1681 | elif $test -f $xxfile.sh ; then | |
1682 | dflt=$xxfile | |
1683 | elif $test -f $xxxfile.sh ; then | |
1684 | dflt=$xxxfile | |
1685 | elif $test -f $xxxxfile.sh ; then | |
1686 | dflt=$xxxxfile | |
1687 | elif $test -f "${osname}.sh" ; then | |
1688 | dflt="${osname}" | |
1689 | else | |
1690 | dflt=none | |
1691 | fi | |
1692 | ;; | |
1693 | esac | |
85e6fe83 LW |
1694 | ;; |
1695 | esac | |
1696 | ;; | |
a0d0e21e | 1697 | *) |
ecfc5424 | 1698 | dflt=`echo $hintfile | $sed 's/\.sh$//'` |
a0d0e21e | 1699 | ;; |
2304df62 | 1700 | esac |
1aef975c | 1701 | |
2304df62 AD |
1702 | $cat <<EOM |
1703 | ||
1704 | You may give one or more space-separated answers, or "none" if appropriate. | |
1705 | If your OS version has no hints, DO NOT give a wrong version -- say "none". | |
1706 | ||
1707 | EOM | |
1708 | rp="Which of these apply, if any?" | |
1709 | . ../UU/myread | |
85e6fe83 LW |
1710 | tans=$ans |
1711 | for file in $tans; do | |
2304df62 AD |
1712 | if $test -f $file.sh; then |
1713 | . ./$file.sh | |
1714 | $cat $file.sh >> ../UU/config.sh | |
85e6fe83 | 1715 | elif $test X$tans = X -o X$tans = Xnone ; then |
2304df62 AD |
1716 | : nothing |
1717 | else | |
85e6fe83 LW |
1718 | : Give one chance to correct a possible typo. |
1719 | echo "$file.sh does not exist" | |
1720 | dflt=$file | |
1721 | rp="hint to use instead?" | |
1722 | . ../UU/myread | |
1723 | for file in $ans; do | |
1724 | if $test -f "$file.sh"; then | |
1725 | . ./$file.sh | |
1726 | $cat $file.sh >> ../UU/config.sh | |
1727 | elif $test X$ans = X -o X$ans = Xnone ; then | |
1728 | : nothing | |
1729 | else | |
1730 | echo "$file.sh does not exist -- ignored." | |
1731 | fi | |
1732 | done | |
2304df62 AD |
1733 | fi |
1734 | done | |
85e6fe83 | 1735 | |
2304df62 | 1736 | hint=recommended |
85e6fe83 LW |
1737 | : Remember our hint file for later. |
1738 | if $test -f "$file.sh" ; then | |
a0d0e21e | 1739 | hintfile="$file" |
85e6fe83 | 1740 | else |
a0d0e21e | 1741 | hintfile='' |
85e6fe83 LW |
1742 | fi |
1743 | ||
2304df62 AD |
1744 | cd .. |
1745 | fi | |
1746 | cd UU | |
1747 | ;; | |
1748 | *) | |
1749 | echo " " | |
1750 | echo "Fetching default answers from $config_sh..." >&4 | |
ecfc5424 AD |
1751 | tmp_n="$n" |
1752 | tmp_c="$c" | |
2304df62 AD |
1753 | cd .. |
1754 | cp $config_sh config.sh 2>/dev/null | |
1755 | . ./config.sh | |
1756 | cd UU | |
1757 | cp ../config.sh . | |
ecfc5424 AD |
1758 | n="$tmp_n" |
1759 | c="$tmp_c" | |
2304df62 AD |
1760 | hint=previous |
1761 | ;; | |
1762 | esac | |
1aef975c AD |
1763 | test "$override" && . ./optdef.sh |
1764 | myuname="$newmyuname" | |
2304df62 AD |
1765 | |
1766 | : Restore computed paths | |
1767 | for file in $loclist $trylist; do | |
1768 | eval $file="\$_$file" | |
1769 | done | |
1770 | ||
85e6fe83 | 1771 | cat << EOM |
a0d0e21e | 1772 | |
85e6fe83 | 1773 | Configure uses the operating system name and version to set some defaults. |
ecfc5424 AD |
1774 | The default value is probably right if the name rings a bell. Otherwise, |
1775 | since spelling matters for me, either accept the default or answer "none" | |
1776 | to leave it blank. | |
a0d0e21e | 1777 | |
85e6fe83 | 1778 | EOM |
85e6fe83 | 1779 | case "$osname" in |
a0d0e21e | 1780 | ''|' ') |
85e6fe83 | 1781 | case "$hintfile" in |
a0d0e21e | 1782 | ''|' '|none) dflt=none ;; |
ecfc5424 | 1783 | *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;; |
85e6fe83 LW |
1784 | esac |
1785 | ;; | |
1786 | *) dflt="$osname" ;; | |
1787 | esac | |
1788 | rp="Operating system name?" | |
1789 | . ./myread | |
1790 | case "$ans" in | |
ecfc5424 AD |
1791 | none) osname='' ;; |
1792 | *) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;; | |
85e6fe83 | 1793 | esac |
2304df62 AD |
1794 | : who configured the system |
1795 | cf_time=`$date 2>&1` | |
a0d0e21e LW |
1796 | (logname > .temp) >/dev/null 2>&1 |
1797 | $test -s .temp || (whoami > .temp) >/dev/null 2>&1 | |
1798 | $test -s .temp || echo unknown > .temp | |
1799 | cf_by=`$cat .temp` | |
1800 | $rm -f .temp | |
2304df62 AD |
1801 | |
1802 | : determine where manual pages are on this system | |
1803 | echo " " | |
1804 | case "$sysman" in | |
1805 | '') | |
a0d0e21e | 1806 | syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1' |
2304df62 AD |
1807 | syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1" |
1808 | syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1" | |
1809 | syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1" | |
a0d0e21e LW |
1810 | syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1" |
1811 | sysman=`./loc . /usr/man/man1 $syspath` | |
2304df62 AD |
1812 | ;; |
1813 | esac | |
1814 | if $test -d "$sysman"; then | |
1815 | echo "System manual is in $sysman." >&4 | |
1816 | else | |
1817 | echo "Could not find manual pages in source form." >&4 | |
1818 | fi | |
1819 | ||
1820 | : see what memory models we can support | |
1821 | case "$models" in | |
1822 | '') | |
1823 | $cat >pdp11.c <<'EOP' | |
1824 | main() { | |
1825 | #ifdef pdp11 | |
1826 | exit(0); | |
1827 | #else | |
1828 | exit(1); | |
1829 | #endif | |
1830 | } | |
1831 | EOP | |
1832 | cc -o pdp11 pdp11.c >/dev/null 2>&1 | |
1833 | if ./pdp11 2>/dev/null; then | |
1834 | dflt='unsplit split' | |
1835 | else | |
1836 | tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge` | |
1837 | case "$tans" in | |
1838 | X) dflt='none';; | |
1839 | *) if $test -d /lib/small || $test -d /usr/lib/small; then | |
1840 | dflt='small' | |
1841 | else | |
1842 | dflt='' | |
1843 | fi | |
1844 | if $test -d /lib/medium || $test -d /usr/lib/medium; then | |
1845 | dflt="$dflt medium" | |
1846 | fi | |
1847 | if $test -d /lib/large || $test -d /usr/lib/large; then | |
1848 | dflt="$dflt large" | |
1849 | fi | |
1850 | if $test -d /lib/huge || $test -d /usr/lib/huge; then | |
1851 | dflt="$dflt huge" | |
1852 | fi | |
1853 | esac | |
1854 | fi;; | |
1855 | *) dflt="$models";; | |
1856 | esac | |
1857 | $cat <<EOM | |
1858 | ||
1859 | Some systems have different model sizes. On most systems they are called | |
1860 | small, medium, large, and huge. On the PDP11 they are called unsplit and | |
1861 | split. If your system doesn't support different memory models, say "none". | |
1862 | If you wish to force everything to one memory model, say "none" here and | |
1863 | put the appropriate flags later when it asks you for other cc and ld flags. | |
1864 | Venix systems may wish to put "none" and let the compiler figure things out. | |
1865 | (In the following question multiple model names should be space separated.) | |
1866 | ||
1867 | EOM | |
1868 | rp="Which memory models are supported?" | |
1869 | . ./myread | |
1870 | models="$ans" | |
1871 | ||
1872 | case "$models" in | |
1873 | none) | |
1874 | small='' | |
1875 | medium='' | |
1876 | large='' | |
1877 | huge='' | |
1878 | unsplit='' | |
1879 | split='' | |
1880 | ;; | |
1881 | *split) | |
1882 | case "$split" in | |
1883 | '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \ | |
1884 | $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then | |
1885 | dflt='-i' | |
1886 | else | |
1887 | dflt='none' | |
1888 | fi;; | |
1889 | *) dflt="$split";; | |
1890 | esac | |
1891 | rp="What flag indicates separate I and D space?" | |
1892 | . ./myread | |
1893 | tans="$ans" | |
1894 | case "$tans" in | |
1895 | none) tans='';; | |
1896 | esac | |
1897 | split="$tans" | |
1898 | unsplit='';; | |
1899 | *large*|*small*|*medium*|*huge*) | |
1900 | case "$models" in | |
1901 | *large*) | |
1902 | case "$large" in | |
1903 | '') dflt='-Ml';; | |
1904 | *) dflt="$large";; | |
1905 | esac | |
1906 | rp="What flag indicates large model?" | |
1907 | . ./myread | |
1908 | tans="$ans" | |
1909 | case "$tans" in | |
1910 | none) tans=''; | |
1911 | esac | |
1912 | large="$tans";; | |
1913 | *) large='';; | |
1914 | esac | |
1915 | case "$models" in | |
1916 | *huge*) case "$huge" in | |
1917 | '') dflt='-Mh';; | |
1918 | *) dflt="$huge";; | |
1919 | esac | |
1920 | rp="What flag indicates huge model?" | |
1921 | . ./myread | |
1922 | tans="$ans" | |
1923 | case "$tans" in | |
1924 | none) tans=''; | |
1925 | esac | |
1926 | huge="$tans";; | |
1927 | *) huge="$large";; | |
1928 | esac | |
1929 | case "$models" in | |
1930 | *medium*) case "$medium" in | |
1931 | '') dflt='-Mm';; | |
1932 | *) dflt="$medium";; | |
1933 | esac | |
1934 | rp="What flag indicates medium model?" | |
1935 | . ./myread | |
1936 | tans="$ans" | |
1937 | case "$tans" in | |
1938 | none) tans=''; | |
1939 | esac | |
1940 | medium="$tans";; | |
1941 | *) medium="$large";; | |
1942 | esac | |
1943 | case "$models" in | |
1944 | *small*) case "$small" in | |
1945 | '') dflt='none';; | |
1946 | *) dflt="$small";; | |
1947 | esac | |
1948 | rp="What flag indicates small model?" | |
1949 | . ./myread | |
1950 | tans="$ans" | |
1951 | case "$tans" in | |
1952 | none) tans=''; | |
1953 | esac | |
1954 | small="$tans";; | |
1955 | *) small='';; | |
1956 | esac | |
1957 | ;; | |
1958 | *) | |
1959 | echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4 | |
1960 | ;; | |
1961 | esac | |
1962 | ||
1963 | : make some quick guesses about what we are up against | |
1964 | echo " " | |
1965 | $echo $n "Hmm... $c" | |
1966 | echo exit 1 >bsd | |
1967 | echo exit 1 >usg | |
1968 | echo exit 1 >v7 | |
1969 | echo exit 1 >osf1 | |
1970 | echo exit 1 >eunice | |
1971 | echo exit 1 >xenix | |
1972 | echo exit 1 >venix | |
ecfc5424 | 1973 | d_bsd="$undef" |
2304df62 AD |
1974 | $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null |
1975 | if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1 | |
1976 | then | |
1977 | echo "Looks kind of like an OSF/1 system, but we'll see..." | |
1978 | echo exit 0 >osf1 | |
1979 | elif test `echo abc | tr a-z A-Z` = Abc ; then | |
1980 | xxx=`./loc addbib blurfl $pth` | |
1981 | if $test -f $xxx; then | |
1982 | echo "Looks kind of like a USG system with BSD features, but we'll see..." | |
1983 | echo exit 0 >bsd | |
1984 | echo exit 0 >usg | |
1985 | else | |
1986 | if $contains SIGTSTP foo >/dev/null 2>&1 ; then | |
1987 | echo "Looks kind of like an extended USG system, but we'll see..." | |
1988 | else | |
1989 | echo "Looks kind of like a USG system, but we'll see..." | |
1990 | fi | |
1991 | echo exit 0 >usg | |
1992 | fi | |
1993 | elif $contains SIGTSTP foo >/dev/null 2>&1 ; then | |
1994 | echo "Looks kind of like a BSD system, but we'll see..." | |
ecfc5424 | 1995 | d_bsd="$define" |
2304df62 AD |
1996 | echo exit 0 >bsd |
1997 | else | |
1998 | echo "Looks kind of like a Version 7 system, but we'll see..." | |
1999 | echo exit 0 >v7 | |
2000 | fi | |
2001 | case "$eunicefix" in | |
2002 | *unixtovms*) | |
2003 | $cat <<'EOI' | |
2004 | There is, however, a strange, musty smell in the air that reminds me of | |
2005 | something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit. | |
2006 | EOI | |
2007 | echo exit 0 >eunice | |
2008 | d_eunice="$define" | |
2009 | : it so happens the Eunice I know will not run shell scripts in Unix format | |
2010 | ;; | |
2011 | *) | |
2012 | echo " " | |
2013 | echo "Congratulations. You aren't running Eunice." | |
2014 | d_eunice="$undef" | |
2015 | ;; | |
2016 | esac | |
2017 | if test -f /xenix; then | |
2018 | echo "Actually, this looks more like a XENIX system..." | |
2019 | echo exit 0 >xenix | |
2020 | d_xenix="$define" | |
2021 | else | |
2022 | echo " " | |
2023 | echo "It's not Xenix..." | |
2024 | d_xenix="$undef" | |
2025 | fi | |
2026 | chmod +x xenix | |
2027 | $eunicefix xenix | |
2028 | if test -f /venix; then | |
2029 | echo "Actually, this looks more like a VENIX system..." | |
2030 | echo exit 0 >venix | |
2031 | else | |
2032 | echo " " | |
ecfc5424 | 2033 | if ./xenix; then |
2304df62 AD |
2034 | : null |
2035 | else | |
2036 | echo "Nor is it Venix..." | |
2037 | fi | |
2038 | fi | |
2039 | chmod +x bsd usg v7 osf1 eunice xenix venix | |
2040 | $eunicefix bsd usg v7 osf1 eunice xenix venix | |
2041 | $rm -f foo | |
2042 | ||
2043 | : see if we need a special compiler | |
2044 | echo " " | |
ecfc5424 | 2045 | if ./usg; then |
2304df62 AD |
2046 | case "$cc" in |
2047 | '') case "$Mcc" in | |
2048 | /*) dflt='Mcc';; | |
2049 | *) case "$large" in | |
2050 | -M*) dflt='cc';; | |
2051 | *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then | |
2052 | if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then | |
2053 | dflt='cc' | |
2054 | else | |
2055 | dflt='cc -M' | |
2056 | fi | |
2057 | else | |
2058 | dflt='cc' | |
2059 | fi;; | |
2060 | esac;; | |
2061 | esac;; | |
2062 | *) dflt="$cc";; | |
2063 | esac | |
2064 | $cat <<'EOM' | |
2065 | On some systems the default C compiler will not resolve multiple global | |
2066 | references that happen to have the same name. On some such systems the "Mcc" | |
2067 | command may be used to force these to be resolved. On other systems a "cc -M" | |
2068 | command is required. (Note that the -M flag on other systems indicates a | |
2069 | memory model to use!) If you have the Gnu C compiler, you might wish to use | |
2070 | that instead. | |
2071 | ||
2072 | EOM | |
2073 | rp="What command will force resolution on this system?" | |
2074 | . ./myread | |
2075 | cc="$ans" | |
2076 | else | |
2077 | case "$cc" in | |
2078 | '') dflt=cc;; | |
2079 | *) dflt="$cc";; | |
2080 | esac | |
2081 | rp="Use which C compiler?" | |
2082 | . ./myread | |
2083 | cc="$ans" | |
2084 | fi | |
ecfc5424 AD |
2085 | echo " " |
2086 | echo "Checking for GNU cc in disguise and/or its version number..." >&4 | |
2304df62 AD |
2087 | $cat >gccvers.c <<EOM |
2088 | #include <stdio.h> | |
a0d0e21e | 2089 | int main() { |
2304df62 | 2090 | #ifdef __GNUC__ |
a0d0e21e | 2091 | #ifdef __VERSION__ |
ecfc5424 | 2092 | printf("%s\n", __VERSION__); |
2304df62 | 2093 | #else |
ecfc5424 | 2094 | printf("%s\n", "1"); |
2304df62 | 2095 | #endif |
a0d0e21e | 2096 | #endif |
ecfc5424 | 2097 | exit(0); |
2304df62 AD |
2098 | } |
2099 | EOM | |
a0d0e21e LW |
2100 | if $cc -o gccvers gccvers.c >/dev/null 2>&1; then |
2101 | gccversion=`./gccvers` | |
2102 | case "$gccversion" in | |
2103 | '') echo "You are not using GNU cc." ;; | |
2104 | *) echo "You are using GNU cc $gccversion." ;; | |
2105 | esac | |
2106 | else | |
ecfc5424 | 2107 | echo "I can't compile the test program -- Assuming it isn't GNU cc." |
a0d0e21e LW |
2108 | fi |
2109 | $rm -f gccvers* | |
2110 | case "$gccversion" in | |
2111 | 1*) cpp=`./loc gcc-cpp $cpp $pth` ;; | |
2304df62 | 2112 | esac |
a0d0e21e | 2113 | |
2304df62 AD |
2114 | : decide how portable to be |
2115 | case "$d_portable" in | |
2116 | "$define") dflt=y;; | |
2117 | *) dflt=n;; | |
2118 | esac | |
2119 | $cat <<'EOH' | |
2120 | ||
2121 | I can set things up so that your shell scripts and binaries are more portable, | |
2122 | at what may be a noticable cost in performance. In particular, if you | |
2123 | ask to be portable, the following happens: | |
2124 | ||
2125 | 1) Shell scripts will rely on the PATH variable rather than using | |
2126 | the paths derived above. | |
2127 | 2) ~username interpretations will be done at run time rather than | |
2128 | by Configure. | |
2129 | ||
2130 | EOH | |
2131 | rp="Do you expect to run these scripts and binaries on multiple machines?" | |
2132 | . ./myread | |
2133 | case "$ans" in | |
2134 | y*) d_portable="$define" | |
2304df62 AD |
2135 | ;; |
2136 | *) d_portable="$undef" ;; | |
2137 | esac | |
2138 | ||
2139 | : set up shell script to do ~ expansion | |
2140 | cat >filexp <<EOSS | |
2141 | $startsh | |
2142 | : expand filename | |
2143 | case "\$1" in | |
2144 | ~/*|~) | |
2145 | echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|" | |
2146 | ;; | |
2147 | ~*) | |
2148 | if $test -f /bin/csh; then | |
2149 | /bin/csh -f -c "glob \$1" | |
a0d0e21e | 2150 | failed=\$? |
2304df62 AD |
2151 | echo "" |
2152 | exit \$failed | |
2153 | else | |
2154 | name=\`$expr x\$1 : '..\([^/]*\)'\` | |
2155 | dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\` | |
2156 | if $test ! -d "\$dir"; then | |
2157 | me=\`basename \$0\` | |
2158 | echo "\$me: can't locate home directory for: \$name" >&2 | |
2159 | exit 1 | |
2160 | fi | |
2161 | case "\$1" in | |
2162 | */*) | |
2163 | echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\` | |
2164 | ;; | |
2165 | *) | |
2166 | echo \$dir | |
2167 | ;; | |
2168 | esac | |
2169 | fi | |
2170 | ;; | |
2171 | *) | |
2172 | echo \$1 | |
2173 | ;; | |
2174 | esac | |
2175 | EOSS | |
2176 | chmod +x filexp | |
2177 | $eunicefix filexp | |
2178 | ||
2179 | : now set up to get a file name | |
2180 | cat <<'EOSC' >getfile | |
2181 | tilde='' | |
2182 | fullpath='' | |
2183 | already='' | |
2184 | skip='' | |
2185 | none_ok='' | |
2186 | exp_file='' | |
a0d0e21e | 2187 | nopath_ok='' |
2304df62 AD |
2188 | orig_rp="$rp" |
2189 | orig_dflt="$dflt" | |
2190 | ||
2191 | case "$fn" in | |
ecfc5424 AD |
2192 | *\(*) |
2193 | expr $fn : '.*(\(.*\)).*' | tr ',' '\012' >getfile.ok | |
2194 | fn=`echo $fn | sed 's/(.*)//'` | |
2195 | ;; | |
2196 | esac | |
2197 | ||
2198 | case "$fn" in | |
a0d0e21e LW |
2199 | *:*) |
2200 | loc_file=`expr $fn : '.*:\(.*\)'` | |
2201 | fn=`expr $fn : '\(.*\):.*'` | |
2202 | ;; | |
2203 | esac | |
2204 | ||
2205 | case "$fn" in | |
2304df62 AD |
2206 | *~*) tilde=true;; |
2207 | esac | |
2208 | case "$fn" in | |
2209 | */*) fullpath=true;; | |
2210 | esac | |
2211 | case "$fn" in | |
2212 | *+*) skip=true;; | |
2213 | esac | |
2214 | case "$fn" in | |
2215 | *n*) none_ok=true;; | |
2216 | esac | |
2217 | case "$fn" in | |
2218 | *e*) exp_file=true;; | |
2219 | esac | |
a0d0e21e LW |
2220 | case "$fn" in |
2221 | *p*) nopath_ok=true;; | |
2222 | esac | |
2304df62 AD |
2223 | |
2224 | case "$fn" in | |
2225 | *f*) type='File';; | |
2226 | *d*) type='Directory';; | |
a0d0e21e | 2227 | *l*) type='Locate';; |
2304df62 AD |
2228 | esac |
2229 | ||
2230 | what="$type" | |
2231 | case "$what" in | |
2232 | Locate) what='File';; | |
2233 | esac | |
2234 | ||
2235 | case "$exp_file" in | |
2236 | '') | |
2237 | case "$d_portable" in | |
2238 | "$define") ;; | |
2239 | *) exp_file=true;; | |
2240 | esac | |
2241 | ;; | |
2242 | esac | |
2243 | ||
2244 | cd .. | |
2245 | while test "$type"; do | |
2246 | redo='' | |
2247 | rp="$orig_rp" | |
2248 | dflt="$orig_dflt" | |
2249 | case "$tilde" in | |
2250 | true) rp="$rp (~name ok)";; | |
2251 | esac | |
2252 | . UU/myread | |
ecfc5424 AD |
2253 | if test -f UU/getfile.ok && \ |
2254 | $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1 | |
2255 | then | |
2256 | value="$ans" | |
2257 | ansexp="$ans" | |
2258 | break | |
2259 | fi | |
2304df62 AD |
2260 | case "$ans" in |
2261 | none) | |
2262 | value='' | |
2263 | ansexp='' | |
2264 | case "$none_ok" in | |
2265 | true) type='';; | |
2266 | esac | |
2267 | ;; | |
2268 | *) | |
2269 | case "$tilde" in | |
2270 | '') value="$ans" | |
2271 | ansexp="$ans";; | |
2272 | *) | |
2273 | value=`UU/filexp $ans` | |
2274 | case $? in | |
2275 | 0) | |
2276 | if test "$ans" != "$value"; then | |
ecfc5424 | 2277 | echo "(That expands to $value on this system.)" |
2304df62 AD |
2278 | fi |
2279 | ;; | |
2280 | *) value="$ans";; | |
2281 | esac | |
2282 | ansexp="$value" | |
2283 | case "$exp_file" in | |
2284 | '') value="$ans";; | |
2285 | esac | |
2286 | ;; | |
2287 | esac | |
2288 | case "$fullpath" in | |
2289 | true) | |
2290 | case "$ansexp" in | |
2291 | /*) value="$ansexp" ;; | |
2292 | *) | |
2293 | redo=true | |
2294 | case "$already" in | |
2295 | true) | |
2296 | echo "I shall only accept a full path name, as in /bin/ls." >&4 | |
2297 | echo "Use a ! shell escape if you wish to check pathnames." >&4 | |
2298 | ;; | |
2299 | *) | |
2300 | echo "Please give a full path name, starting with slash." >&4 | |
2301 | case "$tilde" in | |
2302 | true) | |
2303 | echo "Note that using ~name is ok provided it expands well." >&4 | |
2304 | already=true | |
2305 | ;; | |
2306 | esac | |
2307 | esac | |
2308 | ;; | |
2309 | esac | |
2310 | ;; | |
2311 | esac | |
2312 | case "$redo" in | |
2313 | '') | |
2314 | case "$type" in | |
2315 | File) | |
2316 | if test -f "$ansexp"; then | |
2317 | type='' | |
2318 | elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1 | |
2319 | then | |
2320 | echo "($value is not a plain file, but that's ok.)" | |
2321 | type='' | |
2322 | fi | |
2323 | ;; | |
2324 | Directory) | |
2325 | if test -d "$ansexp"; then | |
2326 | type='' | |
2327 | fi | |
2328 | ;; | |
2329 | Locate) | |
40000a8c | 2330 | if test -d "$ansexp"; then |
a0d0e21e LW |
2331 | echo "(Looking for $loc_file in directory $value.)" |
2332 | value="$value/$loc_file" | |
40000a8c | 2333 | ansexp="$ansexp/$loc_file" |
2304df62 | 2334 | fi |
40000a8c | 2335 | if test -f "$ansexp"; then |
2304df62 AD |
2336 | type='' |
2337 | fi | |
a0d0e21e LW |
2338 | case "$nopath_ok" in |
2339 | true) case "$value" in | |
2340 | */*) ;; | |
2341 | *) echo "Assuming $value will be in people's path." | |
2342 | type='' | |
2343 | ;; | |
2344 | esac | |
2345 | ;; | |
2346 | esac | |
2304df62 AD |
2347 | ;; |
2348 | esac | |
2349 | ||
2350 | case "$skip" in | |
2351 | true) type=''; | |
2352 | esac | |
2353 | ||
2354 | case "$type" in | |
2355 | '') ;; | |
2356 | *) | |
2357 | if test "$fastread" = yes; then | |
2358 | dflt=y | |
2359 | else | |
2360 | dflt=n | |
2361 | fi | |
2362 | rp="$what $value doesn't exist. Use that name anyway?" | |
2363 | . UU/myread | |
2364 | dflt='' | |
2365 | case "$ans" in | |
2366 | y*) type='';; | |
2367 | *) echo " ";; | |
2368 | esac | |
2369 | ;; | |
2370 | esac | |
2371 | ;; | |
2372 | esac | |
2373 | ;; | |
2374 | esac | |
2375 | done | |
2376 | cd UU | |
2377 | ans="$value" | |
2378 | rp="$orig_rp" | |
2379 | dflt="$orig_dflt" | |
ecfc5424 | 2380 | rm -f getfile.ok |
2304df62 AD |
2381 | EOSC |
2382 | ||
2383 | : What should the include directory be ? | |
2384 | echo " " | |
2385 | $echo $n "Hmm... $c" | |
a0d0e21e | 2386 | dflt='/usr/include' |
2304df62 AD |
2387 | incpath='' |
2388 | mips_type='' | |
2389 | if $test -f /bin/mips && /bin/mips; then | |
2390 | echo "Looks like a MIPS system..." | |
2391 | $cat >usr.c <<'EOCP' | |
2392 | #ifdef SYSTYPE_BSD43 | |
2393 | /bsd43 | |
2394 | #endif | |
2395 | EOCP | |
2396 | if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then | |
2397 | dflt='/bsd43/usr/include' | |
2398 | incpath='/bsd43' | |
2399 | mips_type='BSD 4.3' | |
2400 | else | |
2401 | mips_type='System V' | |
2402 | fi | |
2403 | $rm -f usr.c usr.out | |
2404 | echo "and you're compiling with the $mips_type compiler and libraries." | |
40000a8c | 2405 | echo "exit 0" >mips |
2304df62 AD |
2406 | else |
2407 | echo "Doesn't look like a MIPS system." | |
2408 | echo "exit 1" >mips | |
2304df62 | 2409 | fi |
40000a8c AD |
2410 | chmod +x mips |
2411 | $eunicefix mips | |
2304df62 | 2412 | echo " " |
a0d0e21e LW |
2413 | case "$usrinc" in |
2414 | '') ;; | |
2415 | *) dflt="$usrinc";; | |
2416 | esac | |
2304df62 AD |
2417 | fn=d/ |
2418 | rp='Where are the include files you want to use?' | |
2419 | . ./getfile | |
2420 | usrinc="$ans" | |
2421 | ||
a0d0e21e LW |
2422 | : see how we invoke the C preprocessor |
2423 | echo " " | |
2424 | echo "Now, how can we feed standard input to your C preprocessor..." >&4 | |
2425 | cat <<'EOT' >testcpp.c | |
2426 | #define ABC abc | |
2427 | #define XYZ xyz | |
2428 | ABC.XYZ | |
2429 | EOT | |
2430 | cd .. | |
2431 | echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin | |
2432 | chmod 755 cppstdin | |
2433 | wrapper=`pwd`/cppstdin | |
2434 | ok='false' | |
2435 | cd UU | |
2304df62 | 2436 | |
a0d0e21e LW |
2437 | if $test "X$cppstdin" != "X" && \ |
2438 | $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \ | |
2439 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 | |
2440 | then | |
2441 | echo "You used to use $cppstdin $cppminus so we'll use that again." | |
2442 | case "$cpprun" in | |
2443 | '') echo "But let's see if we can live without a wrapper..." ;; | |
2444 | *) | |
2445 | if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \ | |
2446 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 | |
2304df62 | 2447 | then |
a0d0e21e LW |
2448 | echo "(And we'll use $cpprun $cpplast to preprocess directly.)" |
2449 | ok='true' | |
2450 | else | |
2451 | echo "(However, $cpprun $cpplast does not work, let's see...)" | |
2304df62 AD |
2452 | fi |
2453 | ;; | |
2454 | esac | |
2304df62 | 2455 | else |
a0d0e21e LW |
2456 | case "$cppstdin" in |
2457 | '') ;; | |
2458 | *) | |
2459 | echo "Good old $cppstdin $cppminus does not seem to be of any help..." | |
2460 | ;; | |
2461 | esac | |
2304df62 | 2462 | fi |
2304df62 | 2463 | |
a0d0e21e LW |
2464 | if $ok; then |
2465 | : nothing | |
2466 | elif echo 'Maybe "'"$cc"' -E" will work...'; \ | |
2467 | $cc -E <testcpp.c >testcpp.out 2>&1; \ | |
2468 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
2469 | echo "Yup, it does." | |
2470 | x_cpp="$cc -E" | |
2471 | x_minus=''; | |
2472 | elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \ | |
2473 | $cc -E - <testcpp.c >testcpp.out 2>&1; \ | |
2474 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
2475 | echo "Yup, it does." | |
2476 | x_cpp="$cc -E" | |
2477 | x_minus='-'; | |
2478 | elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \ | |
2479 | $cc -P <testcpp.c >testcpp.out 2>&1; \ | |
2480 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
2481 | echo "Yipee, that works!" | |
2482 | x_cpp="$cc -P" | |
2483 | x_minus=''; | |
2484 | elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \ | |
2485 | $cc -P - <testcpp.c >testcpp.out 2>&1; \ | |
2486 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
2487 | echo "At long last!" | |
2488 | x_cpp="$cc -P" | |
2489 | x_minus='-'; | |
2490 | elif echo 'No such luck, maybe "'$cpp'" will work...'; \ | |
2491 | $cpp <testcpp.c >testcpp.out 2>&1; \ | |
2492 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
2493 | echo "It works!" | |
2494 | x_cpp="$cpp" | |
2495 | x_minus=''; | |
2496 | elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \ | |
2497 | $cpp - <testcpp.c >testcpp.out 2>&1; \ | |
2498 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
2499 | echo "Hooray, it works! I was beginning to wonder." | |
2500 | x_cpp="$cpp" | |
2501 | x_minus='-'; | |
2502 | elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \ | |
2503 | $wrapper <testcpp.c >testcpp.out 2>&1; \ | |
2504 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
2505 | x_cpp="$wrapper" | |
2506 | x_minus='' | |
2507 | echo "Eureka!" | |
2508 | else | |
2509 | dflt='' | |
2510 | rp="No dice. I can't find a C preprocessor. Name one:" | |
2511 | . ./myread | |
2512 | x_cpp="$ans" | |
2513 | x_minus='' | |
2514 | $x_cpp <testcpp.c >testcpp.out 2>&1 | |
2515 | if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
2516 | echo "OK, that will do." >&4 | |
2517 | else | |
2518 | echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4 | |
2519 | exit 1 | |
2520 | fi | |
2521 | fi | |
2522 | ||
2523 | case "$ok" in | |
2524 | false) | |
2525 | cppstdin="$x_cpp" | |
2526 | cppminus="$x_minus" | |
2527 | cpprun="$x_cpp" | |
2528 | cpplast="$x_minus" | |
2529 | set X $x_cpp | |
2530 | shift | |
2531 | case "$1" in | |
2532 | "$cpp") | |
2533 | echo "Perhaps can we force $cc -E using a wrapper..." | |
2534 | if $wrapper <testcpp.c >testcpp.out 2>&1; \ | |
2535 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 | |
2536 | then | |
2537 | echo "Yup, we can." | |
2538 | cppstdin="$wrapper" | |
2539 | cppminus=''; | |
2540 | else | |
2541 | echo "Nope, we'll have to live without it..." | |
2542 | fi | |
2543 | ;; | |
2544 | esac | |
2545 | case "$cpprun" in | |
2546 | "$wrapper") | |
2547 | cpprun='' | |
2548 | cpplast='' | |
2549 | ;; | |
2550 | esac | |
2551 | ;; | |
2552 | esac | |
2553 | ||
2554 | case "$cppstdin" in | |
2555 | "$wrapper") ;; | |
2556 | *) $rm -f $wrapper;; | |
2557 | esac | |
2558 | $rm -f testcpp.c testcpp.out | |
2559 | ||
2560 | : determine optimize, if desired, or use for debug flag also | |
2561 | case "$optimize" in | |
2562 | ' ') dflt='none';; | |
2563 | '') dflt='-O';; | |
2564 | *) dflt="$optimize";; | |
2565 | esac | |
2566 | $cat <<EOH | |
2567 | ||
2568 | Some C compilers have problems with their optimizers, by default, $package | |
2569 | compiles with the -O flag to use the optimizer. Alternately, you might want | |
2570 | to use the symbolic debugger, which uses the -g flag (on traditional Unix | |
2571 | systems). Either flag can be specified here. To use neither flag, specify | |
2572 | the word "none". | |
2573 | ||
2574 | EOH | |
2575 | rp="What optimizer/debugger flag should be used?" | |
2576 | . ./myread | |
2577 | optimize="$ans" | |
2578 | case "$optimize" in | |
2579 | 'none') optimize=" ";; | |
2580 | esac | |
2581 | ||
2582 | dflt='' | |
2583 | case "$ccflags" in | |
2584 | '') | |
2585 | case "$gccversion" in | |
2586 | 1*) dflt='-fpcc-struct-return' ;; | |
2587 | esac | |
2588 | case "$optimize" in | |
2589 | *-g*) dflt="$dflt -DDEBUGGING";; | |
2590 | esac | |
2591 | case "$gccversion" in | |
2592 | 2*) if test -d /etc/conf/kconfig.d && | |
2593 | $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1 | |
2594 | then | |
2595 | dflt="$dflt -posix" | |
2596 | fi | |
2597 | ;; | |
2598 | esac | |
2599 | ;; | |
2600 | esac | |
2601 | ||
2602 | case "$mips_type" in | |
2603 | *BSD*) ;; | |
2604 | '') ;; | |
2605 | *) inclwanted="$inclwanted $usrinc/bsd";; | |
2606 | esac | |
2607 | for thisincl in $inclwanted; do | |
2608 | if $test -d $thisincl; then | |
2609 | if $test x$thisincl != x$usrinc; then | |
2610 | case "$dflt" in | |
2611 | *$thisincl*);; | |
2612 | *) dflt="$dflt -I$thisincl";; | |
2613 | esac | |
2614 | fi | |
2615 | fi | |
2616 | done | |
2617 | ||
2618 | inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then | |
2619 | xxx=true; | |
2620 | elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then | |
2621 | xxx=true; | |
2622 | else | |
2623 | xxx=false; | |
2624 | fi; | |
2625 | if $xxx; then | |
2626 | case "$dflt" in | |
2627 | *$2*);; | |
2628 | *) dflt="$dflt -D$2";; | |
2629 | esac; | |
2630 | fi' | |
2631 | ||
2632 | if ./osf1; then | |
2633 | set signal.h __LANGUAGE_C__; eval $inctest | |
2634 | else | |
2635 | set signal.h LANGUAGE_C; eval $inctest | |
2636 | fi | |
2637 | set signal.h NO_PROTOTYPE; eval $inctest | |
2638 | set signal.h _NO_PROTO; eval $inctest | |
2639 | ||
2640 | case "$dflt" in | |
2641 | '') dflt=none;; | |
2304df62 | 2642 | esac |
85e6fe83 LW |
2643 | case "$ccflags" in |
2644 | '') ;; | |
2645 | *) dflt="$ccflags";; | |
2646 | esac | |
2304df62 AD |
2647 | $cat <<EOH |
2648 | ||
2649 | Your C compiler may want other flags. For this question you should include | |
2650 | -I/whatever and -DWHATEVER flags and any other flags used by the C compiler, | |
2651 | but you should NOT include libraries or ld flags like -lwhatever. If you | |
2652 | want $package to honor its debug switch, you should include -DDEBUGGING here. | |
a0d0e21e LW |
2653 | Your C compiler might also need additional flags, such as -D_POSIX_SOURCE, |
2654 | -DHIDEMYMALLOC or -DCRIPPLED_CC. | |
2655 | ||
2304df62 AD |
2656 | To use no flags, specify the word "none". |
2657 | ||
2304df62 AD |
2658 | EOH |
2659 | set X $dflt | |
2660 | shift | |
2661 | dflt=${1+"$@"} | |
2662 | rp="Any additional cc flags?" | |
2663 | . ./myread | |
2664 | case "$ans" in | |
2665 | none) ccflags='';; | |
2666 | *) ccflags="$ans";; | |
2667 | esac | |
2668 | ||
2669 | : the following weeds options from ccflags that are of no interest to cpp | |
2670 | cppflags="$ccflags" | |
a0d0e21e LW |
2671 | case "$gccversion" in |
2672 | 1*) cppflags="$cppflags -D__GNUC__" | |
2304df62 AD |
2673 | esac |
2674 | case "$mips_type" in | |
2675 | '');; | |
2676 | *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";; | |
2677 | esac | |
2678 | case "$cppflags" in | |
2679 | '');; | |
a0d0e21e LW |
2680 | *) |
2681 | echo " " | |
2682 | echo "Let me guess what the preprocessor flags are..." >&4 | |
2683 | set X $cppflags | |
2684 | shift | |
2304df62 | 2685 | cppflags='' |
a0d0e21e LW |
2686 | $cat >cpp.c <<'EOM' |
2687 | #define BLURFL foo | |
2688 | ||
2689 | BLURFL xx LFRULB | |
2690 | EOM | |
2691 | previous='' | |
2692 | for flag in $* | |
2304df62 | 2693 | do |
a0d0e21e LW |
2694 | case "$flag" in |
2695 | -*) ftry="$flag";; | |
2696 | *) ftry="$previous $flag";; | |
2304df62 | 2697 | esac |
a0d0e21e LW |
2698 | if $cppstdin -DLFRULB=bar $ftry $cppminus <cpp.c \ |
2699 | >cpp1.out 2>/dev/null && \ | |
2700 | $cpprun -DLFRULB=bar $ftry $cpplast <cpp.c \ | |
2701 | >cpp2.out 2>/dev/null && \ | |
2702 | $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \ | |
2703 | $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1 | |
2704 | then | |
2705 | cppflags="$cppflags $ftry" | |
2706 | previous='' | |
2707 | else | |
2708 | previous="$flag" | |
2709 | fi | |
2304df62 | 2710 | done |
a0d0e21e LW |
2711 | set X $cppflags |
2712 | shift | |
2713 | cppflags=${1+"$@"} | |
2304df62 | 2714 | case "$cppflags" in |
a0d0e21e | 2715 | *-*) echo "They appear to be: $cppflags";; |
2304df62 | 2716 | esac |
a0d0e21e | 2717 | $rm -f cpp.c cpp?.out |
2304df62 AD |
2718 | ;; |
2719 | esac | |
2720 | ||
2721 | : flags used in final linking phase | |
2722 | case "$ldflags" in | |
ecfc5424 | 2723 | '') if ./venix; then |
2304df62 AD |
2724 | dflt='-i -z' |
2725 | else | |
a0d0e21e | 2726 | dflt='' |
2304df62 | 2727 | fi |
a0d0e21e LW |
2728 | case "$ccflags" in |
2729 | *-posix*) dflt="$dflt -posix" ;; | |
2730 | esac | |
2731 | case "$dflt" in | |
2732 | '') dflt='none' ;; | |
2733 | esac | |
2304df62 AD |
2734 | ;; |
2735 | *) dflt="$ldflags";; | |
2736 | esac | |
2737 | echo " " | |
2738 | rp="Any additional ld flags (NOT including libraries)?" | |
2739 | . ./myread | |
2740 | case "$ans" in | |
2741 | none) ldflags='';; | |
2742 | *) ldflags="$ans";; | |
2743 | esac | |
2744 | rmlist="$rmlist pdp11" | |
2745 | ||
2304df62 AD |
2746 | : Set private lib path |
2747 | case "$plibpth" in | |
ecfc5424 | 2748 | '') if ./mips; then |
2304df62 AD |
2749 | plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib" |
2750 | fi;; | |
2751 | esac | |
a0d0e21e LW |
2752 | case "$libpth" in |
2753 | ' ') dlist='';; | |
2754 | '') dlist="$plibpth $glibpth";; | |
2755 | *) dlist="$libpth";; | |
2756 | esac | |
2757 | ||
2758 | : Now check and see which directories actually exist, avoiding duplicates | |
2759 | libpth='' | |
2760 | for xxx in $dlist | |
2304df62 | 2761 | do |
a0d0e21e LW |
2762 | if $test -d $xxx; then |
2763 | case " $libpth " in | |
2764 | *" $xxx "*) ;; | |
2765 | *) libpth="$libpth $xxx";; | |
2766 | esac | |
2304df62 AD |
2767 | fi |
2768 | done | |
a0d0e21e | 2769 | $cat <<'EOM' |
2304df62 | 2770 | |
a0d0e21e LW |
2771 | Some systems have incompatible or broken versions of libraries. Among |
2772 | the directories listed in the question below, please remove any you | |
2773 | know not to be holding relevant libraries, and add any that are needed. | |
2774 | Say "none" for none. | |
2775 | ||
2776 | EOM | |
2777 | case "$libpth" in | |
2778 | '') dflt='none';; | |
2779 | *) | |
2780 | set X $libpth | |
2781 | shift | |
2782 | dflt=${1+"$@"} | |
2783 | ;; | |
2784 | esac | |
2304df62 AD |
2785 | rp="Directories to use for library searches?" |
2786 | . ./myread | |
2787 | case "$ans" in | |
2788 | none) libpth=' ';; | |
2789 | *) libpth="$ans";; | |
2790 | esac | |
a0d0e21e LW |
2791 | |
2792 | : compute shared library extension | |
2793 | case "$so" in | |
2794 | '') | |
2795 | if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then | |
2796 | dflt='sl' | |
2797 | else | |
2798 | dflt='so' | |
2799 | fi | |
2800 | ;; | |
2801 | *) dflt="$so";; | |
2802 | esac | |
ecfc5424 | 2803 | $cat <<EOM |
a0d0e21e LW |
2804 | |
2805 | On some systems, shared libraries may be available. Answer 'none' if | |
ecfc5424 AD |
2806 | you want to suppress searching of shared libraries for the remaining |
2807 | of this configuration. | |
2808 | ||
a0d0e21e LW |
2809 | EOM |
2810 | rp='What is the file extension used for shared libraries?' | |
2811 | . ./myread | |
2812 | so="$ans" | |
2813 | ||
2304df62 AD |
2814 | : Looking for optional libraries |
2815 | echo " " | |
2816 | echo "Checking for optional libraries..." >&4 | |
2817 | case "$libs" in | |
2818 | ' '|'') dflt='';; | |
2819 | *) dflt="$libs";; | |
2820 | esac | |
2821 | case "$libswanted" in | |
2822 | '') libswanted='c_s';; | |
2823 | esac | |
2824 | for thislib in $libswanted; do | |
a0d0e21e LW |
2825 | |
2826 | if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`; $test -f "$xxx"; then | |
2827 | echo "Found -l$thislib (shared)." | |
2828 | case " $dflt " in | |
2829 | *"-l$thislib "*);; | |
2830 | *) dflt="$dflt -l$thislib";; | |
2831 | esac | |
2832 | elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then | |
2833 | echo "Found -l$thislib (shared)." | |
2834 | case " $dflt " in | |
2835 | *"-l$thislib "*);; | |
2836 | *) dflt="$dflt -l$thislib";; | |
2837 | esac | |
2838 | elif xxx=`./loc lib$thislib.a X $libpth`; $test -f "$xxx"; then | |
2304df62 | 2839 | echo "Found -l$thislib." |
a0d0e21e LW |
2840 | case " $dflt " in |
2841 | *"-l$thislib "*);; | |
2304df62 AD |
2842 | *) dflt="$dflt -l$thislib";; |
2843 | esac | |
a0d0e21e LW |
2844 | elif xxx=`./loc lib${thislib}_s.a X $libpth`; $test -f "$xxx"; then |
2845 | echo "Found -l${thislib}_s." | |
2846 | case " $dflt " in | |
2847 | *"-l$thislib "*);; | |
2848 | *) dflt="$dflt -l${thislib}_s";; | |
2304df62 | 2849 | esac |
a0d0e21e LW |
2850 | elif xxx=`./loc Slib$thislib.a X $xlibpth`; $test -f "$xxx"; then |
2851 | echo "Found -l$thislib." | |
2852 | case " $dflt " in | |
2853 | *"-l$thislib "*);; | |
2304df62 AD |
2854 | *) dflt="$dflt -l$thislib";; |
2855 | esac | |
2856 | else | |
a0d0e21e | 2857 | echo "No -l$thislib." |
2304df62 AD |
2858 | fi |
2859 | done | |
2860 | set X $dflt | |
2861 | shift | |
2862 | dflt="$*" | |
2863 | case "$libs" in | |
2864 | '') dflt="$dflt";; | |
2865 | *) dflt="$libs";; | |
2866 | esac | |
2867 | case "$dflt" in | |
2868 | ' '|'') dflt='none';; | |
2869 | esac | |
2870 | ||
2871 | $cat <<EOM | |
2872 | ||
2873 | Some versions of Unix support shared libraries, which make executables smaller | |
2874 | but make load time slightly longer. | |
2875 | ||
2876 | On some systems, mostly newer Unix System V's, the shared library is included | |
2877 | by putting the option "-lc_s" as the last thing on the cc command line when | |
2878 | linking. Other systems use shared libraries by default. There may be other | |
2879 | libraries needed to compile $package on your machine as well. If your system | |
2880 | needs the "-lc_s" option, include it here. Include any other special libraries | |
2881 | here as well. Say "none" for none. | |
2882 | EOM | |
2883 | ||
2884 | echo " " | |
2885 | rp="Any additional libraries?" | |
2886 | . ./myread | |
2887 | case "$ans" in | |
2888 | none) libs=' ';; | |
2889 | *) libs="$ans";; | |
2890 | esac | |
2891 | ||
2892 | : see if nm is to be used to determine whether a symbol is defined or not | |
2893 | case "$usenm" in | |
2894 | '') | |
2895 | dflt=`egrep 'inlibc|csym' ../Configure | wc -l 2>/dev/null` | |
2896 | if $test $dflt -gt 20; then | |
2897 | dflt=y | |
2898 | else | |
2899 | dflt=n | |
2900 | fi | |
2901 | ;; | |
2902 | *) | |
2903 | case "$usenm" in | |
2904 | true) dflt=y;; | |
2905 | *) dflt=n;; | |
2906 | esac | |
2907 | ;; | |
2908 | esac | |
2909 | $cat <<EOM | |
2910 | ||
2911 | I can use 'nm' to extract the symbols from your C libraries. This is a time | |
2912 | consuming task which may generate huge output on the disk (up to 3 megabytes) | |
2913 | but that should make the symbols extraction faster. The alternative is to skip | |
2914 | the 'nm' extraction part and to compile a small test program instead to | |
2915 | determine whether each symbol is present. If you have a fast C compiler and/or | |
2916 | if your 'nm' output cannot be parsed, this may be the best solution. | |
2917 | ||
2918 | EOM | |
2919 | rp='Shall I use nm to extract C symbols from the libraries?' | |
2920 | . ./myread | |
2921 | case "$ans" in | |
2922 | n|N) usenm=false;; | |
2923 | *) usenm=true;; | |
2924 | esac | |
2925 | ||
2926 | runnm=$usenm | |
2927 | case "$reuseval" in | |
2928 | true) runnm=false;; | |
2929 | esac | |
2930 | ||
2931 | : nm options which may be necessary | |
2932 | case "$nm_opt" in | |
2933 | '') if $test -f /mach_boot; then | |
2934 | nm_opt='' | |
2935 | elif $test -d /usr/ccs/lib; then | |
2936 | nm_opt='-p' | |
2937 | elif $test -f /dgux; then | |
2938 | nm_opt='-p' | |
2939 | else | |
2940 | nm_opt='' | |
2941 | fi;; | |
2942 | esac | |
2943 | ||
2944 | case "$runnm" in | |
2945 | true) | |
2946 | : get list of predefined functions in a handy place | |
2947 | echo " " | |
2948 | case "$libc" in | |
2949 | '') libc=unknown | |
2950 | case "$libs" in | |
2951 | *-lc_s*) libc=`./loc libc_s.a $libc $libpth` | |
2952 | esac | |
2953 | ;; | |
2954 | esac | |
2304df62 AD |
2955 | libnames=''; |
2956 | case "$libs" in | |
2957 | '') ;; | |
2958 | *) for thislib in $libs; do | |
2959 | case "$thislib" in | |
a0d0e21e LW |
2960 | -lc|-lc_s) |
2961 | : Handle C library specially below. | |
2962 | ;; | |
2304df62 | 2963 | -l*) |
ecfc5424 | 2964 | thislib=`echo $thislib | $sed -e 's/^-l//'` |
a0d0e21e LW |
2965 | if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then |
2966 | : | |
2967 | elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then | |
2968 | : | |
2969 | elif try=`./loc lib$thislib.a X $libpth`; $test -f "$try"; then | |
2970 | : | |
2971 | elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then | |
2972 | : | |
2973 | elif try=`./loc $thislib X $libpth`; $test -f "$try"; then | |
2974 | : | |
2975 | elif try=`./loc Slib$thislib.a X $xlibpth`; $test -f "$try"; then | |
2976 | : | |
2977 | else | |
2978 | try='' | |
2304df62 AD |
2979 | fi |
2980 | libnames="$libnames $try" | |
2981 | ;; | |
2982 | *) libnames="$libnames $thislib" ;; | |
2983 | esac | |
2984 | done | |
2985 | ;; | |
2986 | esac | |
2987 | xxx=normal | |
2988 | case "$libc" in | |
2989 | unknown) | |
a0d0e21e LW |
2990 | set /usr/ccs/lib/libc.$so |
2991 | $test -r $1 || set /usr/lib/libc.$so | |
2992 | $test -r $1 || set /usr/shlib/libc.$so | |
2993 | $test -r $1 || set /usr/lib/libc.$so.[0-9]* | |
2994 | $test -r $1 || set /lib/libc.$so | |
2304df62 AD |
2995 | $test -r $1 || set /lib/libsys_s.a |
2996 | eval set \$$# | |
2997 | ;; | |
2998 | *) | |
2999 | set blurfl | |
3000 | ;; | |
3001 | esac | |
3002 | if $test -r "$1"; then | |
3003 | echo "Your (shared) C library seems to be in $1." | |
3004 | libc="$1" | |
3005 | elif $test -r /lib/libc && $test -r /lib/clib; then | |
3006 | echo "Your C library seems to be in both /lib/clib and /lib/libc." | |
3007 | xxx=apollo | |
3008 | libc='/lib/clib /lib/libc' | |
3009 | if $test -r /lib/syslib; then | |
3010 | echo "(Your math library is in /lib/syslib.)" | |
3011 | libc="$libc /lib/syslib" | |
3012 | fi | |
3013 | elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then | |
3014 | echo "Your C library seems to be in $libc, as you said before." | |
3015 | elif $test -r $incpath/usr/lib/libc.a; then | |
3016 | libc=$incpath/usr/lib/libc.a; | |
3017 | echo "Your C library seems to be in $libc. That's fine." | |
3018 | elif $test -r /lib/libc.a; then | |
3019 | libc=/lib/libc.a; | |
3020 | echo "Your C library seems to be in $libc. You're normal." | |
3021 | else | |
3022 | if tans=`./loc libc.a blurfl/dyick $libpth`; $test -r "$tans"; then | |
3023 | : | |
3024 | elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then | |
3025 | libnames="$libnames "`./loc clib blurfl/dyick $libpth` | |
3026 | elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then | |
3027 | : | |
3028 | elif tans=`./loc Slibc.a blurfl/dyick $xlibpth`; $test -r "$tans"; then | |
3029 | : | |
3030 | elif tans=`./loc Mlibc.a blurfl/dyick $xlibpth`; $test -r "$tans"; then | |
3031 | : | |
3032 | else | |
3033 | tans=`./loc Llibc.a blurfl/dyick $xlibpth` | |
3034 | fi | |
3035 | if $test -r "$tans"; then | |
3036 | echo "Your C library seems to be in $tans, of all places." | |
3037 | libc=$tans | |
3038 | else | |
3039 | libc='blurfl' | |
3040 | fi | |
3041 | fi | |
3042 | if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then | |
3043 | dflt="$libc" | |
3044 | cat <<EOM | |
3045 | ||
3046 | If the guess above is wrong (which it might be if you're using a strange | |
3047 | compiler, or your machine supports multiple models), you can override it here. | |
3048 | ||
3049 | EOM | |
3050 | else | |
3051 | dflt='' | |
3052 | echo $libpth | tr ' ' '\012' | sort | uniq > libpath | |
3053 | cat >&4 <<EOM | |
3054 | I can't seem to find your C library. I've looked in the following places: | |
3055 | ||
3056 | EOM | |
3057 | $sed 's/^/ /' libpath | |
3058 | cat <<EOM | |
3059 | ||
3060 | None of these seems to contain your C library. I need to get its name... | |
3061 | ||
3062 | EOM | |
3063 | fi | |
3064 | fn=f | |
3065 | rp='Where is your C library?' | |
3066 | . ./getfile | |
3067 | libc="$ans" | |
3068 | ||
3069 | echo " " | |
3070 | echo $libc $libnames | tr ' ' '\012' | sort | uniq > libnames | |
3071 | set X `cat libnames` | |
3072 | shift | |
3073 | xxx=files | |
3074 | case $# in 1) xxx=file; esac | |
3075 | echo "Extracting names from the following $xxx for later perusal:" >&4 | |
3076 | echo " " | |
3077 | $sed 's/^/ /' libnames >&4 | |
3078 | echo " " | |
3079 | $echo $n "This may take a while...$c" >&4 | |
ecfc5424 | 3080 | |
2304df62 AD |
3081 | nm $nm_opt $* 2>/dev/null >libc.tmp |
3082 | $echo $n ".$c" | |
3083 | $grep fprintf libc.tmp > libc.ptf | |
3084 | xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4' | |
3085 | xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4' | |
a0d0e21e | 3086 | if com="$sed -n -e 's/^.* [ADTSI] *_[_.]*//p' -e 's/^.* [ADTSI] //p'";\ |
2304df62 AD |
3087 | eval $xscan;\ |
3088 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
3089 | eval $xrun | |
3090 | elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\ | |
3091 | eval $xscan;\ | |
3092 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
3093 | eval $xrun | |
3094 | elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\ | |
3095 | eval $xscan;\ | |
3096 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
3097 | eval $xrun | |
3098 | elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\ | |
3099 | eval $xscan;\ | |
3100 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
3101 | eval $xrun | |
3102 | elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\ | |
3103 | eval $xscan;\ | |
3104 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
3105 | eval $xrun | |
3106 | elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\ | |
3107 | eval $xscan;\ | |
3108 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
3109 | eval $xrun | |
3110 | elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \ | |
3111 | -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\ | |
3112 | eval $xscan;\ | |
3113 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
3114 | eval $xrun | |
3115 | elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\ | |
3116 | eval $xscan;\ | |
3117 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
3118 | eval $xrun | |
3119 | elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\ | |
3120 | eval $xscan;\ | |
3121 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
3122 | eval $xrun | |
a0d0e21e LW |
3123 | elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\ |
3124 | eval $xscan;\ | |
3125 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
3126 | eval $xrun | |
2304df62 AD |
3127 | else |
3128 | nm -p $* 2>/dev/null >libc.tmp | |
3129 | com="$sed -n -e 's/^.* [ADTS] *_[_.]*//p' -e 's/^.* [ADTS] //p'";\ | |
3130 | eval "<libc.tmp $com >libc.list" | |
3131 | if $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
3132 | nm_opt='-p' | |
3133 | echo "done" >&4 | |
3134 | else | |
3135 | echo " " | |
3136 | echo "nm didn't seem to work right. Trying ar instead..." >&4 | |
3137 | com='' | |
3138 | if ar t $libc > libc.tmp; then | |
3139 | for thisname in $libnames; do | |
3140 | ar t $thisname >>libc.tmp | |
3141 | done | |
3142 | $sed -e 's/\.o$//' < libc.tmp > libc.list | |
3143 | echo "Ok." >&4 | |
3144 | else | |
3145 | echo "ar didn't seem to work right." >&4 | |
3146 | echo "Maybe this is a Cray...trying bld instead..." >&4 | |
3147 | if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then | |
3148 | for thisname in $libnames; do | |
3149 | bld t $libnames | \ | |
3150 | $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list | |
3151 | ar t $thisname >>libc.tmp | |
3152 | done | |
3153 | echo "Ok." >&4 | |
3154 | else | |
3155 | echo "That didn't work either. Giving up." >&4 | |
3156 | exit 1 | |
3157 | fi | |
3158 | fi | |
3159 | fi | |
3160 | fi | |
3161 | nm_extract="$com" | |
3162 | if $test -f /lib/syscalls.exp; then | |
3163 | echo " " | |
3164 | echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4 | |
3165 | $sed -n 's/^\([^ ]*\)[ ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list | |
3166 | fi | |
3167 | ;; | |
3168 | esac | |
3169 | $rm -f libnames libpath | |
3170 | ||
3171 | : is a C symbol defined? | |
3172 | csym='tlook=$1; | |
3173 | case "$3" in | |
3174 | -v) tf=libc.tmp; tc=""; tdc="";; | |
3175 | -a) tf=libc.tmp; tc="[0]"; tdc=[];; | |
3176 | *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";; | |
3177 | esac; | |
3178 | tx=yes; | |
3179 | case "$reuseval-$4" in | |
3180 | true-) ;; | |
3181 | true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;; | |
3182 | esac; | |
3183 | case "$tx" in | |
3184 | yes) | |
3185 | case "$runnm" in | |
3186 | true) | |
3187 | if $contains $tlook $tf >/dev/null 2>&1; | |
3188 | then tval=true; | |
3189 | else tval=false; | |
3190 | fi;; | |
3191 | *) | |
3192 | echo "main() { extern int $1$tdc; printf(\"%d\", $1$tc); }" > t.c; | |
3193 | if $cc $ccflags -o t t.c $ldflags $libs >/dev/null 2>&1; | |
3194 | then tval=true; | |
3195 | else tval=false; | |
3196 | fi; | |
3197 | $rm -f t t.c;; | |
3198 | esac;; | |
3199 | *) | |
3200 | case "$tval" in | |
3201 | $define) tval=true;; | |
3202 | *) tval=false;; | |
3203 | esac;; | |
3204 | esac; | |
3205 | eval "$2=$tval"' | |
3206 | ||
3207 | : set up the script used to warn in case of inconsistency | |
3208 | cat <<'EOSC' >whoa | |
3209 | dflt=y | |
3210 | echo " " | |
3211 | echo "*** WHOA THERE!!! ***" >&4 | |
3212 | echo " The $hint value for \$$var on this machine was \"$was\"!" >&4 | |
3213 | rp=" Keep the $hint value?" | |
3214 | . ./myread | |
3215 | case "$ans" in | |
3216 | y) td=$was; tu=$was;; | |
3217 | esac | |
3218 | EOSC | |
3219 | ||
3220 | : define an is-in-libc? function | |
3221 | inlibc='echo " "; td=$define; tu=$undef; | |
3222 | sym=$1; var=$2; eval "was=\$$2"; | |
3223 | tx=yes; | |
3224 | case "$reuseval$was" in | |
3225 | true) ;; | |
3226 | true*) tx=no;; | |
3227 | esac; | |
3228 | case "$tx" in | |
3229 | yes) | |
3230 | set $sym tres -f; | |
3231 | eval $csym; | |
3232 | case "$tres" in | |
3233 | true) | |
3234 | echo "$sym() found." >&4; | |
ecfc5424 | 3235 | case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";; |
2304df62 AD |
3236 | *) |
3237 | echo "$sym() NOT found." >&4; | |
ecfc5424 | 3238 | case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";; |
2304df62 AD |
3239 | esac;; |
3240 | *) | |
3241 | case "$was" in | |
3242 | $define) echo "$sym() found." >&4;; | |
3243 | *) echo "$sym() NOT found." >&4;; | |
3244 | esac;; | |
3245 | esac' | |
3246 | ||
a0d0e21e LW |
3247 | : see if gconvert exists |
3248 | set gconvert d_gconvert | |
3249 | eval $inlibc | |
2304df62 | 3250 | |
a0d0e21e LW |
3251 | case "$d_gconvert" in |
3252 | $define) | |
ecfc5424 | 3253 | echo "We'll use it to convert floats into a string then." >&4 |
a0d0e21e LW |
3254 | d_Gconvert="gconvert((x),(n),(t),(b))" |
3255 | ;; | |
3256 | *) | |
3257 | : Maybe we can emulate it with gcvt. | |
3258 | set gcvt d_gcvt | |
3259 | eval $inlibc | |
2304df62 | 3260 | |
a0d0e21e LW |
3261 | case "$d_gcvt" in |
3262 | $define) | |
3263 | : Test whether gcvt drops a trailing decimal point | |
ecfc5424 | 3264 | $cat >try.c <<'EOP' |
a0d0e21e | 3265 | main() { |
ecfc5424 AD |
3266 | char buf[64]; |
3267 | gcvt(1.0, 8, buf); | |
3268 | if (buf[0] != '1' || buf[1] != '\0') | |
3269 | exit(1); | |
3270 | gcvt(0.0, 8, buf); | |
3271 | if (buf[0] != '0' || buf[1] != '\0') | |
3272 | exit(1); | |
3273 | gcvt(-1.0, 8, buf); | |
3274 | if (buf[0] != '-' || buf[1] != '1' || buf[2] != '\0') | |
3275 | exit(1); | |
3276 | exit(0); | |
a0d0e21e LW |
3277 | } |
3278 | EOP | |
3279 | if $cc $ccflags $ldflags -o try try.c $libs > /dev/null 2>&1; then | |
3280 | if ./try; then | |
3281 | echo "Good, your gcvt() drops a trailing decimal point." | |
ecfc5424 | 3282 | echo "We'll use it to convert floats into a string." >&4 |
a0d0e21e LW |
3283 | d_Gconvert="gcvt((x),(n),(b))" |
3284 | else | |
3285 | echo "But your gcvt() keeps a trailing decimal point". | |
3286 | d_Gconvert='' | |
3287 | fi | |
2304df62 | 3288 | else |
a0d0e21e LW |
3289 | echo "Hmm. I can't compile the gcvt test program." |
3290 | d_Gconvert='' | |
2304df62 | 3291 | fi |
a0d0e21e | 3292 | $rm -f try.c try |
2304df62 AD |
3293 | ;; |
3294 | esac | |
a0d0e21e LW |
3295 | case "$d_Gconvert" in |
3296 | '') | |
ecfc5424 | 3297 | echo "I'll use sprintf instead to convert floats into a string." >&4 |
a0d0e21e | 3298 | d_Gconvert='sprintf((b),"%.*g",(n),(x))' |
2304df62 AD |
3299 | ;; |
3300 | esac | |
2304df62 AD |
3301 | esac |
3302 | ||
a0d0e21e LW |
3303 | : Initialize h_fcntl |
3304 | h_fcntl=false | |
3305 | ||
3306 | : Initialize h_sysfile | |
3307 | h_sysfile=false | |
2304df62 AD |
3308 | |
3309 | : determine filename position in cpp output | |
3310 | echo " " | |
3311 | echo "Computing filename position in cpp output for #include directives..." >&4 | |
3312 | echo '#include <stdio.h>' > foo.c | |
3313 | $cat >fieldn <<EOF | |
3314 | $startsh | |
a0d0e21e | 3315 | $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \ |
2304df62 AD |
3316 | $grep '^[ ]*#.*stdio\.h' | \ |
3317 | while read cline; do | |
3318 | pos=1 | |
3319 | set \$cline | |
3320 | while $test \$# -gt 0; do | |
3321 | if $test -r \`echo \$1 | $tr -d '"'\`; then | |
3322 | echo "\$pos" | |
3323 | exit 0 | |
3324 | fi | |
3325 | shift | |
3326 | pos=\`expr \$pos + 1\` | |
3327 | done | |
3328 | done | |
3329 | EOF | |
3330 | chmod +x fieldn | |
3331 | fieldn=`./fieldn` | |
3332 | $rm -f foo.c fieldn | |
3333 | case $fieldn in | |
3334 | '') pos='???';; | |
3335 | 1) pos=first;; | |
3336 | 2) pos=second;; | |
3337 | 3) pos=third;; | |
3338 | *) pos="${fieldn}th";; | |
3339 | esac | |
3340 | echo "Your cpp writes the filename in the $pos field of the line." | |
3341 | ||
3342 | : locate header file | |
3343 | $cat >findhdr <<EOF | |
3344 | $startsh | |
3345 | wanted=\$1 | |
3346 | name='' | |
3347 | if test -f $usrinc/\$wanted; then | |
3348 | echo "$usrinc/\$wanted" | |
3349 | exit 0 | |
3350 | fi | |
3351 | awkprg='{ print \$$fieldn }' | |
3352 | echo "#include <\$wanted>" > foo\$\$.c | |
3353 | $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \ | |
3354 | $grep "^[ ]*#.*\$wanted" | \ | |
3355 | while read cline; do | |
3356 | name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\` | |
3357 | case "\$name" in | |
3358 | */\$wanted) echo "\$name"; exit 0;; | |
3359 | *) name='';; | |
3360 | esac; | |
3361 | done; | |
3362 | $rm -f foo\$\$.c; | |
3363 | case "\$name" in | |
3364 | '') exit 1;; | |
3365 | esac | |
3366 | EOF | |
3367 | chmod +x findhdr | |
3368 | ||
3369 | : access call always available on UNIX | |
3370 | set access d_access | |
3371 | eval $inlibc | |
3372 | ||
3373 | : locate the flags for 'access()' | |
3374 | case "$d_access" in | |
3375 | "$define") | |
3376 | echo " " | |
3377 | $cat >access.c <<'EOCP' | |
3378 | #include <sys/types.h> | |
3379 | #ifdef I_FCNTL | |
3380 | #include <fcntl.h> | |
3381 | #endif | |
3382 | #ifdef I_SYS_FILE | |
3383 | #include <sys/file.h> | |
3384 | #endif | |
3385 | #ifdef I_UNISTD | |
3386 | #include <unistd.h> | |
3387 | #endif | |
3388 | main() { | |
3389 | exit(R_OK); | |
3390 | } | |
3391 | EOCP | |
3392 | : check sys/file.h first, no particular reason here | |
3393 | if $test `./findhdr sys/file.h` && \ | |
3394 | $cc $cppflags -DI_SYS_FILE access.c -o access >/dev/null 2>&1 ; then | |
3395 | h_sysfile=true; | |
3396 | echo "<sys/file.h> defines the *_OK access constants." >&4 | |
3397 | elif $test `./findhdr fcntl.h` && \ | |
3398 | $cc $cppflags -DI_FCNTL access.c -o access >/dev/null 2>&1 ; then | |
3399 | h_fcntl=true; | |
3400 | echo "<fcntl.h> defines the *_OK access constants." >&4 | |
85e6fe83 LW |
3401 | elif $test `./findhdr unistd.h` && \ |
3402 | $cc $cppflags -DI_UNISTD access.c -o access >/dev/null 2>&1 ; then | |
3403 | echo "<unistd.h> defines the *_OK access constants." >&4 | |
2304df62 AD |
3404 | else |
3405 | echo "I can't find the four *_OK access constants--I'll use mine." >&4 | |
3406 | fi | |
3407 | ;; | |
3408 | esac | |
3409 | $rm -f access* | |
3410 | ||
a0d0e21e LW |
3411 | : see if alarm exists |
3412 | set alarm d_alarm | |
2304df62 AD |
3413 | eval $inlibc |
3414 | ||
40000a8c AD |
3415 | : determine the architecture name |
3416 | echo " " | |
3417 | if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then | |
3418 | tarch=`arch`"-$osname" | |
3419 | elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then | |
3420 | if uname -m > tmparch 2>&1 ; then | |
3421 | tarch=`$cat tmparch`"-$osname" | |
3422 | else | |
3423 | tarch="$osname" | |
3424 | fi | |
3425 | $rm -f tmparch | |
3426 | else | |
3427 | tarch="$osname" | |
3428 | fi | |
3429 | case "$myarchname" in | |
3430 | ''|"$tarch") ;; | |
3431 | *) | |
3432 | echo "(Your architecture name used to be $myarchname.)" | |
3433 | archname='' | |
3434 | ;; | |
3435 | esac | |
3436 | case "$archname" in | |
3437 | '') dflt="$tarch";; | |
3438 | *) dflt="$archname";; | |
3439 | esac | |
3440 | rp='What is your architecture name' | |
3441 | . ./myread | |
3442 | archname="$ans" | |
3443 | myarchname="$tarch" | |
3444 | ||
a0d0e21e LW |
3445 | : is AFS running? |
3446 | echo " " | |
3447 | if test -d /afs; then | |
3448 | echo "AFS may be running... I'll be extra cautious then..." >&4 | |
3449 | afs=true | |
3450 | else | |
3451 | echo "AFS does not seem to be running..." >&4 | |
3452 | afs=false | |
3453 | fi | |
2304df62 | 3454 | |
a0d0e21e LW |
3455 | : determine root of directory hierarchy where package will be installed. |
3456 | case "$prefix" in | |
3457 | '') | |
3458 | dflt=`./loc . /usr/local /usr/local /local /opt /usr` | |
3459 | ;; | |
3460 | *) | |
3461 | dflt="$prefix" | |
3462 | ;; | |
3463 | esac | |
3464 | $cat <<EOM | |
2304df62 | 3465 | |
a0d0e21e LW |
3466 | By default, $package will be installed in $dflt/bin, manual |
3467 | pages under $dflt/man, etc..., i.e. with $dflt as prefix for | |
3468 | all installation directories. Typically set to /usr/local, but you | |
3469 | may choose /usr if you wish to install $package among your system | |
3470 | binaries. If you wish to have binaries under /bin but manual pages | |
3471 | under /usr/local/man, that's ok: you will be prompted separately | |
3472 | for each of the installation directories, the prefix being only used | |
1aef975c | 3473 | to set the defaults. |
a0d0e21e LW |
3474 | |
3475 | EOM | |
3476 | fn=d~ | |
3477 | rp='Installation prefix to use?' | |
3478 | . ./getfile | |
1aef975c AD |
3479 | oldprefix='' |
3480 | case "$prefix" in | |
3481 | '') ;; | |
3482 | *) | |
3483 | case "$ans" in | |
3484 | "$prefix") ;; | |
3485 | *) oldprefix="$prefix";; | |
3486 | esac | |
3487 | ;; | |
3488 | esac | |
a0d0e21e | 3489 | prefix="$ans" |
1aef975c AD |
3490 | prefixexp="$ansexp" |
3491 | ||
3492 | : set the prefixit variable, to compute a suitable default value | |
3493 | prefixit='case "$3" in | |
3494 | ""|none) | |
3495 | case "$oldprefix" in | |
3496 | "") eval "$1=\"\$$2\"";; | |
3497 | *) | |
3498 | case "$3" in | |
3499 | "") eval "$1=";; | |
3500 | none) | |
3501 | eval "tp=\"\$$2\""; | |
3502 | case "$tp" in | |
3503 | ""|" ") eval "$1=\"\$$2\"";; | |
3504 | *) eval "$1=";; | |
3505 | esac;; | |
3506 | esac;; | |
3507 | esac;; | |
3508 | *) | |
3509 | eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\""; | |
3510 | case "$tp" in | |
3511 | --|/*--|\~*--) eval "$1=\"$prefix/$3\"";; | |
3512 | /*-$oldprefix/*|\~*-$oldprefix/*) | |
3513 | eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";; | |
3514 | *) eval "$1=\"\$$2\"";; | |
3515 | esac;; | |
3516 | esac' | |
a0d0e21e LW |
3517 | |
3518 | : determine where private executables go | |
1aef975c AD |
3519 | set dflt privlib lib/$package |
3520 | eval $prefixit | |
a0d0e21e LW |
3521 | $cat <<EOM |
3522 | ||
3523 | There are some auxiliary files for $package that need to be put into a | |
3524 | private library directory that is accessible by everyone. | |
3525 | ||
3526 | EOM | |
3527 | fn=d~+ | |
1aef975c | 3528 | rp='Pathname where the private library files will reside?' |
a0d0e21e | 3529 | . ./getfile |
1aef975c AD |
3530 | if $test "X$privlibexp" != "X$ansexp"; then |
3531 | installprivlib='' | |
3532 | fi | |
a0d0e21e LW |
3533 | privlib="$ans" |
3534 | privlibexp="$ansexp" | |
3535 | if $afs; then | |
3536 | $cat <<EOM | |
3537 | ||
3538 | Since you are running AFS, I need to distinguish the directory in which | |
3539 | private files reside from the directory in which they are installed (and from | |
3540 | which they are presumably copied to the former directory by occult means). | |
3541 | ||
3542 | EOM | |
3543 | case "$installprivlib" in | |
3544 | '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;; | |
3545 | *) dflt="$installprivlib";; | |
3546 | esac | |
3547 | fn=de~ | |
3548 | rp='Where will private files be installed?' | |
3549 | . ./getfile | |
3550 | installprivlib="$ans" | |
3551 | else | |
3552 | installprivlib="$privlibexp" | |
3553 | fi | |
3554 | ||
1aef975c AD |
3555 | : set the prefixup variable, to restore leading tilda escape |
3556 | prefixup='case "$prefixexp" in | |
3557 | "$prefix") ;; | |
3558 | *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";; | |
3559 | esac' | |
3560 | ||
a0d0e21e | 3561 | : determine where public architecture dependent libraries go |
1aef975c AD |
3562 | set archlib archlib |
3563 | eval $prefixit | |
ecfc5424 AD |
3564 | case "$archlib" in |
3565 | '') | |
3566 | case "$privlib" in | |
1aef975c AD |
3567 | '') |
3568 | dflt=`./loc . "." $prefixexp/lib /usr/local/lib /usr/lib /lib` | |
3569 | set dflt | |
3570 | eval $prefixup | |
3571 | ;; | |
ecfc5424 AD |
3572 | *) dflt="$privlib/$archname";; |
3573 | esac | |
3574 | ;; | |
3575 | *) dflt="$archlib";; | |
a0d0e21e | 3576 | esac |
a0d0e21e LW |
3577 | cat <<EOM |
3578 | ||
1aef975c | 3579 | $spackage contains architecture-dependent library files. If you are |
a0d0e21e LW |
3580 | sharing libraries in a heterogeneous environment, you might store |
3581 | these files in a separate location. Otherwise, you can just include | |
3582 | them with the rest of the public library files. | |
3583 | ||
3584 | EOM | |
ecfc5424 | 3585 | fn=d~ |
a0d0e21e LW |
3586 | rp='Where do you want to put the public architecture-dependent libraries?' |
3587 | . ./getfile | |
3588 | archlib="$ans" | |
3589 | archlibexp="$ansexp" | |
3590 | ||
3591 | if $afs; then | |
3592 | $cat <<EOM | |
3593 | ||
3594 | Since you are running AFS, I need to distinguish the directory in which | |
3595 | private files reside from the directory in which they are installed (and from | |
3596 | which they are presumably copied to the former directory by occult means). | |
3597 | ||
3598 | EOM | |
3599 | case "$installarchlib" in | |
3600 | '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;; | |
3601 | *) dflt="$installarchlib";; | |
3602 | esac | |
3603 | fn=de~ | |
3604 | rp='Where will architecture-dependent library files be installed?' | |
3605 | . ./getfile | |
3606 | installarchlib="$ans" | |
3607 | else | |
3608 | installarchlib="$archlibexp" | |
3609 | fi | |
3610 | if $test X"$archlib" = X"$privlib"; then | |
3611 | d_archlib="$undef" | |
3612 | else | |
3613 | d_archlib="$define" | |
3614 | fi | |
3615 | ||
2304df62 AD |
3616 | : function used to set $1 to $val |
3617 | setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef; | |
3618 | case "$val$was" in | |
ecfc5424 AD |
3619 | $define$undef) . ./whoa; eval "$var=\$td";; |
3620 | $undef$define) . ./whoa; eval "$var=\$tu";; | |
2304df62 AD |
3621 | *) eval "$var=$val";; |
3622 | esac' | |
3623 | ||
ecfc5424 | 3624 | : Look for GNU-cc style attribute checking |
2304df62 | 3625 | echo " " |
a0d0e21e LW |
3626 | echo "Checking whether your compiler can handle __attribute__ ..." >&4 |
3627 | $cat >attrib.c <<'EOCP' | |
1aef975c | 3628 | #include <stdio.h> |
ecfc5424 | 3629 | void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn)); |
a0d0e21e LW |
3630 | EOCP |
3631 | if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then | |
3632 | if $contains 'warning' attrib.out >/dev/null 2>&1; then | |
ecfc5424 | 3633 | echo "Your C compiler doesn't fully support __attribute__." |
a0d0e21e LW |
3634 | val="$undef" |
3635 | else | |
ecfc5424 | 3636 | echo "Your C compiler supports __attribute__." |
a0d0e21e LW |
3637 | val="$define" |
3638 | fi | |
3639 | else | |
ecfc5424 | 3640 | echo "Your C compiler doesn't seem to understand __attribute__ at all." |
a0d0e21e LW |
3641 | val="$undef" |
3642 | fi | |
ecfc5424 | 3643 | set d_attribut |
a0d0e21e LW |
3644 | eval $setvar |
3645 | $rm -f attrib* | |
3646 | ||
3647 | : see if bcmp exists | |
3648 | set bcmp d_bcmp | |
3649 | eval $inlibc | |
3650 | ||
3651 | : see if bcopy exists | |
3652 | set bcopy d_bcopy | |
3653 | eval $inlibc | |
3654 | ||
3655 | : see if setpgrp exists | |
3656 | set setpgrp d_setpgrp | |
3657 | eval $inlibc | |
3658 | ||
3659 | : see which flavor of setpgrp is in use | |
3660 | case "$d_setpgrp" in | |
3661 | "$define") | |
3662 | echo " " | |
3663 | $cat >set.c <<EOP | |
3664 | main() | |
3665 | { | |
3666 | if (getuid() == 0) { | |
3667 | printf("(I see you are running Configure as super-user...)\n"); | |
3668 | setuid(1); | |
3669 | } | |
3670 | if (-1 == setpgrp(1, 1)) | |
3671 | exit(1); | |
3672 | exit(0); | |
3673 | } | |
3674 | EOP | |
ecfc5424 | 3675 | if $cc $ccflags -o set set.c $ldflags $libs >/dev/null 2>&1; then |
a0d0e21e LW |
3676 | ./set 2>/dev/null |
3677 | case $? in | |
3678 | 0) echo "You have to use setpgrp() instead of setpgrp(pid, pgrp)." >&4 | |
3679 | val="$undef";; | |
3680 | *) echo "You have to use setpgrp(pid, pgrp) instead of setpgrp()." >&4 | |
3681 | val="$define";; | |
3682 | esac | |
3683 | else | |
ecfc5424 | 3684 | if ./usg; then |
a0d0e21e LW |
3685 | xxx="USG one, i.e. you use setpgrp()." |
3686 | val="$undef" | |
3687 | else | |
3688 | xxx="BSD one, i.e. you use setpgrp(pid, pgrp)." | |
3689 | val="$define" | |
3690 | fi | |
3691 | echo "Assuming your setpgrp is a $xxx" >&4 | |
3692 | fi | |
3693 | ;; | |
3694 | *) val="$undef";; | |
3695 | esac | |
3696 | set d_bsdpgrp | |
3697 | eval $setvar | |
3698 | $rm -f set set.c | |
3699 | ||
1aef975c AD |
3700 | : Check if we really have byacc |
3701 | case "$byacc" in | |
3702 | ''|'byacc') val="$undef" ;; | |
3703 | *) val="$define" ;; | |
3704 | esac | |
3705 | set d_byacc | |
3706 | eval $setvar | |
3707 | ||
a0d0e21e LW |
3708 | : see if bzero exists |
3709 | set bzero d_bzero | |
3710 | eval $inlibc | |
3711 | ||
3712 | : check for length of integer | |
3713 | echo " " | |
3714 | case "$intsize" in | |
3715 | '') | |
3716 | echo "Checking to see how big your integers are..." >&4 | |
3717 | $cat >try.c <<'EOCP' | |
3718 | #include <stdio.h> | |
3719 | main() | |
3720 | { | |
3721 | printf("%d\n", sizeof(int)); | |
3722 | } | |
3723 | EOCP | |
3724 | if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then | |
3725 | dflt=`./try` | |
3726 | else | |
3727 | dflt='4' | |
3728 | echo "(I can't seem to compile the test program. Guessing...)" | |
3729 | fi | |
3730 | ;; | |
3731 | *) | |
3732 | dflt="$intsize" | |
3733 | ;; | |
3734 | esac | |
3735 | rp="What is the size of an integer (in bytes)?" | |
3736 | . ./myread | |
3737 | intsize="$ans" | |
3738 | $rm -f try.c try | |
3739 | ||
ecfc5424 | 3740 | : see if signal is declared as pointer to function returning int or void |
a0d0e21e | 3741 | echo " " |
ecfc5424 AD |
3742 | xxx=`./findhdr signal.h` |
3743 | $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null | |
3744 | if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then | |
3745 | echo "You have int (*signal())() instead of void." >&4 | |
3746 | val="$undef" | |
3747 | elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then | |
3748 | echo "You have void (*signal())() instead of int." >&4 | |
3749 | val="$define" | |
3750 | elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then | |
3751 | echo "You have int (*signal())() instead of void." >&4 | |
3752 | val="$undef" | |
a0d0e21e | 3753 | else |
ecfc5424 AD |
3754 | case "$d_voidsig" in |
3755 | '') | |
3756 | echo "I can't determine whether signal handler returns void or int..." >&4 | |
3757 | dflt=void | |
3758 | rp="What type does your signal handler return?" | |
3759 | . ./myread | |
3760 | case "$ans" in | |
3761 | v*) val="$define";; | |
3762 | *) val="$undef";; | |
3763 | esac;; | |
3764 | "$define") | |
3765 | echo "As you already told me, signal handler returns void." >&4;; | |
3766 | *) | |
3767 | echo "As you already told me, signal handler returns int." >&4;; | |
3768 | esac | |
3769 | fi | |
3770 | set d_voidsig | |
3771 | eval $setvar | |
3772 | case "$d_voidsig" in | |
3773 | "$define") signal_t="void";; | |
3774 | *) signal_t="int";; | |
3775 | esac | |
3776 | $rm -f $$.tmp | |
3777 | ||
3778 | : check for ability to cast large floats to 32-bit ints. | |
3779 | echo " " | |
3780 | echo 'Checking whether your C compiler can cast large floats to int32.' >&4 | |
3781 | if $test "$intsize" -eq 4; then | |
3782 | xxx=int | |
3783 | else | |
3784 | xxx=long | |
3785 | fi | |
3786 | $cat >try.c <<EOCP | |
3787 | #include <sys/types.h> | |
3788 | #include <signal.h> | |
3789 | $signal_t blech() { exit(3); } | |
3790 | main() | |
2304df62 | 3791 | { |
a0d0e21e | 3792 | $xxx i32; |
2304df62 AD |
3793 | double f; |
3794 | int result = 0; | |
3795 | signal(SIGFPE, blech); | |
3796 | ||
3797 | f = (double) 0x7fffffff; | |
3798 | f = 10 * f; | |
a0d0e21e | 3799 | i32 = ($xxx) f; |
2304df62 | 3800 | |
a0d0e21e | 3801 | if (i32 != ($xxx) f) |
2304df62 AD |
3802 | result |= 1; |
3803 | exit(result); | |
3804 | } | |
3805 | EOCP | |
3806 | if $cc -o try $ccflags try.c >/dev/null 2>&1; then | |
3807 | ./try | |
3808 | yyy=$? | |
3809 | else | |
a0d0e21e | 3810 | echo "(I can't seem to compile the test program--assuming it can't)" |
2304df62 AD |
3811 | yyy=1 |
3812 | fi | |
3813 | case "$yyy" in | |
3814 | 0) val="$define" | |
3815 | echo "Yup, it can." | |
3816 | ;; | |
3817 | *) val="$undef" | |
3818 | echo "Nope, it can't." | |
3819 | ;; | |
3820 | esac | |
3821 | set d_casti32 | |
3822 | eval $setvar | |
85e6fe83 | 3823 | $rm -f try try.* |
a0d0e21e | 3824 | |
2304df62 AD |
3825 | : check for ability to cast negative floats to unsigned |
3826 | echo " " | |
3827 | echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4 | |
ecfc5424 AD |
3828 | $cat >try.c <<EOCP |
3829 | #include <sys/types.h> | |
2304df62 | 3830 | #include <signal.h> |
ecfc5424 | 3831 | $signal_t blech() { exit(3); } |
2304df62 AD |
3832 | main() |
3833 | { | |
3834 | double f = -123; | |
3835 | unsigned long along; | |
3836 | unsigned int aint; | |
3837 | unsigned short ashort; | |
3838 | int result = 0; | |
3839 | ||
3840 | signal(SIGFPE, blech); | |
3841 | along = (unsigned long)f; | |
3842 | aint = (unsigned int)f; | |
3843 | ashort = (unsigned short)f; | |
3844 | if (along != (unsigned long)-123) | |
3845 | result |= 1; | |
3846 | if (aint != (unsigned int)-123) | |
3847 | result |= 1; | |
3848 | if (ashort != (unsigned short)-123) | |
3849 | result |= 1; | |
3850 | f = (double)0x40000000; | |
3851 | f = f + f; | |
3852 | along = 0; | |
3853 | along = (unsigned long)f; | |
3854 | if (along != 0x80000000) | |
3855 | result |= 2; | |
3856 | f -= 1.; | |
3857 | along = 0; | |
3858 | along = (unsigned long)f; | |
3859 | if (along != 0x7fffffff) | |
3860 | result |= 1; | |
3861 | f += 2.; | |
3862 | along = 0; | |
3863 | along = (unsigned long)f; | |
3864 | if (along != 0x80000001) | |
3865 | result |= 2; | |
3866 | exit(result); | |
3867 | ||
3868 | } | |
3869 | EOCP | |
3870 | if $cc -o try $ccflags try.c >/dev/null 2>&1; then | |
3871 | ./try | |
3872 | castflags=$? | |
3873 | else | |
ecfc5424 | 3874 | echo "(I can't seem to compile the test program--assuming it can't)" |
2304df62 AD |
3875 | castflags=3 |
3876 | fi | |
3877 | case "$castflags" in | |
3878 | 0) val="$define" | |
3879 | echo "Yup, it can." | |
3880 | ;; | |
3881 | *) val="$undef" | |
3882 | echo "Nope, it can't." | |
3883 | ;; | |
3884 | esac | |
3885 | set d_castneg | |
3886 | eval $setvar | |
3887 | $rm -f try.* | |
3888 | ||
2304df62 AD |
3889 | : see if vprintf exists |
3890 | echo " " | |
3891 | if set vprintf val -f d_vprintf; eval $csym; $val; then | |
3892 | echo 'vprintf() found.' >&4 | |
3893 | val="$define" | |
3894 | $cat >vprintf.c <<'EOF' | |
3895 | #include <varargs.h> | |
3896 | ||
3897 | main() { xxx("foo"); } | |
3898 | ||
3899 | xxx(va_alist) | |
3900 | va_dcl | |
3901 | { | |
3902 | va_list args; | |
3903 | char buf[10]; | |
3904 | ||
3905 | va_start(args); | |
3906 | exit((unsigned long)vsprintf(buf,"%s",args) > 10L); | |
3907 | } | |
3908 | EOF | |
3909 | if $cc $ccflags vprintf.c -o vprintf >/dev/null 2>&1 && ./vprintf; then | |
3910 | echo "Your vsprintf() returns (int)." >&4 | |
3911 | val2="$undef" | |
3912 | else | |
3913 | echo "Your vsprintf() returns (char*)." >&4 | |
3914 | val2="$define" | |
3915 | fi | |
3916 | else | |
3917 | echo 'vprintf() NOT found.' >&4 | |
3918 | val="$undef" | |
3919 | val2="$undef" | |
3920 | fi | |
3921 | set d_vprintf | |
3922 | eval $setvar | |
3923 | val=$val2 | |
3924 | set d_charvspr | |
3925 | eval $setvar | |
3926 | ||
a0d0e21e LW |
3927 | : see if chown exists |
3928 | set chown d_chown | |
3929 | eval $inlibc | |
3930 | ||
3931 | : see if chroot exists | |
3932 | set chroot d_chroot | |
3933 | eval $inlibc | |
3934 | ||
2304df62 AD |
3935 | : see if chsize exists |
3936 | set chsize d_chsize | |
3937 | eval $inlibc | |
3938 | ||
3939 | : check for const keyword | |
3940 | echo " " | |
3941 | echo 'Checking to see if your C compiler knows about "const"...' >&4 | |
3942 | $cat >const.c <<'EOCP' | |
3943 | typedef struct spug { int drokk; } spug; | |
3944 | main() | |
3945 | { | |
3946 | const char *foo; | |
3947 | const spug y; | |
3948 | } | |
3949 | EOCP | |
3950 | if $cc -c $ccflags const.c >/dev/null 2>&1 ; then | |
3951 | val="$define" | |
3952 | echo "Yup, it does." | |
3953 | else | |
3954 | val="$undef" | |
3955 | echo "Nope, it doesn't." | |
3956 | fi | |
3957 | set d_const | |
3958 | eval $setvar | |
3959 | ||
3960 | : see if crypt exists | |
3961 | echo " " | |
3962 | if set crypt val -f d_crypt; eval $csym; $val; then | |
3963 | echo 'crypt() found.' >&4 | |
3964 | val="$define" | |
3965 | cryptlib='' | |
3966 | else | |
3967 | cryptlib=`./loc Slibcrypt.a "" $xlibpth` | |
3968 | if $test -z "$cryptlib"; then | |
3969 | cryptlib=`./loc Mlibcrypt.a "" $xlibpth` | |
3970 | else | |
3971 | cryptlib=-lcrypt | |
3972 | fi | |
3973 | if $test -z "$cryptlib"; then | |
3974 | cryptlib=`./loc Llibcrypt.a "" $xlibpth` | |
3975 | else | |
3976 | cryptlib=-lcrypt | |
3977 | fi | |
3978 | if $test -z "$cryptlib"; then | |
3979 | cryptlib=`./loc libcrypt.a "" $libpth` | |
3980 | else | |
3981 | cryptlib=-lcrypt | |
3982 | fi | |
3983 | if $test -z "$cryptlib"; then | |
3984 | echo 'crypt() NOT found.' >&4 | |
3985 | val="$undef" | |
3986 | else | |
3987 | val="$define" | |
3988 | fi | |
3989 | fi | |
3990 | set d_crypt | |
3991 | eval $setvar | |
3992 | ||
3993 | : get csh whereabouts | |
3994 | case "$csh" in | |
3995 | 'csh') val="$undef" ;; | |
3996 | *) val="$define" ;; | |
3997 | esac | |
3998 | set d_csh | |
3999 | eval $setvar | |
1aef975c | 4000 | full_csh=$csh |
2304df62 | 4001 | |
a0d0e21e LW |
4002 | : see if cuserid exists |
4003 | set cuserid d_cuserid | |
2304df62 AD |
4004 | eval $inlibc |
4005 | ||
85e6fe83 LW |
4006 | : define an alternate in-header-list? function |
4007 | inhdr='echo " "; td=$define; tu=$undef; yyy=$@; | |
4008 | cont=true; xxf="echo \"<\$1> found.\" >&4"; | |
4009 | case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";; | |
4010 | *) xxnf="echo \"<\$1> NOT found, ...\" >&4";; | |
4011 | esac; | |
4012 | case $# in 4) instead=instead;; *) instead="at last";; esac; | |
4013 | while $test "$cont"; do | |
4014 | xxx=`./findhdr $1` | |
4015 | var=$2; eval "was=\$$2"; | |
4016 | if $test "$xxx" && $test -r "$xxx"; | |
4017 | then eval $xxf; | |
ecfc5424 | 4018 | eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td"; |
85e6fe83 LW |
4019 | cont=""; |
4020 | else eval $xxnf; | |
ecfc5424 | 4021 | eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi; |
85e6fe83 LW |
4022 | set $yyy; shift; shift; yyy=$@; |
4023 | case $# in 0) cont="";; | |
4024 | 2) xxf="echo \"but I found <\$1> $instead.\" >&4"; | |
4025 | xxnf="echo \"and I did not find <\$1> either.\" >&4";; | |
4026 | *) xxf="echo \"but I found <\$1\> instead.\" >&4"; | |
4027 | xxnf="echo \"there is no <\$1>, ...\" >&4";; | |
4028 | esac; | |
4029 | done; | |
4030 | while $test "$yyy"; | |
4031 | do set $yyy; var=$2; eval "was=\$$2"; | |
ecfc5424 | 4032 | eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; |
85e6fe83 LW |
4033 | set $yyy; shift; shift; yyy=$@; |
4034 | done' | |
4035 | ||
a0d0e21e LW |
4036 | : see if this is a limits.h system |
4037 | set limits.h i_limits | |
85e6fe83 LW |
4038 | eval $inhdr |
4039 | ||
a0d0e21e LW |
4040 | : see if this is a float.h system |
4041 | set float.h i_float | |
4042 | eval $inhdr | |
4043 | ||
4044 | : See if number of significant digits in a double precision number is known | |
4045 | echo " " | |
4046 | $cat >dbl_dig.c <<EOM | |
4047 | #$i_limits I_LIMITS | |
4048 | #$i_float I_FLOAT | |
4049 | #ifdef I_LIMITS | |
4050 | #include <limits.h> | |
85e6fe83 | 4051 | #endif |
a0d0e21e LW |
4052 | #ifdef I_FLOAT |
4053 | #include <float.h> | |
4054 | #endif | |
4055 | #ifdef DBL_DIG | |
4056 | printf("Contains DBL_DIG"); | |
85e6fe83 | 4057 | #endif |
85e6fe83 | 4058 | EOM |
a0d0e21e LW |
4059 | $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null |
4060 | if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then | |
4061 | echo "DBL_DIG found." >&4 | |
4062 | val="$define" | |
2304df62 | 4063 | else |
a0d0e21e LW |
4064 | echo "DBL_DIG NOT found." >&4 |
4065 | val="$undef" | |
2304df62 | 4066 | fi |
a0d0e21e LW |
4067 | $rm -f dbl_dig.? |
4068 | set d_dbl_dig | |
2304df62 | 4069 | eval $setvar |
2304df62 | 4070 | |
a0d0e21e LW |
4071 | : see if difftime exists |
4072 | set difftime d_difftime | |
2304df62 AD |
4073 | eval $inlibc |
4074 | ||
a0d0e21e LW |
4075 | : see if this is a dirent system |
4076 | echo " " | |
4077 | if xinc=`./findhdr dirent.h`; $test "$xinc"; then | |
4078 | val="$define" | |
4079 | echo "<dirent.h> found." >&4 | |
4080 | else | |
4081 | val="$undef" | |
4082 | if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then | |
4083 | echo "<sys/dir.h> found." >&4 | |
4084 | echo " " | |
4085 | else | |
4086 | xinc=`./findhdr sys/ndir.h` | |
4087 | fi | |
4088 | echo "<dirent.h> NOT found." >&4 | |
4089 | fi | |
4090 | set i_dirent | |
4091 | eval $setvar | |
4092 | ||
4093 | : Look for type of directory structure. | |
4094 | echo " " | |
4095 | $cppstdin $cppflags $cppminus < "$xinc" > try.c | |
4096 | ||
4097 | case "$direntrytype" in | |
4098 | ''|' ') | |
4099 | case "$i_dirent" in | |
4100 | $define) guess1='struct dirent' ;; | |
4101 | *) guess1='struct direct' ;; | |
4102 | esac | |
4103 | ;; | |
4104 | *) guess1="$direntrytype" | |
4105 | ;; | |
4106 | esac | |
4107 | ||
4108 | case "$guess1" in | |
4109 | 'struct dirent') guess2='struct direct' ;; | |
4110 | *) guess2='struct dirent' ;; | |
4111 | esac | |
4112 | ||
4113 | if $contains "$guess1" try.c >/dev/null 2>&1; then | |
4114 | direntrytype="$guess1" | |
4115 | echo "Your directory entries are $direntrytype." >&4 | |
4116 | elif $contains "$guess2" try.c >/dev/null 2>&1; then | |
4117 | direntrytype="$guess2" | |
4118 | echo "Your directory entries seem to be $direntrytype." >&4 | |
4119 | else | |
4120 | echo "I don't recognize your system's directory entries." >&4 | |
4121 | rp="What type is used for directory entries on this system?" | |
4122 | dflt="$guess1" | |
4123 | . ./myread | |
4124 | direntrytype="$ans" | |
4125 | fi | |
4126 | $rm -f try.c | |
4127 | ||
4128 | ||
4129 | : see if the directory entry stores field length | |
4130 | echo " " | |
ecfc5424 AD |
4131 | $cppstdin $cppflags $cppminus < "$xinc" > try.c |
4132 | if $contains 'd_namlen' try.c >/dev/null 2>&1; then | |
a0d0e21e LW |
4133 | echo "Good, your directory entry keeps length information in d_namlen." >&4 |
4134 | val="$define" | |
4135 | else | |
4136 | echo "Your directory entry does not know about the d_namlen field." >&4 | |
4137 | val="$undef" | |
4138 | fi | |
4139 | set d_dirnamlen | |
4140 | eval $setvar | |
ecfc5424 | 4141 | $rm -f try.c |
a0d0e21e LW |
4142 | |
4143 | : see if dlerror exists | |
4144 | set dlerror d_dlerror | |
4145 | eval $inlibc | |
4146 | ||
4147 | : see if dld is available | |
4148 | set dld.h i_dld | |
4149 | eval $inhdr | |
4150 | ||
4151 | : see if dlopen exists | |
4152 | set dlopen d_dlopen | |
4153 | eval $inlibc | |
4154 | ||
4155 | : determine which dynamic loading, if any, to compile in | |
4156 | echo " " | |
4157 | dldir="ext/DynaLoader" | |
4158 | case "$usedl" in | |
4159 | $define|y|true) | |
4160 | dflt='y' | |
4161 | usedl="$define" | |
4162 | ;; | |
4163 | $undef|n|false) | |
4164 | dflt='n' | |
4165 | usedl="$undef" | |
4166 | ;; | |
4167 | *) | |
4168 | dflt='n' | |
4169 | case "$d_dlopen" in | |
ecfc5424 AD |
4170 | $define) dflt='y' ;; |
4171 | esac | |
a0d0e21e | 4172 | case "$i_dld" in |
ecfc5424 AD |
4173 | $define) dflt='y' ;; |
4174 | esac | |
4175 | : Does a dl_xxx.xs file exist for this operating system | |
4176 | $test -f ../$dldir/dl_${osname}.xs && dflt='y' | |
4177 | ;; | |
a0d0e21e LW |
4178 | esac |
4179 | rp="Do you wish to use dynamic loading?" | |
4180 | . ./myread | |
4181 | usedl="$ans" | |
4182 | case "$ans" in | |
4183 | y*) usedl="$define" | |
4184 | case "$dlsrc" in | |
4185 | '') | |
4186 | if $test -f ../$dldir/dl_${osname}.xs ; then | |
4187 | dflt="$dldir/dl_${osname}.xs" | |
4188 | elif $test "$d_dlopen" = "$define" ; then | |
4189 | dflt="$dldir/dl_dlopen.xs" | |
4190 | elif $test "$i_dld" = "$define" ; then | |
4191 | dflt="$dldir/dl_dld.xs" | |
4192 | else | |
4193 | dflt='' | |
4194 | fi | |
4195 | ;; | |
4196 | *) dflt="$dldir/$dlsrc" | |
4197 | ;; | |
4198 | esac | |
4199 | echo "The following dynamic loading files are available:" | |
4200 | : Can not go over to $dldir because getfile has path hard-coded in. | |
4201 | cd ..; ls -C $dldir/dl*.xs; cd UU | |
4202 | rp="Source file to use for dynamic loading" | |
fed7345c | 4203 | fn="fne" |
a0d0e21e LW |
4204 | . ./getfile |
4205 | usedl="$define" | |
4206 | : emulate basename | |
4207 | dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'` | |
4208 | $cat << EOM | |
4209 | ||
4210 | Some systems may require passing special flags to $cc -c to | |
4211 | compile modules that will be used to create a shared library. | |
4212 | To use no flags, say "none". | |
4213 | ||
4214 | EOM | |
4215 | case "$cccdlflags" in | |
ecfc5424 AD |
4216 | ''|' ') case "$cc" in |
4217 | *gcc*) dflt='-fpic' ;; | |
4218 | *) case "$osname" in | |