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