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 | ||
8e07c86e | 21 | # $Id: Head.U,v 3.0.1.8 1995/07/25 13:40:02 ram Exp $ |
2304df62 | 22 | # |
5f05dabc | 23 | # Generated on Tue Dec 17 14:33:33 EST 1996 [metaconfig 3.0 PL60] |
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 | ||
8e07c86e AD |
58 | : Proper PATH separator |
59 | p_=: | |
60 | : On OS/2 this directory should exist if this is not floppy only system :-] | |
4b40f7a3 | 61 | if test -d c:/. -a -n "$OS2_SHELL"; then |
8e07c86e AD |
62 | p_=\; |
63 | PATH=`cmd /c "echo %PATH%" | tr '\\\\' / ` | |
64 | OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'` | |
65 | fi | |
a0d0e21e LW |
66 | |
67 | : Proper PATH setting | |
68 | paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin' | |
16d20bd9 | 69 | paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin" |
232e078e | 70 | paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin" |
16d20bd9 | 71 | paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin" |
232e078e AD |
72 | paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb" |
73 | paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin" | |
74 | paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib" | |
75 | paths="$paths /sbin /usr/sbin /usr/libexec" | |
a0d0e21e LW |
76 | |
77 | for p in $paths | |
78 | do | |
8e07c86e AD |
79 | case "$p_$PATH$p_" in |
80 | *$p_$p$p_*) ;; | |
81 | *) test -d $p && PATH=$PATH$p_$p ;; | |
a0d0e21e LW |
82 | esac |
83 | done | |
84 | ||
8e07c86e | 85 | PATH=.$p_$PATH |
2304df62 AD |
86 | export PATH |
87 | ||
a0d0e21e | 88 | : Sanity checks |
2304df62 | 89 | if test ! -t 0; then |
a0d0e21e | 90 | echo "Say 'sh $me', not 'sh <$me'" |
2304df62 AD |
91 | exit 1 |
92 | fi | |
93 | ||
94 | : On HP-UX, large Configure scripts may exercise a bug in /bin/sh | |
95 | if test -f /hp-ux -a -f /bin/ksh; then | |
96 | if (PATH=.; alias -x) >/dev/null 2>&1; then | |
97 | : already under /bin/ksh | |
98 | else | |
99 | cat <<'EOM' | |
100 | (Feeding myself to ksh to avoid nasty sh bug in "here document" expansion.) | |
101 | EOM | |
ecfc5424 | 102 | unset ENV |
2304df62 AD |
103 | exec /bin/ksh $0 "$@" |
104 | fi | |
105 | else | |
106 | : Warn them if they use ksh on other systems | |
107 | (PATH=.; alias -x) >/dev/null 2>&1 && \ | |
a0d0e21e LW |
108 | cat <<EOM |
109 | (I see you are using the Korn shell. Some ksh's blow up on $me, | |
8ff267be | 110 | especially on older exotic systems. If yours does, try the Bourne |
111 | shell instead.) | |
2304df62 AD |
112 | EOM |
113 | fi | |
114 | ||
115 | : Configure runs within the UU subdirectory | |
116 | test -d UU || mkdir UU | |
8e07c86e | 117 | cd UU && rm -f ./* |
2304df62 | 118 | |
a0d0e21e | 119 | dynamic_ext='' |
2304df62 | 120 | extensions='' |
a0d0e21e LW |
121 | known_extensions='' |
122 | static_ext='' | |
8ff267be | 123 | useopcode='' |
a0d0e21e | 124 | useposix='' |
ecfc5424 | 125 | d_bsd='' |
40a7a20a | 126 | d_eunice='' |
2304df62 AD |
127 | d_xenix='' |
128 | eunicefix='' | |
129 | Mcc='' | |
130 | awk='' | |
131 | bash='' | |
132 | bison='' | |
133 | byacc='' | |
134 | cat='' | |
135 | chgrp='' | |
136 | chmod='' | |
137 | chown='' | |
ecfc5424 | 138 | comm='' |
2304df62 AD |
139 | compress='' |
140 | cp='' | |
141 | cpio='' | |
142 | cpp='' | |
143 | csh='' | |
144 | date='' | |
145 | echo='' | |
146 | egrep='' | |
147 | emacs='' | |
148 | expr='' | |
149 | find='' | |
150 | flex='' | |
151 | gcc='' | |
152 | grep='' | |
8ff267be | 153 | gzip='' |
2304df62 AD |
154 | inews='' |
155 | ksh='' | |
156 | less='' | |
157 | line='' | |
158 | lint='' | |
159 | ln='' | |
160 | lp='' | |
161 | lpr='' | |
162 | ls='' | |
163 | mail='' | |
164 | mailx='' | |
2304df62 AD |
165 | mkdir='' |
166 | more='' | |
167 | mv='' | |
168 | nroff='' | |
169 | perl='' | |
170 | pg='' | |
171 | pmake='' | |
172 | pr='' | |
173 | rm='' | |
174 | rmail='' | |
175 | sed='' | |
176 | sendmail='' | |
2304df62 AD |
177 | shar='' |
178 | sleep='' | |
179 | smail='' | |
180 | sort='' | |
181 | submit='' | |
182 | tail='' | |
183 | tar='' | |
184 | tbl='' | |
185 | test='' | |
186 | touch='' | |
187 | tr='' | |
188 | troff='' | |
189 | uname='' | |
190 | uniq='' | |
191 | uuname='' | |
192 | vi='' | |
193 | zcat='' | |
8ff267be | 194 | zip='' |
1aef975c | 195 | full_sed='' |
a0d0e21e | 196 | libswanted='' |
2304df62 AD |
197 | hint='' |
198 | myuname='' | |
85e6fe83 LW |
199 | osname='' |
200 | osvers='' | |
2304df62 AD |
201 | Author='' |
202 | Date='' | |
203 | Header='' | |
204 | Id='' | |
205 | Locker='' | |
206 | Log='' | |
207 | RCSfile='' | |
208 | Revision='' | |
209 | Source='' | |
210 | State='' | |
4633a7c4 LW |
211 | ar='' |
212 | archobjs='' | |
213 | exe_ext='' | |
214 | firstmakefile='' | |
215 | lib_ext='' | |
216 | obj_ext='' | |
217 | path_sep='' | |
2304df62 | 218 | afs='' |
a0d0e21e LW |
219 | alignbytes='' |
220 | archlib='' | |
221 | archlibexp='' | |
a0d0e21e LW |
222 | d_archlib='' |
223 | installarchlib='' | |
40000a8c AD |
224 | archname='' |
225 | myarchname='' | |
ecfc5424 | 226 | baserev='' |
2304df62 AD |
227 | bin='' |
228 | binexp='' | |
229 | installbin='' | |
5f05dabc | 230 | bincompat3='' |
231 | d_bincompat3='' | |
2304df62 AD |
232 | byteorder='' |
233 | cc='' | |
234 | gccversion='' | |
235 | ccflags='' | |
236 | cppflags='' | |
237 | ldflags='' | |
238 | lkflags='' | |
8e07c86e | 239 | locincpth='' |
2304df62 | 240 | optimize='' |
8e07c86e | 241 | cf_email='' |
2304df62 AD |
242 | cf_by='' |
243 | cf_time='' | |
244 | contains='' | |
a0d0e21e | 245 | cpp_stuff='' |
2304df62 AD |
246 | cpplast='' |
247 | cppminus='' | |
248 | cpprun='' | |
249 | cppstdin='' | |
250 | d_access='' | |
a0d0e21e | 251 | d_alarm='' |
ecfc5424 | 252 | d_attribut='' |
2304df62 AD |
253 | d_bcmp='' |
254 | d_bcopy='' | |
255 | d_bzero='' | |
256 | d_casti32='' | |
257 | castflags='' | |
258 | d_castneg='' | |
a0d0e21e LW |
259 | d_chown='' |
260 | d_chroot='' | |
2304df62 | 261 | d_chsize='' |
a0d0e21e LW |
262 | d_closedir='' |
263 | d_void_closedir='' | |
2304df62 AD |
264 | d_const='' |
265 | cryptlib='' | |
266 | d_crypt='' | |
267 | d_csh='' | |
1aef975c | 268 | full_csh='' |
a0d0e21e LW |
269 | d_cuserid='' |
270 | d_dbl_dig='' | |
271 | d_difftime='' | |
272 | d_dlerror='' | |
273 | d_dlopen='' | |
274 | d_dlsymun='' | |
2304df62 | 275 | d_dosuid='' |
a0d0e21e | 276 | d_suidsafe='' |
2304df62 AD |
277 | d_dup2='' |
278 | d_fchmod='' | |
279 | d_fchown='' | |
280 | d_fcntl='' | |
a0d0e21e LW |
281 | d_fd_macros='' |
282 | d_fd_set='' | |
283 | d_fds_bits='' | |
284 | d_fgetpos='' | |
2304df62 AD |
285 | d_flexfnam='' |
286 | d_flock='' | |
a0d0e21e LW |
287 | d_fork='' |
288 | d_fsetpos='' | |
5f05dabc | 289 | d_ftime='' |
290 | d_gettimeod='' | |
a0d0e21e | 291 | d_Gconvert='' |
2304df62 AD |
292 | d_getgrps='' |
293 | d_gethent='' | |
294 | aphostname='' | |
295 | d_gethname='' | |
296 | d_phostname='' | |
297 | d_uname='' | |
a0d0e21e | 298 | d_getlogin='' |
2afac517 | 299 | d_getpgid='' |
2304df62 | 300 | d_getpgrp2='' |
2afac517 | 301 | d_bsdgetpgrp='' |
2304df62 | 302 | d_getpgrp='' |
a0d0e21e | 303 | d_getppid='' |
2304df62 | 304 | d_getprior='' |
a4f3eea9 | 305 | d_gnulibc='' |
2304df62 | 306 | d_htonl='' |
7e1af8bc | 307 | d_inetaton='' |
2304df62 AD |
308 | d_isascii='' |
309 | d_killpg='' | |
310 | d_link='' | |
a0d0e21e LW |
311 | d_locconv='' |
312 | d_lockf='' | |
2304df62 | 313 | d_lstat='' |
a0d0e21e LW |
314 | d_mblen='' |
315 | d_mbstowcs='' | |
316 | d_mbtowc='' | |
2304df62 AD |
317 | d_memcmp='' |
318 | d_memcpy='' | |
319 | d_memmove='' | |
320 | d_memset='' | |
321 | d_mkdir='' | |
a0d0e21e LW |
322 | d_mkfifo='' |
323 | d_mktime='' | |
2304df62 AD |
324 | d_msg='' |
325 | d_msgctl='' | |
326 | d_msgget='' | |
327 | d_msgrcv='' | |
328 | d_msgsnd='' | |
a0d0e21e | 329 | d_nice='' |
2304df62 | 330 | d_open3='' |
a0d0e21e LW |
331 | d_fpathconf='' |
332 | d_pathconf='' | |
333 | d_pause='' | |
334 | d_pipe='' | |
8e07c86e | 335 | d_poll='' |
2304df62 AD |
336 | d_portable='' |
337 | d_readdir='' | |
85e6fe83 LW |
338 | d_rewinddir='' |
339 | d_seekdir='' | |
340 | d_telldir='' | |
a0d0e21e | 341 | d_readlink='' |
2304df62 AD |
342 | d_rename='' |
343 | d_rmdir='' | |
344 | d_safebcpy='' | |
345 | d_safemcpy='' | |
36477c24 | 346 | d_sanemcmp='' |
2304df62 AD |
347 | d_select='' |
348 | d_sem='' | |
349 | d_semctl='' | |
350 | d_semget='' | |
351 | d_semop='' | |
352 | d_setegid='' | |
353 | d_seteuid='' | |
a0d0e21e | 354 | d_setlinebuf='' |
2304df62 AD |
355 | d_setlocale='' |
356 | d_setpgid='' | |
357 | d_setpgrp2='' | |
358 | d_bsdpgrp='' | |
2afac517 | 359 | d_bsdsetpgrp='' |
2304df62 AD |
360 | d_setpgrp='' |
361 | d_setprior='' | |
362 | d_setregid='' | |
363 | d_setresgid='' | |
364 | d_setresuid='' | |
365 | d_setreuid='' | |
366 | d_setrgid='' | |
367 | d_setruid='' | |
368 | d_setsid='' | |
760ac839 | 369 | d_sfio='' |
8ff267be | 370 | usesfio='' |
2304df62 AD |
371 | d_shm='' |
372 | d_shmat='' | |
a0d0e21e LW |
373 | d_shmatprototype='' |
374 | shmattype='' | |
2304df62 AD |
375 | d_shmctl='' |
376 | d_shmdt='' | |
377 | d_shmget='' | |
2c7991dc | 378 | d_sigaction='' |
8ff267be | 379 | d_sigsetjmp='' |
2304df62 AD |
380 | d_oldsock='' |
381 | d_socket='' | |
382 | d_sockpair='' | |
383 | sockethdr='' | |
384 | socketlib='' | |
385 | d_statblks='' | |
c2960299 AD |
386 | d_stdio_cnt_lval='' |
387 | d_stdio_ptr_lval='' | |
16d20bd9 | 388 | d_stdiobase='' |
2304df62 | 389 | d_stdstdio='' |
16d20bd9 AD |
390 | stdio_base='' |
391 | stdio_bufsiz='' | |
392 | stdio_cnt='' | |
8ff267be | 393 | stdio_filbuf='' |
16d20bd9 | 394 | stdio_ptr='' |
2304df62 AD |
395 | d_index='' |
396 | d_strchr='' | |
a0d0e21e | 397 | d_strcoll='' |
2304df62 AD |
398 | d_strctcpy='' |
399 | d_strerrm='' | |
400 | d_strerror='' | |
401 | d_sysernlst='' | |
402 | d_syserrlst='' | |
a89d8a78 DH |
403 | d_strtod='' |
404 | d_strtol='' | |
405 | d_strtoul='' | |
a0d0e21e | 406 | d_strxfrm='' |
2304df62 AD |
407 | d_symlink='' |
408 | d_syscall='' | |
a0d0e21e | 409 | d_sysconf='' |
2304df62 | 410 | d_system='' |
a0d0e21e LW |
411 | d_tcgetpgrp='' |
412 | d_tcsetpgrp='' | |
85e6fe83 LW |
413 | d_time='' |
414 | timetype='' | |
2304df62 AD |
415 | clocktype='' |
416 | d_times='' | |
417 | d_truncate='' | |
a0d0e21e LW |
418 | d_tzname='' |
419 | d_umask='' | |
2304df62 | 420 | d_vfork='' |
a0d0e21e | 421 | usevfork='' |
2304df62 AD |
422 | d_voidsig='' |
423 | signal_t='' | |
424 | d_volatile='' | |
425 | d_charvspr='' | |
426 | d_vprintf='' | |
427 | d_wait4='' | |
428 | d_waitpid='' | |
a0d0e21e LW |
429 | d_wcstombs='' |
430 | d_wctomb='' | |
431 | dlext='' | |
85e6fe83 LW |
432 | cccdlflags='' |
433 | ccdlflags='' | |
2304df62 | 434 | dlsrc='' |
232e078e | 435 | ld='' |
85e6fe83 | 436 | lddlflags='' |
2304df62 | 437 | usedl='' |
a0d0e21e | 438 | fpostype='' |
2304df62 AD |
439 | gidtype='' |
440 | groupstype='' | |
441 | h_fcntl='' | |
442 | h_sysfile='' | |
ecfc5424 AD |
443 | db_hashtype='' |
444 | db_prefixtype='' | |
a0d0e21e | 445 | i_db='' |
2304df62 | 446 | i_dbm='' |
8e07c86e | 447 | i_rpcsvcdbm='' |
2304df62 | 448 | d_dirnamlen='' |
a0d0e21e | 449 | direntrytype='' |
2304df62 | 450 | i_dirent='' |
a0d0e21e | 451 | i_dld='' |
2304df62 AD |
452 | i_dlfcn='' |
453 | i_fcntl='' | |
a0d0e21e | 454 | i_float='' |
2304df62 AD |
455 | i_gdbm='' |
456 | i_grp='' | |
a0d0e21e | 457 | i_limits='' |
4633a7c4 | 458 | i_locale='' |
a0d0e21e LW |
459 | i_malloc='' |
460 | i_math='' | |
85e6fe83 | 461 | i_memory='' |
2304df62 | 462 | i_ndbm='' |
85e6fe83 | 463 | i_neterrno='' |
2304df62 AD |
464 | i_niin='' |
465 | i_sysin='' | |
466 | d_pwage='' | |
467 | d_pwchange='' | |
468 | d_pwclass='' | |
469 | d_pwcomment='' | |
470 | d_pwexpire='' | |
471 | d_pwquota='' | |
472 | i_pwd='' | |
760ac839 | 473 | i_sfio='' |
2304df62 | 474 | i_stddef='' |
a0d0e21e | 475 | i_stdlib='' |
2304df62 AD |
476 | i_string='' |
477 | strings='' | |
478 | i_sysdir='' | |
479 | i_sysfile='' | |
480 | d_voidtty='' | |
481 | i_bsdioctl='' | |
a0d0e21e | 482 | i_sysfilio='' |
2304df62 AD |
483 | i_sysioctl='' |
484 | i_syssockio='' | |
485 | i_sysndir='' | |
a0d0e21e | 486 | i_sysparam='' |
8ff267be | 487 | i_sysresrc='' |
2304df62 | 488 | i_sysselct='' |
1aef975c | 489 | i_sysstat='' |
a0d0e21e | 490 | i_systimes='' |
fed7345c | 491 | i_systypes='' |
25f94b33 | 492 | i_sysun='' |
8ff267be | 493 | i_syswait='' |
2304df62 AD |
494 | i_sgtty='' |
495 | i_termio='' | |
496 | i_termios='' | |
497 | i_systime='' | |
498 | i_systimek='' | |
499 | i_time='' | |
500 | timeincl='' | |
85e6fe83 | 501 | i_unistd='' |
2304df62 | 502 | i_utime='' |
760ac839 | 503 | i_values='' |
a0d0e21e | 504 | i_stdarg='' |
2304df62 AD |
505 | i_varargs='' |
506 | i_varhdr='' | |
507 | i_vfork='' | |
508 | intsize='' | |
2304df62 | 509 | libc='' |
8ff267be | 510 | libperl='' |
2afac517 | 511 | shrpenv='' |
8ff267be | 512 | useshrplib='' |
a0d0e21e | 513 | glibpth='' |
2304df62 | 514 | libpth='' |
8e07c86e | 515 | loclibpth='' |
2304df62 AD |
516 | plibpth='' |
517 | xlibpth='' | |
518 | libs='' | |
85e6fe83 LW |
519 | lns='' |
520 | lseektype='' | |
8ff267be | 521 | make='' |
522 | make_set_make='' | |
85e6fe83 | 523 | d_mymalloc='' |
94b6baf5 | 524 | freetype='' |
2304df62 AD |
525 | mallocobj='' |
526 | mallocsrc='' | |
527 | malloctype='' | |
528 | usemymalloc='' | |
16d20bd9 AD |
529 | installman1dir='' |
530 | man1dir='' | |
531 | man1direxp='' | |
532 | man1ext='' | |
533 | installman3dir='' | |
534 | man3dir='' | |
535 | man3direxp='' | |
536 | man3ext='' | |
2304df62 AD |
537 | huge='' |
538 | large='' | |
539 | medium='' | |
540 | models='' | |
541 | small='' | |
542 | split='' | |
a0d0e21e | 543 | modetype='' |
2304df62 AD |
544 | mydomain='' |
545 | myhostname='' | |
546 | phostname='' | |
547 | c='' | |
548 | n='' | |
8e07c86e AD |
549 | d_eofnblk='' |
550 | eagain='' | |
551 | o_nonblock='' | |
552 | rd_nodata='' | |
2304df62 AD |
553 | groupcat='' |
554 | hostcat='' | |
555 | passcat='' | |
4633a7c4 LW |
556 | d_oldarchlib='' |
557 | oldarchlib='' | |
558 | oldarchlibexp='' | |
85e6fe83 LW |
559 | orderlib='' |
560 | ranlib='' | |
2304df62 AD |
561 | package='' |
562 | spackage='' | |
2c7991dc | 563 | pager='' |
ecfc5424 | 564 | patchlevel='' |
760ac839 | 565 | subversion='' |
8e07c86e | 566 | perladmin='' |
4633a7c4 | 567 | perlpath='' |
a0d0e21e | 568 | prefix='' |
1aef975c | 569 | prefixexp='' |
2304df62 AD |
570 | installprivlib='' |
571 | privlib='' | |
572 | privlibexp='' | |
573 | prototype='' | |
574 | randbits='' | |
575 | installscript='' | |
576 | scriptdir='' | |
577 | scriptdirexp='' | |
a0d0e21e | 578 | selecttype='' |
8ff267be | 579 | sh='' |
2304df62 | 580 | sig_name='' |
8e07c86e | 581 | sig_num='' |
4633a7c4 LW |
582 | installsitearch='' |
583 | sitearch='' | |
584 | sitearchexp='' | |
25f94b33 AD |
585 | installsitelib='' |
586 | sitelib='' | |
587 | sitelibexp='' | |
a0d0e21e LW |
588 | sizetype='' |
589 | so='' | |
2304df62 AD |
590 | sharpbang='' |
591 | shsharp='' | |
592 | spitshell='' | |
a0d0e21e | 593 | ssizetype='' |
4633a7c4 | 594 | startperl='' |
2304df62 AD |
595 | startsh='' |
596 | stdchar='' | |
597 | sysman='' | |
598 | uidtype='' | |
599 | nm_opt='' | |
40a7a20a | 600 | nm_so_opt='' |
2304df62 AD |
601 | runnm='' |
602 | usenm='' | |
8ff267be | 603 | useperlio='' |
2304df62 AD |
604 | incpath='' |
605 | mips='' | |
606 | mips_type='' | |
607 | usrinc='' | |
608 | defvoidused='' | |
609 | voidflags='' | |
2304df62 AD |
610 | CONFIG='' |
611 | ||
ecfc5424 AD |
612 | define='define' |
613 | undef='undef' | |
614 | smallmach='pdp11 i8086 z8000 i80286 iAPX286' | |
615 | rmlist='' | |
616 | ||
617 | : We must find out about Eunice early | |
618 | eunicefix=':' | |
619 | if test -f /etc/unixtovms; then | |
620 | eunicefix=/etc/unixtovms | |
621 | fi | |
622 | if test -f /etc/unixtovms.exe; then | |
623 | eunicefix=/etc/unixtovms.exe | |
624 | fi | |
625 | ||
626 | : list of known cpp symbols, sorted alphabetically | |
627 | al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2" | |
628 | al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH" | |
629 | al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS" | |
630 | al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM" | |
631 | al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX" | |
632 | al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX" | |
633 | al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4" | |
634 | al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300" | |
635 | al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek" | |
636 | al="$al VMS Xenix286" | |
637 | al="$al _AIX _AIX32 _AIX370 _AM29000 _COFF _CRAY _CX_UX _EPI" | |
638 | al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET" | |
639 | al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3" | |
640 | al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000" | |
641 | al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4" | |
642 | al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS" | |
643 | al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__" | |
644 | al="$al __DGUX__ __DPX2__ __H3050R __H3050RX" | |
645 | al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__" | |
646 | al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__" | |
647 | al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__" | |
648 | al="$al __SVR4_2__ __UMAXV__" | |
649 | al="$al ____386BSD____ __alpha __alpha__ __amiga" | |
650 | al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__" | |
651 | al="$al __host_mips__" | |
652 | al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500" | |
653 | al="$al __hp9000s500 __hp9000s700 __hp9000s800" | |
654 | al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__" | |
655 | al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__" | |
656 | al="$al __m68k __m68k__ __m88100__ __m88k __m88k__" | |
657 | al="$al __mc68000 __mc68000__ __mc68020 __mc68020__" | |
658 | al="$al __mc68030 __mc68030__ __mc68040 __mc68040__" | |
659 | al="$al __mc88100 __mc88100__ __mips __mips__" | |
660 | al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__" | |
661 | al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__" | |
662 | al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__" | |
663 | al="$al _host_mips _mips _unix" | |
664 | al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent" | |
665 | al="$al apollo ardent att386 att3b" | |
666 | al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull" | |
667 | al="$al cadmus clipper concurrent convex cray ctix" | |
668 | al="$al dmert encore gcos gcx gimpel gould" | |
669 | al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800" | |
670 | al="$al hp9000 hp9000s300 hp9000s400 hp9000s500" | |
671 | al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux" | |
672 | al="$al i186 i286 i386 i486 i8086" | |
673 | al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k" | |
674 | al="$al ksr1 linux luna luna88k m68k m88100 m88k" | |
675 | al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030" | |
676 | al="$al mc68040 mc68060 mc68k mc68k32 mc700" | |
677 | al="$al mc88000 mc88100 merlin mert mips mvs n16" | |
678 | al="$al ncl_el ncl_mr" | |
679 | al="$al news1500 news1700 news1800 news1900 news3700" | |
680 | al="$al news700 news800 news900 ns16000 ns32000" | |
681 | al="$al ns32016 ns32332 ns32k nsc32000 os osf" | |
682 | al="$al parisc pc532 pdp11 plexus posix pyr" | |
683 | al="$al riscix riscos scs sequent sgi sinix sony sony_news" | |
684 | al="$al sonyrisc sparc sparclite spectrum stardent stratos" | |
685 | al="$al sun sun3 sun386 svr4 sysV68 sysV88" | |
686 | al="$al titan tower tower32 tower32_200 tower32_600 tower32_700" | |
687 | al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200" | |
688 | al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms" | |
689 | al="$al xenix z8000" | |
690 | ||
ecfc5424 AD |
691 | groupstype='' |
692 | i_whoami='' | |
8e07c86e AD |
693 | : default library list |
694 | libswanted='' | |
695 | : set useposix=false in your hint file to disable the POSIX extension. | |
696 | useposix=true | |
8ff267be | 697 | : set useopcode=false in your hint file to disable the Opcode extension. |
698 | useopcode=true | |
40a7a20a | 699 | : Define several unixisms. These can be used in hint files. |
25f94b33 AD |
700 | exe_ext='' |
701 | : Extra object files, if any, needed on this platform. | |
702 | archobjs='' | |
8e07c86e | 703 | : Possible local include directories to search. |
25f94b33 | 704 | : Set locincpth to "" in a hint file to defeat local include searches. |
8e07c86e AD |
705 | locincpth="/usr/local/include /opt/local/include /usr/gnu/include" |
706 | locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include" | |
707 | : | |
708 | : no include file wanted by default | |
709 | inclwanted='' | |
710 | ||
ecfc5424 AD |
711 | : change the next line if compiling for Xenix/286 on Xenix/386 |
712 | xlibpth='/usr/lib/386 /lib/386' | |
713 | ||
8e07c86e AD |
714 | : Possible local library directories to search. |
715 | loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib" | |
716 | loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib" | |
717 | ||
ecfc5424 | 718 | : general looking path for locating libraries |
4b40f7a3 SV |
719 | glibpth="/shlib /usr/shlib /lib/pa1.1 /usr/lib/large" |
720 | glibpth="$glibpth /lib /usr/lib $xlibpth" | |
721 | glibpth="$glibpth /lib/large /usr/lib/small /lib/small" | |
722 | glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib" | |
ecfc5424 AD |
723 | |
724 | : Private path used by Configure to find libraries. Its value | |
725 | : is prepended to libpth. This variable takes care of special | |
726 | : machines, like the mips. Usually, it should be empty. | |
727 | plibpth='' | |
728 | ||
ecfc5424 AD |
729 | : full support for void wanted by default |
730 | defvoidused=15 | |
731 | ||
ecfc5424 | 732 | : List of libraries we want. |
760ac839 | 733 | libswanted='sfio net socket inet nsl nm ndbm gdbm dbm db malloc dl' |
ecfc5424 AD |
734 | libswanted="$libswanted dld ld sun m c cposix posix ndir dir crypt" |
735 | libswanted="$libswanted ucb bsd BSD PW x" | |
1aef975c | 736 | : We probably want to search /usr/shlib before most other libraries. |
94b6baf5 | 737 | : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist. |
ecfc5424 AD |
738 | glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'` |
739 | glibpth="/usr/shlib $glibpth" | |
740 | : Do not use vfork unless overridden by a hint file. | |
741 | usevfork=false | |
742 | ||
8ff267be | 743 | : Find the basic shell for Bourne shell scripts |
744 | case "$sh" in | |
745 | '') | |
746 | : SYSTYPE is for some older MIPS systems. | |
747 | : I do not know if it is still needed. | |
748 | case "$SYSTYPE" in | |
749 | *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";; | |
750 | *) xxx='/bin/sh';; | |
751 | esac | |
752 | if test -f "$xxx"; then | |
753 | sh="$xxx" | |
754 | else | |
755 | : Build up a list and do a single loop so we can 'break' out. | |
756 | pth=`echo $PATH | sed -e "s/$p_/ /g"` | |
757 | for xxx in sh bash ksh pdksh ash; do | |
758 | for p in $pth; do | |
759 | try="$try ${p}/${xxx}" | |
760 | done | |
761 | done | |
762 | for xxx in $try; do | |
763 | if test -f "$xxx"; then | |
764 | sh="$xxx"; | |
765 | echo "Your Bourne shell appears to be in $sh." | |
766 | break | |
767 | elif test -f "$xxx.exe"; then | |
768 | sh="$xxx"; | |
769 | echo "Hmm. Your Bourne shell appears to be in $sh." | |
770 | break | |
771 | fi | |
772 | done | |
773 | fi | |
774 | ;; | |
775 | esac | |
776 | ||
777 | case "$sh" in | |
778 | '') cat <<EOM >&2 | |
779 | $me: Fatal Error: I can't find a Bourne Shell anywhere. | |
780 | Usually it's in /bin/sh. How did you even get this far? | |
5f05dabc | 781 | Please contact me (Chip Salzenberg) at chip@atlantic.net and |
8ff267be | 782 | we'll try to straigten this all out. |
783 | EOM | |
784 | exit 1 | |
785 | ;; | |
786 | esac | |
787 | ||
760ac839 | 788 | : see if sh knows # comments |
8ff267be | 789 | if `$sh -c '#' >/dev/null 2>&1`; then |
760ac839 LW |
790 | shsharp=true |
791 | spitshell=cat | |
792 | echo " " | |
760ac839 LW |
793 | xcat=/bin/cat |
794 | test -f $xcat || xcat=/usr/bin/cat | |
795 | echo "#!$xcat" >try | |
796 | $eunicefix try | |
797 | chmod +x try | |
798 | ./try > today | |
799 | if test -s today; then | |
760ac839 LW |
800 | sharpbang='#!' |
801 | else | |
802 | echo "#! $xcat" > try | |
803 | $eunicefix try | |
804 | chmod +x try | |
805 | ./try > today | |
806 | if test -s today; then | |
760ac839 LW |
807 | sharpbang='#! ' |
808 | else | |
8ff267be | 809 | echo "Okay, let's see if #! works on this system..." |
760ac839 LW |
810 | echo "It's just a comment." |
811 | sharpbang=': use ' | |
812 | fi | |
813 | fi | |
814 | else | |
8ff267be | 815 | echo "Your $sh doesn't grok # comments--I will strip them later on." |
760ac839 LW |
816 | shsharp=false |
817 | cd .. | |
818 | echo "exec grep -v '^[ ]*#'" >spitshell | |
819 | chmod +x spitshell | |
820 | $eunicefix spitshell | |
821 | spitshell=`pwd`/spitshell | |
822 | cd UU | |
823 | echo "I presume that if # doesn't work, #! won't work either!" | |
824 | sharpbang=': use ' | |
825 | fi | |
826 | rm -f try today | |
827 | ||
828 | : figure out how to guarantee sh startup | |
8ff267be | 829 | case "$startsh" in |
830 | '') startsh=${sharpbang}${sh} ;; | |
831 | *) | |
760ac839 | 832 | esac |
760ac839 LW |
833 | cat >try <<EOSS |
834 | $startsh | |
835 | set abc | |
836 | test "$?abc" != 1 | |
837 | EOSS | |
838 | ||
839 | chmod +x try | |
840 | $eunicefix try | |
841 | if ./try; then | |
8ff267be | 842 | : echo "Yup, it does." |
760ac839 | 843 | else |
8ff267be | 844 | echo "Hmm. '$startsh' didn't work." |
845 | echo "You may have to fix up the shell scripts to make sure sh runs them." | |
760ac839 LW |
846 | fi |
847 | rm -f try | |
848 | ||
2304df62 | 849 | : script used to extract .SH files with variable substitutions |
760ac839 LW |
850 | cat >extract <<EOS |
851 | $startsh | |
852 | EOS | |
853 | cat >>extract <<'EOS' | |
2304df62 AD |
854 | CONFIG=true |
855 | echo "Doing variable substitutions on .SH files..." | |
856 | if test -f MANIFEST; then | |
5f05dabc | 857 | shlist=`awk '{print $1}' <MANIFEST | grep '\.SH'` |
a0d0e21e LW |
858 | : Pick up possible extension manifests. |
859 | for dir in ext/* ; do | |
860 | if test -f $dir/MANIFEST; then | |
5f05dabc | 861 | xxx=`awk '{print $1}' < $dir/MANIFEST | |
a0d0e21e LW |
862 | sed -n "/\.SH$/ s@^@$dir/@p"` |
863 | shlist="$shlist $xxx" | |
864 | fi | |
865 | done | |
866 | set x $shlist | |
2304df62 AD |
867 | else |
868 | echo "(Looking for .SH files under the current directory.)" | |
5f05dabc | 869 | set x `find . -name "*.SH" -print` |
2304df62 AD |
870 | fi |
871 | shift | |
872 | case $# in | |
873 | 0) set x *.SH; shift;; | |
874 | esac | |
875 | if test ! -f $1; then | |
876 | shift | |
877 | fi | |
878 | for file in $*; do | |
879 | case "$file" in | |
880 | */*) | |
881 | dir=`expr X$file : 'X\(.*\)/'` | |
882 | file=`expr X$file : 'X.*/\(.*\)'` | |
883 | (cd $dir && . ./$file) | |
884 | ;; | |
885 | *) | |
886 | . ./$file | |
887 | ;; | |
888 | esac | |
889 | done | |
890 | if test -f config_h.SH; then | |
891 | if test ! -f config.h; then | |
892 | : oops, they left it out of MANIFEST, probably, so do it anyway. | |
893 | . ./config_h.SH | |
894 | fi | |
895 | fi | |
896 | EOS | |
897 | ||
898 | : produce awk script to parse command line options | |
899 | cat >options.awk <<'EOF' | |
900 | BEGIN { | |
16d20bd9 | 901 | optstr = "dD:eEf:hKOrsSU:V"; # getopt-style specification |
2304df62 AD |
902 | |
903 | len = length(optstr); | |
904 | for (i = 1; i <= len; i++) { | |
905 | c = substr(optstr, i, 1); | |
906 | if (i < len) a = substr(optstr, i + 1, 1); else a = ""; | |
907 | if (a == ":") { | |
908 | arg[c] = 1; | |
909 | i++; | |
910 | } | |
911 | opt[c] = 1; | |
912 | } | |
913 | } | |
914 | { | |
915 | expect = 0; | |
916 | str = $0; | |
917 | if (substr(str, 1, 1) != "-") { | |
918 | printf("'%s'\n", str); | |
919 | next; | |
920 | } | |
921 | len = length($0); | |
922 | for (i = 2; i <= len; i++) { | |
923 | c = substr(str, i, 1); | |
924 | if (!opt[c]) { | |
925 | printf("-%s\n", substr(str, i)); | |
926 | next; | |
927 | } | |
928 | printf("-%s\n", c); | |
929 | if (arg[c]) { | |
930 | if (i < len) | |
931 | printf("'%s'\n", substr(str, i + 1)); | |
932 | else | |
933 | expect = 1; | |
934 | next; | |
935 | } | |
936 | } | |
937 | } | |
938 | END { | |
939 | if (expect) | |
940 | print "?"; | |
941 | } | |
942 | EOF | |
943 | ||
944 | : process the command line options | |
4633a7c4 LW |
945 | set X `for arg in "$@"; do echo "X$arg"; done | |
946 | sed -e s/X// | awk -f options.awk` | |
2304df62 AD |
947 | eval "set $*" |
948 | shift | |
949 | rm -f options.awk | |
950 | ||
951 | : set up default values | |
952 | fastread='' | |
953 | reuseval=false | |
954 | config_sh='' | |
955 | alldone='' | |
956 | error='' | |
957 | silent='' | |
958 | extractsh='' | |
ecfc5424 | 959 | override='' |
16d20bd9 | 960 | knowitall='' |
28757baa | 961 | |
1aef975c | 962 | rm -f optdef.sh |
28757baa | 963 | cat >optdef.sh <<EOS |
964 | $startsh | |
965 | EOS | |
2304df62 AD |
966 | |
967 | : option parsing | |
968 | while test $# -gt 0; do | |
969 | case "$1" in | |
970 | -d) shift; fastread=yes;; | |
971 | -e) shift; alldone=cont;; | |
972 | -f) | |
973 | shift | |
974 | cd .. | |
975 | if test -r "$1"; then | |
976 | config_sh="$1" | |
977 | else | |
a0d0e21e | 978 | echo "$me: cannot read config file $1." >&2 |
2304df62 AD |
979 | error=true |
980 | fi | |
981 | cd UU | |
982 | shift;; | |
983 | -h) shift; error=true;; | |
984 | -r) shift; reuseval=true;; | |
985 | -s) shift; silent=true;; | |
986 | -E) shift; alldone=exit;; | |
16d20bd9 | 987 | -K) shift; knowitall=true;; |
ecfc5424 | 988 | -O) shift; override=true;; |
2304df62 | 989 | -S) shift; extractsh=true;; |
a0d0e21e LW |
990 | -D) |
991 | shift | |
992 | case "$1" in | |
993 | *=) | |
994 | echo "$me: use '-U symbol=', not '-D symbol='." >&2 | |
995 | echo "$me: ignoring -D $1" >&2 | |
996 | ;; | |
ecfc5424 | 997 | *=*) echo "$1" | \ |
1aef975c AD |
998 | sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;; |
999 | *) echo "$1='define'" >> optdef.sh;; | |
a0d0e21e LW |
1000 | esac |
1001 | shift | |
1002 | ;; | |
1003 | -U) | |
1004 | shift | |
1005 | case "$1" in | |
1aef975c | 1006 | *=) echo "$1" >> optdef.sh;; |
a0d0e21e LW |
1007 | *=*) |
1008 | echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2 | |
1009 | echo "$me: ignoring -U $1" >&2 | |
1010 | ;; | |
1aef975c | 1011 | *) echo "$1='undef'" >> optdef.sh;; |
a0d0e21e LW |
1012 | esac |
1013 | shift | |
1014 | ;; | |
2c7991dc | 1015 | -V) echo "$me generated by metaconfig 3.0 PL60." >&2 |
2304df62 AD |
1016 | exit 0;; |
1017 | --) break;; | |
a0d0e21e | 1018 | -*) echo "$me: unknown option $1" >&2; shift; error=true;; |
2304df62 AD |
1019 | *) break;; |
1020 | esac | |
1021 | done | |
1022 | ||
1023 | case "$error" in | |
1024 | true) | |
1025 | cat >&2 <<EOM | |
2afac517 | 1026 | Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value] |
a0d0e21e | 1027 | [-U symbol] [-U symbol=] |
2304df62 AD |
1028 | -d : use defaults for all answers. |
1029 | -e : go on without questioning past the production of config.sh. | |
1030 | -f : specify an alternate default configuration file. | |
1031 | -h : print this help message and exit (with an error status). | |
1032 | -r : reuse C symbols value if possible (skips costly nm extraction). | |
1033 | -s : silent mode, only echoes questions and essential information. | |
a0d0e21e LW |
1034 | -D : define symbol to have some value: |
1035 | -D symbol symbol gets the value 'define' | |
1036 | -D symbol=value symbol gets the value 'value' | |
2304df62 | 1037 | -E : stop at the end of questions, after having produced config.sh. |
16d20bd9 | 1038 | -K : do not use unless you know what you are doing. |
ecfc5424 | 1039 | -O : let -D and -U override definitions from loaded configuration file. |
2304df62 | 1040 | -S : perform variable substitutions on all .SH files (can mix with -f) |
a0d0e21e LW |
1041 | -U : undefine symbol: |
1042 | -U symbol symbol gets the value 'undef' | |
1043 | -U symbol= symbol gets completely empty | |
2304df62 AD |
1044 | -V : print version number and exit (with a zero status). |
1045 | EOM | |
1046 | exit 1 | |
1047 | ;; | |
1048 | esac | |
1049 | ||
1050 | exec 4>&1 | |
1051 | case "$silent" in | |
1052 | true) exec 1>/dev/null;; | |
1053 | esac | |
1054 | ||
ecfc5424 | 1055 | : run the defines and the undefines, if any, but leave the file out there... |
1aef975c AD |
1056 | touch optdef.sh |
1057 | . ./optdef.sh | |
a0d0e21e | 1058 | |
2304df62 AD |
1059 | case "$extractsh" in |
1060 | true) | |
1061 | case "$config_sh" in | |
1062 | '') config_sh='config.sh'; config='./config.sh';; | |
1063 | /*) config="$config_sh";; | |
1064 | *) config="./$config_sh";; | |
1065 | esac | |
1066 | echo " " | |
1067 | echo "Fetching answers from $config_sh..." | |
1068 | cd .. | |
1069 | . $config | |
1aef975c | 1070 | test "$override" && . ./optdef.sh |
2304df62 AD |
1071 | echo " " |
1072 | . ./UU/extract | |
1073 | rm -rf UU | |
1074 | echo "Done." | |
1075 | exit 0 | |
1076 | ;; | |
1077 | esac | |
1078 | ||
1079 | : set package name | |
85e6fe83 | 1080 | package=perl5 |
1aef975c AD |
1081 | first=`echo $package | sed -e 's/^\(.\).*/\1/'` |
1082 | last=`echo $package | sed -e 's/^.\(.*\)/\1/'` | |
1083 | case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in | |
1084 | ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;; | |
1085 | *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;; | |
1086 | esac | |
2304df62 AD |
1087 | |
1088 | : Eunice requires " " instead of "", can you believe it | |
1089 | echo " " | |
1090 | : Here we go... | |
1091 | echo "Beginning of configuration questions for $package." | |
1092 | ||
1aef975c | 1093 | trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15 |
2304df62 | 1094 | |
2304df62 AD |
1095 | : Some greps do not return status, grrr. |
1096 | echo "grimblepritz" >grimble | |
1097 | if grep blurfldyick grimble >/dev/null 2>&1 ; then | |
1098 | contains=contains | |
1099 | elif grep grimblepritz grimble >/dev/null 2>&1 ; then | |
1100 | contains=grep | |
1101 | else | |
1102 | contains=contains | |
1103 | fi | |
1104 | rm -f grimble | |
1105 | : the following should work in any shell | |
1106 | case "$contains" in | |
1107 | contains*) | |
1108 | echo " " | |
1109 | echo "AGH! Grep doesn't return a status. Attempting remedial action." | |
1110 | cat >contains <<'EOSS' | |
1111 | grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp | |
1112 | EOSS | |
1113 | chmod +x contains | |
1114 | esac | |
1115 | ||
1116 | : first determine how to suppress newline on echo command | |
1117 | echo " " | |
1118 | echo "Checking echo to see how to suppress newlines..." | |
1119 | (echo "hi there\c" ; echo " ") >.echotmp | |
1120 | if $contains c .echotmp >/dev/null 2>&1 ; then | |
1121 | echo "...using -n." | |
1122 | n='-n' | |
1123 | c='' | |
1124 | else | |
1125 | cat <<'EOM' | |
1126 | ...using \c | |
1127 | EOM | |
1128 | n='' | |
1129 | c='\c' | |
1130 | fi | |
1131 | echo $n "The star should be here-->$c" | |
1132 | echo '*' | |
1133 | rm -f .echotmp | |
1134 | ||
1135 | : Now test for existence of everything in MANIFEST | |
1136 | echo " " | |
1137 | if test -f ../MANIFEST; then | |
1138 | echo "First let's make sure your kit is complete. Checking..." >&4 | |
1139 | awk '$1 !~ /PACK[A-Z]+/ {print $1}' ../MANIFEST | split -50 | |
1140 | rm -f missing | |
1141 | for filelist in x??; do | |
1142 | (cd ..; ls `cat UU/$filelist` >/dev/null 2>>UU/missing) | |
1143 | done | |
1144 | if test -s missing; then | |
1145 | cat missing >&4 | |
1146 | cat >&4 <<'EOM' | |
1147 | ||
1148 | THIS PACKAGE SEEMS TO BE INCOMPLETE. | |
1149 | ||
1150 | You have the option of continuing the configuration process, despite the | |
1151 | distinct possibility that your kit is damaged, by typing 'y'es. If you | |
1152 | do, don't blame me if something goes wrong. I advise you to type 'n'o | |
5f05dabc | 1153 | and contact the author (chip@atlantic.net). |
2304df62 AD |
1154 | |
1155 | EOM | |
1156 | echo $n "Continue? [n] $c" >&4 | |
1157 | read ans | |
1158 | case "$ans" in | |
1159 | y*) | |
1160 | echo "Continuing..." >&4 | |
1161 | rm -f missing | |
1162 | ;; | |
1163 | *) | |
1164 | echo "ABORTING..." >&4 | |
1165 | kill $$ | |
1166 | ;; | |
1167 | esac | |
1168 | else | |
1169 | echo "Looks good..." >&4 | |
1170 | fi | |
1171 | else | |
1172 | echo "There is no MANIFEST file. I hope your kit is complete !" | |
1173 | fi | |
1174 | rm -f missing x?? | |
1175 | ||
1176 | : compute the number of columns on the terminal for proper question formatting | |
1177 | case "$COLUMNS" in | |
1178 | '') COLUMNS='80';; | |
1179 | esac | |
1180 | ||
1181 | : set up the echo used in my read | |
1182 | myecho="case \"\$xxxm\" in | |
1183 | '') echo $n \"\$rp $c\" >&4;; | |
1184 | *) case \"\$rp\" in | |
1185 | '') echo $n \"[\$xxxm] $c\";; | |
1186 | *) | |
1187 | if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then | |
1188 | echo \"\$rp\" >&4 | |
1189 | echo $n \"[\$xxxm] $c\" >&4 | |
1190 | else | |
1191 | echo $n \"\$rp [\$xxxm] $c\" >&4 | |
1192 | fi | |
1193 | ;; | |
1194 | esac;; | |
1195 | esac" | |
1196 | ||
1197 | : now set up to do reads with possible shell escape and default assignment | |
1198 | cat <<EOSC >myread | |
28757baa | 1199 | $startsh |
2304df62 AD |
1200 | xxxm=\$dflt |
1201 | $myecho | |
1202 | ans='!' | |
1203 | case "\$fastread" in | |
1204 | yes) case "\$dflt" in | |
1205 | '') ;; | |
1206 | *) ans=''; | |
1207 | case "\$silent-\$rp" in | |
1208 | true-) ;; | |
1209 | *) echo " " >&4;; | |
1210 | esac;; | |
1211 | esac;; | |
1212 | *) case "\$silent" in | |
1213 | true) case "\$rp" in | |
1214 | '') ans='';; | |
1215 | esac;; | |
1216 | esac;; | |
1217 | esac | |
1218 | while expr "X\$ans" : "X!" >/dev/null; do | |
1219 | read answ | |
1220 | set x \$xxxm | |
1221 | shift | |
1222 | aok=''; eval "ans=\"\$answ\"" && aok=y | |
1223 | case "\$answ" in | |
1224 | "\$ans") | |
1225 | case "\$ans" in | |
ecfc5424 AD |
1226 | \\&*) |
1227 | set x \`expr "X\$ans" : "X&\(.*\)\$"\` | |
1228 | shift | |
1229 | case "\$1" in | |
1230 | -d) | |
1231 | fastread=yes | |
40a7a20a | 1232 | echo "(OK, I'll run with -d after this question.)" >&4 |
ecfc5424 AD |
1233 | ;; |
1234 | -*) | |
40a7a20a | 1235 | echo "*** Sorry, \$1 not supported yet." >&4 |
ecfc5424 AD |
1236 | ;; |
1237 | esac | |
1238 | $myecho | |
1239 | ans=! | |
1240 | ;; | |
2304df62 AD |
1241 | "!") |
1242 | sh 1>&4 | |
1243 | echo " " | |
1244 | $myecho | |
1245 | ;; | |
1246 | !*) | |
1247 | set x \`expr "X\$ans" : "X!\(.*\)\$"\` | |
1248 | shift | |
1249 | sh 1>&4 -c "\$*" | |
1250 | echo " " | |
1251 | $myecho | |
1252 | ;; | |
1253 | esac;; | |
1254 | *) | |
1255 | case "\$aok" in | |
1256 | y) | |
1257 | echo "*** Substitution done -- please confirm." | |
1258 | xxxm="\$ans" | |
1259 | ans=\`echo $n "\$ans$c" | tr '\012' ' '\` | |
1260 | xxxm="\$ans" | |
1261 | ans=! | |
1262 | ;; | |
1263 | *) | |
1264 | echo "*** Error -- try again." | |
1265 | ans=! | |
1266 | ;; | |
1267 | esac | |
1268 | $myecho | |
1269 | ;; | |
1270 | esac | |
1271 | case "\$ans\$xxxm\$nostick" in | |
1272 | '') | |
1273 | ans=! | |
1274 | $myecho | |
1275 | ;; | |
1276 | esac | |
1277 | done | |
1278 | case "\$ans" in | |
1279 | '') ans="\$xxxm";; | |
1280 | esac | |
1281 | EOSC | |
1282 | ||
1283 | : create .config dir to save info across Configure sessions | |
1284 | test -d ../.config || mkdir ../.config | |
1285 | cat >../.config/README <<EOF | |
1286 | This directory created by Configure to save information that should | |
1287 | persist across sessions. | |
1288 | ||
1289 | You may safely delete it if you wish. | |
1290 | EOF | |
1291 | ||
1292 | : general instructions | |
1293 | needman=true | |
1294 | firsttime=true | |
760ac839 LW |
1295 | user=`(logname) 2>/dev/null` |
1296 | case "$user" in "") | |
1297 | user=`whoami 2>&1` ;; | |
1298 | esac | |
2304df62 AD |
1299 | if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then |
1300 | firsttime=false | |
1301 | echo " " | |
1302 | rp='Would you like to see the instructions?' | |
1303 | dflt=n | |
1304 | . ./myread | |
1305 | case "$ans" in | |
1306 | [yY]*) ;; | |
1307 | *) needman=false;; | |
1308 | esac | |
1309 | fi | |
1310 | if $needman; then | |
1311 | cat <<EOH | |
1312 | ||
1313 | This installation shell script will examine your system and ask you questions | |
a0d0e21e | 1314 | to determine how the perl5 package should be installed. If you get |
2304df62 AD |
1315 | stuck on a question, you may use a ! shell escape to start a subshell or |
1316 | execute a command. Many of the questions will have default answers in square | |
1317 | brackets; typing carriage return will give you the default. | |
1318 | ||
1319 | On some of the questions which ask for file or directory names you are allowed | |
1320 | to use the ~name construct to specify the login directory belonging to "name", | |
1321 | even if you don't have a shell which knows about that. Questions where this is | |
1322 | allowed will be marked "(~name ok)". | |
1323 | ||
1324 | EOH | |
1325 | rp='' | |
1326 | dflt='Type carriage return to continue' | |
1327 | . ./myread | |
1328 | cat <<'EOH' | |
1329 | ||
1330 | The prompter used in this script allows you to use shell variables and | |
1331 | backticks in your answers. You may use $1, $2, etc... to refer to the words | |
1332 | in the default answer, as if the default line was a set of arguments given to a | |
1333 | script shell. This means you may also use $* to repeat the whole default line, | |
1334 | so you do not have to re-type everything to add something to the default. | |
1335 | ||
1336 | Everytime there is a substitution, you will have to confirm. If there is an | |
1337 | error (e.g. an unmatched backtick), the default answer will remain unchanged | |
1338 | and you will be prompted again. | |
1339 | ||
1340 | If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all | |
1341 | the questions and use the computed defaults (or the previous answers if there | |
1342 | was already a config.sh file). Type 'Configure -h' for a list of options. | |
ecfc5424 AD |
1343 | You may also start interactively and then answer '& -d' at any prompt to turn |
1344 | on the non-interactive behaviour for the remaining of the execution. | |
2304df62 AD |
1345 | |
1346 | EOH | |
1347 | . ./myread | |
1348 | cat <<EOH | |
1349 | ||
1350 | Much effort has been expended to ensure that this shell script will run on any | |
1351 | Unix system. If despite that it blows up on yours, your best bet is to edit | |
40000a8c AD |
1352 | Configure and run it again. If you can't run Configure for some reason, |
1353 | you'll have to generate a config.sh file by hand. Whatever problems you | |
5f05dabc | 1354 | have, let me (chip@atlantic.net) know how I blew it. |
2304df62 AD |
1355 | |
1356 | This installation script affects things in two ways: | |
1357 | ||
1358 | 1) it may do direct variable substitutions on some of the files included | |
1359 | in this kit. | |
1360 | 2) it builds a config.h file for inclusion in C programs. You may edit | |
1361 | any of these files as the need arises after running this script. | |
1362 | ||
1363 | If you make a mistake on a question, there is no easy way to back up to it | |
1364 | currently. The easiest thing to do is to edit config.sh and rerun all the SH | |
1365 | files. Configure will offer to let you do this before it runs the SH files. | |
1366 | ||
1367 | EOH | |
1368 | dflt='Type carriage return to continue' | |
1369 | . ./myread | |
1370 | case "$firsttime" in | |
1371 | true) echo $user >>../.config/instruct;; | |
1372 | esac | |
1373 | fi | |
1374 | ||
2304df62 AD |
1375 | : find out where common programs are |
1376 | echo " " | |
1377 | echo "Locating common programs..." >&4 | |
1378 | cat <<EOSC >loc | |
1379 | $startsh | |
1380 | case \$# in | |
1381 | 0) exit 1;; | |
1382 | esac | |
1383 | thing=\$1 | |
1384 | shift | |
1385 | dflt=\$1 | |
1386 | shift | |
1387 | for dir in \$*; do | |
1388 | case "\$thing" in | |
1389 | .) | |
1390 | if test -d \$dir/\$thing; then | |
1391 | echo \$dir | |
1392 | exit 0 | |
1393 | fi | |
1394 | ;; | |
1395 | *) | |
a0d0e21e | 1396 | for thisthing in \$dir/\$thing; do |
ecfc5424 | 1397 | : just loop through to pick last item |
a0d0e21e | 1398 | done |
25f94b33 | 1399 | if test -f \$thisthing; then |
a0d0e21e | 1400 | echo \$thisthing |
2304df62 AD |
1401 | exit 0 |
1402 | elif test -f \$dir/\$thing.exe; then | |
1403 | : on Eunice apparently | |
1404 | echo \$dir/\$thing | |
1405 | exit 0 | |
1406 | fi | |
1407 | ;; | |
1408 | esac | |
1409 | done | |
1410 | echo \$dflt | |
1411 | exit 1 | |
1412 | EOSC | |
1413 | chmod +x loc | |
1414 | $eunicefix loc | |
1415 | loclist=" | |
1416 | awk | |
1417 | cat | |
ecfc5424 | 1418 | comm |
2304df62 AD |
1419 | cp |
1420 | echo | |
1421 | expr | |
a0d0e21e | 1422 | find |
2304df62 | 1423 | grep |
a0d0e21e | 1424 | ls |
2304df62 | 1425 | mkdir |
2304df62 AD |
1426 | rm |
1427 | sed | |
1428 | sort | |
85e6fe83 | 1429 | touch |
2304df62 AD |
1430 | tr |
1431 | uniq | |
1432 | " | |
1433 | trylist=" | |
1434 | Mcc | |
2304df62 AD |
1435 | byacc |
1436 | cpp | |
1437 | csh | |
1438 | date | |
1439 | egrep | |
8ff267be | 1440 | gzip |
2c7991dc | 1441 | less |
2304df62 | 1442 | line |
8ff267be | 1443 | ln |
2c7991dc | 1444 | more |
2304df62 AD |
1445 | nroff |
1446 | perl | |
2c7991dc | 1447 | pg |
40a7a20a | 1448 | sendmail |
2304df62 AD |
1449 | test |
1450 | uname | |
8ff267be | 1451 | zip |
2304df62 | 1452 | " |
8e07c86e | 1453 | pth=`echo $PATH | sed -e "s/$p_/ /g"` |
2304df62 AD |
1454 | pth="$pth /lib /usr/lib" |
1455 | for file in $loclist; do | |
1456 | xxx=`./loc $file $file $pth` | |
1457 | eval $file=$xxx | |
1458 | eval _$file=$xxx | |
1459 | case "$xxx" in | |
1460 | /*) | |
1461 | echo $file is in $xxx. | |
1462 | ;; | |
8e07c86e AD |
1463 | ?:[\\/]*) |
1464 | echo $file is in $xxx. | |
1465 | ;; | |
2304df62 | 1466 | *) |
25f94b33 AD |
1467 | echo "I don't know where '$file' is, and my life depends on it." >&4 |
1468 | echo "Go find a public domain implementation or fix your PATH setting!" >&4 | |
4633a7c4 | 1469 | exit 1 |
2304df62 AD |
1470 | ;; |
1471 | esac | |
1472 | done | |
1473 | echo " " | |
1474 | echo "Don't worry if any of the following aren't found..." | |
1475 | say=offhand | |
1476 | for file in $trylist; do | |
1477 | xxx=`./loc $file $file $pth` | |
1478 | eval $file=$xxx | |
1479 | eval _$file=$xxx | |
1480 | case "$xxx" in | |
1481 | /*) | |
1482 | echo $file is in $xxx. | |
1483 | ;; | |
8e07c86e AD |
1484 | ?:[\\/]*) |
1485 | echo $file is in $xxx. | |
1486 | ;; | |
2304df62 AD |
1487 | *) |
1488 | echo "I don't see $file out there, $say." | |
1489 | say=either | |
1490 | ;; | |
1491 | esac | |
1492 | done | |
1493 | case "$egrep" in | |
1494 | egrep) | |
1495 | echo "Substituting grep for egrep." | |
1496 | egrep=$grep | |
1497 | ;; | |
1498 | esac | |
8ff267be | 1499 | case "$ln" in |
1500 | ln) | |
1501 | echo "Substituting cp for ln." | |
1502 | ln=$cp | |
1503 | ;; | |
1504 | esac | |
2304df62 AD |
1505 | case "$test" in |
1506 | test) | |
1507 | echo "Hopefully test is built into your sh." | |
1508 | ;; | |
1509 | *) | |
ecfc5424 | 1510 | if `sh -c "PATH= test true" >/dev/null 2>&1`; then |
2304df62 AD |
1511 | echo "Using the test built into your sh." |
1512 | test=test | |
1513 | _test=test | |
1514 | fi | |
1515 | ;; | |
1516 | esac | |
1517 | case "$echo" in | |
1518 | echo) | |
1519 | echo "Hopefully echo is built into your sh." | |
1520 | ;; | |
1521 | '') ;; | |
1522 | *) | |
1523 | echo " " | |
1524 | echo "Checking compatibility between $echo and builtin echo (if any)..." >&4 | |
1525 | $echo $n "hi there$c" >foo1 | |
1526 | echo $n "hi there$c" >foo2 | |
1527 | if cmp foo1 foo2 >/dev/null 2>&1; then | |
1528 | echo "They are compatible. In fact, they may be identical." | |
1529 | else | |
1530 | case "$n" in | |
1531 | '-n') n='' c='\c';; | |
1532 | *) n='-n' c='';; | |
1533 | esac | |
1534 | cat <<FOO | |
1535 | They are not compatible! You are probably running ksh on a non-USG system. | |
1536 | I'll have to use $echo instead of the builtin, since Bourne shell doesn't | |
1537 | have echo built in and we may have to run some Bourne shell scripts. That | |
1538 | means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous. | |
1539 | ||
1540 | FOO | |
1541 | $echo $n "The star should be here-->$c" | |
1542 | $echo "*" | |
1543 | fi | |
1544 | $rm -f foo1 foo2 | |
1545 | ;; | |
1546 | esac | |
1547 | ||
a0d0e21e LW |
1548 | : determine whether symbolic links are supported |
1549 | echo " " | |
1550 | $touch blurfl | |
1551 | if $ln -s blurfl sym > /dev/null 2>&1 ; then | |
1552 | echo "Symbolic links are supported." >&4 | |
1553 | lns="$ln -s" | |
1554 | else | |
1555 | echo "Symbolic links are NOT supported." >&4 | |
1556 | lns="$ln" | |
1557 | fi | |
1558 | $rm -f blurfl sym | |
1559 | ||
ecfc5424 AD |
1560 | : see whether [:lower:] and [:upper:] are supported character classes |
1561 | echo " " | |
1562 | up='[A-Z]' | |
1563 | low='[a-z]' | |
1564 | case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in | |
1565 | ABYZ) | |
1566 | echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4 | |
1567 | up='[:upper:]' | |
1568 | low='[:lower:]' | |
1569 | ;; | |
1570 | *) | |
1571 | echo "Your tr only supports [a-z] and [A-Z] to convert case." >&4 | |
1572 | ;; | |
1573 | esac | |
1574 | : set up the translation script tr, must be called with ./tr of course | |
1575 | cat >tr <<EOSC | |
1576 | $startsh | |
1577 | case "\$1\$2" in | |
1578 | '[A-Z][a-z]') exec $tr '$up' '$low';; | |
1579 | '[a-z][A-Z]') exec $tr '$low' '$up';; | |
1580 | esac | |
1581 | exec $tr "\$@" | |
1582 | EOSC | |
1583 | chmod +x tr | |
1584 | $eunicefix tr | |
1585 | ||
2304df62 AD |
1586 | : Try to determine whether config.sh was made on this system |
1587 | case "$config_sh" in | |
1588 | '') | |
1589 | myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1` | |
a0d0e21e | 1590 | myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \ |
ecfc5424 | 1591 | ./tr '[A-Z]' '[a-z]' | tr '\012' ' '` |
1aef975c | 1592 | newmyuname="$myuname" |
2304df62 | 1593 | dflt=n |
16d20bd9 AD |
1594 | case "$knowitall" in |
1595 | '') | |
1596 | if test -f ../config.sh; then | |
1597 | if $contains myuname= ../config.sh >/dev/null 2>&1; then | |
1598 | eval "`grep myuname= ../config.sh`" | |
1599 | fi | |
1600 | if test "X$myuname" = "X$newmyuname"; then | |
1601 | dflt=y | |
1602 | fi | |
2304df62 | 1603 | fi |
16d20bd9 AD |
1604 | ;; |
1605 | *) dflt=y;; | |
1606 | esac | |
2304df62 AD |
1607 | |
1608 | : Get old answers from old config file if Configure was run on the | |
1609 | : same system, otherwise use the hints. | |
1610 | hint=default | |
1611 | cd .. | |
1612 | if test -f config.sh; then | |
16d20bd9 AD |
1613 | echo " " |
1614 | rp="I see a config.sh file. Shall I use it to set the defaults?" | |
2304df62 AD |
1615 | . UU/myread |
1616 | case "$ans" in | |
1617 | n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;; | |
1618 | *) echo "Fetching default answers from your old config.sh file..." >&4 | |
ecfc5424 AD |
1619 | tmp_n="$n" |
1620 | tmp_c="$c" | |
85cad39c | 1621 | tmp_sh="$sh" |
2304df62 AD |
1622 | . ./config.sh |
1623 | cp config.sh UU | |
ecfc5424 AD |
1624 | n="$tmp_n" |
1625 | c="$tmp_c" | |
85cad39c | 1626 | : Older versions did not always set $sh. Catch re-use of such |
1627 | : an old config.sh. | |
1628 | case "$sh" in | |
1629 | '') sh="$tmp_sh" ;; | |
1630 | esac | |
2304df62 AD |
1631 | hint=previous |
1632 | ;; | |
1633 | esac | |
1634 | fi | |
1635 | if test ! -f config.sh; then | |
1636 | $cat <<EOM | |
1637 | ||
1638 | First time through, eh? I have some defaults handy for the following systems: | |
1639 | ||
1640 | EOM | |
1641 | cd hints; ls -C *.sh | $sed 's/\.sh/ /g' >&4 | |
1642 | dflt='' | |
1643 | : Half the following guesses are probably wrong... If you have better | |
5f05dabc | 1644 | : tests or hints, please send them to chip@atlantic.net |
2304df62 | 1645 | : The metaconfig authors would also appreciate a copy... |
a0d0e21e | 1646 | $test -f /irix && osname=irix |
85e6fe83 LW |
1647 | $test -f /xenix && osname=sco_xenix |
1648 | $test -f /dynix && osname=dynix | |
1649 | $test -f /dnix && osname=dnix | |
5f05dabc | 1650 | $test -f /lynx.os && osname=lynxos |
1651 | $test -f /unicos && osname=unicos && osvers=`$uname -r` | |
7a4c00b4 | 1652 | $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r` |
85e6fe83 | 1653 | $test -f /bin/mips && /bin/mips && osname=mips |
ecfc5424 AD |
1654 | $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \ |
1655 | $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4 | |
a0d0e21e LW |
1656 | $test -d /usr/apollo/bin && osname=apollo |
1657 | $test -f /etc/saf/_sactab && osname=svr4 | |
85e6fe83 | 1658 | $test -d /usr/include/minix && osname=minix |
4633a7c4 LW |
1659 | if $test -d /MachTen; then |
1660 | osname=machten | |
1661 | if $test -x /sbin/version; then | |
1662 | osvers=`/sbin/version | $awk '{print $2}' | | |
1663 | $sed -e 's/[A-Za-z]$//'` | |
1664 | elif $test -x /usr/etc/version; then | |
1665 | osvers=`/usr/etc/version | $awk '{print $2}' | | |
1666 | $sed -e 's/[A-Za-z]$//'` | |
1667 | else | |
1668 | osvers="$2.$3" | |
1669 | fi | |
1670 | fi | |
2304df62 AD |
1671 | if $test -f $uname; then |
1672 | set X $myuname | |
1673 | shift | |
1674 | ||
2304df62 | 1675 | case "$5" in |
85e6fe83 | 1676 | fps*) osname=fps ;; |
2304df62 AD |
1677 | mips*) |
1678 | case "$4" in | |
85e6fe83 LW |
1679 | umips) osname=umips ;; |
1680 | *) osname=mips ;; | |
2304df62 | 1681 | esac;; |
85e6fe83 LW |
1682 | [23]100) osname=mips ;; |
1683 | next*) osname=next ;; | |
1684 | news*) osname=news ;; | |
ecfc5424 AD |
1685 | i386*) |
1686 | if $test -f /etc/kconfig; then | |
1687 | osname=isc | |
a0d0e21e LW |
1688 | if test "$lns" = "ln -s"; then |
1689 | osvers=4 | |
1690 | elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then | |
1691 | osvers=3 | |
2304df62 | 1692 | elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then |
a0d0e21e | 1693 | osvers=2 |
ecfc5424 AD |
1694 | fi |
1695 | fi | |
1696 | ;; | |
2304df62 AD |
1697 | esac |
1698 | ||
1699 | case "$1" in | |
a0d0e21e LW |
1700 | aix) osname=aix |
1701 | tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1` | |
1702 | case "$tmp" in | |
1aef975c | 1703 | 'not found') osvers="$4"."$3" ;; |
a0d0e21e LW |
1704 | '<3240'|'<>3240') osvers=3.2.0 ;; |
1705 | '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;; | |
1706 | '=3250'|'>3250') osvers=3.2.5 ;; | |
1aef975c | 1707 | *) osvers=$tmp;; |
a0d0e21e LW |
1708 | esac |
1709 | ;; | |
1710 | dnix) osname=dnix | |
1711 | osvers="$3" | |
1712 | ;; | |
1713 | domainos) osname=apollo | |
1714 | osvers="$3" | |
1715 | ;; | |
1716 | dgux) osname=dgux | |
1717 | osvers="$3" | |
1718 | ;; | |
760ac839 LW |
1719 | dynixptx*) osname=dynixptx |
1720 | osvers="$3" | |
1721 | ;; | |
a0d0e21e LW |
1722 | freebsd) osname=freebsd |
1723 | osvers="$3" ;; | |
1724 | genix) osname=genix ;; | |
1725 | hp*) osname=hpux | |
1726 | case "$3" in | |
1727 | *.08.*) osvers=9 ;; | |
1728 | *.09.*) osvers=9 ;; | |
1729 | *.10.*) osvers=10 ;; | |
ecfc5424 | 1730 | *) osvers="$3" ;; |
a0d0e21e LW |
1731 | esac |
1732 | ;; | |
a78b0d02 | 1733 | irix*) osname=irix |
a0d0e21e LW |
1734 | case "$3" in |
1735 | 4*) osvers=4 ;; | |
1736 | 5*) osvers=5 ;; | |
ecfc5424 | 1737 | *) osvers="$3" ;; |
a0d0e21e LW |
1738 | esac |
1739 | ;; | |
1740 | linux) osname=linux | |
1741 | case "$3" in | |
1742 | 1*) osvers=1 ;; | |
1743 | *) osvers="$3" ;; | |
1744 | esac | |
1745 | ;; | |
1746 | netbsd*) osname=netbsd | |
ecfc5424 AD |
1747 | osvers="$3" |
1748 | ;; | |
a0d0e21e LW |
1749 | bsd386) osname=bsd386 |
1750 | osvers=`$uname -r` | |
1751 | ;; | |
1752 | next*) osname=next ;; | |
1753 | solaris) osname=solaris | |
1754 | case "$3" in | |
1755 | 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;; | |
ecfc5424 | 1756 | *) osvers="$3" ;; |
a0d0e21e LW |
1757 | esac |
1758 | ;; | |
85e6fe83 LW |
1759 | sunos) osname=sunos |
1760 | case "$3" in | |
85e6fe83 LW |
1761 | 5*) osname=solaris |
1762 | osvers=`echo $3 | $sed 's/^5/2/g'` ;; | |
a0d0e21e | 1763 | *) osvers="$3" ;; |
2304df62 AD |
1764 | esac |
1765 | ;; | |
a0d0e21e | 1766 | titanos) osname=titanos |
85e6fe83 | 1767 | case "$3" in |
a0d0e21e LW |
1768 | 1*) osvers=1 ;; |
1769 | 2*) osvers=2 ;; | |
1770 | 3*) osvers=3 ;; | |
1771 | 4*) osvers=4 ;; | |
ecfc5424 | 1772 | *) osvers="$3" ;; |
2304df62 AD |
1773 | esac |
1774 | ;; | |
85e6fe83 | 1775 | ultrix) osname=ultrix |
ecfc5424 | 1776 | osvers="$3" |
2304df62 | 1777 | ;; |
28757baa | 1778 | osf1|mls+) case "$5" in |
fed7345c AD |
1779 | alpha) |
1780 | osname=dec_osf | |
1781 | osvers=`echo "$3" | sed 's/^[vt]//'` | |
ecfc5424 AD |
1782 | ;; |
1783 | hp*) osname=hp_osf1 ;; | |
1784 | mips) osname=mips_osf1 ;; | |
85e6fe83 LW |
1785 | esac |
1786 | ;; | |
a0d0e21e LW |
1787 | uts) osname=uts |
1788 | osvers="$3" | |
1789 | ;; | |
ff68c719 | 1790 | qnx) osname=qnx |
1791 | osvers="$4" | |
1792 | ;; | |
85e6fe83 | 1793 | $2) case "$osname" in |
2304df62 | 1794 | *isc*) ;; |
a0d0e21e | 1795 | *freebsd*) ;; |
5f05dabc | 1796 | svr*) |
a0d0e21e LW |
1797 | : svr4.x or possibly later |
1798 | case "svr$3" in | |
1799 | ${osname}*) | |
1800 | osname=svr$3 | |
1801 | osvers=$4 | |
1802 | ;; | |
1803 | esac | |
1804 | case "$osname" in | |
1805 | svr4.0) | |
1806 | : Check for ESIX | |
1807 | if test -f /stand/boot ; then | |
1808 | eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot` | |
ecfc5424 AD |
1809 | if test -n "$INITPROG" -a -f "$INITPROG"; then |
1810 | isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'` | |
1811 | if test -n "$isesix"; then | |
a0d0e21e LW |
1812 | osname=esix4 |
1813 | fi | |
1814 | fi | |
1815 | fi | |
1816 | ;; | |
1817 | esac | |
1818 | ;; | |
2304df62 | 1819 | *) if test -f /etc/systemid; then |
a0d0e21e LW |
1820 | osname=sco |
1821 | set `echo $3 | $sed 's/\./ /g'` $4 | |
2304df62 | 1822 | if $test -f sco_$1_$2_$3.sh; then |
85e6fe83 | 1823 | osvers=$1.$2.$3 |
2304df62 | 1824 | elif $test -f sco_$1_$2.sh; then |
85e6fe83 | 1825 | osvers=$1.$2 |
2304df62 | 1826 | elif $test -f sco_$1.sh; then |
85e6fe83 | 1827 | osvers=$1 |
2304df62 | 1828 | fi |
a0d0e21e LW |
1829 | else |
1830 | case "$osname" in | |
1831 | '') : Still unknown. Probably a generic Sys V. | |
1832 | osname="sysv" | |
1833 | osvers="$3" | |
1834 | ;; | |
1835 | esac | |
2304df62 AD |
1836 | fi |
1837 | ;; | |
1838 | esac | |
1839 | ;; | |
a0d0e21e LW |
1840 | *) case "$osname" in |
1841 | '') : Still unknown. Probably a generic BSD. | |
1842 | osname="$1" | |
1843 | osvers="$3" | |
1844 | ;; | |
1845 | esac | |
1846 | ;; | |
2304df62 AD |
1847 | esac |
1848 | else | |
1849 | if test -f /vmunix -a -f news_os.sh; then | |
ecfc5424 | 1850 | (what /vmunix | ../UU/tr '[A-Z]' '[a-z]') > ../UU/kernel.what 2>&1 |
2304df62 | 1851 | if $contains news-os ../UU/kernel.what >/dev/null 2>&1; then |
85e6fe83 | 1852 | osname=news_os |
2304df62 AD |
1853 | fi |
1854 | $rm -f ../UU/kernel.what | |
8e07c86e AD |
1855 | elif test -d c:/.; then |
1856 | set X $myuname | |
1857 | osname=os2 | |
1858 | osvers="$5" | |
2304df62 AD |
1859 | fi |
1860 | fi | |
85e6fe83 | 1861 | |
a0d0e21e LW |
1862 | : Now look for a hint file osname_osvers, unless one has been |
1863 | : specified already. | |
1864 | case "$hintfile" in | |
1865 | ''|' ') | |
ecfc5424 | 1866 | file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'` |
a0d0e21e | 1867 | : Also try without trailing minor version numbers. |
ecfc5424 AD |
1868 | xfile=`echo $file | $sed -e 's@_[^_]*$@@'` |
1869 | xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'` | |
1870 | xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'` | |
1871 | xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'` | |
a0d0e21e LW |
1872 | case "$file" in |
1873 | '') dflt=none ;; | |
1874 | *) case "$osvers" in | |
1875 | '') dflt=$file | |
1876 | ;; | |
1877 | *) if $test -f $file.sh ; then | |
1878 | dflt=$file | |
1879 | elif $test -f $xfile.sh ; then | |
1880 | dflt=$xfile | |
1881 | elif $test -f $xxfile.sh ; then | |
1882 | dflt=$xxfile | |
1883 | elif $test -f $xxxfile.sh ; then | |
1884 | dflt=$xxxfile | |
1885 | elif $test -f $xxxxfile.sh ; then | |
1886 | dflt=$xxxxfile | |
1887 | elif $test -f "${osname}.sh" ; then | |
1888 | dflt="${osname}" | |
1889 | else | |
1890 | dflt=none | |
1891 | fi | |
1892 | ;; | |
1893 | esac | |
85e6fe83 LW |
1894 | ;; |
1895 | esac | |
1896 | ;; | |
a0d0e21e | 1897 | *) |
ecfc5424 | 1898 | dflt=`echo $hintfile | $sed 's/\.sh$//'` |
a0d0e21e | 1899 | ;; |
2304df62 | 1900 | esac |
1aef975c | 1901 | |
2304df62 AD |
1902 | $cat <<EOM |
1903 | ||
1904 | You may give one or more space-separated answers, or "none" if appropriate. | |
1905 | If your OS version has no hints, DO NOT give a wrong version -- say "none". | |
1906 | ||
1907 | EOM | |
1908 | rp="Which of these apply, if any?" | |
1909 | . ../UU/myread | |
85e6fe83 LW |
1910 | tans=$ans |
1911 | for file in $tans; do | |
2304df62 AD |
1912 | if $test -f $file.sh; then |
1913 | . ./$file.sh | |
1914 | $cat $file.sh >> ../UU/config.sh | |
85e6fe83 | 1915 | elif $test X$tans = X -o X$tans = Xnone ; then |
2304df62 AD |
1916 | : nothing |
1917 | else | |
85e6fe83 LW |
1918 | : Give one chance to correct a possible typo. |
1919 | echo "$file.sh does not exist" | |
1920 | dflt=$file | |
1921 | rp="hint to use instead?" | |
1922 | . ../UU/myread | |
1923 | for file in $ans; do | |
1924 | if $test -f "$file.sh"; then | |
1925 | . ./$file.sh | |
1926 | $cat $file.sh >> ../UU/config.sh | |
1927 | elif $test X$ans = X -o X$ans = Xnone ; then | |
1928 | : nothing | |
1929 | else | |
1930 | echo "$file.sh does not exist -- ignored." | |
1931 | fi | |
1932 | done | |
2304df62 AD |
1933 | fi |
1934 | done | |
85e6fe83 | 1935 | |
2304df62 | 1936 | hint=recommended |
85e6fe83 LW |
1937 | : Remember our hint file for later. |
1938 | if $test -f "$file.sh" ; then | |
a0d0e21e | 1939 | hintfile="$file" |
85e6fe83 | 1940 | else |
a0d0e21e | 1941 | hintfile='' |
85e6fe83 LW |
1942 | fi |
1943 | ||
2304df62 AD |
1944 | cd .. |
1945 | fi | |
1946 | cd UU | |
1947 | ;; | |
1948 | *) | |
1949 | echo " " | |
1950 | echo "Fetching default answers from $config_sh..." >&4 | |
ecfc5424 AD |
1951 | tmp_n="$n" |
1952 | tmp_c="$c" | |
2304df62 AD |
1953 | cd .. |
1954 | cp $config_sh config.sh 2>/dev/null | |
a78b0d02 | 1955 | chmod +w config.sh |
2304df62 AD |
1956 | . ./config.sh |
1957 | cd UU | |
1958 | cp ../config.sh . | |
ecfc5424 AD |
1959 | n="$tmp_n" |
1960 | c="$tmp_c" | |
2304df62 AD |
1961 | hint=previous |
1962 | ;; | |
1963 | esac | |
1aef975c AD |
1964 | test "$override" && . ./optdef.sh |
1965 | myuname="$newmyuname" | |
2304df62 AD |
1966 | |
1967 | : Restore computed paths | |
1968 | for file in $loclist $trylist; do | |
1969 | eval $file="\$_$file" | |
1970 | done | |
1971 | ||
85e6fe83 | 1972 | cat << EOM |
a0d0e21e | 1973 | |
85e6fe83 | 1974 | Configure uses the operating system name and version to set some defaults. |
ecfc5424 AD |
1975 | The default value is probably right if the name rings a bell. Otherwise, |
1976 | since spelling matters for me, either accept the default or answer "none" | |
1977 | to leave it blank. | |
a0d0e21e | 1978 | |
85e6fe83 | 1979 | EOM |
85e6fe83 | 1980 | case "$osname" in |
a0d0e21e | 1981 | ''|' ') |
85e6fe83 | 1982 | case "$hintfile" in |
a0d0e21e | 1983 | ''|' '|none) dflt=none ;; |
ecfc5424 | 1984 | *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;; |
85e6fe83 LW |
1985 | esac |
1986 | ;; | |
1987 | *) dflt="$osname" ;; | |
1988 | esac | |
1989 | rp="Operating system name?" | |
1990 | . ./myread | |
1991 | case "$ans" in | |
ecfc5424 AD |
1992 | none) osname='' ;; |
1993 | *) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;; | |
85e6fe83 | 1994 | esac |
8ff267be | 1995 | echo " " |
1996 | case "$osvers" in | |
1997 | ''|' ') | |
1998 | case "$hintfile" in | |
1999 | ''|' '|none) dflt=none ;; | |
2000 | *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'` | |
2001 | dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'` | |
2002 | case "$dflt" in | |
2003 | ''|' ') dflt=none ;; | |
2004 | esac | |
2005 | ;; | |
2006 | esac | |
2007 | ;; | |
2008 | *) dflt="$osvers" ;; | |
2009 | esac | |
2010 | rp="Operating system version?" | |
2011 | . ./myread | |
2012 | case "$ans" in | |
2013 | none) osvers='' ;; | |
2014 | *) osvers="$ans" ;; | |
2015 | esac | |
2016 | ||
760ac839 LW |
2017 | |
2018 | ||
2304df62 AD |
2019 | : who configured the system |
2020 | cf_time=`$date 2>&1` | |
8ff267be | 2021 | cf_by=`(logname) 2>/dev/null` |
2022 | case "$cf_by" in "") | |
2023 | cf_by=`(whoami) 2>/dev/null` | |
2024 | case "$cf_by" in "") | |
2025 | cf_by=unknown ;; | |
2026 | esac ;; | |
2027 | esac | |
2304df62 | 2028 | |
4633a7c4 | 2029 | : determine the architecture name |
2304df62 | 2030 | echo " " |
4633a7c4 LW |
2031 | if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then |
2032 | tarch=`arch`"-$osname" | |
2033 | elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then | |
2034 | if uname -m > tmparch 2>&1 ; then | |
7e1af8bc | 2035 | tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \ |
5f05dabc | 2036 | -e 's/$/'"-$osname/" tmparch` |
4633a7c4 LW |
2037 | else |
2038 | tarch="$osname" | |
2039 | fi | |
2040 | $rm -f tmparch | |
2041 | else | |
2042 | tarch="$osname" | |
2043 | fi | |
2044 | case "$myarchname" in | |
2045 | ''|"$tarch") ;; | |
2046 | *) | |
2047 | echo "(Your architecture name used to be $myarchname.)" | |
2048 | archname='' | |
2304df62 AD |
2049 | ;; |
2050 | esac | |
4633a7c4 LW |
2051 | case "$archname" in |
2052 | '') dflt="$tarch";; | |
2053 | *) dflt="$archname";; | |
2054 | esac | |
2055 | rp='What is your architecture name' | |
2056 | . ./myread | |
2057 | archname="$ans" | |
2058 | myarchname="$tarch" | |
2059 | ||
2060 | : is AFS running? | |
2061 | echo " " | |
2afac517 | 2062 | case "$afs" in |
2063 | $define|true) afs=true ;; | |
2064 | $undef|false) afs=false ;; | |
2065 | *) if test -d /afs; then | |
2066 | afs=true | |
2067 | else | |
2068 | afs=false | |
2069 | fi | |
2070 | ;; | |
2071 | esac | |
2072 | if $afs; then | |
4633a7c4 | 2073 | echo "AFS may be running... I'll be extra cautious then..." >&4 |
2304df62 | 2074 | else |
4633a7c4 | 2075 | echo "AFS does not seem to be running..." >&4 |
2304df62 AD |
2076 | fi |
2077 | ||
4633a7c4 LW |
2078 | : decide how portable to be. Allow command line overrides. |
2079 | case "$d_portable" in | |
2080 | "$undef") ;; | |
2081 | *) d_portable="$define" ;; | |
2304df62 | 2082 | esac |
2304df62 | 2083 | |
4633a7c4 LW |
2084 | : set up shell script to do ~ expansion |
2085 | cat >filexp <<EOSS | |
2086 | $startsh | |
2087 | : expand filename | |
2088 | case "\$1" in | |
2089 | ~/*|~) | |
2090 | echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|" | |
2304df62 | 2091 | ;; |
4633a7c4 LW |
2092 | ~*) |
2093 | if $test -f /bin/csh; then | |
2094 | /bin/csh -f -c "glob \$1" | |
2095 | failed=\$? | |
2096 | echo "" | |
2097 | exit \$failed | |
2098 | else | |
2099 | name=\`$expr x\$1 : '..\([^/]*\)'\` | |
2100 | dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\` | |
2101 | if $test ! -d "\$dir"; then | |
2102 | me=\`basename \$0\` | |
2103 | echo "\$me: can't locate home directory for: \$name" >&2 | |
2104 | exit 1 | |
2105 | fi | |
2106 | case "\$1" in | |
2107 | */*) | |
2108 | echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\` | |
2109 | ;; | |
2110 | *) | |
2111 | echo \$dir | |
2112 | ;; | |
2304df62 | 2113 | esac |
4633a7c4 | 2114 | fi |
2304df62 AD |
2115 | ;; |
2116 | *) | |
4633a7c4 | 2117 | echo \$1 |
2304df62 AD |
2118 | ;; |
2119 | esac | |
4633a7c4 LW |
2120 | EOSS |
2121 | chmod +x filexp | |
2122 | $eunicefix filexp | |
2304df62 AD |
2123 | |
2124 | : now set up to get a file name | |
28757baa | 2125 | cat <<EOS >getfile |
2126 | $startsh | |
2127 | EOS | |
2128 | cat <<'EOSC' >>getfile | |
2304df62 AD |
2129 | tilde='' |
2130 | fullpath='' | |
2131 | already='' | |
2132 | skip='' | |
2133 | none_ok='' | |
2134 | exp_file='' | |
a0d0e21e | 2135 | nopath_ok='' |
2304df62 AD |
2136 | orig_rp="$rp" |
2137 | orig_dflt="$dflt" | |
2138 | ||
2139 | case "$fn" in | |
ecfc5424 AD |
2140 | *\(*) |
2141 | expr $fn : '.*(\(.*\)).*' | tr ',' '\012' >getfile.ok | |
2142 | fn=`echo $fn | sed 's/(.*)//'` | |
2143 | ;; | |
2144 | esac | |
2145 | ||
2146 | case "$fn" in | |
a0d0e21e LW |
2147 | *:*) |
2148 | loc_file=`expr $fn : '.*:\(.*\)'` | |
2149 | fn=`expr $fn : '\(.*\):.*'` | |
2150 | ;; | |
2151 | esac | |
2152 | ||
2153 | case "$fn" in | |
2304df62 AD |
2154 | *~*) tilde=true;; |
2155 | esac | |
2156 | case "$fn" in | |
2157 | */*) fullpath=true;; | |
2158 | esac | |
2159 | case "$fn" in | |
2160 | *+*) skip=true;; | |
2161 | esac | |
2162 | case "$fn" in | |
2163 | *n*) none_ok=true;; | |
2164 | esac | |
2165 | case "$fn" in | |
2166 | *e*) exp_file=true;; | |
2167 | esac | |
a0d0e21e LW |
2168 | case "$fn" in |
2169 | *p*) nopath_ok=true;; | |
2170 | esac | |
2304df62 AD |
2171 | |
2172 | case "$fn" in | |
2173 | *f*) type='File';; | |
2174 | *d*) type='Directory';; | |
a0d0e21e | 2175 | *l*) type='Locate';; |
2304df62 AD |
2176 | esac |
2177 | ||
2178 | what="$type" | |
2179 | case "$what" in | |
2180 | Locate) what='File';; | |
2181 | esac | |
2182 | ||
2183 | case "$exp_file" in | |
2184 | '') | |
2185 | case "$d_portable" in | |
2186 | "$define") ;; | |
2187 | *) exp_file=true;; | |
2188 | esac | |
2189 | ;; | |
2190 | esac | |
2191 | ||
2192 | cd .. | |
2193 | while test "$type"; do | |
2194 | redo='' | |
2195 | rp="$orig_rp" | |
2196 | dflt="$orig_dflt" | |
2197 | case "$tilde" in | |
2198 | true) rp="$rp (~name ok)";; | |
2199 | esac | |
2200 | . UU/myread | |
ecfc5424 AD |
2201 | if test -f UU/getfile.ok && \ |
2202 | $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1 | |
2203 | then | |
2204 | value="$ans" | |
2205 | ansexp="$ans" | |
2206 | break | |
2207 | fi | |
2304df62 AD |
2208 | case "$ans" in |
2209 | none) | |
2210 | value='' | |
2211 | ansexp='' | |
2212 | case "$none_ok" in | |
2213 | true) type='';; | |
2214 | esac | |
2215 | ;; | |
2216 | *) | |
2217 | case "$tilde" in | |
2218 | '') value="$ans" | |
2219 | ansexp="$ans";; | |
2220 | *) | |
2221 | value=`UU/filexp $ans` | |
2222 | case $? in | |
2223 | 0) | |
2224 | if test "$ans" != "$value"; then | |
ecfc5424 | 2225 | echo "(That expands to $value on this system.)" |
2304df62 AD |
2226 | fi |
2227 | ;; | |
2228 | *) value="$ans";; | |
2229 | esac | |
2230 | ansexp="$value" | |
2231 | case "$exp_file" in | |
2232 | '') value="$ans";; | |
2233 | esac | |
2234 | ;; | |
2235 | esac | |
2236 | case "$fullpath" in | |
2237 | true) | |
2238 | case "$ansexp" in | |
2239 | /*) value="$ansexp" ;; | |
2240 | *) | |
2241 | redo=true | |
2242 | case "$already" in | |
2243 | true) | |
2244 | echo "I shall only accept a full path name, as in /bin/ls." >&4 | |
2245 | echo "Use a ! shell escape if you wish to check pathnames." >&4 | |
2246 | ;; | |
2247 | *) | |
2248 | echo "Please give a full path name, starting with slash." >&4 | |
2249 | case "$tilde" in | |
2250 | true) | |
2251 | echo "Note that using ~name is ok provided it expands well." >&4 | |
2252 | already=true | |
2253 | ;; | |
2254 | esac | |
2255 | esac | |
2256 | ;; | |
2257 | esac | |
2258 | ;; | |
2259 | esac | |
2260 | case "$redo" in | |
2261 | '') | |
2262 | case "$type" in | |
2263 | File) | |
2264 | if test -f "$ansexp"; then | |
2265 | type='' | |
2266 | elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1 | |
2267 | then | |
2268 | echo "($value is not a plain file, but that's ok.)" | |
2269 | type='' | |
2270 | fi | |
2271 | ;; | |
2272 | Directory) | |
2273 | if test -d "$ansexp"; then | |
2274 | type='' | |
2275 | fi | |
2276 | ;; | |
2277 | Locate) | |
40000a8c | 2278 | if test -d "$ansexp"; then |
a0d0e21e LW |
2279 | echo "(Looking for $loc_file in directory $value.)" |
2280 | value="$value/$loc_file" | |
40000a8c | 2281 | ansexp="$ansexp/$loc_file" |
2304df62 | 2282 | fi |
40000a8c | 2283 | if test -f "$ansexp"; then |
2304df62 AD |
2284 | type='' |
2285 | fi | |
a0d0e21e LW |
2286 | case "$nopath_ok" in |
2287 | true) case "$value" in | |
2288 | */*) ;; | |
2289 | *) echo "Assuming $value will be in people's path." | |
2290 | type='' | |
2291 | ;; | |
2292 | esac | |
2293 | ;; | |
2294 | esac | |
2304df62 AD |
2295 | ;; |
2296 | esac | |
2297 | ||
2298 | case "$skip" in | |
2299 | true) type=''; | |
2300 | esac | |
2301 | ||
2302 | case "$type" in | |
2303 | '') ;; | |
2304 | *) | |
2305 | if test "$fastread" = yes; then | |
2306 | dflt=y | |
2307 | else | |
2308 | dflt=n | |
2309 | fi | |
2310 | rp="$what $value doesn't exist. Use that name anyway?" | |
2311 | . UU/myread | |
2312 | dflt='' | |
2313 | case "$ans" in | |
2314 | y*) type='';; | |
2315 | *) echo " ";; | |
2316 | esac | |
2317 | ;; | |
2318 | esac | |
2319 | ;; | |
2320 | esac | |
2321 | ;; | |
2322 | esac | |
2323 | done | |
2324 | cd UU | |
2325 | ans="$value" | |
2326 | rp="$orig_rp" | |
2327 | dflt="$orig_dflt" | |
ecfc5424 | 2328 | rm -f getfile.ok |
2304df62 AD |
2329 | EOSC |
2330 | ||
4633a7c4 LW |
2331 | : determine root of directory hierarchy where package will be installed. |
2332 | case "$prefix" in | |
2333 | '') | |
2334 | dflt=`./loc . /usr/local /usr/local /local /opt /usr` | |
8e07c86e | 2335 | ;; |
4633a7c4 LW |
2336 | *) |
2337 | dflt="$prefix" | |
8e07c86e AD |
2338 | ;; |
2339 | esac | |
4633a7c4 | 2340 | $cat <<EOM |
2304df62 | 2341 | |
4633a7c4 LW |
2342 | By default, $package will be installed in $dflt/bin, manual |
2343 | pages under $dflt/man, etc..., i.e. with $dflt as prefix for | |
2344 | all installation directories. Typically set to /usr/local, but you | |
2345 | may choose /usr if you wish to install $package among your system | |
2346 | binaries. If you wish to have binaries under /bin but manual pages | |
2347 | under /usr/local/man, that's ok: you will be prompted separately | |
2348 | for each of the installation directories, the prefix being only used | |
2349 | to set the defaults. | |
8e07c86e AD |
2350 | |
2351 | EOM | |
2352 | fn=d~ | |
2353 | rp='Installation prefix to use?' | |
2354 | . ./getfile | |
2355 | oldprefix='' | |
2356 | case "$prefix" in | |
a0d0e21e | 2357 | '') ;; |
8e07c86e AD |
2358 | *) |
2359 | case "$ans" in | |
2360 | "$prefix") ;; | |
2361 | *) oldprefix="$prefix";; | |
2362 | esac | |
2363 | ;; | |
a0d0e21e | 2364 | esac |
8e07c86e AD |
2365 | prefix="$ans" |
2366 | prefixexp="$ansexp" | |
a0d0e21e | 2367 | |
8e07c86e AD |
2368 | : set the prefixit variable, to compute a suitable default value |
2369 | prefixit='case "$3" in | |
2370 | ""|none) | |
2371 | case "$oldprefix" in | |
2372 | "") eval "$1=\"\$$2\"";; | |
2373 | *) | |
2374 | case "$3" in | |
2375 | "") eval "$1=";; | |
2376 | none) | |
2377 | eval "tp=\"\$$2\""; | |
2378 | case "$tp" in | |
2379 | ""|" ") eval "$1=\"\$$2\"";; | |
2380 | *) eval "$1=";; | |
2381 | esac;; | |
2382 | esac;; | |
2383 | esac;; | |
2384 | *) | |
2385 | eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\""; | |
2386 | case "$tp" in | |
2387 | --|/*--|\~*--) eval "$1=\"$prefix/$3\"";; | |
2388 | /*-$oldprefix/*|\~*-$oldprefix/*) | |
2389 | eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";; | |
2390 | *) eval "$1=\"\$$2\"";; | |
2391 | esac;; | |
2392 | esac' | |
a0d0e21e | 2393 | |
4633a7c4 LW |
2394 | : determine where private library files go |
2395 | : Usual default is /usr/local/lib/perl5. Also allow things like | |
2396 | : /opt/perl/lib, since /opt/perl/lib/perl5 would be redundant. | |
2397 | case "$prefix" in | |
2398 | *perl*) set dflt privlib lib ;; | |
2399 | *) set dflt privlib lib/$package ;; | |
2400 | esac | |
8e07c86e | 2401 | eval $prefixit |
4633a7c4 LW |
2402 | $cat <<EOM |
2403 | ||
2404 | There are some auxiliary files for $package that need to be put into a | |
2405 | private library directory that is accessible by everyone. | |
2406 | ||
2407 | EOM | |
2408 | fn=d~+ | |
2409 | rp='Pathname where the private library files will reside?' | |
8e07c86e | 2410 | . ./getfile |
4633a7c4 LW |
2411 | if $test "X$privlibexp" != "X$ansexp"; then |
2412 | installprivlib='' | |
8e07c86e | 2413 | fi |
4633a7c4 LW |
2414 | privlib="$ans" |
2415 | privlibexp="$ansexp" | |
8e07c86e AD |
2416 | if $afs; then |
2417 | $cat <<EOM | |
2304df62 | 2418 | |
8e07c86e | 2419 | Since you are running AFS, I need to distinguish the directory in which |
4633a7c4 | 2420 | private files reside from the directory in which they are installed (and from |
8e07c86e | 2421 | which they are presumably copied to the former directory by occult means). |
a0d0e21e | 2422 | |
8e07c86e | 2423 | EOM |
4633a7c4 LW |
2424 | case "$installprivlib" in |
2425 | '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;; | |
2426 | *) dflt="$installprivlib";; | |
8e07c86e AD |
2427 | esac |
2428 | fn=de~ | |
4633a7c4 | 2429 | rp='Where will private files be installed?' |
8e07c86e | 2430 | . ./getfile |
4633a7c4 | 2431 | installprivlib="$ans" |
8e07c86e | 2432 | else |
4633a7c4 LW |
2433 | installprivlib="$privlibexp" |
2434 | fi | |
2435 | ||
2436 | : set the base revision | |
5f05dabc | 2437 | baserev=5 |
4633a7c4 LW |
2438 | |
2439 | : get the patchlevel | |
2440 | echo " " | |
2441 | echo "Getting the current patchlevel..." >&4 | |
2442 | if $test -r ../patchlevel.h;then | |
760ac839 LW |
2443 | patchlevel=`awk '/PATCHLEVEL/ {print $3}' ../patchlevel.h` |
2444 | subversion=`awk '/SUBVERSION/ {print $3}' ../patchlevel.h` | |
4633a7c4 LW |
2445 | else |
2446 | patchlevel=0 | |
f55a7265 | 2447 | subversion=0 |
8e07c86e | 2448 | fi |
5f05dabc | 2449 | $echo $n "(You have $package" $c |
2450 | case "$package" in | |
2451 | "*$baserev") ;; | |
2452 | *) $echo $n " $baserev" $c ;; | |
2453 | esac | |
2454 | $echo $n " patchlevel $patchlevel" $c | |
36477c24 | 2455 | test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c |
2456 | echo ".)" | |
2304df62 | 2457 | |
8e07c86e AD |
2458 | : set the prefixup variable, to restore leading tilda escape |
2459 | prefixup='case "$prefixexp" in | |
2460 | "$prefix") ;; | |
2461 | *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";; | |
2462 | esac' | |
2463 | ||
4633a7c4 LW |
2464 | : determine where public architecture dependent libraries go |
2465 | set archlib archlib | |
8e07c86e | 2466 | eval $prefixit |
4633a7c4 | 2467 | case "$archlib" in |
8e07c86e | 2468 | '') |
4633a7c4 | 2469 | case "$privlib" in |
760ac839 | 2470 | '') dflt=`./loc . "." $prefixexp/lib /usr/local/lib /usr/lib /lib` |
4633a7c4 LW |
2471 | set dflt |
2472 | eval $prefixup | |
2473 | ;; | |
36477c24 | 2474 | *) if test 0 -eq "$subversion"; then |
2475 | version=`echo $baserev $patchlevel | \ | |
2476 | $awk '{ printf "%d.%03d\n",$1,$2 }'` | |
2477 | else | |
2478 | version=`echo $baserev $patchlevel $subversion | \ | |
2479 | $awk '{ printf "%d.%03d%02d\n",$1,$2,$3 }'` | |
2480 | fi | |
4633a7c4 LW |
2481 | dflt="$privlib/$archname/$version" |
2482 | ;; | |
2483 | esac | |
8e07c86e | 2484 | ;; |
4633a7c4 | 2485 | *) dflt="$archlib";; |
8e07c86e | 2486 | esac |
4633a7c4 LW |
2487 | cat <<EOM |
2488 | ||
2489 | $spackage contains architecture-dependent library files. If you are | |
2490 | sharing libraries in a heterogeneous environment, you might store | |
2491 | these files in a separate location. Otherwise, you can just include | |
2492 | them with the rest of the public library files. | |
2493 | ||
8e07c86e | 2494 | EOM |
4633a7c4 LW |
2495 | fn=d+~ |
2496 | rp='Where do you want to put the public architecture-dependent libraries?' | |
8e07c86e | 2497 | . ./getfile |
4633a7c4 LW |
2498 | archlib="$ans" |
2499 | archlibexp="$ansexp" | |
2500 | ||
8e07c86e AD |
2501 | if $afs; then |
2502 | $cat <<EOM | |
2503 | ||
2504 | Since you are running AFS, I need to distinguish the directory in which | |
4633a7c4 | 2505 | private files reside from the directory in which they are installed (and from |
8e07c86e AD |
2506 | which they are presumably copied to the former directory by occult means). |
2507 | ||
2508 | EOM | |
4633a7c4 LW |
2509 | case "$installarchlib" in |
2510 | '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;; | |
2511 | *) dflt="$installarchlib";; | |
8e07c86e AD |
2512 | esac |
2513 | fn=de~ | |
4633a7c4 | 2514 | rp='Where will architecture-dependent library files be installed?' |
8e07c86e | 2515 | . ./getfile |
4633a7c4 | 2516 | installarchlib="$ans" |
8e07c86e | 2517 | else |
4633a7c4 LW |
2518 | installarchlib="$archlibexp" |
2519 | fi | |
2520 | if $test X"$archlib" = X"$privlib"; then | |
2521 | d_archlib="$undef" | |
2522 | else | |
2523 | d_archlib="$define" | |
8e07c86e AD |
2524 | fi |
2525 | ||
40a7a20a | 2526 | : set up the script used to warn in case of inconsistency |
28757baa | 2527 | cat <<EOS >whoa |
2528 | $startsh | |
2529 | EOS | |
2530 | cat <<'EOSC' >>whoa | |
40a7a20a | 2531 | dflt=y |
2532 | echo " " | |
2533 | echo "*** WHOA THERE!!! ***" >&4 | |
2534 | echo " The $hint value for \$$var on this machine was \"$was\"!" >&4 | |
2535 | rp=" Keep the $hint value?" | |
2536 | . ./myread | |
2537 | case "$ans" in | |
2538 | y) td=$was; tu=$was;; | |
2539 | esac | |
2540 | EOSC | |
2541 | ||
2542 | : function used to set $1 to $val | |
2543 | setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef; | |
2544 | case "$val$was" in | |
2545 | $define$undef) . ./whoa; eval "$var=\$td";; | |
2546 | $undef$define) . ./whoa; eval "$var=\$tu";; | |
2547 | *) eval "$var=$val";; | |
2548 | esac' | |
2549 | ||
5f05dabc | 2550 | $cat <<EOM |
2551 | ||
2552 | Perl 5.004 can be compiled for binary compatibility with 5.003. | |
2553 | If you decide to do so, you will be able to continue using any | |
2554 | extensions that were compiled for Perl 5.003. However, binary | |
2555 | compatibility forces Perl to expose some of its internal symbols | |
2556 | in the same way that 5.003 did. So you may have symbol conflicts | |
2557 | if you embed a binary-compatible Perl in other programs. | |
2558 | ||
2559 | EOM | |
2560 | case "$d_bincompat3" in | |
2561 | "$undef") dflt=n ;; | |
2562 | *) dflt=y ;; | |
2563 | esac | |
2564 | rp='Binary compatibility with Perl 5.003?' | |
2565 | . ./myread | |
2566 | case "$ans" in | |
2567 | y*) val="$define" ;; | |
2568 | *) val="$undef" ;; | |
2569 | esac | |
2570 | set d_bincompat3 | |
2571 | eval $setvar | |
2572 | case "$d_bincompat3" in | |
2573 | "$define") bincompat3=y ;; | |
2574 | *) bincompat3=n ;; | |
2575 | esac | |
2576 | ||
40a7a20a | 2577 | : make some quick guesses about what we are up against |
2578 | echo " " | |
2579 | $echo $n "Hmm... $c" | |
2580 | echo exit 1 >bsd | |
2581 | echo exit 1 >usg | |
2582 | echo exit 1 >v7 | |
2583 | echo exit 1 >osf1 | |
2584 | echo exit 1 >eunice | |
2585 | echo exit 1 >xenix | |
2586 | echo exit 1 >venix | |
8ff267be | 2587 | echo exit 1 >os2 |
40a7a20a | 2588 | d_bsd="$undef" |
2589 | $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null | |
2590 | if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1 | |
2591 | then | |
2592 | echo "Looks kind of like an OSF/1 system, but we'll see..." | |
2593 | echo exit 0 >osf1 | |
2594 | elif test `echo abc | tr a-z A-Z` = Abc ; then | |
2595 | xxx=`./loc addbib blurfl $pth` | |
2596 | if $test -f $xxx; then | |
2597 | echo "Looks kind of like a USG system with BSD features, but we'll see..." | |
2598 | echo exit 0 >bsd | |
2599 | echo exit 0 >usg | |
2600 | else | |
2601 | if $contains SIGTSTP foo >/dev/null 2>&1 ; then | |
2602 | echo "Looks kind of like an extended USG system, but we'll see..." | |
2603 | else | |
2604 | echo "Looks kind of like a USG system, but we'll see..." | |
2605 | fi | |
2606 | echo exit 0 >usg | |
2607 | fi | |
2608 | elif $contains SIGTSTP foo >/dev/null 2>&1 ; then | |
2609 | echo "Looks kind of like a BSD system, but we'll see..." | |
2610 | d_bsd="$define" | |
2611 | echo exit 0 >bsd | |
2612 | else | |
2613 | echo "Looks kind of like a Version 7 system, but we'll see..." | |
2614 | echo exit 0 >v7 | |
2615 | fi | |
2616 | case "$eunicefix" in | |
2617 | *unixtovms*) | |
2618 | $cat <<'EOI' | |
2619 | There is, however, a strange, musty smell in the air that reminds me of | |
2620 | something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit. | |
2621 | EOI | |
2622 | echo exit 0 >eunice | |
2623 | d_eunice="$define" | |
2624 | : it so happens the Eunice I know will not run shell scripts in Unix format | |
2625 | ;; | |
2626 | *) | |
2627 | echo " " | |
2628 | echo "Congratulations. You aren't running Eunice." | |
2629 | d_eunice="$undef" | |
2630 | ;; | |
2631 | esac | |
8ff267be | 2632 | : Detect OS2. The p_ variable is set above in the Head.U unit. |
2633 | case "$p_" in | |
2634 | :) ;; | |
2635 | *) | |
2636 | $cat <<'EOI' | |
2637 | I have the feeling something is not exactly right, however...don't tell me... | |
2638 | lemme think...does HAL ring a bell?...no, of course, you're only running OS/2! | |
2639 | EOI | |
2640 | echo exit 0 >os2 | |
2641 | ;; | |
2642 | esac | |
40a7a20a | 2643 | if test -f /xenix; then |
2644 | echo "Actually, this looks more like a XENIX system..." | |
2645 | echo exit 0 >xenix | |
2646 | d_xenix="$define" | |
2647 | else | |
2648 | echo " " | |
2649 | echo "It's not Xenix..." | |
2650 | d_xenix="$undef" | |
2651 | fi | |
2652 | chmod +x xenix | |
2653 | $eunicefix xenix | |
2654 | if test -f /venix; then | |
2655 | echo "Actually, this looks more like a VENIX system..." | |
2656 | echo exit 0 >venix | |
2657 | else | |
2658 | echo " " | |
2659 | if ./xenix; then | |
2660 | : null | |
2661 | else | |
2662 | echo "Nor is it Venix..." | |
2663 | fi | |
2664 | fi | |
8ff267be | 2665 | chmod +x bsd usg v7 osf1 eunice xenix venix os2 |
2666 | $eunicefix bsd usg v7 osf1 eunice xenix venix os2 | |
40a7a20a | 2667 | $rm -f foo |
2668 | ||
2669 | : see if setuid scripts can be secure | |
2670 | $cat <<EOM | |
2671 | ||
2672 | Some kernels have a bug that prevents setuid #! scripts from being | |
2673 | secure. Some sites have disabled setuid #! scripts because of this. | |
2674 | ||
2675 | First let's decide if your kernel supports secure setuid #! scripts. | |
2676 | (If setuid #! scripts would be secure but have been disabled anyway, | |
2677 | don't say that they are secure if asked.) | |
2678 | ||
2679 | EOM | |
2680 | ||
2681 | val="$undef" | |
2682 | if $test -d /dev/fd; then | |
2683 | echo "#!$ls" >reflect | |
2684 | chmod +x,u+s reflect | |
2685 | ./reflect >flect 2>&1 | |
2686 | if $contains "/dev/fd" flect >/dev/null; then | |
2687 | echo "Congratulations, your kernel has secure setuid scripts!" >&4 | |
2688 | val="$define" | |
2689 | else | |
2690 | $cat <<EOM | |
2691 | If you are not sure if they are secure, I can check but I'll need a | |
2692 | username and password different from the one you are using right now. | |
2693 | If you don't have such a username or don't want me to test, simply | |
2694 | enter 'none'. | |
2695 | ||
2696 | EOM | |
2697 | rp='Other username to test security of setuid scripts with?' | |
2698 | dflt='none' | |
2699 | . ./myread | |
2700 | case "$ans" in | |
2701 | n|none) | |
2702 | case "$d_suidsafe" in | |
2703 | '') echo "I'll assume setuid scripts are *not* secure." >&4 | |
2704 | dflt=n;; | |
2705 | "$undef") | |
2706 | echo "Well, the $hint value is *not* secure." >&4 | |
2707 | dflt=n;; | |
2708 | *) echo "Well, the $hint value *is* secure." >&4 | |
2709 | dflt=y;; | |
2710 | esac | |
2711 | ;; | |
2712 | *) | |
2713 | $rm -f reflect flect | |
2714 | echo "#!$ls" >reflect | |
2715 | chmod +x,u+s reflect | |
2716 | echo >flect | |
2717 | chmod a+w flect | |
2718 | echo '"su" will (probably) prompt you for '"$ans's password." | |
2719 | su $ans -c './reflect >flect' | |
2720 | if $contains "/dev/fd" flect >/dev/null; then | |
2721 | echo "Okay, it looks like setuid scripts are secure." >&4 | |
2722 | dflt=y | |
2723 | else | |
2724 | echo "I don't think setuid scripts are secure." >&4 | |
2725 | dflt=n | |
2726 | fi | |
2727 | ;; | |
2728 | esac | |
2729 | rp='Does your kernel have *secure* setuid scripts?' | |
2730 | . ./myread | |
2731 | case "$ans" in | |
2732 | [yY]*) val="$define";; | |
2733 | *) val="$undef";; | |
2734 | esac | |
2735 | fi | |
2736 | else | |
2737 | echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4 | |
760ac839 | 2738 | echo "(That's for file descriptors, not floppy disks.)" |
40a7a20a | 2739 | val="$undef" |
2740 | fi | |
2741 | set d_suidsafe | |
2742 | eval $setvar | |
2743 | ||
2744 | $rm -f reflect flect | |
2745 | ||
2746 | : now see if they want to do setuid emulation | |
2747 | echo " " | |
2748 | val="$undef" | |
2749 | case "$d_suidsafe" in | |
2750 | "$define") | |
2751 | val="$undef" | |
2752 | echo "No need to emulate SUID scripts since they are secure here." >& 4 | |
2753 | ;; | |
2754 | *) | |
2755 | $cat <<EOM | |
2756 | Some systems have disabled setuid scripts, especially systems where | |
2757 | setuid scripts cannot be secure. On systems where setuid scripts have | |
2758 | been disabled, the setuid/setgid bits on scripts are currently | |
2759 | useless. It is possible for $package to detect those bits and emulate | |
2760 | setuid/setgid in a secure fashion. This emulation will only work if | |
2761 | setuid scripts have been disabled in your kernel. | |
2762 | ||
2763 | EOM | |
2764 | case "$d_dosuid" in | |
2765 | "$define") dflt=y ;; | |
2766 | *) dflt=n ;; | |
2767 | esac | |
2768 | rp="Do you want to do setuid/setgid emulation?" | |
2769 | . ./myread | |
2770 | case "$ans" in | |
2771 | [yY]*) val="$define";; | |
2772 | *) val="$undef";; | |
2773 | esac | |
2774 | ;; | |
2775 | esac | |
2776 | set d_dosuid | |
2777 | eval $setvar | |
2778 | ||
37120919 AD |
2779 | : determine where site specific libraries go. |
2780 | set sitelib sitelib | |
2781 | eval $prefixit | |
2782 | case "$sitelib" in | |
2783 | '') dflt="$privlib/site_perl" ;; | |
2784 | *) dflt="$sitelib" ;; | |
2785 | esac | |
2786 | $cat <<EOM | |
2787 | ||
2788 | The installation process will also create a directory for | |
2789 | site-specific extensions and modules. Some users find it convenient | |
2790 | to place all local files in this directory rather than in the main | |
2791 | distribution directory. | |
2792 | ||
2793 | EOM | |
2794 | fn=d~+ | |
2795 | rp='Pathname for the site-specific library files?' | |
2796 | . ./getfile | |
2797 | if $test "X$sitelibexp" != "X$ansexp"; then | |
2798 | installsitelib='' | |
2799 | fi | |
2800 | sitelib="$ans" | |
2801 | sitelibexp="$ansexp" | |
2802 | if $afs; then | |
2803 | $cat <<EOM | |
2804 | ||
2805 | Since you are running AFS, I need to distinguish the directory in which | |
2806 | private files reside from the directory in which they are installed (and from | |
2807 | which they are presumably copied to the former directory by occult means). | |
2808 | ||
2809 | EOM | |
2810 | case "$installsitelib" in | |
2811 | '') dflt=`echo $sitelibexp | sed 's#^/afs/#/afs/.#'`;; | |
2812 | *) dflt="$installsitelib";; | |
2813 | esac | |
2814 | fn=de~ | |
2815 | rp='Where will private files be installed?' | |
2816 | . ./getfile | |
2817 | installsitelib="$ans" | |
2818 | else | |
2819 | installsitelib="$sitelibexp" | |
2820 | fi | |
4633a7c4 | 2821 | |
37120919 AD |
2822 | : determine where site specific architecture-dependent libraries go. |
2823 | xxx=`echo $sitelib/$archname | sed 's!^$prefix!!'` | |
2824 | : xxx is usuually lib/site_perl/archname. | |
2825 | set sitearch sitearch none | |
8e07c86e | 2826 | eval $prefixit |
37120919 AD |
2827 | case "$sitearch" in |
2828 | '') dflt="$sitelib/$archname" ;; | |
2829 | *) dflt="$sitearch" ;; | |
2830 | esac | |
8e07c86e AD |
2831 | $cat <<EOM |
2832 | ||
4633a7c4 LW |
2833 | The installation process will also create a directory for |
2834 | architecture-dependent site-specific extensions and modules. | |
8e07c86e AD |
2835 | |
2836 | EOM | |
4633a7c4 LW |
2837 | fn=nd~+ |
2838 | rp='Pathname for the site-specific architecture-dependent library files?' | |
8e07c86e | 2839 | . ./getfile |
4633a7c4 LW |
2840 | if $test "X$sitearchexp" != "X$ansexp"; then |
2841 | installsitearch='' | |
8e07c86e | 2842 | fi |
4633a7c4 LW |
2843 | sitearch="$ans" |
2844 | sitearchexp="$ansexp" | |
8e07c86e AD |
2845 | if $afs; then |
2846 | $cat <<EOM | |
2847 | ||
2848 | Since you are running AFS, I need to distinguish the directory in which | |
2849 | private files reside from the directory in which they are installed (and from | |
2850 | which they are presumably copied to the former directory by occult means). | |
2851 | ||
2852 | EOM | |
4633a7c4 LW |
2853 | case "$installsitearch" in |
2854 | '') dflt=`echo $sitearchexp | sed 's#^/afs/#/afs/.#'`;; | |
2855 | *) dflt="$installsitearch";; | |
8e07c86e AD |
2856 | esac |
2857 | fn=de~ | |
2858 | rp='Where will private files be installed?' | |
2859 | . ./getfile | |
4633a7c4 | 2860 | installsitearch="$ans" |
8e07c86e | 2861 | else |
4633a7c4 | 2862 | installsitearch="$sitearchexp" |
8e07c86e AD |
2863 | fi |
2864 | ||
4633a7c4 LW |
2865 | : determine where old public architecture dependent libraries might be |
2866 | case "$oldarchlib" in | |
2867 | '') case "$privlib" in | |
2868 | '') ;; | |
2869 | *) dflt="$privlib/$archname" | |
8e07c86e | 2870 | ;; |
8e07c86e AD |
2871 | esac |
2872 | ;; | |
4633a7c4 LW |
2873 | *) dflt="$oldarchlib" |
2874 | ;; | |
8e07c86e | 2875 | esac |
4633a7c4 LW |
2876 | if $test ! -d "$dflt/auto"; then |
2877 | dflt=none | |
2878 | fi | |
8e07c86e AD |
2879 | cat <<EOM |
2880 | ||
760ac839 | 2881 | In 5.001, Perl stored architecture-dependent library files in a directory |
4633a7c4 LW |
2882 | with a name such as $privlib/$archname, |
2883 | and this directory contained files from the standard extensions and | |
2884 | files from any additional extensions you might have added. Starting | |
2885 | with version 5.002, all the architecture-dependent standard extensions | |
760ac839 LW |
2886 | will go into a version-specific directory such as |
2887 | $archlib, | |
4633a7c4 LW |
2888 | while locally-added extensions will go into |
2889 | $sitearch. | |
2890 | ||
2891 | If you wish Perl to continue to search the old architecture-dependent | |
2892 | library for your local extensions, give the path to that directory. | |
2893 | If you do not wish to use your old architecture-dependent library | |
2894 | files, answer 'none'. | |
8e07c86e AD |
2895 | |
2896 | EOM | |
4633a7c4 LW |
2897 | fn=dn~ |
2898 | rp='Directory for your old 5.001 architecture-dependent libraries?' | |
8e07c86e | 2899 | . ./getfile |
4633a7c4 LW |
2900 | oldarchlib="$ans" |
2901 | oldarchlibexp="$ansexp" | |
2902 | case "$oldarchlib" in | |
2903 | ''|' ') val="$undef" ;; | |
2904 | *) val="$define" ;; | |
2905 | esac | |
2906 | set d_oldarchlib | |
2907 | eval $setvar | |
8e07c86e | 2908 | |
4633a7c4 LW |
2909 | : determine where public executables go |
2910 | echo " " | |
2911 | set dflt bin bin | |
2912 | eval $prefixit | |
2913 | fn=d~ | |
2914 | rp='Pathname where the public executables will reside?' | |
2915 | . ./getfile | |
2916 | if $test "X$ansexp" != "X$binexp"; then | |
2917 | installbin='' | |
2918 | fi | |
2919 | bin="$ans" | |
2920 | binexp="$ansexp" | |
8e07c86e AD |
2921 | if $afs; then |
2922 | $cat <<EOM | |
2923 | ||
2924 | Since you are running AFS, I need to distinguish the directory in which | |
4633a7c4 | 2925 | executables reside from the directory in which they are installed (and from |
8e07c86e AD |
2926 | which they are presumably copied to the former directory by occult means). |
2927 | ||
2928 | EOM | |
4633a7c4 LW |
2929 | case "$installbin" in |
2930 | '') dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;; | |
2931 | *) dflt="$installbin";; | |
8e07c86e AD |
2932 | esac |
2933 | fn=de~ | |
4633a7c4 | 2934 | rp='Where will public executables be installed?' |
8e07c86e | 2935 | . ./getfile |
4633a7c4 | 2936 | installbin="$ans" |
8e07c86e | 2937 | else |
4633a7c4 | 2938 | installbin="$binexp" |
8e07c86e AD |
2939 | fi |
2940 | ||
2c7991dc | 2941 | : determine where manual pages are on this system |
2942 | echo " " | |
2943 | case "$sysman" in | |
2944 | '') | |
2945 | syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1' | |
2946 | syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1" | |
2947 | syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1" | |
2948 | syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1" | |
2949 | syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1" | |
2950 | sysman=`./loc . /usr/man/man1 $syspath` | |
2951 | ;; | |
2952 | esac | |
2953 | if $test -d "$sysman"; then | |
2954 | echo "System manual is in $sysman." >&4 | |
2955 | else | |
2956 | echo "Could not find manual pages in source form." >&4 | |
2957 | fi | |
2958 | ||
2afac517 | 2959 | : see what memory models we can support |
2960 | case "$models" in | |
2961 | '') | |
2962 | $cat >pdp11.c <<'EOP' | |
2963 | main() { | |
2964 | #ifdef pdp11 | |
2965 | exit(0); | |
2966 | #else | |
2967 | exit(1); | |
2968 | #endif | |
2969 | } | |
2970 | EOP | |
2971 | cc -o pdp11 pdp11.c >/dev/null 2>&1 | |
2972 | if ./pdp11 2>/dev/null; then | |
2973 | dflt='unsplit split' | |
2974 | else | |
2975 | tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge` | |
2976 | case "$tans" in | |
2977 | X) dflt='none';; | |
2978 | *) if $test -d /lib/small || $test -d /usr/lib/small; then | |
2979 | dflt='small' | |
2980 | else | |
2981 | dflt='' | |
2982 | fi | |
2983 | if $test -d /lib/medium || $test -d /usr/lib/medium; then | |
2984 | dflt="$dflt medium" | |
2985 | fi | |
2986 | if $test -d /lib/large || $test -d /usr/lib/large; then | |
2987 | dflt="$dflt large" | |
2988 | fi | |
2989 | if $test -d /lib/huge || $test -d /usr/lib/huge; then | |
2990 | dflt="$dflt huge" | |
2991 | fi | |
2992 | esac | |
2993 | fi;; | |
2994 | *) dflt="$models";; | |
2995 | esac | |
8e07c86e | 2996 | $cat <<EOM |
2afac517 | 2997 | |
2998 | Some systems have different model sizes. On most systems they are called | |
2999 | small, medium, large, and huge. On the PDP11 they are called unsplit and | |
3000 | split. If your system doesn't support different memory models, say "none". | |
3001 | If you wish to force everything to one memory model, say "none" here and | |
3002 | put the appropriate flags later when it asks you for other cc and ld flags. | |
3003 | Venix systems may wish to put "none" and let the compiler figure things out. | |
3004 | (In the following question multiple model names should be space separated.) | |
8e07c86e | 3005 | |
8e07c86e | 3006 | EOM |
2afac517 | 3007 | rp="Which memory models are supported?" |
3008 | . ./myread | |
3009 | models="$ans" | |
3010 | ||
3011 | case "$models" in | |
3012 | none) | |
3013 | small='' | |
3014 | medium='' | |
3015 | large='' | |
3016 | huge='' | |
3017 | unsplit='' | |
3018 | split='' | |
2c7991dc | 3019 | ;; |
2afac517 | 3020 | *split) |
3021 | case "$split" in | |
3022 | '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \ | |
3023 | $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then | |
3024 | dflt='-i' | |
3025 | else | |
3026 | dflt='none' | |
3027 | fi;; | |
3028 | *) dflt="$split";; | |
3029 | esac | |
3030 | rp="What flag indicates separate I and D space?" | |
3031 | . ./myread | |
3032 | tans="$ans" | |
3033 | case "$tans" in | |
3034 | none) tans='';; | |
3035 | esac | |
3036 | split="$tans" | |
3037 | unsplit='';; | |
3038 | *large*|*small*|*medium*|*huge*) | |
3039 | case "$models" in | |
3040 | *large*) | |
3041 | case "$large" in | |
3042 | '') dflt='-Ml';; | |
3043 | *) dflt="$large";; | |
3044 | esac | |
3045 | rp="What flag indicates large model?" | |
3046 | . ./myread | |
3047 | tans="$ans" | |
3048 | case "$tans" in | |
3049 | none) tans=''; | |
3050 | esac | |
3051 | large="$tans";; | |
3052 | *) large='';; | |
3053 | esac | |
3054 | case "$models" in | |
3055 | *huge*) case "$huge" in | |
3056 | '') dflt='-Mh';; | |
3057 | *) dflt="$huge";; | |
3058 | esac | |
3059 | rp="What flag indicates huge model?" | |
3060 | . ./myread | |
3061 | tans="$ans" | |
3062 | case "$tans" in | |
3063 | none) tans=''; | |
3064 | esac | |
3065 | huge="$tans";; | |
3066 | *) huge="$large";; | |
3067 | esac | |
3068 | case "$models" in | |
3069 | *medium*) case "$medium" in | |
3070 | '') dflt='-Mm';; | |
3071 | *) dflt="$medium";; | |
3072 | esac | |
3073 | rp="What flag indicates medium model?" | |
3074 | . ./myread | |
3075 | tans="$ans" | |
3076 | case "$tans" in | |
3077 | none) tans=''; | |
3078 | esac | |
3079 | medium="$tans";; | |
3080 | *) medium="$large";; | |
3081 | esac | |
3082 | case "$models" in | |
3083 | *small*) case "$small" in | |
3084 | '') dflt='none';; | |
3085 | *) dflt="$small";; | |
3086 | esac | |
3087 | rp="What flag indicates small model?" | |
3088 | . ./myread | |
3089 | tans="$ans" | |
3090 | case "$tans" in | |
3091 | none) tans=''; | |
3092 | esac | |
3093 | small="$tans";; | |
3094 | *) small='';; | |
25f94b33 | 3095 | esac |
8e07c86e | 3096 | ;; |
2afac517 | 3097 | *) |
3098 | echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4 | |
8e07c86e AD |
3099 | ;; |
3100 | esac | |
8e07c86e | 3101 | |
2afac517 | 3102 | : see if we need a special compiler |
3103 | echo " " | |
3104 | if ./usg; then | |
3105 | case "$cc" in | |
3106 | '') case "$Mcc" in | |
3107 | /*) dflt='Mcc';; | |
3108 | *) case "$large" in | |
3109 | -M*) dflt='cc';; | |
3110 | *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then | |
3111 | if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then | |
3112 | dflt='cc' | |
3113 | else | |
3114 | dflt='cc -M' | |
3115 | fi | |
3116 | else | |
3117 | dflt='cc' | |
3118 | fi;; | |
3119 | esac;; | |
3120 | esac;; | |
3121 | *) dflt="$cc";; | |
3122 | esac | |
3123 | $cat <<'EOM' | |
3124 | On some systems the default C compiler will not resolve multiple global | |
3125 | references that happen to have the same name. On some such systems the "Mcc" | |
3126 | command may be used to force these to be resolved. On other systems a "cc -M" | |
3127 | command is required. (Note that the -M flag on other systems indicates a | |
3128 | memory model to use!) If you have the Gnu C compiler, you might wish to use | |
3129 | that instead. | |
8e07c86e AD |
3130 | |
3131 | EOM | |
2afac517 | 3132 | rp="What command will force resolution on this system?" |
3133 | . ./myread | |
3134 | cc="$ans" | |
8e07c86e | 3135 | else |
2afac517 | 3136 | case "$cc" in |
3137 | '') dflt=cc;; | |
3138 | *) dflt="$cc";; | |
3139 | esac | |
3140 | rp="Use which C compiler?" | |
3141 | . ./myread | |
3142 | cc="$ans" | |
8e07c86e | 3143 | fi |
2afac517 | 3144 | echo " " |
3145 | echo "Checking for GNU cc in disguise and/or its version number..." >&4 | |
3146 | $cat >gccvers.c <<EOM | |
3147 | #include <stdio.h> | |
3148 | int main() { | |
3149 | #ifdef __GNUC__ | |
3150 | #ifdef __VERSION__ | |
3151 | printf("%s\n", __VERSION__); | |
3152 | #else | |
3153 | printf("%s\n", "1"); | |
3154 | #endif | |
3155 | #endif | |
3156 | exit(0); | |
3157 | } | |
3158 | EOM | |
3159 | if $cc -o gccvers gccvers.c >/dev/null 2>&1; then | |
3160 | gccversion=`./gccvers` | |
3161 | case "$gccversion" in | |
3162 | '') echo "You are not using GNU cc." ;; | |
3163 | *) echo "You are using GNU cc $gccversion." ;; | |
3164 | esac | |
3165 | else | |
3166 | echo " " | |
3167 | echo "*** WHOA THERE!!! ***" >&4 | |
3168 | echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4 | |
3169 | case "$knowitall" in | |
3170 | '') | |
3171 | echo " You'd better start hunting for one and let me know about it." >&4 | |
3172 | exit 1 | |
2c7991dc | 3173 | ;; |
8e07c86e | 3174 | esac |
2afac517 | 3175 | fi |
3176 | $rm -f gccvers* | |
3177 | case "$gccversion" in | |
3178 | 1*) cpp=`./loc gcc-cpp $cpp $pth` ;; | |
8e07c86e AD |
3179 | esac |
3180 | ||
2afac517 | 3181 | : What should the include directory be ? |
8e07c86e | 3182 | echo " " |
2afac517 | 3183 | $echo $n "Hmm... $c" |
3184 | dflt='/usr/include' | |
3185 | incpath='' | |
3186 | mips_type='' | |
3187 | if $test -f /bin/mips && /bin/mips; then | |
3188 | echo "Looks like a MIPS system..." | |
3189 | $cat >usr.c <<'EOCP' | |
3190 | #ifdef SYSTYPE_BSD43 | |
3191 | /bsd43 | |
3192 | #endif | |
3193 | EOCP | |
3194 | if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then | |
3195 | dflt='/bsd43/usr/include' | |
3196 | incpath='/bsd43' | |
3197 | mips_type='BSD 4.3' | |
8e07c86e | 3198 | else |
2afac517 | 3199 | mips_type='System V' |
8e07c86e | 3200 | fi |
2afac517 | 3201 | $rm -f usr.c usr.out |
3202 | echo "and you're compiling with the $mips_type compiler and libraries." | |
3203 | xxx_prompt=y | |
3204 | echo "exit 0" >mips | |
8e07c86e | 3205 | else |
2afac517 | 3206 | echo "Doesn't look like a MIPS system." |
3207 | xxx_prompt=n | |
3208 | echo "exit 1" >mips | |
3209 | fi | |
3210 | chmod +x mips | |
3211 | $eunicefix mips | |
3212 | echo " " | |
3213 | case "$usrinc" in | |
3214 | '') ;; | |
3215 | *) dflt="$usrinc";; | |
3216 | esac | |
3217 | case "$xxx_prompt" in | |
3218 | y) fn=d/ | |
3219 | rp='Where are the include files you want to use?' | |
3220 | . ./getfile | |
3221 | usrinc="$ans" | |
3222 | ;; | |
3223 | *) usrinc="$dflt" | |
3224 | ;; | |
3225 | esac | |
8e07c86e | 3226 | |
2afac517 | 3227 | : Set private lib path |
3228 | case "$plibpth" in | |
3229 | '') if ./mips; then | |
3230 | plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib" | |
3231 | fi;; | |
3232 | esac | |
3233 | case "$libpth" in | |
3234 | ' ') dlist='';; | |
3235 | '') dlist="$loclibpth $plibpth $glibpth";; | |
3236 | *) dlist="$libpth";; | |
3237 | esac | |
8e07c86e | 3238 | |
2afac517 | 3239 | : Now check and see which directories actually exist, avoiding duplicates |
3240 | libpth='' | |
3241 | for xxx in $dlist | |
3242 | do | |
3243 | if $test -d $xxx; then | |
3244 | case " $libpth " in | |
3245 | *" $xxx "*) ;; | |
3246 | *) libpth="$libpth $xxx";; | |
3247 | esac | |
3248 | fi | |
3249 | done | |
3250 | $cat <<'EOM' | |
8e07c86e | 3251 | |
2afac517 | 3252 | Some systems have incompatible or broken versions of libraries. Among |
3253 | the directories listed in the question below, please remove any you | |
3254 | know not to be holding relevant libraries, and add any that are needed. | |
3255 | Say "none" for none. | |
8e07c86e | 3256 | |
8e07c86e | 3257 | EOM |
2afac517 | 3258 | case "$libpth" in |
3259 | '') dflt='none';; | |
3260 | *) | |
3261 | set X $libpth | |
3262 | shift | |
3263 | dflt=${1+"$@"} | |
4633a7c4 | 3264 | ;; |
8e07c86e | 3265 | esac |
2afac517 | 3266 | rp="Directories to use for library searches?" |
3267 | . ./myread | |
3268 | case "$ans" in | |
3269 | none) libpth=' ';; | |
3270 | *) libpth="$ans";; | |
3271 | esac | |
8e07c86e | 3272 | |
5f05dabc | 3273 | : Define several unixisms. Hints files or command line options |
3274 | : can be used to override them. | |
3275 | case "$ar" in | |
3276 | '') ar='ar';; | |
3277 | esac | |
3278 | case "$lib_ext" in | |
3279 | '') lib_ext='.a';; | |
3280 | esac | |
3281 | case "$obj_ext" in | |
3282 | '') obj_ext='.o';; | |
3283 | esac | |
3284 | case "$path_sep" in | |
3285 | '') path_sep=':';; | |
3286 | esac | |
3287 | : Which makefile gets called first. This is used by make depend. | |
3288 | case "$firstmakefile" in | |
3289 | '') firstmakefile='makefile';; | |
3290 | esac | |
3291 | ||
2afac517 | 3292 | : compute shared library extension |
3293 | case "$so" in | |
3294 | '') | |
3295 | if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then | |
3296 | dflt='sl' | |
3297 | else | |
3298 | dflt='so' | |
3299 | fi | |
3300 | ;; | |
3301 | *) dflt="$so";; | |
8e07c86e | 3302 | esac |
2afac517 | 3303 | $cat <<EOM |
8e07c86e | 3304 | |
2afac517 | 3305 | On some systems, shared libraries may be available. Answer 'none' if |
3306 | you want to suppress searching of shared libraries for the remaining | |
3307 | of this configuration. | |
8e07c86e AD |
3308 | |
3309 | EOM | |
2afac517 | 3310 | rp='What is the file extension used for shared libraries?' |
3311 | . ./myread | |
3312 | so="$ans" | |
8e07c86e | 3313 | |
2afac517 | 3314 | : Looking for optional libraries |
3315 | echo " " | |
3316 | echo "Checking for optional libraries..." >&4 | |
3317 | case "$libs" in | |
3318 | ' '|'') dflt='';; | |
3319 | *) dflt="$libs";; | |
8e07c86e | 3320 | esac |
2afac517 | 3321 | case "$libswanted" in |
3322 | '') libswanted='c_s';; | |
3323 | esac | |
3324 | for thislib in $libswanted; do | |
3325 | ||
3326 | if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`; $test -f "$xxx"; then | |
3327 | echo "Found -l$thislib (shared)." | |
3328 | case " $dflt " in | |
3329 | *"-l$thislib "*);; | |
3330 | *) dflt="$dflt -l$thislib";; | |
4633a7c4 | 3331 | esac |
2afac517 | 3332 | elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then |
3333 | echo "Found -l$thislib (shared)." | |
3334 | case " $dflt " in | |
3335 | *"-l$thislib "*);; | |
3336 | *) dflt="$dflt -l$thislib";; | |
3337 | esac | |
5f05dabc | 3338 | elif xxx=`./loc lib$thislib$lib_ext X $libpth`; $test -f "$xxx"; then |
2afac517 | 3339 | echo "Found -l$thislib." |
3340 | case " $dflt " in | |
3341 | *"-l$thislib "*);; | |
3342 | *) dflt="$dflt -l$thislib";; | |
3343 | esac | |
5f05dabc | 3344 | elif xxx=`./loc $thislib$lib_ext X $libpth`; $test -f "$xxx"; then |
2afac517 | 3345 | echo "Found -l$thislib." |
3346 | case " $dflt " in | |
3347 | *"-l$thislib "*);; | |
3348 | *) dflt="$dflt -l$thislib";; | |
3349 | esac | |
5f05dabc | 3350 | elif xxx=`./loc lib${thislib}_s$lib_ext X $libpth`; $test -f "$xxx"; then |
2afac517 | 3351 | echo "Found -l${thislib}_s." |
3352 | case " $dflt " in | |
3353 | *"-l$thislib "*);; | |
3354 | *) dflt="$dflt -l${thislib}_s";; | |
3355 | esac | |
5f05dabc | 3356 | elif xxx=`./loc Slib$thislib$lib_ext X $xlibpth`; $test -f "$xxx"; then |
2afac517 | 3357 | echo "Found -l$thislib." |
3358 | case " $dflt " in | |
3359 | *"-l$thislib "*);; | |
3360 | *) dflt="$dflt -l$thislib";; | |
3361 | esac | |
3362 | else | |
3363 | echo "No -l$thislib." | |
3364 | fi | |
3365 | done | |
3366 | set X $dflt | |
3367 | shift | |
3368 | dflt="$*" | |
3369 | case "$libs" in | |
3370 | '') dflt="$dflt";; | |
3371 | *) dflt="$libs";; | |
3372 | esac | |
3373 | case "$dflt" in | |
3374 | ' '|'') dflt='none';; | |
8e07c86e | 3375 | esac |
2afac517 | 3376 | |
4633a7c4 LW |
3377 | $cat <<EOM |
3378 | ||
2afac517 | 3379 | Some versions of Unix support shared libraries, which make executables smaller |
3380 | but make load time slightly longer. | |
8e07c86e | 3381 | |
2afac517 | 3382 | On some systems, mostly System V Release 3's, the shared library is included |
3383 | by putting the option "-lc_s" as the last thing on the cc command line when | |
3384 | linking. Other systems use shared libraries by default. There may be other | |
3385 | libraries needed to compile $package on your machine as well. If your system | |
3386 | needs the "-lc_s" option, include it here. Include any other special libraries | |
3387 | here as well. Say "none" for none. | |
4633a7c4 | 3388 | EOM |
2afac517 | 3389 | |
3390 | echo " " | |
3391 | rp="Any additional libraries?" | |
8e07c86e | 3392 | . ./myread |
2afac517 | 3393 | case "$ans" in |
3394 | none) libs=' ';; | |
3395 | *) libs="$ans";; | |
3396 | esac | |
8e07c86e | 3397 | |
4633a7c4 | 3398 | : see how we invoke the C preprocessor |
2304df62 | 3399 | echo " " |
4633a7c4 LW |
3400 | echo "Now, how can we feed standard input to your C preprocessor..." >&4 |
3401 | cat <<'EOT' >testcpp.c | |
3402 | #define ABC abc | |
3403 | #define XYZ xyz | |
3404 | ABC.XYZ | |
3405 | EOT | |
3406 | cd .. | |
3407 | echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin | |
3408 | chmod 755 cppstdin | |
3409 | wrapper=`pwd`/cppstdin | |
3410 | ok='false' | |
3411 | cd UU | |
3412 | ||
3413 | if $test "X$cppstdin" != "X" && \ | |
3414 | $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \ | |
3415 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 | |
3416 | then | |
3417 | echo "You used to use $cppstdin $cppminus so we'll use that again." | |
3418 | case "$cpprun" in | |
3419 | '') echo "But let's see if we can live without a wrapper..." ;; | |
3420 | *) | |
3421 | if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \ | |
3422 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 | |
3423 | then | |
3424 | echo "(And we'll use $cpprun $cpplast to preprocess directly.)" | |
3425 | ok='true' | |
a0d0e21e | 3426 | else |
4633a7c4 | 3427 | echo "(However, $cpprun $cpplast does not work, let's see...)" |
2304df62 | 3428 | fi |
2304df62 | 3429 | ;; |
2304df62 | 3430 | esac |
4633a7c4 LW |
3431 | else |
3432 | case "$cppstdin" in | |
3433 | '') ;; | |
3434 | *) | |
3435 | echo "Good old $cppstdin $cppminus does not seem to be of any help..." | |
3436 | ;; | |
3437 | esac | |
3438 | fi | |
3439 | ||
3440 | if $ok; then | |
3441 | : nothing | |
3442 | elif echo 'Maybe "'"$cc"' -E" will work...'; \ | |
3443 | $cc -E <testcpp.c >testcpp.out 2>&1; \ | |
3444 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
3445 | echo "Yup, it does." | |
3446 | x_cpp="$cc -E" | |
3447 | x_minus=''; | |
3448 | elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \ | |
3449 | $cc -E - <testcpp.c >testcpp.out 2>&1; \ | |
3450 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
3451 | echo "Yup, it does." | |
3452 | x_cpp="$cc -E" | |
3453 | x_minus='-'; | |
3454 | elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \ | |
3455 | $cc -P <testcpp.c >testcpp.out 2>&1; \ | |
3456 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
3457 | echo "Yipee, that works!" | |
3458 | x_cpp="$cc -P" | |
3459 | x_minus=''; | |
3460 | elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \ | |
3461 | $cc -P - <testcpp.c >testcpp.out 2>&1; \ | |
3462 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
3463 | echo "At long last!" | |
3464 | x_cpp="$cc -P" | |
3465 | x_minus='-'; | |
3466 | elif echo 'No such luck, maybe "'$cpp'" will work...'; \ | |
3467 | $cpp <testcpp.c >testcpp.out 2>&1; \ | |
3468 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
3469 | echo "It works!" | |
3470 | x_cpp="$cpp" | |
3471 | x_minus=''; | |
3472 | elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \ | |
3473 | $cpp - <testcpp.c >testcpp.out 2>&1; \ | |
3474 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
3475 | echo "Hooray, it works! I was beginning to wonder." | |
3476 | x_cpp="$cpp" | |
3477 | x_minus='-'; | |
3478 | elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \ | |
3479 | $wrapper <testcpp.c >testcpp.out 2>&1; \ | |
3480 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
3481 | x_cpp="$wrapper" | |
3482 | x_minus='' | |
3483 | echo "Eureka!" | |
3484 | else | |
3485 | dflt='' | |
3486 | rp="No dice. I can't find a C preprocessor. Name one:" | |
3487 | . ./myread | |
3488 | x_cpp="$ans" | |
3489 | x_minus='' | |
3490 | $x_cpp <testcpp.c >testcpp.out 2>&1 | |
3491 | if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
3492 | echo "OK, that will do." >&4 | |
3493 | else | |
3494 | echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4 | |
3495 | exit 1 | |
3496 | fi | |
3497 | fi | |
3498 | ||
3499 | case "$ok" in | |
3500 | false) | |
3501 | cppstdin="$x_cpp" | |
3502 | cppminus="$x_minus" | |
3503 | cpprun="$x_cpp" | |
3504 | cpplast="$x_minus" | |
3505 | set X $x_cpp | |
3506 | shift | |
3507 | case "$1" in | |
3508 | "$cpp") | |
3509 | echo "Perhaps can we force $cc -E using a wrapper..." | |
3510 | if $wrapper <testcpp.c >testcpp.out 2>&1; \ | |
3511 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 | |
3512 | then | |
3513 | echo "Yup, we can." | |
3514 | cppstdin="$wrapper" | |
3515 | cppminus=''; | |
3516 | else | |
3517 | echo "Nope, we'll have to live without it..." | |
3518 | fi | |
3519 | ;; | |
3520 | esac | |
3521 | case "$cpprun" in | |
3522 | "$wrapper") | |
3523 | cpprun='' | |
3524 | cpplast='' | |
3525 | ;; | |
3526 | esac | |
3527 | ;; | |
3528 | esac | |
3529 | ||
3530 | case "$cppstdin" in | |
3531 | "$wrapper") ;; | |
3532 | *) $rm -f $wrapper;; | |
3533 | esac | |
3534 | $rm -f testcpp.c testcpp.out | |
3535 | ||
2afac517 | 3536 | : determine optimize, if desired, or use for debug flag also |
3537 | case "$optimize" in | |
3538 | ' ') dflt='none';; | |
3539 | '') dflt='-O';; | |
3540 | *) dflt="$optimize";; | |
4633a7c4 | 3541 | esac |
2afac517 | 3542 | $cat <<EOH |
4633a7c4 | 3543 | |
760ac839 | 3544 | Some C compilers have problems with their optimizers. By default, $package |
4633a7c4 LW |
3545 | compiles with the -O flag to use the optimizer. Alternately, you might want |
3546 | to use the symbolic debugger, which uses the -g flag (on traditional Unix | |
3547 | systems). Either flag can be specified here. To use neither flag, specify | |
3548 | the word "none". | |
3549 | ||
3550 | EOH | |
3551 | rp="What optimizer/debugger flag should be used?" | |
3552 | . ./myread | |
3553 | optimize="$ans" | |
3554 | case "$optimize" in | |
3555 | 'none') optimize=" ";; | |
3556 | esac | |
3557 | ||
3558 | dflt='' | |
25f94b33 AD |
3559 | : We will not override a previous value, but we might want to |
3560 | : augment a hint file | |
3561 | case "$hint" in | |
3562 | none|recommended) | |
4633a7c4 LW |
3563 | case "$gccversion" in |
3564 | 1*) dflt='-fpcc-struct-return' ;; | |
3565 | esac | |
3566 | case "$optimize" in | |
3567 | *-g*) dflt="$dflt -DDEBUGGING";; | |
3568 | esac | |
3569 | case "$gccversion" in | |
3570 | 2*) if test -d /etc/conf/kconfig.d && | |
3571 | $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1 | |
3572 | then | |
3573 | dflt="$dflt -posix" | |
3574 | fi | |
3575 | ;; | |
3576 | esac | |
3577 | ;; | |
3578 | esac | |
3579 | ||
a4f3eea9 | 3580 | case "$mips_type" in |
3581 | *BSD*|'') inclwanted="$locincpth $usrinc";; | |
3582 | *) inclwanted="$locincpth $inclwanted $usrinc/bsd";; | |
3583 | esac | |
3584 | for thisincl in $inclwanted; do | |
3585 | if $test -d $thisincl; then | |
3586 | if $test x$thisincl != x$usrinc; then | |
3587 | case "$dflt" in | |
3588 | *$thisincl*);; | |
3589 | *) dflt="$dflt -I$thisincl";; | |
3590 | esac | |
3591 | fi | |
3592 | fi | |
3593 | done | |
3594 | ||
3595 | inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then | |
3596 | xxx=true; | |
3597 | elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then | |
3598 | xxx=true; | |
3599 | else | |
3600 | xxx=false; | |
3601 | fi; | |
3602 | if $xxx; then | |
3603 | case "$dflt" in | |
3604 | *$2*);; | |
3605 | *) dflt="$dflt -D$2";; | |
3606 | esac; | |
3607 | fi' | |
3608 | ||
3609 | if ./osf1; then | |
3610 | set signal.h __LANGUAGE_C__; eval $inctest | |
3611 | else | |
3612 | set signal.h LANGUAGE_C; eval $inctest | |
3613 | fi | |
a4f3eea9 | 3614 | set signal.h _NO_PROTO; eval $inctest |
3615 | ||
3616 | case "$hint" in | |
3617 | none|recommended) dflt="$ccflags $dflt" ;; | |
3618 | *) dflt="$ccflags";; | |
3619 | esac | |
3620 | ||
3621 | case "$dflt" in | |
3622 | ''|' ') dflt=none;; | |
3623 | esac | |
3624 | $cat <<EOH | |
3625 | ||
3626 | Your C compiler may want other flags. For this question you should include | |
3627 | -I/whatever and -DWHATEVER flags and any other flags used by the C compiler, | |
3628 | but you should NOT include libraries or ld flags like -lwhatever. If you | |
3629 | want $package to honor its debug switch, you should include -DDEBUGGING here. | |
3630 | Your C compiler might also need additional flags, such as -D_POSIX_SOURCE, | |
3631 | -DHIDEMYMALLOC or -DCRIPPLED_CC. | |
3632 | ||
3633 | To use no flags, specify the word "none". | |
3634 | ||
3635 | EOH | |
3636 | set X $dflt | |
3637 | shift | |
3638 | dflt=${1+"$@"} | |
3639 | rp="Any additional cc flags?" | |
3640 | . ./myread | |
3641 | case "$ans" in | |
3642 | none) ccflags='';; | |
3643 | *) ccflags="$ans";; | |
3644 | esac | |
3645 | ||
3646 | : the following weeds options from ccflags that are of no interest to cpp | |
3647 | cppflags="$ccflags" | |
3648 | case "$gccversion" in | |
3649 | 1*) cppflags="$cppflags -D__GNUC__" | |
3650 | esac | |
3651 | case "$mips_type" in | |
3652 | '');; | |
3653 | *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";; | |
3654 | esac | |
3655 | case "$cppflags" in | |
3656 | '');; | |
3657 | *) | |
3658 | echo " " | |
3659 | echo "Let me guess what the preprocessor flags are..." >&4 | |
3660 | set X $cppflags | |
3661 | shift | |
3662 | cppflags='' | |
3663 | $cat >cpp.c <<'EOM' | |
3664 | #define BLURFL foo | |
3665 | ||
3666 | BLURFL xx LFRULB | |
3667 | EOM | |
3668 | previous='' | |
3669 | for flag in $* | |
3670 | do | |
3671 | case "$flag" in | |
3672 | -*) ftry="$flag";; | |
3673 | *) ftry="$previous $flag";; | |
3674 | esac | |
3675 | if $cppstdin -DLFRULB=bar $ftry $cppminus <cpp.c \ | |
3676 | >cpp1.out 2>/dev/null && \ | |
3677 | $cpprun -DLFRULB=bar $ftry $cpplast <cpp.c \ | |
3678 | >cpp2.out 2>/dev/null && \ | |
3679 | $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \ | |
3680 | $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1 | |
3681 | then | |
3682 | cppflags="$cppflags $ftry" | |
3683 | previous='' | |
3684 | else | |
3685 | previous="$flag" | |
3686 | fi | |
3687 | done | |
3688 | set X $cppflags | |
3689 | shift | |
3690 | cppflags=${1+"$@"} | |
3691 | case "$cppflags" in | |
3692 | *-*) echo "They appear to be: $cppflags";; | |
3693 | esac | |
3694 | $rm -f cpp.c cpp?.out | |
3695 | ;; | |
3696 | esac | |
3697 | ||
3698 | : flags used in final linking phase | |
3699 | ||
3700 | case "$ldflags" in | |
3701 | '') if ./venix; then | |
3702 | dflt='-i -z' | |
3703 | else | |
3704 | dflt='' | |
3705 | fi | |
3706 | case "$ccflags" in | |
3707 | *-posix*) dflt="$dflt -posix" ;; | |
3708 | esac | |
3709 | ;; | |
3710 | *) dflt="$ldflags";; | |
3711 | esac | |
3712 | ||
3713 | : Try to guess additional flags to pick up local libraries. | |
3714 | for thislibdir in $libpth; do | |
3715 | case " $loclibpth " in | |
3716 | *" $thislibdir "*) | |
3717 | case "$dflt " in | |
3718 | *"-L$thislibdir "*) ;; | |
3719 | *) dflt="$dflt -L$thislibdir" ;; | |
3720 | esac | |
3721 | ;; | |
3722 | esac | |
3723 | done | |
3724 | ||
3725 | case "$dflt" in | |
3726 | '') dflt='none' ;; | |
3727 | esac | |
3728 | ||
3729 | $cat <<EOH | |
3730 | ||
3731 | Your C linker may need flags. For this question you should | |
3732 | include -L/whatever and any other flags used by the C linker, but you | |
3733 | should NOT include libraries like -lwhatever. | |
3734 | ||
3735 | Make sure you include the appropriate -L/path flags if your C linker | |
3736 | does not normally search all of the directories you specified above, | |
3737 | namely | |
3738 | $libpth | |
3739 | To use no flags, specify the word "none". | |
3740 | ||
3741 | EOH | |
3742 | ||
3743 | rp="Any additional ld flags (NOT including libraries)?" | |
3744 | . ./myread | |
3745 | case "$ans" in | |
3746 | none) ldflags='';; | |
3747 | *) ldflags="$ans";; | |
3748 | esac | |
3749 | rmlist="$rmlist pdp11" | |
3750 | ||
3751 | : coherency check | |
3752 | echo " " | |
3753 | echo "Checking your choice of C compiler and flags for coherency..." >&4 | |
3754 | set X $cc $optimize $ccflags $ldflags try.c -o try | |
3755 | shift | |
3756 | $cat >try.msg <<EOM | |
3757 | I've tried to compile and run a simple program with: | |
3758 | ||
3759 | $* | |
3760 | ./try | |
3761 | ||
3762 | and I got the following output: | |
3763 | ||
3764 | EOM | |
3765 | $cat > try.c <<'EOF' | |
3766 | #include <stdio.h> | |
3767 | main() { exit(0); } | |
3768 | EOF | |
3769 | dflt=y | |
3770 | if sh -c "$cc $optimize $ccflags try.c -o try $ldflags" >>try.msg 2>&1; then | |
3771 | if sh -c './try' >>try.msg 2>&1; then | |
3772 | dflt=n | |
3773 | else | |
3774 | echo "The program compiled OK, but exited with status $?." >>try.msg | |
3775 | rp="You have a problem. Shall I abort Configure" | |
3776 | dflt=y | |
3777 | fi | |
3778 | else | |
3779 | echo "I can't compile the test program." >>try.msg | |
3780 | rp="You have a BIG problem. Shall I abort Configure" | |
3781 | dflt=y | |
3782 | fi | |
3783 | case "$dflt" in | |
3784 | y) | |
3785 | $cat try.msg | |
3786 | case "$knowitall" in | |
3787 | '') | |
3788 | echo "(The supplied flags might be incorrect with this C compiler.)" | |
3789 | ;; | |
3790 | *) dflt=n;; | |
3791 | esac | |
3792 | echo " " | |
3793 | . ./myread | |
3794 | case "$ans" in | |
3795 | n*|N*) ;; | |
3796 | *) echo "Ok. Stopping Configure." >&4 | |
3797 | exit 1 | |
3798 | ;; | |
3799 | esac | |
3800 | ;; | |
3801 | n) echo "OK, that should do.";; | |
3802 | esac | |
3803 | $rm -f try try.* core | |
3804 | ||
3805 | echo " " | |
3806 | echo "Checking for GNU C Library..." >&4 | |
3807 | cat >gnulibc.c <<EOM | |
3808 | int | |
3809 | main() | |
3810 | { | |
3811 | return __libc_main(); | |
3812 | } | |
3813 | EOM | |
3814 | if $cc $ccflags $ldflags -o gnulibc gnulibc.c $libs >/dev/null 2>&1 && \ | |
3815 | ./gnulibc | $contains '^GNU C Library' >/dev/null 2>&1; then | |
3816 | val="$define" | |
3817 | echo "You are using the GNU C Library" | |
4633a7c4 | 3818 | else |
a4f3eea9 | 3819 | val="$undef" |
3820 | echo "You are not using the GNU C Library" | |
4633a7c4 | 3821 | fi |
a4f3eea9 | 3822 | $rm -f gnulibc* |
3823 | set d_gnulibc | |
3824 | eval $setvar | |
25f94b33 | 3825 | |
a4f3eea9 | 3826 | : see if nm is to be used to determine whether a symbol is defined or not |
3827 | case "$usenm" in | |
3828 | '') | |
3829 | case "$d_gnulibc" in | |
3830 | $define) | |
3831 | dflt=n | |
3832 | ;; | |
3833 | *) | |
3834 | dflt=`egrep 'inlibc|csym' ../Configure | wc -l 2>/dev/null` | |
3835 | if $test $dflt -gt 20; then | |
3836 | dflt=y | |
3837 | else | |
3838 | dflt=n | |
3839 | fi | |
3840 | ;; | |
3841 | esac | |
3842 | ;; | |
3843 | *) | |
3844 | case "$usenm" in | |
3845 | true) dflt=y;; | |
3846 | *) dflt=n;; | |
3847 | esac | |
3848 | ;; | |
25f94b33 | 3849 | esac |
a4f3eea9 | 3850 | $cat <<EOM |
4633a7c4 | 3851 | |
a4f3eea9 | 3852 | I can use 'nm' to extract the symbols from your C libraries. This is a time |
3853 | consuming task which may generate huge output on the disk (up to 3 megabytes) | |
3854 | but that should make the symbols extraction faster. The alternative is to skip | |
3855 | the 'nm' extraction part and to compile a small test program instead to | |
3856 | determine whether each symbol is present. If you have a fast C compiler and/or | |
3857 | if your 'nm' output cannot be parsed, this may be the best solution. | |
3858 | You shouldn't let me use 'nm' if you have the GNU C Library. | |
4633a7c4 | 3859 | |
a4f3eea9 | 3860 | EOM |
3861 | rp='Shall I use nm to extract C symbols from the libraries?' | |
4633a7c4 LW |
3862 | . ./myread |
3863 | case "$ans" in | |
a4f3eea9 | 3864 | n|N) usenm=false;; |
3865 | *) usenm=true;; | |
4633a7c4 LW |
3866 | esac |
3867 | ||
a4f3eea9 | 3868 | runnm=$usenm |
3869 | case "$reuseval" in | |
3870 | true) runnm=false;; | |
4633a7c4 | 3871 | esac |
a4f3eea9 | 3872 | |
3873 | : nm options which may be necessary | |
3874 | case "$nm_opt" in | |
3875 | '') if $test -f /mach_boot; then | |
3876 | nm_opt='' | |
3877 | elif $test -d /usr/ccs/lib; then | |
3878 | nm_opt='-p' | |
3879 | elif $test -f /dgux; then | |
3880 | nm_opt='-p' | |
3881 | else | |
3882 | nm_opt='' | |
3883 | fi;; | |
4633a7c4 | 3884 | esac |
4633a7c4 | 3885 | |
a4f3eea9 | 3886 | : nm options which may be necessary for shared libraries but illegal |
3887 | : for archive libraries. Thank you, Linux. | |
3888 | case "$nm_so_opt" in | |
3889 | '') case "$myuname" in | |
3890 | *linux*) | |
3891 | if nm --help | $grep 'dynamic' > /dev/null 2>&1; then | |
3892 | nm_so_opt='--dynamic' | |
4633a7c4 | 3893 | fi |
a4f3eea9 | 3894 | ;; |
4633a7c4 | 3895 | esac |
4633a7c4 LW |
3896 | ;; |
3897 | esac | |
3898 | ||
a4f3eea9 | 3899 | case "$runnm" in |
3900 | true) | |
3901 | : get list of predefined functions in a handy place | |
3902 | echo " " | |
3903 | case "$libc" in | |
3904 | '') libc=unknown | |
3905 | case "$libs" in | |
5f05dabc | 3906 | *-lc_s*) libc=`./loc libc_s$lib_ext $libc $libpth` |
a4f3eea9 | 3907 | esac |
3908 | ;; | |
3909 | esac | |
3910 | libnames=''; | |
3911 | case "$libs" in | |
3912 | '') ;; | |
3913 | *) for thislib in $libs; do | |
3914 | case "$thislib" in | |
3915 | -lc|-lc_s) | |
3916 | : Handle C library specially below. | |
3917 | ;; | |
3918 | -l*) | |
3919 | thislib=`echo $thislib | $sed -e 's/^-l//'` | |
3920 | if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then | |
3921 | : | |
3922 | elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then | |
3923 | : | |
5f05dabc | 3924 | elif try=`./loc lib$thislib$lib_ext X $libpth`; $test -f "$try"; then |
a4f3eea9 | 3925 | : |
d97d40b5 IZ |
3926 | elif try=`./loc $thislib$lib_ext X $libpth`; $test -f "$try"; then |
3927 | : | |
a4f3eea9 | 3928 | elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then |
3929 | : | |
3930 | elif try=`./loc $thislib X $libpth`; $test -f "$try"; then | |
3931 | : | |
5f05dabc | 3932 | elif try=`./loc Slib$thislib$lib_ext X $xlibpth`; $test -f "$try"; then |
a4f3eea9 | 3933 | : |
3934 | else | |
3935 | try='' | |
3936 | fi | |
3937 | libnames="$libnames $try" | |
3938 | ;; | |
3939 | *) libnames="$libnames $thislib" ;; | |
3940 | esac | |
3941 | done | |
3942 | ;; | |
3943 | esac | |
3944 | xxx=normal | |
3945 | case "$libc" in | |
3946 | unknown) | |
3947 | set /lib/libc.$so | |
3948 | for xxx in $libpth; do | |
3949 | $test -r $1 || set $xxx/libc.$so | |
3950 | : The messy sed command sorts on library version numbers. | |
3951 | $test -r $1 || \ | |
3952 | set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \ | |
3953 | tr ' ' '\012' | egrep -v '\.[A-Za-z]*$' | $sed -e ' | |
3954 | h | |
3955 | s/[0-9][0-9]*/0000&/g | |
3956 | s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g | |
3957 | G | |
3958 | s/\n/ /' | \ | |
3959 | sort | $sed -e 's/^.* //'` | |
3960 | eval set \$$# | |
3961 | done | |
3962 | $test -r $1 || set /usr/ccs/lib/libc.$so | |
5f05dabc | 3963 | $test -r $1 || set /lib/libsys_s$lib_ext |
a4f3eea9 | 3964 | ;; |
3965 | *) | |
3966 | set blurfl | |
3967 | ;; | |
3968 | esac | |
3969 | if $test -r "$1"; then | |
3970 | echo "Your (shared) C library seems to be in $1." | |
3971 | libc="$1" | |
3972 | elif $test -r /lib/libc && $test -r /lib/clib; then | |
3973 | echo "Your C library seems to be in both /lib/clib and /lib/libc." | |
3974 | xxx=apollo | |
3975 | libc='/lib/clib /lib/libc' | |
3976 | if $test -r /lib/syslib; then | |
3977 | echo "(Your math library is in /lib/syslib.)" | |
3978 | libc="$libc /lib/syslib" | |
3979 | fi | |
3980 | elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then | |
3981 | echo "Your C library seems to be in $libc, as you said before." | |
5f05dabc | 3982 | elif $test -r $incpath/usr/lib/libc$lib_ext; then |
3983 | libc=$incpath/usr/lib/libc$lib_ext; | |
a4f3eea9 | 3984 | echo "Your C library seems to be in $libc. That's fine." |
5f05dabc | 3985 | elif $test -r /lib/libc$lib_ext; then |
3986 | libc=/lib/libc$lib_ext; | |
a4f3eea9 | 3987 | echo "Your C library seems to be in $libc. You're normal." |
3988 | else | |
5f05dabc | 3989 | if tans=`./loc libc$lib_ext blurfl/dyick $libpth`; $test -r "$tans"; then |
a4f3eea9 | 3990 | : |
3991 | elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then | |
3992 | libnames="$libnames "`./loc clib blurfl/dyick $libpth` | |
3993 | elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then | |
3994 | : | |
5f05dabc | 3995 | elif tans=`./loc Slibc$lib_ext blurfl/dyick $xlibpth`; $test -r "$tans"; then |
a4f3eea9 | 3996 | : |
5f05dabc | 3997 | elif tans=`./loc Mlibc$lib_ext blurfl/dyick $xlibpth`; $test -r "$tans"; then |
a4f3eea9 | 3998 | : |
4633a7c4 | 3999 | else |
5f05dabc | 4000 | tans=`./loc Llibc$lib_ext blurfl/dyick $xlibpth` |
4633a7c4 | 4001 | fi |
a4f3eea9 | 4002 | if $test -r "$tans"; then |
4003 | echo "Your C library seems to be in $tans, of all places." | |
4004 | libc=$tans | |
4005 | else | |
4006 | libc='blurfl' | |
4007 | fi | |
4008 | fi | |
4009 | if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then | |
4010 | dflt="$libc" | |
4011 | cat <<EOM | |
4633a7c4 | 4012 | |
a4f3eea9 | 4013 | If the guess above is wrong (which it might be if you're using a strange |
4014 | compiler, or your machine supports multiple models), you can override it here. | |
4633a7c4 | 4015 | |
a4f3eea9 | 4016 | EOM |
4017 | else | |
4018 | dflt='' | |
4019 | echo $libpth | tr ' ' '\012' | sort | uniq > libpath | |
4020 | cat >&4 <<EOM | |
4021 | I can't seem to find your C library. I've looked in the following places: | |
4633a7c4 | 4022 | |
a4f3eea9 | 4023 | EOM |
4024 | $sed 's/^/ /' libpath | |
4025 | cat <<EOM | |
4633a7c4 | 4026 | |
a4f3eea9 | 4027 | None of these seems to contain your C library. I need to get its name... |
4633a7c4 | 4028 | |
a4f3eea9 | 4029 | EOM |
4030 | fi | |
4031 | fn=f | |
4032 | rp='Where is your C library?' | |
4033 | . ./getfile | |
4034 | libc="$ans" | |
4633a7c4 | 4035 | |
4633a7c4 | 4036 | echo " " |
a4f3eea9 | 4037 | echo $libc $libnames | tr ' ' '\012' | sort | uniq > libnames |
4038 | set X `cat libnames` | |
4633a7c4 | 4039 | shift |
a4f3eea9 | 4040 | xxx=files |
4041 | case $# in 1) xxx=file; esac | |
4042 | echo "Extracting names from the following $xxx for later perusal:" >&4 | |
4043 | echo " " | |
4044 | $sed 's/^/ /' libnames >&4 | |
4045 | echo " " | |
4046 | $echo $n "This may take a while...$c" >&4 | |
4633a7c4 | 4047 | |
a4f3eea9 | 4048 | : Linux may need the special Dynamic option to nm for shared libraries. |
4049 | : In general, this is stored in the nm_so_opt variable. | |
4050 | : Unfortunately, that option may be fatal on non-shared libraries. | |
4051 | for nm_libs_ext in $*; do | |
4052 | case $nm_libs_ext in | |
4053 | *$so*) nm $nm_so_opt $nm_opt $nm_libs_ext 2>/dev/null ;; | |
4054 | *) nm $nm_opt $nm_libs_ext 2>/dev/null ;; | |
4055 | esac | |
4056 | done > libc.tmp | |
4633a7c4 | 4057 | |
a4f3eea9 | 4058 | $echo $n ".$c" |
4059 | $grep fprintf libc.tmp > libc.ptf | |
4060 | xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4' | |
4061 | xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4' | |
4062 | xxx='[ADTSIW]' | |
4063 | if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\ | |
4064 | eval $xscan;\ | |
4065 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4066 | eval $xrun | |
4067 | elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\ | |
4068 | eval $xscan;\ | |
4069 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4070 | eval $xrun | |
4071 | elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\ | |
4072 | eval $xscan;\ | |
4073 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4074 | eval $xrun | |
4075 | elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\ | |
4076 | eval $xscan;\ | |
4077 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4078 | eval $xrun | |
4079 | elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\ | |
4080 | eval $xscan;\ | |
4081 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4082 | eval $xrun | |
4083 | elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\ | |
4084 | eval $xscan;\ | |
4085 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4086 | eval $xrun | |
4087 | elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \ | |
4088 | -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\ | |
4089 | eval $xscan;\ | |
4090 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4091 | eval $xrun | |
4092 | elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\ | |
4093 | eval $xscan;\ | |
4094 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4095 | eval $xrun | |
4096 | elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\ | |
4097 | eval $xscan;\ | |
4098 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4099 | eval $xrun | |
4100 | elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\ | |
4101 | eval $xscan;\ | |
4102 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4103 | eval $xrun | |
4104 | elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\ | |
4105 | eval $xscan;\ | |
4106 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4107 | eval $xrun | |
44a8e56a | 4108 | elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\ |
4109 | eval $xscan;\ | |
4110 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4111 | eval $xrun | |
a4f3eea9 | 4112 | else |
4113 | nm -p $* 2>/dev/null >libc.tmp | |
4114 | $grep fprintf libc.tmp > libc.ptf | |
4115 | if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\ | |
4116 | eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1 | |
4117 | then | |
4118 | nm_opt='-p' | |
4119 | eval $xrun | |
4633a7c4 | 4120 | else |
a4f3eea9 | 4121 | echo " " |
4122 | echo "nm didn't seem to work right. Trying ar instead..." >&4 | |
4123 | com='' | |
4124 | if ar t $libc > libc.tmp; then | |
4125 | for thisname in $libnames; do | |
4126 | ar t $thisname >>libc.tmp | |
4127 | done | |
4128 | $sed -e 's/\.o$//' < libc.tmp > libc.list | |
4129 | echo "Ok." >&4 | |
4130 | else | |
4131 | echo "ar didn't seem to work right." >&4 | |
4132 | echo "Maybe this is a Cray...trying bld instead..." >&4 | |
4133 | if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list | |
4134 | then | |
4135 | for thisname in $libnames; do | |
4136 | bld t $libnames | \ | |
4137 | $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list | |
4138 | ar t $thisname >>libc.tmp | |
4139 | done | |
4140 | echo "Ok." >&4 | |
4141 | else | |
4142 | echo "That didn't work either. Giving up." >&4 | |
4143 | exit 1 | |
4144 | fi | |
4145 | fi | |
4633a7c4 | 4146 | fi |
4633a7c4 | 4147 | fi |
a4f3eea9 | 4148 | nm_extract="$com" |
4149 | if $test -f /lib/syscalls.exp; then | |
4633a7c4 | 4150 | echo " " |
a4f3eea9 | 4151 | echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4 |
4152 | $sed -n 's/^\([^ ]*\)[ ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list | |
4153 | fi | |
4154 | ;; | |
4155 | esac | |
4156 | $rm -f libnames libpath | |
4157 | ||
2afac517 | 4158 | : determine filename position in cpp output |
4633a7c4 | 4159 | echo " " |
2afac517 | 4160 | echo "Computing filename position in cpp output for #include directives..." >&4 |
4161 | echo '#include <stdio.h>' > foo.c | |
4162 | $cat >fieldn <<EOF | |
4163 | $startsh | |
4164 | $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \ | |
4165 | $grep '^[ ]*#.*stdio\.h' | \ | |
4166 | while read cline; do | |
4167 | pos=1 | |
4168 | set \$cline | |
4169 | while $test \$# -gt 0; do | |
4170 | if $test -r \`echo \$1 | $tr -d '"'\`; then | |
4171 | echo "\$pos" | |
4172 | exit 0 | |
4173 | fi | |
4174 | shift | |
4175 | pos=\`expr \$pos + 1\` | |
4176 | done | |
4633a7c4 | 4177 | done |
2afac517 | 4178 | EOF |
4179 | chmod +x fieldn | |
4180 | fieldn=`./fieldn` | |
4181 | $rm -f foo.c fieldn | |
4182 | case $fieldn in | |
4183 | '') pos='???';; | |
4184 | 1) pos=first;; | |
4185 | 2) pos=second;; | |
4186 | 3) pos=third;; | |
4187 | *) pos="${fieldn}th";; | |
4633a7c4 | 4188 | esac |
2afac517 | 4189 | echo "Your cpp writes the filename in the $pos field of the line." |
4633a7c4 | 4190 | |
2afac517 | 4191 | : locate header file |
4192 | $cat >findhdr <<EOF | |
4193 | $startsh | |
4194 | wanted=\$1 | |
4195 | name='' | |
4196 | if test -f $usrinc/\$wanted; then | |
4197 | echo "$usrinc/\$wanted" | |
4198 | exit 0 | |
4199 | fi | |
4200 | awkprg='{ print \$$fieldn }' | |
4201 | echo "#include <\$wanted>" > foo\$\$.c | |
4202 | $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \ | |
4203 | $grep "^[ ]*#.*\$wanted" | \ | |
4204 | while read cline; do | |
4205 | name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\` | |
4206 | case "\$name" in | |
4207 | */\$wanted) echo "\$name"; exit 0;; | |
4208 | *) name='';; | |
4209 | esac; | |
4210 | done; | |
4211 | $rm -f foo\$\$.c; | |
4212 | case "\$name" in | |
4213 | '') exit 1;; | |
4633a7c4 | 4214 | esac |
2afac517 | 4215 | EOF |
4216 | chmod +x findhdr | |
4633a7c4 | 4217 | |
2afac517 | 4218 | : define an alternate in-header-list? function |
4219 | inhdr='echo " "; td=$define; tu=$undef; yyy=$@; | |
4220 | cont=true; xxf="echo \"<\$1> found.\" >&4"; | |
4221 | case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";; | |
4222 | *) xxnf="echo \"<\$1> NOT found, ...\" >&4";; | |
4223 | esac; | |
4224 | case $# in 4) instead=instead;; *) instead="at last";; esac; | |
4225 | while $test "$cont"; do | |
4226 | xxx=`./findhdr $1` | |
4227 | var=$2; eval "was=\$$2"; | |
4228 | if $test "$xxx" && $test -r "$xxx"; | |
4229 | then eval $xxf; | |
4230 | eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td"; | |
4231 | cont=""; | |
4232 | else eval $xxnf; | |
4233 | eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi; | |
4234 | set $yyy; shift; shift; yyy=$@; | |
4235 | case $# in 0) cont="";; | |
4236 | 2) xxf="echo \"but I found <\$1> $instead.\" >&4"; | |
4237 | xxnf="echo \"and I did not find <\$1> either.\" >&4";; | |
4238 | *) xxf="echo \"but I found <\$1\> instead.\" >&4"; | |
4239 | xxnf="echo \"there is no <\$1>, ...\" >&4";; | |
4240 | esac; | |
4241 | done; | |
4242 | while $test "$yyy"; | |
4243 | do set $yyy; var=$2; eval "was=\$$2"; | |
4244 | eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; | |
4245 | set $yyy; shift; shift; yyy=$@; | |
4246 | done' | |
4633a7c4 | 4247 | |
2afac517 | 4248 | : see if dld is available |
4249 | set dld.h i_dld | |
4250 | eval $inhdr | |
4633a7c4 | 4251 | |
2afac517 | 4252 | : is a C symbol defined? |
4253 | csym='tlook=$1; | |
4254 | case "$3" in | |
4255 | -v) tf=libc.tmp; tc=""; tdc="";; | |
4256 | -a) tf=libc.tmp; tc="[0]"; tdc="[]";; | |
4257 | *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";; | |
4258 | esac; | |
4259 | tx=yes; | |
4260 | case "$reuseval-$4" in | |
4261 | true-) ;; | |
4262 | true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;; | |
4263 | esac; | |
4264 | case "$tx" in | |
4265 | yes) | |
4266 | case "$runnm" in | |
4267 | true) | |
4268 | if $contains $tlook $tf >/dev/null 2>&1; | |
4269 | then tval=true; | |
4270 | else tval=false; | |
4271 | fi;; | |
4272 | *) | |
4273 | echo "main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c; | |
4274 | if $cc $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1; | |
4275 | then tval=true; | |
4276 | else tval=false; | |
4277 | fi; | |
4278 | $rm -f t t.c;; | |
4279 | esac;; | |
4280 | *) | |
4281 | case "$tval" in | |
4282 | $define) tval=true;; | |
4283 | *) tval=false;; | |
4284 | esac;; | |
4285 | esac; | |
4286 | eval "$2=$tval"' | |
4633a7c4 | 4287 | |
2afac517 | 4288 | : define an is-in-libc? function |
4289 | inlibc='echo " "; td=$define; tu=$undef; | |
4290 | sym=$1; var=$2; eval "was=\$$2"; | |
4291 | tx=yes; | |
4292 | case "$reuseval$was" in | |
4293 | true) ;; | |
4294 | true*) tx=no;; | |
4295 | esac; | |
4296 | case "$tx" in | |
4297 | yes) | |
4298 | set $sym tres -f; | |
4299 | eval $csym; | |
4300 | case "$tres" in | |
4301 | true) | |
4302 | echo "$sym() found." >&4; | |
4303 | case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";; | |
4304 | *) | |
4305 | echo "$sym() NOT found." >&4; | |
4306 | case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";; | |
4307 | esac;; | |
4308 | *) | |
4309 | case "$was" in | |
4310 | $define) echo "$sym() found." >&4;; | |
4311 | *) echo "$sym() NOT found." >&4;; | |
4312 | esac;; | |
4313 | esac' | |
4633a7c4 | 4314 | |
2afac517 | 4315 | : see if dlopen exists |
4316 | xxx_runnm="$runnm" | |
4317 | runnm=false | |
4318 | set dlopen d_dlopen | |
4319 | eval $inlibc | |
4320 | runnm="$xxx_runnm" | |
40a7a20a | 4321 | |
2afac517 | 4322 | : determine which dynamic loading, if any, to compile in |
4633a7c4 | 4323 | echo " " |
2afac517 | 4324 | dldir="ext/DynaLoader" |
4325 | case "$usedl" in | |
4326 | $define|y|true) | |
4327 | dflt='y' | |
4328 | usedl="$define" | |
4329 | ;; | |
4330 | $undef|n|false) | |
4331 | dflt='n' | |
4332 | usedl="$undef" | |
4333 | ;; | |
4334 | *) | |
4335 | dflt='n' | |
4336 | case "$d_dlopen" in | |
4337 | $define) dflt='y' ;; | |
4338 | esac | |
4339 | case "$i_dld" in | |
4340 | $define) dflt='y' ;; | |
4633a7c4 | 4341 | esac |
2afac517 | 4342 | : Does a dl_xxx.xs file exist for this operating system |
4343 | $test -f ../$dldir/dl_${osname}.xs && dflt='y' | |
4633a7c4 LW |
4344 | ;; |
4345 | esac | |
2afac517 | 4346 | rp="Do you wish to use dynamic loading?" |
4347 | . ./myread | |
4348 | usedl="$ans" | |
4349 | case "$ans" in | |
4350 | y*) usedl="$define" | |
4351 | case "$dlsrc" in | |
4352 | '') | |
4353 | if $test -f ../$dldir/dl_${osname}.xs ; then | |
4354 | dflt="$dldir/dl_${osname}.xs" | |
4355 | elif $test "$d_dlopen" = "$define" ; then | |
4356 | dflt="$dldir/dl_dlopen.xs" | |
4357 | elif $test "$i_dld" = "$define" ; then | |
4358 | dflt="$dldir/dl_dld.xs" | |
4633a7c4 | 4359 | else |
2afac517 | 4360 | dflt='' |
4633a7c4 | 4361 | fi |
4633a7c4 | 4362 | ;; |
2afac517 | 4363 | *) dflt="$dldir/$dlsrc" |
4364 | ;; | |
4633a7c4 | 4365 | esac |
2afac517 | 4366 | echo "The following dynamic loading files are available:" |
4367 | : Can not go over to $dldir because getfile has path hard-coded in. | |
4368 | cd ..; ls -C $dldir/dl*.xs; cd UU | |
4369 | rp="Source file to use for dynamic loading" | |
4370 | fn="fne" | |
4371 | . ./getfile | |
4372 | usedl="$define" | |
4373 | : emulate basename | |
4374 | dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'` | |
2304df62 | 4375 | |
2afac517 | 4376 | $cat << EOM |
2304df62 | 4377 | |
2afac517 | 4378 | Some systems may require passing special flags to $cc -c to |
4379 | compile modules that will be used to create a shared library. | |
4380 | To use no flags, say "none". | |
2304df62 AD |
4381 | |
4382 | EOM | |
2afac517 | 4383 | case "$cccdlflags" in |
4384 | '') case "$gccversion" in | |
4385 | '') case "$osname" in | |
4386 | hpux) dflt='+z' ;; | |
4387 | next) dflt='none' ;; | |
4388 | solaris|svr4*|esix*) dflt='-Kpic' ;; | |
4389 | irix*) dflt='-KPIC' ;; | |
4390 | sunos) dflt='-pic' ;; | |
4391 | *) dflt='none' ;; | |
4392 | esac ;; | |
4393 | *) dflt='-fpic' ;; | |
4394 | esac ;; | |
4395 | *) dflt="$cccdlflags" ;; | |
4396 | esac | |
4397 | rp="Any special flags to pass to $cc -c to compile shared library modules?" | |
4398 | . ./myread | |
4399 | case "$ans" in | |
4400 | none) cccdlflags=' ' ;; | |
4401 | *) cccdlflags="$ans" ;; | |
4402 | esac | |
2304df62 | 4403 | |
2afac517 | 4404 | cat << EOM |
ecfc5424 | 4405 | |
2afac517 | 4406 | Some systems use ld to create libraries that can be dynamically loaded, |
4407 | while other systems (such as those using ELF) use $cc. | |
a0f45b59 | 4408 | |
2afac517 | 4409 | EOM |
4410 | case "$ld" in | |
4411 | '') $cat >try.c <<'EOM' | |
4412 | /* Test for whether ELF binaries are produced */ | |
4413 | #include <fcntl.h> | |
4414 | #include <stdlib.h> | |
4415 | main() { | |
4416 | char b[4]; | |
4417 | int i = open("a.out",O_RDONLY); | |
4418 | if(i == -1) | |
4419 | exit(1); /* fail */ | |
4420 | if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F') | |
4421 | exit(0); /* succeed (yes, it's ELF) */ | |
2304df62 | 4422 | else |
2afac517 | 4423 | exit(1); /* fail */ |
4424 | } | |
4425 | EOM | |
4426 | if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then | |
4427 | cat <<EOM | |
4428 | You appear to have ELF support. I'll use $cc to build dynamic libraries. | |
4429 | EOM | |
4430 | dflt="$cc" | |
2304df62 | 4431 | else |
2afac517 | 4432 | echo "I'll use ld to build dynamic libraries." |
4433 | dflt='ld' | |
2304df62 | 4434 | fi |
2afac517 | 4435 | rm -f try.c a.out |
4436 | ;; | |
4437 | *) dflt="$ld" | |
4438 | ;; | |
4439 | esac | |
4440 | ||
4441 | rp="What command should be used to create dynamic libraries?" | |
4442 | . ./myread | |
4443 | ld="$ans" | |
4444 | ||
4445 | cat << EOM | |
4446 | ||
4447 | Some systems may require passing special flags to $ld to create a | |
4448 | library that can be dynamically loaded. If your ld flags include | |
4449 | -L/other/path options to locate libraries outside your loader's normal | |
4450 | search path, you may need to specify those -L options here as well. To | |
4451 | use no flags, say "none". | |
4452 | ||
4453 | EOM | |
4454 | case "$lddlflags" in | |
4455 | '') case "$osname" in | |
4456 | hpux) dflt='-b' ;; | |
4457 | linux|irix*) dflt='-shared' ;; | |
4458 | next) dflt='none' ;; | |
4459 | solaris) dflt='-G' ;; | |
4460 | sunos) dflt='-assert nodefinitions' ;; | |
4461 | svr4*|esix*) dflt="-G $ldflags" ;; | |
4462 | *) dflt='none' ;; | |
4463 | esac | |
4464 | ;; | |
4465 | *) dflt="$lddlflags" ;; | |
4466 | esac | |
4467 | ||
4468 | : Try to guess additional flags to pick up local libraries. | |
4469 | for thisflag in $ldflags; do | |
4470 | case "$thisflag" in | |
4471 | -L*) | |
4472 | case " $dflt " in | |
4473 | *" $thisflag "*) ;; | |
4474 | *) dflt="$dflt $thisflag" ;; | |
4475 | esac | |
4476 | ;; | |
4477 | esac | |
4478 | done | |
4479 | ||
4480 | case "$dflt" in | |
4481 | '') dflt='none' ;; | |
4482 | esac | |
4483 | ||
4484 | rp="Any special flags to pass to $ld to create a dynamically loaded library?" | |
4485 | . ./myread | |
4486 | case "$ans" in | |
4487 | none) lddlflags=' ' ;; | |
4488 | *) lddlflags="$ans" ;; | |
4489 | esac | |
4490 | ||
4491 | cat <<EOM | |
4492 | ||
4493 | Some systems may require passing special flags to $cc to indicate that | |
4494 | the resulting executable will use dynamic linking. To use no flags, | |
4495 | say "none". | |
4496 | ||
4497 | EOM | |
4498 | case "$ccdlflags" in | |
4499 | '') case "$osname" in | |
4500 | hpux) dflt='-Wl,-E' ;; | |
4501 | linux) dflt='-rdynamic' ;; | |
4502 | next) dflt='none' ;; | |
4503 | sunos) dflt='none' ;; | |
4504 | *) dflt='none' ;; | |
4505 | esac ;; | |
4506 | *) dflt="$ccdlflags" ;; | |
4507 | esac | |
4508 | rp="Any special flags to pass to $cc to use dynamic loading?" | |
4509 | . ./myread | |
4510 | case "$ans" in | |
4511 | none) ccdlflags=' ' ;; | |
4512 | *) ccdlflags="$ans" ;; | |
4513 | esac | |
4514 | ;; | |
4515 | *) usedl="$undef" | |
4516 | ld='ld' | |
4517 | dlsrc='dl_none.xs' | |
4518 | lddlflags='' | |
4519 | ccdlflags='' | |
4520 | ;; | |
4521 | esac | |
4522 | ||
4523 | also='' | |
4524 | case "$usedl" in | |
4525 | $undef) | |
4526 | # No dynamic loading being used, so don't bother even to prompt. | |
4527 | useshrplib='false' | |
4528 | ;; | |
4529 | *) case "$useshrplib" in | |
4530 | '') case "$osname" in | |
4531 | svr4|dgux|dynixptx|esix|powerux) | |
4532 | dflt='yes' | |
4533 | also='Building a shared libperl is required for dynamic loading to work on your system.' | |
4534 | ;; | |
4535 | next*) | |
4536 | case "$osvers" in | |
4537 | 4*) dflt='yes' | |
4538 | also='Building a shared libperl is needed for MAB support.' | |
4539 | ;; | |
4540 | *) dflt='no' | |
4541 | ;; | |
4542 | esac | |
4543 | ;; | |
4544 | sunos) | |
4545 | dflt='no' | |
4546 | also='Building a shared libperl will definitely not work on SunOS 4.' | |
4547 | ;; | |
4548 | *) dflt='no' | |
4549 | ;; | |
4550 | esac | |
4551 | ;; | |
4552 | $define|true|[Yy]*) | |
4553 | dflt='yes' | |
4554 | ;; | |
4555 | *) dflt='no' | |
4556 | ;; | |
4557 | esac | |
4558 | $cat << EOM | |
4559 | ||
4560 | The perl executable is normally obtained by linking perlmain.c with | |
4561 | libperl${lib_ext}, any static extensions (usually just DynaLoader), and | |
4562 | any other libraries needed on this system (such as -lm, etc.). Since | |
4563 | your system supports dynamic loading, it is probably possible to build | |
4564 | a shared libperl.$so. If you will have more than one executable linked | |
4565 | to libperl.$so, this will significantly reduce the size of each | |
4566 | executable, but it may have a noticeable affect on performance. The | |
4567 | default is probably sensible for your system. | |
4568 | $also | |
4569 | ||
4570 | EOM | |
4571 | rp="Build a shared libperl.$so (y/n)" | |
4572 | . ./myread | |
4573 | case "$ans" in | |
4574 | true|$define|[Yy]*) | |
4575 | useshrplib='true' | |
4576 | # Why does next4 have to be so different? | |
4577 | case "${osname}${osvers}" in | |
4578 | next4*) xxx='DYLD_LIBRARY_PATH' ;; | |
4579 | *) xxx='LD_LIBRARY_PATH' ;; | |
4580 | esac | |
4581 | $cat <<EOM >&4 | |
4582 | ||
4583 | To build perl, you must add the current working directory to your | |
4584 | $xxx environtment variable before running make. You can do | |
4585 | this with | |
4586 | $xxx=\`pwd\`; export $xxx | |
4587 | for Bourne-style shells, or | |
4588 | setenv $xxx \`pwd\` | |
4589 | for Csh-style shells. You *MUST* do this before running make. | |
4590 | ||
4591 | EOM | |
4592 | ;; | |
4593 | *) useshrplib='false' ;; | |
4594 | esac | |
4595 | ;; | |
4596 | esac | |
4597 | ||
4598 | case "$useshrplib" in | |
4599 | true) | |
4600 | case "$libperl" in | |
4601 | '') | |
4602 | # Figure out a good name for libperl.so. Since it gets stored in | |
4603 | # a version-specific architecture-dependent library, the version | |
4604 | # number isn't really that important, except for making cc/ld happy. | |
4605 | # | |
4606 | # A name such as libperl.so.3.1 | |
4607 | majmin="libperl.$so.$patchlevel.$subversion" | |
4608 | # A name such as libperl.so.301 | |
4609 | majonly=`echo $patchlevel $subversion | | |
4610 | $awk '{printf "%d%02d", $1, $2}'` | |
4611 | majonly=libperl.$so.$majonly | |
4612 | # I'd prefer to keep the os-specific stuff here to a minimum, and | |
4613 | # rely on figuring it out from the naming of libc. | |
4614 | case "${osname}${osvers}" in | |
4615 | next4*) | |
4616 | dflt=libperl.5.$so | |
4617 | # XXX How handle the --version stuff for MAB? | |
4618 | ;; | |
4619 | linux*) # ld won't link with a bare -lperl otherwise. | |
4620 | dflt=libperl.$so | |
4621 | ;; | |
4622 | *) # Try to guess based on whether libc has major.minor. | |
4623 | case "$libc" in | |
4624 | *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;; | |
4625 | *libc.$so.[0-9]*) dflt=$majonly ;; | |
4626 | *) dflt=libperl.$so ;; | |
4627 | esac | |
4628 | ;; | |
4629 | esac | |
4630 | ;; | |
4631 | *) dflt=$libperl | |
4632 | ;; | |
4633 | esac | |
4634 | cat << EOM | |
4635 | ||
4636 | I need to select a good name for the shared libperl. If your system uses | |
4637 | library names with major and minor numbers, then you might want something | |
4638 | like $majmin. Alternatively, if your system uses a single version | |
4639 | number for shared libraries, then you might want to use $majonly. | |
4640 | Or, your system might be quite happy with a simple libperl.$so. | |
4641 | ||
4642 | Since the shared libperl will get installed into a version-specific | |
4643 | architecture-dependent directory, the version number of the shared perl | |
4644 | library probably isn't important, so the default should be o.k. | |
4645 | ||
4646 | EOM | |
4647 | rp='What name do you want to give to the shared libperl?' | |
4648 | . ./myread | |
4649 | libperl=$ans | |
4650 | echo "Ok, I'll use $libperl" | |
4651 | ;; | |
4652 | *) | |
4653 | libperl="libperl${lib_ext}" | |
4654 | ;; | |
4655 | esac | |
4656 | ||
4657 | # Detect old use of shrpdir via undocumented Configure -Dshrpdir | |
4658 | case "$shrpdir" in | |
4659 | '') ;; | |
4660 | *) $cat >&4 <<EOM | |
4661 | WARNING: Use of the shrpdir variable for the installation location of | |
4662 | the shared $libperl is not supported. It was never documented and | |
5f05dabc | 4663 | will not work in this version. Let me (chip@atlantic.net) |
2afac517 | 4664 | know of any problems this may cause. |
4665 | ||
4666 | EOM | |
4667 | case "$shrpdir" in | |
4668 | "$archlibexp/CORE") | |
4669 | $cat >&4 <<EOM | |
4670 | But your current setting of $shrpdir is | |
4671 | the default anyway, so it's harmless. | |
4672 | EOM | |
4673 | ;; | |
4674 | *) | |
4675 | $cat >&4 <<EOM | |
4676 | Further, your current attempted setting of $shrpdir | |
4677 | conflicts with the value of $archlibexp/CORE | |
4678 | that installperl will use. | |
4679 | EOM | |
4680 | ;; | |
4681 | esac | |
4682 | ;; | |
4683 | esac | |
4684 | ||
4685 | # How will the perl executable find the installed shared $libperl? | |
4686 | # Add $xxx to ccdlflags. | |
4687 | # If we can't figure out a command-line option, use $shrpenv to | |
4688 | # set env LD_RUN_PATH. The main perl makefile uses this. | |
4689 | shrpdir=$archlibexp/CORE | |
4690 | xxx='' | |
4691 | tmp_shrpenv='' | |
4692 | if "$useshrplib"; then | |
4693 | case "$osname" in | |
4694 | solaris|netbsd) | |
4695 | xxx="-R $shrpdir" | |
4696 | ;; | |
28757baa | 4697 | freebsd) |
44a8e56a | 4698 | xxx="-Wl,-R$shrpdir" |
28757baa | 4699 | ;; |
4b40f7a3 | 4700 | linux|irix*) |
2afac517 | 4701 | xxx="-Wl,-rpath,$shrpdir" |
4702 | ;; | |
4703 | *) | |
4704 | tmp_shrpenv="env LD_RUN_PATH=$shrpdir" | |
4705 | ;; | |
4706 | esac | |
4707 | case "$xxx" in | |
4708 | '') ;; | |
4709 | *) ccdlflags="$ccdlflags $xxx" | |
4710 | cat <<EOM >&4 | |
4711 | ||
4712 | Adding $xxx to the flags | |
4713 | passed to $ld so that the perl executable will find the | |
4714 | installed shared $libperl. | |
4715 | ||
4716 | EOM | |
4717 | ;; | |
4718 | esac | |
4719 | fi | |
4720 | # Respect a hint or command-line value. | |
4721 | case "$shrpenv" in | |
4722 | '') shrpenv="$tmp_shrpenv" ;; | |
4723 | esac | |
4724 | ||
4725 | : determine where manual pages go | |
4726 | set man1dir man1dir none | |
4727 | eval $prefixit | |
4728 | $cat <<EOM | |
4729 | ||
4730 | $spackage has manual pages available in source form. | |
4731 | EOM | |
4732 | case "$nroff" in | |
4733 | nroff) | |
4734 | echo "However, you don't have nroff, so they're probably useless to you." | |
4735 | case "$man1dir" in | |
4736 | '') man1dir="none";; | |
4737 | esac;; | |
4738 | esac | |
4739 | echo "If you don't want the manual sources installed, answer 'none'." | |
4740 | case "$man1dir" in | |
4741 | ' ') dflt=none | |
4742 | ;; | |
4743 | '') | |
4744 | lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1" | |
4745 | lookpath="$lookpath $prefixexp/man/p_man/man1" | |
4746 | lookpath="$lookpath $prefixexp/man/u_man/man1" | |
4747 | lookpath="$lookpath $prefixexp/man/man.1" | |
4748 | : If prefix contains 'perl' then we want to keep the man pages | |
4749 | : under the prefix directory. Otherwise, look in a variety of | |
4750 | : other possible places. This is debatable, but probably a | |
4751 | : good compromise. Well, apparently not. | |
4752 | : Experience has shown people expect man1dir to be under prefix, | |
4753 | : so we now always put it there. Users who want other behavior | |
4754 | : can answer interactively or use a command line option. | |
4755 | : Does user have System V-style man paths. | |
4756 | case "$sysman" in | |
4757 | */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;; | |
4758 | *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;; | |
4759 | esac | |
4760 | set dflt | |
4761 | eval $prefixup | |
4762 | ;; | |
4763 | *) dflt="$man1dir" | |
4764 | ;; | |
4765 | esac | |
4766 | echo " " | |
4767 | fn=dn+~ | |
4768 | rp="Where do the main $spackage manual pages (source) go?" | |
4769 | . ./getfile | |
4770 | if $test "X$man1direxp" != "X$ansexp"; then | |
4771 | installman1dir='' | |
4772 | fi | |
4773 | man1dir="$ans" | |
4774 | man1direxp="$ansexp" | |
4775 | case "$man1dir" in | |
4776 | '') man1dir=' ' | |
4777 | installman1dir='';; | |
4778 | esac | |
4779 | if $afs; then | |
4780 | $cat <<EOM | |
4781 | ||
4782 | Since you are running AFS, I need to distinguish the directory in which | |
4783 | manual pages reside from the directory in which they are installed (and from | |
4784 | which they are presumably copied to the former directory by occult means). | |
4785 | ||
4786 | EOM | |
4787 | case "$installman1dir" in | |
4788 | '') dflt=`echo $man1direxp | sed 's#^/afs/#/afs/.#'`;; | |
4789 | *) dflt="$installman1dir";; | |
4790 | esac | |
4791 | fn=de~ | |
4792 | rp='Where will man pages be installed?' | |
4793 | . ./getfile | |
4794 | installman1dir="$ans" | |
4795 | else | |
4796 | installman1dir="$man1direxp" | |
4797 | fi | |
4798 | ||
4799 | : What suffix to use on installed man pages | |
4800 | ||
4801 | case "$man1dir" in | |
4802 | ' ') | |
4803 | man1ext='0' | |
4804 | ;; | |
4805 | *) | |
4806 | rp="What suffix should be used for the main $spackage man pages?" | |
4807 | case "$man1ext" in | |
4808 | '') case "$man1dir" in | |
4809 | *1) dflt=1 ;; | |
4810 | *1p) dflt=1p ;; | |
4811 | *1pm) dflt=1pm ;; | |
4812 | *l) dflt=l;; | |
4813 | *n) dflt=n;; | |
4814 | *o) dflt=o;; | |
4815 | *p) dflt=p;; | |
4816 | *C) dflt=C;; | |
4817 | *L) dflt=L;; | |
4818 | *L1) dflt=L1;; | |
4819 | *) dflt=1;; | |
4820 | esac | |
4821 | ;; | |
4822 | *) dflt="$man1ext";; | |
4823 | esac | |
4824 | . ./myread | |
4825 | man1ext="$ans" | |
4826 | ;; | |
4827 | esac | |
4828 | ||
4829 | : see if we can have long filenames | |
4830 | echo " " | |
4831 | rmlist="$rmlist /tmp/cf$$" | |
4832 | $test -d /tmp/cf$$ || mkdir /tmp/cf$$ | |
4833 | first=123456789abcdef | |
4834 | second=/tmp/cf$$/$first | |
4835 | $rm -f $first $second | |
4836 | if (echo hi >$first) 2>/dev/null; then | |
4837 | if $test -f 123456789abcde; then | |
4838 | echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4 | |
4839 | val="$undef" | |
4840 | else | |
4841 | if (echo hi >$second) 2>/dev/null; then | |
4842 | if $test -f /tmp/cf$$/123456789abcde; then | |
4843 | $cat <<'EOM' | |
4844 | That's peculiar... You can have filenames longer than 14 characters, but only | |
4845 | on some of the filesystems. Maybe you are using NFS. Anyway, to avoid problems | |
4846 | I shall consider your system cannot support long filenames at all. | |
4847 | EOM | |
4848 | val="$undef" | |
4849 | else | |
4850 | echo 'You can have filenames longer than 14 characters.' >&4 | |
4851 | val="$define" | |
4852 | fi | |
4853 | else | |
4854 | $cat <<'EOM' | |
4855 | How confusing! Some of your filesystems are sane enough to allow filenames | |
4856 | longer than 14 characters but some others like /tmp can't even think about them. | |
4857 | So, for now on, I shall assume your kernel does not allow them at all. | |
4858 | EOM | |
4859 | val="$undef" | |
4860 | fi | |
4861 | fi | |
4862 | else | |
4863 | $cat <<'EOM' | |
4864 | You can't have filenames longer than 14 chars. You can't even think about them! | |
4865 | EOM | |
4866 | val="$undef" | |
4867 | fi | |
4868 | set d_flexfnam | |
4869 | eval $setvar | |
4870 | $rm -rf /tmp/cf$$ 123456789abcde* | |
4871 | ||
4872 | : determine where library module manual pages go | |
4873 | set man3dir man3dir none | |
4874 | eval $prefixit | |
4875 | $cat <<EOM | |
4876 | ||
4877 | $spackage has manual pages for many of the library modules. | |
4878 | EOM | |
4879 | ||
4880 | case "$nroff" in | |
4881 | nroff) | |
4882 | $cat <<'EOM' | |
4883 | However, you don't have nroff, so they're probably useless to you. | |
4884 | You can use the supplied perldoc script instead. | |
4885 | EOM | |
4886 | case "$man3dir" in | |
4887 | '') man3dir="none";; | |
4888 | esac;; | |
4889 | esac | |
4890 | ||
4891 | case "$d_flexfnam" in | |
4892 | undef) | |
4893 | $cat <<'EOM' | |
4894 | However, your system can't handle the long file names like File::Basename.3. | |
4895 | You can use the supplied perldoc script instead. | |
4896 | EOM | |
4897 | case "$man3dir" in | |
4898 | '') man3dir="none";; | |
4899 | esac;; | |
4900 | esac | |
4901 | ||
4902 | echo "If you don't want the manual sources installed, answer 'none'." | |
4903 | : We dont use /usr/local/man/man3 because some man programs will | |
4904 | : only show the /usr/local/man/man3 contents, and not the system ones, | |
4905 | : thus man less will show the perl module less.pm, but not the system | |
4906 | : less command. We might also conflict with TCL man pages. | |
4907 | : However, something like /opt/perl/man/man3 is fine. | |
4908 | case "$man3dir" in | |
4909 | '') case "$prefix" in | |
4910 | *perl*) dflt=`echo $man1dir | | |
4911 | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'` ;; | |
4912 | *) dflt="$privlib/man/man3" ;; | |
4913 | esac | |
4914 | ;; | |
4915 | ' ') dflt=none;; | |
4916 | *) dflt="$man3dir" ;; | |
4917 | esac | |
4918 | echo " " | |
4919 | ||
4920 | fn=dn+~ | |
4921 | rp="Where do the $spackage library man pages (source) go?" | |
4922 | . ./getfile | |
4923 | if test "X$man3direxp" != "X$ansexp"; then | |
4924 | installman3dir='' | |
4925 | fi | |
4926 | ||
4927 | man3dir="$ans" | |
4928 | man3direxp="$ansexp" | |
4929 | case "$man3dir" in | |
4930 | '') man3dir=' ' | |
4931 | installman3dir='';; | |
4932 | esac | |
4933 | if $afs; then | |
4934 | $cat <<EOM | |
4935 | ||
4936 | Since you are running AFS, I need to distinguish the directory in which | |
4937 | manual pages reside from the directory in which they are installed (and from | |
4938 | which they are presumably copied to the former directory by occult means). | |
4939 | ||
4940 | EOM | |
4941 | case "$installman3dir" in | |
4942 | '') dflt=`echo $man3direxp | sed 's#^/afs/#/afs/.#'`;; | |
4943 | *) dflt="$installman3dir";; | |
4944 | esac | |
4945 | fn=de~ | |
4946 | rp='Where will man pages be installed?' | |
4947 | . ./getfile | |
4948 | installman3dir="$ans" | |
4949 | else | |
4950 | installman3dir="$man3direxp" | |
4951 | fi | |
4952 | ||
4953 | : What suffix to use on installed man pages | |
4954 | ||
4955 | case "$man3dir" in | |
4956 | ' ') | |
4957 | man3ext='0' | |
4958 | ;; | |
4959 | *) | |
4960 | rp="What suffix should be used for the $spackage library man pages?" | |
4961 | case "$man3ext" in | |
4962 | '') case "$man3dir" in | |
4963 | *3) dflt=3 ;; | |
4964 | *3p) dflt=3p ;; | |
4965 | *3pm) dflt=3pm ;; | |
4966 | *l) dflt=l;; | |
4967 | *n) dflt=n;; | |
4968 | *o) dflt=o;; | |
4969 | *p) dflt=p;; | |
4970 | *C) dflt=C;; | |
4971 | *L) dflt=L;; | |
4972 | *L3) dflt=L3;; | |
4973 | *) dflt=3;; | |
4974 | esac | |
4975 | ;; | |
4976 | *) dflt="$man3ext";; | |
4977 | esac | |
4978 | . ./myread | |
4979 | man3ext="$ans" | |
4980 | ;; | |
4981 | esac | |
4982 | ||
4983 | : see if we have to deal with yellow pages, now NIS. | |
4984 | if $test -d /usr/etc/yp || $test -d /etc/yp; then | |
4985 | if $test -f /usr/etc/nibindd; then | |
4986 | echo " " | |
4987 | echo "I'm fairly confident you're on a NeXT." | |
4988 | echo " " | |
4989 | rp='Do you get the hosts file via NetInfo?' | |
4990 | dflt=y | |
4991 | case "$hostcat" in | |
4992 | nidump*) ;; | |
4993 | '') ;; | |
4994 | *) dflt=n;; | |
4995 | esac | |
4996 | . ./myread | |
4997 | case "$ans" in | |
4998 | y*) hostcat='nidump hosts .';; | |
4999 | *) case "$hostcat" in | |
5000 | nidump*) hostcat='';; | |
5001 | esac | |
5002 | ;; | |
5003 | esac | |
5004 | fi | |
5005 | case "$hostcat" in | |
5006 | nidump*) ;; | |
5007 | *) | |
5008 | case "$hostcat" in | |
5009 | *ypcat*) dflt=y;; | |
5010 | '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then | |
5011 | dflt=y | |
5012 | else | |
5013 | dflt=n | |
5014 | fi;; | |
5015 | *) dflt=n;; | |
5016 | esac | |
5017 | echo " " | |
5018 | rp='Are you getting the hosts file via yellow pages?' | |
5019 | . ./myread | |
5020 | case "$ans" in | |
5021 | y*) hostcat='ypcat hosts';; | |
5022 | *) hostcat='cat /etc/hosts';; | |
5023 | esac | |
5024 | ;; | |
5025 | esac | |
5026 | fi | |
5027 | ||
5028 | : now get the host name | |
5029 | echo " " | |
5030 | echo "Figuring out host name..." >&4 | |
5031 | case "$myhostname" in | |
5032 | '') cont=true | |
5033 | echo 'Maybe "hostname" will work...' | |
5034 | if tans=`sh -c hostname 2>&1` ; then | |
5035 | myhostname=$tans | |
5036 | phostname=hostname | |
5037 | cont='' | |
5038 | fi | |
5039 | ;; | |
5040 | *) cont='';; | |
5041 | esac | |
5042 | if $test "$cont"; then | |
5043 | if ./xenix; then | |
5044 | echo 'Oh, dear. Maybe "/etc/systemid" is the key...' | |
5045 | if tans=`cat /etc/systemid 2>&1` ; then | |
5046 | myhostname=$tans | |
5047 | phostname='cat /etc/systemid' | |
5048 | echo "Whadyaknow. Xenix always was a bit strange..." | |
5049 | cont='' | |
5050 | fi | |
5051 | elif $test -r /etc/systemid; then | |
5052 | echo "(What is a non-Xenix system doing with /etc/systemid?)" | |
5053 | fi | |
5054 | fi | |
5055 | if $test "$cont"; then | |
5056 | echo 'No, maybe "uuname -l" will work...' | |
5057 | if tans=`sh -c 'uuname -l' 2>&1` ; then | |
5058 | myhostname=$tans | |
5059 | phostname='uuname -l' | |
5060 | else | |
5061 | echo 'Strange. Maybe "uname -n" will work...' | |
5062 | if tans=`sh -c 'uname -n' 2>&1` ; then | |
5063 | myhostname=$tans | |
5064 | phostname='uname -n' | |
5065 | else | |
5066 | echo 'Oh well, maybe I can mine it out of whoami.h...' | |
5067 | if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then | |
5068 | myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'` | |
5069 | phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h" | |
5070 | else | |
5071 | case "$myhostname" in | |
5072 | '') echo "Does this machine have an identity crisis or something?" | |
5073 | phostname='';; | |
5074 | *) | |
5075 | echo "Well, you said $myhostname before..." | |
5076 | phostname='echo $myhostname';; | |
5077 | esac | |
5078 | fi | |
5079 | fi | |
5080 | fi | |
5081 | fi | |
5082 | : you do not want to know about this | |
5083 | set $myhostname | |
5084 | myhostname=$1 | |
5085 | ||
5086 | : verify guess | |
5087 | if $test "$myhostname" ; then | |
5088 | dflt=y | |
5089 | rp='Your host name appears to be "'$myhostname'".'" Right?" | |
5090 | . ./myread | |
5091 | case "$ans" in | |
5092 | y*) ;; | |
5093 | *) myhostname='';; | |
5094 | esac | |
5095 | fi | |
5096 | ||
5097 | : bad guess or no guess | |
5098 | while $test "X$myhostname" = X ; do | |
5099 | dflt='' | |
5100 | rp="Please type the (one word) name of your host:" | |
5101 | . ./myread | |
5102 | myhostname="$ans" | |
5103 | done | |
5104 | ||
5105 | : translate upper to lower if necessary | |
5106 | case "$myhostname" in | |
5107 | *[A-Z]*) | |
5108 | echo "(Normalizing case in your host name)" | |
5109 | myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'` | |
5110 | ;; | |
5111 | esac | |
5112 | ||
5113 | case "$myhostname" in | |
5114 | *.*) | |
5115 | dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"` | |
5116 | myhostname=`expr "X$myhostname" : "X\([^.]*\)\."` | |
5117 | echo "(Trimming domain name from host name--host name is now $myhostname)" | |
5118 | ;; | |
5119 | *) case "$mydomain" in | |
5120 | '') | |
5121 | { | |
5122 | : If we use NIS, try ypmatch. | |
5123 | : Is there some reason why this was not done before? | |
5124 | test "X$hostcat" = "Xypcat hosts" && | |
5125 | ypmatch "$myhostname" hosts 2>/dev/null |\ | |
5126 | $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \ | |
5127 | $test -s hosts | |
5128 | } || { | |
5129 | : Extract only the relevant hosts, reducing file size, | |
5130 | : remove comments, insert trailing space for later use. | |
5131 | $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ / | |
5132 | /[ ]$myhostname[ . ]/p" > hosts | |
5133 | } | |
5134 | tmp_re="[ . ]" | |
5135 | $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ } | |
5136 | END { print sum }" hosts` = x1 || tmp_re="[ ]" | |
5137 | dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \ | |
5138 | hosts | $sort | $uniq | \ | |
5139 | $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"` | |
5140 | case `$echo X$dflt` in | |
5141 | X*\ *) echo "(Several hosts in /etc/hosts matched hostname)" | |
5142 | dflt=. | |
5143 | ;; | |
5144 | X.) echo "(You do not have fully-qualified names in /etc/hosts)" | |
5145 | ;; | |
5146 | esac | |
5147 | case "$dflt" in | |
5148 | .) | |
5149 | tans=`./loc resolv.conf X /etc /usr/etc` | |
5150 | if $test -f "$tans"; then | |
5151 | echo "(Attempting domain name extraction from $tans)" | |
5152 | : Why was there an Egrep here, when Sed works? | |
5153 | : Look for either a search or a domain directive. | |
a6006777 | 5154 | dflt=.`$sed -n -e 's/ / /g' \ |
28757baa | 5155 | -e 's/^search *\([^ ]*\).*/\1/p' $tans \ |
a6006777 | 5156 | | ./tr '[A-Z]' '[a-z]' 2>/dev/null` |
2afac517 | 5157 | case "$dflt" in |
a6006777 | 5158 | .) dflt=.`$sed -n -e 's/ / /g' \ |
28757baa | 5159 | -e 's/^domain *\([^ ]*\).*/\1/p' $tans \ |
a6006777 | 5160 | | ./tr '[A-Z]' '[a-z]' 2>/dev/null` |
2afac517 | 5161 | ;; |
5162 | esac | |
5163 | fi | |
5164 | ;; | |
5165 | esac | |
5166 | case "$dflt" in | |
5167 | .) echo "(No help from resolv.conf either -- attempting clever guess)" | |
5168 | dflt=.`sh -c domainname 2>/dev/null` | |
5169 | case "$dflt" in | |
5170 | '') dflt='.';; | |
5171 | .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;; | |
5172 | esac | |
5173 | ;; | |
5174 | esac | |
5175 | case "$dflt" in | |
5176 | .) echo "(Lost all hope -- silly guess then)" | |
5177 | dflt='.uucp' | |
5178 | ;; | |
5179 | esac | |
5180 | $rm -f hosts | |
5181 | ;; | |
5182 | *) dflt="$mydomain";; | |
5183 | esac;; | |
5184 | esac | |
5185 | echo " " | |
5186 | rp="What is your domain name?" | |
5187 | . ./myread | |
5188 | tans="$ans" | |
5189 | case "$ans" in | |
5190 | '') ;; | |
5191 | .*) ;; | |
5192 | *) tans=".$tans";; | |
5193 | esac | |
5194 | mydomain="$tans" | |
5195 | ||
5196 | : translate upper to lower if necessary | |
5197 | case "$mydomain" in | |
5198 | *[A-Z]*) | |
5199 | echo "(Normalizing case in your domain name)" | |
5200 | mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'` | |
5201 | ;; | |
5202 | esac | |
5203 | ||
5204 | : a little sanity check here | |
5205 | case "$phostname" in | |
5206 | '') ;; | |
5207 | *) | |
5208 | case `$phostname | ./tr '[A-Z]' '[a-z]'` in | |
5209 | $myhostname$mydomain|$myhostname) ;; | |
5210 | *) | |
5211 | case "$phostname" in | |
5212 | sed*) | |
5213 | echo "(That doesn't agree with your whoami.h file, by the way.)" | |
5214 | ;; | |
5215 | *) | |
5216 | echo "(That doesn't agree with your $phostname command, by the way.)" | |
5217 | ;; | |
5218 | esac | |
5219 | ;; | |
5220 | esac | |
5221 | ;; | |
5222 | esac | |
5223 | ||
5224 | $cat <<EOM | |
5225 | ||
5226 | I need to get your e-mail address in Internet format if possible, i.e. | |
5227 | something like user@host.domain. Please answer accurately since I have | |
5228 | no easy means to double check it. The default value provided below | |
5229 | is most probably close to the reality but may not be valid from outside | |
5230 | your organization... | |
5231 | ||
5232 | EOM | |
5233 | cont=x | |
5234 | while test "$cont"; do | |
5235 | case "$cf_email" in | |
5236 | '') dflt="$cf_by@$myhostname$mydomain";; | |
5237 | *) dflt="$cf_email";; | |
5238 | esac | |
5239 | rp='What is your e-mail address?' | |
5240 | . ./myread | |
5241 | cf_email="$ans" | |
5242 | case "$cf_email" in | |
5243 | *@*.*) cont='' ;; | |
5244 | *) | |
5245 | rp='Address does not look like an Internet one. Use it anyway?' | |
5246 | case "$fastread" in | |
5247 | yes) dflt=y ;; | |
5248 | *) dflt=n ;; | |
5249 | esac | |
5250 | . ./myread | |
5251 | case "$ans" in | |
5252 | y*) cont='' ;; | |
5253 | *) echo " " ;; | |
5254 | esac | |
5255 | ;; | |
5256 | esac | |
5257 | done | |
5258 | ||
5259 | $cat <<EOM | |
5260 | ||
5261 | If you or somebody else will be maintaining perl at your site, please | |
5262 | fill in the correct e-mail address here so that they may be contacted | |
5263 | if necessary. Currently, the "perlbug" program included with perl | |
5264 | will send mail to this address in addition to perlbug@perl.com. You may | |
5265 | enter "none" for no administrator. | |
5266 | ||
5267 | EOM | |
5268 | case "$perladmin" in | |
5269 | '') dflt="$cf_email";; | |
5270 | *) dflt="$perladmin";; | |
5271 | esac | |
5272 | rp='Perl administrator e-mail address' | |
5273 | . ./myread | |
5274 | perladmin="$ans" | |
5275 | ||
5f05dabc | 5276 | : figure out how to guarantee perl startup |
5277 | case "$startperl" in | |
5278 | '') | |
5279 | case "$sharpbang" in | |
5280 | *!) | |
5281 | $cat <<EOH | |
5282 | ||
5283 | I can use the #! construct to start perl on your system. This will | |
5284 | make startup of perl scripts faster, but may cause problems if you | |
5285 | want to share those scripts and perl is not in a standard place | |
5286 | ($binexp/perl) on all your platforms. The alternative is to force | |
5287 | a shell by starting the script with a single ':' character. | |
5288 | ||
5289 | EOH | |
5290 | dflt="$binexp/perl" | |
5291 | rp='What shall I put after the #! to start up perl ("none" to not use #!)?' | |
5292 | . ./myread | |
5293 | case "$ans" in | |
5294 | none) startperl=": # use perl";; | |
5295 | *) startperl="#!$ans";; | |
5296 | esac | |
5297 | ;; | |
5298 | *) startperl=": # use perl" | |
5299 | ;; | |
5300 | esac | |
5301 | ;; | |
5302 | esac | |
5303 | echo "I'll use $startperl to start perl scripts." | |
5304 | ||
5305 | : figure best path for perl in scripts | |
5306 | case "$perlpath" in | |
5307 | '') | |
5308 | perlpath="$binexp/perl" | |
5309 | case "$startperl" in | |
5310 | *!*) ;; | |
5311 | *) | |
5312 | $cat <<EOH | |
5313 | ||
5314 | I will use the "eval 'exec'" idiom to start Perl on your system. | |
5315 | I can use the full path of your Perl binary for this purpose, but | |
5316 | doing so may cause problems if you want to share those scripts and | |
5317 | Perl is not always in a standard place ($binexp/perl). | |
5318 | ||
5319 | EOH | |
5320 | dflt="$binexp/perl" | |
5321 | rp="What path shall I use in \"eval 'exec'\"?" | |
5322 | . ./myread | |
5323 | perlpath="$ans" | |
5324 | ;; | |
5325 | esac | |
5326 | ;; | |
5327 | esac | |
5328 | case "$startperl" in | |
5329 | *!*) ;; | |
5330 | *) echo "I'll use $perlpath in \"eval 'exec'\"" ;; | |
5331 | esac | |
5332 | ||
2afac517 | 5333 | : determine where public executable scripts go |
5334 | set scriptdir scriptdir | |
5335 | eval $prefixit | |
5336 | case "$scriptdir" in | |
5337 | '') | |
5338 | dflt="$bin" | |
5339 | : guess some guesses | |
5340 | $test -d /usr/share/scripts && dflt=/usr/share/scripts | |
5341 | $test -d /usr/share/bin && dflt=/usr/share/bin | |
5342 | $test -d /usr/local/script && dflt=/usr/local/script | |
5343 | $test -d $prefixexp/script && dflt=$prefixexp/script | |
5344 | set dflt | |
5345 | eval $prefixup | |
5346 | ;; | |
5347 | *) dflt="$scriptdir" | |
5348 | ;; | |
5349 | esac | |
5350 | $cat <<EOM | |
5351 | ||
5352 | Some installations have a separate directory just for executable scripts so | |
5353 | that they can mount it across multiple architectures but keep the scripts in | |
5354 | one spot. You might, for example, have a subdirectory of /usr/share for this. | |
5355 | Or you might just lump your scripts in with all your other executables. | |
5356 | ||
5357 | EOM | |
5358 | fn=d~ | |
5359 | rp='Where do you keep publicly executable scripts?' | |
5360 | . ./getfile | |
5361 | if $test "X$ansexp" != "X$scriptdirexp"; then | |
5362 | installscript='' | |
5363 | fi | |
5364 | scriptdir="$ans" | |
5365 | scriptdirexp="$ansexp" | |
5366 | if $afs; then | |
5367 | $cat <<EOM | |
5368 | ||
5369 | Since you are running AFS, I need to distinguish the directory in which | |
5370 | scripts reside from the directory in which they are installed (and from | |
5371 | which they are presumably copied to the former directory by occult means). | |
5372 | ||
5373 | EOM | |
5374 | case "$installscript" in | |
5375 | '') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;; | |
5376 | *) dflt="$installscript";; | |
5377 | esac | |
5378 | fn=de~ | |
5379 | rp='Where will public scripts be installed?' | |
5380 | . ./getfile | |
5381 | installscript="$ans" | |
5382 | else | |
5383 | installscript="$scriptdirexp" | |
2304df62 | 5384 | fi |
2afac517 | 5385 | |
2afac517 | 5386 | cat <<EOM |
5387 | ||
5388 | Previous version of $package used the standard IO mechanisms as defined in | |
5389 | <stdio.h>. Versions 5.003_02 and later of perl allow alternate IO | |
5390 | mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still | |
5391 | the default and is the only supported mechanism. This abstraction | |
5392 | layer can use AT&T's sfio (if you already have sfio installed) or | |
5393 | fall back on standard IO. This PerlIO abstraction layer is | |
5394 | experimental and may cause problems with some extension modules. | |
5395 | ||
5396 | If this doesn't make any sense to you, just accept the default 'n'. | |
5397 | EOM | |
5398 | case "$useperlio" in | |
5399 | $define|true|[yY]*) dflt='y';; | |
5400 | *) dflt='n';; | |
5401 | esac | |
5402 | rp='Use the experimental PerlIO abstraction layer?' | |
5403 | . ./myread | |
5404 | case "$ans" in | |
5405 | y|Y) | |
5406 | val="$define" | |
5407 | ;; | |
5408 | *) | |
5409 | echo "Ok, doing things the stdio way" | |
5410 | val="$undef" | |
5411 | ;; | |
5412 | esac | |
5413 | set useperlio | |
5414 | eval $setvar | |
2304df62 | 5415 | |
8e07c86e AD |
5416 | : Check how to convert floats to strings. |
5417 | echo " " | |
5418 | echo "Checking for an efficient way to convert floats to strings." | |
5419 | $cat >try.c <<'EOP' | |
5420 | #ifdef TRY_gconvert | |
5421 | #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b)) | |
8ff267be | 5422 | char *myname = "gconvert"; |
8e07c86e AD |
5423 | #endif |
5424 | #ifdef TRY_gcvt | |
5425 | #define Gconvert(x,n,t,b) gcvt((x),(n),(b)) | |
8ff267be | 5426 | char *myname = "gcvt"; |
8e07c86e AD |
5427 | #endif |
5428 | #ifdef TRY_sprintf | |
5429 | #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x)) | |
8ff267be | 5430 | char *myname = "sprintf"; |
8e07c86e | 5431 | #endif |
8ff267be | 5432 | |
5433 | #include <stdio.h> | |
5434 | ||
5435 | int | |
5436 | checkit(expect, got) | |
5437 | char *expect; | |
5438 | char *got; | |
5439 | { | |
5440 | if (strcmp(expect, got)) { | |
5441 | printf("%s oddity: Expected %s, got %s\n", | |
5442 | myname, expect, got); | |
5443 | exit(1); | |
5444 | } | |
5445 | } | |
5446 | ||
5447 | int | |
5448 | main() | |
5449 | { | |
ecfc5424 | 5450 | char buf[64]; |
8ff267be | 5451 | buf[63] = '\0'; |
5452 | ||
5453 | /* This must be 1st test on (which?) platform */ | |
5454 | /* Alan Burlison <AlanBurlsin@unn.unisys.com> */ | |
5455 | Gconvert(0.1, 8, 0, buf); | |
5456 | checkit("0.1", buf); | |
5457 | ||
8e07c86e | 5458 | Gconvert(1.0, 8, 0, buf); |
8ff267be | 5459 | checkit("1", buf); |
5460 | ||
8e07c86e | 5461 | Gconvert(0.0, 8, 0, buf); |
8ff267be | 5462 | checkit("0", buf); |
5463 | ||
8e07c86e | 5464 | Gconvert(-1.0, 8, 0, buf); |
8ff267be | 5465 | checkit("-1", buf); |
5466 | ||
5467 | /* Some Linux gcvt's give 1.e+5 here. */ | |
5468 | Gconvert(100000.0, 8, 0, buf); | |
5469 | checkit("100000", buf); | |
5470 | ||
5471 | /* Some Linux gcvt's give -1.e+5 here. */ | |
5472 | Gconvert(-100000.0, 8, 0, buf); | |
5473 | checkit("-100000", buf); | |
5474 | ||
ecfc5424 | 5475 | exit(0); |
a0d0e21e LW |
5476 | } |
5477 | EOP | |
8e07c86e AD |
5478 | case "$d_Gconvert" in |
5479 | gconvert*) xxx_list='gconvert gcvt sprintf' ;; | |
5480 | gcvt*) xxx_list='gcvt gconvert sprintf' ;; | |
5481 | sprintf*) xxx_list='sprintf gconvert gcvt' ;; | |
5482 | *) xxx_list='gconvert gcvt sprintf' ;; | |
5483 | esac | |
5484 | ||
5485 | for xxx_convert in $xxx_list; do | |
5486 | echo "Trying $xxx_convert" | |
5487 | $rm -f try try.o | |
5488 | if $cc $ccflags -DTRY_$xxx_convert $ldflags -o try \ | |
5489 | try.c $libs > /dev/null 2>&1 ; then | |
5490 | echo "$xxx_convert" found. >&4 | |
5491 | if ./try; then | |
8e07c86e AD |
5492 | echo "I'll use $xxx_convert to convert floats into a string." >&4 |
5493 | break; | |
2304df62 | 5494 | else |
8ff267be | 5495 | echo "...But $xxx_convert didn't work as I expected." |
2304df62 | 5496 | fi |
8e07c86e AD |
5497 | else |
5498 | echo "$xxx_convert NOT found." >&4 | |
5499 | fi | |
5500 | done | |
5501 | ||
5502 | case "$xxx_convert" in | |
5503 | gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;; | |
5504 | gcvt) d_Gconvert='gcvt((x),(n),(b))' ;; | |
5505 | *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;; | |
2304df62 AD |
5506 | esac |
5507 | ||
a0d0e21e LW |
5508 | : Initialize h_fcntl |
5509 | h_fcntl=false | |
5510 | ||
5511 | : Initialize h_sysfile | |
5512 | h_sysfile=false | |
2304df62 | 5513 | |
2304df62 AD |
5514 | : access call always available on UNIX |
5515 | set access d_access | |
5516 | eval $inlibc | |
5517 | ||
5518 | : locate the flags for 'access()' | |
5519 | case "$d_access" in | |
5520 | "$define") | |
5521 | echo " " | |
5522 | $cat >access.c <<'EOCP' | |
5523 | #include <sys/types.h> | |
5524 | #ifdef I_FCNTL | |
5525 | #include <fcntl.h> | |
5526 | #endif | |
5527 | #ifdef I_SYS_FILE | |
5528 | #include <sys/file.h> | |
5529 | #endif | |
5530 | #ifdef I_UNISTD | |
5531 | #include <unistd.h> | |
5532 | #endif | |
5533 | main() { | |
5534 | exit(R_OK); | |
5535 | } | |
8e07c86e AD |
5536 | EOCP |
5537 | : check sys/file.h first, no particular reason here | |
5538 | if $test `./findhdr sys/file.h` && \ | |
5539 | $cc $cppflags -DI_SYS_FILE access.c -o access >/dev/null 2>&1 ; then | |
5540 | h_sysfile=true; | |
5541 | echo "<sys/file.h> defines the *_OK access constants." >&4 | |
5542 | elif $test `./findhdr fcntl.h` && \ | |
5543 | $cc $cppflags -DI_FCNTL access.c -o access >/dev/null 2>&1 ; then | |
5544 | h_fcntl=true; | |
5545 | echo "<fcntl.h> defines the *_OK access constants." >&4 | |
5546 | elif $test `./findhdr unistd.h` && \ | |
5547 | $cc $cppflags -DI_UNISTD access.c -o access >/dev/null 2>&1 ; then | |
5548 | echo "<unistd.h> defines the *_OK access constants." >&4 | |
5549 | else | |
5550 | echo "I can't find the four *_OK access constants--I'll use mine." >&4 | |
5551 | fi | |
5552 | ;; | |
5553 | esac | |
5554 | $rm -f access* | |
a0d0e21e | 5555 | |
8e07c86e AD |
5556 | : see if alarm exists |
5557 | set alarm d_alarm | |
5558 | eval $inlibc | |
2304df62 | 5559 | |
ecfc5424 | 5560 | : Look for GNU-cc style attribute checking |
2304df62 | 5561 | echo " " |
a0d0e21e LW |
5562 | echo "Checking whether your compiler can handle __attribute__ ..." >&4 |
5563 | $cat >attrib.c <<'EOCP' | |
1aef975c | 5564 | #include <stdio.h> |
ecfc5424 | 5565 | void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn)); |
a0d0e21e LW |
5566 | EOCP |
5567 | if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then | |
5568 | if $contains 'warning' attrib.out >/dev/null 2>&1; then | |
ecfc5424 | 5569 | echo "Your C compiler doesn't fully support __attribute__." |
a0d0e21e LW |
5570 | val="$undef" |
5571 | else | |
ecfc5424 | 5572 | echo "Your C compiler supports __attribute__." |
a0d0e21e LW |
5573 | val="$define" |
5574 | fi | |
5575 | else | |
ecfc5424 | 5576 | echo "Your C compiler doesn't seem to understand __attribute__ at all." |
a0d0e21e LW |
5577 | val="$undef" |
5578 | fi | |
ecfc5424 | 5579 | set d_attribut |
a0d0e21e LW |
5580 | eval $setvar |
5581 | $rm -f attrib* | |
5582 | ||
5583 | : see if bcmp exists | |
5584 | set bcmp d_bcmp | |
5585 | eval $inlibc | |
5586 | ||
5587 | : see if bcopy exists | |
5588 | set bcopy d_bcopy | |
5589 | eval $inlibc | |
5590 | ||
2afac517 | 5591 | : see if this is a unistd.h system |
5592 | set unistd.h i_unistd | |
5593 | eval $inhdr | |
5594 | ||
5595 | : see if getpgrp exists | |
5596 | set getpgrp d_getpgrp | |
5597 | eval $inlibc | |
5598 | ||
5599 | echo "Checking to see which flavor of getpgrp is in use . . . " | |
5600 | case "$d_getpgrp" in | |
5601 | "$define") | |
5602 | echo " " | |
5603 | $cat >set.c <<EOP | |
5604 | #$i_unistd I_UNISTD | |
5605 | #include <sys/types.h> | |
5606 | #ifdef I_UNISTD | |
5607 | # include <unistd.h> | |
5608 | #endif | |
5609 | main() | |
5610 | { | |
5611 | if (getuid() == 0) { | |
5612 | printf("(I see you are running Configure as super-user...)\n"); | |
5613 | setuid(1); | |
5614 | } | |
5615 | #ifdef TRY_BSD_PGRP | |
5616 | if (getpgrp(1) == 0) | |
5617 | exit(0); | |
5618 | #else | |
5619 | if (getpgrp() > 0) | |
5620 | exit(0); | |
5621 | #endif | |
5622 | exit(1); | |
5623 | } | |
5624 | EOP | |
5625 | if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then | |
5626 | echo "You have to use getpgrp(pid) instead of getpgrp()." >&4 | |
5627 | val="$define" | |
5628 | elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then | |
5629 | echo "You have to use getpgrp() instead of getpgrp(pid)." >&4 | |
5630 | val="$undef" | |
5631 | else | |
5632 | echo "I can't seem to compile and run the test program." | |
5633 | if ./usg; then | |
5634 | xxx="a USG one, i.e. you use getpgrp()." | |
5635 | else | |
5636 | # SVR4 systems can appear rather BSD-ish. | |
5637 | case "$i_unistd" in | |
5638 | $undef) | |
5639 | xxx="a BSD one, i.e. you use getpgrp(pid)." | |
5640 | val="$define" | |
5641 | ;; | |
5642 | $define) | |
5643 | xxx="probably a USG one, i.e. you use getpgrp()." | |
5644 | val="$undef" | |
5645 | ;; | |
5646 | esac | |
5647 | fi | |
5648 | echo "Assuming your getpgrp is $xxx" >&4 | |
5649 | fi | |
5650 | ;; | |
5651 | *) val="$undef";; | |
5652 | esac | |
5653 | set d_bsdgetpgrp | |
5654 | eval $setvar | |
5655 | $rm -f set set.c | |
5656 | ||
a0d0e21e LW |
5657 | : see if setpgrp exists |
5658 | set setpgrp d_setpgrp | |
5659 | eval $inlibc | |
5660 | ||
2afac517 | 5661 | echo "Checking to see which flavor of setpgrp is in use . . . " |
a0d0e21e LW |
5662 | case "$d_setpgrp" in |
5663 | "$define") | |
5664 | echo " " | |
5665 | $cat >set.c <<EOP | |
2afac517 | 5666 | #$i_unistd I_UNISTD |
5667 | #include <sys/types.h> | |
5668 | #ifdef I_UNISTD | |
5669 | # include <unistd.h> | |
5670 | #endif | |
a0d0e21e LW |
5671 | main() |
5672 | { | |
5673 | if (getuid() == 0) { | |
5674 | printf("(I see you are running Configure as super-user...)\n"); | |
5675 | setuid(1); | |
5676 | } | |
2afac517 | 5677 | #ifdef TRY_BSD_PGRP |
a0d0e21e | 5678 | if (-1 == setpgrp(1, 1)) |
2afac517 | 5679 | exit(0); |
5680 | #else | |
5681 | if (setpgrp() != -1) | |
5682 | exit(0); | |
5683 | #endif | |
5684 | exit(1); | |
a0d0e21e LW |
5685 | } |
5686 | EOP | |
2afac517 | 5687 | if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then |
5688 | echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4 | |
5689 | val="$define" | |
5690 | elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then | |
5691 | echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4 | |
5692 | val="$undef" | |
a0d0e21e | 5693 | else |
2afac517 | 5694 | echo "I can't seem to compile and run the test program." |
ecfc5424 | 5695 | if ./usg; then |
2afac517 | 5696 | xxx="a USG one, i.e. you use setpgrp()." |
a0d0e21e | 5697 | else |
2afac517 | 5698 | # SVR4 systems can appear rather BSD-ish. |
5699 | case "$i_unistd" in | |
5700 | $undef) | |
5701 | xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)." | |
5702 | val="$define" | |
5703 | ;; | |
5704 | $define) | |
5705 | xxx="probably a USG one, i.e. you use setpgrp()." | |
5706 | val="$undef" | |
5707 | ;; | |
5708 | esac | |
a0d0e21e | 5709 | fi |
2afac517 | 5710 | echo "Assuming your setpgrp is $xxx" >&4 |
a0d0e21e LW |
5711 | fi |
5712 | ;; | |
5713 | *) val="$undef";; | |
5714 | esac | |
2afac517 | 5715 | set d_bsdsetpgrp |
a0d0e21e | 5716 | eval $setvar |
2afac517 | 5717 | d_bsdpgrp=$d_bsdsetpgrp |
a0d0e21e | 5718 | $rm -f set set.c |
a0d0e21e LW |
5719 | : see if bzero exists |
5720 | set bzero d_bzero | |
5721 | eval $inlibc | |
5722 | ||
5723 | : check for length of integer | |
5724 | echo " " | |
5725 | case "$intsize" in | |
5726 | '') | |
5727 | echo "Checking to see how big your integers are..." >&4 | |
5728 | $cat >try.c <<'EOCP' | |
5729 | #include <stdio.h> | |
5730 | main() | |
5731 | { | |
5732 | printf("%d\n", sizeof(int)); | |
8e07c86e | 5733 | exit(0); |
a0d0e21e LW |
5734 | } |
5735 | EOCP | |
8e07c86e AD |
5736 | if $cc $ccflags try.c -o try >/dev/null 2>&1 && ./try > /dev/null; then |
5737 | intsize=`./try` | |
5738 | echo "Your integers are $intsize bytes long." | |
a0d0e21e LW |
5739 | else |
5740 | dflt='4' | |
5741 | echo "(I can't seem to compile the test program. Guessing...)" | |
8e07c86e AD |
5742 | rp="What is the size of an integer (in bytes)?" |
5743 | . ./myread | |
5744 | intsize="$ans" | |
a0d0e21e LW |
5745 | fi |
5746 | ;; | |
a0d0e21e | 5747 | esac |
a0d0e21e LW |
5748 | $rm -f try.c try |
5749 | ||
ecfc5424 | 5750 | : see if signal is declared as pointer to function returning int or void |
a0d0e21e | 5751 | echo " " |
ecfc5424 AD |
5752 | xxx=`./findhdr signal.h` |
5753 | $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null | |
5754 | if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then | |
5755 | echo "You have int (*signal())() instead of void." >&4 | |
5756 | val="$undef" | |
5757 | elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then | |
5758 | echo "You have void (*signal())() instead of int." >&4 | |
5759 | val="$define" | |
5760 | elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then | |
5761 | echo "You have int (*signal())() instead of void." >&4 | |
5762 | val="$undef" | |
a0d0e21e | 5763 | else |
ecfc5424 AD |
5764 | case "$d_voidsig" in |
5765 | '') | |
5766 | echo "I can't determine whether signal handler returns void or int..." >&4 | |
5767 | dflt=void | |
5768 | rp="What type does your signal handler return?" | |
5769 | . ./myread | |
5770 | case "$ans" in | |
5771 | v*) val="$define";; | |
5772 | *) val="$undef";; | |
5773 | esac;; | |
5774 | "$define") | |
5775 | echo "As you already told me, signal handler returns void." >&4;; | |
5776 | *) | |
5777 | echo "As you already told me, signal handler returns int." >&4;; | |
5778 | esac | |
5779 | fi | |
5780 | set d_voidsig | |
5781 | eval $setvar | |
5782 | case "$d_voidsig" in | |
5783 | "$define") signal_t="void";; | |
5784 | *) signal_t="int";; | |
5785 | esac | |
5786 | $rm -f $$.tmp | |
5787 | ||
5788 | : check for ability to cast large floats to 32-bit ints. | |
5789 | echo " " | |
5790 | echo 'Checking whether your C compiler can cast large floats to int32.' >&4 | |
5791 | if $test "$intsize" -eq 4; then | |
5792 | xxx=int | |
5793 | else | |
5794 | xxx=long | |
5795 | fi | |
5796 | $cat >try.c <<EOCP | |
5797 | #include <sys/types.h> | |
5798 | #include <signal.h> | |
5799 | $signal_t blech() { exit(3); } | |
5800 | main() | |
2304df62 | 5801 | { |
a0d0e21e | 5802 | $xxx i32; |
2304df62 AD |
5803 | double f; |
5804 | int result = 0; | |
5805 | signal(SIGFPE, blech); | |
5806 | ||
5807 | f = (double) 0x7fffffff; | |
5808 | f = 10 * f; | |
a0d0e21e | 5809 | i32 = ($xxx) f; |
2304df62 | 5810 | |
a0d0e21e | 5811 | if (i32 != ($xxx) f) |
2304df62 AD |
5812 | result |= 1; |
5813 | exit(result); | |
5814 | } | |
5815 | EOCP | |
5816 | if $cc -o try $ccflags try.c >/dev/null 2>&1; then | |
5817 | ./try | |
5818 | yyy=$? | |
5819 | else | |
a0d0e21e | 5820 | echo "(I can't seem to compile the test program--assuming it can't)" |
2304df62 AD |
5821 | yyy=1 |
5822 | fi | |
5823 | case "$yyy" in | |
5824 | 0) val="$define" | |
5825 | echo "Yup, it can." | |
5826 | ;; | |
5827 | *) val="$undef" | |
5828 | echo "Nope, it can't." | |
5829 | ;; | |
5830 | esac | |
5831 | set d_casti32 | |
5832 | eval $setvar | |
85e6fe83 | 5833 | $rm -f try try.* |
a0d0e21e | 5834 | |
2304df62 AD |
5835 | : check for ability to cast negative floats to unsigned |
5836 | echo " " | |
5837 | echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4 | |
ecfc5424 AD |
5838 | $cat >try.c <<EOCP |
5839 | #include <sys/types.h> | |
2304df62 | 5840 | #include <signal.h> |
232e078e AD |
5841 | $signal_t blech() { exit(7); } |
5842 | $signal_t blech_in_list() { exit(4); } | |
5843 | unsigned long dummy_long(p) unsigned long p; { return p; } | |
5844 | unsigned int dummy_int(p) unsigned int p; { return p; } | |
5845 | unsigned short dummy_short(p) unsigned short p; { return p; } | |
2304df62 AD |
5846 | main() |
5847 | { | |
232e078e | 5848 | double f = -123.; |
2304df62 AD |
5849 | unsigned long along; |
5850 | unsigned int aint; | |
5851 | unsigned short ashort; | |
5852 | int result = 0; | |
5853 | ||
5854 | signal(SIGFPE, blech); | |
5855 | along = (unsigned long)f; | |
5856 | aint = (unsigned int)f; | |
5857 | ashort = (unsigned short)f; | |
5858 | if (along != (unsigned long)-123) | |
5859 | result |= 1; | |
5860 | if (aint != (unsigned int)-123) | |
5861 | result |= 1; | |
5862 | if (ashort != (unsigned short)-123) | |
5863 | result |= 1; | |
5864 | f = (double)0x40000000; | |
5865 | f = f + f; | |
5866 | along = 0; | |
5867 | along = (unsigned long)f; | |
5868 | if (along != 0x80000000) | |
5869 | result |= 2; | |
5870 | f -= 1.; | |
5871 | along = 0; | |
5872 | along = (unsigned long)f; | |
5873 | if (along != 0x7fffffff) | |
5874 | result |= 1; | |
5875 | f += 2.; | |
5876 | along = 0; | |
5877 | along = (unsigned long)f; | |
5878 | if (along != 0x80000001) | |
5879 | result |= 2; | |
232e078e AD |
5880 | if (result) |
5881 | exit(result); | |
5882 | signal(SIGFPE, blech_in_list); | |
5883 | f = 123.; | |
5884 | along = dummy_long((unsigned long)f); | |
5885 | aint = dummy_int((unsigned int)f); | |
5886 | ashort = dummy_short((unsigned short)f); | |
5887 | if (along != (unsigned long)123) | |
5888 | result |= 4; | |
5889 | if (aint != (unsigned int)123) | |
5890 | result |= 4; | |
5891 | if (ashort != (unsigned short)123) | |
5892 | result |= 4; | |
2304df62 AD |
5893 | exit(result); |
5894 | ||
5895 | } | |
5896 | EOCP | |
5897 | if $cc -o try $ccflags try.c >/dev/null 2>&1; then | |
5898 | ./try | |
5899 | castflags=$? | |
5900 | else | |
ecfc5424 | 5901 | echo "(I can't seem to compile the test program--assuming it can't)" |
232e078e | 5902 | castflags=7 |
2304df62 AD |
5903 | fi |
5904 | case "$castflags" in | |
5905 | 0) val="$define" | |
5906 | echo "Yup, it can." | |
5907 | ;; | |
5908 | *) val="$undef" | |
5909 | echo "Nope, it can't." | |
5910 | ;; | |
5911 | esac | |
5912 | set d_castneg | |
5913 | eval $setvar | |
5914 | $rm -f try.* | |
5915 | ||
2304df62 AD |
5916 | : see if vprintf exists |
5917 | echo " " | |
5918 | if set vprintf val -f d_vprintf; eval $csym; $val; then | |
5919 | echo 'vprintf() found.' >&4 | |
5920 | val="$define" | |
5921 | $cat >vprintf.c <<'EOF' | |
5922 | #include <varargs.h> | |
5923 | ||
5924 | main() { xxx("foo"); } | |
5925 | ||
5926 | xxx(va_alist) | |
5927 | va_dcl | |
5928 | { | |
5929 | va_list args; | |
5930 | char buf[10]; | |
5931 | ||
5932 | va_start(args); | |
5933 | exit((unsigned long)vsprintf(buf,"%s",args) > 10L); | |
5934 | } | |
5935 | EOF | |
5936 | if $cc $ccflags vprintf.c -o vprintf >/dev/null 2>&1 && ./vprintf; then | |
5937 | echo "Your vsprintf() returns (int)." >&4 | |
5938 | val2="$undef" | |
5939 | else | |
5940 | echo "Your vsprintf() returns (char*)." >&4 | |
5941 | val2="$define" | |
5942 | fi | |
5943 | else | |
5944 | echo 'vprintf() NOT found.' >&4 | |
5945 | val="$undef" | |
5946 | val2="$undef" | |
5947 | fi | |
5948 | set d_vprintf | |
5949 | eval $setvar | |
5950 | val=$val2 | |
5951 | set d_charvspr | |
5952 | eval $setvar | |
5953 | ||
a0d0e21e LW |
5954 | : see if chown exists |
5955 | set chown d_chown | |
5956 | eval $inlibc | |
5957 | ||
5958 | : see if chroot exists | |
5959 | set chroot d_chroot | |
5960 | eval $inlibc | |
5961 | ||
2304df62 AD |
5962 | : see if chsize exists |
5963 | set chsize d_chsize | |
5964 | eval $inlibc | |
5965 | ||
5966 | : check for const keyword | |
5967 | echo " " | |
5968 | echo 'Checking to see if your C compiler knows about "const"...' >&4 | |
5969 | $cat >const.c <<'EOCP' | |
5970 | typedef struct spug { int drokk; } spug; | |
5971 | main() | |
5972 | { | |
5973 | const char *foo; | |
5974 | const spug y; | |
5975 | } | |
5976 | EOCP | |
5977 | if $cc -c $ccflags const.c >/dev/null 2>&1 ; then | |
5978 | val="$define" | |
5979 | echo "Yup, it does." | |
5980 | else | |
5981 | val="$undef" | |
5982 | echo "Nope, it doesn't." | |
5983 | fi | |
5984 | set d_const | |
5985 | eval $setvar | |
5986 | ||
5987 | : see if crypt exists | |
5988 | echo " " | |
5989 | if set crypt val -f d_crypt; eval $csym; $val; then | |
5990 | echo 'crypt() found.' >&4 | |
5991 | val="$define" | |
5992 | cryptlib='' | |
5993 | else | |
5f05dabc | 5994 | cryptlib=`./loc Slibcrypt$lib_ext "" $xlibpth` |
2304df62 | 5995 | if $test -z "$cryptlib"; then |
5f05dabc | 5996 | cryptlib=`./loc Mlibcrypt$lib_ext "" $xlibpth` |
2304df62 AD |
5997 | else |
5998 | cryptlib=-lcrypt | |
5999 | fi | |
6000 | if $test -z "$cryptlib"; then | |
5f05dabc | 6001 | cryptlib=`./loc Llibcrypt$lib_ext "" $xlibpth` |
2304df62 AD |
6002 | else |
6003 | cryptlib=-lcrypt | |
6004 | fi | |
6005 | if $test -z "$cryptlib"; then | |
5f05dabc | 6006 | cryptlib=`./loc libcrypt$lib_ext "" $libpth` |
2304df62 AD |
6007 | else |
6008 | cryptlib=-lcrypt | |
6009 | fi | |
6010 | if $test -z "$cryptlib"; then | |
6011 | echo 'crypt() NOT found.' >&4 | |
6012 | val="$undef" | |
6013 | else | |
6014 | val="$define" | |
6015 | fi | |
6016 | fi | |
6017 | set d_crypt | |
6018 | eval $setvar | |
6019 | ||
6020 | : get csh whereabouts | |
6021 | case "$csh" in | |
6022 | 'csh') val="$undef" ;; | |
6023 | *) val="$define" ;; | |
6024 | esac | |
6025 | set d_csh | |
6026 | eval $setvar | |
1aef975c | 6027 | full_csh=$csh |
2304df62 | 6028 | |
a0d0e21e LW |
6029 | : see if cuserid exists |
6030 | set cuserid d_cuserid | |
2304df62 AD |
6031 | eval $inlibc |
6032 | ||
a0d0e21e LW |
6033 | : see if this is a limits.h system |
6034 | set limits.h i_limits | |
85e6fe83 LW |
6035 | eval $inhdr |
6036 | ||
a0d0e21e LW |
6037 | : see if this is a float.h system |
6038 | set float.h i_float | |
6039 | eval $inhdr | |
6040 | ||
6041 | : See if number of significant digits in a double precision number is known | |
6042 | echo " " | |
6043 | $cat >dbl_dig.c <<EOM | |
6044 | #$i_limits I_LIMITS | |
6045 | #$i_float I_FLOAT | |
6046 | #ifdef I_LIMITS | |
6047 | #include <limits.h> | |
85e6fe83 | 6048 | #endif |
a0d0e21e LW |
6049 | #ifdef I_FLOAT |
6050 | #include <float.h> | |
6051 | #endif | |
6052 | #ifdef DBL_DIG | |
6053 | printf("Contains DBL_DIG"); | |
85e6fe83 | 6054 | #endif |
85e6fe83 | 6055 | EOM |
a0d0e21e LW |
6056 | $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null |
6057 | if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then | |
6058 | echo "DBL_DIG found." >&4 | |
6059 | val="$define" | |
2304df62 | 6060 | else |
a0d0e21e LW |
6061 | echo "DBL_DIG NOT found." >&4 |
6062 | val="$undef" | |
2304df62 | 6063 | fi |
a0d0e21e LW |
6064 | $rm -f dbl_dig.? |
6065 | set d_dbl_dig | |
2304df62 | 6066 | eval $setvar |
2304df62 | 6067 | |
a0d0e21e LW |
6068 | : see if difftime exists |
6069 | set difftime d_difftime | |
2304df62 AD |
6070 | eval $inlibc |
6071 | ||
a0d0e21e LW |
6072 | : see if this is a dirent system |
6073 | echo " " | |
6074 | if xinc=`./findhdr dirent.h`; $test "$xinc"; then | |
6075 | val="$define" | |
6076 | echo "<dirent.h> found." >&4 | |
6077 | else | |
6078 | val="$undef" | |
6079 | if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then | |
6080 | echo "<sys/dir.h> found." >&4 | |
6081 | echo " " | |
6082 | else | |
6083 | xinc=`./findhdr sys/ndir.h` | |
6084 | fi | |
6085 | echo "<dirent.h> NOT found." >&4 | |
6086 | fi | |
6087 | set i_dirent | |
6088 | eval $setvar | |
6089 | ||
6090 | : Look for type of directory structure. | |
6091 | echo " " | |
6092 | $cppstdin $cppflags $cppminus < "$xinc" > try.c | |
6093 | ||
6094 | case "$direntrytype" in | |
6095 | ''|' ') | |
6096 | case "$i_dirent" in | |
6097 | $define) guess1='struct dirent' ;; | |
6098 | *) guess1='struct direct' ;; | |
2afac517 | 6099 | esac |
6100 | ;; | |
6101 | *) guess1="$direntrytype" | |
6102 | ;; | |
8e07c86e AD |
6103 | esac |
6104 | ||
2afac517 | 6105 | case "$guess1" in |
6106 | 'struct dirent') guess2='struct direct' ;; | |
6107 | *) guess2='struct dirent' ;; | |
6108 | esac | |
6109 | ||
6110 | if $contains "$guess1" try.c >/dev/null 2>&1; then | |
6111 | direntrytype="$guess1" | |
6112 | echo "Your directory entries are $direntrytype." >&4 | |
6113 | elif $contains "$guess2" try.c >/dev/null 2>&1; then | |
6114 | direntrytype="$guess2" | |
6115 | echo "Your directory entries seem to be $direntrytype." >&4 | |
6116 | else | |
6117 | echo "I don't recognize your system's directory entries." >&4 | |
6118 | rp="What type is used for directory entries on this system?" | |
6119 | dflt="$guess1" | |
6120 | . ./myread | |
6121 | direntrytype="$ans" | |
6122 | fi | |
6123 | $rm -f try.c | |
a0d0e21e | 6124 | |
a0d0e21e | 6125 | |
2afac517 | 6126 | : see if the directory entry stores field length |
6127 | echo " " | |
6128 | $cppstdin $cppflags $cppminus < "$xinc" > try.c | |
6129 | if $contains 'd_namlen' try.c >/dev/null 2>&1; then | |
6130 | echo "Good, your directory entry keeps length information in d_namlen." >&4 | |
6131 | val="$define" | |
6132 | else | |
6133 | echo "Your directory entry does not know about the d_namlen field." >&4 | |
6134 | val="$undef" | |
6135 | fi | |
6136 | set d_dirnamlen | |
6137 | eval $setvar | |
6138 | $rm -f try.c | |
a0d0e21e | 6139 | |
2afac517 | 6140 | : see if dlerror exists |
6141 | xxx_runnm="$runnm" | |
6142 | runnm=false | |
6143 | set dlerror d_dlerror | |
6144 | eval $inlibc | |
6145 | runnm="$xxx_runnm" | |
a0d0e21e LW |
6146 | |
6147 | : see if dlfcn is available | |
6148 | set dlfcn.h i_dlfcn | |
6149 | eval $inhdr | |
6150 | ||
6151 | case "$usedl" in | |
6152 | $define|y|true) | |
6153 | $cat << EOM | |
6154 | ||
6155 | On a few systems, the dynamically loaded modules that perl generates and uses | |
6156 | will need a different extension then shared libs. The default will probably | |
6157 | be appropriate. | |
6158 | ||
6159 | EOM | |
6160 | case "$dlext" in | |
6161 | '') dflt="$so" ;; | |
6162 | *) dflt="$dlext" ;; | |
6163 | esac | |
6164 | rp='What is the extension of dynamically loaded modules' | |
6165 | . ./myread | |
6166 | dlext="$ans" | |
6167 | ;; | |
6168 | *) | |
6169 | dlext="none" | |
6170 | ;; | |
6171 | esac | |
6172 | ||
6173 | : Check if dlsym need a leading underscore | |
6174 | echo " " | |
6175 | val="$undef" | |
6176 | ||
6177 | case "$dlsrc" in | |
6178 | dl_dlopen.xs) | |
6179 | echo "Checking whether your dlsym() needs a leading underscore ..." >&4 | |
6180 | $cat >dyna.c <<'EOM' | |
6181 | fred () { } | |
6182 | EOM | |
6183 | ||
6184 | $cat >fred.c<<EOM | |
6185 | ||
6186 | #include <stdio.h> | |
6187 | #$i_dlfcn I_DLFCN | |
6188 | #ifdef I_DLFCN | |
6189 | #include <dlfcn.h> /* the dynamic linker include file for Sunos/Solaris */ | |
6190 | #else | |
6191 | #include <sys/types.h> | |
6192 | #include <nlist.h> | |
6193 | #include <link.h> | |
6194 | #endif | |
6195 | ||
6196 | extern int fred() ; | |
6197 | ||
6198 | main() | |
6199 | { | |
6200 | void * handle ; | |
6201 | void * symbol ; | |
6202 | #ifndef RTLD_LAZY | |
6203 | int mode = 1 ; | |
6204 | #else | |
6205 | int mode = RTLD_LAZY ; | |
6206 | #endif | |
6207 | handle = dlopen("./dyna.$dlext", mode) ; | |
6208 | if (handle == NULL) { | |
5f05dabc | 6209 | printf ("1\n") ; |
6210 | fflush (stdout) ; | |
6211 | exit(0); | |
a0d0e21e LW |
6212 | } |
6213 | symbol = dlsym(handle, "fred") ; | |
6214 | if (symbol == NULL) { | |
5f05dabc | 6215 | /* try putting a leading underscore */ |
6216 | symbol = dlsym(handle, "_fred") ; | |
6217 | if (symbol == NULL) { | |
6218 | printf ("2\n") ; | |
6219 | fflush (stdout) ; | |
6220 | exit(0); | |
6221 | } | |
6222 | printf ("3\n") ; | |
a0d0e21e LW |
6223 | } |
6224 | else | |
5f05dabc | 6225 | printf ("4\n") ; |
36477c24 | 6226 | fflush (stdout) ; |
6227 | exit(0); | |
a0d0e21e LW |
6228 | } |
6229 | EOM | |
760ac839 | 6230 | : Call the object file tmp-dyna.o in case dlext=o. |
a0d0e21e | 6231 | if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && |
8ff267be | 6232 | mv dyna${obj_ext} tmp-dyna${obj_ext} > /dev/null 2>&1 && |
6233 | $ld $lddlflags -o dyna.$dlext tmp-dyna${obj_ext} > /dev/null 2>&1 && | |
a0d0e21e LW |
6234 | $cc $ccflags $ldflags $cccdlflags $ccdlflags fred.c -o fred $libs > /dev/null 2>&1; then |
6235 | xxx=`./fred` | |
6236 | case $xxx in | |
6237 | 1) echo "Test program failed using dlopen." >&4 | |
6238 | echo "Perhaps you should not use dynamic loading." >&4;; | |
6239 | 2) echo "Test program failed using dlsym." >&4 | |
6240 | echo "Perhaps you should not use dynamic loading." >&4;; | |
6241 | 3) echo "dlsym needs a leading underscore" >&4 | |
6242 | val="$define" ;; | |
6243 | 4) echo "dlsym doesn't need a leading underscore." >&4;; | |
6244 | esac | |
6245 | else | |
6246 | echo "I can't compile and run the test program." >&4 | |
6247 | fi | |
6248 | ;; | |
6249 | esac | |
6250 | ||
a78b0d02 | 6251 | $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.? |
a0d0e21e LW |
6252 | |
6253 | set d_dlsymun | |
6254 | eval $setvar | |
6255 | ||
a0d0e21e LW |
6256 | : see if dup2 exists |
6257 | set dup2 d_dup2 | |
6258 | eval $inlibc | |
6259 | ||
8e07c86e AD |
6260 | : Locate the flags for 'open()' |
6261 | echo " " | |
6262 | $cat >open3.c <<'EOCP' | |
6263 | #include <sys/types.h> | |
6264 | #ifdef I_FCNTL | |
6265 | #include <fcntl.h> | |
6266 | #endif | |
6267 | #ifdef I_SYS_FILE | |
6268 | #include <sys/file.h> | |
6269 | #endif | |
6270 | main() { | |
6271 | if(O_RDONLY); | |
6272 | #ifdef O_TRUNC | |
6273 | exit(0); | |
6274 | #else | |
6275 | exit(1); | |
6276 | #endif | |
6277 | } | |
6278 | EOCP | |
6279 | : check sys/file.h first to get FREAD on Sun | |
6280 | if $test `./findhdr sys/file.h` && \ | |
6281 | $cc $cppflags "-DI_SYS_FILE" open3.c -o open3 >/dev/null 2>&1 ; then | |
6282 | h_sysfile=true; | |
6283 | echo "<sys/file.h> defines the O_* constants..." >&4 | |
6284 | if ./open3; then | |
6285 | echo "and you have the 3 argument form of open()." >&4 | |
6286 | val="$define" | |
6287 | else | |
6288 | echo "but not the 3 argument form of open(). Oh, well." >&4 | |
6289 | val="$undef" | |
6290 | fi | |
6291 | elif $test `./findhdr fcntl.h` && \ | |
6292 | $cc "-DI_FCNTL" open3.c -o open3 >/dev/null 2>&1 ; then | |
6293 | h_fcntl=true; | |
6294 | echo "<fcntl.h> defines the O_* constants..." >&4 | |
6295 | if ./open3; then | |
6296 | echo "and you have the 3 argument form of open()." >&4 | |
6297 | val="$define" | |
6298 | else | |
6299 | echo "but not the 3 argument form of open(). Oh, well." >&4 | |
6300 | val="$undef" | |
6301 | fi | |
6302 | else | |
6303 | val="$undef" | |
6304 | echo "I can't find the O_* constant definitions! You got problems." >&4 | |
6305 | fi | |
6306 | set d_open3 | |
6307 | eval $setvar | |
6308 | $rm -f open3* | |
6309 | ||
6310 | : check for non-blocking I/O stuff | |
6311 | case "$h_sysfile" in | |
6312 | true) echo "#include <sys/file.h>" > head.c;; | |
6313 | *) | |
6314 | case "$h_fcntl" in | |
6315 | true) echo "#include <fcntl.h>" > head.c;; | |
6316 | *) echo "#include <sys/fcntl.h>" > head.c;; | |
6317 | esac | |
6318 | ;; | |
6319 | esac | |
6320 | echo " " | |
6321 | echo "Figuring out the flag used by open() for non-blocking I/O..." >&4 | |
6322 | case "$o_nonblock" in | |
6323 | '') | |
6324 | $cat head.c > try.c | |
6325 | $cat >>try.c <<'EOCP' | |
6326 | main() { | |
6327 | #ifdef O_NONBLOCK | |
6328 | printf("O_NONBLOCK\n"); | |
6329 | exit(0); | |
6330 | #endif | |
6331 | #ifdef O_NDELAY | |
6332 | printf("O_NDELAY\n"); | |
6333 | exit(0); | |
6334 | #endif | |
6335 | #ifdef FNDELAY | |
6336 | printf("FNDELAY\n"); | |
6337 | exit(0); | |
6338 | #endif | |
6339 | exit(0); | |
6340 | } | |
6341 | EOCP | |
6342 | if $cc $ccflags $ldflags try.c -o try >/dev/null 2>&1; then | |
6343 | o_nonblock=`./try` | |
6344 | case "$o_nonblock" in | |
6345 | '') echo "I can't figure it out, assuming O_NONBLOCK will do.";; | |
6346 | *) echo "Seems like we can use $o_nonblock.";; | |
6347 | esac | |
6348 | else | |
6349 | echo "(I can't compile the test program; pray O_NONBLOCK is right!)" | |
6350 | fi | |
6351 | ;; | |
6352 | *) echo "Using $hint value $o_nonblock.";; | |
6353 | esac | |
6354 | $rm -f try try.* .out core | |
6355 | ||
6356 | echo " " | |
6357 | echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4 | |
6358 | case "$eagain" in | |
6359 | '') | |
6360 | $cat head.c > try.c | |
6361 | $cat >>try.c <<EOCP | |
6362 | #include <errno.h> | |
6363 | #include <sys/types.h> | |
6364 | #include <signal.h> | |
4633a7c4 | 6365 | #define MY_O_NONBLOCK $o_nonblock |
8e07c86e AD |
6366 | extern int errno; |
6367 | $signal_t blech(x) int x; { exit(3); } | |
4633a7c4 LW |
6368 | EOCP |
6369 | $cat >> try.c <<'EOCP' | |
8e07c86e AD |
6370 | main() |
6371 | { | |
6372 | int pd[2]; | |
6373 | int pu[2]; | |
6374 | char buf[1]; | |
6375 | char string[100]; | |
6376 | ||
6377 | pipe(pd); /* Down: child -> parent */ | |
6378 | pipe(pu); /* Up: parent -> child */ | |
6379 | if (0 != fork()) { | |
6380 | int ret; | |
6381 | close(pd[1]); /* Parent reads from pd[0] */ | |
6382 | close(pu[0]); /* Parent writes (blocking) to pu[1] */ | |
4633a7c4 | 6383 | if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK)) |
8e07c86e AD |
6384 | exit(1); |
6385 | signal(SIGALRM, blech); | |
6386 | alarm(5); | |
6387 | if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */ | |
6388 | exit(2); | |
6389 | sprintf(string, "%d\n", ret); | |
6390 | write(2, string, strlen(string)); | |
6391 | alarm(0); | |
6392 | #ifdef EAGAIN | |
6393 | if (errno == EAGAIN) { | |
6394 | printf("EAGAIN\n"); | |
6395 | goto ok; | |
6396 | } | |
6397 | #endif | |
6398 | #ifdef EWOULDBLOCK | |
6399 | if (errno == EWOULDBLOCK) | |
6400 | printf("EWOULDBLOCK\n"); | |
6401 | #endif | |
6402 | ok: | |
6403 | write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */ | |
6404 | sleep(2); /* Give it time to close our pipe */ | |
6405 | alarm(5); | |
6406 | ret = read(pd[0], buf, 1); /* Should read EOF */ | |
6407 | alarm(0); | |
6408 | sprintf(string, "%d\n", ret); | |
6409 | write(3, string, strlen(string)); | |
6410 | exit(0); | |
6411 | } | |
6412 | ||
6413 | close(pd[0]); /* We write to pd[1] */ | |
6414 | close(pu[1]); /* We read from pu[0] */ | |
6415 | read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */ | |
6416 | close(pd[1]); /* Pipe pd is now fully closed! */ | |
6417 | exit(0); /* Bye bye, thank you for playing! */ | |
6418 | } | |
6419 | EOCP | |
25f94b33 | 6420 | if $cc $ccflags $ldflags try.c -o try >/dev/null 2>&1; then |
28757baa | 6421 | cat <<EOS >mtry |
6422 | $startsh | |
6423 | EOS | |
40a7a20a | 6424 | echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry |
8e07c86e AD |
6425 | chmod +x mtry |
6426 | ./mtry >/dev/null 2>&1 | |
6427 | case $? in | |
6428 | 0) eagain=`$cat try.out`;; | |
6429 | 1) echo "Could not perform non-blocking setting!";; | |
6430 | 2) echo "I did a successful read() for something that was not there!";; | |
6431 | 3) echo "Hmm... non-blocking I/O does not seem to be working!";; | |
6432 | *) echo "Something terribly wrong happened during testing.";; | |
6433 | esac | |
6434 | rd_nodata=`$cat try.ret` | |
6435 | echo "A read() system call with no data present returns $rd_nodata." | |
6436 | case "$rd_nodata" in | |
6437 | 0|-1) ;; | |
6438 | *) | |
6439 | echo "(That's peculiar, fixing that to be -1.)" | |
6440 | rd_nodata=-1 | |
6441 | ;; | |
6442 | esac | |
6443 | case "$eagain" in | |
6444 | '') | |
6445 | echo "Forcing errno EAGAIN on read() with no data available." | |
6446 | eagain=EAGAIN | |
6447 | ;; | |
6448 | *) | |
6449 | echo "Your read() sets errno to $eagain when no data is available." | |
6450 | ;; | |
6451 | esac | |
6452 | status=`$cat try.err` | |
6453 | case "$status" in | |
6454 | 0) echo "And it correctly returns 0 to signal EOF.";; | |
6455 | -1) echo "But it also returns -1 to signal EOF, so be careful!";; | |
6456 | *) echo "However, your read() returns '$status' on EOF??";; | |
6457 | esac | |
6458 | val="$define" | |
28757baa | 6459 | if test "$status" = "$rd_nodata"; then |
8e07c86e AD |
6460 | echo "WARNING: you can't distinguish between EOF and no data!" |
6461 | val="$undef" | |
6462 | fi | |
6463 | else | |
6464 | echo "I can't compile the test program--assuming errno EAGAIN will do." | |
6465 | eagain=EAGAIN | |
6466 | fi | |
6467 | set d_eofnblk | |
6468 | eval $setvar | |
6469 | ;; | |
6470 | *) | |
6471 | echo "Using $hint value $eagain." | |
6472 | echo "Your read() returns $rd_nodata when no data is present." | |
6473 | case "$d_eofnblk" in | |
6474 | "$define") echo "And you can see EOF because read() returns 0.";; | |
6475 | "$undef") echo "But you can't see EOF status from read() returned value.";; | |
6476 | *) | |
6477 | echo "(Assuming you can't see EOF status from read anyway.)" | |
6478 | d_eofnblk=$undef | |
6479 | ;; | |
6480 | esac | |
6481 | ;; | |
6482 | esac | |
6483 | $rm -f try try.* .out core head.c mtry | |
6484 | ||
a0d0e21e LW |
6485 | : see if fchmod exists |
6486 | set fchmod d_fchmod | |
6487 | eval $inlibc | |
6488 | ||
6489 | : see if fchown exists | |
6490 | set fchown d_fchown | |
6491 | eval $inlibc | |
6492 | ||
6493 | : see if this is an fcntl system | |
6494 | set fcntl d_fcntl | |
6495 | eval $inlibc | |
6496 | ||
6497 | : see if fgetpos exists | |
6498 | set fgetpos d_fgetpos | |
6499 | eval $inlibc | |
6500 | ||
a0d0e21e LW |
6501 | : see if flock exists |
6502 | set flock d_flock | |
6503 | eval $inlibc | |
6504 | ||
a0d0e21e LW |
6505 | : see if fork exists |
6506 | set fork d_fork | |
6507 | eval $inlibc | |
6508 | ||
6509 | : see if pathconf exists | |
6510 | set pathconf d_pathconf | |
6511 | eval $inlibc | |
6512 | ||
6513 | : see if fpathconf exists | |
6514 | set fpathconf d_fpathconf | |
6515 | eval $inlibc | |
6516 | ||
6517 | : see if fsetpos exists | |
6518 | set fsetpos d_fsetpos | |
6519 | eval $inlibc | |
6520 | ||
6521 | : see if gethostent exists | |
6522 | set gethostent d_gethent | |
6523 | eval $inlibc | |
6524 | ||
6525 | : see if getlogin exists | |
6526 | set getlogin d_getlogin | |
6527 | eval $inlibc | |
6528 | ||
2afac517 | 6529 | : see if getpgid exists |
6530 | set getpgid d_getpgid | |
a0d0e21e LW |
6531 | eval $inlibc |
6532 | ||
6533 | : see if getpgrp2 exists | |
6534 | set getpgrp2 d_getpgrp2 | |
6535 | eval $inlibc | |
6536 | ||
6537 | : see if getppid exists | |
6538 | set getppid d_getppid | |
6539 | eval $inlibc | |
6540 | ||
6541 | : see if getpriority exists | |
6542 | set getpriority d_getprior | |
6543 | eval $inlibc | |
6544 | ||
5f05dabc | 6545 | : see if gettimeofday or ftime exists |
6546 | set gettimeofday d_gettimeod | |
6547 | eval $inlibc | |
6548 | case "$d_gettimeod" in | |
6549 | "$undef") | |
6550 | set ftime d_ftime | |
6551 | eval $inlibc | |
6552 | ;; | |
6553 | *) | |
6554 | val="$undef"; set d_ftime; eval $setvar | |
6555 | ;; | |
6556 | esac | |
6557 | case "$d_gettimeod$d_ftime" in | |
6558 | "$undef$undef") | |
6559 | echo " " | |
6560 | echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4 | |
6561 | ;; | |
6562 | esac | |
6563 | ||
a0d0e21e LW |
6564 | : see if this is a netinet/in.h or sys/in.h system |
6565 | set netinet/in.h i_niin sys/in.h i_sysin | |
6566 | eval $inhdr | |
6567 | ||
6568 | : see if htonl --and friends-- exists | |
6569 | val='' | |
6570 | set htonl val | |
6571 | eval $inlibc | |
6572 | ||
6573 | : Maybe they are macros. | |
6574 | case "$val" in | |
6575 | $undef) | |
6576 | $cat >htonl.c <<EOM | |
6577 | #include <stdio.h> | |
6578 | #include <sys/types.h> | |
6579 | #$i_niin I_NETINET_IN | |
6580 | #$i_sysin I_SYS_IN | |
6581 | #ifdef I_NETINET_IN | |
6582 | #include <netinet/in.h> | |
6583 | #endif | |
6584 | #ifdef I_SYS_IN | |
6585 | #include <sys/in.h> | |
6586 | #endif | |
6587 | #ifdef htonl | |
6588 | printf("Defined as a macro."); | |
6589 | #endif | |
6590 | EOM | |
6591 | $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null | |
6592 | if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then | |
6593 | val="$define" | |
6594 | echo "But it seems to be defined as a macro." >&4 | |
6595 | fi | |
6596 | $rm -f htonl.? | |
6597 | ;; | |
6598 | esac | |
6599 | set d_htonl | |
6600 | eval $setvar | |
6601 | ||
6602 | : see which of string.h or strings.h is needed | |
6603 | echo " " | |
6604 | strings=`./findhdr string.h` | |
6605 | if $test "$strings" && $test -r "$strings"; then | |
6606 | echo "Using <string.h> instead of <strings.h>." >&4 | |
6607 | val="$define" | |
6608 | else | |
6609 | val="$undef" | |
6610 | strings=`./findhdr strings.h` | |
6611 | if $test "$strings" && $test -r "$strings"; then | |
6612 | echo "Using <strings.h> instead of <string.h>." >&4 | |
6613 | else | |
6614 | echo "No string header found -- You'll surely have problems." >&4 | |
6615 | fi | |
6616 | fi | |
6617 | set i_string | |
6618 | eval $setvar | |
6619 | case "$i_string" in | |
6620 | "$undef") strings=`./findhdr strings.h`;; | |
6621 | *) strings=`./findhdr string.h`;; | |
6622 | esac | |
6623 | ||
6624 | : index or strchr | |
6625 | echo " " | |
6626 | if set index val -f; eval $csym; $val; then | |
6627 | if set strchr val -f d_strchr; eval $csym; $val; then | |
6628 | if $contains strchr "$strings" >/dev/null 2>&1 ; then | |
6629 | val="$define" | |
6630 | vali="$undef" | |
6631 | echo "strchr() found." >&4 | |
6632 | else | |
6633 | val="$undef" | |
6634 | vali="$define" | |
6635 | echo "index() found." >&4 | |
6636 | fi | |
6637 | else | |
6638 | val="$undef" | |
6639 | vali="$define" | |
6640 | echo "index() found." >&4 | |
6641 | fi | |
6642 | else | |
6643 | if set strchr val -f d_strchr; eval $csym; $val; then | |
6644 | val="$define" | |
6645 | vali="$undef" | |
6646 | echo "strchr() found." >&4 | |
6647 | else | |
6648 | echo "No index() or strchr() found!" >&4 | |
6649 | val="$undef" | |
6650 | vali="$undef" | |
6651 | fi | |
6652 | fi | |
6653 | set d_strchr; eval $setvar | |
6654 | val="$vali" | |
6655 | set d_index; eval $setvar | |
6656 | ||
7e1af8bc | 6657 | : check whether inet_aton exists |
6658 | set inet_aton d_inetaton | |
6659 | eval $inlibc | |
6660 | ||
a0d0e21e LW |
6661 | : Look for isascii |
6662 | echo " " | |
6663 | $cat >isascii.c <<'EOCP' | |
6664 | #include <stdio.h> | |
6665 | #include <ctype.h> | |
6666 | main() { | |
6667 | int c = 'A'; | |
6668 | if (isascii(c)) | |
6669 | exit(0); | |
6670 | else | |
6671 | exit(1); | |
6672 | } | |
6673 | EOCP | |
6674 | if $cc $ccflags $ldflags -o isascii isascii.c $libs >/dev/null 2>&1 ; then | |
6675 | echo "isascii() found." >&4 | |
6676 | val="$define" | |
6677 | else | |
6678 | echo "isascii() NOT found." >&4 | |
6679 | val="$undef" | |
6680 | fi | |
6681 | set d_isascii | |
6682 | eval $setvar | |
6683 | $rm -f isascii* | |
6684 | ||
6685 | : see if killpg exists | |
6686 | set killpg d_killpg | |
6687 | eval $inlibc | |
6688 | ||
6689 | : see if link exists | |
6690 | set link d_link | |
6691 | eval $inlibc | |
6692 | ||
a0d0e21e LW |
6693 | : see if localeconv exists |
6694 | set localeconv d_locconv | |
6695 | eval $inlibc | |
6696 | ||
6697 | : see if lockf exists | |
6698 | set lockf d_lockf | |
6699 | eval $inlibc | |
6700 | ||
6701 | : see if lstat exists | |
6702 | set lstat d_lstat | |
6703 | eval $inlibc | |
6704 | ||
6705 | : see if mblen exists | |
6706 | set mblen d_mblen | |
6707 | eval $inlibc | |
6708 | ||
6709 | : see if mbstowcs exists | |
6710 | set mbstowcs d_mbstowcs | |
6711 | eval $inlibc | |
6712 | ||
6713 | : see if mbtowc exists | |
6714 | set mbtowc d_mbtowc | |
6715 | eval $inlibc | |
6716 | ||
6717 | : see if memcmp exists | |
6718 | set memcmp d_memcmp | |
6719 | eval $inlibc | |
6720 | ||
6721 | : see if memcpy exists | |
6722 | set memcpy d_memcpy | |
6723 | eval $inlibc | |
6724 | ||
6725 | : see if memmove exists | |
6726 | set memmove d_memmove | |
2304df62 AD |
6727 | eval $inlibc |
6728 | ||
6729 | : see if memset exists | |
6730 | set memset d_memset | |
6731 | eval $inlibc | |
6732 | ||
6733 | : see if mkdir exists | |
6734 | set mkdir d_mkdir | |
6735 | eval $inlibc | |
6736 | ||
a0d0e21e LW |
6737 | : see if mkfifo exists |
6738 | set mkfifo d_mkfifo | |
6739 | eval $inlibc | |
6740 | ||
6741 | : see if mktime exists | |
6742 | set mktime d_mktime | |
6743 | eval $inlibc | |
6744 | ||
2304df62 AD |
6745 | : see if msgctl exists |
6746 | set msgctl d_msgctl | |
6747 | eval $inlibc | |
6748 | ||
6749 | : see if msgget exists | |
6750 | set msgget d_msgget | |
6751 | eval $inlibc | |
6752 | ||
6753 | : see if msgsnd exists | |
6754 | set msgsnd d_msgsnd | |
6755 | eval $inlibc | |
6756 | ||
6757 | : see if msgrcv exists | |
6758 | set msgrcv d_msgrcv | |
6759 | eval $inlibc | |
6760 | ||
6761 | : see how much of the 'msg*(2)' library is present. | |
6762 | h_msg=true | |
6763 | echo " " | |
6764 | case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in | |
6765 | *"$undef"*) h_msg=false;; | |
6766 | esac | |
6767 | : we could also check for sys/ipc.h ... | |
6768 | if $h_msg && $test `./findhdr sys/msg.h`; then | |
6769 | echo "You have the full msg*(2) library." >&4 | |
6770 | val="$define" | |
6771 | else | |
6772 | echo "You don't have the full msg*(2) library." >&4 | |
6773 | val="$undef" | |
6774 | fi | |
6775 | set d_msg | |
6776 | eval $setvar | |
6777 | ||
a0d0e21e LW |
6778 | : see if this is a malloc.h system |
6779 | set malloc.h i_malloc | |
6780 | eval $inhdr | |
6781 | ||
94b6baf5 AD |
6782 | : see if stdlib is available |
6783 | set stdlib.h i_stdlib | |
6784 | eval $inhdr | |
6785 | ||
85e6fe83 | 6786 | : determine which malloc to compile in |
85e6fe83 LW |
6787 | echo " " |
6788 | case "$usemymalloc" in | |
a0d0e21e LW |
6789 | ''|y*|true) dflt='y' ;; |
6790 | n*|false) dflt='n' ;; | |
6791 | *) dflt="$usemymalloc" ;; | |
85e6fe83 LW |
6792 | esac |
6793 | rp="Do you wish to attempt to use the malloc that comes with $package?" | |
6794 | . ./myread | |
6795 | usemymalloc="$ans" | |
6796 | case "$ans" in | |
a0d0e21e LW |
6797 | y*|true) |
6798 | usemymalloc='y' | |
6799 | mallocsrc='malloc.c' | |
6800 | mallocobj='malloc.o' | |
6801 | d_mymalloc="$define" | |
6802 | case "$libs" in | |
6803 | *-lmalloc*) | |
6804 | : Remove malloc from list of libraries to use | |
6805 | echo "Removing unneeded -lmalloc from library list" >&4 | |
6806 | set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'` | |
6807 | shift | |
6808 | libs="$*" | |
6809 | echo "libs = $libs" >&4 | |
6810 | ;; | |
6811 | esac | |
6812 | ;; | |
6813 | *) | |
6814 | usemymalloc='n' | |
6815 | mallocsrc='' | |
6816 | mallocobj='' | |
6817 | d_mymalloc="$undef" | |
6818 | ;; | |
85e6fe83 LW |
6819 | esac |
6820 | ||
94b6baf5 | 6821 | : compute the return types of malloc and free |
85e6fe83 | 6822 | echo " " |
94b6baf5 | 6823 | $cat >malloc.c <<END |
a0d0e21e | 6824 | #$i_malloc I_MALLOC |
94b6baf5 | 6825 | #$i_stdlib I_STDLIB |
a0d0e21e LW |
6826 | #include <stdio.h> |
6827 | #include <sys/types.h> | |
6828 | #ifdef I_MALLOC | |
85e6fe83 | 6829 | #include <malloc.h> |
a0d0e21e | 6830 | #endif |
94b6baf5 AD |
6831 | #ifdef I_STDLIB |
6832 | #include <stdlib.h> | |
6833 | #endif | |
6834 | #ifdef TRY_MALLOC | |
85e6fe83 | 6835 | void *malloc(); |
94b6baf5 AD |
6836 | #endif |
6837 | #ifdef TRY_FREE | |
6838 | void free(); | |
6839 | #endif | |
85e6fe83 | 6840 | END |
94b6baf5 AD |
6841 | case "$malloctype" in |
6842 | '') | |
6843 | if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then | |
85e6fe83 LW |
6844 | malloctype='void *' |
6845 | else | |
6846 | malloctype='char *' | |
6847 | fi | |
85e6fe83 LW |
6848 | ;; |
6849 | esac | |
6850 | echo "Your system wants malloc to return '$malloctype', it would seem." >&4 | |
6851 | ||
94b6baf5 AD |
6852 | case "$freetype" in |
6853 | '') | |
6854 | if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then | |
6855 | freetype='void' | |
6856 | else | |
6857 | freetype='int' | |
6858 | fi | |
6859 | ;; | |
8e07c86e AD |
6860 | esac |
6861 | echo "Your system uses $freetype free(), it would seem." >&4 | |
6862 | $rm -f malloc.[co] | |
6863 | : see if nice exists | |
6864 | set nice d_nice | |
6865 | eval $inlibc | |
2304df62 | 6866 | |
a0d0e21e LW |
6867 | : see if pause exists |
6868 | set pause d_pause | |
6869 | eval $inlibc | |
6870 | ||
6871 | : see if pipe exists | |
6872 | set pipe d_pipe | |
6873 | eval $inlibc | |
6874 | ||
8e07c86e AD |
6875 | : see if poll exists |
6876 | set poll d_poll | |
6877 | eval $inlibc | |
6878 | ||
4aa0a1f7 AD |
6879 | : see if this is a pwd.h system |
6880 | set pwd.h i_pwd | |
6881 | eval $inhdr | |
6882 | ||
6883 | case "$i_pwd" in | |
6884 | $define) | |
6885 | xxx=`./findhdr pwd.h` | |
85e6fe83 | 6886 | $cppstdin $cppflags $cppminus < $xxx >$$.h |
4aa0a1f7 | 6887 | |
2304df62 | 6888 | if $contains 'pw_quota' $$.h >/dev/null 2>&1; then |
4aa0a1f7 | 6889 | val="$define" |
2304df62 | 6890 | else |
4aa0a1f7 | 6891 | val="$undef" |
2304df62 | 6892 | fi |
4aa0a1f7 AD |
6893 | set d_pwquota |
6894 | eval $setvar | |
6895 | ||
2304df62 | 6896 | if $contains 'pw_age' $$.h >/dev/null 2>&1; then |
4aa0a1f7 | 6897 | val="$define" |
2304df62 | 6898 | else |
4aa0a1f7 | 6899 | val="$undef" |
2304df62 | 6900 | fi |
4aa0a1f7 AD |
6901 | set d_pwage |
6902 | eval $setvar | |
6903 | ||
2304df62 | 6904 | if $contains 'pw_change' $$.h >/dev/null 2>&1; then |
4aa0a1f7 | 6905 | val="$define" |
2304df62 | 6906 | else |
4aa0a1f7 | 6907 | val="$undef" |
2304df62 | 6908 | fi |
4aa0a1f7 AD |
6909 | set d_pwchange |
6910 | eval $setvar | |
6911 | ||
2304df62 | 6912 | if $contains 'pw_class' $$.h >/dev/null 2>&1; then |
4aa0a1f7 | 6913 | val="$define" |
2304df62 | 6914 | else |
4aa0a1f7 | 6915 | val="$undef" |
2304df62 | 6916 | fi |
4aa0a1f7 AD |
6917 | set d_pwclass |
6918 | eval $setvar | |
6919 | ||
2304df62 | 6920 | if $contains 'pw_expire' $$.h >/dev/null 2>&1; then |
4aa0a1f7 | 6921 | val="$define" |
2304df62 | 6922 | else |
4aa0a1f7 | 6923 | val="$undef" |
2304df62 | 6924 | fi |
4aa0a1f7 AD |
6925 | set d_pwexpire |
6926 | eval $setvar | |
6927 | ||
2304df62 | 6928 | if $contains 'pw_comment' $$.h >/dev/null 2>&1; then |
4aa0a1f7 | 6929 | val="$define" |
2304df62 | 6930 | else |
4aa0a1f7 | 6931 | val="$undef" |
2304df62 | 6932 | fi |
4aa0a1f7 AD |
6933 | set d_pwcomment |
6934 | eval $setvar | |
6935 | ||
2304df62 | 6936 | $rm -f $$.h |
4aa0a1f7 AD |
6937 | ;; |
6938 | *) | |
6939 | val="$undef"; | |
6940 | set d_pwquota; eval $setvar | |
6941 | set d_pwage; eval $setvar | |
6942 | set d_pwchange; eval $setvar | |
6943 | set d_pwclass; eval $setvar | |
6944 | set d_pwexpire; eval $setvar | |
6945 | set d_pwcomment; eval $setvar | |
6946 | ;; | |
6947 | esac | |
2304df62 | 6948 | |
85e6fe83 | 6949 | : see if readdir and friends exist |
2304df62 AD |
6950 | set readdir d_readdir |
6951 | eval $inlibc | |
85e6fe83 LW |
6952 | set seekdir d_seekdir |
6953 | eval $inlibc | |
6954 | set telldir d_telldir | |
6955 | eval $inlibc | |
6956 | set rewinddir d_rewinddir | |
6957 | eval $inlibc | |
2304df62 | 6958 | |
a0d0e21e LW |
6959 | : see if readlink exists |
6960 | set readlink d_readlink | |
6961 | eval $inlibc | |
6962 | ||
2304df62 AD |
6963 | : see if rename exists |
6964 | set rename d_rename | |
6965 | eval $inlibc | |
6966 | ||
6967 | : see if rmdir exists | |
6968 | set rmdir d_rmdir | |
6969 | eval $inlibc | |
6970 | ||
8ff267be | 6971 | : see if memory.h is available. |
6972 | val='' | |
6973 | set memory.h val | |
6974 | eval $inhdr | |
6975 | ||
6976 | : See if it conflicts with string.h | |
6977 | case "$val" in | |
6978 | $define) | |
6979 | case "$strings" in | |
6980 | '') ;; | |
6981 | *) | |
6982 | $cppstdin $cppflags $cppminus < $strings > mem.h | |
6983 | if $contains 'memcpy' mem.h >/dev/null 2>&1; then | |
6984 | echo " " | |
6985 | echo "We won't be including <memory.h>." | |
6986 | val="$undef" | |
6987 | fi | |
6988 | $rm -f mem.h | |
6989 | ;; | |
6990 | esac | |
6991 | esac | |
6992 | set i_memory | |
6993 | eval $setvar | |
6994 | ||
2304df62 AD |
6995 | : can bcopy handle overlapping blocks? |
6996 | val="$undef" | |
6997 | case "$d_bcopy" in | |
6998 | "$define") | |
6999 | echo " " | |
7000 | echo "Checking to see if your bcopy() can do overlapping copies..." >&4 | |
8ff267be | 7001 | $cat >foo.c <<EOCP |
7002 | #$i_memory I_MEMORY | |
7003 | #$i_stdlib I_STDLIB | |
7004 | #$i_string I_STRING | |
7005 | #$i_unistd I_UNISTD | |
7006 | EOCP | |
7007 | $cat >>foo.c <<'EOCP' | |
7008 | #include <stdio.h> | |
7009 | ||
7010 | #ifdef I_MEMORY | |
7011 | # include <memory.h> | |
7012 | #endif | |
7013 | #ifdef I_STDLIB | |
7014 | # include <stdlib.h> | |
7015 | #endif | |
7016 | #ifdef I_STRING | |
7017 | # include <string.h> | |
7018 | #else | |
7019 | # include <strings.h> | |
7020 | #endif | |
7021 | #ifdef I_UNISTD | |
7022 | # include <unistd.h> /* Needed for NetBSD */ | |
7023 | #endif | |
2304df62 AD |
7024 | main() |
7025 | { | |
85e6fe83 LW |
7026 | char buf[128], abc[128]; |
7027 | char *b; | |
7028 | int len; | |
7029 | int off; | |
7030 | int align; | |
a0d0e21e | 7031 | |
8ff267be | 7032 | /* Copy "abcde..." string to char abc[] so that gcc doesn't |
7033 | try to store the string in read-only memory. */ | |
85e6fe83 | 7034 | bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36); |
2304df62 AD |
7035 | |
7036 | for (align = 7; align >= 0; align--) { | |
7037 | for (len = 36; len; len--) { | |
7038 | b = buf+align; | |
85e6fe83 | 7039 | bcopy(abc, b, len); |
2304df62 AD |
7040 | for (off = 1; off <= len; off++) { |
7041 | bcopy(b, b+off, len); | |
7042 | bcopy(b+off, b, len); | |
85e6fe83 | 7043 | if (bcmp(b, abc, len)) |
2304df62 AD |
7044 | exit(1); |
7045 | } | |
7046 | } | |
7047 | } | |
7048 | exit(0); | |
7049 | } | |
7050 | EOCP | |
8e07c86e | 7051 | if $cc $ccflags $ldflags foo.c -o safebcpy $libs >/dev/null 2>&1; then |
2304df62 AD |
7052 | if ./safebcpy 2>/dev/null; then |
7053 | echo "Yes, it can." | |
7054 | val="$define" | |
7055 | else | |
7056 | echo "It can't, sorry." | |
8ff267be | 7057 | case "$d_memmove" in |
7058 | "$define") echo "But that's Ok since you have memmove()." ;; | |
7059 | esac | |
2304df62 AD |
7060 | fi |
7061 | else | |
7062 | echo "(I can't compile the test program, so we'll assume not...)" | |
8ff267be | 7063 | case "$d_memmove" in |
7064 | "$define") echo "But that's Ok since you have memmove()." ;; | |
7065 | esac | |
2304df62 AD |
7066 | fi |
7067 | ;; | |
7068 | esac | |
7069 | $rm -f foo.* safebcpy core | |
7070 | set d_safebcpy | |
7071 | eval $setvar | |
7072 | ||
7073 | : can memcpy handle overlapping blocks? | |
7074 | val="$undef" | |
7075 | case "$d_memcpy" in | |
7076 | "$define") | |
7077 | echo " " | |
7078 | echo "Checking to see if your memcpy() can do overlapping copies..." >&4 | |
8ff267be | 7079 | $cat >foo.c <<EOCP |
7080 | #$i_memory I_MEMORY | |
7081 | #$i_stdlib I_STDLIB | |
7082 | #$i_string I_STRING | |
7083 | #$i_unistd I_UNISTD | |
7084 | EOCP | |
7085 | $cat >>foo.c <<'EOCP' | |
7086 | #include <stdio.h> | |
7087 | ||
7088 | #ifdef I_MEMORY | |
7089 | # include <memory.h> | |
7090 | #endif | |
7091 | #ifdef I_STDLIB | |
7092 | # include <stdlib.h> | |
7093 | #endif | |
7094 | #ifdef I_STRING | |
7095 | # include <string.h> | |
7096 | #else | |
7097 | # include <strings.h> | |
7098 | #endif | |
7099 | #ifdef I_UNISTD | |
7100 | # include <unistd.h> /* Needed for NetBSD */ | |
7101 | #endif | |
2304df62 AD |
7102 | main() |
7103 | { | |
85e6fe83 LW |
7104 | char buf[128], abc[128]; |
7105 | char *b; | |
7106 | int len; | |
7107 | int off; | |
7108 | int align; | |
7109 | ||
8ff267be | 7110 | /* Copy "abcde..." string to char abc[] so that gcc doesn't |
7111 | try to store the string in read-only memory. */ | |
85e6fe83 | 7112 | memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36); |
2304df62 AD |
7113 | |
7114 | for (align = 7; align >= 0; align--) { | |
7115 | for (len = 36; len; len--) { | |
7116 | b = buf+align; | |
232e078e | 7117 | memcpy(b, abc, len); |
2304df62 | 7118 | for (off = 1; off <= len; off++) { |
2304df62 | 7119 | memcpy(b+off, b, len); |
232e078e | 7120 | memcpy(b, b+off, len); |
85e6fe83 | 7121 | if (memcmp(b, abc, len)) |
2304df62 AD |
7122 | exit(1); |
7123 | } | |
7124 | } | |
7125 | } | |
7126 | exit(0); | |
7127 | } | |
7128 | EOCP | |
8e07c86e | 7129 | if $cc $ccflags $ldflags foo.c -o safemcpy $libs >/dev/null 2>&1; then |
2304df62 AD |
7130 | if ./safemcpy 2>/dev/null; then |
7131 | echo "Yes, it can." | |
7132 | val="$define" | |
7133 | else | |
7134 | echo "It can't, sorry." | |
8ff267be | 7135 | case "$d_memmove" in |
7136 | "$define") echo "But that's Ok since you have memmove()." ;; | |
7137 | esac | |
2304df62 AD |
7138 | fi |
7139 | else | |
7140 | echo "(I can't compile the test program, so we'll assume not...)" | |
8ff267be | 7141 | case "$d_memmove" in |
7142 | "$define") echo "But that's Ok since you have memmove()." ;; | |
7143 | esac | |
2304df62 AD |
7144 | fi |
7145 | ;; | |
7146 | esac | |
7147 | $rm -f foo.* safemcpy core | |
7148 | set d_safemcpy | |
7149 | eval $setvar | |
7150 | ||
36477c24 | 7151 | : can memcmp be trusted to compare relative magnitude? |
7152 | val="$undef" | |
7153 | case "$d_memcmp" in | |
7154 | "$define") | |
7155 | echo " " | |
5f05dabc | 7156 | echo "Checking to see if your memcmp() can compare relative magnitude..." >&4 |
36477c24 | 7157 | $cat >foo.c <<EOCP |
7158 | #$i_memory I_MEMORY | |
7159 | #$i_stdlib I_STDLIB | |
7160 | #$i_string I_STRING | |
7161 | #$i_unistd I_UNISTD | |
7162 | EOCP | |
7163 | $cat >>foo.c <<'EOCP' | |
7164 | #include <stdio.h> | |
7165 | ||
7166 | #ifdef I_MEMORY | |
7167 | # include <memory.h> | |
7168 | #endif | |
7169 | #ifdef I_STDLIB | |
7170 | # include <stdlib.h> | |
7171 | #endif | |
7172 | #ifdef I_STRING | |
7173 | # include <string.h> | |
7174 | #else | |
7175 | # include <strings.h> | |
7176 | #endif | |
7177 | #ifdef I_UNISTD | |
7178 | # include <unistd.h> /* Needed for NetBSD */ | |
7179 | #endif | |
7180 | main() | |
7181 | { | |
7182 | char a = -1; | |
7183 | char b = 0; | |
7184 | if ((a < b) && memcmp(&a, &b, 1) < 0) | |
7185 | exit(1); | |
7186 | exit(0); | |
7187 | } | |
7188 | EOCP | |
7189 | if $cc $ccflags $ldflags foo.c -o sanemcmp $libs >/dev/null 2>&1; then | |
7190 | if ./sanemcmp 2>/dev/null; then | |
7191 | echo "Yes, it can." | |
7192 | val="$define" | |
7193 | else | |
7194 | echo "No, it can't (it uses signed chars)." | |
7195 | fi | |
7196 | else | |
7197 | echo "(I can't compile the test program, so we'll assume not...)" | |
7198 | fi | |
7199 | ;; | |
7200 | esac | |
7201 | $rm -f foo.* sanemcmp core | |
7202 | set d_sanemcmp | |
7203 | eval $setvar | |
7204 | ||
2304df62 AD |
7205 | : see if select exists |
7206 | set select d_select | |
7207 | eval $inlibc | |
7208 | ||
7209 | : see if semctl exists | |
7210 | set semctl d_semctl | |
7211 | eval $inlibc | |
7212 | ||
7213 | : see if semget exists | |
7214 | set semget d_semget | |
7215 | eval $inlibc | |
7216 | ||
7217 | : see if semop exists | |
7218 | set semop d_semop | |
7219 | eval $inlibc | |
7220 | ||
7221 | : see how much of the 'sem*(2)' library is present. | |
7222 | h_sem=true | |
7223 | echo " " | |
7224 | case "$d_semctl$d_semget$d_semop" in | |
7225 | *"$undef"*) h_sem=false;; | |
7226 | esac | |
7227 | : we could also check for sys/ipc.h ... | |
7228 | if $h_sem && $test `./findhdr sys/sem.h`; then | |
7229 | echo "You have the full sem*(2) library." >&4 | |
7230 | val="$define" | |
7231 | else | |
7232 | echo "You don't have the full sem*(2) library." >&4 | |
7233 | val="$undef" | |
7234 | fi | |
7235 | set d_sem | |
7236 | eval $setvar | |
7237 | ||
7238 | : see if setegid exists | |
7239 | set setegid d_setegid | |
7240 | eval $inlibc | |
7241 | ||
7242 | : see if seteuid exists | |
7243 | set seteuid d_seteuid | |
7244 | eval $inlibc | |
7245 | ||
a0d0e21e LW |
7246 | : see if setlinebuf exists |
7247 | set setlinebuf d_setlinebuf | |
7248 | eval $inlibc | |
7249 | ||
2304df62 AD |
7250 | : see if setlocale exists |
7251 | set setlocale d_setlocale | |
7252 | eval $inlibc | |
a0d0e21e | 7253 | |
2304df62 AD |
7254 | : see if setpgid exists |
7255 | set setpgid d_setpgid | |
7256 | eval $inlibc | |
7257 | ||
2304df62 AD |
7258 | : see if setpgrp2 exists |
7259 | set setpgrp2 d_setpgrp2 | |
7260 | eval $inlibc | |
7261 | ||
7262 | : see if setpriority exists | |
7263 | set setpriority d_setprior | |
7264 | eval $inlibc | |
7265 | ||
7266 | : see if setregid exists | |
7267 | set setregid d_setregid | |
7268 | eval $inlibc | |
7269 | set setresgid d_setresgid | |
7270 | eval $inlibc | |
7271 | ||
7272 | : see if setreuid exists | |
7273 | set setreuid d_setreuid | |
7274 | eval $inlibc | |
7275 | set setresuid d_setresuid | |
7276 | eval $inlibc | |
7277 | ||
7278 | : see if setrgid exists | |
7279 | set setrgid d_setrgid | |
7280 | eval $inlibc | |
7281 | ||
7282 | : see if setruid exists | |
7283 | set setruid d_setruid | |
7284 | eval $inlibc | |
7285 | ||
7286 | : see if setsid exists | |
7287 | set setsid d_setsid | |
7288 | eval $inlibc | |
7289 | ||
760ac839 LW |
7290 | : see if sfio.h is available |
7291 | set sfio.h i_sfio | |
7292 | eval $inhdr | |
7293 | ||
7294 | ||
8ff267be | 7295 | : see if sfio library is available |
760ac839 LW |
7296 | case "$i_sfio" in |
7297 | $define) | |
7298 | val='' | |
7299 | set sfreserve val | |
7300 | eval $inlibc | |
7301 | ;; | |
7302 | *) | |
7303 | val="$undef" | |
7304 | ;; | |
7305 | esac | |
8ff267be | 7306 | : Ok, but do we want to use it. |
760ac839 LW |
7307 | case "$val" in |
7308 | $define) | |
7309 | case "$usesfio" in | |
8ff267be | 7310 | true|$define|[yY]*) dflt='y';; |
760ac839 LW |
7311 | *) dflt='n';; |
7312 | esac | |
8ff267be | 7313 | echo "$package can use the sfio library, but it is experimental." |
760ac839 LW |
7314 | rp="You seem to have sfio available, do you want to try using it?" |
7315 | . ./myread | |
7316 | case "$ans" in | |
8ff267be | 7317 | y|Y) ;; |
7318 | *) echo "Ok, avoiding sfio this time. I'll use stdio instead." | |
760ac839 LW |
7319 | val="$undef" |
7320 | ;; | |
7321 | esac | |
7322 | ;; | |
8ff267be | 7323 | *) case "$usesfio" in |
7324 | true|$define|[yY]*) | |
7325 | echo "Sorry, cannot find sfio on this machine" >&4 | |
7326 | echo "Ignoring your setting of usesfio=$usesfio" >&4 | |
760ac839 LW |
7327 | ;; |
7328 | esac | |
7329 | ;; | |
7330 | esac | |
8ff267be | 7331 | set d_sfio |
7332 | eval $setvar | |
760ac839 LW |
7333 | case "$d_sfio" in |
7334 | $define) usesfio='true';; | |
7335 | *) usesfio='false';; | |
7336 | esac | |
7337 | ||
2304df62 AD |
7338 | : see if shmctl exists |
7339 | set shmctl d_shmctl | |
7340 | eval $inlibc | |
7341 | ||
7342 | : see if shmget exists | |
7343 | set shmget d_shmget | |
7344 | eval $inlibc | |
7345 | ||
a0d0e21e LW |
7346 | : see if shmat exists |
7347 | set shmat d_shmat | |
7348 | eval $inlibc | |
7349 | : see what shmat returns | |
7350 | case "$d_shmat" in | |
7351 | "$define") | |
7352 | $cat >shmat.c <<'END' | |
7353 | #include <sys/shm.h> | |
7354 | void *shmat(); | |
7355 | END | |
7356 | if $cc $ccflags -c shmat.c >/dev/null 2>&1; then | |
7357 | shmattype='void *' | |
7358 | else | |
7359 | shmattype='char *' | |
7360 | fi | |
7361 | echo "and it returns ($shmattype)." >&4 | |
7362 | : see if a prototype for shmat is available | |
e50aee73 AD |
7363 | xxx=`./findhdr sys/shm.h` |
7364 | $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null | |
a0d0e21e LW |
7365 | if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then |
7366 | val="$define" | |
7367 | else | |
7368 | val="$undef" | |
7369 | fi | |
7370 | $rm -f shmat.[co] | |
7371 | ;; | |
7372 | *) | |
7373 | val="$undef" | |
7374 | ;; | |
7375 | esac | |
7376 | set d_shmatprototype | |
7377 | eval $setvar | |
7378 | ||
7379 | : see if shmdt exists | |
7380 | set shmdt d_shmdt | |
7381 | eval $inlibc | |
7382 | ||
7383 | : see how much of the 'shm*(2)' library is present. | |
7384 | h_shm=true | |
7385 | echo " " | |
7386 | case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in | |
7387 | *"$undef"*) h_shm=false;; | |
7388 | esac | |
7389 | : we could also check for sys/ipc.h ... | |
7390 | if $h_shm && $test `./findhdr sys/shm.h`; then | |
7391 | echo "You have the full shm*(2) library." >&4 | |
7392 | val="$define" | |
7393 | else | |
7394 | echo "You don't have the full shm*(2) library." >&4 | |
7395 | val="$undef" | |
7396 | fi | |
7397 | set d_shm | |
7398 | eval $setvar | |
7399 | ||
2c7991dc | 7400 | echo " " |
8ff267be | 7401 | : see if we have sigaction |
7402 | if set sigaction val -f d_sigaction; eval $csym; $val; then | |
7403 | echo 'sigaction() found.' >&4 | |
7404 | val="$define" | |
2c7991dc | 7405 | else |
8ff267be | 7406 | echo 'sigaction NOT found.' >&4 |
7407 | val="$undef" | |
2c7991dc | 7408 | fi |
7409 | ||
8ff267be | 7410 | $cat > set.c <<'EOP' |
7411 | /* Solaris 2.5_x86 with SunWorks Pro C 3.0.1 doesn't have a complete | |
7412 | sigaction structure if compiled with cc -Xc. This compile test | |
7413 | will fail then. <doughera@lafcol.lafayette.edu> | |
7414 | */ | |
7415 | #include <stdio.h> | |
7416 | #include <sys/types.h> | |
7417 | #include <signal.h> | |
7418 | main() | |
7419 | { | |
7420 | struct sigaction act, oact; | |
7421 | } | |
7422 | EOP | |
7423 | ||
7424 | if $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1; then | |
7425 | : | |
7426 | else | |
7427 | echo "But you don't seem to have a useable struct sigaction." >&4 | |
7428 | val="$undef" | |
7429 | fi | |
7430 | set d_sigaction; eval $setvar | |
7431 | $rm -f set set.o set.c | |
2c7991dc | 7432 | |
a5f75d66 AD |
7433 | : see if sigsetjmp exists |
7434 | echo " " | |
7435 | case "$d_sigsetjmp" in | |
7436 | '') | |
760ac839 | 7437 | $cat >set.c <<'EOP' |
a5f75d66 AD |
7438 | #include <setjmp.h> |
7439 | sigjmp_buf env; | |
7440 | int set = 1; | |
7441 | main() | |
7442 | { | |
7443 | if (sigsetjmp(env,1)) | |
7444 | exit(set); | |
7445 | set = 0; | |
7446 | siglongjmp(env, 1); | |
7447 | exit(1); | |
7448 | } | |
7449 | EOP | |
760ac839 | 7450 | if $cc $ccflags $ldflags -o set set.c $libs > /dev/null 2>&1 ; then |
a5f75d66 AD |
7451 | if ./set >/dev/null 2>&1; then |
7452 | echo "POSIX sigsetjmp found." >&4 | |
7453 | val="$define" | |
7454 | else | |
760ac839 | 7455 | $cat >&4 <<EOM |
a5f75d66 | 7456 | Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!! |
760ac839 | 7457 | I'll ignore them. |
a5f75d66 AD |
7458 | EOM |
7459 | val="$undef" | |
7460 | fi | |
7461 | else | |
760ac839 | 7462 | echo "sigsetjmp not found." >&4 |
a5f75d66 AD |
7463 | val="$undef" |
7464 | fi | |
7465 | ;; | |
7466 | *) val="$d_sigsetjmp" | |
7467 | case "$d_sigsetjmp" in | |
7468 | $define) echo "POSIX sigsetjmp found." >&4;; | |
760ac839 | 7469 | $undef) echo "sigsetjmp not found." >&4;; |
a5f75d66 AD |
7470 | esac |
7471 | ;; | |
7472 | esac | |
7473 | set d_sigsetjmp | |
7474 | eval $setvar | |
7475 | $rm -f set.c set | |
7476 | ||
a0d0e21e LW |
7477 | socketlib='' |
7478 | sockethdr='' | |
7479 | : see whether socket exists | |
7480 | echo " " | |
7481 | $echo $n "Hmm... $c" >&4 | |
7482 | if set socket val -f d_socket; eval $csym; $val; then | |
7483 | echo "Looks like you have Berkeley networking support." >&4 | |
7484 | d_socket="$define" | |
7485 | if set setsockopt val -f; eval $csym; $val; then | |
7486 | d_oldsock="$undef" | |
7487 | else | |
7488 | echo "...but it uses the old 4.1c interface, rather than 4.2" >&4 | |
7489 | d_oldsock="$define" | |
7490 | fi | |
7491 | else | |
7492 | if $contains socklib libc.list >/dev/null 2>&1; then | |
7493 | echo "Looks like you have Berkeley networking support." >&4 | |
7494 | d_socket="$define" | |
7495 | : we will have to assume that it supports the 4.2 BSD interface | |
7496 | d_oldsock="$undef" | |
7497 | else | |
5f05dabc | 7498 | echo "You don't have Berkeley networking in libc$lib_ext..." >&4 |
7499 | if test -f /usr/lib/libnet$lib_ext; then | |
7500 | ( (nm $nm_opt /usr/lib/libnet$lib_ext | eval $nm_extract) || \ | |
7501 | ar t /usr/lib/libnet$lib_ext) 2>/dev/null >> libc.list | |
a0d0e21e LW |
7502 | if $contains socket libc.list >/dev/null 2>&1; then |
7503 | echo "...but the Wollongong group seems to have hacked it in." >&4 | |
7504 | socketlib="-lnet" | |
7505 | sockethdr="-I/usr/netinclude" | |
7506 | d_socket="$define" | |
7507 | if $contains setsockopt libc.list >/dev/null 2>&1; then | |
7508 | d_oldsock="$undef" | |
7509 | else | |
7510 | echo "...using the old 4.1c interface, rather than 4.2" >&4 | |
7511 | d_oldsock="$define" | |
7512 | fi | |
7513 | else | |
5f05dabc | 7514 | echo "or even in libnet$lib_ext, which is peculiar." >&4 |
a0d0e21e LW |
7515 | d_socket="$undef" |
7516 | d_oldsock="$undef" | |
7517 | fi | |
7518 | else | |
7519 | echo "or anywhere else I see." >&4 | |
7520 | d_socket="$undef" | |
7521 | d_oldsock="$undef" | |
7522 | fi | |
7523 | fi | |
7524 | fi | |
7525 | ||
7526 | : see if socketpair exists | |
7527 | set socketpair d_sockpair | |
2304df62 AD |
7528 | eval $inlibc |
7529 | ||
2304df62 AD |
7530 | : see if stat knows about block sizes |
7531 | echo " " | |
7532 | xxx=`./findhdr sys/stat.h` | |
7533 | if $contains 'st_blocks;' "$xxx" >/dev/null 2>&1 ; then | |
7534 | if $contains 'st_blksize;' "$xxx" >/dev/null 2>&1 ; then | |
7535 | echo "Your stat() knows about block sizes." >&4 | |
7536 | val="$define" | |
7537 | else | |
7538 | echo "Your stat() doesn't know about block sizes." >&4 | |
7539 | val="$undef" | |
7540 | fi | |
7541 | else | |
7542 | echo "Your stat() doesn't know about block sizes." >&4 | |
7543 | val="$undef" | |
7544 | fi | |
7545 | set d_statblks | |
7546 | eval $setvar | |
7547 | ||
16d20bd9 AD |
7548 | : see if _ptr and _cnt from stdio act std |
7549 | echo " " | |
7550 | if $contains '_IO_fpos_t' `./findhdr stdio.h` >/dev/null 2>&1 ; then | |
7551 | echo "(Looks like you have stdio.h from Linux.)" | |
7552 | case "$stdio_ptr" in | |
c2960299 AD |
7553 | '') stdio_ptr='((fp)->_IO_read_ptr)' |
7554 | ptr_lval=$define | |
7555 | ;; | |
8e07c86e | 7556 | *) ptr_lval=$d_stdio_ptr_lval;; |
16d20bd9 AD |
7557 | esac |
7558 | case "$stdio_cnt" in | |
c2960299 AD |
7559 | '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)' |
7560 | cnt_lval=$undef | |
7561 | ;; | |
8e07c86e | 7562 | *) cnt_lval=$d_stdio_cnt_lval;; |
16d20bd9 AD |
7563 | esac |
7564 | case "$stdio_base" in | |
7565 | '') stdio_base='((fp)->_IO_read_base)';; | |
7566 | esac | |
7567 | case "$stdio_bufsiz" in | |
c2960299 | 7568 | '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';; |
16d20bd9 AD |
7569 | esac |
7570 | else | |
7571 | case "$stdio_ptr" in | |
c2960299 AD |
7572 | '') stdio_ptr='((fp)->_ptr)' |
7573 | ptr_lval=$define | |
7574 | ;; | |
8e07c86e | 7575 | *) ptr_lval=$d_stdio_ptr_lval;; |
16d20bd9 AD |
7576 | esac |
7577 | case "$stdio_cnt" in | |
c2960299 AD |
7578 | '') stdio_cnt='((fp)->_cnt)' |
7579 | cnt_lval=$define | |
7580 | ;; | |
8e07c86e | 7581 | *) cnt_lval=$d_stdio_cnt_lval;; |
16d20bd9 AD |
7582 | esac |
7583 | case "$stdio_base" in | |
7584 | '') stdio_base='((fp)->_base)';; | |
7585 | esac | |
7586 | case "$stdio_bufsiz" in | |
7587 | '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';; | |
7588 | esac | |
7589 | fi | |
7590 | : test whether _ptr and _cnt really work | |
7591 | echo "Checking how std your stdio is..." >&4 | |
7592 | $cat >try.c <<EOP | |
7593 | #include <stdio.h> | |
7594 | #define FILE_ptr(fp) $stdio_ptr | |
7595 | #define FILE_cnt(fp) $stdio_cnt | |
8ff267be | 7596 | main() { |
16d20bd9 AD |
7597 | FILE *fp = fopen("try.c", "r"); |
7598 | char c = getc(fp); | |
7599 | if ( | |
7600 | 18 <= FILE_cnt(fp) && | |
7601 | strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0 | |
7602 | ) | |
7603 | exit(0); | |
7604 | exit(1); | |
7605 | } | |
7606 | EOP | |
7607 | val="$undef" | |
7608 | if $cc $ccflags $ldflags -o try try.c $libs >/dev/null 2>&1; then | |
7609 | if ./try; then | |
7610 | echo "Your stdio acts pretty std." | |
7611 | val="$define" | |
7612 | else | |
7613 | echo "Your stdio isn't very std." | |
7614 | fi | |
7615 | else | |
7616 | echo "Your stdio doesn't appear very std." | |
7617 | fi | |
7618 | $rm -f try.c try | |
7619 | set d_stdstdio | |
7620 | eval $setvar | |
7621 | ||
8e07c86e | 7622 | : Can _ptr be used as an lvalue? |
e50aee73 AD |
7623 | case "$d_stdstdio$ptr_lval" in |
7624 | $define$define) val=$define ;; | |
c2960299 AD |
7625 | *) val=$undef ;; |
7626 | esac | |
7627 | set d_stdio_ptr_lval | |
7628 | eval $setvar | |
7629 | ||
8e07c86e | 7630 | : Can _cnt be used as an lvalue? |
e50aee73 AD |
7631 | case "$d_stdstdio$cnt_lval" in |
7632 | $define$define) val=$define ;; | |
c2960299 AD |
7633 | *) val=$undef ;; |
7634 | esac | |
7635 | set d_stdio_cnt_lval | |
7636 | eval $setvar | |
7637 | ||
8ff267be | 7638 | : How to access the stdio _filbuf or __filbuf function. |
7639 | : If this fails, check how the getc macro in stdio.h works. | |
7640 | case "${d_stdio_ptr_lval}${d_stdio_cnt_lval}" in | |
7641 | ${define}${define}) | |
7642 | : Try $hint value, if any, then _filbuf, __filbuf, _fill, then punt. | |
7643 | : _fill is for os/2. | |
7644 | xxx='notok' | |
7645 | for filbuf in $stdio_filbuf '_filbuf(fp)' '__filbuf(fp) ' '_fill(fp)' ; do | |
7646 | $cat >try.c <<EOP | |
7647 | #include <stdio.h> | |
7648 | #define FILE_ptr(fp) $stdio_ptr | |
7649 | #define FILE_cnt(fp) $stdio_cnt | |
7650 | #define FILE_filbuf(fp) $filbuf | |
7651 | main() { | |
7652 | FILE *fp = fopen("try.c", "r"); | |
7653 | int c; | |
7654 | c = getc(fp); | |
7655 | c = FILE_filbuf(fp); /* Just looking for linker errors.*/ | |
7656 | exit(0); | |
7657 | } | |
7658 | EOP | |
7659 | if $cc $ccflags $ldflags -o try try.c $libs >/dev/null 2>&1 && ./try; then | |
7660 | echo "Your stdio appears to use $filbuf" | |
7661 | stdio_filbuf="$filbuf" | |
7662 | xxx='ok' | |
7663 | break | |
7664 | else | |
7665 | echo "Hmm. $filbuf doesn't seem to work." | |
7666 | fi | |
7667 | $rm -f try.c try | |
7668 | done | |
7669 | case "$xxx" in | |
7670 | notok) echo "I can't figure out how to access _filbuf" | |
7671 | echo "I'll just have to work around it." | |
7672 | d_stdio_ptr_lval="$undef" | |
7673 | d_stdio_cnt_lval="$undef" | |
7674 | ;; | |
7675 | esac | |
7676 | ;; | |
7677 | esac | |
7678 | ||
7679 | ||
16d20bd9 AD |
7680 | : see if _base is also standard |
7681 | val="$undef" | |
7682 | case "$d_stdstdio" in | |
7683 | $define) | |
7684 | $cat >try.c <<EOP | |
7685 | #include <stdio.h> | |
7686 | #define FILE_base(fp) $stdio_base | |
7687 | #define FILE_bufsiz(fp) $stdio_bufsiz | |
8ff267be | 7688 | main() { |
16d20bd9 AD |
7689 | FILE *fp = fopen("try.c", "r"); |
7690 | char c = getc(fp); | |
7691 | if ( | |
7692 | 19 <= FILE_bufsiz(fp) && | |
7693 | strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0 | |
7694 | ) | |
7695 | exit(0); | |
7696 | exit(1); | |
7697 | } | |
7698 | EOP | |
7699 | if $cc $ccflags $ldflags -o try try.c $libs > /dev/null 2>&1; then | |
7700 | if ./try; then | |
8ff267be | 7701 | echo "And its _base field acts std." |
16d20bd9 AD |
7702 | val="$define" |
7703 | else | |
7704 | echo "But its _base field isn't std." | |
7705 | fi | |
7706 | else | |
7707 | echo "However, it seems to be lacking the _base field." | |
7708 | fi | |
7709 | $rm -f try.c try | |
7710 | ;; | |
7711 | esac | |
7712 | set d_stdiobase | |
7713 | eval $setvar | |
7714 | ||
a0d0e21e LW |
7715 | : see if strcoll exists |
7716 | set strcoll d_strcoll | |
7717 | eval $inlibc | |
2304df62 AD |
7718 | |
7719 | : check for structure copying | |
7720 | echo " " | |
7721 | echo "Checking to see if your C compiler can copy structs..." >&4 | |
7722 | $cat >try.c <<'EOCP' | |
7723 | main() | |
7724 | { | |
7725 | struct blurfl { | |
7726 | int dyick; | |
7727 | } foo, bar; | |
7728 | ||
7729 | foo = bar; | |
7730 | } | |
7731 | EOCP | |
7732 | if $cc -c try.c >/dev/null 2>&1 ; then | |
7733 | val="$define" | |
7734 | echo "Yup, it can." | |
7735 | else | |
7736 | val="$undef" | |
7737 | echo "Nope, it can't." | |
7738 | fi | |
7739 | set d_strctcpy | |
7740 | eval $setvar | |
7741 | $rm -f try.* | |
7742 | ||
7743 | : see if strerror and/or sys_errlist[] exist | |
7744 | echo " " | |
7745 | if set strerror val -f d_strerror; eval $csym; $val; then | |
7746 | echo 'strerror() found.' >&4 | |
7747 | d_strerror="$define" | |
a0d0e21e | 7748 | d_strerrm='strerror(e)' |
2304df62 AD |
7749 | if set sys_errlist val -a d_syserrlst; eval $csym; $val; then |
7750 | echo "(You also have sys_errlist[], so we could roll our own strerror.)" | |
7751 | d_syserrlst="$define" | |
7752 | else | |
7753 | echo "(Since you don't have sys_errlist[], sterror() is welcome.)" | |
7754 | d_syserrlst="$undef" | |
7755 | fi | |
7756 | elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \ | |
7757 | $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then | |
7758 | echo 'strerror() found in string header.' >&4 | |
7759 | d_strerror="$define" | |
a0d0e21e | 7760 | d_strerrm='strerror(e)' |
2304df62 AD |
7761 | if set sys_errlist val -a d_syserrlst; eval $csym; $val; then |
7762 | echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)" | |
7763 | d_syserrlst="$define" | |
7764 | else | |
7765 | echo "(You don't appear to have any sys_errlist[], how can this be?)" | |
7766 | d_syserrlst="$undef" | |
7767 | fi | |
7768 | elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then | |
7769 | echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4 | |
7770 | d_strerror="$undef" | |
7771 | d_syserrlst="$define" | |
a0d0e21e | 7772 | d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])' |
2304df62 AD |
7773 | else |
7774 | echo 'strerror() and sys_errlist[] NOT found.' >&4 | |
7775 | d_strerror="$undef" | |
7776 | d_syserrlst="$undef" | |
a0d0e21e | 7777 | d_strerrm='"unknown"' |
2304df62 AD |
7778 | fi |
7779 | ||
a89d8a78 DH |
7780 | : see if strtod exists |
7781 | set strtod d_strtod | |
7782 | eval $inlibc | |
7783 | ||
7784 | : see if strtol exists | |
7785 | set strtol d_strtol | |
7786 | eval $inlibc | |
7787 | ||
7788 | : see if strtoul exists | |
7789 | set strtoul d_strtoul | |
7790 | eval $inlibc | |
7791 | ||
a0d0e21e LW |
7792 | : see if strxfrm exists |
7793 | set strxfrm d_strxfrm | |
7794 | eval $inlibc | |
7795 | ||
2304df62 AD |
7796 | : see if symlink exists |
7797 | set symlink d_symlink | |
7798 | eval $inlibc | |
7799 | ||
7800 | : see if syscall exists | |
7801 | set syscall d_syscall | |
7802 | eval $inlibc | |
7803 | ||
a0d0e21e LW |
7804 | : see if sysconf exists |
7805 | set sysconf d_sysconf | |
7806 | eval $inlibc | |
7807 | ||
2304df62 AD |
7808 | : see if system exists |
7809 | set system d_system | |
7810 | eval $inlibc | |
7811 | ||
a0d0e21e LW |
7812 | : see if tcgetpgrp exists |
7813 | set tcgetpgrp d_tcgetpgrp | |
7814 | eval $inlibc | |
7815 | ||
2c7991dc | 7816 | : see if tcsetpgrp exists |
7817 | set tcsetpgrp d_tcsetpgrp | |
7818 | eval $inlibc | |
4633a7c4 | 7819 | |
2c7991dc | 7820 | : define an is-a-typedef? function |
7821 | typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@; | |
7822 | case "$inclist" in | |
7823 | "") inclist="sys/types.h";; | |
7824 | esac; | |
7825 | eval "varval=\$$var"; | |
7826 | case "$varval" in | |
7827 | "") | |
7828 | $rm -f temp.c; | |
7829 | for inc in $inclist; do | |
7830 | echo "#include <$inc>" >>temp.c; | |
7831 | done; | |
7832 | $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null; | |
7833 | if $contains $type temp.E >/dev/null 2>&1; then | |
7834 | eval "$var=\$type"; | |
7835 | else | |
7836 | eval "$var=\$def"; | |
7837 | fi; | |
7838 | $rm -f temp.?;; | |
7839 | *) eval "$var=\$varval";; | |
7840 | esac' | |
4633a7c4 | 7841 | |
2c7991dc | 7842 | : see if this is a sys/times.h system |
7843 | set sys/times.h i_systimes | |
7844 | eval $inhdr | |
4633a7c4 | 7845 | |
2c7991dc | 7846 | : see if times exists |
4633a7c4 | 7847 | echo " " |
2c7991dc | 7848 | if set times val -f d_times; eval $csym; $val; then |
7849 | echo 'times() found.' >&4 | |
7850 | d_times="$define" | |
7851 | inc='' | |
7852 | case "$i_systimes" in | |
7853 | "$define") inc='sys/times.h';; | |
7854 | esac | |
7855 | set clock_t clocktype long stdio.h sys/types.h $inc | |
7856 | eval $typedef | |
7857 | dflt="$clocktype" | |
7858 | echo " " | |
7859 | rp="What type is returned by times() on this system?" | |
7860 | . ./myread | |
7861 | clocktype="$ans" | |
7862 | else | |
7863 | echo 'times() NOT found, hope that will do.' >&4 | |
7864 | d_times="$undef" | |
7865 | clocktype='int' | |
7866 | fi | |
2304df62 | 7867 | |
2c7991dc | 7868 | : see if truncate exists |
7869 | set truncate d_truncate | |
7870 | eval $inlibc | |
2304df62 | 7871 | |
2c7991dc | 7872 | : see if tzname[] exists |
7873 | echo " " | |
7874 | if set tzname val -a d_tzname; eval $csym; $val; then | |
7875 | val="$define" | |
7876 | echo 'tzname[] found.' >&4 | |
7877 | else | |
7878 | val="$undef" | |
7879 | echo 'tzname[] NOT found.' >&4 | |
7880 | fi | |
7881 | set d_tzname | |
7882 | eval $setvar | |
7883 | ||
7884 | : see if umask exists | |
7885 | set umask d_umask | |
7886 | eval $inlibc | |
85e6fe83 | 7887 | |
4633a7c4 | 7888 | : see how we will look up host name |
a0d0e21e | 7889 | echo " " |
4633a7c4 LW |
7890 | if false; then |
7891 | : dummy stub to allow use of elif | |
7892 | elif set uname val -f d_uname; eval $csym; $val; then | |
7893 | if ./xenix; then | |
7894 | $cat <<'EOM' | |
7895 | uname() was found, but you're running xenix, and older versions of xenix | |
7896 | have a broken uname(). If you don't really know whether your xenix is old | |
7897 | enough to have a broken system call, use the default answer. | |
7898 | ||
85e6fe83 | 7899 | EOM |
4633a7c4 LW |
7900 | dflt=y |
7901 | case "$d_uname" in | |
7902 | "$define") dflt=n;; | |
7903 | esac | |
7904 | rp='Is your uname() broken?' | |
7905 | . ./myread | |
7906 | case "$ans" in | |
7907 | n*) d_uname="$define"; call=uname;; | |
7908 | esac | |
7909 | else | |
7910 | echo 'uname() found.' >&4 | |
7911 | d_uname="$define" | |
7912 | call=uname | |
7913 | fi | |
a0d0e21e | 7914 | fi |
4633a7c4 LW |
7915 | case "$d_gethname" in |
7916 | '') d_gethname="$undef";; | |
7917 | esac | |
7918 | case "$d_uname" in | |
7919 | '') d_uname="$undef";; | |
7920 | esac | |
7921 | case "$d_phostname" in | |
7922 | '') d_phostname="$undef";; | |
7923 | esac | |
ecfc5424 | 7924 | |
4633a7c4 LW |
7925 | : backward compatibility for d_hvfork |
7926 | if test X$d_hvfork != X; then | |
7927 | d_vfork="$d_hvfork" | |
7928 | d_hvfork='' | |
7929 | fi | |
7930 | : see if there is a vfork | |
7931 | val='' | |
7932 | set vfork val | |
7933 | eval $inlibc | |
ecfc5424 | 7934 | |
4633a7c4 LW |
7935 | : Ok, but do we want to use it. vfork is reportedly unreliable in |
7936 | : perl on Solaris 2.x, and probably elsewhere. | |
7937 | case "$val" in | |
7938 | $define) | |
16d20bd9 | 7939 | echo " " |
4633a7c4 LW |
7940 | case "$usevfork" in |
7941 | false) dflt='n';; | |
7942 | *) dflt='y';; | |
7943 | esac | |
7944 | rp="Some systems have problems with vfork(). Do you want to use it?" | |
7945 | . ./myread | |
7946 | case "$ans" in | |
7947 | y|Y) ;; | |
7948 | *) | |
7949 | echo "Ok, we won't use vfork()." | |
7950 | val="$undef" | |
7951 | ;; | |
7952 | esac | |
ecfc5424 AD |
7953 | ;; |
7954 | esac | |
4633a7c4 LW |
7955 | set d_vfork |
7956 | eval $setvar | |
7957 | case "$d_vfork" in | |
7958 | $define) usevfork='true';; | |
7959 | *) usevfork='false';; | |
7960 | esac | |
ecfc5424 | 7961 | |
4633a7c4 LW |
7962 | : see if this is an sysdir system |
7963 | set sys/dir.h i_sysdir | |
7964 | eval $inhdr | |
7965 | ||
7966 | : see if this is an sysndir system | |
7967 | set sys/ndir.h i_sysndir | |
7968 | eval $inhdr | |
7969 | ||
7970 | : see if closedir exists | |
7971 | set closedir d_closedir | |
7972 | eval $inlibc | |
7973 | ||
7974 | case "$d_closedir" in | |
7975 | "$define") | |
16d20bd9 | 7976 | echo " " |
4633a7c4 LW |
7977 | echo "Checking whether closedir() returns a status..." >&4 |
7978 | cat > closedir.c <<EOM | |
7979 | #$i_dirent I_DIRENT /**/ | |
7980 | #$i_sysdir I_SYS_DIR /**/ | |
7981 | #$i_sysndir I_SYS_NDIR /**/ | |
7982 | ||
7983 | #if defined(I_DIRENT) | |
7984 | #include <dirent.h> | |
7985 | #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */ | |
7986 | #include <sys/dir.h> | |
4aa0a1f7 | 7987 | #endif |
4633a7c4 LW |
7988 | #else |
7989 | #ifdef I_SYS_NDIR | |
7990 | #include <sys/ndir.h> | |
7991 | #else | |
7992 | #ifdef I_SYS_DIR | |
7993 | #ifdef hp9000s500 | |
7994 | #include <ndir.h> /* may be wrong in the future */ | |
7995 | #else | |
7996 | #include <sys/dir.h> | |
7997 | #endif | |
7998 | #endif | |
7999 | #endif | |
8000 | #endif | |
8001 | int main() { return closedir(opendir(".")); } | |
8002 | EOM | |
8003 | if $cc $ccflags $ldflags -o closedir closedir.c $libs > /dev/null 2>&1; then | |
8004 | if ./closedir > /dev/null 2>&1 ; then | |
8005 | echo "Yes, it does." | |
8006 | val="$undef" | |
ecfc5424 | 8007 | else |
4633a7c4 LW |
8008 | echo "No, it doesn't." |
8009 | val="$define" | |
ecfc5424 AD |
8010 | fi |
8011 | else | |
4633a7c4 LW |
8012 | echo "(I can't seem to compile the test program--assuming it doesn't)" |
8013 | val="$define" | |
ecfc5424 | 8014 | fi |
ecfc5424 | 8015 | ;; |
4633a7c4 LW |
8016 | *) |
8017 | val="$undef"; | |
ecfc5424 AD |
8018 | ;; |
8019 | esac | |
4633a7c4 LW |
8020 | set d_void_closedir |
8021 | eval $setvar | |
8022 | $rm -f closedir* | |
8023 | : check for volatile keyword | |
ecfc5424 | 8024 | echo " " |
4633a7c4 LW |
8025 | echo 'Checking to see if your C compiler knows about "volatile"...' >&4 |
8026 | $cat >try.c <<'EOCP' | |
8027 | main() | |
8028 | { | |
8029 | typedef struct _goo_struct goo_struct; | |
8030 | goo_struct * volatile goo = ((goo_struct *)0); | |
8031 | struct _goo_struct { | |
8032 | long long_int; | |
8033 | int reg_int; | |
8034 | char char_var; | |
8035 | }; | |
8036 | typedef unsigned short foo_t; | |
8037 | char *volatile foo; | |
8038 | volatile int bar; | |
8039 | volatile foo_t blech; | |
8040 | foo = foo; | |
a0d0e21e LW |
8041 | } |
8042 | EOCP | |
4633a7c4 LW |
8043 | if $cc -c $ccflags try.c >/dev/null 2>&1 ; then |
8044 | val="$define" | |
8045 | echo "Yup, it does." | |
8046 | else | |
8047 | val="$undef" | |
8048 | echo "Nope, it doesn't." | |
8049 | fi | |
8050 | set d_volatile | |
8051 | eval $setvar | |
8052 | $rm -f try.* | |
a0d0e21e | 8053 | |
4633a7c4 LW |
8054 | : see if there is a wait4 |
8055 | set wait4 d_wait4 | |
8e07c86e AD |
8056 | eval $inlibc |
8057 | ||
4633a7c4 LW |
8058 | : see if waitpid exists |
8059 | set waitpid d_waitpid | |
8060 | eval $inlibc | |
8061 | ||
8062 | : see if wcstombs exists | |
8063 | set wcstombs d_wcstombs | |
8064 | eval $inlibc | |
8065 | ||
8066 | : see if wctomb exists | |
8067 | set wctomb d_wctomb | |
8068 | eval $inlibc | |
8069 | ||
8070 | : preserve RCS keywords in files with variable substitution, grrr | |
8071 | Date='$Date' | |
8072 | Id='$Id' | |
8073 | Log='$Log' | |
8074 | RCSfile='$RCSfile' | |
8075 | Revision='$Revision' | |
8076 | ||
8077 | : check for alignment requirements | |
8078 | echo " " | |
8079 | case "$alignbytes" in | |
8080 | '') echo "Checking alignment constraints..." >&4 | |
8081 | $cat >try.c <<'EOCP' | |
8082 | struct foobar { | |
8083 | char foo; | |
8084 | double bar; | |
8085 | } try; | |
8086 | main() | |
8087 | { | |
8088 | printf("%d\n", (char *)&try.bar - (char *)&try.foo); | |
8089 | } | |
8090 | EOCP | |
8091 | if $cc $ccflags try.c -o try >/dev/null 2>&1; then | |
8092 | dflt=`./try` | |
8093 | else | |
8094 | dflt='8' | |
8095 | echo"(I can't seem to compile the test program...)" | |
8096 | fi | |
ecfc5424 | 8097 | ;; |
4633a7c4 | 8098 | *) dflt="$alignbytes" |
8e07c86e | 8099 | ;; |
ecfc5424 | 8100 | esac |
4633a7c4 LW |
8101 | rp="Doubles must be aligned on a how-many-byte boundary?" |
8102 | . ./myread | |
8103 | alignbytes="$ans" | |
8104 | $rm -f try.c try | |
85e6fe83 | 8105 | |
4633a7c4 LW |
8106 | : check for ordering of bytes in a long |
8107 | case "$byteorder" in | |
8108 | '') | |
8109 | $cat <<'EOM' | |
8110 | ||
8111 | In the following, larger digits indicate more significance. A big-endian | |
8112 | machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A | |
8113 | little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other | |
8114 | machines may have weird orders like 3412. A Cray will report 87654321. If | |
8115 | the test program works the default is probably right. | |
8116 | I'm now running the test program... | |
8117 | EOM | |
8118 | $cat >try.c <<'EOCP' | |
8119 | #include <stdio.h> | |
8120 | main() | |
8121 | { | |
8122 | int i; | |
8123 | union { | |
8124 | unsigned long l; | |
8125 | char c[sizeof(long)]; | |
8126 | } u; | |
8127 | ||
8128 | if (sizeof(long) > 4) | |
8129 | u.l = (0x08070605L << 32) | 0x04030201L; | |
8130 | else | |
8131 | u.l = 0x04030201L; | |
8132 | for (i = 0; i < sizeof(long); i++) | |
8133 | printf("%c", u.c[i]+'0'); | |
8134 | printf("\n"); | |
8135 | exit(0); | |
8136 | } | |
8137 | EOCP | |
8138 | xxx_prompt=y | |
8139 | if $cc $ccflags try.c -o try >/dev/null 2>&1 && ./try > /dev/null; then | |
8140 | dflt=`./try` | |
8141 | case "$dflt" in | |
8142 | [1-4][1-4][1-4][1-4]|12345678|87654321) | |
8143 | echo "(The test program ran ok.)" | |
8144 | echo "byteorder=$dflt" | |
8145 | xxx_prompt=n | |
8146 | ;; | |
8147 | ????|????????) echo "(The test program ran ok.)" ;; | |
8148 | *) echo "(The test program didn't run right for some reason.)" ;; | |
8149 | esac | |
8150 | else | |
8151 | dflt='4321' | |
8152 | cat <<'EOM' | |
8153 | (I can't seem to compile the test program. Guessing big-endian...) | |
8154 | EOM | |
8155 | fi | |
8156 | case "$xxx_prompt" in | |
8157 | y) | |
8158 | rp="What is the order of bytes in a long?" | |
8159 | . ./myread | |
8160 | byteorder="$ans" | |
8161 | ;; | |
8162 | *) byteorder=$dflt | |
ecfc5424 AD |
8163 | ;; |
8164 | esac | |
8165 | ;; | |
8166 | esac | |
4633a7c4 | 8167 | $rm -f try.c try |
85e6fe83 | 8168 | |
4633a7c4 | 8169 | : how do we catenate cpp tokens here? |
2304df62 | 8170 | echo " " |
4633a7c4 LW |
8171 | echo "Checking to see how your cpp does stuff like catenate tokens..." >&4 |
8172 | $cat >cpp_stuff.c <<'EOCP' | |
8173 | #define RCAT(a,b)a/**/b | |
8174 | #define ACAT(a,b)a ## b | |
8175 | RCAT(Rei,ser) | |
8176 | ACAT(Cir,cus) | |
8177 | EOCP | |
8178 | $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1 | |
8179 | if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then | |
8180 | echo "Oh! Smells like ANSI's been here." | |
8181 | echo "We can catify or stringify, separately or together!" | |
8182 | cpp_stuff=42 | |
8183 | elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then | |
8184 | echo "Ah, yes! The good old days!" | |
8185 | echo "However, in the good old days we don't know how to stringify and" | |
8186 | echo "catify at the same time." | |
8187 | cpp_stuff=1 | |
8188 | else | |
8189 | $cat >&4 <<EOM | |
8190 | Hmm, I don't seem to be able to catenate tokens with your cpp. You're going | |
8191 | to have to edit the values of CAT[2-5] in config.h... | |
a0d0e21e | 8192 | EOM |
4633a7c4 LW |
8193 | cpp_stuff="/* Help! How do we handle cpp_stuff? */*/" |
8194 | fi | |
8195 | $rm -f cpp_stuff.* | |
a0d0e21e | 8196 | |
4633a7c4 LW |
8197 | : see if this is a db.h system |
8198 | set db.h i_db | |
8199 | eval $inhdr | |
8200 | ||
8201 | case "$i_db" in | |
8202 | define) | |
8203 | : Check the return type needed for hash | |
8204 | echo " " | |
8205 | echo "Checking return type needed for hash for Berkeley DB ..." >&4 | |
8206 | $cat >try.c <<EOCP | |
8207 | #$d_const HASCONST | |
8208 | #ifndef HASCONST | |
8209 | #define const | |
8210 | #endif | |
8211 | #include <sys/types.h> | |
8212 | #include <db.h> | |
8213 | u_int32_t hash_cb (ptr, size) | |
8214 | const void *ptr; | |
8215 | size_t size; | |
8216 | { | |
8217 | } | |
8218 | HASHINFO info; | |
8219 | main() | |
8220 | { | |
8221 | info.hash = hash_cb; | |
8222 | } | |
8223 | EOCP | |
8224 | if $cc $ccflags -c try.c >try.out 2>&1 ; then | |
8225 | if $contains warning try.out >>/dev/null 2>&1 ; then | |
8226 | db_hashtype='int' | |
8227 | else | |
8228 | db_hashtype='u_int32_t' | |
8229 | fi | |
8230 | else | |
8231 | echo "I can't seem to compile the test program." >&4 | |
8232 | db_hashtype=int | |
8233 | fi | |
8234 | $rm -f try.* | |
8235 | echo "Your version of Berkeley DB uses $db_hashtype for hash." | |
8236 | ;; | |
8237 | *) db_hashtype=int | |
8238 | ;; | |
8239 | esac | |
a0d0e21e | 8240 | |
4633a7c4 LW |
8241 | case "$i_db" in |
8242 | define) | |
8243 | : Check the return type needed for prefix | |
8244 | echo " " | |
8245 | echo "Checking return type needed for prefix for Berkeley DB ..." >&4 | |
8246 | cat >try.c <<EOCP | |
8247 | #$d_const HASCONST | |
8248 | #ifndef HASCONST | |
8249 | #define const | |
8250 | #endif | |
8251 | #include <sys/types.h> | |
8252 | #include <db.h> | |
8253 | size_t prefix_cb (key1, key2) | |
8254 | const DBT *key1; | |
8255 | const DBT *key2; | |
8256 | { | |
8257 | } | |
8258 | BTREEINFO info; | |
8259 | main() | |
8260 | { | |
8261 | info.prefix = prefix_cb; | |
8262 | } | |
8263 | EOCP | |
8264 | if $cc $ccflags -c try.c >try.out 2>&1 ; then | |
8265 | if $contains warning try.out >>/dev/null 2>&1 ; then | |
8266 | db_prefixtype='int' | |
8267 | else | |
8268 | db_prefixtype='size_t' | |
8269 | fi | |
8270 | else | |
8271 | echo "I can't seem to compile the test program." >&4 | |
8272 | db_prefixtype='int' | |
8273 | fi | |
8274 | $rm -f try.* | |
8275 | echo "Your version of Berkeley DB uses $db_prefixtype for prefix." | |
a0d0e21e | 8276 | ;; |
4633a7c4 LW |
8277 | *) db_prefixtype='int' |
8278 | ;; | |
8279 | esac | |
a0d0e21e | 8280 | |
4633a7c4 LW |
8281 | : check for void type |
8282 | echo " " | |
8283 | echo "Checking to see how well your C compiler groks the void type..." >&4 | |
8284 | echo " " | |
8285 | $cat >&4 <<EOM | |
8286 | Support flag bits are: | |
8287 | 1: basic void declarations. | |
8288 | 2: arrays of pointers to functions returning void. | |
8289 | 4: operations between pointers to and addresses of void functions. | |
8290 | 8: generic void pointers. | |
a0d0e21e | 8291 | EOM |
4633a7c4 LW |
8292 | echo " " |
8293 | case "$voidflags" in | |
8294 | '') | |
8295 | $cat >try.c <<'EOCP' | |
8296 | #if TRY & 1 | |
760ac839 | 8297 | void sub() { |
4633a7c4 | 8298 | #else |
760ac839 | 8299 | sub() { |
4633a7c4 LW |
8300 | #endif |
8301 | extern void moo(); /* function returning void */ | |
8302 | void (*goo)(); /* ptr to func returning void */ | |
8303 | #if TRY & 8 | |
8304 | void *hue; /* generic ptr */ | |
8305 | #endif | |
8306 | #if TRY & 2 | |
8307 | void (*foo[10])(); | |
8308 | #endif | |
a0d0e21e | 8309 | |
4633a7c4 LW |
8310 | #if TRY & 4 |
8311 | if(goo == moo) { | |
8312 | exit(0); | |
8313 | } | |
8314 | #endif | |
8315 | exit(0); | |
8316 | } | |
760ac839 | 8317 | main() { sub(); } |
4633a7c4 | 8318 | EOCP |
760ac839 | 8319 | if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then |
4633a7c4 LW |
8320 | voidflags=$defvoidused |
8321 | echo "It appears to support void to the level $package wants ($defvoidused)." | |
8322 | if $contains warning .out >/dev/null 2>&1; then | |
8323 | echo "However, you might get some warnings that look like this:" | |
8324 | $cat .out | |
8325 | fi | |
8326 | else | |
8327 | echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4 | |
760ac839 | 8328 | if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then |
4633a7c4 | 8329 | echo "It supports 1..." |
760ac839 | 8330 | if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then |
4633a7c4 | 8331 | echo "It also supports 2..." |
760ac839 | 8332 | if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then |
4633a7c4 LW |
8333 | voidflags=7 |
8334 | echo "And it supports 4 but not 8 definitely." | |
8335 | else | |
8336 | echo "It doesn't support 4..." | |
760ac839 | 8337 | if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then |
4633a7c4 LW |
8338 | voidflags=11 |
8339 | echo "But it supports 8." | |
8340 | else | |
8341 | voidflags=3 | |
8342 | echo "Neither does it support 8." | |
8343 | fi | |
8344 | fi | |
8345 | else | |
8346 | echo "It does not support 2..." | |
760ac839 | 8347 | if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then |
4633a7c4 LW |
8348 | voidflags=13 |
8349 | echo "But it supports 4 and 8." | |
8350 | else | |
760ac839 | 8351 | if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then |
4633a7c4 LW |
8352 | voidflags=5 |
8353 | echo "And it supports 4 but has not heard about 8." | |
8354 | else | |
8355 | echo "However it supports 8 but not 4." | |
8356 | fi | |
8357 | fi | |
8358 | fi | |
8359 | else | |
8360 | echo "There is no support at all for void." | |
8361 | voidflags=0 | |
8362 | fi | |
8363 | fi | |
8364 | esac | |
2c7991dc | 8365 | : Only prompt user if support does not match the level we want |
4633a7c4 | 8366 | case "$voidflags" in |
2c7991dc | 8367 | "$defvoidused") ;; |
8368 | *) | |
8369 | dflt="$voidflags"; | |
4633a7c4 | 8370 | rp="Your void support flags add up to what?" |
a0d0e21e | 8371 | . ./myread |
4633a7c4 | 8372 | voidflags="$ans" |
a0d0e21e LW |
8373 | ;; |
8374 | esac | |
4633a7c4 | 8375 | $rm -f try.* .out |
a0d0e21e LW |
8376 | |
8377 | : see what type file positions are declared as in the library | |
8378 | set fpos_t fpostype long stdio.h sys/types.h | |
8379 | eval $typedef | |
8380 | echo " " | |
8381 | dflt="$fpostype" | |
8382 | rp="What is the type for file position used by fsetpos()?" | |
2304df62 | 8383 | . ./myread |
a0d0e21e | 8384 | fpostype="$ans" |
2304df62 | 8385 | |
1aef975c AD |
8386 | : Store the full pathname to the sed program for use in the C program |
8387 | full_sed=$sed | |
8388 | ||
2304df62 | 8389 | : see what type gids are declared as in the kernel |
a0d0e21e LW |
8390 | set gid_t gidtype xxx stdio.h sys/types.h |
8391 | eval $typedef | |
2304df62 | 8392 | case "$gidtype" in |
a0d0e21e LW |
8393 | xxx) |
8394 | xxx=`./findhdr sys/user.h` | |
8395 | set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short | |
8396 | case $1 in | |
8397 | unsigned) dflt="$1 $2" ;; | |
8398 | *) dflt="$1" ;; | |
8399 | esac | |
2304df62 | 8400 | ;; |
a0d0e21e | 8401 | *) dflt="$gidtype";; |
2304df62 AD |
8402 | esac |
8403 | echo " " | |
8404 | rp="What is the type for group ids returned by getgid()?" | |
8405 | . ./myread | |
a0d0e21e LW |
8406 | gidtype="$ans" |
8407 | ||
2304df62 AD |
8408 | : see if getgroups exists |
8409 | set getgroups d_getgrps | |
8410 | eval $inlibc | |
8411 | ||
a0d0e21e LW |
8412 | : Find type of 2nd arg to getgroups |
8413 | echo " " | |
2304df62 AD |
8414 | case "$d_getgrps" in |
8415 | 'define') | |
a0d0e21e | 8416 | case "$groupstype" in |
2304df62 AD |
8417 | '') dflt="$gidtype" ;; |
8418 | *) dflt="$groupstype" ;; | |
a0d0e21e LW |
8419 | esac |
8420 | $cat <<EOM | |
2304df62 | 8421 | What is the type of the second argument to getgroups()? Usually this |
85e6fe83 | 8422 | is the same as group ids, $gidtype, but not always. |
2304df62 AD |
8423 | |
8424 | EOM | |
a0d0e21e LW |
8425 | rp='What type is the second argument to getgroups()?' |
8426 | . ./myread | |
8427 | groupstype="$ans" | |
8428 | ;; | |
8429 | *) groupstype="$gidtype";; | |
2304df62 | 8430 | esac |
2304df62 | 8431 | |
85e6fe83 | 8432 | : see what type lseek is declared as in the kernel |
a0d0e21e LW |
8433 | set off_t lseektype long stdio.h sys/types.h |
8434 | eval $typedef | |
2304df62 | 8435 | echo " " |
a0d0e21e | 8436 | dflt="$lseektype" |
85e6fe83 LW |
8437 | rp="What type is lseek's offset on this system declared as?" |
8438 | . ./myread | |
8439 | lseektype="$ans" | |
2304df62 | 8440 | |
8ff267be | 8441 | echo " " |
8442 | case "$make" in | |
8443 | '') | |
8444 | make=`./loc make make $pth` | |
8445 | case "$make" in | |
8446 | /*) echo make is in $make. ;; | |
8447 | ?:[\\/]*) echo make is in $make. ;; | |
8448 | *) echo "I don't know where 'make' is, and my life depends on it." >&4 | |
8449 | echo "Go find a make program or fix your PATH setting!" >&4 | |
8450 | exit 1 | |
8451 | ;; | |
8452 | esac | |
8453 | ;; | |
8454 | *) echo make is in $make. ;; | |
8455 | esac | |
8456 | ||
8457 | $echo $n "Checking if your $make program sets \$(MAKE)... $c" >&4 | |
8458 | case "$make_set_make" in | |
8459 | '') | |
8460 | $sed 's/^X //' > testmake.mak << 'EOF' | |
8461 | Xall: | |
8462 | X @echo 'ac_maketemp="$(MAKE)"' | |
8463 | EOF | |
8464 | : GNU make sometimes prints "make[1]: Entering...", which would confuse us. | |
8465 | case "`$make -f testmake.mak 2>/dev/null`" in | |
8466 | *ac_maketemp=*) make_set_make='#' ;; | |
8467 | *) make_set_make="MAKE=$make" ;; | |
8468 | esac | |
8469 | $rm -f testmake.mak | |
8470 | ;; | |
8471 | esac | |
8472 | case "$make_set_make" in | |
8473 | '#') echo "Yup, it does." >&4 ;; | |
8474 | *) echo "Nope, it doesn't." >&4 ;; | |
8475 | esac | |
8476 | ||
a0d0e21e LW |
8477 | : see what type is used for mode_t |
8478 | set mode_t modetype int stdio.h sys/types.h | |
8479 | eval $typedef | |
8480 | dflt="$modetype" | |
85e6fe83 | 8481 | echo " " |
a0d0e21e | 8482 | rp="What type is used for file modes?" |
85e6fe83 | 8483 | . ./myread |
a0d0e21e | 8484 | modetype="$ans" |
85e6fe83 | 8485 | |
2c7991dc | 8486 | : locate the preferred pager for this system |
8487 | case "$pager" in | |
8488 | '') | |
8489 | dflt='' | |
8490 | case "$pg" in | |
8491 | /*) dflt=$pg;; | |
8492 | esac | |
8493 | case "$more" in | |
8494 | /*) dflt=$more;; | |
8495 | esac | |
8496 | case "$less" in | |
8497 | /*) dflt=$less;; | |
8498 | esac | |
8499 | case "$dflt" in | |
8500 | '') dflt=/usr/ucb/more;; | |
8501 | esac | |
8502 | ;; | |
8503 | *) dflt="$pager";; | |
8504 | esac | |
8505 | echo " " | |
8506 | fn=f/ | |
8507 | rp='What pager is used on your system?' | |
8508 | . ./getfile | |
8509 | pager="$ans" | |
8510 | ||
2304df62 AD |
8511 | : Cruising for prototypes |
8512 | echo " " | |
8513 | echo "Checking out function prototypes..." >&4 | |
8514 | $cat >prototype.c <<'EOCP' | |
8515 | main(int argc, char *argv[]) { | |
8516 | exit(0);} | |
8517 | EOCP | |
a0d0e21e | 8518 | if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then |
2304df62 AD |
8519 | echo "Your C compiler appears to support function prototypes." |
8520 | val="$define" | |
8521 | else | |
8522 | echo "Your C compiler doesn't seem to understand function prototypes." | |
8523 | val="$undef" | |
8524 | fi | |
8525 | set prototype | |
8526 | eval $setvar | |
8527 | $rm -f prototype* | |
8528 | ||
8529 | : check for size of random number generator | |
8530 | echo " " | |
8531 | case "$randbits" in | |
8532 | '') | |
8533 | echo "Checking to see how many bits your rand function produces..." >&4 | |
8ff267be | 8534 | $cat >try.c <<EOCP |
8535 | #$i_unistd I_UNISTD | |
8536 | #$i_stdlib I_STDLIB | |
2304df62 | 8537 | #include <stdio.h> |
8ff267be | 8538 | #ifdef I_UNISTD |
8539 | # include <unistd.h> | |
8540 | #endif | |
8541 | #ifdef I_STDLIB | |
8542 | # include <stdlib.h> | |
8543 | #endif | |
8544 | EOCP | |
8545 | $cat >>try.c <<'EOCP' | |
2304df62 AD |
8546 | main() |
8547 | { | |
8548 | register int i; | |
8549 | register unsigned long tmp; | |
8550 | register unsigned long max = 0L; | |
8551 | ||
8552 | for (i = 1000; i; i--) { | |
8553 | tmp = (unsigned long)rand(); | |
8554 | if (tmp > max) max = tmp; | |
8555 | } | |
8556 | for (i = 0; max; i++) | |
8557 | max /= 2; | |
8558 | printf("%d\n",i); | |
8559 | } | |
8560 | EOCP | |
8561 | if $cc try.c -o try >/dev/null 2>&1 ; then | |
8562 | dflt=`try` | |
8563 | else | |
8564 | dflt='?' | |
8565 | echo "(I can't seem to compile the test program...)" | |
8566 | fi | |
8567 | ;; | |
8568 | *) | |
8569 | dflt="$randbits" | |
8570 | ;; | |
8571 | esac | |
a0d0e21e LW |
8572 | rp='How many bits does your rand() function produce?' |
8573 | . ./myread | |
8574 | randbits="$ans" | |
8575 | $rm -f try.c try | |
8576 | ||
8577 | : see if ar generates random libraries by itself | |
8578 | echo " " | |
8579 | echo "Checking how to generate random libraries on your machine..." >&4 | |
8580 | echo 'int bar1() { return bar2(); }' > bar1.c | |
8581 | echo 'int bar2() { return 2; }' > bar2.c | |
8582 | $cat > foo.c <<'EOP' | |
8583 | main() { printf("%d\n", bar1()); exit(0); } | |
8584 | EOP | |
8585 | $cc $ccflags -c bar1.c >/dev/null 2>&1 | |
8586 | $cc $ccflags -c bar2.c >/dev/null 2>&1 | |
8587 | $cc $ccflags -c foo.c >/dev/null 2>&1 | |
5f05dabc | 8588 | ar rc bar$lib_ext bar2.o bar1.o >/dev/null 2>&1 |
8589 | if $cc $ccflags $ldflags -o foobar foo.o bar$lib_ext $libs > /dev/null 2>&1 && | |
a0d0e21e LW |
8590 | ./foobar >/dev/null 2>&1; then |
8591 | echo "ar appears to generate random libraries itself." | |
8592 | orderlib=false | |
8593 | ranlib=":" | |
5f05dabc | 8594 | elif ar ts bar$lib_ext >/dev/null 2>&1 && |
8595 | $cc $ccflags $ldflags -o foobar foo.o bar$lib_ext $libs > /dev/null 2>&1 && | |
a0d0e21e LW |
8596 | ./foobar >/dev/null 2>&1; then |
8597 | echo "a table of contents needs to be added with 'ar ts'." | |
8598 | orderlib=false | |
8599 | ranlib="ar ts" | |
8600 | else | |
ecfc5424 AD |
8601 | case "$ranlib" in |
8602 | :) ranlib='';; | |
8603 | '') | |
8604 | ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin` | |
8605 | $test -f $ranlib || ranlib='' | |
8606 | ;; | |
8607 | esac | |
a0d0e21e | 8608 | if $test -n "$ranlib"; then |
ecfc5424 | 8609 | echo "your system has '$ranlib'; we'll use that." |
a0d0e21e LW |
8610 | orderlib=false |
8611 | else | |
8612 | echo "your system doesn't seem to support random libraries" | |
8613 | echo "so we'll use lorder and tsort to order the libraries." | |
8614 | orderlib=true | |
8615 | ranlib=":" | |
8616 | fi | |
8617 | fi | |
8618 | $rm -f foo* bar* | |
8619 | ||
a0d0e21e LW |
8620 | : see if sys/select.h has to be included |
8621 | set sys/select.h i_sysselct | |
8622 | eval $inhdr | |
8623 | ||
8624 | : see if we should include time.h, sys/time.h, or both | |
8625 | echo " " | |
8626 | echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4 | |
8627 | $echo $n "I'm now running the test program...$c" | |
8628 | $cat >try.c <<'EOCP' | |
8629 | #include <sys/types.h> | |
8630 | #ifdef I_TIME | |
8631 | #include <time.h> | |
8632 | #endif | |
8633 | #ifdef I_SYSTIME | |
8634 | #ifdef SYSTIMEKERNEL | |
8635 | #define KERNEL | |
8636 | #endif | |
8637 | #include <sys/time.h> | |
8638 | #endif | |
8639 | #ifdef I_SYSSELECT | |
8640 | #include <sys/select.h> | |
8641 | #endif | |
8642 | main() | |
8643 | { | |
8644 | struct tm foo; | |
8645 | #ifdef S_TIMEVAL | |
8646 | struct timeval bar; | |
8647 | #endif | |
8648 | #ifdef S_TIMEZONE | |
8649 | struct timezone tzp; | |
8650 | #endif | |
8651 | if (foo.tm_sec == foo.tm_sec) | |
8652 | exit(0); | |
8653 | #ifdef S_TIMEVAL | |
8654 | if (bar.tv_sec == bar.tv_sec) | |
8655 | exit(0); | |
8656 | #endif | |
8657 | exit(1); | |
8658 | } | |
8659 | EOCP | |
8660 | flags='' | |
40a7a20a | 8661 | for s_timezone in '-DS_TIMEZONE' ''; do |
a0d0e21e LW |
8662 | sysselect='' |
8663 | for s_timeval in '-DS_TIMEVAL' ''; do | |
8664 | for i_systimek in '' '-DSYSTIMEKERNEL'; do | |
8665 | for i_time in '' '-DI_TIME'; do | |
8666 | for i_systime in '-DI_SYSTIME' ''; do | |
8667 | case "$flags" in | |
8668 | '') $echo $n ".$c" | |
8669 | if $cc $ccflags \ | |
8670 | $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone \ | |
8671 | try.c -o try >/dev/null 2>&1 ; then | |
8672 | set X $i_time $i_systime $i_systimek $sysselect $s_timeval | |
8673 | shift | |
8674 | flags="$*" | |
8675 | echo " " | |
8676 | $echo $n "Succeeded with $flags$c" | |
8677 | fi | |
8678 | ;; | |
8679 | esac | |
8680 | done | |
8681 | done | |
8682 | done | |
8683 | done | |
40a7a20a | 8684 | done |
a0d0e21e LW |
8685 | timeincl='' |
8686 | echo " " | |
8687 | case "$flags" in | |
8688 | *SYSTIMEKERNEL*) i_systimek="$define" | |
8689 | timeincl=`./findhdr sys/time.h` | |
8690 | echo "We'll include <sys/time.h> with KERNEL defined." >&4;; | |
8691 | *) i_systimek="$undef";; | |
8692 | esac | |
8693 | case "$flags" in | |
8694 | *I_TIME*) i_time="$define" | |
8695 | timeincl=`./findhdr time.h`" $timeincl" | |
8696 | echo "We'll include <time.h>." >&4;; | |
8697 | *) i_time="$undef";; | |
8698 | esac | |
8699 | case "$flags" in | |
8700 | *I_SYSTIME*) i_systime="$define" | |
8701 | timeincl=`./findhdr sys/time.h`" $timeincl" | |
8702 | echo "We'll include <sys/time.h>." >&4;; | |
8703 | *) i_systime="$undef";; | |
8704 | esac | |
2304df62 AD |
8705 | $rm -f try.c try |
8706 | ||
a0d0e21e LW |
8707 | : check for fd_set items |
8708 | $cat <<EOM | |
8709 | ||
8710 | Checking to see how well your C compiler handles fd_set and friends ... | |
8711 | EOM | |
8712 | $cat >fd_set.c <<EOCP | |
8713 | #$i_systime I_SYS_TIME | |
8714 | #$i_sysselct I_SYS_SELECT | |
8715 | #$d_socket HAS_SOCKET | |
8716 | #include <sys/types.h> | |
8717 | #ifdef HAS_SOCKET | |
8718 | #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */ | |
8719 | #endif | |
8720 | #ifdef I_SYS_TIME | |
8721 | #include <sys/time.h> | |
a4f3eea9 | 8722 | #endif |
a0d0e21e LW |
8723 | #ifdef I_SYS_SELECT |
8724 | #include <sys/select.h> | |
8725 | #endif | |
a0d0e21e LW |
8726 | main() { |
8727 | fd_set fds; | |
8728 | ||
8729 | #ifdef TRYBITS | |
8730 | if(fds.fds_bits); | |
8731 | #endif | |
8732 | ||
8733 | #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO) | |
8734 | exit(0); | |
8735 | #else | |
8736 | exit(1); | |
8737 | #endif | |
8738 | } | |
8739 | EOCP | |
8740 | if $cc $ccflags -DTRYBITS fd_set.c -o fd_set >fd_set.out 2>&1 ; then | |
8741 | d_fds_bits="$define" | |
8742 | d_fd_set="$define" | |
8743 | echo "Well, your system knows about the normal fd_set typedef..." >&4 | |
8744 | if ./fd_set; then | |
8745 | echo "and you have the normal fd_set macros (just as I'd expect)." >&4 | |
8746 | d_fd_macros="$define" | |
85e6fe83 | 8747 | else |
a0d0e21e LW |
8748 | $cat >&4 <<'EOM' |
8749 | but not the normal fd_set macros! Gaaack! I'll have to cover for you. | |
8750 | EOM | |
8751 | d_fd_macros="$undef" | |
85e6fe83 LW |
8752 | fi |
8753 | else | |
a0d0e21e LW |
8754 | $cat <<'EOM' |
8755 | Hmm, your compiler has some difficulty with fd_set. Checking further... | |
8756 | EOM | |
8757 | if $cc $ccflags fd_set.c -o fd_set >fd_set.out 2>&1 ; then | |
8758 | d_fds_bits="$undef" | |
8759 | d_fd_set="$define" | |
8760 | echo "Well, your system has some sort of fd_set available..." >&4 | |
8761 | if ./fd_set; then | |
8762 | echo "and you have the normal fd_set macros." >&4 | |
8763 | d_fd_macros="$define" | |
8764 | else | |
8765 | $cat <<'EOM' | |
8766 | but not the normal fd_set macros! Gross! More work for me... | |
8767 | EOM | |
8768 | d_fd_macros="$undef" | |
8769 | fi | |
85e6fe83 | 8770 | else |
a0d0e21e LW |
8771 | echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4 |
8772 | d_fd_set="$undef" | |
8773 | d_fds_bits="$undef" | |
8774 | d_fd_macros="$undef" | |
85e6fe83 LW |
8775 | fi |
8776 | fi | |
a0d0e21e LW |
8777 | $rm -f fd_set* |
8778 | ||
8779 | ||
8780 | : check for type of arguments to select. This will only really | |
8781 | : work if the system supports prototypes and provides one for | |
8782 | : select. | |
8783 | case "$d_select" in | |
8784 | $define) | |
8785 | : Make initial guess | |
8786 | case "$selecttype" in | |
8787 | ''|' ') | |
8788 | case "$d_fd_set" in | |
8789 | $define) xxx='fd_set *' ;; | |
8790 | *) xxx='int *' ;; | |
8791 | esac | |
8792 | ;; | |
8793 | *) xxx="$selecttype" | |
8794 | ;; | |
8795 | esac | |
8796 | : backup guess | |
8797 | case "$xxx" in | |
8798 | 'fd_set *') yyy='int *' ;; | |
8799 | 'int *') yyy='fd_set *' ;; | |
8800 | esac | |
85e6fe83 | 8801 | |
2304df62 AD |
8802 | $cat <<EOM |
8803 | ||
a0d0e21e | 8804 | Checking to see what type of arguments are expected by select(). |
2304df62 | 8805 | EOM |
a0d0e21e LW |
8806 | $cat >try.c <<EOCP |
8807 | #$i_systime I_SYS_TIME | |
8808 | #$i_sysselct I_SYS_SELECT | |
8809 | #$d_socket HAS_SOCKET | |
8810 | #include <sys/types.h> | |
8811 | #ifdef HAS_SOCKET | |
8812 | #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */ | |
8813 | #endif | |
8814 | #ifdef I_SYS_TIME | |
8815 | #include <sys/time.h> | |
8ff267be | 8816 | #endif |
a0d0e21e LW |
8817 | #ifdef I_SYS_SELECT |
8818 | #include <sys/select.h> | |
8819 | #endif | |
a0d0e21e LW |
8820 | main() |
8821 | { | |
8822 | int width; | |
8823 | Select_fd_set_t readfds; | |
8824 | Select_fd_set_t writefds; | |
8825 | Select_fd_set_t exceptfds; | |
8826 | struct timeval timeout; | |
8827 | select(width, readfds, writefds, exceptfds, &timeout); | |
8828 | exit(0); | |
8829 | } | |
8830 | EOCP | |
8831 | if $cc $ccflags -c -DSelect_fd_set_t="$xxx" try.c >/dev/null 2>&1 ; then | |
8832 | selecttype="$xxx" | |
8833 | echo "Your system uses $xxx for the arguments to select." >&4 | |
8834 | elif $cc $ccflags -c -DSelect_fd_set_t="$yyy" try.c >/dev/null 2>&1 ; then | |
8835 | selecttype="$yyy" | |
8836 | echo "Your system uses $yyy for the arguments to select." >&4 | |
8837 | else | |
8838 | rp='What is the type for the 2nd, 3rd, and 4th arguments to select?' | |
8839 | dflt="$xxx" | |
8840 | . ./myread | |
8841 | selecttype="$ans" | |
8842 | fi | |
8843 | $rm -f try.[co] | |
8844 | ;; | |
8e07c86e | 8845 | *) selecttype='int *' |
a0d0e21e LW |
8846 | ;; |
8847 | esac | |
2304df62 | 8848 | |
8e07c86e AD |
8849 | : Trace out the files included by signal.h, then look for SIGxxx names. |
8850 | : Remove SIGARRAYSIZE used by HPUX. | |
4633a7c4 | 8851 | : Remove SIGTYP void lines used by OS2. |
8e07c86e AD |
8852 | xxx=`echo '#include <signal.h>' | |
8853 | $cppstdin $cppminus $cppflags 2>/dev/null | | |
8854 | $grep '^[ ]*#.*include' | | |
8855 | $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq` | |
8856 | : Check this list of files to be sure we have parsed the cpp output ok. | |
8857 | : This will also avoid potentially non-existent files, such | |
8858 | : as ../foo/bar.h | |
8859 | xxxfiles='' | |
8860 | for xx in $xxx /dev/null ; do | |
8861 | $test -f "$xx" && xxxfiles="$xxxfiles $xx" | |
8862 | done | |
8863 | : If we have found no files, at least try signal.h | |
8864 | case "$xxxfiles" in | |
8865 | '') xxxfiles=`./findhdr signal.h` ;; | |
8866 | esac | |
8867 | xxx=`awk ' | |
4633a7c4 | 8868 | $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $3 !~ /void/ { |
8e07c86e AD |
8869 | print substr($2, 4, 20) |
8870 | } | |
4633a7c4 | 8871 | $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ { |
8e07c86e AD |
8872 | print substr($3, 4, 20) |
8873 | }' $xxxfiles` | |
8874 | : Append some common names just in case the awk scan failed. | |
8875 | xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL" | |
8876 | xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP" | |
8877 | xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM" | |
8878 | xxx="$xxx WINCH WIND WINDOW XCPU XFSZ" | |
8879 | : generate a few handy files for later | |
4633a7c4 LW |
8880 | $cat > signal.c <<'EOP' |
8881 | #include <sys/types.h> | |
8882 | #include <signal.h> | |
8883 | int main() { | |
760ac839 LW |
8884 | |
8885 | /* Strange style to avoid deeply-nested #if/#else/#endif */ | |
8886 | #ifndef NSIG | |
8887 | # ifdef _NSIG | |
8888 | # define NSIG (_NSIG) | |
8889 | # endif | |
8890 | #endif | |
8891 | ||
8892 | #ifndef NSIG | |
8893 | # ifdef SIGMAX | |
8894 | # define NSIG (SIGMAX+1) | |
8895 | # endif | |
8896 | #endif | |
8897 | ||
8898 | #ifndef NSIG | |
8899 | # ifdef SIG_MAX | |
8900 | # define NSIG (SIG_MAX+1) | |
8901 | # endif | |
8902 | #endif | |
8903 | ||
8904 | #ifndef NSIG | |
8905 | # ifdef MAXSIG | |
8906 | # define NSIG (MAXSIG+1) | |
8907 | # endif | |
4633a7c4 | 8908 | #endif |
760ac839 LW |
8909 | |
8910 | #ifndef NSIG | |
8911 | # ifdef MAX_SIG | |
8912 | # define NSIG (MAX_SIG+1) | |
8913 | # endif | |
8914 | #endif | |
8915 | ||
8916 | #ifndef NSIG | |
8917 | # ifdef SIGARRAYSIZE | |
8918 | # define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */ | |
8919 | # endif | |
8920 | #endif | |
8921 | ||
8922 | #ifndef NSIG | |
8923 | # ifdef _sys_nsig | |
8924 | # define NSIG (_sys_nsig) /* Solaris 2.5 */ | |
8925 | # endif | |
8926 | #endif | |
8927 | ||
8928 | /* Default to some arbitrary number that's big enough to get most | |
8929 | of the common signals. | |
8930 | */ | |
8931 | #ifndef NSIG | |
8932 | # define NSIG 50 | |
4633a7c4 | 8933 | #endif |
760ac839 LW |
8934 | |
8935 | printf("NSIG %d\n", NSIG); | |
8936 | ||
4633a7c4 LW |
8937 | EOP |
8938 | echo $xxx | $tr ' ' '\012' | $sort | $uniq | $awk ' | |
8e07c86e AD |
8939 | { |
8940 | printf "#ifdef SIG"; printf $1; printf "\n" | |
8941 | printf "printf(\""; printf $1; printf " %%d\\n\",SIG"; | |
8942 | printf $1; printf ");\n" | |
8943 | printf "#endif\n" | |
2304df62 | 8944 | } |
2304df62 | 8945 | END { |
8e07c86e | 8946 | printf "}\n"; |
2304df62 | 8947 | } |
4633a7c4 LW |
8948 | ' >>signal.c |
8949 | $cat >signal.awk <<'EOP' | |
8950 | BEGIN { ndups = 0 } | |
8951 | $1 ~ /^NSIG$/ { nsig = $2 } | |
8952 | ($1 !~ /^NSIG$/) && (NF == 2) { | |
8953 | if ($2 > maxsig) { maxsig = $2 } | |
8954 | if (sig_name[$2]) { | |
8955 | dup_name[ndups] = $1 | |
8956 | dup_num[ndups] = $2 | |
8957 | ndups++ | |
8958 | } | |
8959 | else { | |
8960 | sig_name[$2] = $1 | |
8961 | sig_num[$2] = $2 | |
8962 | } | |
8963 | ||
8964 | } | |
8965 | END { | |
8966 | if (nsig == 0) { nsig = maxsig + 1 } | |
8967 | for (n = 1; n < nsig; n++) { | |
8968 | if (sig_name[n]) { | |
8969 | printf("%s %d\n", sig_name[n], sig_num[n]) | |
8970 | } | |
8971 | else { | |
8972 | printf("NUM%d %d\n", n, n) | |
8973 | } | |
8974 | } | |
8975 | for (n = 0; n < ndups; n++) { | |
8976 | printf("%s %d\n", dup_name[n], dup_num[n]) | |
8977 | } | |
8978 | } | |
8979 | EOP | |
8980 | $cat >signal_cmd <<EOS | |
8e07c86e AD |
8981 | $startsh |
8982 | $test -s signal.lst && exit 0 | |
8983 | if $cc $ccflags signal.c -o signal $ldflags >/dev/null 2>&1; then | |
4633a7c4 | 8984 | ./signal | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst |
8e07c86e AD |
8985 | else |
8986 | echo "(I can't seem be able to compile the test program -- Guessing)" | |
8987 | echo 'kill -l' >signal | |
8988 | set X \`csh -f <signal\` | |
8989 | $rm -f signal | |
2304df62 | 8990 | shift |
8e07c86e AD |
8991 | case \$# in |
8992 | 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;; | |
2304df62 | 8993 | esac |
8e07c86e AD |
8994 | echo \$@ | $tr ' ' '\012' | \ |
8995 | $awk '{ printf $1; printf " %d\n", ++s; }' >signal.lst | |
8996 | fi | |
8997 | $rm -f signal.c signal signal.o | |
8998 | EOS | |
4633a7c4 LW |
8999 | chmod a+x signal_cmd |
9000 | $eunicefix signal_cmd | |
8e07c86e AD |
9001 | |
9002 | : generate list of signal names | |
9003 | echo " " | |
9004 | case "$sig_name" in | |
4633a7c4 LW |
9005 | '') sig_num='' ;; |
9006 | esac | |
9007 | case "$sig_num" in | |
9008 | '') sig_name='' ;; | |
9009 | esac | |
9010 | case "$sig_name" in | |
8e07c86e | 9011 | '') |
4633a7c4 LW |
9012 | echo "Generating a list of signal names and numbers..." >&4 |
9013 | ./signal_cmd | |
8e07c86e AD |
9014 | sig_name=`$awk '{printf "%s ", $1}' signal.lst` |
9015 | sig_name="ZERO $sig_name" | |
4633a7c4 LW |
9016 | sig_num=`$awk '{printf "%d ", $2}' signal.lst` |
9017 | sig_num="0 $sig_num" | |
a0d0e21e | 9018 | ;; |
2304df62 | 9019 | esac |
a0d0e21e LW |
9020 | echo "The following signals are available:" |
9021 | echo " " | |
9022 | echo $sig_name | $awk \ | |
9023 | 'BEGIN { linelen = 0 } | |
9024 | { | |
8e07c86e | 9025 | for (i = 1; i <= NF; i++) { |
a0d0e21e LW |
9026 | name = "SIG" $i " " |
9027 | linelen = linelen + length(name) | |
9028 | if (linelen > 70) { | |
9029 | printf "\n" | |
9030 | linelen = length(name) | |
9031 | } | |
9032 | printf "%s", name | |
9033 | } | |
8e07c86e | 9034 | printf "\n" |
a0d0e21e | 9035 | }' |
4633a7c4 | 9036 | $rm -f signal signal.c signal.awk signal.lst signal_cmd |
a0d0e21e LW |
9037 | |
9038 | : see what type is used for size_t | |
9039 | set size_t sizetype 'unsigned int' stdio.h sys/types.h | |
9040 | eval $typedef | |
9041 | dflt="$sizetype" | |
9042 | echo " " | |
9043 | rp="What type is used for the length parameter for string functions?" | |
2304df62 | 9044 | . ./myread |
a0d0e21e LW |
9045 | sizetype="$ans" |
9046 | ||
9047 | : see what type is used for signed size_t | |
9048 | set ssize_t ssizetype int stdio.h sys/types.h | |
9049 | eval $typedef | |
9050 | dflt="$ssizetype" | |
9051 | $cat > ssize.c <<EOM | |
9052 | #include <stdio.h> | |
9053 | #include <sys/types.h> | |
9054 | #define Size_t $sizetype | |
9055 | #define SSize_t $dflt | |
9056 | main() | |
9057 | { | |
9058 | if (sizeof(Size_t) == sizeof(SSize_t)) | |
9059 | printf("$dflt\n"); | |
9060 | else if (sizeof(Size_t) == sizeof(int)) | |
9061 | printf("int\n"); | |
9062 | else | |
9063 | printf("long\n"); | |
d97d40b5 | 9064 | fflush(stdout); |
760ac839 | 9065 | exit(0); |
a0d0e21e LW |
9066 | } |
9067 | EOM | |
9068 | echo " " | |
5f05dabc | 9069 | if $cc $ccflags $ldflags -o ssize ssize.c $libs > /dev/null 2>&1 && |
760ac839 | 9070 | ./ssize > /dev/null 2>&1 ; then |
a0d0e21e LW |
9071 | ssizetype=`./ssize` |
9072 | echo "I'll be using $ssizetype for functions returning a byte count." >&4 | |
9073 | else | |
760ac839 | 9074 | echo "(I can't compile and run the test program--please enlighten me!)" |
a0d0e21e LW |
9075 | $cat <<EOM |
9076 | ||
9077 | I need a type that is the same size as $sizetype, but is guaranteed to | |
9078 | be signed. Common values are int and long. | |
9079 | ||
9080 | EOM | |
9081 | rp="What signed type is the same size as $sizetype?" | |
9082 | . ./myread | |
9083 | ssizetype="$ans" | |
9084 | fi | |
9085 | $rm -f ssize ssize.[co] | |
9086 | ||
9087 | : see what type of char stdio uses. | |
9088 | echo " " | |
9089 | if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then | |
9090 | echo "Your stdio uses unsigned chars." >&4 | |
9091 | stdchar="unsigned char" | |
9092 | else | |
9093 | echo "Your stdio uses signed chars." >&4 | |
9094 | stdchar="char" | |
9095 | fi | |
9096 | ||
9097 | : see if time exists | |
9098 | echo " " | |
ecfc5424 | 9099 | if set time val -f d_time; eval $csym; $val; then |
a0d0e21e | 9100 | echo 'time() found.' >&4 |
ecfc5424 | 9101 | val="$define" |
a0d0e21e LW |
9102 | set time_t timetype long stdio.h sys/types.h |
9103 | eval $typedef | |
9104 | dflt="$timetype" | |
9105 | echo " " | |
c2960299 | 9106 | rp="What type is returned by time() on this system?" |
a0d0e21e LW |
9107 | . ./myread |
9108 | timetype="$ans" | |
9109 | else | |
9110 | echo 'time() not found, hope that will do.' >&4 | |
ecfc5424 | 9111 | val="$undef" |
a0d0e21e LW |
9112 | timetype='int'; |
9113 | fi | |
a0d0e21e LW |
9114 | set d_time |
9115 | eval $setvar | |
9116 | ||
9117 | : see what type uids are declared as in the kernel | |
9118 | set uid_t uidtype xxx stdio.h sys/types.h | |
9119 | eval $typedef | |
9120 | case "$uidtype" in | |
9121 | xxx) | |
9122 | xxx=`./findhdr sys/user.h` | |
9123 | set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short | |
9124 | case $1 in | |
9125 | unsigned) dflt="$1 $2" ;; | |
9126 | *) dflt="$1" ;; | |
9127 | esac | |
9128 | ;; | |
4633a7c4 LW |
9129 | *) dflt="$uidtype";; |
9130 | esac | |
9131 | echo " " | |
9132 | rp="What is the type for user ids returned by getuid()?" | |
9133 | . ./myread | |
9134 | uidtype="$ans" | |
9135 | ||
9136 | : see if dbm.h is available | |
9137 | : see if dbmclose exists | |
9138 | set dbmclose d_dbmclose | |
9139 | eval $inlibc | |
9140 | ||
9141 | case "$d_dbmclose" in | |
9142 | $define) | |
9143 | set dbm.h i_dbm | |
9144 | eval $inhdr | |
9145 | case "$i_dbm" in | |
9146 | $define) | |
9147 | val="$undef" | |
9148 | set i_rpcsvcdbm | |
9149 | eval $setvar | |
9150 | ;; | |
9151 | *) set rpcsvc/dbm.h i_rpcsvcdbm | |
9152 | eval $inhdr | |
9153 | ;; | |
9154 | esac | |
9155 | ;; | |
9156 | *) echo "We won't be including <dbm.h>" | |
9157 | val="$undef" | |
9158 | set i_dbm | |
9159 | eval $setvar | |
9160 | val="$undef" | |
9161 | set i_rpcsvcdbm | |
9162 | eval $setvar | |
9163 | ;; | |
a0d0e21e | 9164 | esac |
2304df62 | 9165 | |
2304df62 AD |
9166 | : see if this is a sys/file.h system |
9167 | val='' | |
9168 | set sys/file.h val | |
9169 | eval $inhdr | |
9170 | ||
8e07c86e | 9171 | : do we need to include sys/file.h ? |
2304df62 AD |
9172 | case "$val" in |
9173 | "$define") | |
9174 | echo " " | |
9175 | if $h_sysfile; then | |
9176 | val="$define" | |
9177 | echo "We'll be including <sys/file.h>." >&4 | |
9178 | else | |
9179 | val="$undef" | |
9180 | echo "We won't be including <sys/file.h>." >&4 | |
9181 | fi | |
9182 | ;; | |
9183 | *) | |
9184 | h_sysfile=false | |
9185 | ;; | |
9186 | esac | |
9187 | set i_sysfile | |
9188 | eval $setvar | |
9189 | ||
9190 | : see if fcntl.h is there | |
9191 | val='' | |
9192 | set fcntl.h val | |
9193 | eval $inhdr | |
9194 | ||
9195 | : see if we can include fcntl.h | |
9196 | case "$val" in | |
9197 | "$define") | |
9198 | echo " " | |
9199 | if $h_fcntl; then | |
9200 | val="$define" | |
9201 | echo "We'll be including <fcntl.h>." >&4 | |
9202 | else | |
9203 | val="$undef" | |
9204 | if $h_sysfile; then | |
9205 | echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4 | |
9206 | else | |
9207 | echo "We won't be including <fcntl.h>." >&4 | |
9208 | fi | |
9209 | fi | |
9210 | ;; | |
9211 | *) | |
9212 | h_fcntl=false | |
9213 | val="$undef" | |
9214 | ;; | |
9215 | esac | |
9216 | set i_fcntl | |
9217 | eval $setvar | |
9218 | ||
2304df62 AD |
9219 | : see if this is an grp system |
9220 | set grp.h i_grp | |
9221 | eval $inhdr | |
9222 | ||
4633a7c4 LW |
9223 | : see if locale.h is available |
9224 | set locale.h i_locale | |
9225 | eval $inhdr | |
9226 | ||
a0d0e21e LW |
9227 | : see if this is a math.h system |
9228 | set math.h i_math | |
9229 | eval $inhdr | |
9230 | ||
4633a7c4 LW |
9231 | : see if ndbm.h is available |
9232 | set ndbm.h t_ndbm | |
9233 | eval $inhdr | |
9234 | case "$t_ndbm" in | |
9235 | $define) | |
9236 | : see if dbm_open exists | |
9237 | set dbm_open d_dbm_open | |
9238 | eval $inlibc | |
9239 | case "$d_dbm_open" in | |
9240 | $undef) | |
9241 | t_ndbm="$undef" | |
9242 | echo "We won't be including <ndbm.h>" | |
9243 | ;; | |
9244 | esac | |
9245 | ;; | |
9246 | esac | |
9247 | val="$t_ndbm" | |
9248 | set i_ndbm | |
9249 | eval $setvar | |
9250 | ||
85e6fe83 | 9251 | : see if net/errno.h is available |
a0d0e21e LW |
9252 | val='' |
9253 | set net/errno.h val | |
2304df62 | 9254 | eval $inhdr |
a0d0e21e | 9255 | |
85e6fe83 | 9256 | : Unfortunately, it causes problems on some systems. Arrgh. |
a0d0e21e LW |
9257 | case "$val" in |
9258 | $define) | |
9259 | cat > try.c <<'EOM' | |
85e6fe83 LW |
9260 | #include <stdio.h> |
9261 | #include <errno.h> | |
9262 | #include <net/errno.h> | |
9263 | int func() | |
9264 | { | |
a0d0e21e | 9265 | return ENOTSOCK; |
85e6fe83 LW |
9266 | } |
9267 | EOM | |
a0d0e21e LW |
9268 | if $cc $ccflags -c try.c >/dev/null 2>&1; then |
9269 | echo "We'll be including <net/errno.h>." >&4 | |
9270 | else | |
9271 | echo "We won't be including <net/errno.h>." >&4 | |
9272 | val="$undef" | |
9273 | fi | |
9274 | $rm -f try.* try | |
9275 | ;; | |
85e6fe83 | 9276 | esac |
a0d0e21e LW |
9277 | set i_neterrno |
9278 | eval $setvar | |
2304df62 AD |
9279 | |
9280 | : get C preprocessor symbols handy | |
9281 | echo " " | |
ecfc5424 | 9282 | $echo $n "Hmm... $c" |
a0d0e21e | 9283 | echo $al | $tr ' ' '\012' >Cppsym.know |
2304df62 AD |
9284 | $cat <<EOSS >Cppsym |
9285 | $startsh | |
9286 | case "\$1" in | |
9287 | -l) list=true | |
9288 | shift | |
9289 | ;; | |
9290 | esac | |
9291 | unknown='' | |
9292 | case "\$list\$#" in | |
9293 | 1|2) | |
9294 | for sym do | |
9295 | if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then | |
9296 | exit 0 | |
9297 | elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then | |
9298 | : | |
9299 | else | |
9300 | unknown="\$unknown \$sym" | |
9301 | fi | |
9302 | done | |
9303 | set X \$unknown | |
9304 | shift | |
9305 | ;; | |
9306 | esac | |
9307 | case \$# in | |
9308 | 0) exit 1;; | |
9309 | esac | |
9310 | echo \$* | $tr ' ' '\012' | $sed -e 's/\(.*\)/\\ | |
9311 | #ifdef \1\\ | |
9312 | exit 0; _ _ _ _\1\\ \1\\ | |
9313 | #endif\\ | |
9314 | /' >Cppsym\$\$ | |
9315 | echo "exit 1; _ _ _" >>Cppsym\$\$ | |
9316 | $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _' >Cppsym2\$\$ | |
9317 | case "\$list" in | |
9318 | true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;; | |
9319 | *) | |
9320 | sh Cppsym2\$\$ | |
9321 | status=\$? | |
9322 | ;; | |
9323 | esac | |
9324 | $rm -f Cppsym\$\$ Cppsym2\$\$ | |
9325 | exit \$status | |
9326 | EOSS | |
9327 | chmod +x Cppsym | |
9328 | $eunicefix Cppsym | |
ecfc5424 AD |
9329 | ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true |
9330 | ||
9331 | : now check the C compiler for additional symbols | |
9332 | $cat >ccsym <<EOS | |
9333 | $startsh | |
9334 | $cat >tmp.c <<EOF | |
9335 | extern int foo; | |
9336 | EOF | |
9337 | for i in \`$cc -v -c tmp.c 2>&1\` | |
9338 | do | |
9339 | case "\$i" in | |
9340 | -D*) echo "\$i" | $sed 's/^-D//';; | |
9341 | -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';; | |
9342 | esac | |
9343 | done | |
9344 | $rm -f try.c | |
9345 | EOS | |
9346 | chmod +x ccsym | |
9347 | $eunicefix ccsym | |
9348 | ./ccsym | $sort | $uniq >ccsym.raw | |
f0b7e567 AD |
9349 | $awk '/\=/ { print $0; next } |
9350 | { print $0"=1" }' ccsym.raw >ccsym.list | |
ecfc5424 AD |
9351 | $awk '{ print $0"=1" }' Cppsym.true >ccsym.true |
9352 | $comm -13 ccsym.true ccsym.list >ccsym.own | |
9353 | $comm -12 ccsym.true ccsym.list >ccsym.com | |
9354 | $comm -23 ccsym.true ccsym.list >ccsym.cpp | |
9355 | also='' | |
9356 | symbols='symbols' | |
9357 | if $test -z ccsym.raw; then | |
9358 | echo "Your C compiler doesn't seem to define any symbol!" >&4 | |
9359 | echo " " | |
9360 | echo "However, your C preprocessor defines the following ones:" | |
9361 | $cat Cppsym.true | |
9362 | else | |
9363 | if $test -s ccsym.com; then | |
9364 | echo "Your C compiler and pre-processor define these symbols:" | |
9365 | $sed -e 's/\(.*\)=.*/\1/' ccsym.com | |
9366 | also='also ' | |
9367 | symbols='ones' | |
9368 | $test "$silent" || sleep 1 | |
9369 | fi | |
9370 | if $test -s ccsym.cpp; then | |
9371 | $test "$also" && echo " " | |
9372 | echo "Your C pre-processor ${also}defines the following $symbols:" | |
9373 | $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp | |
9374 | also='further ' | |
9375 | $test "$silent" || sleep 1 | |
9376 | fi | |
9377 | if $test -s ccsym.own; then | |
9378 | $test "$also" && echo " " | |
9379 | echo "Your C compiler ${also}defines the following cpp variables:" | |
9380 | $sed -e 's/\(.*\)=1/\1/' ccsym.own | |
9381 | $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true | |
9382 | $test "$silent" || sleep 1 | |
9383 | fi | |
9384 | fi | |
9385 | $rm -f ccsym* | |
2304df62 AD |
9386 | |
9387 | : see if this is a termio system | |
9388 | val="$undef" | |
9389 | val2="$undef" | |
9390 | val3="$undef" | |
9391 | if $test `./findhdr termios.h`; then | |
9392 | set tcsetattr i_termios | |
9393 | eval $inlibc | |
9394 | val3="$i_termios" | |
9395 | fi | |
9396 | echo " " | |
9397 | case "$val3" in | |
9398 | "$define") echo "You have POSIX termios.h... good!" >&4;; | |
ecfc5424 | 9399 | *) if ./Cppsym pyr; then |
2304df62 AD |
9400 | case "`/bin/universe`" in |
9401 | ucb) if $test `./findhdr sgtty.h`; then | |
9402 | val2="$define" | |
9403 | echo "<sgtty.h> found." >&4 | |
9404 | else | |
9405 | echo "System is pyramid with BSD universe." | |
9406 | echo "<sgtty.h> not found--you could have problems." >&4 | |
9407 | fi;; | |
9408 | *) if $test `./findhdr termio.h`; then | |
9409 | val="$define" | |
9410 | echo "<termio.h> found." >&4 | |
9411 | else | |
9412 | echo "System is pyramid with USG universe." | |
9413 | echo "<termio.h> not found--you could have problems." >&4 | |
9414 | fi;; | |
9415 | esac | |
ecfc5424 | 9416 | elif ./usg; then |
2304df62 AD |
9417 | if $test `./findhdr termio.h`; then |
9418 | echo "<termio.h> found." >&4 | |
9419 | val="$define" | |
9420 | elif $test `./findhdr sgtty.h`; then | |
9421 | echo "<sgtty.h> found." >&4 | |
9422 | val2="$define" | |
9423 | else | |
9424 | echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4 | |
9425 | fi | |
9426 | else | |
9427 | if $test `./findhdr sgtty.h`; then | |
9428 | echo "<sgtty.h> found." >&4 | |
9429 | val2="$define" | |
9430 | elif $test `./findhdr termio.h`; then | |
9431 | echo "<termio.h> found." >&4 | |
9432 | val="$define" | |
9433 | else | |
9434 | echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4 | |
9435 | fi | |
9436 | fi;; | |
9437 | esac | |
9438 | set i_termio; eval $setvar | |
9439 | val=$val2; set i_sgtty; eval $setvar | |
9440 | val=$val3; set i_termios; eval $setvar | |
9441 | ||
a0d0e21e | 9442 | : see if stdarg is available |
2304df62 | 9443 | echo " " |
a0d0e21e LW |
9444 | if $test `./findhdr stdarg.h`; then |
9445 | echo "<stdarg.h> found." >&4 | |
9446 | valstd="$define" | |
2304df62 | 9447 | else |
a0d0e21e LW |
9448 | echo "<stdarg.h> NOT found." >&4 |
9449 | valstd="$undef" | |
2304df62 | 9450 | fi |
85e6fe83 | 9451 | |
a0d0e21e | 9452 | : see if varags is available |
2304df62 AD |
9453 | echo " " |
9454 | if $test `./findhdr varargs.h`; then | |
2304df62 AD |
9455 | echo "<varargs.h> found." >&4 |
9456 | else | |
2304df62 AD |
9457 | echo "<varargs.h> NOT found, but that's ok (I hope)." >&4 |
9458 | fi | |
2304df62 AD |
9459 | |
9460 | : set up the varargs testing programs | |
9461 | $cat > varargs.c <<EOP | |
9462 | #ifdef I_STDARG | |
9463 | #include <stdarg.h> | |
9464 | #endif | |
9465 | #ifdef I_VARARGS | |
9466 | #include <varargs.h> | |
9467 | #endif | |
9468 | ||
9469 | #ifdef I_STDARG | |
9470 | int f(char *p, ...) | |
9471 | #else | |
9472 | int f(va_alist) | |
9473 | va_dcl | |
9474 | #endif | |
9475 | { | |
9476 | va_list ap; | |
9477 | #ifndef I_STDARG | |
9478 | char *p; | |
9479 | #endif | |
9480 | #ifdef I_STDARG | |
9481 | va_start(ap,p); | |
9482 | #else | |
9483 | va_start(ap); | |
9484 | p = va_arg(ap, char *); | |
9485 | #endif | |
9486 | va_end(ap); | |
9487 | } | |
9488 | EOP | |
9489 | $cat > varargs <<EOP | |
40a7a20a | 9490 | $startsh |
2304df62 AD |
9491 | if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then |
9492 | echo "true" | |
9493 | else | |
9494 | echo "false" | |
9495 | fi | |
9496 | $rm -f varargs.o | |
9497 | EOP | |
9498 | chmod +x varargs | |
9499 | ||
9500 | : now check which varargs header should be included | |
9501 | echo " " | |
9502 | i_varhdr='' | |
a0d0e21e | 9503 | case "$valstd" in |
2304df62 AD |
9504 | "$define") |
9505 | if `./varargs I_STDARG`; then | |
a0d0e21e | 9506 | val='stdarg.h' |
2304df62 | 9507 | elif `./varargs I_VARARGS`; then |
a0d0e21e | 9508 | val='varargs.h' |
2304df62 AD |
9509 | fi |
9510 | ;; | |
9511 | *) | |
9512 | if `./varargs I_VARARGS`; then | |
a0d0e21e | 9513 | val='varargs.h' |
2304df62 AD |
9514 | fi |
9515 | ;; | |
9516 | esac | |
a0d0e21e | 9517 | case "$val" in |
2304df62 AD |
9518 | '') |
9519 | echo "I could not find the definition for va_dcl... You have problems..." >&4 | |
a0d0e21e LW |
9520 | val="$undef"; set i_stdarg; eval $setvar |
9521 | val="$undef"; set i_varargs; eval $setvar | |
2304df62 | 9522 | ;; |
a0d0e21e LW |
9523 | *) |
9524 | set i_varhdr | |
9525 | eval $setvar | |
9526 | case "$i_varhdr" in | |
9527 | stdarg.h) | |
9528 | val="$define"; set i_stdarg; eval $setvar | |
9529 | val="$undef"; set i_varargs; eval $setvar | |
9530 | ;; | |
9531 | varargs.h) | |
9532 | val="$undef"; set i_stdarg; eval $setvar | |
9533 | val="$define"; set i_varargs; eval $setvar | |
9534 | ;; | |
9535 | esac | |
9536 | echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;; | |
2304df62 AD |
9537 | esac |
9538 | $rm -f varargs* | |
9539 | ||
a0d0e21e LW |
9540 | : see if stddef is available |
9541 | set stddef.h i_stddef | |
9542 | eval $inhdr | |
9543 | ||
a0d0e21e LW |
9544 | : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl |
9545 | set sys/filio.h i_sysfilio | |
9546 | eval $inhdr | |
9547 | echo " " | |
9548 | if $test `./findhdr sys/ioctl.h`; then | |
9549 | val="$define" | |
9550 | echo '<sys/ioctl.h> found.' >&4 | |
9551 | else | |
9552 | val="$undef" | |
9553 | if $test $i_sysfilio = "$define"; then | |
9554 | echo '<sys/ioctl.h> NOT found.' >&4 | |
9555 | else | |
9556 | $test $i_sgtty = "$define" && xxx="sgtty.h" | |
9557 | $test $i_termio = "$define" && xxx="termio.h" | |
9558 | $test $i_termios = "$define" && xxx="termios.h" | |
9559 | echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4 | |
9560 | fi | |
9561 | fi | |
9562 | set i_sysioctl | |
9563 | eval $setvar | |
9564 | ||
9565 | : see if this is a sys/param system | |
9566 | set sys/param.h i_sysparam | |
9567 | eval $inhdr | |
9568 | ||
8ff267be | 9569 | : see if sys/resource.h has to be included |
9570 | set sys/resource.h i_sysresrc | |
9571 | eval $inhdr | |
9572 | ||
1aef975c AD |
9573 | : see if sys/stat.h is available |
9574 | set sys/stat.h i_sysstat | |
9575 | eval $inhdr | |
9576 | ||
fed7345c AD |
9577 | : see if sys/types.h has to be included |
9578 | set sys/types.h i_systypes | |
9579 | eval $inhdr | |
9580 | ||
25f94b33 AD |
9581 | : see if this is a sys/un.h system |
9582 | set sys/un.h i_sysun | |
9583 | eval $inhdr | |
9584 | ||
8ff267be | 9585 | : see if this is a syswait system |
9586 | set sys/wait.h i_syswait | |
a0d0e21e LW |
9587 | eval $inhdr |
9588 | ||
9589 | : see if this is an utime system | |
9590 | set utime.h i_utime | |
9591 | eval $inhdr | |
9592 | ||
760ac839 LW |
9593 | : see if this is a values.h system |
9594 | set values.h i_values | |
9595 | eval $inhdr | |
9596 | ||
2304df62 | 9597 | : see if this is a vfork system |
85e6fe83 | 9598 | case "$d_vfork" in |
a0d0e21e LW |
9599 | "$define") |
9600 | set vfork.h i_vfork | |
85e6fe83 LW |
9601 | eval $inhdr |
9602 | ;; | |
a0d0e21e LW |
9603 | *) |
9604 | i_vfork="$undef" | |
9605 | ;; | |
85e6fe83 | 9606 | esac |
a0d0e21e | 9607 | |
4633a7c4 LW |
9608 | : see if gdbm.h is available |
9609 | set gdbm.h t_gdbm | |
9610 | eval $inhdr | |
9611 | case "$t_gdbm" in | |
9612 | $define) | |
9613 | : see if gdbm_open exists | |
9614 | set gdbm_open d_gdbm_open | |
9615 | eval $inlibc | |
9616 | case "$d_gdbm_open" in | |
9617 | $undef) | |
9618 | t_gdbm="$undef" | |
9619 | echo "We won't be including <gdbm.h>" | |
9620 | ;; | |
9621 | esac | |
9622 | ;; | |
9623 | esac | |
9624 | val="$t_gdbm" | |
9625 | set i_gdbm | |
9626 | eval $setvar | |
9627 | ||
9628 | echo " " | |
9629 | echo "Looking for extensions..." >&4 | |
9630 | cd ../ext | |
9631 | : If we are using the old config.sh, known_extensions may contain | |
9632 | : old or inaccurate or duplicate values. | |
9633 | known_extensions='' | |
9634 | : We do not use find because it might not be available. | |
9635 | : We do not just use MANIFEST because the user may have dropped | |
9636 | : some additional extensions into the source tree and expect them | |
9637 | : to be built. | |
9638 | for xxx in * ; do | |
5f05dabc | 9639 | case "$xxx" in |
9640 | DynaLoader) ;; | |
9641 | *) if $test -f $xxx/$xxx.xs; then | |
9642 | known_extensions="$known_extensions $xxx" | |
9643 | else | |
9644 | if $test -d $xxx; then | |
9645 | cd $xxx | |
9646 | for yyy in * ; do | |
9647 | if $test -f $yyy/$yyy.xs; then | |
9648 | known_extensions="$known_extensions $xxx/$yyy" | |
9649 | fi | |
9650 | done | |
9651 | cd .. | |
9652 | fi | |
9653 | fi ;; | |
9654 | esac | |
4633a7c4 LW |
9655 | done |
9656 | set X $known_extensions | |
9657 | shift | |
9658 | known_extensions="$*" | |
9659 | cd ../UU | |
9660 | ||
9661 | : Now see which are supported on this system. | |
9662 | avail_ext='' | |
9663 | for xxx in $known_extensions ; do | |
9664 | case "$xxx" in | |
9665 | DB_File) case "$i_db" in | |
9666 | $define) avail_ext="$avail_ext $xxx" ;; | |
9667 | esac | |
9668 | ;; | |
9669 | GDBM_File) case "$i_gdbm" in | |
9670 | $define) avail_ext="$avail_ext $xxx" ;; | |
9671 | esac | |
9672 | ;; | |
9673 | NDBM_File) case "$i_ndbm" in | |
9674 | $define) avail_ext="$avail_ext $xxx" ;; | |
9675 | esac | |
9676 | ;; | |
9677 | ODBM_File) case "${i_dbm}${i_rpcsvcdbm}" in | |
9678 | *"${define}"*) avail_ext="$avail_ext $xxx" ;; | |
9679 | esac | |
9680 | ;; | |
9681 | POSIX) case "$useposix" in | |
9682 | true|define|y) avail_ext="$avail_ext $xxx" ;; | |
9683 | esac | |
9684 | ;; | |
8ff267be | 9685 | Opcode) case "$useopcode" in |
2c7991dc | 9686 | true|define|y) avail_ext="$avail_ext $xxx" ;; |
9687 | esac | |
9688 | ;; | |
4633a7c4 LW |
9689 | Socket) case "$d_socket" in |
9690 | $define) avail_ext="$avail_ext $xxx" ;; | |
9691 | esac | |
9692 | ;; | |
9693 | *) avail_ext="$avail_ext $xxx" | |
9694 | ;; | |
9695 | esac | |
9696 | done | |
9697 | ||
9698 | set X $avail_ext | |
9699 | shift | |
9700 | avail_ext="$*" | |
9701 | ||
9702 | case $usedl in | |
9703 | $define) | |
9704 | $cat <<EOM | |
9705 | A number of extensions are supplied with $package. You may choose to | |
9706 | compile these extensions for dynamic loading (the default), compile | |
9707 | them into the $package executable (static loading), or not include | |
9708 | them at all. Answer "none" to include no extensions. | |
9709 | ||
9710 | EOM | |
9711 | case "$dynamic_ext" in | |
9712 | '') dflt="$avail_ext" ;; | |
9713 | *) dflt="$dynamic_ext" ;; | |
9714 | esac | |
9715 | case "$dflt" in | |
9716 | '') dflt=none;; | |
9717 | esac | |
9718 | rp="What extensions do you wish to load dynamically?" | |
9719 | . ./myread | |
9720 | case "$ans" in | |
9721 | none) dynamic_ext=' ' ;; | |
9722 | *) dynamic_ext="$ans" ;; | |
9723 | esac | |
9724 | ||
9725 | case "$static_ext" in | |
9726 | '') | |
9727 | : Exclude those already listed in dynamic linking | |
9728 | dflt='' | |
9729 | for xxx in $avail_ext; do | |
9730 | case " $dynamic_ext " in | |
9731 | *" $xxx "*) ;; | |
9732 | *) dflt="$dflt $xxx" ;; | |
9733 | esac | |
9734 | done | |
9735 | set X $dflt | |
9736 | shift | |
9737 | dflt="$*" | |
9738 | ;; | |
9739 | *) dflt="$static_ext" | |
9740 | ;; | |
9741 | esac | |
9742 | ||
9743 | case "$dflt" in | |
9744 | '') dflt=none;; | |
9745 | esac | |
9746 | rp="What extensions do you wish to load statically?" | |
9747 | . ./myread | |
9748 | case "$ans" in | |
9749 | none) static_ext=' ' ;; | |
9750 | *) static_ext="$ans" ;; | |
9751 | esac | |
9752 | ;; | |
9753 | *) | |
9754 | $cat <<EOM | |
9755 | A number of extensions are supplied with $package. Answer "none" | |
9756 | to include no extensions. | |
9757 | ||
9758 | EOM | |
9759 | case "$static_ext" in | |
9760 | '') dflt="$avail_ext" ;; | |
9761 | *) dflt="$static_ext" ;; | |
9762 | esac | |
9763 | ||
9764 | case "$dflt" in | |
9765 | '') dflt=none;; | |
9766 | esac | |
9767 | rp="What extensions do you wish to include?" | |
9768 | . ./myread | |
9769 | case "$ans" in | |
9770 | none) static_ext=' ' ;; | |
9771 | *) static_ext="$ans" ;; | |
9772 | esac | |
9773 | ;; | |
9774 | esac | |
9775 | ||
9776 | set X $dynamic_ext $static_ext | |
9777 | shift | |
9778 | extensions="$*" | |
9779 | ||
16d20bd9 AD |
9780 | : Remove build directory name from cppstdin so it can be used from |
9781 | : either the present location or the final installed location. | |
9782 | echo " " | |
9783 | : Get out of the UU directory to get correct path name. | |
9784 | cd .. | |
9785 | case "$cppstdin" in | |
9786 | `pwd`/cppstdin) | |
9787 | echo "Stripping down cppstdin path name" | |
9788 | cppstdin=cppstdin | |
9789 | ;; | |
9790 | esac | |
9791 | cd UU | |
9792 | ||
2304df62 AD |
9793 | : end of configuration questions |
9794 | echo " " | |
9795 | echo "End of configuration questions." | |
9796 | echo " " | |
9797 | ||
9798 | : back to where it started | |
9799 | if test -d ../UU; then | |
9800 | cd .. | |
9801 | fi | |
9802 | ||
9803 | : configuration may be patched via a 'config.over' file | |
9804 | if $test -f config.over; then | |
9805 | echo " " | |
9806 | dflt=y | |
9807 | rp='I see a config.over file. Do you wish to load it?' | |
9808 | . UU/myread | |
9809 | case "$ans" in | |
9810 | n*) echo "OK, I'll ignore it.";; | |
9811 | *) . ./config.over | |
9812 | echo "Configuration override changes have been loaded." | |
9813 | ;; | |
9814 | esac | |
9815 | fi | |
9816 | ||
ecfc5424 AD |
9817 | : in case they want portability, strip down executable paths |
9818 | case "$d_portable" in | |
9819 | "$define") | |
9820 | echo " " | |
9821 | echo "Stripping down executable paths..." >&4 | |
9822 | for file in $loclist $trylist; do | |
9823 | eval $file="\$file" | |
9824 | done | |
9825 | ;; | |
9826 | esac | |
9827 | ||
2304df62 AD |
9828 | : create config.sh file |
9829 | echo " " | |
9830 | echo "Creating config.sh..." >&4 | |
9831 | $spitshell <<EOT >config.sh | |
9832 | $startsh | |
9833 | # | |
9834 | # This file was produced by running the Configure script. It holds all the | |
9835 | # definitions figured out by Configure. Should you modify one of these values, | |
9836 | # do not forget to propagate your changes by running "Configure -der". You may | |
9837 | # instead choose to run each of the .SH files by yourself, or "Configure -S". | |
9838 | # | |
9839 | ||
9840 | # Configuration time: $cf_time | |
9841 | # Configured by: $cf_by | |
9842 | # Target system: $myuname | |
9843 | ||
2304df62 AD |
9844 | Author='$Author' |
9845 | Date='$Date' | |
9846 | Header='$Header' | |
9847 | Id='$Id' | |
9848 | Locker='$Locker' | |
9849 | Log='$Log' | |
ecfc5424 | 9850 | Mcc='$Mcc' |
2304df62 AD |
9851 | RCSfile='$RCSfile' |
9852 | Revision='$Revision' | |
9853 | Source='$Source' | |
9854 | State='$State' | |
9855 | afs='$afs' | |
a0d0e21e | 9856 | alignbytes='$alignbytes' |
ecfc5424 | 9857 | aphostname='$aphostname' |
4633a7c4 | 9858 | ar='$ar' |
a0d0e21e LW |
9859 | archlib='$archlib' |
9860 | archlibexp='$archlibexp' | |
9861 | archname='$archname' | |
4633a7c4 | 9862 | archobjs='$archobjs' |
ecfc5424 AD |
9863 | awk='$awk' |
9864 | baserev='$baserev' | |
9865 | bash='$bash' | |
2304df62 | 9866 | bin='$bin' |
5f05dabc | 9867 | bincompat3='$bincompat3' |
2304df62 | 9868 | binexp='$binexp' |
ecfc5424 AD |
9869 | bison='$bison' |
9870 | byacc='$byacc' | |
2304df62 | 9871 | byteorder='$byteorder' |
ecfc5424 AD |
9872 | c='$c' |
9873 | castflags='$castflags' | |
9874 | cat='$cat' | |
2304df62 | 9875 | cc='$cc' |
ecfc5424 AD |
9876 | cccdlflags='$cccdlflags' |
9877 | ccdlflags='$ccdlflags' | |
2304df62 | 9878 | ccflags='$ccflags' |
2304df62 | 9879 | cf_by='$cf_by' |
8e07c86e | 9880 | cf_email='$cf_email' |
2304df62 | 9881 | cf_time='$cf_time' |
ecfc5424 AD |
9882 | chgrp='$chgrp' |
9883 | chmod='$chmod' | |
9884 | chown='$chown' | |
9885 | clocktype='$clocktype' | |
9886 | comm='$comm' | |
9887 | compress='$compress' | |
2304df62 | 9888 | contains='$contains' |
ecfc5424 AD |
9889 | cp='$cp' |
9890 | cpio='$cpio' | |
9891 | cpp='$cpp' | |
a0d0e21e | 9892 | cpp_stuff='$cpp_stuff' |
ecfc5424 | 9893 | cppflags='$cppflags' |
2304df62 AD |
9894 | cpplast='$cpplast' |
9895 | cppminus='$cppminus' | |
9896 | cpprun='$cpprun' | |
9897 | cppstdin='$cppstdin' | |
ecfc5424 AD |
9898 | cryptlib='$cryptlib' |
9899 | csh='$csh' | |
9900 | d_Gconvert='$d_Gconvert' | |
2304df62 | 9901 | d_access='$d_access' |
a0d0e21e | 9902 | d_alarm='$d_alarm' |
ecfc5424 AD |
9903 | d_archlib='$d_archlib' |
9904 | d_attribut='$d_attribut' | |
2304df62 AD |
9905 | d_bcmp='$d_bcmp' |
9906 | d_bcopy='$d_bcopy' | |
5f05dabc | 9907 | d_bincompat3='$d_bincompat3' |
ecfc5424 | 9908 | d_bsd='$d_bsd' |
2afac517 | 9909 | d_bsdgetpgrp='$d_bsdgetpgrp' |
ecfc5424 | 9910 | d_bsdpgrp='$d_bsdpgrp' |
2afac517 | 9911 | d_bsdsetpgrp='$d_bsdsetpgrp' |
2304df62 AD |
9912 | d_bzero='$d_bzero' |
9913 | d_casti32='$d_casti32' | |
2304df62 | 9914 | d_castneg='$d_castneg' |
ecfc5424 | 9915 | d_charvspr='$d_charvspr' |
a0d0e21e LW |
9916 | d_chown='$d_chown' |
9917 | d_chroot='$d_chroot' | |
2304df62 | 9918 | d_chsize='$d_chsize' |
a0d0e21e | 9919 | d_closedir='$d_closedir' |
2304df62 | 9920 | d_const='$d_const' |
2304df62 AD |
9921 | d_crypt='$d_crypt' |
9922 | d_csh='$d_csh' | |
a0d0e21e LW |
9923 | d_cuserid='$d_cuserid' |
9924 | d_dbl_dig='$d_dbl_dig' | |
9925 | d_difftime='$d_difftime' | |
ecfc5424 | 9926 | d_dirnamlen='$d_dirnamlen' |
a0d0e21e LW |
9927 | d_dlerror='$d_dlerror' |
9928 | d_dlopen='$d_dlopen' | |
9929 | d_dlsymun='$d_dlsymun' | |
2304df62 AD |
9930 | d_dosuid='$d_dosuid' |
9931 | d_dup2='$d_dup2' | |
8e07c86e | 9932 | d_eofnblk='$d_eofnblk' |
40a7a20a | 9933 | d_eunice='$d_eunice' |
2304df62 AD |
9934 | d_fchmod='$d_fchmod' |
9935 | d_fchown='$d_fchown' | |
9936 | d_fcntl='$d_fcntl' | |
a0d0e21e LW |
9937 | d_fd_macros='$d_fd_macros' |
9938 | d_fd_set='$d_fd_set' | |
9939 | d_fds_bits='$d_fds_bits' | |
9940 | d_fgetpos='$d_fgetpos' | |
2304df62 AD |
9941 | d_flexfnam='$d_flexfnam' |
9942 | d_flock='$d_flock' | |
a0d0e21e | 9943 | d_fork='$d_fork' |
ecfc5424 | 9944 | d_fpathconf='$d_fpathconf' |
a0d0e21e | 9945 | d_fsetpos='$d_fsetpos' |
5f05dabc | 9946 | d_ftime='$d_ftime' |
2304df62 AD |
9947 | d_getgrps='$d_getgrps' |
9948 | d_gethent='$d_gethent' | |
2304df62 | 9949 | d_gethname='$d_gethname' |
a0d0e21e | 9950 | d_getlogin='$d_getlogin' |
2afac517 | 9951 | d_getpgid='$d_getpgid' |
2304df62 AD |
9952 | d_getpgrp2='$d_getpgrp2' |
9953 | d_getpgrp='$d_getpgrp' | |
a0d0e21e | 9954 | d_getppid='$d_getppid' |
2304df62 | 9955 | d_getprior='$d_getprior' |
5f05dabc | 9956 | d_gettimeod='$d_gettimeod' |
a4f3eea9 | 9957 | d_gnulibc='$d_gnulibc' |
2304df62 | 9958 | d_htonl='$d_htonl' |
ecfc5424 | 9959 | d_index='$d_index' |
7e1af8bc | 9960 | d_inetaton='$d_inetaton' |
2304df62 AD |
9961 | d_isascii='$d_isascii' |
9962 | d_killpg='$d_killpg' | |
9963 | d_link='$d_link' | |
a0d0e21e LW |
9964 | d_locconv='$d_locconv' |
9965 | d_lockf='$d_lockf' | |
2304df62 | 9966 | d_lstat='$d_lstat' |
a0d0e21e LW |
9967 | d_mblen='$d_mblen' |
9968 | d_mbstowcs='$d_mbstowcs' | |
9969 | d_mbtowc='$d_mbtowc' | |
2304df62 AD |
9970 | d_memcmp='$d_memcmp' |
9971 | d_memcpy='$d_memcpy' | |
9972 | d_memmove='$d_memmove' | |
9973 | d_memset='$d_memset' | |
9974 | d_mkdir='$d_mkdir' | |
a0d0e21e LW |
9975 | d_mkfifo='$d_mkfifo' |
9976 | d_mktime='$d_mktime' | |
2304df62 AD |
9977 | d_msg='$d_msg' |
9978 | d_msgctl='$d_msgctl' | |
9979 | d_msgget='$d_msgget' | |
9980 | d_msgrcv='$d_msgrcv' | |
9981 | d_msgsnd='$d_msgsnd' | |
ecfc5424 | 9982 | d_mymalloc='$d_mymalloc' |
a0d0e21e | 9983 | d_nice='$d_nice' |
4633a7c4 | 9984 | d_oldarchlib='$d_oldarchlib' |
ecfc5424 | 9985 | d_oldsock='$d_oldsock' |
2304df62 | 9986 | d_open3='$d_open3' |
a0d0e21e LW |
9987 | d_pathconf='$d_pathconf' |
9988 | d_pause='$d_pause' | |
ecfc5424 | 9989 | d_phostname='$d_phostname' |
a0d0e21e | 9990 | d_pipe='$d_pipe' |
8e07c86e | 9991 | d_poll='$d_poll' |
2304df62 | 9992 | d_portable='$d_portable' |
ecfc5424 AD |
9993 | d_pwage='$d_pwage' |
9994 | d_pwchange='$d_pwchange' | |
9995 | d_pwclass='$d_pwclass' | |
9996 | d_pwcomment='$d_pwcomment' | |
9997 | d_pwexpire='$d_pwexpire' | |
9998 | d_pwquota='$d_pwquota' | |
2304df62 | 9999 | d_readdir='$d_readdir' |
a0d0e21e | 10000 | d_readlink='$d_readlink' |
2304df62 | 10001 | d_rename='$d_rename' |
ecfc5424 | 10002 | d_rewinddir='$d_rewinddir' |
2304df62 AD |
10003 | d_rmdir='$d_rmdir' |
10004 | d_safebcpy='$d_safebcpy' | |
10005 | d_safemcpy='$d_safemcpy' | |
36477c24 | 10006 | d_sanemcmp='$d_sanemcmp' |
ecfc5424 | 10007 | d_seekdir='$d_seekdir' |
2304df62 AD |
10008 | d_select='$d_select' |
10009 | d_sem='$d_sem' | |
10010 | d_semctl='$d_semctl' | |
10011 | d_semget='$d_semget' | |
10012 | d_semop='$d_semop' | |
10013 | d_setegid='$d_setegid' | |
10014 | d_seteuid='$d_seteuid' | |
a0d0e21e | 10015 | d_setlinebuf='$d_setlinebuf' |
2304df62 AD |
10016 | d_setlocale='$d_setlocale' |
10017 | d_setpgid='$d_setpgid' | |
10018 | d_setpgrp2='$d_setpgrp2' | |
2304df62 AD |
10019 | d_setpgrp='$d_setpgrp' |
10020 | d_setprior='$d_setprior' | |
10021 | d_setregid='$d_setregid' | |
10022 | d_setresgid='$d_setresgid' | |
10023 | d_setresuid='$d_setresuid' | |
10024 | d_setreuid='$d_setreuid' | |
10025 | d_setrgid='$d_setrgid' | |
10026 | d_setruid='$d_setruid' | |
10027 | d_setsid='$d_setsid' | |
760ac839 | 10028 | d_sfio='$d_sfio' |
2304df62 AD |
10029 | d_shm='$d_shm' |
10030 | d_shmat='$d_shmat' | |
a0d0e21e | 10031 | d_shmatprototype='$d_shmatprototype' |
2304df62 AD |
10032 | d_shmctl='$d_shmctl' |
10033 | d_shmdt='$d_shmdt' | |
10034 | d_shmget='$d_shmget' | |
2c7991dc | 10035 | d_sigaction='$d_sigaction' |
a5f75d66 | 10036 | d_sigsetjmp='$d_sigsetjmp' |
2304df62 AD |
10037 | d_socket='$d_socket' |
10038 | d_sockpair='$d_sockpair' | |
2304df62 | 10039 | d_statblks='$d_statblks' |
c2960299 AD |
10040 | d_stdio_cnt_lval='$d_stdio_cnt_lval' |
10041 | d_stdio_ptr_lval='$d_stdio_ptr_lval' | |
16d20bd9 | 10042 | d_stdiobase='$d_stdiobase' |
2304df62 | 10043 | d_stdstdio='$d_stdstdio' |
2304df62 | 10044 | d_strchr='$d_strchr' |
a0d0e21e | 10045 | d_strcoll='$d_strcoll' |
2304df62 AD |
10046 | d_strctcpy='$d_strctcpy' |
10047 | d_strerrm='$d_strerrm' | |
10048 | d_strerror='$d_strerror' | |
a89d8a78 DH |
10049 | d_strtod='$d_strtod' |
10050 | d_strtol='$d_strtol' | |
10051 | d_strtoul='$d_strtoul' | |
a0d0e21e | 10052 | d_strxfrm='$d_strxfrm' |
ecfc5424 | 10053 | d_suidsafe='$d_suidsafe' |
2304df62 AD |
10054 | d_symlink='$d_symlink' |
10055 | d_syscall='$d_syscall' | |
a0d0e21e | 10056 | d_sysconf='$d_sysconf' |
ecfc5424 AD |
10057 | d_sysernlst='$d_sysernlst' |
10058 | d_syserrlst='$d_syserrlst' | |
2304df62 | 10059 | d_system='$d_system' |
a0d0e21e LW |
10060 | d_tcgetpgrp='$d_tcgetpgrp' |
10061 | d_tcsetpgrp='$d_tcsetpgrp' | |
ecfc5424 | 10062 | d_telldir='$d_telldir' |
85e6fe83 | 10063 | d_time='$d_time' |
2304df62 AD |
10064 | d_times='$d_times' |
10065 | d_truncate='$d_truncate' | |
a0d0e21e LW |
10066 | d_tzname='$d_tzname' |
10067 | d_umask='$d_umask' | |
ecfc5424 | 10068 | d_uname='$d_uname' |
2304df62 | 10069 | d_vfork='$d_vfork' |
ecfc5424 | 10070 | d_void_closedir='$d_void_closedir' |
2304df62 | 10071 | d_voidsig='$d_voidsig' |
ecfc5424 | 10072 | d_voidtty='$d_voidtty' |
2304df62 | 10073 | d_volatile='$d_volatile' |
2304df62 AD |
10074 | d_vprintf='$d_vprintf' |
10075 | d_wait4='$d_wait4' | |
10076 | d_waitpid='$d_waitpid' | |
a0d0e21e LW |
10077 | d_wcstombs='$d_wcstombs' |
10078 | d_wctomb='$d_wctomb' | |
ecfc5424 AD |
10079 | d_xenix='$d_xenix' |
10080 | date='$date' | |
10081 | db_hashtype='$db_hashtype' | |
10082 | db_prefixtype='$db_prefixtype' | |
10083 | defvoidused='$defvoidused' | |
10084 | direntrytype='$direntrytype' | |
a0d0e21e | 10085 | dlext='$dlext' |
2304df62 | 10086 | dlsrc='$dlsrc' |
ecfc5424 | 10087 | dynamic_ext='$dynamic_ext' |
8e07c86e | 10088 | eagain='$eagain' |
ecfc5424 AD |
10089 | echo='$echo' |
10090 | egrep='$egrep' | |
10091 | emacs='$emacs' | |
10092 | eunicefix='$eunicefix' | |
4633a7c4 | 10093 | exe_ext='$exe_ext' |
ecfc5424 AD |
10094 | expr='$expr' |
10095 | extensions='$extensions' | |
10096 | find='$find' | |
4633a7c4 | 10097 | firstmakefile='$firstmakefile' |
ecfc5424 | 10098 | flex='$flex' |
a0d0e21e | 10099 | fpostype='$fpostype' |
94b6baf5 | 10100 | freetype='$freetype' |
1aef975c AD |
10101 | full_csh='$full_csh' |
10102 | full_sed='$full_sed' | |
ecfc5424 AD |
10103 | gcc='$gcc' |
10104 | gccversion='$gccversion' | |
2304df62 | 10105 | gidtype='$gidtype' |
ecfc5424 AD |
10106 | glibpth='$glibpth' |
10107 | grep='$grep' | |
10108 | groupcat='$groupcat' | |
2304df62 | 10109 | groupstype='$groupstype' |
8ff267be | 10110 | gzip='$gzip' |
2304df62 AD |
10111 | h_fcntl='$h_fcntl' |
10112 | h_sysfile='$h_sysfile' | |
ecfc5424 AD |
10113 | hint='$hint' |
10114 | hostcat='$hostcat' | |
10115 | huge='$huge' | |
10116 | i_bsdioctl='$i_bsdioctl' | |
a0d0e21e | 10117 | i_db='$i_db' |
2304df62 | 10118 | i_dbm='$i_dbm' |
2304df62 | 10119 | i_dirent='$i_dirent' |
a0d0e21e | 10120 | i_dld='$i_dld' |
2304df62 AD |
10121 | i_dlfcn='$i_dlfcn' |
10122 | i_fcntl='$i_fcntl' | |
a0d0e21e | 10123 | i_float='$i_float' |
2304df62 AD |
10124 | i_gdbm='$i_gdbm' |
10125 | i_grp='$i_grp' | |
a0d0e21e | 10126 | i_limits='$i_limits' |
4633a7c4 | 10127 | i_locale='$i_locale' |
a0d0e21e LW |
10128 | i_malloc='$i_malloc' |
10129 | i_math='$i_math' | |
85e6fe83 | 10130 | i_memory='$i_memory' |
2304df62 | 10131 | i_ndbm='$i_ndbm' |
85e6fe83 | 10132 | i_neterrno='$i_neterrno' |
2304df62 | 10133 | i_niin='$i_niin' |
2304df62 | 10134 | i_pwd='$i_pwd' |
8e07c86e | 10135 | i_rpcsvcdbm='$i_rpcsvcdbm' |
760ac839 | 10136 | i_sfio='$i_sfio' |
ecfc5424 AD |
10137 | i_sgtty='$i_sgtty' |
10138 | i_stdarg='$i_stdarg' | |
2304df62 | 10139 | i_stddef='$i_stddef' |
a0d0e21e | 10140 | i_stdlib='$i_stdlib' |
2304df62 | 10141 | i_string='$i_string' |
2304df62 AD |
10142 | i_sysdir='$i_sysdir' |
10143 | i_sysfile='$i_sysfile' | |
a0d0e21e | 10144 | i_sysfilio='$i_sysfilio' |
ecfc5424 | 10145 | i_sysin='$i_sysin' |
2304df62 | 10146 | i_sysioctl='$i_sysioctl' |
2304df62 | 10147 | i_sysndir='$i_sysndir' |
a0d0e21e | 10148 | i_sysparam='$i_sysparam' |
8ff267be | 10149 | i_sysresrc='$i_sysresrc' |
2304df62 | 10150 | i_sysselct='$i_sysselct' |
ecfc5424 | 10151 | i_syssockio='$i_syssockio' |
1aef975c | 10152 | i_sysstat='$i_sysstat' |
ecfc5424 AD |
10153 | i_systime='$i_systime' |
10154 | i_systimek='$i_systimek' | |
a0d0e21e | 10155 | i_systimes='$i_systimes' |
fed7345c | 10156 | i_systypes='$i_systypes' |
25f94b33 | 10157 | i_sysun='$i_sysun' |
8ff267be | 10158 | i_syswait='$i_syswait' |
2304df62 AD |
10159 | i_termio='$i_termio' |
10160 | i_termios='$i_termios' | |
2304df62 | 10161 | i_time='$i_time' |
85e6fe83 | 10162 | i_unistd='$i_unistd' |
2304df62 | 10163 | i_utime='$i_utime' |
760ac839 | 10164 | i_values='$i_values' |
2304df62 AD |
10165 | i_varargs='$i_varargs' |
10166 | i_varhdr='$i_varhdr' | |
10167 | i_vfork='$i_vfork' | |
ecfc5424 AD |
10168 | incpath='$incpath' |
10169 | inews='$inews' | |
10170 | installarchlib='$installarchlib' | |
10171 | installbin='$installbin' | |
16d20bd9 AD |
10172 | installman1dir='$installman1dir' |
10173 | installman3dir='$installman3dir' | |
ecfc5424 AD |
10174 | installprivlib='$installprivlib' |
10175 | installscript='$installscript' | |
4633a7c4 | 10176 | installsitearch='$installsitearch' |
25f94b33 | 10177 | installsitelib='$installsitelib' |
2304df62 | 10178 | intsize='$intsize' |
ecfc5424 AD |
10179 | known_extensions='$known_extensions' |
10180 | ksh='$ksh' | |
10181 | large='$large' | |
232e078e | 10182 | ld='$ld' |
ecfc5424 AD |
10183 | lddlflags='$lddlflags' |
10184 | ldflags='$ldflags' | |
10185 | less='$less' | |
4633a7c4 | 10186 | lib_ext='$lib_ext' |
2304df62 | 10187 | libc='$libc' |
8ff267be | 10188 | libperl='$libperl' |
2304df62 | 10189 | libpth='$libpth' |
2304df62 | 10190 | libs='$libs' |
ecfc5424 AD |
10191 | libswanted='$libswanted' |
10192 | line='$line' | |
10193 | lint='$lint' | |
10194 | lkflags='$lkflags' | |
10195 | ln='$ln' | |
85e6fe83 | 10196 | lns='$lns' |
8e07c86e AD |
10197 | locincpth='$locincpth' |
10198 | loclibpth='$loclibpth' | |
ecfc5424 AD |
10199 | lp='$lp' |
10200 | lpr='$lpr' | |
10201 | ls='$ls' | |
85e6fe83 | 10202 | lseektype='$lseektype' |
ecfc5424 AD |
10203 | mail='$mail' |
10204 | mailx='$mailx' | |
10205 | make='$make' | |
8ff267be | 10206 | make_set_make='$make_set_make' |
2304df62 AD |
10207 | mallocobj='$mallocobj' |
10208 | mallocsrc='$mallocsrc' | |
10209 | malloctype='$malloctype' | |
16d20bd9 AD |
10210 | man1dir='$man1dir' |
10211 | man1direxp='$man1direxp' | |
10212 | man1ext='$man1ext' | |
10213 | man3dir='$man3dir' | |
10214 | man3direxp='$man3direxp' | |
10215 | man3ext='$man3ext' | |
2304df62 | 10216 | medium='$medium' |
ecfc5424 AD |
10217 | mips='$mips' |
10218 | mips_type='$mips_type' | |
10219 | mkdir='$mkdir' | |
2304df62 | 10220 | models='$models' |
a0d0e21e | 10221 | modetype='$modetype' |
ecfc5424 AD |
10222 | more='$more' |
10223 | mv='$mv' | |
40000a8c | 10224 | myarchname='$myarchname' |
2304df62 AD |
10225 | mydomain='$mydomain' |
10226 | myhostname='$myhostname' | |
ecfc5424 | 10227 | myuname='$myuname' |
2304df62 | 10228 | n='$n' |
ecfc5424 | 10229 | nm_opt='$nm_opt' |
40a7a20a | 10230 | nm_so_opt='$nm_so_opt' |
ecfc5424 | 10231 | nroff='$nroff' |
8e07c86e | 10232 | o_nonblock='$o_nonblock' |
4633a7c4 LW |
10233 | obj_ext='$obj_ext' |
10234 | oldarchlib='$oldarchlib' | |
10235 | oldarchlibexp='$oldarchlibexp' | |
ecfc5424 | 10236 | optimize='$optimize' |
85e6fe83 | 10237 | orderlib='$orderlib' |
ecfc5424 AD |
10238 | osname='$osname' |
10239 | osvers='$osvers' | |
2304df62 | 10240 | package='$package' |
2c7991dc | 10241 | pager='$pager' |
ecfc5424 AD |
10242 | passcat='$passcat' |
10243 | patchlevel='$patchlevel' | |
4633a7c4 | 10244 | path_sep='$path_sep' |
ecfc5424 | 10245 | perl='$perl' |
8e07c86e | 10246 | perladmin='$perladmin' |
4633a7c4 | 10247 | perlpath='$perlpath' |
ecfc5424 AD |
10248 | pg='$pg' |
10249 | phostname='$phostname' | |
10250 | plibpth='$plibpth' | |
10251 | pmake='$pmake' | |
10252 | pr='$pr' | |
a0d0e21e | 10253 | prefix='$prefix' |
1aef975c | 10254 | prefixexp='$prefixexp' |
2304df62 AD |
10255 | privlib='$privlib' |
10256 | privlibexp='$privlibexp' | |
10257 | prototype='$prototype' | |
10258 | randbits='$randbits' | |
ecfc5424 | 10259 | ranlib='$ranlib' |
8e07c86e | 10260 | rd_nodata='$rd_nodata' |
ecfc5424 AD |
10261 | rm='$rm' |
10262 | rmail='$rmail' | |
10263 | runnm='$runnm' | |
2304df62 AD |
10264 | scriptdir='$scriptdir' |
10265 | scriptdirexp='$scriptdirexp' | |
ecfc5424 | 10266 | sed='$sed' |
a0d0e21e | 10267 | selecttype='$selecttype' |
ecfc5424 AD |
10268 | sendmail='$sendmail' |
10269 | sh='$sh' | |
10270 | shar='$shar' | |
10271 | sharpbang='$sharpbang' | |
10272 | shmattype='$shmattype' | |
2afac517 | 10273 | shrpenv='$shrpenv' |
ecfc5424 | 10274 | shsharp='$shsharp' |
2304df62 | 10275 | sig_name='$sig_name' |
8e07c86e | 10276 | sig_num='$sig_num' |
ecfc5424 | 10277 | signal_t='$signal_t' |
4633a7c4 LW |
10278 | sitearch='$sitearch' |
10279 | sitearchexp='$sitearchexp' | |
25f94b33 AD |
10280 | sitelib='$sitelib' |
10281 | sitelibexp='$sitelibexp' | |
a0d0e21e | 10282 | sizetype='$sizetype' |
ecfc5424 AD |
10283 | sleep='$sleep' |
10284 | smail='$smail' | |
10285 | small='$small' | |
a0d0e21e | 10286 | so='$so' |
ecfc5424 AD |
10287 | sockethdr='$sockethdr' |
10288 | socketlib='$socketlib' | |
10289 | sort='$sort' | |
10290 | spackage='$spackage' | |
2304df62 | 10291 | spitshell='$spitshell' |
ecfc5424 | 10292 | split='$split' |
a0d0e21e | 10293 | ssizetype='$ssizetype' |
4633a7c4 | 10294 | startperl='$startperl' |
2304df62 | 10295 | startsh='$startsh' |
ecfc5424 | 10296 | static_ext='$static_ext' |
2304df62 | 10297 | stdchar='$stdchar' |
16d20bd9 AD |
10298 | stdio_base='$stdio_base' |
10299 | stdio_bufsiz='$stdio_bufsiz' | |
10300 | stdio_cnt='$stdio_cnt' | |
8ff267be | 10301 | stdio_filbuf='$stdio_filbuf' |
16d20bd9 | 10302 | stdio_ptr='$stdio_ptr' |
ecfc5424 AD |
10303 | strings='$strings' |
10304 | submit='$submit' | |
f55a7265 | 10305 | subversion='$subversion' |
2304df62 | 10306 | sysman='$sysman' |
ecfc5424 AD |
10307 | tail='$tail' |
10308 | tar='$tar' | |
10309 | tbl='$tbl' | |
10310 | test='$test' | |
10311 | timeincl='$timeincl' | |
10312 | timetype='$timetype' | |
10313 | touch='$touch' | |
10314 | tr='$tr' | |
10315 | troff='$troff' | |
2304df62 | 10316 | uidtype='$uidtype' |
ecfc5424 AD |
10317 | uname='$uname' |
10318 | uniq='$uniq' | |
10319 | usedl='$usedl' | |
10320 | usemymalloc='$usemymalloc' | |
2304df62 | 10321 | usenm='$usenm' |
8ff267be | 10322 | useopcode='$useopcode' |
10323 | useperlio='$useperlio' | |
ecfc5424 | 10324 | useposix='$useposix' |
8ff267be | 10325 | usesfio='$usesfio' |
10326 | useshrplib='$useshrplib' | |
ecfc5424 | 10327 | usevfork='$usevfork' |
2304df62 | 10328 | usrinc='$usrinc' |
ecfc5424 AD |
10329 | uuname='$uuname' |
10330 | vi='$vi' | |
2304df62 | 10331 | voidflags='$voidflags' |
ecfc5424 AD |
10332 | xlibpth='$xlibpth' |
10333 | zcat='$zcat' | |
8ff267be | 10334 | zip='$zip' |
2304df62 AD |
10335 | EOT |
10336 | ||
10337 | : add special variables | |
10338 | $test -f patchlevel.h && \ | |
10339 | awk '/^#define/ {printf "%s=%s\n",$2,$3}' patchlevel.h >>config.sh | |
10340 | echo "CONFIG=true" >>config.sh | |
10341 | ||
10342 | : propagate old symbols | |
10343 | if $test -f UU/config.sh; then | |
10344 | <UU/config.sh sort | uniq >UU/oldconfig.sh | |
10345 | sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\ | |
10346 | sort | uniq -u >UU/oldsyms | |
10347 | set X `cat UU/oldsyms` | |
10348 | shift | |
10349 | case $# in | |
10350 | 0) ;; | |
10351 | *) | |
10352 | cat <<EOM | |
10353 | Hmm...You had some extra variables I don't know about...I'll try to keep 'em... | |
10354 | EOM | |
10355 | echo "# Variables propagated from previous config.sh file." >>config.sh | |
10356 | for sym in `cat UU/oldsyms`; do | |
10357 | echo " Propagating $hint variable "'$'"$sym..." | |
10358 | eval 'tmp="$'"${sym}"'"' | |
10359 | echo "$tmp" | \ | |
10360 | sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh | |
10361 | done | |
10362 | ;; | |
10363 | esac | |
10364 | fi | |
10365 | ||
10366 | : Finish up by extracting the .SH files | |
10367 | case "$alldone" in | |
10368 | exit) | |
10369 | $rm -rf UU | |
10370 | echo "Done." | |
10371 | exit 0 | |
10372 | ;; | |
10373 | cont) | |
10374 | ;; | |
10375 | '') | |
2304df62 AD |
10376 | dflt='' |
10377 | nostick=true | |
40000a8c AD |
10378 | $cat <<EOM |
10379 | ||
10380 | If you'd like to make any changes to the config.sh file before I begin | |
10381 | to configure things, do it as a shell escape now (e.g. !vi config.sh). | |
10382 | ||
10383 | EOM | |
10384 | rp="Press return or use a shell escape to edit config.sh:" | |
2304df62 AD |
10385 | . UU/myread |
10386 | nostick='' | |
10387 | case "$ans" in | |
10388 | '') ;; | |
10389 | *) : in case they cannot read | |
10390 | sh 1>&4 -c "$ans";; | |
10391 | esac | |
10392 | ;; | |
10393 | esac | |
10394 | ||
10395 | : if this fails, just run all the .SH files by hand | |
10396 | . ./config.sh | |
10397 | ||
10398 | echo " " | |
10399 | exec 1>&4 | |
10400 | . ./UU/extract | |
10401 | ||
10402 | if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then | |
10403 | dflt=y | |
10404 | case "$silent" in | |
10405 | true) ;; | |
10406 | *) | |
10407 | $cat <<EOM | |
10408 | ||
10409 | Now you need to generate make dependencies by running "make depend". | |
10410 | You might prefer to run it in background: "make depend > makedepend.out &" | |
10411 | It can take a while, so you might not want to run it right now. | |
10412 | ||
10413 | EOM | |
10414 | ;; | |
10415 | esac | |
10416 | rp="Run make depend now?" | |
10417 | . UU/myread | |
10418 | case "$ans" in | |
10419 | y*) | |
10420 | make depend && echo "Now you must run a make." | |
10421 | ;; | |
10422 | *) | |
10423 | echo "You must run 'make depend' then 'make'." | |
10424 | ;; | |
10425 | esac | |
10426 | elif test -f [Mm]akefile; then | |
10427 | echo " " | |
10428 | echo "Now you must run a make." | |
10429 | else | |
10430 | echo "Done." | |
10431 | fi | |
10432 | ||
10433 | $rm -f kit*isdone ark*isdone | |
10434 | $rm -rf UU | |
a0d0e21e | 10435 | |
2304df62 | 10436 | : End of Configure |
a0d0e21e | 10437 |