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 | # |
24fef2a7 | 23 | # Generated on Sat Feb 1 00:26:40 EST 1997 [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 | ||
c90c0ff4 | 88 | : This should not matter in scripts, but apparently it does, sometimes |
89 | case "$CDPATH" in | |
90 | '') ;; | |
91 | *) CDPATH='' ;; | |
92 | esac | |
3c321fdc | 93 | |
a0d0e21e | 94 | : Sanity checks |
2304df62 | 95 | if test ! -t 0; then |
a0d0e21e | 96 | echo "Say 'sh $me', not 'sh <$me'" |
2304df62 AD |
97 | exit 1 |
98 | fi | |
99 | ||
ff0cee69 | 100 | : Test and see if we are running under ksh, either blatantly or in disguise. |
101 | if (PATH=.; alias -x) >/dev/null 2>&1; then | |
102 | : running under ksh. Is this a good thing? | |
103 | if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname ; then | |
104 | if test X`/usr/bin/uname -v` = X4 ; then | |
105 | : on AIX 4, /bin/sh is really ksh, and it causes us problems. | |
106 | : Avoid it | |
2304df62 | 107 | cat <<'EOM' |
ff0cee69 | 108 | (Feeding myself to /usr/bin/bsh to avoid AIX 4's /bin/sh.) |
2304df62 | 109 | EOM |
ecfc5424 | 110 | unset ENV |
ff0cee69 | 111 | exec /usr/bin/bsh $0 "$@" |
2304df62 | 112 | fi |
ff0cee69 | 113 | else |
114 | if test ! -f /hp-ux ; then | |
2304df62 | 115 | : Warn them if they use ksh on other systems |
a0d0e21e LW |
116 | cat <<EOM |
117 | (I see you are using the Korn shell. Some ksh's blow up on $me, | |
8ff267be | 118 | especially on older exotic systems. If yours does, try the Bourne |
119 | shell instead.) | |
2304df62 | 120 | EOM |
c90c0ff4 | 121 | unset ENV |
ff0cee69 | 122 | fi |
123 | fi | |
124 | else | |
125 | : Not running under ksh. Maybe we should be? | |
126 | : On HP-UX, large Configure scripts may exercise a bug in /bin/sh | |
127 | if test -f /hp-ux -a -f /bin/ksh; then | |
128 | cat <<'EOM' | |
129 | (Feeding myself to ksh to avoid nasty sh bug in "here document" expansion.) | |
130 | EOM | |
131 | unset ENV | |
132 | exec /bin/ksh $0 "$@" | |
133 | fi | |
2304df62 AD |
134 | fi |
135 | ||
136 | : Configure runs within the UU subdirectory | |
137 | test -d UU || mkdir UU | |
8e07c86e | 138 | cd UU && rm -f ./* |
2304df62 | 139 | |
a0d0e21e | 140 | dynamic_ext='' |
2304df62 | 141 | extensions='' |
a0d0e21e LW |
142 | known_extensions='' |
143 | static_ext='' | |
8ff267be | 144 | useopcode='' |
a0d0e21e | 145 | useposix='' |
ecfc5424 | 146 | d_bsd='' |
40a7a20a | 147 | d_eunice='' |
2304df62 AD |
148 | d_xenix='' |
149 | eunicefix='' | |
150 | Mcc='' | |
151 | awk='' | |
152 | bash='' | |
153 | bison='' | |
154 | byacc='' | |
155 | cat='' | |
156 | chgrp='' | |
157 | chmod='' | |
158 | chown='' | |
ecfc5424 | 159 | comm='' |
2304df62 AD |
160 | compress='' |
161 | cp='' | |
162 | cpio='' | |
163 | cpp='' | |
164 | csh='' | |
165 | date='' | |
166 | echo='' | |
167 | egrep='' | |
168 | emacs='' | |
169 | expr='' | |
170 | find='' | |
171 | flex='' | |
172 | gcc='' | |
173 | grep='' | |
8ff267be | 174 | gzip='' |
2304df62 AD |
175 | inews='' |
176 | ksh='' | |
177 | less='' | |
178 | line='' | |
179 | lint='' | |
180 | ln='' | |
181 | lp='' | |
182 | lpr='' | |
183 | ls='' | |
184 | mail='' | |
185 | mailx='' | |
2304df62 AD |
186 | mkdir='' |
187 | more='' | |
188 | mv='' | |
189 | nroff='' | |
190 | perl='' | |
191 | pg='' | |
192 | pmake='' | |
193 | pr='' | |
194 | rm='' | |
195 | rmail='' | |
196 | sed='' | |
197 | sendmail='' | |
2304df62 AD |
198 | shar='' |
199 | sleep='' | |
200 | smail='' | |
201 | sort='' | |
202 | submit='' | |
203 | tail='' | |
204 | tar='' | |
205 | tbl='' | |
206 | test='' | |
207 | touch='' | |
208 | tr='' | |
209 | troff='' | |
210 | uname='' | |
211 | uniq='' | |
dc66995c | 212 | usethreads='' |
2304df62 AD |
213 | uuname='' |
214 | vi='' | |
215 | zcat='' | |
8ff267be | 216 | zip='' |
1aef975c | 217 | full_sed='' |
a0d0e21e | 218 | libswanted='' |
2304df62 AD |
219 | hint='' |
220 | myuname='' | |
85e6fe83 LW |
221 | osname='' |
222 | osvers='' | |
2304df62 AD |
223 | Author='' |
224 | Date='' | |
225 | Header='' | |
226 | Id='' | |
227 | Locker='' | |
228 | Log='' | |
229 | RCSfile='' | |
230 | Revision='' | |
231 | Source='' | |
232 | State='' | |
4633a7c4 LW |
233 | ar='' |
234 | archobjs='' | |
235 | exe_ext='' | |
236 | firstmakefile='' | |
237 | lib_ext='' | |
238 | obj_ext='' | |
239 | path_sep='' | |
2304df62 | 240 | afs='' |
a0d0e21e LW |
241 | alignbytes='' |
242 | archlib='' | |
243 | archlibexp='' | |
a0d0e21e LW |
244 | d_archlib='' |
245 | installarchlib='' | |
40000a8c AD |
246 | archname='' |
247 | myarchname='' | |
ecfc5424 | 248 | baserev='' |
2304df62 AD |
249 | bin='' |
250 | binexp='' | |
251 | installbin='' | |
5f05dabc | 252 | bincompat3='' |
253 | d_bincompat3='' | |
2304df62 AD |
254 | byteorder='' |
255 | cc='' | |
256 | gccversion='' | |
257 | ccflags='' | |
258 | cppflags='' | |
259 | ldflags='' | |
260 | lkflags='' | |
8e07c86e | 261 | locincpth='' |
2304df62 | 262 | optimize='' |
8e07c86e | 263 | cf_email='' |
2304df62 AD |
264 | cf_by='' |
265 | cf_time='' | |
266 | contains='' | |
a0d0e21e | 267 | cpp_stuff='' |
2304df62 AD |
268 | cpplast='' |
269 | cppminus='' | |
270 | cpprun='' | |
271 | cppstdin='' | |
272 | d_access='' | |
a0d0e21e | 273 | d_alarm='' |
ecfc5424 | 274 | d_attribut='' |
2304df62 AD |
275 | d_bcmp='' |
276 | d_bcopy='' | |
277 | d_bzero='' | |
278 | d_casti32='' | |
279 | castflags='' | |
280 | d_castneg='' | |
a0d0e21e LW |
281 | d_chown='' |
282 | d_chroot='' | |
2304df62 | 283 | d_chsize='' |
a0d0e21e LW |
284 | d_closedir='' |
285 | d_void_closedir='' | |
2304df62 AD |
286 | d_const='' |
287 | cryptlib='' | |
288 | d_crypt='' | |
289 | d_csh='' | |
1aef975c | 290 | full_csh='' |
a0d0e21e LW |
291 | d_cuserid='' |
292 | d_dbl_dig='' | |
293 | d_difftime='' | |
294 | d_dlerror='' | |
295 | d_dlopen='' | |
296 | d_dlsymun='' | |
2304df62 | 297 | d_dosuid='' |
a0d0e21e | 298 | d_suidsafe='' |
2304df62 AD |
299 | d_dup2='' |
300 | d_fchmod='' | |
301 | d_fchown='' | |
302 | d_fcntl='' | |
a0d0e21e LW |
303 | d_fd_macros='' |
304 | d_fd_set='' | |
305 | d_fds_bits='' | |
306 | d_fgetpos='' | |
2304df62 AD |
307 | d_flexfnam='' |
308 | d_flock='' | |
a0d0e21e LW |
309 | d_fork='' |
310 | d_fsetpos='' | |
5f05dabc | 311 | d_ftime='' |
312 | d_gettimeod='' | |
a0d0e21e | 313 | d_Gconvert='' |
2304df62 | 314 | d_getgrps='' |
5cd24f17 | 315 | d_setgrps='' |
2304df62 | 316 | d_gethent='' |
3fd537d4 JH |
317 | d_gethbadd='' |
318 | gethbadd_addr_type='' | |
319 | gethbadd_alen_type='' | |
320 | d_getnbadd='' | |
321 | getnbadd_net_type='' | |
2304df62 AD |
322 | aphostname='' |
323 | d_gethname='' | |
324 | d_phostname='' | |
325 | d_uname='' | |
a0d0e21e | 326 | d_getlogin='' |
2afac517 | 327 | d_getpgid='' |
2304df62 | 328 | d_getpgrp2='' |
2afac517 | 329 | d_bsdgetpgrp='' |
2304df62 | 330 | d_getpgrp='' |
a0d0e21e | 331 | d_getppid='' |
2304df62 | 332 | d_getprior='' |
a4f3eea9 | 333 | d_gnulibc='' |
2304df62 | 334 | d_htonl='' |
7e1af8bc | 335 | d_inetaton='' |
2304df62 AD |
336 | d_isascii='' |
337 | d_killpg='' | |
338 | d_link='' | |
a0d0e21e LW |
339 | d_locconv='' |
340 | d_lockf='' | |
2304df62 | 341 | d_lstat='' |
a0d0e21e LW |
342 | d_mblen='' |
343 | d_mbstowcs='' | |
344 | d_mbtowc='' | |
2304df62 AD |
345 | d_memcmp='' |
346 | d_memcpy='' | |
347 | d_memmove='' | |
348 | d_memset='' | |
349 | d_mkdir='' | |
a0d0e21e LW |
350 | d_mkfifo='' |
351 | d_mktime='' | |
2304df62 AD |
352 | d_msg='' |
353 | d_msgctl='' | |
354 | d_msgget='' | |
355 | d_msgrcv='' | |
356 | d_msgsnd='' | |
a0d0e21e | 357 | d_nice='' |
2304df62 | 358 | d_open3='' |
a0d0e21e LW |
359 | d_fpathconf='' |
360 | d_pathconf='' | |
361 | d_pause='' | |
362 | d_pipe='' | |
8e07c86e | 363 | d_poll='' |
2304df62 AD |
364 | d_portable='' |
365 | d_readdir='' | |
85e6fe83 LW |
366 | d_rewinddir='' |
367 | d_seekdir='' | |
368 | d_telldir='' | |
a0d0e21e | 369 | d_readlink='' |
2304df62 AD |
370 | d_rename='' |
371 | d_rmdir='' | |
372 | d_safebcpy='' | |
373 | d_safemcpy='' | |
36477c24 | 374 | d_sanemcmp='' |
2304df62 AD |
375 | d_select='' |
376 | d_sem='' | |
377 | d_semctl='' | |
378 | d_semget='' | |
379 | d_semop='' | |
380 | d_setegid='' | |
381 | d_seteuid='' | |
a0d0e21e | 382 | d_setlinebuf='' |
2304df62 AD |
383 | d_setlocale='' |
384 | d_setpgid='' | |
385 | d_setpgrp2='' | |
386 | d_bsdpgrp='' | |
2afac517 | 387 | d_bsdsetpgrp='' |
2304df62 AD |
388 | d_setpgrp='' |
389 | d_setprior='' | |
390 | d_setregid='' | |
391 | d_setresgid='' | |
392 | d_setresuid='' | |
393 | d_setreuid='' | |
394 | d_setrgid='' | |
395 | d_setruid='' | |
396 | d_setsid='' | |
760ac839 | 397 | d_sfio='' |
8ff267be | 398 | usesfio='' |
2304df62 AD |
399 | d_shm='' |
400 | d_shmat='' | |
a0d0e21e LW |
401 | d_shmatprototype='' |
402 | shmattype='' | |
2304df62 AD |
403 | d_shmctl='' |
404 | d_shmdt='' | |
405 | d_shmget='' | |
2c7991dc | 406 | d_sigaction='' |
8ff267be | 407 | d_sigsetjmp='' |
2304df62 AD |
408 | d_oldsock='' |
409 | d_socket='' | |
410 | d_sockpair='' | |
411 | sockethdr='' | |
412 | socketlib='' | |
413 | d_statblks='' | |
c2960299 AD |
414 | d_stdio_cnt_lval='' |
415 | d_stdio_ptr_lval='' | |
16d20bd9 | 416 | d_stdiobase='' |
2304df62 | 417 | d_stdstdio='' |
16d20bd9 AD |
418 | stdio_base='' |
419 | stdio_bufsiz='' | |
420 | stdio_cnt='' | |
421 | stdio_ptr='' | |
2304df62 AD |
422 | d_index='' |
423 | d_strchr='' | |
a0d0e21e | 424 | d_strcoll='' |
2304df62 AD |
425 | d_strctcpy='' |
426 | d_strerrm='' | |
427 | d_strerror='' | |
428 | d_sysernlst='' | |
429 | d_syserrlst='' | |
a89d8a78 DH |
430 | d_strtod='' |
431 | d_strtol='' | |
432 | d_strtoul='' | |
a0d0e21e | 433 | d_strxfrm='' |
2304df62 AD |
434 | d_symlink='' |
435 | d_syscall='' | |
a0d0e21e | 436 | d_sysconf='' |
2304df62 | 437 | d_system='' |
a0d0e21e LW |
438 | d_tcgetpgrp='' |
439 | d_tcsetpgrp='' | |
85e6fe83 LW |
440 | d_time='' |
441 | timetype='' | |
2304df62 AD |
442 | clocktype='' |
443 | d_times='' | |
444 | d_truncate='' | |
a0d0e21e LW |
445 | d_tzname='' |
446 | d_umask='' | |
2304df62 | 447 | d_vfork='' |
a0d0e21e | 448 | usevfork='' |
2304df62 AD |
449 | d_voidsig='' |
450 | signal_t='' | |
451 | d_volatile='' | |
452 | d_charvspr='' | |
453 | d_vprintf='' | |
454 | d_wait4='' | |
455 | d_waitpid='' | |
a0d0e21e LW |
456 | d_wcstombs='' |
457 | d_wctomb='' | |
458 | dlext='' | |
85e6fe83 LW |
459 | cccdlflags='' |
460 | ccdlflags='' | |
2304df62 | 461 | dlsrc='' |
232e078e | 462 | ld='' |
85e6fe83 | 463 | lddlflags='' |
2304df62 | 464 | usedl='' |
a0d0e21e | 465 | fpostype='' |
2304df62 AD |
466 | gidtype='' |
467 | groupstype='' | |
52e1cb5e JH |
468 | d_sched_yield='' |
469 | d_pthread_yield='' | |
2304df62 AD |
470 | h_fcntl='' |
471 | h_sysfile='' | |
ecfc5424 AD |
472 | db_hashtype='' |
473 | db_prefixtype='' | |
a0d0e21e | 474 | i_db='' |
2304df62 | 475 | i_dbm='' |
8e07c86e | 476 | i_rpcsvcdbm='' |
2304df62 | 477 | d_dirnamlen='' |
a0d0e21e | 478 | direntrytype='' |
2304df62 | 479 | i_dirent='' |
a0d0e21e | 480 | i_dld='' |
2304df62 AD |
481 | i_dlfcn='' |
482 | i_fcntl='' | |
a0d0e21e | 483 | i_float='' |
2304df62 AD |
484 | i_gdbm='' |
485 | i_grp='' | |
a0d0e21e | 486 | i_limits='' |
4633a7c4 | 487 | i_locale='' |
a0d0e21e LW |
488 | i_malloc='' |
489 | i_math='' | |
85e6fe83 | 490 | i_memory='' |
2304df62 | 491 | i_ndbm='' |
3fd537d4 | 492 | i_netdb='' |
85e6fe83 | 493 | i_neterrno='' |
2304df62 AD |
494 | i_niin='' |
495 | i_sysin='' | |
ce637636 | 496 | d_pthreads_created_joinable='' |
2304df62 AD |
497 | d_pwage='' |
498 | d_pwchange='' | |
499 | d_pwclass='' | |
500 | d_pwcomment='' | |
501 | d_pwexpire='' | |
502 | d_pwquota='' | |
503 | i_pwd='' | |
760ac839 | 504 | i_sfio='' |
2304df62 | 505 | i_stddef='' |
a0d0e21e | 506 | i_stdlib='' |
2304df62 AD |
507 | i_string='' |
508 | strings='' | |
509 | i_sysdir='' | |
510 | i_sysfile='' | |
511 | d_voidtty='' | |
512 | i_bsdioctl='' | |
a0d0e21e | 513 | i_sysfilio='' |
2304df62 AD |
514 | i_sysioctl='' |
515 | i_syssockio='' | |
516 | i_sysndir='' | |
a0d0e21e | 517 | i_sysparam='' |
8ff267be | 518 | i_sysresrc='' |
2304df62 | 519 | i_sysselct='' |
1aef975c | 520 | i_sysstat='' |
a0d0e21e | 521 | i_systimes='' |
fed7345c | 522 | i_systypes='' |
25f94b33 | 523 | i_sysun='' |
8ff267be | 524 | i_syswait='' |
2304df62 AD |
525 | i_sgtty='' |
526 | i_termio='' | |
527 | i_termios='' | |
528 | i_systime='' | |
529 | i_systimek='' | |
530 | i_time='' | |
531 | timeincl='' | |
85e6fe83 | 532 | i_unistd='' |
2304df62 | 533 | i_utime='' |
760ac839 | 534 | i_values='' |
a0d0e21e | 535 | i_stdarg='' |
2304df62 AD |
536 | i_varargs='' |
537 | i_varhdr='' | |
538 | i_vfork='' | |
539 | intsize='' | |
24fef2a7 AD |
540 | longsize='' |
541 | shortsize='' | |
2304df62 | 542 | libc='' |
8ff267be | 543 | libperl='' |
2afac517 | 544 | shrpenv='' |
8ff267be | 545 | useshrplib='' |
a0d0e21e | 546 | glibpth='' |
2304df62 | 547 | libpth='' |
8e07c86e | 548 | loclibpth='' |
2304df62 AD |
549 | plibpth='' |
550 | xlibpth='' | |
551 | libs='' | |
85e6fe83 LW |
552 | lns='' |
553 | lseektype='' | |
8ff267be | 554 | make='' |
555 | make_set_make='' | |
85e6fe83 | 556 | d_mymalloc='' |
94b6baf5 | 557 | freetype='' |
2304df62 AD |
558 | mallocobj='' |
559 | mallocsrc='' | |
560 | malloctype='' | |
561 | usemymalloc='' | |
16d20bd9 AD |
562 | installman1dir='' |
563 | man1dir='' | |
564 | man1direxp='' | |
565 | man1ext='' | |
566 | installman3dir='' | |
567 | man3dir='' | |
568 | man3direxp='' | |
569 | man3ext='' | |
2304df62 AD |
570 | huge='' |
571 | large='' | |
572 | medium='' | |
573 | models='' | |
574 | small='' | |
575 | split='' | |
a0d0e21e | 576 | modetype='' |
2304df62 AD |
577 | mydomain='' |
578 | myhostname='' | |
579 | phostname='' | |
580 | c='' | |
581 | n='' | |
8e07c86e AD |
582 | d_eofnblk='' |
583 | eagain='' | |
584 | o_nonblock='' | |
585 | rd_nodata='' | |
2304df62 AD |
586 | groupcat='' |
587 | hostcat='' | |
588 | passcat='' | |
4633a7c4 LW |
589 | d_oldarchlib='' |
590 | oldarchlib='' | |
591 | oldarchlibexp='' | |
85e6fe83 LW |
592 | orderlib='' |
593 | ranlib='' | |
2304df62 AD |
594 | package='' |
595 | spackage='' | |
2c7991dc | 596 | pager='' |
ecfc5424 | 597 | patchlevel='' |
760ac839 | 598 | subversion='' |
8e07c86e | 599 | perladmin='' |
4633a7c4 | 600 | perlpath='' |
a0d0e21e | 601 | prefix='' |
1aef975c | 602 | prefixexp='' |
2304df62 AD |
603 | installprivlib='' |
604 | privlib='' | |
605 | privlibexp='' | |
606 | prototype='' | |
607 | randbits='' | |
608 | installscript='' | |
609 | scriptdir='' | |
610 | scriptdirexp='' | |
a0d0e21e | 611 | selecttype='' |
8ff267be | 612 | sh='' |
2304df62 | 613 | sig_name='' |
8e07c86e | 614 | sig_num='' |
4633a7c4 LW |
615 | installsitearch='' |
616 | sitearch='' | |
617 | sitearchexp='' | |
25f94b33 AD |
618 | installsitelib='' |
619 | sitelib='' | |
620 | sitelibexp='' | |
a0d0e21e LW |
621 | sizetype='' |
622 | so='' | |
2304df62 AD |
623 | sharpbang='' |
624 | shsharp='' | |
625 | spitshell='' | |
a0d0e21e | 626 | ssizetype='' |
4633a7c4 | 627 | startperl='' |
2304df62 AD |
628 | startsh='' |
629 | stdchar='' | |
630 | sysman='' | |
631 | uidtype='' | |
632 | nm_opt='' | |
40a7a20a | 633 | nm_so_opt='' |
2304df62 AD |
634 | runnm='' |
635 | usenm='' | |
8ff267be | 636 | useperlio='' |
2304df62 AD |
637 | incpath='' |
638 | mips='' | |
639 | mips_type='' | |
640 | usrinc='' | |
641 | defvoidused='' | |
642 | voidflags='' | |
2304df62 AD |
643 | CONFIG='' |
644 | ||
ecfc5424 AD |
645 | define='define' |
646 | undef='undef' | |
647 | smallmach='pdp11 i8086 z8000 i80286 iAPX286' | |
648 | rmlist='' | |
649 | ||
650 | : We must find out about Eunice early | |
651 | eunicefix=':' | |
652 | if test -f /etc/unixtovms; then | |
653 | eunicefix=/etc/unixtovms | |
654 | fi | |
655 | if test -f /etc/unixtovms.exe; then | |
656 | eunicefix=/etc/unixtovms.exe | |
657 | fi | |
658 | ||
659 | : list of known cpp symbols, sorted alphabetically | |
660 | al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CMU CRAY DGUX DOLPHIN DPX2" | |
661 | al="$al GO32 GOULD_PN HP700 I386 I80960 I960 Lynx M68000 M68K MACH" | |
662 | al="$al MIPSEB MIPSEL MSDOS MTXINU MULTIMAX MVS" | |
663 | al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM" | |
664 | al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX" | |
665 | al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX" | |
666 | al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4" | |
667 | al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300" | |
668 | al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek" | |
669 | al="$al VMS Xenix286" | |
670 | al="$al _AIX _AIX32 _AIX370 _AM29000 _COFF _CRAY _CX_UX _EPI" | |
671 | al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET" | |
672 | al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3" | |
673 | al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000" | |
674 | al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4" | |
675 | al="$al _SYSTYPE_SYSV _SYSV3 _U370 _UNICOS" | |
676 | al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__" | |
677 | al="$al __DGUX__ __DPX2__ __H3050R __H3050RX" | |
678 | al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__" | |
679 | al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__" | |
680 | al="$al __Next__ __OSF1__ __PARAGON__ __PGC__ __PWB __STDC__" | |
681 | al="$al __SVR4_2__ __UMAXV__" | |
682 | al="$al ____386BSD____ __alpha __alpha__ __amiga" | |
683 | al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__" | |
684 | al="$al __host_mips__" | |
685 | al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500" | |
686 | al="$al __hp9000s500 __hp9000s700 __hp9000s800" | |
687 | al="$al __hppa __hpux __hp_osf __i286 __i286__ __i386 __i386__" | |
688 | al="$al __i486 __i486__ __i860 __i860__ __ibmesa __ksr1__ __linux__" | |
689 | al="$al __m68k __m68k__ __m88100__ __m88k __m88k__" | |
690 | al="$al __mc68000 __mc68000__ __mc68020 __mc68020__" | |
691 | al="$al __mc68030 __mc68030__ __mc68040 __mc68040__" | |
692 | al="$al __mc88100 __mc88100__ __mips __mips__" | |
693 | al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__" | |
694 | al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__" | |
695 | al="$al __unix __unix__ __uxpm__ __uxps__ __vax __vax__" | |
696 | al="$al _host_mips _mips _unix" | |
697 | al="$al a29k aegis aix aixpc alliant alpha am29000 amiga ansi ardent" | |
698 | al="$al apollo ardent att386 att3b" | |
699 | al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bsdi bull" | |
700 | al="$al cadmus clipper concurrent convex cray ctix" | |
701 | al="$al dmert encore gcos gcx gimpel gould" | |
702 | al="$al hbullx20 hcx host_mips hp200 hp300 hp700 hp800" | |
703 | al="$al hp9000 hp9000s300 hp9000s400 hp9000s500" | |
704 | al="$al hp9000s700 hp9000s800 hp9k8 hppa hpux" | |
705 | al="$al i186 i286 i386 i486 i8086" | |
706 | al="$al i80960 i860 iAPX286 ibm ibm032 ibmrt interdata is68k" | |
707 | al="$al ksr1 linux luna luna88k m68k m88100 m88k" | |
708 | al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030" | |
709 | al="$al mc68040 mc68060 mc68k mc68k32 mc700" | |
710 | al="$al mc88000 mc88100 merlin mert mips mvs n16" | |
711 | al="$al ncl_el ncl_mr" | |
712 | al="$al news1500 news1700 news1800 news1900 news3700" | |
713 | al="$al news700 news800 news900 ns16000 ns32000" | |
714 | al="$al ns32016 ns32332 ns32k nsc32000 os osf" | |
715 | al="$al parisc pc532 pdp11 plexus posix pyr" | |
716 | al="$al riscix riscos scs sequent sgi sinix sony sony_news" | |
717 | al="$al sonyrisc sparc sparclite spectrum stardent stratos" | |
718 | al="$al sun sun3 sun386 svr4 sysV68 sysV88" | |
719 | al="$al titan tower tower32 tower32_200 tower32_600 tower32_700" | |
720 | al="$al tower32_800 tower32_850 tss u370 u3b u3b2 u3b20 u3b200" | |
721 | al="$al u3b20d u3b5 ultrix unix unixpc unos vax venix vms" | |
722 | al="$al xenix z8000" | |
723 | ||
ecfc5424 AD |
724 | groupstype='' |
725 | i_whoami='' | |
8e07c86e AD |
726 | : default library list |
727 | libswanted='' | |
728 | : set useposix=false in your hint file to disable the POSIX extension. | |
729 | useposix=true | |
8ff267be | 730 | : set useopcode=false in your hint file to disable the Opcode extension. |
731 | useopcode=true | |
40a7a20a | 732 | : Define several unixisms. These can be used in hint files. |
25f94b33 AD |
733 | exe_ext='' |
734 | : Extra object files, if any, needed on this platform. | |
735 | archobjs='' | |
8e07c86e | 736 | : Possible local include directories to search. |
25f94b33 | 737 | : Set locincpth to "" in a hint file to defeat local include searches. |
8e07c86e AD |
738 | locincpth="/usr/local/include /opt/local/include /usr/gnu/include" |
739 | locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include" | |
740 | : | |
741 | : no include file wanted by default | |
742 | inclwanted='' | |
743 | ||
ecfc5424 AD |
744 | : change the next line if compiling for Xenix/286 on Xenix/386 |
745 | xlibpth='/usr/lib/386 /lib/386' | |
746 | ||
8e07c86e AD |
747 | : Possible local library directories to search. |
748 | loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib" | |
749 | loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib" | |
750 | ||
ecfc5424 | 751 | : general looking path for locating libraries |
84902520 | 752 | glibpth="/shlib /usr/shlib /usr/lib/pa1.1 /usr/lib/large" |
4b40f7a3 SV |
753 | glibpth="$glibpth /lib /usr/lib $xlibpth" |
754 | glibpth="$glibpth /lib/large /usr/lib/small /lib/small" | |
755 | glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib" | |
ecfc5424 AD |
756 | |
757 | : Private path used by Configure to find libraries. Its value | |
758 | : is prepended to libpth. This variable takes care of special | |
759 | : machines, like the mips. Usually, it should be empty. | |
760 | plibpth='' | |
761 | ||
ecfc5424 AD |
762 | : full support for void wanted by default |
763 | defvoidused=15 | |
764 | ||
ecfc5424 | 765 | : List of libraries we want. |
760ac839 | 766 | libswanted='sfio net socket inet nsl nm ndbm gdbm dbm db malloc dl' |
ecfc5424 AD |
767 | libswanted="$libswanted dld ld sun m c cposix posix ndir dir crypt" |
768 | libswanted="$libswanted ucb bsd BSD PW x" | |
1aef975c | 769 | : We probably want to search /usr/shlib before most other libraries. |
94b6baf5 | 770 | : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist. |
ecfc5424 AD |
771 | glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'` |
772 | glibpth="/usr/shlib $glibpth" | |
773 | : Do not use vfork unless overridden by a hint file. | |
774 | usevfork=false | |
775 | ||
8ff267be | 776 | : Find the basic shell for Bourne shell scripts |
777 | case "$sh" in | |
778 | '') | |
779 | : SYSTYPE is for some older MIPS systems. | |
780 | : I do not know if it is still needed. | |
781 | case "$SYSTYPE" in | |
782 | *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";; | |
783 | *) xxx='/bin/sh';; | |
784 | esac | |
785 | if test -f "$xxx"; then | |
786 | sh="$xxx" | |
787 | else | |
788 | : Build up a list and do a single loop so we can 'break' out. | |
789 | pth=`echo $PATH | sed -e "s/$p_/ /g"` | |
790 | for xxx in sh bash ksh pdksh ash; do | |
791 | for p in $pth; do | |
792 | try="$try ${p}/${xxx}" | |
793 | done | |
794 | done | |
795 | for xxx in $try; do | |
796 | if test -f "$xxx"; then | |
797 | sh="$xxx"; | |
798 | echo "Your Bourne shell appears to be in $sh." | |
799 | break | |
800 | elif test -f "$xxx.exe"; then | |
801 | sh="$xxx"; | |
802 | echo "Hmm. Your Bourne shell appears to be in $sh." | |
803 | break | |
804 | fi | |
805 | done | |
806 | fi | |
807 | ;; | |
808 | esac | |
809 | ||
810 | case "$sh" in | |
811 | '') cat <<EOM >&2 | |
812 | $me: Fatal Error: I can't find a Bourne Shell anywhere. | |
813 | Usually it's in /bin/sh. How did you even get this far? | |
284c50cc | 814 | Please contact me (Chip Salzenberg) at chip@perl.com and |
8ff267be | 815 | we'll try to straigten this all out. |
816 | EOM | |
817 | exit 1 | |
818 | ;; | |
819 | esac | |
820 | ||
760ac839 | 821 | : see if sh knows # comments |
8ff267be | 822 | if `$sh -c '#' >/dev/null 2>&1`; then |
760ac839 LW |
823 | shsharp=true |
824 | spitshell=cat | |
825 | echo " " | |
760ac839 LW |
826 | xcat=/bin/cat |
827 | test -f $xcat || xcat=/usr/bin/cat | |
828 | echo "#!$xcat" >try | |
829 | $eunicefix try | |
830 | chmod +x try | |
831 | ./try > today | |
832 | if test -s today; then | |
760ac839 LW |
833 | sharpbang='#!' |
834 | else | |
835 | echo "#! $xcat" > try | |
836 | $eunicefix try | |
837 | chmod +x try | |
838 | ./try > today | |
839 | if test -s today; then | |
760ac839 LW |
840 | sharpbang='#! ' |
841 | else | |
8ff267be | 842 | echo "Okay, let's see if #! works on this system..." |
760ac839 LW |
843 | echo "It's just a comment." |
844 | sharpbang=': use ' | |
845 | fi | |
846 | fi | |
847 | else | |
8ff267be | 848 | echo "Your $sh doesn't grok # comments--I will strip them later on." |
760ac839 LW |
849 | shsharp=false |
850 | cd .. | |
851 | echo "exec grep -v '^[ ]*#'" >spitshell | |
852 | chmod +x spitshell | |
853 | $eunicefix spitshell | |
854 | spitshell=`pwd`/spitshell | |
855 | cd UU | |
856 | echo "I presume that if # doesn't work, #! won't work either!" | |
857 | sharpbang=': use ' | |
858 | fi | |
859 | rm -f try today | |
860 | ||
861 | : figure out how to guarantee sh startup | |
8ff267be | 862 | case "$startsh" in |
863 | '') startsh=${sharpbang}${sh} ;; | |
864 | *) | |
760ac839 | 865 | esac |
760ac839 LW |
866 | cat >try <<EOSS |
867 | $startsh | |
868 | set abc | |
869 | test "$?abc" != 1 | |
870 | EOSS | |
871 | ||
872 | chmod +x try | |
873 | $eunicefix try | |
874 | if ./try; then | |
8ff267be | 875 | : echo "Yup, it does." |
760ac839 | 876 | else |
8ff267be | 877 | echo "Hmm. '$startsh' didn't work." |
878 | echo "You may have to fix up the shell scripts to make sure sh runs them." | |
760ac839 LW |
879 | fi |
880 | rm -f try | |
881 | ||
2304df62 | 882 | : script used to extract .SH files with variable substitutions |
760ac839 LW |
883 | cat >extract <<EOS |
884 | $startsh | |
885 | EOS | |
886 | cat >>extract <<'EOS' | |
2304df62 AD |
887 | CONFIG=true |
888 | echo "Doing variable substitutions on .SH files..." | |
889 | if test -f MANIFEST; then | |
5f05dabc | 890 | shlist=`awk '{print $1}' <MANIFEST | grep '\.SH'` |
a0d0e21e LW |
891 | : Pick up possible extension manifests. |
892 | for dir in ext/* ; do | |
893 | if test -f $dir/MANIFEST; then | |
5f05dabc | 894 | xxx=`awk '{print $1}' < $dir/MANIFEST | |
a0d0e21e LW |
895 | sed -n "/\.SH$/ s@^@$dir/@p"` |
896 | shlist="$shlist $xxx" | |
897 | fi | |
898 | done | |
899 | set x $shlist | |
2304df62 AD |
900 | else |
901 | echo "(Looking for .SH files under the current directory.)" | |
5f05dabc | 902 | set x `find . -name "*.SH" -print` |
2304df62 AD |
903 | fi |
904 | shift | |
905 | case $# in | |
906 | 0) set x *.SH; shift;; | |
907 | esac | |
908 | if test ! -f $1; then | |
909 | shift | |
910 | fi | |
911 | for file in $*; do | |
912 | case "$file" in | |
913 | */*) | |
914 | dir=`expr X$file : 'X\(.*\)/'` | |
915 | file=`expr X$file : 'X.*/\(.*\)'` | |
916 | (cd $dir && . ./$file) | |
917 | ;; | |
918 | *) | |
919 | . ./$file | |
920 | ;; | |
921 | esac | |
922 | done | |
923 | if test -f config_h.SH; then | |
924 | if test ! -f config.h; then | |
925 | : oops, they left it out of MANIFEST, probably, so do it anyway. | |
926 | . ./config_h.SH | |
927 | fi | |
928 | fi | |
929 | EOS | |
930 | ||
931 | : produce awk script to parse command line options | |
932 | cat >options.awk <<'EOF' | |
933 | BEGIN { | |
16d20bd9 | 934 | optstr = "dD:eEf:hKOrsSU:V"; # getopt-style specification |
2304df62 AD |
935 | |
936 | len = length(optstr); | |
937 | for (i = 1; i <= len; i++) { | |
938 | c = substr(optstr, i, 1); | |
939 | if (i < len) a = substr(optstr, i + 1, 1); else a = ""; | |
940 | if (a == ":") { | |
941 | arg[c] = 1; | |
942 | i++; | |
943 | } | |
944 | opt[c] = 1; | |
945 | } | |
946 | } | |
947 | { | |
948 | expect = 0; | |
949 | str = $0; | |
950 | if (substr(str, 1, 1) != "-") { | |
951 | printf("'%s'\n", str); | |
952 | next; | |
953 | } | |
954 | len = length($0); | |
955 | for (i = 2; i <= len; i++) { | |
956 | c = substr(str, i, 1); | |
957 | if (!opt[c]) { | |
958 | printf("-%s\n", substr(str, i)); | |
959 | next; | |
960 | } | |
961 | printf("-%s\n", c); | |
962 | if (arg[c]) { | |
963 | if (i < len) | |
964 | printf("'%s'\n", substr(str, i + 1)); | |
965 | else | |
966 | expect = 1; | |
967 | next; | |
968 | } | |
969 | } | |
970 | } | |
971 | END { | |
972 | if (expect) | |
973 | print "?"; | |
974 | } | |
975 | EOF | |
976 | ||
977 | : process the command line options | |
4633a7c4 LW |
978 | set X `for arg in "$@"; do echo "X$arg"; done | |
979 | sed -e s/X// | awk -f options.awk` | |
2304df62 AD |
980 | eval "set $*" |
981 | shift | |
982 | rm -f options.awk | |
983 | ||
984 | : set up default values | |
985 | fastread='' | |
986 | reuseval=false | |
987 | config_sh='' | |
988 | alldone='' | |
989 | error='' | |
990 | silent='' | |
991 | extractsh='' | |
ecfc5424 | 992 | override='' |
16d20bd9 | 993 | knowitall='' |
28757baa | 994 | |
1aef975c | 995 | rm -f optdef.sh |
28757baa | 996 | cat >optdef.sh <<EOS |
997 | $startsh | |
998 | EOS | |
2304df62 AD |
999 | |
1000 | : option parsing | |
1001 | while test $# -gt 0; do | |
1002 | case "$1" in | |
1003 | -d) shift; fastread=yes;; | |
1004 | -e) shift; alldone=cont;; | |
1005 | -f) | |
1006 | shift | |
1007 | cd .. | |
1008 | if test -r "$1"; then | |
1009 | config_sh="$1" | |
1010 | else | |
a0d0e21e | 1011 | echo "$me: cannot read config file $1." >&2 |
2304df62 AD |
1012 | error=true |
1013 | fi | |
1014 | cd UU | |
1015 | shift;; | |
1016 | -h) shift; error=true;; | |
1017 | -r) shift; reuseval=true;; | |
1018 | -s) shift; silent=true;; | |
1019 | -E) shift; alldone=exit;; | |
16d20bd9 | 1020 | -K) shift; knowitall=true;; |
ecfc5424 | 1021 | -O) shift; override=true;; |
2304df62 | 1022 | -S) shift; extractsh=true;; |
a0d0e21e LW |
1023 | -D) |
1024 | shift | |
1025 | case "$1" in | |
1026 | *=) | |
1027 | echo "$me: use '-U symbol=', not '-D symbol='." >&2 | |
1028 | echo "$me: ignoring -D $1" >&2 | |
1029 | ;; | |
ecfc5424 | 1030 | *=*) echo "$1" | \ |
1aef975c AD |
1031 | sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;; |
1032 | *) echo "$1='define'" >> optdef.sh;; | |
a0d0e21e LW |
1033 | esac |
1034 | shift | |
1035 | ;; | |
1036 | -U) | |
1037 | shift | |
1038 | case "$1" in | |
1aef975c | 1039 | *=) echo "$1" >> optdef.sh;; |
a0d0e21e LW |
1040 | *=*) |
1041 | echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2 | |
1042 | echo "$me: ignoring -U $1" >&2 | |
1043 | ;; | |
1aef975c | 1044 | *) echo "$1='undef'" >> optdef.sh;; |
a0d0e21e LW |
1045 | esac |
1046 | shift | |
1047 | ;; | |
2c7991dc | 1048 | -V) echo "$me generated by metaconfig 3.0 PL60." >&2 |
2304df62 AD |
1049 | exit 0;; |
1050 | --) break;; | |
a0d0e21e | 1051 | -*) echo "$me: unknown option $1" >&2; shift; error=true;; |
2304df62 AD |
1052 | *) break;; |
1053 | esac | |
1054 | done | |
1055 | ||
1056 | case "$error" in | |
1057 | true) | |
1058 | cat >&2 <<EOM | |
2afac517 | 1059 | Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value] |
a0d0e21e | 1060 | [-U symbol] [-U symbol=] |
2304df62 AD |
1061 | -d : use defaults for all answers. |
1062 | -e : go on without questioning past the production of config.sh. | |
1063 | -f : specify an alternate default configuration file. | |
1064 | -h : print this help message and exit (with an error status). | |
1065 | -r : reuse C symbols value if possible (skips costly nm extraction). | |
1066 | -s : silent mode, only echoes questions and essential information. | |
a0d0e21e LW |
1067 | -D : define symbol to have some value: |
1068 | -D symbol symbol gets the value 'define' | |
1069 | -D symbol=value symbol gets the value 'value' | |
2304df62 | 1070 | -E : stop at the end of questions, after having produced config.sh. |
16d20bd9 | 1071 | -K : do not use unless you know what you are doing. |
ecfc5424 | 1072 | -O : let -D and -U override definitions from loaded configuration file. |
2304df62 | 1073 | -S : perform variable substitutions on all .SH files (can mix with -f) |
a0d0e21e LW |
1074 | -U : undefine symbol: |
1075 | -U symbol symbol gets the value 'undef' | |
1076 | -U symbol= symbol gets completely empty | |
2304df62 AD |
1077 | -V : print version number and exit (with a zero status). |
1078 | EOM | |
1079 | exit 1 | |
1080 | ;; | |
1081 | esac | |
1082 | ||
1083 | exec 4>&1 | |
1084 | case "$silent" in | |
1085 | true) exec 1>/dev/null;; | |
1086 | esac | |
1087 | ||
ecfc5424 | 1088 | : run the defines and the undefines, if any, but leave the file out there... |
1aef975c AD |
1089 | touch optdef.sh |
1090 | . ./optdef.sh | |
a0d0e21e | 1091 | |
2304df62 AD |
1092 | case "$extractsh" in |
1093 | true) | |
1094 | case "$config_sh" in | |
1095 | '') config_sh='config.sh'; config='./config.sh';; | |
1096 | /*) config="$config_sh";; | |
1097 | *) config="./$config_sh";; | |
1098 | esac | |
1099 | echo " " | |
1100 | echo "Fetching answers from $config_sh..." | |
1101 | cd .. | |
1102 | . $config | |
1aef975c | 1103 | test "$override" && . ./optdef.sh |
2304df62 AD |
1104 | echo " " |
1105 | . ./UU/extract | |
1106 | rm -rf UU | |
1107 | echo "Done." | |
1108 | exit 0 | |
1109 | ;; | |
1110 | esac | |
1111 | ||
1112 | : set package name | |
85e6fe83 | 1113 | package=perl5 |
1aef975c AD |
1114 | first=`echo $package | sed -e 's/^\(.\).*/\1/'` |
1115 | last=`echo $package | sed -e 's/^.\(.*\)/\1/'` | |
1116 | case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in | |
1117 | ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;; | |
1118 | *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;; | |
1119 | esac | |
2304df62 AD |
1120 | |
1121 | : Eunice requires " " instead of "", can you believe it | |
1122 | echo " " | |
1123 | : Here we go... | |
1124 | echo "Beginning of configuration questions for $package." | |
1125 | ||
1aef975c | 1126 | trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15 |
2304df62 | 1127 | |
2304df62 AD |
1128 | : Some greps do not return status, grrr. |
1129 | echo "grimblepritz" >grimble | |
1130 | if grep blurfldyick grimble >/dev/null 2>&1 ; then | |
1131 | contains=contains | |
1132 | elif grep grimblepritz grimble >/dev/null 2>&1 ; then | |
1133 | contains=grep | |
1134 | else | |
1135 | contains=contains | |
1136 | fi | |
1137 | rm -f grimble | |
1138 | : the following should work in any shell | |
1139 | case "$contains" in | |
1140 | contains*) | |
1141 | echo " " | |
1142 | echo "AGH! Grep doesn't return a status. Attempting remedial action." | |
1143 | cat >contains <<'EOSS' | |
1144 | grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp | |
1145 | EOSS | |
1146 | chmod +x contains | |
1147 | esac | |
1148 | ||
1149 | : first determine how to suppress newline on echo command | |
1150 | echo " " | |
1151 | echo "Checking echo to see how to suppress newlines..." | |
1152 | (echo "hi there\c" ; echo " ") >.echotmp | |
1153 | if $contains c .echotmp >/dev/null 2>&1 ; then | |
1154 | echo "...using -n." | |
1155 | n='-n' | |
1156 | c='' | |
1157 | else | |
1158 | cat <<'EOM' | |
1159 | ...using \c | |
1160 | EOM | |
1161 | n='' | |
1162 | c='\c' | |
1163 | fi | |
1164 | echo $n "The star should be here-->$c" | |
1165 | echo '*' | |
1166 | rm -f .echotmp | |
1167 | ||
1168 | : Now test for existence of everything in MANIFEST | |
1169 | echo " " | |
1170 | if test -f ../MANIFEST; then | |
1171 | echo "First let's make sure your kit is complete. Checking..." >&4 | |
1172 | awk '$1 !~ /PACK[A-Z]+/ {print $1}' ../MANIFEST | split -50 | |
1173 | rm -f missing | |
1174 | for filelist in x??; do | |
1175 | (cd ..; ls `cat UU/$filelist` >/dev/null 2>>UU/missing) | |
1176 | done | |
1177 | if test -s missing; then | |
1178 | cat missing >&4 | |
1179 | cat >&4 <<'EOM' | |
1180 | ||
1181 | THIS PACKAGE SEEMS TO BE INCOMPLETE. | |
1182 | ||
1183 | You have the option of continuing the configuration process, despite the | |
1184 | distinct possibility that your kit is damaged, by typing 'y'es. If you | |
1185 | do, don't blame me if something goes wrong. I advise you to type 'n'o | |
284c50cc | 1186 | and contact the author (chip@perl.com). |
2304df62 AD |
1187 | |
1188 | EOM | |
1189 | echo $n "Continue? [n] $c" >&4 | |
1190 | read ans | |
1191 | case "$ans" in | |
1192 | y*) | |
1193 | echo "Continuing..." >&4 | |
1194 | rm -f missing | |
1195 | ;; | |
1196 | *) | |
1197 | echo "ABORTING..." >&4 | |
1198 | kill $$ | |
1199 | ;; | |
1200 | esac | |
1201 | else | |
1202 | echo "Looks good..." >&4 | |
1203 | fi | |
1204 | else | |
1205 | echo "There is no MANIFEST file. I hope your kit is complete !" | |
1206 | fi | |
1207 | rm -f missing x?? | |
1208 | ||
1209 | : compute the number of columns on the terminal for proper question formatting | |
1210 | case "$COLUMNS" in | |
1211 | '') COLUMNS='80';; | |
1212 | esac | |
1213 | ||
1214 | : set up the echo used in my read | |
1215 | myecho="case \"\$xxxm\" in | |
1216 | '') echo $n \"\$rp $c\" >&4;; | |
1217 | *) case \"\$rp\" in | |
1218 | '') echo $n \"[\$xxxm] $c\";; | |
1219 | *) | |
1220 | if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then | |
1221 | echo \"\$rp\" >&4 | |
1222 | echo $n \"[\$xxxm] $c\" >&4 | |
1223 | else | |
1224 | echo $n \"\$rp [\$xxxm] $c\" >&4 | |
1225 | fi | |
1226 | ;; | |
1227 | esac;; | |
1228 | esac" | |
1229 | ||
1230 | : now set up to do reads with possible shell escape and default assignment | |
1231 | cat <<EOSC >myread | |
28757baa | 1232 | $startsh |
2304df62 AD |
1233 | xxxm=\$dflt |
1234 | $myecho | |
1235 | ans='!' | |
1236 | case "\$fastread" in | |
1237 | yes) case "\$dflt" in | |
1238 | '') ;; | |
1239 | *) ans=''; | |
1240 | case "\$silent-\$rp" in | |
1241 | true-) ;; | |
1242 | *) echo " " >&4;; | |
1243 | esac;; | |
1244 | esac;; | |
1245 | *) case "\$silent" in | |
1246 | true) case "\$rp" in | |
1247 | '') ans='';; | |
1248 | esac;; | |
1249 | esac;; | |
1250 | esac | |
1251 | while expr "X\$ans" : "X!" >/dev/null; do | |
1252 | read answ | |
1253 | set x \$xxxm | |
1254 | shift | |
ff0cee69 | 1255 | aok=''; eval ans="\\"\$answ\\"" && aok=y |
2304df62 AD |
1256 | case "\$answ" in |
1257 | "\$ans") | |
1258 | case "\$ans" in | |
ecfc5424 AD |
1259 | \\&*) |
1260 | set x \`expr "X\$ans" : "X&\(.*\)\$"\` | |
1261 | shift | |
1262 | case "\$1" in | |
1263 | -d) | |
1264 | fastread=yes | |
40a7a20a | 1265 | echo "(OK, I'll run with -d after this question.)" >&4 |
ecfc5424 AD |
1266 | ;; |
1267 | -*) | |
40a7a20a | 1268 | echo "*** Sorry, \$1 not supported yet." >&4 |
ecfc5424 AD |
1269 | ;; |
1270 | esac | |
1271 | $myecho | |
1272 | ans=! | |
1273 | ;; | |
2304df62 AD |
1274 | "!") |
1275 | sh 1>&4 | |
1276 | echo " " | |
1277 | $myecho | |
1278 | ;; | |
1279 | !*) | |
1280 | set x \`expr "X\$ans" : "X!\(.*\)\$"\` | |
1281 | shift | |
1282 | sh 1>&4 -c "\$*" | |
1283 | echo " " | |
1284 | $myecho | |
1285 | ;; | |
1286 | esac;; | |
1287 | *) | |
1288 | case "\$aok" in | |
1289 | y) | |
1290 | echo "*** Substitution done -- please confirm." | |
1291 | xxxm="\$ans" | |
1292 | ans=\`echo $n "\$ans$c" | tr '\012' ' '\` | |
1293 | xxxm="\$ans" | |
1294 | ans=! | |
1295 | ;; | |
1296 | *) | |
1297 | echo "*** Error -- try again." | |
1298 | ans=! | |
1299 | ;; | |
1300 | esac | |
1301 | $myecho | |
1302 | ;; | |
1303 | esac | |
1304 | case "\$ans\$xxxm\$nostick" in | |
1305 | '') | |
1306 | ans=! | |
1307 | $myecho | |
1308 | ;; | |
1309 | esac | |
1310 | done | |
1311 | case "\$ans" in | |
1312 | '') ans="\$xxxm";; | |
1313 | esac | |
1314 | EOSC | |
1315 | ||
1316 | : create .config dir to save info across Configure sessions | |
1317 | test -d ../.config || mkdir ../.config | |
1318 | cat >../.config/README <<EOF | |
1319 | This directory created by Configure to save information that should | |
1320 | persist across sessions. | |
1321 | ||
1322 | You may safely delete it if you wish. | |
1323 | EOF | |
1324 | ||
1325 | : general instructions | |
1326 | needman=true | |
1327 | firsttime=true | |
760ac839 LW |
1328 | user=`(logname) 2>/dev/null` |
1329 | case "$user" in "") | |
1330 | user=`whoami 2>&1` ;; | |
1331 | esac | |
2304df62 AD |
1332 | if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then |
1333 | firsttime=false | |
1334 | echo " " | |
1335 | rp='Would you like to see the instructions?' | |
1336 | dflt=n | |
1337 | . ./myread | |
1338 | case "$ans" in | |
1339 | [yY]*) ;; | |
1340 | *) needman=false;; | |
1341 | esac | |
1342 | fi | |
1343 | if $needman; then | |
1344 | cat <<EOH | |
1345 | ||
1346 | This installation shell script will examine your system and ask you questions | |
a0d0e21e | 1347 | to determine how the perl5 package should be installed. If you get |
2304df62 AD |
1348 | stuck on a question, you may use a ! shell escape to start a subshell or |
1349 | execute a command. Many of the questions will have default answers in square | |
1350 | brackets; typing carriage return will give you the default. | |
1351 | ||
1352 | On some of the questions which ask for file or directory names you are allowed | |
1353 | to use the ~name construct to specify the login directory belonging to "name", | |
1354 | even if you don't have a shell which knows about that. Questions where this is | |
1355 | allowed will be marked "(~name ok)". | |
1356 | ||
1357 | EOH | |
1358 | rp='' | |
1359 | dflt='Type carriage return to continue' | |
1360 | . ./myread | |
1361 | cat <<'EOH' | |
1362 | ||
1363 | The prompter used in this script allows you to use shell variables and | |
1364 | backticks in your answers. You may use $1, $2, etc... to refer to the words | |
1365 | in the default answer, as if the default line was a set of arguments given to a | |
1366 | script shell. This means you may also use $* to repeat the whole default line, | |
1367 | so you do not have to re-type everything to add something to the default. | |
1368 | ||
1369 | Everytime there is a substitution, you will have to confirm. If there is an | |
1370 | error (e.g. an unmatched backtick), the default answer will remain unchanged | |
1371 | and you will be prompted again. | |
1372 | ||
1373 | If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all | |
1374 | the questions and use the computed defaults (or the previous answers if there | |
1375 | was already a config.sh file). Type 'Configure -h' for a list of options. | |
ecfc5424 | 1376 | You may also start interactively and then answer '& -d' at any prompt to turn |
7bac28a0 | 1377 | on the non-interactive behavior for the remainder of the execution. |
2304df62 AD |
1378 | |
1379 | EOH | |
1380 | . ./myread | |
1381 | cat <<EOH | |
1382 | ||
1383 | Much effort has been expended to ensure that this shell script will run on any | |
1384 | Unix system. If despite that it blows up on yours, your best bet is to edit | |
40000a8c AD |
1385 | Configure and run it again. If you can't run Configure for some reason, |
1386 | you'll have to generate a config.sh file by hand. Whatever problems you | |
284c50cc | 1387 | have, let me (chip@perl.com) know how I blew it. |
2304df62 AD |
1388 | |
1389 | This installation script affects things in two ways: | |
1390 | ||
1391 | 1) it may do direct variable substitutions on some of the files included | |
1392 | in this kit. | |
1393 | 2) it builds a config.h file for inclusion in C programs. You may edit | |
1394 | any of these files as the need arises after running this script. | |
1395 | ||
1396 | If you make a mistake on a question, there is no easy way to back up to it | |
1397 | currently. The easiest thing to do is to edit config.sh and rerun all the SH | |
1398 | files. Configure will offer to let you do this before it runs the SH files. | |
1399 | ||
1400 | EOH | |
1401 | dflt='Type carriage return to continue' | |
1402 | . ./myread | |
1403 | case "$firsttime" in | |
1404 | true) echo $user >>../.config/instruct;; | |
1405 | esac | |
1406 | fi | |
1407 | ||
2304df62 AD |
1408 | : find out where common programs are |
1409 | echo " " | |
1410 | echo "Locating common programs..." >&4 | |
1411 | cat <<EOSC >loc | |
1412 | $startsh | |
1413 | case \$# in | |
1414 | 0) exit 1;; | |
1415 | esac | |
1416 | thing=\$1 | |
1417 | shift | |
1418 | dflt=\$1 | |
1419 | shift | |
1420 | for dir in \$*; do | |
1421 | case "\$thing" in | |
1422 | .) | |
1423 | if test -d \$dir/\$thing; then | |
1424 | echo \$dir | |
1425 | exit 0 | |
1426 | fi | |
1427 | ;; | |
1428 | *) | |
a0d0e21e | 1429 | for thisthing in \$dir/\$thing; do |
ecfc5424 | 1430 | : just loop through to pick last item |
a0d0e21e | 1431 | done |
25f94b33 | 1432 | if test -f \$thisthing; then |
a0d0e21e | 1433 | echo \$thisthing |
2304df62 AD |
1434 | exit 0 |
1435 | elif test -f \$dir/\$thing.exe; then | |
1436 | : on Eunice apparently | |
1437 | echo \$dir/\$thing | |
1438 | exit 0 | |
1439 | fi | |
1440 | ;; | |
1441 | esac | |
1442 | done | |
1443 | echo \$dflt | |
1444 | exit 1 | |
1445 | EOSC | |
1446 | chmod +x loc | |
1447 | $eunicefix loc | |
1448 | loclist=" | |
1449 | awk | |
1450 | cat | |
ecfc5424 | 1451 | comm |
2304df62 AD |
1452 | cp |
1453 | echo | |
1454 | expr | |
a0d0e21e | 1455 | find |
2304df62 | 1456 | grep |
a0d0e21e | 1457 | ls |
2304df62 | 1458 | mkdir |
2304df62 AD |
1459 | rm |
1460 | sed | |
1461 | sort | |
85e6fe83 | 1462 | touch |
2304df62 AD |
1463 | tr |
1464 | uniq | |
1465 | " | |
1466 | trylist=" | |
1467 | Mcc | |
2304df62 AD |
1468 | byacc |
1469 | cpp | |
1470 | csh | |
1471 | date | |
1472 | egrep | |
8ff267be | 1473 | gzip |
2c7991dc | 1474 | less |
2304df62 | 1475 | line |
8ff267be | 1476 | ln |
2c7991dc | 1477 | more |
2304df62 AD |
1478 | nroff |
1479 | perl | |
2c7991dc | 1480 | pg |
40a7a20a | 1481 | sendmail |
2304df62 AD |
1482 | test |
1483 | uname | |
8ff267be | 1484 | zip |
2304df62 | 1485 | " |
8e07c86e | 1486 | pth=`echo $PATH | sed -e "s/$p_/ /g"` |
2304df62 AD |
1487 | pth="$pth /lib /usr/lib" |
1488 | for file in $loclist; do | |
1489 | xxx=`./loc $file $file $pth` | |
1490 | eval $file=$xxx | |
1491 | eval _$file=$xxx | |
1492 | case "$xxx" in | |
1493 | /*) | |
1494 | echo $file is in $xxx. | |
1495 | ;; | |
8e07c86e AD |
1496 | ?:[\\/]*) |
1497 | echo $file is in $xxx. | |
1498 | ;; | |
2304df62 | 1499 | *) |
25f94b33 AD |
1500 | echo "I don't know where '$file' is, and my life depends on it." >&4 |
1501 | echo "Go find a public domain implementation or fix your PATH setting!" >&4 | |
4633a7c4 | 1502 | exit 1 |
2304df62 AD |
1503 | ;; |
1504 | esac | |
1505 | done | |
1506 | echo " " | |
1507 | echo "Don't worry if any of the following aren't found..." | |
1508 | say=offhand | |
1509 | for file in $trylist; do | |
1510 | xxx=`./loc $file $file $pth` | |
1511 | eval $file=$xxx | |
1512 | eval _$file=$xxx | |
1513 | case "$xxx" in | |
1514 | /*) | |
1515 | echo $file is in $xxx. | |
1516 | ;; | |
8e07c86e AD |
1517 | ?:[\\/]*) |
1518 | echo $file is in $xxx. | |
1519 | ;; | |
2304df62 AD |
1520 | *) |
1521 | echo "I don't see $file out there, $say." | |
1522 | say=either | |
1523 | ;; | |
1524 | esac | |
1525 | done | |
1526 | case "$egrep" in | |
1527 | egrep) | |
1528 | echo "Substituting grep for egrep." | |
1529 | egrep=$grep | |
1530 | ;; | |
1531 | esac | |
8ff267be | 1532 | case "$ln" in |
1533 | ln) | |
1534 | echo "Substituting cp for ln." | |
1535 | ln=$cp | |
1536 | ;; | |
1537 | esac | |
2304df62 AD |
1538 | case "$test" in |
1539 | test) | |
1540 | echo "Hopefully test is built into your sh." | |
1541 | ;; | |
1542 | *) | |
ecfc5424 | 1543 | if `sh -c "PATH= test true" >/dev/null 2>&1`; then |
2304df62 AD |
1544 | echo "Using the test built into your sh." |
1545 | test=test | |
1546 | _test=test | |
1547 | fi | |
1548 | ;; | |
1549 | esac | |
1550 | case "$echo" in | |
1551 | echo) | |
1552 | echo "Hopefully echo is built into your sh." | |
1553 | ;; | |
1554 | '') ;; | |
1555 | *) | |
1556 | echo " " | |
1557 | echo "Checking compatibility between $echo and builtin echo (if any)..." >&4 | |
1558 | $echo $n "hi there$c" >foo1 | |
1559 | echo $n "hi there$c" >foo2 | |
1560 | if cmp foo1 foo2 >/dev/null 2>&1; then | |
1561 | echo "They are compatible. In fact, they may be identical." | |
1562 | else | |
1563 | case "$n" in | |
1564 | '-n') n='' c='\c';; | |
1565 | *) n='-n' c='';; | |
1566 | esac | |
1567 | cat <<FOO | |
1568 | They are not compatible! You are probably running ksh on a non-USG system. | |
1569 | I'll have to use $echo instead of the builtin, since Bourne shell doesn't | |
1570 | have echo built in and we may have to run some Bourne shell scripts. That | |
1571 | means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous. | |
1572 | ||
1573 | FOO | |
1574 | $echo $n "The star should be here-->$c" | |
1575 | $echo "*" | |
1576 | fi | |
1577 | $rm -f foo1 foo2 | |
1578 | ;; | |
1579 | esac | |
1580 | ||
a0d0e21e LW |
1581 | : determine whether symbolic links are supported |
1582 | echo " " | |
1583 | $touch blurfl | |
1584 | if $ln -s blurfl sym > /dev/null 2>&1 ; then | |
1585 | echo "Symbolic links are supported." >&4 | |
1586 | lns="$ln -s" | |
1587 | else | |
1588 | echo "Symbolic links are NOT supported." >&4 | |
1589 | lns="$ln" | |
1590 | fi | |
1591 | $rm -f blurfl sym | |
1592 | ||
ecfc5424 AD |
1593 | : see whether [:lower:] and [:upper:] are supported character classes |
1594 | echo " " | |
1595 | up='[A-Z]' | |
1596 | low='[a-z]' | |
1597 | case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in | |
1598 | ABYZ) | |
1599 | echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4 | |
1600 | up='[:upper:]' | |
1601 | low='[:lower:]' | |
1602 | ;; | |
1603 | *) | |
1604 | echo "Your tr only supports [a-z] and [A-Z] to convert case." >&4 | |
1605 | ;; | |
1606 | esac | |
1607 | : set up the translation script tr, must be called with ./tr of course | |
1608 | cat >tr <<EOSC | |
1609 | $startsh | |
1610 | case "\$1\$2" in | |
1611 | '[A-Z][a-z]') exec $tr '$up' '$low';; | |
1612 | '[a-z][A-Z]') exec $tr '$low' '$up';; | |
1613 | esac | |
1614 | exec $tr "\$@" | |
1615 | EOSC | |
1616 | chmod +x tr | |
1617 | $eunicefix tr | |
1618 | ||
2304df62 AD |
1619 | : Try to determine whether config.sh was made on this system |
1620 | case "$config_sh" in | |
1621 | '') | |
1622 | myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1` | |
a0d0e21e | 1623 | myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \ |
ecfc5424 | 1624 | ./tr '[A-Z]' '[a-z]' | tr '\012' ' '` |
1aef975c | 1625 | newmyuname="$myuname" |
2304df62 | 1626 | dflt=n |
16d20bd9 AD |
1627 | case "$knowitall" in |
1628 | '') | |
1629 | if test -f ../config.sh; then | |
1630 | if $contains myuname= ../config.sh >/dev/null 2>&1; then | |
1631 | eval "`grep myuname= ../config.sh`" | |
1632 | fi | |
1633 | if test "X$myuname" = "X$newmyuname"; then | |
1634 | dflt=y | |
1635 | fi | |
2304df62 | 1636 | fi |
16d20bd9 AD |
1637 | ;; |
1638 | *) dflt=y;; | |
1639 | esac | |
2304df62 AD |
1640 | |
1641 | : Get old answers from old config file if Configure was run on the | |
1642 | : same system, otherwise use the hints. | |
1643 | hint=default | |
1644 | cd .. | |
1645 | if test -f config.sh; then | |
16d20bd9 AD |
1646 | echo " " |
1647 | rp="I see a config.sh file. Shall I use it to set the defaults?" | |
2304df62 AD |
1648 | . UU/myread |
1649 | case "$ans" in | |
1650 | n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;; | |
1651 | *) echo "Fetching default answers from your old config.sh file..." >&4 | |
ecfc5424 AD |
1652 | tmp_n="$n" |
1653 | tmp_c="$c" | |
85cad39c | 1654 | tmp_sh="$sh" |
2304df62 AD |
1655 | . ./config.sh |
1656 | cp config.sh UU | |
ecfc5424 AD |
1657 | n="$tmp_n" |
1658 | c="$tmp_c" | |
85cad39c | 1659 | : Older versions did not always set $sh. Catch re-use of such |
1660 | : an old config.sh. | |
1661 | case "$sh" in | |
1662 | '') sh="$tmp_sh" ;; | |
1663 | esac | |
2304df62 AD |
1664 | hint=previous |
1665 | ;; | |
1666 | esac | |
1667 | fi | |
1668 | if test ! -f config.sh; then | |
1669 | $cat <<EOM | |
1670 | ||
1671 | First time through, eh? I have some defaults handy for the following systems: | |
1672 | ||
1673 | EOM | |
1674 | cd hints; ls -C *.sh | $sed 's/\.sh/ /g' >&4 | |
1675 | dflt='' | |
1676 | : Half the following guesses are probably wrong... If you have better | |
284c50cc | 1677 | : tests or hints, please send them to chip@perl.com |
2304df62 | 1678 | : The metaconfig authors would also appreciate a copy... |
a0d0e21e | 1679 | $test -f /irix && osname=irix |
85e6fe83 LW |
1680 | $test -f /xenix && osname=sco_xenix |
1681 | $test -f /dynix && osname=dynix | |
1682 | $test -f /dnix && osname=dnix | |
5f05dabc | 1683 | $test -f /lynx.os && osname=lynxos |
1684 | $test -f /unicos && osname=unicos && osvers=`$uname -r` | |
7a4c00b4 | 1685 | $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r` |
85e6fe83 | 1686 | $test -f /bin/mips && /bin/mips && osname=mips |
ecfc5424 AD |
1687 | $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \ |
1688 | $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4 | |
a0d0e21e LW |
1689 | $test -d /usr/apollo/bin && osname=apollo |
1690 | $test -f /etc/saf/_sactab && osname=svr4 | |
85e6fe83 | 1691 | $test -d /usr/include/minix && osname=minix |
4633a7c4 LW |
1692 | if $test -d /MachTen; then |
1693 | osname=machten | |
1694 | if $test -x /sbin/version; then | |
1695 | osvers=`/sbin/version | $awk '{print $2}' | | |
1696 | $sed -e 's/[A-Za-z]$//'` | |
1697 | elif $test -x /usr/etc/version; then | |
1698 | osvers=`/usr/etc/version | $awk '{print $2}' | | |
1699 | $sed -e 's/[A-Za-z]$//'` | |
1700 | else | |
1701 | osvers="$2.$3" | |
1702 | fi | |
1703 | fi | |
2304df62 AD |
1704 | if $test -f $uname; then |
1705 | set X $myuname | |
1706 | shift | |
1707 | ||
2304df62 | 1708 | case "$5" in |
85e6fe83 | 1709 | fps*) osname=fps ;; |
2304df62 AD |
1710 | mips*) |
1711 | case "$4" in | |
85e6fe83 LW |
1712 | umips) osname=umips ;; |
1713 | *) osname=mips ;; | |
2304df62 | 1714 | esac;; |
85e6fe83 LW |
1715 | [23]100) osname=mips ;; |
1716 | next*) osname=next ;; | |
ecfc5424 AD |
1717 | i386*) |
1718 | if $test -f /etc/kconfig; then | |
1719 | osname=isc | |
a0d0e21e LW |
1720 | if test "$lns" = "ln -s"; then |
1721 | osvers=4 | |
1722 | elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then | |
1723 | osvers=3 | |
2304df62 | 1724 | elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then |
a0d0e21e | 1725 | osvers=2 |
ecfc5424 AD |
1726 | fi |
1727 | fi | |
1728 | ;; | |
2304df62 AD |
1729 | esac |
1730 | ||
1731 | case "$1" in | |
a0d0e21e LW |
1732 | aix) osname=aix |
1733 | tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1` | |
1734 | case "$tmp" in | |
1aef975c | 1735 | 'not found') osvers="$4"."$3" ;; |
a0d0e21e LW |
1736 | '<3240'|'<>3240') osvers=3.2.0 ;; |
1737 | '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;; | |
1738 | '=3250'|'>3250') osvers=3.2.5 ;; | |
1aef975c | 1739 | *) osvers=$tmp;; |
a0d0e21e LW |
1740 | esac |
1741 | ;; | |
23f87696 SZ |
1742 | *dc.osx) osname=dcosx |
1743 | osvers="$3" | |
1744 | ;; | |
a0d0e21e LW |
1745 | dnix) osname=dnix |
1746 | osvers="$3" | |
1747 | ;; | |
1748 | domainos) osname=apollo | |
1749 | osvers="$3" | |
1750 | ;; | |
1751 | dgux) osname=dgux | |
1752 | osvers="$3" | |
1753 | ;; | |
760ac839 LW |
1754 | dynixptx*) osname=dynixptx |
1755 | osvers="$3" | |
1756 | ;; | |
a0d0e21e LW |
1757 | freebsd) osname=freebsd |
1758 | osvers="$3" ;; | |
1759 | genix) osname=genix ;; | |
1760 | hp*) osname=hpux | |
1761 | case "$3" in | |
1762 | *.08.*) osvers=9 ;; | |
1763 | *.09.*) osvers=9 ;; | |
1764 | *.10.*) osvers=10 ;; | |
ecfc5424 | 1765 | *) osvers="$3" ;; |
a0d0e21e LW |
1766 | esac |
1767 | ;; | |
a78b0d02 | 1768 | irix*) osname=irix |
a0d0e21e LW |
1769 | case "$3" in |
1770 | 4*) osvers=4 ;; | |
1771 | 5*) osvers=5 ;; | |
ecfc5424 | 1772 | *) osvers="$3" ;; |
a0d0e21e LW |
1773 | esac |
1774 | ;; | |
1775 | linux) osname=linux | |
1776 | case "$3" in | |
a0d0e21e LW |
1777 | *) osvers="$3" ;; |
1778 | esac | |
1779 | ;; | |
1780 | netbsd*) osname=netbsd | |
ecfc5424 AD |
1781 | osvers="$3" |
1782 | ;; | |
4e81affe MM |
1783 | news-os) osvers="$3" |
1784 | case "$3" in | |
1785 | 4*) osname=newsos4 ;; | |
1786 | *) osname=newsos ;; | |
1787 | esac | |
1788 | ;; | |
a0d0e21e LW |
1789 | bsd386) osname=bsd386 |
1790 | osvers=`$uname -r` | |
1791 | ;; | |
ae3afa4e TH |
1792 | powerux | power_ux | powermax_os | powermaxos | \ |
1793 | powerunix | power_unix) osname=powerux | |
1794 | osvers="$3" | |
1795 | ;; | |
a0d0e21e LW |
1796 | next*) osname=next ;; |
1797 | solaris) osname=solaris | |
1798 | case "$3" in | |
1799 | 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;; | |
ecfc5424 | 1800 | *) osvers="$3" ;; |
a0d0e21e LW |
1801 | esac |
1802 | ;; | |
85e6fe83 LW |
1803 | sunos) osname=sunos |
1804 | case "$3" in | |
85e6fe83 LW |
1805 | 5*) osname=solaris |
1806 | osvers=`echo $3 | $sed 's/^5/2/g'` ;; | |
a0d0e21e | 1807 | *) osvers="$3" ;; |
2304df62 AD |
1808 | esac |
1809 | ;; | |
a0d0e21e | 1810 | titanos) osname=titanos |
85e6fe83 | 1811 | case "$3" in |
a0d0e21e LW |
1812 | 1*) osvers=1 ;; |
1813 | 2*) osvers=2 ;; | |
1814 | 3*) osvers=3 ;; | |
1815 | 4*) osvers=4 ;; | |
ecfc5424 | 1816 | *) osvers="$3" ;; |
2304df62 AD |
1817 | esac |
1818 | ;; | |
85e6fe83 | 1819 | ultrix) osname=ultrix |
ecfc5424 | 1820 | osvers="$3" |
2304df62 | 1821 | ;; |
28757baa | 1822 | osf1|mls+) case "$5" in |
fed7345c AD |
1823 | alpha) |
1824 | osname=dec_osf | |
1825 | osvers=`echo "$3" | sed 's/^[vt]//'` | |
ecfc5424 AD |
1826 | ;; |
1827 | hp*) osname=hp_osf1 ;; | |
1828 | mips) osname=mips_osf1 ;; | |
85e6fe83 LW |
1829 | esac |
1830 | ;; | |
a0d0e21e LW |
1831 | uts) osname=uts |
1832 | osvers="$3" | |
1833 | ;; | |
ff68c719 | 1834 | qnx) osname=qnx |
1835 | osvers="$4" | |
1836 | ;; | |
85e6fe83 | 1837 | $2) case "$osname" in |
2304df62 | 1838 | *isc*) ;; |
a0d0e21e | 1839 | *freebsd*) ;; |
5f05dabc | 1840 | svr*) |
a0d0e21e LW |
1841 | : svr4.x or possibly later |
1842 | case "svr$3" in | |
1843 | ${osname}*) | |
1844 | osname=svr$3 | |
1845 | osvers=$4 | |
1846 | ;; | |
1847 | esac | |
1848 | case "$osname" in | |
1849 | svr4.0) | |
1850 | : Check for ESIX | |
1851 | if test -f /stand/boot ; then | |
1852 | eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot` | |
ecfc5424 AD |
1853 | if test -n "$INITPROG" -a -f "$INITPROG"; then |
1854 | isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'` | |
1855 | if test -n "$isesix"; then | |
a0d0e21e LW |
1856 | osname=esix4 |
1857 | fi | |
1858 | fi | |
1859 | fi | |
1860 | ;; | |
1861 | esac | |
1862 | ;; | |
2304df62 | 1863 | *) if test -f /etc/systemid; then |
a0d0e21e LW |
1864 | osname=sco |
1865 | set `echo $3 | $sed 's/\./ /g'` $4 | |
2304df62 | 1866 | if $test -f sco_$1_$2_$3.sh; then |
85e6fe83 | 1867 | osvers=$1.$2.$3 |
2304df62 | 1868 | elif $test -f sco_$1_$2.sh; then |
85e6fe83 | 1869 | osvers=$1.$2 |
2304df62 | 1870 | elif $test -f sco_$1.sh; then |
85e6fe83 | 1871 | osvers=$1 |
2304df62 | 1872 | fi |
a0d0e21e LW |
1873 | else |
1874 | case "$osname" in | |
1875 | '') : Still unknown. Probably a generic Sys V. | |
1876 | osname="sysv" | |
1877 | osvers="$3" | |
1878 | ;; | |
1879 | esac | |
2304df62 AD |
1880 | fi |
1881 | ;; | |
1882 | esac | |
1883 | ;; | |
a0d0e21e LW |
1884 | *) case "$osname" in |
1885 | '') : Still unknown. Probably a generic BSD. | |
1886 | osname="$1" | |
1887 | osvers="$3" | |
1888 | ;; | |
1889 | esac | |
1890 | ;; | |
2304df62 AD |
1891 | esac |
1892 | else | |
4e81affe | 1893 | if test -f /vmunix -a -f newsos4.sh; then |
ecfc5424 | 1894 | (what /vmunix | ../UU/tr '[A-Z]' '[a-z]') > ../UU/kernel.what 2>&1 |
2304df62 | 1895 | if $contains news-os ../UU/kernel.what >/dev/null 2>&1; then |
4e81affe | 1896 | osname=newsos4 |
2304df62 AD |
1897 | fi |
1898 | $rm -f ../UU/kernel.what | |
8e07c86e AD |
1899 | elif test -d c:/.; then |
1900 | set X $myuname | |
1901 | osname=os2 | |
1902 | osvers="$5" | |
2304df62 AD |
1903 | fi |
1904 | fi | |
85e6fe83 | 1905 | |
a0d0e21e LW |
1906 | : Now look for a hint file osname_osvers, unless one has been |
1907 | : specified already. | |
1908 | case "$hintfile" in | |
1909 | ''|' ') | |
ecfc5424 | 1910 | file=`echo "${osname}_${osvers}" | $sed -e 's@\.@_@g' -e 's@_$@@'` |
a0d0e21e | 1911 | : Also try without trailing minor version numbers. |
ecfc5424 AD |
1912 | xfile=`echo $file | $sed -e 's@_[^_]*$@@'` |
1913 | xxfile=`echo $xfile | $sed -e 's@_[^_]*$@@'` | |
1914 | xxxfile=`echo $xxfile | $sed -e 's@_[^_]*$@@'` | |
1915 | xxxxfile=`echo $xxxfile | $sed -e 's@_[^_]*$@@'` | |
a0d0e21e LW |
1916 | case "$file" in |
1917 | '') dflt=none ;; | |
1918 | *) case "$osvers" in | |
1919 | '') dflt=$file | |
1920 | ;; | |
1921 | *) if $test -f $file.sh ; then | |
1922 | dflt=$file | |
1923 | elif $test -f $xfile.sh ; then | |
1924 | dflt=$xfile | |
1925 | elif $test -f $xxfile.sh ; then | |
1926 | dflt=$xxfile | |
1927 | elif $test -f $xxxfile.sh ; then | |
1928 | dflt=$xxxfile | |
1929 | elif $test -f $xxxxfile.sh ; then | |
1930 | dflt=$xxxxfile | |
1931 | elif $test -f "${osname}.sh" ; then | |
1932 | dflt="${osname}" | |
1933 | else | |
1934 | dflt=none | |
1935 | fi | |
1936 | ;; | |
1937 | esac | |
85e6fe83 LW |
1938 | ;; |
1939 | esac | |
1940 | ;; | |
a0d0e21e | 1941 | *) |
ecfc5424 | 1942 | dflt=`echo $hintfile | $sed 's/\.sh$//'` |
a0d0e21e | 1943 | ;; |
2304df62 | 1944 | esac |
1aef975c | 1945 | |
2304df62 AD |
1946 | $cat <<EOM |
1947 | ||
1948 | You may give one or more space-separated answers, or "none" if appropriate. | |
1949 | If your OS version has no hints, DO NOT give a wrong version -- say "none". | |
1950 | ||
1951 | EOM | |
1952 | rp="Which of these apply, if any?" | |
1953 | . ../UU/myread | |
85e6fe83 LW |
1954 | tans=$ans |
1955 | for file in $tans; do | |
2304df62 AD |
1956 | if $test -f $file.sh; then |
1957 | . ./$file.sh | |
1958 | $cat $file.sh >> ../UU/config.sh | |
85e6fe83 | 1959 | elif $test X$tans = X -o X$tans = Xnone ; then |
2304df62 AD |
1960 | : nothing |
1961 | else | |
85e6fe83 LW |
1962 | : Give one chance to correct a possible typo. |
1963 | echo "$file.sh does not exist" | |
1964 | dflt=$file | |
1965 | rp="hint to use instead?" | |
1966 | . ../UU/myread | |
1967 | for file in $ans; do | |
1968 | if $test -f "$file.sh"; then | |
1969 | . ./$file.sh | |
1970 | $cat $file.sh >> ../UU/config.sh | |
1971 | elif $test X$ans = X -o X$ans = Xnone ; then | |
1972 | : nothing | |
1973 | else | |
1974 | echo "$file.sh does not exist -- ignored." | |
1975 | fi | |
1976 | done | |
2304df62 AD |
1977 | fi |
1978 | done | |
85e6fe83 | 1979 | |
2304df62 | 1980 | hint=recommended |
85e6fe83 LW |
1981 | : Remember our hint file for later. |
1982 | if $test -f "$file.sh" ; then | |
a0d0e21e | 1983 | hintfile="$file" |
85e6fe83 | 1984 | else |
a0d0e21e | 1985 | hintfile='' |
85e6fe83 LW |
1986 | fi |
1987 | ||
2304df62 AD |
1988 | cd .. |
1989 | fi | |
1990 | cd UU | |
1991 | ;; | |
1992 | *) | |
1993 | echo " " | |
1994 | echo "Fetching default answers from $config_sh..." >&4 | |
ecfc5424 AD |
1995 | tmp_n="$n" |
1996 | tmp_c="$c" | |
2304df62 AD |
1997 | cd .. |
1998 | cp $config_sh config.sh 2>/dev/null | |
a78b0d02 | 1999 | chmod +w config.sh |
2304df62 AD |
2000 | . ./config.sh |
2001 | cd UU | |
2002 | cp ../config.sh . | |
ecfc5424 AD |
2003 | n="$tmp_n" |
2004 | c="$tmp_c" | |
2304df62 AD |
2005 | hint=previous |
2006 | ;; | |
2007 | esac | |
1aef975c AD |
2008 | test "$override" && . ./optdef.sh |
2009 | myuname="$newmyuname" | |
2304df62 AD |
2010 | |
2011 | : Restore computed paths | |
2012 | for file in $loclist $trylist; do | |
2013 | eval $file="\$_$file" | |
2014 | done | |
2015 | ||
85e6fe83 | 2016 | cat << EOM |
a0d0e21e | 2017 | |
85e6fe83 | 2018 | Configure uses the operating system name and version to set some defaults. |
ecfc5424 AD |
2019 | The default value is probably right if the name rings a bell. Otherwise, |
2020 | since spelling matters for me, either accept the default or answer "none" | |
2021 | to leave it blank. | |
a0d0e21e | 2022 | |
85e6fe83 | 2023 | EOM |
85e6fe83 | 2024 | case "$osname" in |
a0d0e21e | 2025 | ''|' ') |
85e6fe83 | 2026 | case "$hintfile" in |
a0d0e21e | 2027 | ''|' '|none) dflt=none ;; |
ecfc5424 | 2028 | *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;; |
85e6fe83 LW |
2029 | esac |
2030 | ;; | |
2031 | *) dflt="$osname" ;; | |
2032 | esac | |
2033 | rp="Operating system name?" | |
2034 | . ./myread | |
2035 | case "$ans" in | |
ecfc5424 AD |
2036 | none) osname='' ;; |
2037 | *) osname=`echo "$ans" | $sed -e 's/[ ][ ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;; | |
85e6fe83 | 2038 | esac |
8ff267be | 2039 | echo " " |
2040 | case "$osvers" in | |
2041 | ''|' ') | |
2042 | case "$hintfile" in | |
2043 | ''|' '|none) dflt=none ;; | |
2044 | *) dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'` | |
2045 | dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'` | |
2046 | case "$dflt" in | |
2047 | ''|' ') dflt=none ;; | |
2048 | esac | |
2049 | ;; | |
2050 | esac | |
2051 | ;; | |
2052 | *) dflt="$osvers" ;; | |
2053 | esac | |
2054 | rp="Operating system version?" | |
2055 | . ./myread | |
2056 | case "$ans" in | |
2057 | none) osvers='' ;; | |
2058 | *) osvers="$ans" ;; | |
2059 | esac | |
2060 | ||
760ac839 LW |
2061 | |
2062 | ||
2304df62 | 2063 | : who configured the system |
7792a3d7 | 2064 | cf_time=`LC_ALL=C; export LC_ALL; $date 2>&1` |
8ff267be | 2065 | cf_by=`(logname) 2>/dev/null` |
2066 | case "$cf_by" in "") | |
2067 | cf_by=`(whoami) 2>/dev/null` | |
2068 | case "$cf_by" in "") | |
2069 | cf_by=unknown ;; | |
2070 | esac ;; | |
2071 | esac | |
2304df62 | 2072 | |
4633a7c4 | 2073 | : determine the architecture name |
2304df62 | 2074 | echo " " |
4633a7c4 LW |
2075 | if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then |
2076 | tarch=`arch`"-$osname" | |
2077 | elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then | |
2078 | if uname -m > tmparch 2>&1 ; then | |
7e1af8bc | 2079 | tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \ |
5f05dabc | 2080 | -e 's/$/'"-$osname/" tmparch` |
4633a7c4 LW |
2081 | else |
2082 | tarch="$osname" | |
2083 | fi | |
2084 | $rm -f tmparch | |
2085 | else | |
2086 | tarch="$osname" | |
2087 | fi | |
2088 | case "$myarchname" in | |
2089 | ''|"$tarch") ;; | |
2090 | *) | |
2091 | echo "(Your architecture name used to be $myarchname.)" | |
2092 | archname='' | |
2304df62 AD |
2093 | ;; |
2094 | esac | |
4633a7c4 LW |
2095 | case "$archname" in |
2096 | '') dflt="$tarch";; | |
2097 | *) dflt="$archname";; | |
2098 | esac | |
2099 | rp='What is your architecture name' | |
2100 | . ./myread | |
dc66995c | 2101 | case "$usethreads" in |
c6ee37c5 MB |
2102 | $define) echo "Threads selected." >&4 |
2103 | case "$ans" in | |
2104 | *-thread) echo "...and architecture name already ends in -thread." >&4 | |
2105 | archname="$ans" | |
2106 | ;; | |
2107 | *) archname="$ans-thread" | |
2108 | echo "...setting architecture name to $archname." >&4 | |
2109 | ;; | |
2110 | esac | |
dc66995c MB |
2111 | ;; |
2112 | *) archname="$ans" ;; | |
2113 | esac | |
4633a7c4 LW |
2114 | myarchname="$tarch" |
2115 | ||
2116 | : is AFS running? | |
2117 | echo " " | |
2afac517 | 2118 | case "$afs" in |
2119 | $define|true) afs=true ;; | |
2120 | $undef|false) afs=false ;; | |
2121 | *) if test -d /afs; then | |
2122 | afs=true | |
2123 | else | |
2124 | afs=false | |
2125 | fi | |
2126 | ;; | |
2127 | esac | |
2128 | if $afs; then | |
4633a7c4 | 2129 | echo "AFS may be running... I'll be extra cautious then..." >&4 |
2304df62 | 2130 | else |
4633a7c4 | 2131 | echo "AFS does not seem to be running..." >&4 |
2304df62 AD |
2132 | fi |
2133 | ||
4633a7c4 LW |
2134 | : decide how portable to be. Allow command line overrides. |
2135 | case "$d_portable" in | |
2136 | "$undef") ;; | |
2137 | *) d_portable="$define" ;; | |
2304df62 | 2138 | esac |
2304df62 | 2139 | |
4633a7c4 LW |
2140 | : set up shell script to do ~ expansion |
2141 | cat >filexp <<EOSS | |
2142 | $startsh | |
2143 | : expand filename | |
2144 | case "\$1" in | |
2145 | ~/*|~) | |
2146 | echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|" | |
2304df62 | 2147 | ;; |
4633a7c4 LW |
2148 | ~*) |
2149 | if $test -f /bin/csh; then | |
2150 | /bin/csh -f -c "glob \$1" | |
2151 | failed=\$? | |
2152 | echo "" | |
2153 | exit \$failed | |
2154 | else | |
2155 | name=\`$expr x\$1 : '..\([^/]*\)'\` | |
2156 | dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\` | |
2157 | if $test ! -d "\$dir"; then | |
2158 | me=\`basename \$0\` | |
2159 | echo "\$me: can't locate home directory for: \$name" >&2 | |
2160 | exit 1 | |
2161 | fi | |
2162 | case "\$1" in | |
2163 | */*) | |
2164 | echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\` | |
2165 | ;; | |
2166 | *) | |
2167 | echo \$dir | |
2168 | ;; | |
2304df62 | 2169 | esac |
4633a7c4 | 2170 | fi |
2304df62 AD |
2171 | ;; |
2172 | *) | |
4633a7c4 | 2173 | echo \$1 |
2304df62 AD |
2174 | ;; |
2175 | esac | |
4633a7c4 LW |
2176 | EOSS |
2177 | chmod +x filexp | |
2178 | $eunicefix filexp | |
2304df62 AD |
2179 | |
2180 | : now set up to get a file name | |
28757baa | 2181 | cat <<EOS >getfile |
2182 | $startsh | |
2183 | EOS | |
2184 | cat <<'EOSC' >>getfile | |
2304df62 AD |
2185 | tilde='' |
2186 | fullpath='' | |
2187 | already='' | |
2188 | skip='' | |
2189 | none_ok='' | |
2190 | exp_file='' | |
a0d0e21e | 2191 | nopath_ok='' |
2304df62 AD |
2192 | orig_rp="$rp" |
2193 | orig_dflt="$dflt" | |
2194 | ||
2195 | case "$fn" in | |
ecfc5424 AD |
2196 | *\(*) |
2197 | expr $fn : '.*(\(.*\)).*' | tr ',' '\012' >getfile.ok | |
2198 | fn=`echo $fn | sed 's/(.*)//'` | |
2199 | ;; | |
2200 | esac | |
2201 | ||
2202 | case "$fn" in | |
a0d0e21e LW |
2203 | *:*) |
2204 | loc_file=`expr $fn : '.*:\(.*\)'` | |
2205 | fn=`expr $fn : '\(.*\):.*'` | |
2206 | ;; | |
2207 | esac | |
2208 | ||
2209 | case "$fn" in | |
2304df62 AD |
2210 | *~*) tilde=true;; |
2211 | esac | |
2212 | case "$fn" in | |
2213 | */*) fullpath=true;; | |
2214 | esac | |
2215 | case "$fn" in | |
2216 | *+*) skip=true;; | |
2217 | esac | |
2218 | case "$fn" in | |
2219 | *n*) none_ok=true;; | |
2220 | esac | |
2221 | case "$fn" in | |
2222 | *e*) exp_file=true;; | |
2223 | esac | |
a0d0e21e LW |
2224 | case "$fn" in |
2225 | *p*) nopath_ok=true;; | |
2226 | esac | |
2304df62 AD |
2227 | |
2228 | case "$fn" in | |
2229 | *f*) type='File';; | |
2230 | *d*) type='Directory';; | |
a0d0e21e | 2231 | *l*) type='Locate';; |
2304df62 AD |
2232 | esac |
2233 | ||
2234 | what="$type" | |
2235 | case "$what" in | |
2236 | Locate) what='File';; | |
2237 | esac | |
2238 | ||
2239 | case "$exp_file" in | |
2240 | '') | |
2241 | case "$d_portable" in | |
2242 | "$define") ;; | |
2243 | *) exp_file=true;; | |
2244 | esac | |
2245 | ;; | |
2246 | esac | |
2247 | ||
2248 | cd .. | |
2249 | while test "$type"; do | |
2250 | redo='' | |
2251 | rp="$orig_rp" | |
2252 | dflt="$orig_dflt" | |
2253 | case "$tilde" in | |
2254 | true) rp="$rp (~name ok)";; | |
2255 | esac | |
2256 | . UU/myread | |
ecfc5424 AD |
2257 | if test -f UU/getfile.ok && \ |
2258 | $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1 | |
2259 | then | |
2260 | value="$ans" | |
2261 | ansexp="$ans" | |
2262 | break | |
2263 | fi | |
2304df62 AD |
2264 | case "$ans" in |
2265 | none) | |
2266 | value='' | |
2267 | ansexp='' | |
2268 | case "$none_ok" in | |
2269 | true) type='';; | |
2270 | esac | |
2271 | ;; | |
2272 | *) | |
2273 | case "$tilde" in | |
2274 | '') value="$ans" | |
2275 | ansexp="$ans";; | |
2276 | *) | |
2277 | value=`UU/filexp $ans` | |
2278 | case $? in | |
2279 | 0) | |
2280 | if test "$ans" != "$value"; then | |
ecfc5424 | 2281 | echo "(That expands to $value on this system.)" |
2304df62 AD |
2282 | fi |
2283 | ;; | |
2284 | *) value="$ans";; | |
2285 | esac | |
2286 | ansexp="$value" | |
2287 | case "$exp_file" in | |
2288 | '') value="$ans";; | |
2289 | esac | |
2290 | ;; | |
2291 | esac | |
2292 | case "$fullpath" in | |
2293 | true) | |
2294 | case "$ansexp" in | |
2295 | /*) value="$ansexp" ;; | |
2296 | *) | |
2297 | redo=true | |
2298 | case "$already" in | |
2299 | true) | |
2300 | echo "I shall only accept a full path name, as in /bin/ls." >&4 | |
2301 | echo "Use a ! shell escape if you wish to check pathnames." >&4 | |
2302 | ;; | |
2303 | *) | |
2304 | echo "Please give a full path name, starting with slash." >&4 | |
2305 | case "$tilde" in | |
2306 | true) | |
2307 | echo "Note that using ~name is ok provided it expands well." >&4 | |
2308 | already=true | |
2309 | ;; | |
2310 | esac | |
2311 | esac | |
2312 | ;; | |
2313 | esac | |
2314 | ;; | |
2315 | esac | |
2316 | case "$redo" in | |
2317 | '') | |
2318 | case "$type" in | |
2319 | File) | |
2320 | if test -f "$ansexp"; then | |
2321 | type='' | |
2322 | elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1 | |
2323 | then | |
2324 | echo "($value is not a plain file, but that's ok.)" | |
2325 | type='' | |
2326 | fi | |
2327 | ;; | |
2328 | Directory) | |
2329 | if test -d "$ansexp"; then | |
2330 | type='' | |
2331 | fi | |
2332 | ;; | |
2333 | Locate) | |
40000a8c | 2334 | if test -d "$ansexp"; then |
a0d0e21e LW |
2335 | echo "(Looking for $loc_file in directory $value.)" |
2336 | value="$value/$loc_file" | |
40000a8c | 2337 | ansexp="$ansexp/$loc_file" |
2304df62 | 2338 | fi |
40000a8c | 2339 | if test -f "$ansexp"; then |
2304df62 AD |
2340 | type='' |
2341 | fi | |
a0d0e21e LW |
2342 | case "$nopath_ok" in |
2343 | true) case "$value" in | |
2344 | */*) ;; | |
2345 | *) echo "Assuming $value will be in people's path." | |
2346 | type='' | |
2347 | ;; | |
2348 | esac | |
2349 | ;; | |
2350 | esac | |
2304df62 AD |
2351 | ;; |
2352 | esac | |
2353 | ||
2354 | case "$skip" in | |
2355 | true) type=''; | |
2356 | esac | |
2357 | ||
2358 | case "$type" in | |
2359 | '') ;; | |
2360 | *) | |
2361 | if test "$fastread" = yes; then | |
2362 | dflt=y | |
2363 | else | |
2364 | dflt=n | |
2365 | fi | |
2366 | rp="$what $value doesn't exist. Use that name anyway?" | |
2367 | . UU/myread | |
2368 | dflt='' | |
2369 | case "$ans" in | |
2370 | y*) type='';; | |
2371 | *) echo " ";; | |
2372 | esac | |
2373 | ;; | |
2374 | esac | |
2375 | ;; | |
2376 | esac | |
2377 | ;; | |
2378 | esac | |
2379 | done | |
2380 | cd UU | |
2381 | ans="$value" | |
2382 | rp="$orig_rp" | |
2383 | dflt="$orig_dflt" | |
ecfc5424 | 2384 | rm -f getfile.ok |
2304df62 AD |
2385 | EOSC |
2386 | ||
4633a7c4 LW |
2387 | : determine root of directory hierarchy where package will be installed. |
2388 | case "$prefix" in | |
2389 | '') | |
2390 | dflt=`./loc . /usr/local /usr/local /local /opt /usr` | |
8e07c86e | 2391 | ;; |
4633a7c4 LW |
2392 | *) |
2393 | dflt="$prefix" | |
8e07c86e AD |
2394 | ;; |
2395 | esac | |
4633a7c4 | 2396 | $cat <<EOM |
2304df62 | 2397 | |
4633a7c4 LW |
2398 | By default, $package will be installed in $dflt/bin, manual |
2399 | pages under $dflt/man, etc..., i.e. with $dflt as prefix for | |
2400 | all installation directories. Typically set to /usr/local, but you | |
2401 | may choose /usr if you wish to install $package among your system | |
2402 | binaries. If you wish to have binaries under /bin but manual pages | |
2403 | under /usr/local/man, that's ok: you will be prompted separately | |
2404 | for each of the installation directories, the prefix being only used | |
2405 | to set the defaults. | |
8e07c86e AD |
2406 | |
2407 | EOM | |
2408 | fn=d~ | |
2409 | rp='Installation prefix to use?' | |
2410 | . ./getfile | |
2411 | oldprefix='' | |
2412 | case "$prefix" in | |
a0d0e21e | 2413 | '') ;; |
8e07c86e AD |
2414 | *) |
2415 | case "$ans" in | |
2416 | "$prefix") ;; | |
2417 | *) oldprefix="$prefix";; | |
2418 | esac | |
2419 | ;; | |
a0d0e21e | 2420 | esac |
8e07c86e AD |
2421 | prefix="$ans" |
2422 | prefixexp="$ansexp" | |
a0d0e21e | 2423 | |
8e07c86e AD |
2424 | : set the prefixit variable, to compute a suitable default value |
2425 | prefixit='case "$3" in | |
2426 | ""|none) | |
2427 | case "$oldprefix" in | |
2428 | "") eval "$1=\"\$$2\"";; | |
2429 | *) | |
2430 | case "$3" in | |
2431 | "") eval "$1=";; | |
2432 | none) | |
2433 | eval "tp=\"\$$2\""; | |
2434 | case "$tp" in | |
2435 | ""|" ") eval "$1=\"\$$2\"";; | |
2436 | *) eval "$1=";; | |
2437 | esac;; | |
2438 | esac;; | |
2439 | esac;; | |
2440 | *) | |
2441 | eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\""; | |
2442 | case "$tp" in | |
2443 | --|/*--|\~*--) eval "$1=\"$prefix/$3\"";; | |
2444 | /*-$oldprefix/*|\~*-$oldprefix/*) | |
2445 | eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";; | |
2446 | *) eval "$1=\"\$$2\"";; | |
2447 | esac;; | |
2448 | esac' | |
a0d0e21e | 2449 | |
4633a7c4 LW |
2450 | : determine where private library files go |
2451 | : Usual default is /usr/local/lib/perl5. Also allow things like | |
2452 | : /opt/perl/lib, since /opt/perl/lib/perl5 would be redundant. | |
2453 | case "$prefix" in | |
2454 | *perl*) set dflt privlib lib ;; | |
2455 | *) set dflt privlib lib/$package ;; | |
2456 | esac | |
8e07c86e | 2457 | eval $prefixit |
4633a7c4 LW |
2458 | $cat <<EOM |
2459 | ||
2460 | There are some auxiliary files for $package that need to be put into a | |
2461 | private library directory that is accessible by everyone. | |
2462 | ||
2463 | EOM | |
2464 | fn=d~+ | |
2465 | rp='Pathname where the private library files will reside?' | |
8e07c86e | 2466 | . ./getfile |
4633a7c4 LW |
2467 | if $test "X$privlibexp" != "X$ansexp"; then |
2468 | installprivlib='' | |
8e07c86e | 2469 | fi |
4633a7c4 LW |
2470 | privlib="$ans" |
2471 | privlibexp="$ansexp" | |
8e07c86e AD |
2472 | if $afs; then |
2473 | $cat <<EOM | |
2304df62 | 2474 | |
8e07c86e | 2475 | Since you are running AFS, I need to distinguish the directory in which |
4633a7c4 | 2476 | private files reside from the directory in which they are installed (and from |
8e07c86e | 2477 | which they are presumably copied to the former directory by occult means). |
a0d0e21e | 2478 | |
8e07c86e | 2479 | EOM |
4633a7c4 LW |
2480 | case "$installprivlib" in |
2481 | '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;; | |
2482 | *) dflt="$installprivlib";; | |
8e07c86e AD |
2483 | esac |
2484 | fn=de~ | |
4633a7c4 | 2485 | rp='Where will private files be installed?' |
8e07c86e | 2486 | . ./getfile |
4633a7c4 | 2487 | installprivlib="$ans" |
8e07c86e | 2488 | else |
4633a7c4 LW |
2489 | installprivlib="$privlibexp" |
2490 | fi | |
2491 | ||
2492 | : set the base revision | |
774d564b | 2493 | baserev=5.0 |
4633a7c4 LW |
2494 | |
2495 | : get the patchlevel | |
2496 | echo " " | |
2497 | echo "Getting the current patchlevel..." >&4 | |
2498 | if $test -r ../patchlevel.h;then | |
760ac839 LW |
2499 | patchlevel=`awk '/PATCHLEVEL/ {print $3}' ../patchlevel.h` |
2500 | subversion=`awk '/SUBVERSION/ {print $3}' ../patchlevel.h` | |
4633a7c4 LW |
2501 | else |
2502 | patchlevel=0 | |
f55a7265 | 2503 | subversion=0 |
8e07c86e | 2504 | fi |
5f05dabc | 2505 | $echo $n "(You have $package" $c |
2506 | case "$package" in | |
2507 | "*$baserev") ;; | |
2508 | *) $echo $n " $baserev" $c ;; | |
2509 | esac | |
2510 | $echo $n " patchlevel $patchlevel" $c | |
36477c24 | 2511 | test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c |
2512 | echo ".)" | |
2304df62 | 2513 | |
8e07c86e AD |
2514 | : set the prefixup variable, to restore leading tilda escape |
2515 | prefixup='case "$prefixexp" in | |
2516 | "$prefix") ;; | |
2517 | *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";; | |
2518 | esac' | |
2519 | ||
4633a7c4 LW |
2520 | : determine where public architecture dependent libraries go |
2521 | set archlib archlib | |
8e07c86e | 2522 | eval $prefixit |
4633a7c4 | 2523 | case "$archlib" in |
8e07c86e | 2524 | '') |
774d564b | 2525 | case "$privlib" in |
2526 | '') dflt=`./loc . "." $prefixexp/lib /usr/local/lib /usr/lib /lib` | |
2527 | set dflt | |
2528 | eval $prefixup | |
8e07c86e | 2529 | ;; |
774d564b | 2530 | *) if test 0 -eq "$subversion"; then |
2531 | version=`LC_ALL=C; export LC_ALL; \ | |
2532 | echo $baserev $patchlevel | \ | |
2533 | $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'` | |
2534 | else | |
2535 | version=`LC_ALL=C; export LC_ALL; \ | |
2536 | echo $baserev $patchlevel $subversion | \ | |
2537 | $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'` | |
2538 | fi | |
aa7e9289 | 2539 | dflt="$privlib/$archname/$version" |
774d564b | 2540 | ;; |
2541 | esac | |
2542 | ;; | |
2543 | *) | |
2544 | dflt="$archlib" | |
2545 | ;; | |
8e07c86e | 2546 | esac |
4633a7c4 LW |
2547 | cat <<EOM |
2548 | ||
2549 | $spackage contains architecture-dependent library files. If you are | |
2550 | sharing libraries in a heterogeneous environment, you might store | |
2551 | these files in a separate location. Otherwise, you can just include | |
2552 | them with the rest of the public library files. | |
2553 | ||
8e07c86e | 2554 | EOM |
4633a7c4 LW |
2555 | fn=d+~ |
2556 | rp='Where do you want to put the public architecture-dependent libraries?' | |
8e07c86e | 2557 | . ./getfile |
4633a7c4 LW |
2558 | archlib="$ans" |
2559 | archlibexp="$ansexp" | |
2560 | ||
8e07c86e AD |
2561 | if $afs; then |
2562 | $cat <<EOM | |
2563 | ||
7bac28a0 | 2564 | Since you are running AFS, I need to distinguish the directory in |
2565 | which architecture-dependent library files reside from the directory | |
2566 | in which they are installed (and from which they are presumably copied | |
2567 | to the former directory by occult means). | |
8e07c86e AD |
2568 | |
2569 | EOM | |
4633a7c4 LW |
2570 | case "$installarchlib" in |
2571 | '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;; | |
2572 | *) dflt="$installarchlib";; | |
8e07c86e AD |
2573 | esac |
2574 | fn=de~ | |
4633a7c4 | 2575 | rp='Where will architecture-dependent library files be installed?' |
8e07c86e | 2576 | . ./getfile |
4633a7c4 | 2577 | installarchlib="$ans" |
8e07c86e | 2578 | else |
4633a7c4 LW |
2579 | installarchlib="$archlibexp" |
2580 | fi | |
2581 | if $test X"$archlib" = X"$privlib"; then | |
2582 | d_archlib="$undef" | |
2583 | else | |
2584 | d_archlib="$define" | |
8e07c86e AD |
2585 | fi |
2586 | ||
40a7a20a | 2587 | : set up the script used to warn in case of inconsistency |
28757baa | 2588 | cat <<EOS >whoa |
2589 | $startsh | |
2590 | EOS | |
2591 | cat <<'EOSC' >>whoa | |
40a7a20a | 2592 | dflt=y |
2593 | echo " " | |
2594 | echo "*** WHOA THERE!!! ***" >&4 | |
2595 | echo " The $hint value for \$$var on this machine was \"$was\"!" >&4 | |
2596 | rp=" Keep the $hint value?" | |
2597 | . ./myread | |
2598 | case "$ans" in | |
2599 | y) td=$was; tu=$was;; | |
2600 | esac | |
2601 | EOSC | |
2602 | ||
2603 | : function used to set $1 to $val | |
2604 | setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef; | |
2605 | case "$val$was" in | |
2606 | $define$undef) . ./whoa; eval "$var=\$td";; | |
2607 | $undef$define) . ./whoa; eval "$var=\$tu";; | |
2608 | *) eval "$var=$val";; | |
2609 | esac' | |
2610 | ||
f7542a9d JH |
2611 | : bincompat3 is no more even possible starting with 5.005 |
2612 | d_bincompat3=$undef | |
5f05dabc | 2613 | |
40a7a20a | 2614 | : make some quick guesses about what we are up against |
2615 | echo " " | |
2616 | $echo $n "Hmm... $c" | |
2617 | echo exit 1 >bsd | |
2618 | echo exit 1 >usg | |
2619 | echo exit 1 >v7 | |
2620 | echo exit 1 >osf1 | |
2621 | echo exit 1 >eunice | |
2622 | echo exit 1 >xenix | |
2623 | echo exit 1 >venix | |
8ff267be | 2624 | echo exit 1 >os2 |
40a7a20a | 2625 | d_bsd="$undef" |
2626 | $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null | |
2627 | if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1 | |
2628 | then | |
2629 | echo "Looks kind of like an OSF/1 system, but we'll see..." | |
2630 | echo exit 0 >osf1 | |
2631 | elif test `echo abc | tr a-z A-Z` = Abc ; then | |
2632 | xxx=`./loc addbib blurfl $pth` | |
2633 | if $test -f $xxx; then | |
2634 | echo "Looks kind of like a USG system with BSD features, but we'll see..." | |
2635 | echo exit 0 >bsd | |
2636 | echo exit 0 >usg | |
2637 | else | |
2638 | if $contains SIGTSTP foo >/dev/null 2>&1 ; then | |
2639 | echo "Looks kind of like an extended USG system, but we'll see..." | |
2640 | else | |
2641 | echo "Looks kind of like a USG system, but we'll see..." | |
2642 | fi | |
2643 | echo exit 0 >usg | |
2644 | fi | |
2645 | elif $contains SIGTSTP foo >/dev/null 2>&1 ; then | |
2646 | echo "Looks kind of like a BSD system, but we'll see..." | |
2647 | d_bsd="$define" | |
2648 | echo exit 0 >bsd | |
2649 | else | |
2650 | echo "Looks kind of like a Version 7 system, but we'll see..." | |
2651 | echo exit 0 >v7 | |
2652 | fi | |
2653 | case "$eunicefix" in | |
2654 | *unixtovms*) | |
2655 | $cat <<'EOI' | |
2656 | There is, however, a strange, musty smell in the air that reminds me of | |
2657 | something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit. | |
2658 | EOI | |
2659 | echo exit 0 >eunice | |
2660 | d_eunice="$define" | |
2661 | : it so happens the Eunice I know will not run shell scripts in Unix format | |
2662 | ;; | |
2663 | *) | |
2664 | echo " " | |
2665 | echo "Congratulations. You aren't running Eunice." | |
2666 | d_eunice="$undef" | |
2667 | ;; | |
2668 | esac | |
8ff267be | 2669 | : Detect OS2. The p_ variable is set above in the Head.U unit. |
2670 | case "$p_" in | |
2671 | :) ;; | |
2672 | *) | |
2673 | $cat <<'EOI' | |
2674 | I have the feeling something is not exactly right, however...don't tell me... | |
2675 | lemme think...does HAL ring a bell?...no, of course, you're only running OS/2! | |
2676 | EOI | |
2677 | echo exit 0 >os2 | |
2678 | ;; | |
2679 | esac | |
40a7a20a | 2680 | if test -f /xenix; then |
2681 | echo "Actually, this looks more like a XENIX system..." | |
2682 | echo exit 0 >xenix | |
2683 | d_xenix="$define" | |
2684 | else | |
2685 | echo " " | |
2686 | echo "It's not Xenix..." | |
2687 | d_xenix="$undef" | |
2688 | fi | |
2689 | chmod +x xenix | |
2690 | $eunicefix xenix | |
2691 | if test -f /venix; then | |
2692 | echo "Actually, this looks more like a VENIX system..." | |
2693 | echo exit 0 >venix | |
2694 | else | |
2695 | echo " " | |
2696 | if ./xenix; then | |
2697 | : null | |
2698 | else | |
2699 | echo "Nor is it Venix..." | |
2700 | fi | |
2701 | fi | |
8ff267be | 2702 | chmod +x bsd usg v7 osf1 eunice xenix venix os2 |
2703 | $eunicefix bsd usg v7 osf1 eunice xenix venix os2 | |
40a7a20a | 2704 | $rm -f foo |
2705 | ||
2706 | : see if setuid scripts can be secure | |
2707 | $cat <<EOM | |
2708 | ||
2709 | Some kernels have a bug that prevents setuid #! scripts from being | |
2710 | secure. Some sites have disabled setuid #! scripts because of this. | |
2711 | ||
2712 | First let's decide if your kernel supports secure setuid #! scripts. | |
2713 | (If setuid #! scripts would be secure but have been disabled anyway, | |
2714 | don't say that they are secure if asked.) | |
2715 | ||
2716 | EOM | |
2717 | ||
2718 | val="$undef" | |
2719 | if $test -d /dev/fd; then | |
2720 | echo "#!$ls" >reflect | |
2721 | chmod +x,u+s reflect | |
2722 | ./reflect >flect 2>&1 | |
2723 | if $contains "/dev/fd" flect >/dev/null; then | |
2724 | echo "Congratulations, your kernel has secure setuid scripts!" >&4 | |
2725 | val="$define" | |
2726 | else | |
2727 | $cat <<EOM | |
2728 | If you are not sure if they are secure, I can check but I'll need a | |
2729 | username and password different from the one you are using right now. | |
2730 | If you don't have such a username or don't want me to test, simply | |
2731 | enter 'none'. | |
2732 | ||
2733 | EOM | |
2734 | rp='Other username to test security of setuid scripts with?' | |
2735 | dflt='none' | |
2736 | . ./myread | |
2737 | case "$ans" in | |
2738 | n|none) | |
2739 | case "$d_suidsafe" in | |
2740 | '') echo "I'll assume setuid scripts are *not* secure." >&4 | |
2741 | dflt=n;; | |
2742 | "$undef") | |
2743 | echo "Well, the $hint value is *not* secure." >&4 | |
2744 | dflt=n;; | |
2745 | *) echo "Well, the $hint value *is* secure." >&4 | |
2746 | dflt=y;; | |
2747 | esac | |
2748 | ;; | |
2749 | *) | |
2750 | $rm -f reflect flect | |
2751 | echo "#!$ls" >reflect | |
2752 | chmod +x,u+s reflect | |
2753 | echo >flect | |
2754 | chmod a+w flect | |
2755 | echo '"su" will (probably) prompt you for '"$ans's password." | |
2756 | su $ans -c './reflect >flect' | |
2757 | if $contains "/dev/fd" flect >/dev/null; then | |
2758 | echo "Okay, it looks like setuid scripts are secure." >&4 | |
2759 | dflt=y | |
2760 | else | |
2761 | echo "I don't think setuid scripts are secure." >&4 | |
2762 | dflt=n | |
2763 | fi | |
2764 | ;; | |
2765 | esac | |
2766 | rp='Does your kernel have *secure* setuid scripts?' | |
2767 | . ./myread | |
2768 | case "$ans" in | |
2769 | [yY]*) val="$define";; | |
2770 | *) val="$undef";; | |
2771 | esac | |
2772 | fi | |
2773 | else | |
2774 | echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4 | |
760ac839 | 2775 | echo "(That's for file descriptors, not floppy disks.)" |
40a7a20a | 2776 | val="$undef" |
2777 | fi | |
2778 | set d_suidsafe | |
2779 | eval $setvar | |
2780 | ||
2781 | $rm -f reflect flect | |
2782 | ||
2783 | : now see if they want to do setuid emulation | |
2784 | echo " " | |
2785 | val="$undef" | |
2786 | case "$d_suidsafe" in | |
2787 | "$define") | |
2788 | val="$undef" | |
2789 | echo "No need to emulate SUID scripts since they are secure here." >& 4 | |
2790 | ;; | |
2791 | *) | |
2792 | $cat <<EOM | |
2793 | Some systems have disabled setuid scripts, especially systems where | |
2794 | setuid scripts cannot be secure. On systems where setuid scripts have | |
2795 | been disabled, the setuid/setgid bits on scripts are currently | |
2796 | useless. It is possible for $package to detect those bits and emulate | |
2797 | setuid/setgid in a secure fashion. This emulation will only work if | |
2798 | setuid scripts have been disabled in your kernel. | |
2799 | ||
2800 | EOM | |
2801 | case "$d_dosuid" in | |
2802 | "$define") dflt=y ;; | |
2803 | *) dflt=n ;; | |
2804 | esac | |
2805 | rp="Do you want to do setuid/setgid emulation?" | |
2806 | . ./myread | |
2807 | case "$ans" in | |
2808 | [yY]*) val="$define";; | |
2809 | *) val="$undef";; | |
2810 | esac | |
2811 | ;; | |
2812 | esac | |
2813 | set d_dosuid | |
2814 | eval $setvar | |
2815 | ||
37120919 AD |
2816 | : determine where site specific libraries go. |
2817 | set sitelib sitelib | |
2818 | eval $prefixit | |
2819 | case "$sitelib" in | |
2820 | '') dflt="$privlib/site_perl" ;; | |
2821 | *) dflt="$sitelib" ;; | |
2822 | esac | |
2823 | $cat <<EOM | |
2824 | ||
2825 | The installation process will also create a directory for | |
2826 | site-specific extensions and modules. Some users find it convenient | |
2827 | to place all local files in this directory rather than in the main | |
2828 | distribution directory. | |
2829 | ||
2830 | EOM | |
2831 | fn=d~+ | |
2832 | rp='Pathname for the site-specific library files?' | |
2833 | . ./getfile | |
2834 | if $test "X$sitelibexp" != "X$ansexp"; then | |
2835 | installsitelib='' | |
2836 | fi | |
2837 | sitelib="$ans" | |
2838 | sitelibexp="$ansexp" | |
2839 | if $afs; then | |
2840 | $cat <<EOM | |
2841 | ||
7bac28a0 | 2842 | Since you are running AFS, I need to distinguish the directory in |
2843 | which site-specific files reside from the directory in which they are | |
2844 | installed (and from which they are presumably copied to the former | |
2845 | directory by occult means). | |
37120919 AD |
2846 | |
2847 | EOM | |
2848 | case "$installsitelib" in | |
2849 | '') dflt=`echo $sitelibexp | sed 's#^/afs/#/afs/.#'`;; | |
2850 | *) dflt="$installsitelib";; | |
2851 | esac | |
2852 | fn=de~ | |
7bac28a0 | 2853 | rp='Where will site-specific files be installed?' |
37120919 AD |
2854 | . ./getfile |
2855 | installsitelib="$ans" | |
2856 | else | |
2857 | installsitelib="$sitelibexp" | |
2858 | fi | |
4633a7c4 | 2859 | |
37120919 AD |
2860 | : determine where site specific architecture-dependent libraries go. |
2861 | xxx=`echo $sitelib/$archname | sed 's!^$prefix!!'` | |
2862 | : xxx is usuually lib/site_perl/archname. | |
2863 | set sitearch sitearch none | |
8e07c86e | 2864 | eval $prefixit |
37120919 AD |
2865 | case "$sitearch" in |
2866 | '') dflt="$sitelib/$archname" ;; | |
2867 | *) dflt="$sitearch" ;; | |
2868 | esac | |
8e07c86e AD |
2869 | $cat <<EOM |
2870 | ||
4633a7c4 LW |
2871 | The installation process will also create a directory for |
2872 | architecture-dependent site-specific extensions and modules. | |
8e07c86e AD |
2873 | |
2874 | EOM | |
4633a7c4 LW |
2875 | fn=nd~+ |
2876 | rp='Pathname for the site-specific architecture-dependent library files?' | |
8e07c86e | 2877 | . ./getfile |
4633a7c4 LW |
2878 | if $test "X$sitearchexp" != "X$ansexp"; then |
2879 | installsitearch='' | |
8e07c86e | 2880 | fi |
4633a7c4 LW |
2881 | sitearch="$ans" |
2882 | sitearchexp="$ansexp" | |
8e07c86e AD |
2883 | if $afs; then |
2884 | $cat <<EOM | |
2885 | ||
7bac28a0 | 2886 | Since you are running AFS, I need to distinguish the directory in |
2887 | which site-specific architecture-dependent library files reside from | |
2888 | the directory in which they are installed (and from which they are | |
2889 | presumably copied to the former directory by occult means). | |
8e07c86e AD |
2890 | |
2891 | EOM | |
4633a7c4 LW |
2892 | case "$installsitearch" in |
2893 | '') dflt=`echo $sitearchexp | sed 's#^/afs/#/afs/.#'`;; | |
2894 | *) dflt="$installsitearch";; | |
8e07c86e AD |
2895 | esac |
2896 | fn=de~ | |
7bac28a0 | 2897 | rp='Where will site-specific architecture-dependent files be installed?' |
8e07c86e | 2898 | . ./getfile |
4633a7c4 | 2899 | installsitearch="$ans" |
8e07c86e | 2900 | else |
4633a7c4 | 2901 | installsitearch="$sitearchexp" |
8e07c86e AD |
2902 | fi |
2903 | ||
4633a7c4 LW |
2904 | : determine where old public architecture dependent libraries might be |
2905 | case "$oldarchlib" in | |
2906 | '') case "$privlib" in | |
2907 | '') ;; | |
2908 | *) dflt="$privlib/$archname" | |
8e07c86e | 2909 | ;; |
8e07c86e AD |
2910 | esac |
2911 | ;; | |
4633a7c4 LW |
2912 | *) dflt="$oldarchlib" |
2913 | ;; | |
8e07c86e | 2914 | esac |
4633a7c4 LW |
2915 | if $test ! -d "$dflt/auto"; then |
2916 | dflt=none | |
2917 | fi | |
8e07c86e AD |
2918 | cat <<EOM |
2919 | ||
760ac839 | 2920 | In 5.001, Perl stored architecture-dependent library files in a directory |
4633a7c4 LW |
2921 | with a name such as $privlib/$archname, |
2922 | and this directory contained files from the standard extensions and | |
2923 | files from any additional extensions you might have added. Starting | |
2924 | with version 5.002, all the architecture-dependent standard extensions | |
760ac839 LW |
2925 | will go into a version-specific directory such as |
2926 | $archlib, | |
4633a7c4 LW |
2927 | while locally-added extensions will go into |
2928 | $sitearch. | |
2929 | ||
2930 | If you wish Perl to continue to search the old architecture-dependent | |
2931 | library for your local extensions, give the path to that directory. | |
2932 | If you do not wish to use your old architecture-dependent library | |
2933 | files, answer 'none'. | |
8e07c86e AD |
2934 | |
2935 | EOM | |
4633a7c4 LW |
2936 | fn=dn~ |
2937 | rp='Directory for your old 5.001 architecture-dependent libraries?' | |
8e07c86e | 2938 | . ./getfile |
4633a7c4 LW |
2939 | oldarchlib="$ans" |
2940 | oldarchlibexp="$ansexp" | |
2941 | case "$oldarchlib" in | |
2942 | ''|' ') val="$undef" ;; | |
2943 | *) val="$define" ;; | |
2944 | esac | |
2945 | set d_oldarchlib | |
2946 | eval $setvar | |
8e07c86e | 2947 | |
4633a7c4 LW |
2948 | : determine where public executables go |
2949 | echo " " | |
2950 | set dflt bin bin | |
2951 | eval $prefixit | |
2952 | fn=d~ | |
2953 | rp='Pathname where the public executables will reside?' | |
2954 | . ./getfile | |
2955 | if $test "X$ansexp" != "X$binexp"; then | |
2956 | installbin='' | |
2957 | fi | |
2958 | bin="$ans" | |
2959 | binexp="$ansexp" | |
8e07c86e AD |
2960 | if $afs; then |
2961 | $cat <<EOM | |
2962 | ||
2963 | Since you are running AFS, I need to distinguish the directory in which | |
4633a7c4 | 2964 | executables reside from the directory in which they are installed (and from |
8e07c86e AD |
2965 | which they are presumably copied to the former directory by occult means). |
2966 | ||
2967 | EOM | |
4633a7c4 LW |
2968 | case "$installbin" in |
2969 | '') dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;; | |
2970 | *) dflt="$installbin";; | |
8e07c86e AD |
2971 | esac |
2972 | fn=de~ | |
4633a7c4 | 2973 | rp='Where will public executables be installed?' |
8e07c86e | 2974 | . ./getfile |
4633a7c4 | 2975 | installbin="$ans" |
8e07c86e | 2976 | else |
4633a7c4 | 2977 | installbin="$binexp" |
8e07c86e AD |
2978 | fi |
2979 | ||
2c7991dc | 2980 | : determine where manual pages are on this system |
2981 | echo " " | |
2982 | case "$sysman" in | |
2983 | '') | |
2984 | syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1' | |
2985 | syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1" | |
2986 | syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1" | |
2987 | syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1" | |
2988 | syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1" | |
2989 | sysman=`./loc . /usr/man/man1 $syspath` | |
2990 | ;; | |
2991 | esac | |
2992 | if $test -d "$sysman"; then | |
2993 | echo "System manual is in $sysman." >&4 | |
2994 | else | |
2995 | echo "Could not find manual pages in source form." >&4 | |
2996 | fi | |
2997 | ||
2afac517 | 2998 | : see what memory models we can support |
2999 | case "$models" in | |
3000 | '') | |
3001 | $cat >pdp11.c <<'EOP' | |
3002 | main() { | |
3003 | #ifdef pdp11 | |
3004 | exit(0); | |
3005 | #else | |
3006 | exit(1); | |
3007 | #endif | |
3008 | } | |
3009 | EOP | |
c90c0ff4 | 3010 | (cc -o pdp11 pdp11.c) >/dev/null 2>&1 |
3011 | if $test -f pdp11 && ./pdp11 2>/dev/null; then | |
2afac517 | 3012 | dflt='unsplit split' |
3013 | else | |
3014 | tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge` | |
3015 | case "$tans" in | |
3016 | X) dflt='none';; | |
3017 | *) if $test -d /lib/small || $test -d /usr/lib/small; then | |
3018 | dflt='small' | |
3019 | else | |
3020 | dflt='' | |
3021 | fi | |
3022 | if $test -d /lib/medium || $test -d /usr/lib/medium; then | |
3023 | dflt="$dflt medium" | |
3024 | fi | |
3025 | if $test -d /lib/large || $test -d /usr/lib/large; then | |
3026 | dflt="$dflt large" | |
3027 | fi | |
3028 | if $test -d /lib/huge || $test -d /usr/lib/huge; then | |
3029 | dflt="$dflt huge" | |
3030 | fi | |
3031 | esac | |
3032 | fi;; | |
3033 | *) dflt="$models";; | |
3034 | esac | |
8e07c86e | 3035 | $cat <<EOM |
2afac517 | 3036 | |
3037 | Some systems have different model sizes. On most systems they are called | |
3038 | small, medium, large, and huge. On the PDP11 they are called unsplit and | |
3039 | split. If your system doesn't support different memory models, say "none". | |
3040 | If you wish to force everything to one memory model, say "none" here and | |
3041 | put the appropriate flags later when it asks you for other cc and ld flags. | |
3042 | Venix systems may wish to put "none" and let the compiler figure things out. | |
3043 | (In the following question multiple model names should be space separated.) | |
8e07c86e | 3044 | |
8e07c86e | 3045 | EOM |
2afac517 | 3046 | rp="Which memory models are supported?" |
3047 | . ./myread | |
3048 | models="$ans" | |
3049 | ||
3050 | case "$models" in | |
3051 | none) | |
3052 | small='' | |
3053 | medium='' | |
3054 | large='' | |
3055 | huge='' | |
3056 | unsplit='' | |
3057 | split='' | |
2c7991dc | 3058 | ;; |
2afac517 | 3059 | *split) |
3060 | case "$split" in | |
3061 | '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \ | |
3062 | $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then | |
3063 | dflt='-i' | |
3064 | else | |
3065 | dflt='none' | |
3066 | fi;; | |
3067 | *) dflt="$split";; | |
3068 | esac | |
3069 | rp="What flag indicates separate I and D space?" | |
3070 | . ./myread | |
3071 | tans="$ans" | |
3072 | case "$tans" in | |
3073 | none) tans='';; | |
3074 | esac | |
3075 | split="$tans" | |
3076 | unsplit='';; | |
3077 | *large*|*small*|*medium*|*huge*) | |
3078 | case "$models" in | |
3079 | *large*) | |
3080 | case "$large" in | |
3081 | '') dflt='-Ml';; | |
3082 | *) dflt="$large";; | |
3083 | esac | |
3084 | rp="What flag indicates large model?" | |
3085 | . ./myread | |
3086 | tans="$ans" | |
3087 | case "$tans" in | |
3088 | none) tans=''; | |
3089 | esac | |
3090 | large="$tans";; | |
3091 | *) large='';; | |
3092 | esac | |
3093 | case "$models" in | |
3094 | *huge*) case "$huge" in | |
3095 | '') dflt='-Mh';; | |
3096 | *) dflt="$huge";; | |
3097 | esac | |
3098 | rp="What flag indicates huge model?" | |
3099 | . ./myread | |
3100 | tans="$ans" | |
3101 | case "$tans" in | |
3102 | none) tans=''; | |
3103 | esac | |
3104 | huge="$tans";; | |
3105 | *) huge="$large";; | |
3106 | esac | |
3107 | case "$models" in | |
3108 | *medium*) case "$medium" in | |
3109 | '') dflt='-Mm';; | |
3110 | *) dflt="$medium";; | |
3111 | esac | |
3112 | rp="What flag indicates medium model?" | |
3113 | . ./myread | |
3114 | tans="$ans" | |
3115 | case "$tans" in | |
3116 | none) tans=''; | |
3117 | esac | |
3118 | medium="$tans";; | |
3119 | *) medium="$large";; | |
3120 | esac | |
3121 | case "$models" in | |
3122 | *small*) case "$small" in | |
3123 | '') dflt='none';; | |
3124 | *) dflt="$small";; | |
3125 | esac | |
3126 | rp="What flag indicates small model?" | |
3127 | . ./myread | |
3128 | tans="$ans" | |
3129 | case "$tans" in | |
3130 | none) tans=''; | |
3131 | esac | |
3132 | small="$tans";; | |
3133 | *) small='';; | |
25f94b33 | 3134 | esac |
8e07c86e | 3135 | ;; |
2afac517 | 3136 | *) |
3137 | echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4 | |
8e07c86e AD |
3138 | ;; |
3139 | esac | |
8e07c86e | 3140 | |
2afac517 | 3141 | : see if we need a special compiler |
3142 | echo " " | |
3143 | if ./usg; then | |
3144 | case "$cc" in | |
3145 | '') case "$Mcc" in | |
3146 | /*) dflt='Mcc';; | |
3147 | *) case "$large" in | |
3148 | -M*) dflt='cc';; | |
3149 | *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then | |
3150 | if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then | |
3151 | dflt='cc' | |
3152 | else | |
3153 | dflt='cc -M' | |
3154 | fi | |
3155 | else | |
3156 | dflt='cc' | |
3157 | fi;; | |
3158 | esac;; | |
3159 | esac;; | |
3160 | *) dflt="$cc";; | |
3161 | esac | |
3162 | $cat <<'EOM' | |
3163 | On some systems the default C compiler will not resolve multiple global | |
3164 | references that happen to have the same name. On some such systems the "Mcc" | |
3165 | command may be used to force these to be resolved. On other systems a "cc -M" | |
3166 | command is required. (Note that the -M flag on other systems indicates a | |
3167 | memory model to use!) If you have the Gnu C compiler, you might wish to use | |
3168 | that instead. | |
8e07c86e AD |
3169 | |
3170 | EOM | |
2afac517 | 3171 | rp="What command will force resolution on this system?" |
3172 | . ./myread | |
3173 | cc="$ans" | |
8e07c86e | 3174 | else |
2afac517 | 3175 | case "$cc" in |
3176 | '') dflt=cc;; | |
3177 | *) dflt="$cc";; | |
3178 | esac | |
3179 | rp="Use which C compiler?" | |
3180 | . ./myread | |
3181 | cc="$ans" | |
8e07c86e | 3182 | fi |
2afac517 | 3183 | echo " " |
3184 | echo "Checking for GNU cc in disguise and/or its version number..." >&4 | |
3185 | $cat >gccvers.c <<EOM | |
3186 | #include <stdio.h> | |
3187 | int main() { | |
3188 | #ifdef __GNUC__ | |
3189 | #ifdef __VERSION__ | |
3190 | printf("%s\n", __VERSION__); | |
3191 | #else | |
3192 | printf("%s\n", "1"); | |
3193 | #endif | |
3194 | #endif | |
3195 | exit(0); | |
3196 | } | |
3197 | EOM | |
3198 | if $cc -o gccvers gccvers.c >/dev/null 2>&1; then | |
3199 | gccversion=`./gccvers` | |
3200 | case "$gccversion" in | |
3201 | '') echo "You are not using GNU cc." ;; | |
3202 | *) echo "You are using GNU cc $gccversion." ;; | |
3203 | esac | |
3204 | else | |
3205 | echo " " | |
3206 | echo "*** WHOA THERE!!! ***" >&4 | |
3207 | echo " Your C compiler \"$cc\" doesn't seem to be working!" >&4 | |
3208 | case "$knowitall" in | |
3209 | '') | |
3210 | echo " You'd better start hunting for one and let me know about it." >&4 | |
3211 | exit 1 | |
2c7991dc | 3212 | ;; |
8e07c86e | 3213 | esac |
2afac517 | 3214 | fi |
3215 | $rm -f gccvers* | |
3216 | case "$gccversion" in | |
3217 | 1*) cpp=`./loc gcc-cpp $cpp $pth` ;; | |
8e07c86e AD |
3218 | esac |
3219 | ||
2afac517 | 3220 | : What should the include directory be ? |
8e07c86e | 3221 | echo " " |
2afac517 | 3222 | $echo $n "Hmm... $c" |
3223 | dflt='/usr/include' | |
3224 | incpath='' | |
3225 | mips_type='' | |
3226 | if $test -f /bin/mips && /bin/mips; then | |
3227 | echo "Looks like a MIPS system..." | |
3228 | $cat >usr.c <<'EOCP' | |
3229 | #ifdef SYSTYPE_BSD43 | |
3230 | /bsd43 | |
3231 | #endif | |
3232 | EOCP | |
3233 | if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then | |
3234 | dflt='/bsd43/usr/include' | |
3235 | incpath='/bsd43' | |
3236 | mips_type='BSD 4.3' | |
8e07c86e | 3237 | else |
2afac517 | 3238 | mips_type='System V' |
8e07c86e | 3239 | fi |
2afac517 | 3240 | $rm -f usr.c usr.out |
3241 | echo "and you're compiling with the $mips_type compiler and libraries." | |
3242 | xxx_prompt=y | |
3243 | echo "exit 0" >mips | |
8e07c86e | 3244 | else |
2afac517 | 3245 | echo "Doesn't look like a MIPS system." |
3246 | xxx_prompt=n | |
3247 | echo "exit 1" >mips | |
3248 | fi | |
3249 | chmod +x mips | |
3250 | $eunicefix mips | |
3251 | echo " " | |
3252 | case "$usrinc" in | |
3253 | '') ;; | |
3254 | *) dflt="$usrinc";; | |
3255 | esac | |
3256 | case "$xxx_prompt" in | |
3257 | y) fn=d/ | |
3258 | rp='Where are the include files you want to use?' | |
3259 | . ./getfile | |
3260 | usrinc="$ans" | |
3261 | ;; | |
3262 | *) usrinc="$dflt" | |
3263 | ;; | |
3264 | esac | |
8e07c86e | 3265 | |
2afac517 | 3266 | : Set private lib path |
3267 | case "$plibpth" in | |
3268 | '') if ./mips; then | |
3269 | plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib" | |
3270 | fi;; | |
3271 | esac | |
3272 | case "$libpth" in | |
3273 | ' ') dlist='';; | |
3274 | '') dlist="$loclibpth $plibpth $glibpth";; | |
3275 | *) dlist="$libpth";; | |
3276 | esac | |
8e07c86e | 3277 | |
2afac517 | 3278 | : Now check and see which directories actually exist, avoiding duplicates |
3279 | libpth='' | |
3280 | for xxx in $dlist | |
3281 | do | |
3282 | if $test -d $xxx; then | |
3283 | case " $libpth " in | |
3284 | *" $xxx "*) ;; | |
3285 | *) libpth="$libpth $xxx";; | |
3286 | esac | |
3287 | fi | |
3288 | done | |
3289 | $cat <<'EOM' | |
8e07c86e | 3290 | |
2afac517 | 3291 | Some systems have incompatible or broken versions of libraries. Among |
3292 | the directories listed in the question below, please remove any you | |
3293 | know not to be holding relevant libraries, and add any that are needed. | |
3294 | Say "none" for none. | |
8e07c86e | 3295 | |
8e07c86e | 3296 | EOM |
2afac517 | 3297 | case "$libpth" in |
3298 | '') dflt='none';; | |
3299 | *) | |
3300 | set X $libpth | |
3301 | shift | |
3302 | dflt=${1+"$@"} | |
4633a7c4 | 3303 | ;; |
8e07c86e | 3304 | esac |
2afac517 | 3305 | rp="Directories to use for library searches?" |
3306 | . ./myread | |
3307 | case "$ans" in | |
3308 | none) libpth=' ';; | |
3309 | *) libpth="$ans";; | |
3310 | esac | |
8e07c86e | 3311 | |
5f05dabc | 3312 | : Define several unixisms. Hints files or command line options |
3313 | : can be used to override them. | |
3314 | case "$ar" in | |
3315 | '') ar='ar';; | |
3316 | esac | |
3317 | case "$lib_ext" in | |
3318 | '') lib_ext='.a';; | |
3319 | esac | |
3320 | case "$obj_ext" in | |
3321 | '') obj_ext='.o';; | |
3322 | esac | |
3323 | case "$path_sep" in | |
3324 | '') path_sep=':';; | |
3325 | esac | |
3326 | : Which makefile gets called first. This is used by make depend. | |
3327 | case "$firstmakefile" in | |
3328 | '') firstmakefile='makefile';; | |
3329 | esac | |
3330 | ||
2afac517 | 3331 | : compute shared library extension |
3332 | case "$so" in | |
3333 | '') | |
3334 | if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then | |
3335 | dflt='sl' | |
3336 | else | |
3337 | dflt='so' | |
3338 | fi | |
3339 | ;; | |
3340 | *) dflt="$so";; | |
8e07c86e | 3341 | esac |
2afac517 | 3342 | $cat <<EOM |
8e07c86e | 3343 | |
2afac517 | 3344 | On some systems, shared libraries may be available. Answer 'none' if |
3345 | you want to suppress searching of shared libraries for the remaining | |
3346 | of this configuration. | |
8e07c86e AD |
3347 | |
3348 | EOM | |
2afac517 | 3349 | rp='What is the file extension used for shared libraries?' |
3350 | . ./myread | |
3351 | so="$ans" | |
8e07c86e | 3352 | |
2afac517 | 3353 | : Looking for optional libraries |
3354 | echo " " | |
3355 | echo "Checking for optional libraries..." >&4 | |
3356 | case "$libs" in | |
3357 | ' '|'') dflt='';; | |
3358 | *) dflt="$libs";; | |
8e07c86e | 3359 | esac |
2afac517 | 3360 | case "$libswanted" in |
3361 | '') libswanted='c_s';; | |
3362 | esac | |
3363 | for thislib in $libswanted; do | |
3364 | ||
3365 | if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`; $test -f "$xxx"; then | |
3366 | echo "Found -l$thislib (shared)." | |
3367 | case " $dflt " in | |
3368 | *"-l$thislib "*);; | |
3369 | *) dflt="$dflt -l$thislib";; | |
4633a7c4 | 3370 | esac |
2afac517 | 3371 | elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then |
3372 | echo "Found -l$thislib (shared)." | |
3373 | case " $dflt " in | |
3374 | *"-l$thislib "*);; | |
3375 | *) dflt="$dflt -l$thislib";; | |
3376 | esac | |
5f05dabc | 3377 | elif xxx=`./loc lib$thislib$lib_ext X $libpth`; $test -f "$xxx"; then |
2afac517 | 3378 | echo "Found -l$thislib." |
3379 | case " $dflt " in | |
3380 | *"-l$thislib "*);; | |
3381 | *) dflt="$dflt -l$thislib";; | |
3382 | esac | |
5f05dabc | 3383 | elif xxx=`./loc $thislib$lib_ext X $libpth`; $test -f "$xxx"; then |
2afac517 | 3384 | echo "Found -l$thislib." |
3385 | case " $dflt " in | |
3386 | *"-l$thislib "*);; | |
3387 | *) dflt="$dflt -l$thislib";; | |
3388 | esac | |
5f05dabc | 3389 | elif xxx=`./loc lib${thislib}_s$lib_ext X $libpth`; $test -f "$xxx"; then |
2afac517 | 3390 | echo "Found -l${thislib}_s." |
3391 | case " $dflt " in | |
3392 | *"-l$thislib "*);; | |
3393 | *) dflt="$dflt -l${thislib}_s";; | |
3394 | esac | |
5f05dabc | 3395 | elif xxx=`./loc Slib$thislib$lib_ext X $xlibpth`; $test -f "$xxx"; then |
2afac517 | 3396 | echo "Found -l$thislib." |
3397 | case " $dflt " in | |
3398 | *"-l$thislib "*);; | |
3399 | *) dflt="$dflt -l$thislib";; | |
3400 | esac | |
3401 | else | |
3402 | echo "No -l$thislib." | |
3403 | fi | |
3404 | done | |
3405 | set X $dflt | |
3406 | shift | |
3407 | dflt="$*" | |
3408 | case "$libs" in | |
3409 | '') dflt="$dflt";; | |
3410 | *) dflt="$libs";; | |
3411 | esac | |
3412 | case "$dflt" in | |
3413 | ' '|'') dflt='none';; | |
8e07c86e | 3414 | esac |
2afac517 | 3415 | |
4633a7c4 LW |
3416 | $cat <<EOM |
3417 | ||
2afac517 | 3418 | Some versions of Unix support shared libraries, which make executables smaller |
3419 | but make load time slightly longer. | |
8e07c86e | 3420 | |
2afac517 | 3421 | On some systems, mostly System V Release 3's, the shared library is included |
3422 | by putting the option "-lc_s" as the last thing on the cc command line when | |
3423 | linking. Other systems use shared libraries by default. There may be other | |
3424 | libraries needed to compile $package on your machine as well. If your system | |
3425 | needs the "-lc_s" option, include it here. Include any other special libraries | |
3426 | here as well. Say "none" for none. | |
4633a7c4 | 3427 | EOM |
2afac517 | 3428 | |
3429 | echo " " | |
3430 | rp="Any additional libraries?" | |
8e07c86e | 3431 | . ./myread |
2afac517 | 3432 | case "$ans" in |
3433 | none) libs=' ';; | |
3434 | *) libs="$ans";; | |
3435 | esac | |
8e07c86e | 3436 | |
4633a7c4 | 3437 | : see how we invoke the C preprocessor |
2304df62 | 3438 | echo " " |
4633a7c4 LW |
3439 | echo "Now, how can we feed standard input to your C preprocessor..." >&4 |
3440 | cat <<'EOT' >testcpp.c | |
3441 | #define ABC abc | |
3442 | #define XYZ xyz | |
3443 | ABC.XYZ | |
3444 | EOT | |
3445 | cd .. | |
3446 | echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin | |
3447 | chmod 755 cppstdin | |
3448 | wrapper=`pwd`/cppstdin | |
3449 | ok='false' | |
3450 | cd UU | |
3451 | ||
3452 | if $test "X$cppstdin" != "X" && \ | |
3453 | $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \ | |
3454 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 | |
3455 | then | |
3456 | echo "You used to use $cppstdin $cppminus so we'll use that again." | |
3457 | case "$cpprun" in | |
3458 | '') echo "But let's see if we can live without a wrapper..." ;; | |
3459 | *) | |
3460 | if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \ | |
3461 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 | |
3462 | then | |
3463 | echo "(And we'll use $cpprun $cpplast to preprocess directly.)" | |
3464 | ok='true' | |
a0d0e21e | 3465 | else |
4633a7c4 | 3466 | echo "(However, $cpprun $cpplast does not work, let's see...)" |
2304df62 | 3467 | fi |
2304df62 | 3468 | ;; |
2304df62 | 3469 | esac |
4633a7c4 LW |
3470 | else |
3471 | case "$cppstdin" in | |
3472 | '') ;; | |
3473 | *) | |
3474 | echo "Good old $cppstdin $cppminus does not seem to be of any help..." | |
3475 | ;; | |
3476 | esac | |
3477 | fi | |
3478 | ||
3479 | if $ok; then | |
3480 | : nothing | |
3481 | elif echo 'Maybe "'"$cc"' -E" will work...'; \ | |
3482 | $cc -E <testcpp.c >testcpp.out 2>&1; \ | |
3483 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
3484 | echo "Yup, it does." | |
3485 | x_cpp="$cc -E" | |
3486 | x_minus=''; | |
3487 | elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \ | |
3488 | $cc -E - <testcpp.c >testcpp.out 2>&1; \ | |
3489 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
3490 | echo "Yup, it does." | |
3491 | x_cpp="$cc -E" | |
3492 | x_minus='-'; | |
3493 | elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \ | |
3494 | $cc -P <testcpp.c >testcpp.out 2>&1; \ | |
3495 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
3496 | echo "Yipee, that works!" | |
3497 | x_cpp="$cc -P" | |
3498 | x_minus=''; | |
3499 | elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \ | |
3500 | $cc -P - <testcpp.c >testcpp.out 2>&1; \ | |
3501 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
3502 | echo "At long last!" | |
3503 | x_cpp="$cc -P" | |
3504 | x_minus='-'; | |
3505 | elif echo 'No such luck, maybe "'$cpp'" will work...'; \ | |
3506 | $cpp <testcpp.c >testcpp.out 2>&1; \ | |
3507 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
3508 | echo "It works!" | |
3509 | x_cpp="$cpp" | |
3510 | x_minus=''; | |
3511 | elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \ | |
3512 | $cpp - <testcpp.c >testcpp.out 2>&1; \ | |
3513 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
3514 | echo "Hooray, it works! I was beginning to wonder." | |
3515 | x_cpp="$cpp" | |
3516 | x_minus='-'; | |
3517 | elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \ | |
3518 | $wrapper <testcpp.c >testcpp.out 2>&1; \ | |
3519 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
3520 | x_cpp="$wrapper" | |
3521 | x_minus='' | |
3522 | echo "Eureka!" | |
3523 | else | |
3524 | dflt='' | |
3525 | rp="No dice. I can't find a C preprocessor. Name one:" | |
3526 | . ./myread | |
3527 | x_cpp="$ans" | |
3528 | x_minus='' | |
3529 | $x_cpp <testcpp.c >testcpp.out 2>&1 | |
3530 | if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then | |
3531 | echo "OK, that will do." >&4 | |
3532 | else | |
3533 | echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4 | |
3534 | exit 1 | |
3535 | fi | |
3536 | fi | |
3537 | ||
3538 | case "$ok" in | |
3539 | false) | |
3540 | cppstdin="$x_cpp" | |
3541 | cppminus="$x_minus" | |
3542 | cpprun="$x_cpp" | |
3543 | cpplast="$x_minus" | |
3544 | set X $x_cpp | |
3545 | shift | |
3546 | case "$1" in | |
3547 | "$cpp") | |
3548 | echo "Perhaps can we force $cc -E using a wrapper..." | |
3549 | if $wrapper <testcpp.c >testcpp.out 2>&1; \ | |
3550 | $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 | |
3551 | then | |
3552 | echo "Yup, we can." | |
3553 | cppstdin="$wrapper" | |
3554 | cppminus=''; | |
3555 | else | |
3556 | echo "Nope, we'll have to live without it..." | |
3557 | fi | |
3558 | ;; | |
3559 | esac | |
3560 | case "$cpprun" in | |
3561 | "$wrapper") | |
3562 | cpprun='' | |
3563 | cpplast='' | |
3564 | ;; | |
3565 | esac | |
3566 | ;; | |
3567 | esac | |
3568 | ||
3569 | case "$cppstdin" in | |
3570 | "$wrapper") ;; | |
3571 | *) $rm -f $wrapper;; | |
3572 | esac | |
3573 | $rm -f testcpp.c testcpp.out | |
3574 | ||
2afac517 | 3575 | : determine optimize, if desired, or use for debug flag also |
3576 | case "$optimize" in | |
2ae324a7 | 3577 | ' '|$undef) dflt='none';; |
2afac517 | 3578 | '') dflt='-O';; |
3579 | *) dflt="$optimize";; | |
4633a7c4 | 3580 | esac |
2afac517 | 3581 | $cat <<EOH |
4633a7c4 | 3582 | |
760ac839 | 3583 | Some C compilers have problems with their optimizers. By default, $package |
4633a7c4 LW |
3584 | compiles with the -O flag to use the optimizer. Alternately, you might want |
3585 | to use the symbolic debugger, which uses the -g flag (on traditional Unix | |
3586 | systems). Either flag can be specified here. To use neither flag, specify | |
3587 | the word "none". | |
3588 | ||
3589 | EOH | |
3590 | rp="What optimizer/debugger flag should be used?" | |
3591 | . ./myread | |
3592 | optimize="$ans" | |
3593 | case "$optimize" in | |
3594 | 'none') optimize=" ";; | |
3595 | esac | |
3596 | ||
3597 | dflt='' | |
25f94b33 AD |
3598 | : We will not override a previous value, but we might want to |
3599 | : augment a hint file | |
3600 | case "$hint" in | |
3601 | none|recommended) | |
4633a7c4 LW |
3602 | case "$gccversion" in |
3603 | 1*) dflt='-fpcc-struct-return' ;; | |
3604 | esac | |
3605 | case "$optimize" in | |
3606 | *-g*) dflt="$dflt -DDEBUGGING";; | |
3607 | esac | |
3608 | case "$gccversion" in | |
3609 | 2*) if test -d /etc/conf/kconfig.d && | |
3610 | $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1 | |
3611 | then | |
3612 | dflt="$dflt -posix" | |
3613 | fi | |
3614 | ;; | |
3615 | esac | |
3616 | ;; | |
3617 | esac | |
3618 | ||
a4f3eea9 | 3619 | case "$mips_type" in |
3620 | *BSD*|'') inclwanted="$locincpth $usrinc";; | |
3621 | *) inclwanted="$locincpth $inclwanted $usrinc/bsd";; | |
3622 | esac | |
3623 | for thisincl in $inclwanted; do | |
3624 | if $test -d $thisincl; then | |
3625 | if $test x$thisincl != x$usrinc; then | |
3626 | case "$dflt" in | |
3627 | *$thisincl*);; | |
3628 | *) dflt="$dflt -I$thisincl";; | |
3629 | esac | |
3630 | fi | |
3631 | fi | |
3632 | done | |
3633 | ||
3634 | inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then | |
3635 | xxx=true; | |
3636 | elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then | |
3637 | xxx=true; | |
3638 | else | |
3639 | xxx=false; | |
3640 | fi; | |
3641 | if $xxx; then | |
3642 | case "$dflt" in | |
3643 | *$2*);; | |
3644 | *) dflt="$dflt -D$2";; | |
3645 | esac; | |
3646 | fi' | |
3647 | ||
3648 | if ./osf1; then | |
3649 | set signal.h __LANGUAGE_C__; eval $inctest | |
3650 | else | |
3651 | set signal.h LANGUAGE_C; eval $inctest | |
3652 | fi | |
a4f3eea9 | 3653 | |
3654 | case "$hint" in | |
3655 | none|recommended) dflt="$ccflags $dflt" ;; | |
3656 | *) dflt="$ccflags";; | |
3657 | esac | |
3658 | ||
3659 | case "$dflt" in | |
3660 | ''|' ') dflt=none;; | |
3661 | esac | |
3662 | $cat <<EOH | |
3663 | ||
3664 | Your C compiler may want other flags. For this question you should include | |
3665 | -I/whatever and -DWHATEVER flags and any other flags used by the C compiler, | |
3666 | but you should NOT include libraries or ld flags like -lwhatever. If you | |
3667 | want $package to honor its debug switch, you should include -DDEBUGGING here. | |
3668 | Your C compiler might also need additional flags, such as -D_POSIX_SOURCE, | |
3669 | -DHIDEMYMALLOC or -DCRIPPLED_CC. | |
3670 | ||
3671 | To use no flags, specify the word "none". | |
3672 | ||
3673 | EOH | |
3674 | set X $dflt | |
3675 | shift | |
3676 | dflt=${1+"$@"} | |
3677 | rp="Any additional cc flags?" | |
3678 | . ./myread | |
3679 | case "$ans" in | |
3680 | none) ccflags='';; | |
3681 | *) ccflags="$ans";; | |
3682 | esac | |
3683 | ||
3684 | : the following weeds options from ccflags that are of no interest to cpp | |
3685 | cppflags="$ccflags" | |
3686 | case "$gccversion" in | |
3687 | 1*) cppflags="$cppflags -D__GNUC__" | |
3688 | esac | |
3689 | case "$mips_type" in | |
3690 | '');; | |
3691 | *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";; | |
3692 | esac | |
3693 | case "$cppflags" in | |
3694 | '');; | |
3695 | *) | |
3696 | echo " " | |
3697 | echo "Let me guess what the preprocessor flags are..." >&4 | |
3698 | set X $cppflags | |
3699 | shift | |
3700 | cppflags='' | |
3701 | $cat >cpp.c <<'EOM' | |
3702 | #define BLURFL foo | |
3703 | ||
3704 | BLURFL xx LFRULB | |
3705 | EOM | |
3706 | previous='' | |
3707 | for flag in $* | |
3708 | do | |
3709 | case "$flag" in | |
3710 | -*) ftry="$flag";; | |
3711 | *) ftry="$previous $flag";; | |
3712 | esac | |
7bac28a0 | 3713 | if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \ |
a4f3eea9 | 3714 | >cpp1.out 2>/dev/null && \ |
3715 | $cpprun -DLFRULB=bar $ftry $cpplast <cpp.c \ | |
3716 | >cpp2.out 2>/dev/null && \ | |
3717 | $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \ | |
3718 | $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1 | |
3719 | then | |
3720 | cppflags="$cppflags $ftry" | |
3721 | previous='' | |
3722 | else | |
3723 | previous="$flag" | |
3724 | fi | |
3725 | done | |
3726 | set X $cppflags | |
3727 | shift | |
3728 | cppflags=${1+"$@"} | |
3729 | case "$cppflags" in | |
3730 | *-*) echo "They appear to be: $cppflags";; | |
3731 | esac | |
3732 | $rm -f cpp.c cpp?.out | |
3733 | ;; | |
3734 | esac | |
3735 | ||
3736 | : flags used in final linking phase | |
3737 | ||
3738 | case "$ldflags" in | |
3739 | '') if ./venix; then | |
3740 | dflt='-i -z' | |
3741 | else | |
3742 | dflt='' | |
3743 | fi | |
3744 | case "$ccflags" in | |
3745 | *-posix*) dflt="$dflt -posix" ;; | |
3746 | esac | |
3747 | ;; | |
3748 | *) dflt="$ldflags";; | |
3749 | esac | |
3750 | ||
3751 | : Try to guess additional flags to pick up local libraries. | |
3752 | for thislibdir in $libpth; do | |
3753 | case " $loclibpth " in | |
3754 | *" $thislibdir "*) | |
3755 | case "$dflt " in | |
3756 | *"-L$thislibdir "*) ;; | |
3757 | *) dflt="$dflt -L$thislibdir" ;; | |
3758 | esac | |
3759 | ;; | |
3760 | esac | |
3761 | done | |
3762 | ||
3763 | case "$dflt" in | |
3764 | '') dflt='none' ;; | |
3765 | esac | |
3766 | ||
3767 | $cat <<EOH | |
3768 | ||
3769 | Your C linker may need flags. For this question you should | |
3770 | include -L/whatever and any other flags used by the C linker, but you | |
3771 | should NOT include libraries like -lwhatever. | |
3772 | ||
3773 | Make sure you include the appropriate -L/path flags if your C linker | |
3774 | does not normally search all of the directories you specified above, | |
3775 | namely | |
3776 | $libpth | |
3777 | To use no flags, specify the word "none". | |
3778 | ||
3779 | EOH | |
3780 | ||
3781 | rp="Any additional ld flags (NOT including libraries)?" | |
3782 | . ./myread | |
3783 | case "$ans" in | |
3784 | none) ldflags='';; | |
3785 | *) ldflags="$ans";; | |
3786 | esac | |
3787 | rmlist="$rmlist pdp11" | |
3788 | ||
3789 | : coherency check | |
3790 | echo " " | |
1e422769 | 3791 | echo "Checking your choice of C compiler, libs, and flags for coherency..." >&4 |
3792 | set X $cc $optimize $ccflags $ldflags -o try try.c $libs | |
a4f3eea9 | 3793 | shift |
3794 | $cat >try.msg <<EOM | |
3795 | I've tried to compile and run a simple program with: | |
3796 | ||
3797 | $* | |
3798 | ./try | |
3799 | ||
3800 | and I got the following output: | |
3801 | ||
3802 | EOM | |
3803 | $cat > try.c <<'EOF' | |
3804 | #include <stdio.h> | |
3805 | main() { exit(0); } | |
3806 | EOF | |
3807 | dflt=y | |
1e422769 | 3808 | if sh -c "$cc $optimize $ccflags -o try try.c $ldflags $libs" >>try.msg 2>&1; then |
a4f3eea9 | 3809 | if sh -c './try' >>try.msg 2>&1; then |
3810 | dflt=n | |
3811 | else | |
3812 | echo "The program compiled OK, but exited with status $?." >>try.msg | |
90248788 | 3813 | rp="You have a problem. Shall I abort Configure (and explain the problem)" |
a4f3eea9 | 3814 | dflt=y |
3815 | fi | |
3816 | else | |
3817 | echo "I can't compile the test program." >>try.msg | |
90248788 | 3818 | rp="You have a BIG problem. Shall I abort Configure (and explain the problem)" |
a4f3eea9 | 3819 | dflt=y |
3820 | fi | |
3821 | case "$dflt" in | |
3822 | y) | |
97286747 | 3823 | $cat try.msg >&4 |
a4f3eea9 | 3824 | case "$knowitall" in |
3825 | '') | |
3826 | echo "(The supplied flags might be incorrect with this C compiler.)" | |
3827 | ;; | |
3828 | *) dflt=n;; | |
3829 | esac | |
3830 | echo " " | |
3831 | . ./myread | |
3832 | case "$ans" in | |
3833 | n*|N*) ;; | |
3834 | *) echo "Ok. Stopping Configure." >&4 | |
3835 | exit 1 | |
3836 | ;; | |
3837 | esac | |
3838 | ;; | |
3839 | n) echo "OK, that should do.";; | |
3840 | esac | |
3841 | $rm -f try try.* core | |
3842 | ||
3843 | echo " " | |
3844 | echo "Checking for GNU C Library..." >&4 | |
3845 | cat >gnulibc.c <<EOM | |
3846 | int | |
3847 | main() | |
3848 | { | |
3849 | return __libc_main(); | |
3850 | } | |
3851 | EOM | |
3852 | if $cc $ccflags $ldflags -o gnulibc gnulibc.c $libs >/dev/null 2>&1 && \ | |
3853 | ./gnulibc | $contains '^GNU C Library' >/dev/null 2>&1; then | |
3854 | val="$define" | |
3855 | echo "You are using the GNU C Library" | |
4633a7c4 | 3856 | else |
a4f3eea9 | 3857 | val="$undef" |
3858 | echo "You are not using the GNU C Library" | |
4633a7c4 | 3859 | fi |
a4f3eea9 | 3860 | $rm -f gnulibc* |
3861 | set d_gnulibc | |
3862 | eval $setvar | |
25f94b33 | 3863 | |
a4f3eea9 | 3864 | : see if nm is to be used to determine whether a symbol is defined or not |
3865 | case "$usenm" in | |
3866 | '') | |
3867 | case "$d_gnulibc" in | |
3868 | $define) | |
3869 | dflt=n | |
3870 | ;; | |
3871 | *) | |
3872 | dflt=`egrep 'inlibc|csym' ../Configure | wc -l 2>/dev/null` | |
3873 | if $test $dflt -gt 20; then | |
3874 | dflt=y | |
3875 | else | |
3876 | dflt=n | |
3877 | fi | |
3878 | ;; | |
3879 | esac | |
3880 | ;; | |
3881 | *) | |
3882 | case "$usenm" in | |
3883 | true) dflt=y;; | |
3884 | *) dflt=n;; | |
3885 | esac | |
3886 | ;; | |
25f94b33 | 3887 | esac |
a4f3eea9 | 3888 | $cat <<EOM |
4633a7c4 | 3889 | |
a4f3eea9 | 3890 | I can use 'nm' to extract the symbols from your C libraries. This is a time |
3891 | consuming task which may generate huge output on the disk (up to 3 megabytes) | |
3892 | but that should make the symbols extraction faster. The alternative is to skip | |
3893 | the 'nm' extraction part and to compile a small test program instead to | |
3894 | determine whether each symbol is present. If you have a fast C compiler and/or | |
3895 | if your 'nm' output cannot be parsed, this may be the best solution. | |
3896 | You shouldn't let me use 'nm' if you have the GNU C Library. | |
4633a7c4 | 3897 | |
a4f3eea9 | 3898 | EOM |
3899 | rp='Shall I use nm to extract C symbols from the libraries?' | |
4633a7c4 LW |
3900 | . ./myread |
3901 | case "$ans" in | |
a4f3eea9 | 3902 | n|N) usenm=false;; |
3903 | *) usenm=true;; | |
4633a7c4 LW |
3904 | esac |
3905 | ||
a4f3eea9 | 3906 | runnm=$usenm |
3907 | case "$reuseval" in | |
3908 | true) runnm=false;; | |
4633a7c4 | 3909 | esac |
a4f3eea9 | 3910 | |
3911 | : nm options which may be necessary | |
3912 | case "$nm_opt" in | |
3913 | '') if $test -f /mach_boot; then | |
1e422769 | 3914 | nm_opt='' # Mach |
a4f3eea9 | 3915 | elif $test -d /usr/ccs/lib; then |
1e422769 | 3916 | nm_opt='-p' # Solaris (and SunOS?) |
a4f3eea9 | 3917 | elif $test -f /dgux; then |
1e422769 | 3918 | nm_opt='-p' # DG-UX |
2ae324a7 | 3919 | elif $test -f /lib64/rld; then |
1e422769 | 3920 | nm_opt='-p' # 64-bit Irix |
a4f3eea9 | 3921 | else |
3922 | nm_opt='' | |
3923 | fi;; | |
4633a7c4 | 3924 | esac |
4633a7c4 | 3925 | |
a4f3eea9 | 3926 | : nm options which may be necessary for shared libraries but illegal |
3927 | : for archive libraries. Thank you, Linux. | |
3928 | case "$nm_so_opt" in | |
3929 | '') case "$myuname" in | |
3930 | *linux*) | |
3931 | if nm --help | $grep 'dynamic' > /dev/null 2>&1; then | |
3932 | nm_so_opt='--dynamic' | |
4633a7c4 | 3933 | fi |
a4f3eea9 | 3934 | ;; |
4633a7c4 | 3935 | esac |
4633a7c4 LW |
3936 | ;; |
3937 | esac | |
3938 | ||
a4f3eea9 | 3939 | case "$runnm" in |
3940 | true) | |
3941 | : get list of predefined functions in a handy place | |
3942 | echo " " | |
3943 | case "$libc" in | |
3944 | '') libc=unknown | |
3945 | case "$libs" in | |
5f05dabc | 3946 | *-lc_s*) libc=`./loc libc_s$lib_ext $libc $libpth` |
a4f3eea9 | 3947 | esac |
3948 | ;; | |
3949 | esac | |
3950 | libnames=''; | |
3951 | case "$libs" in | |
3952 | '') ;; | |
3953 | *) for thislib in $libs; do | |
3954 | case "$thislib" in | |
3955 | -lc|-lc_s) | |
3956 | : Handle C library specially below. | |
3957 | ;; | |
3958 | -l*) | |
3959 | thislib=`echo $thislib | $sed -e 's/^-l//'` | |
3960 | if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then | |
3961 | : | |
3962 | elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then | |
3963 | : | |
5f05dabc | 3964 | elif try=`./loc lib$thislib$lib_ext X $libpth`; $test -f "$try"; then |
a4f3eea9 | 3965 | : |
d97d40b5 IZ |
3966 | elif try=`./loc $thislib$lib_ext X $libpth`; $test -f "$try"; then |
3967 | : | |
a4f3eea9 | 3968 | elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then |
3969 | : | |
3970 | elif try=`./loc $thislib X $libpth`; $test -f "$try"; then | |
3971 | : | |
5f05dabc | 3972 | elif try=`./loc Slib$thislib$lib_ext X $xlibpth`; $test -f "$try"; then |
a4f3eea9 | 3973 | : |
3974 | else | |
3975 | try='' | |
3976 | fi | |
3977 | libnames="$libnames $try" | |
3978 | ;; | |
3979 | *) libnames="$libnames $thislib" ;; | |
3980 | esac | |
3981 | done | |
3982 | ;; | |
3983 | esac | |
3984 | xxx=normal | |
3985 | case "$libc" in | |
3986 | unknown) | |
3987 | set /lib/libc.$so | |
3988 | for xxx in $libpth; do | |
3989 | $test -r $1 || set $xxx/libc.$so | |
3990 | : The messy sed command sorts on library version numbers. | |
3991 | $test -r $1 || \ | |
3992 | set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \ | |
3993 | tr ' ' '\012' | egrep -v '\.[A-Za-z]*$' | $sed -e ' | |
3994 | h | |
3995 | s/[0-9][0-9]*/0000&/g | |
3996 | s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g | |
3997 | G | |
3998 | s/\n/ /' | \ | |
3999 | sort | $sed -e 's/^.* //'` | |
4000 | eval set \$$# | |
4001 | done | |
4002 | $test -r $1 || set /usr/ccs/lib/libc.$so | |
5f05dabc | 4003 | $test -r $1 || set /lib/libsys_s$lib_ext |
a4f3eea9 | 4004 | ;; |
4005 | *) | |
4006 | set blurfl | |
4007 | ;; | |
4008 | esac | |
4009 | if $test -r "$1"; then | |
4010 | echo "Your (shared) C library seems to be in $1." | |
4011 | libc="$1" | |
4012 | elif $test -r /lib/libc && $test -r /lib/clib; then | |
4013 | echo "Your C library seems to be in both /lib/clib and /lib/libc." | |
4014 | xxx=apollo | |
4015 | libc='/lib/clib /lib/libc' | |
4016 | if $test -r /lib/syslib; then | |
4017 | echo "(Your math library is in /lib/syslib.)" | |
4018 | libc="$libc /lib/syslib" | |
4019 | fi | |
4020 | elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then | |
4021 | echo "Your C library seems to be in $libc, as you said before." | |
5f05dabc | 4022 | elif $test -r $incpath/usr/lib/libc$lib_ext; then |
4023 | libc=$incpath/usr/lib/libc$lib_ext; | |
a4f3eea9 | 4024 | echo "Your C library seems to be in $libc. That's fine." |
5f05dabc | 4025 | elif $test -r /lib/libc$lib_ext; then |
4026 | libc=/lib/libc$lib_ext; | |
a4f3eea9 | 4027 | echo "Your C library seems to be in $libc. You're normal." |
4028 | else | |
5f05dabc | 4029 | if tans=`./loc libc$lib_ext blurfl/dyick $libpth`; $test -r "$tans"; then |
a4f3eea9 | 4030 | : |
4031 | elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then | |
4032 | libnames="$libnames "`./loc clib blurfl/dyick $libpth` | |
4033 | elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then | |
4034 | : | |
5f05dabc | 4035 | elif tans=`./loc Slibc$lib_ext blurfl/dyick $xlibpth`; $test -r "$tans"; then |
a4f3eea9 | 4036 | : |
5f05dabc | 4037 | elif tans=`./loc Mlibc$lib_ext blurfl/dyick $xlibpth`; $test -r "$tans"; then |
a4f3eea9 | 4038 | : |
4633a7c4 | 4039 | else |
5f05dabc | 4040 | tans=`./loc Llibc$lib_ext blurfl/dyick $xlibpth` |
4633a7c4 | 4041 | fi |
a4f3eea9 | 4042 | if $test -r "$tans"; then |
4043 | echo "Your C library seems to be in $tans, of all places." | |
4044 | libc=$tans | |
4045 | else | |
4046 | libc='blurfl' | |
4047 | fi | |
4048 | fi | |
4049 | if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then | |
4050 | dflt="$libc" | |
4051 | cat <<EOM | |
4633a7c4 | 4052 | |
a4f3eea9 | 4053 | If the guess above is wrong (which it might be if you're using a strange |
4054 | compiler, or your machine supports multiple models), you can override it here. | |
4633a7c4 | 4055 | |
a4f3eea9 | 4056 | EOM |
4057 | else | |
4058 | dflt='' | |
4059 | echo $libpth | tr ' ' '\012' | sort | uniq > libpath | |
4060 | cat >&4 <<EOM | |
4061 | I can't seem to find your C library. I've looked in the following places: | |
4633a7c4 | 4062 | |
a4f3eea9 | 4063 | EOM |
4064 | $sed 's/^/ /' libpath | |
4065 | cat <<EOM | |
4633a7c4 | 4066 | |
a4f3eea9 | 4067 | None of these seems to contain your C library. I need to get its name... |
4633a7c4 | 4068 | |
a4f3eea9 | 4069 | EOM |
4070 | fi | |
4071 | fn=f | |
4072 | rp='Where is your C library?' | |
4073 | . ./getfile | |
4074 | libc="$ans" | |
4633a7c4 | 4075 | |
4633a7c4 | 4076 | echo " " |
a4f3eea9 | 4077 | echo $libc $libnames | tr ' ' '\012' | sort | uniq > libnames |
4078 | set X `cat libnames` | |
4633a7c4 | 4079 | shift |
a4f3eea9 | 4080 | xxx=files |
4081 | case $# in 1) xxx=file; esac | |
4082 | echo "Extracting names from the following $xxx for later perusal:" >&4 | |
4083 | echo " " | |
4084 | $sed 's/^/ /' libnames >&4 | |
4085 | echo " " | |
4086 | $echo $n "This may take a while...$c" >&4 | |
4633a7c4 | 4087 | |
a4f3eea9 | 4088 | : Linux may need the special Dynamic option to nm for shared libraries. |
4089 | : In general, this is stored in the nm_so_opt variable. | |
4090 | : Unfortunately, that option may be fatal on non-shared libraries. | |
4091 | for nm_libs_ext in $*; do | |
4092 | case $nm_libs_ext in | |
4093 | *$so*) nm $nm_so_opt $nm_opt $nm_libs_ext 2>/dev/null ;; | |
4094 | *) nm $nm_opt $nm_libs_ext 2>/dev/null ;; | |
4095 | esac | |
4096 | done > libc.tmp | |
4633a7c4 | 4097 | |
a4f3eea9 | 4098 | $echo $n ".$c" |
4099 | $grep fprintf libc.tmp > libc.ptf | |
4100 | xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4' | |
4101 | xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4' | |
4102 | xxx='[ADTSIW]' | |
4103 | if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx *_[_.]*//p' -e 's/^.* $xxx *//p'";\ | |
4104 | eval $xscan;\ | |
4105 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4106 | eval $xrun | |
4107 | elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\ | |
4108 | eval $xscan;\ | |
4109 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4110 | eval $xrun | |
4111 | elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\ | |
4112 | eval $xscan;\ | |
4113 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4114 | eval $xrun | |
4115 | elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\ | |
4116 | eval $xscan;\ | |
4117 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4118 | eval $xrun | |
4119 | elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\ | |
4120 | eval $xscan;\ | |
4121 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4122 | eval $xrun | |
4123 | elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\ | |
4124 | eval $xscan;\ | |
4125 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4126 | eval $xrun | |
4127 | elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \ | |
4128 | -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\ | |
4129 | eval $xscan;\ | |
4130 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4131 | eval $xrun | |
4132 | elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\ | |
4133 | eval $xscan;\ | |
4134 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4135 | eval $xrun | |
4136 | elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\ | |
4137 | eval $xscan;\ | |
4138 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4139 | eval $xrun | |
1e422769 | 4140 | elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\ |
4141 | eval $xscan;\ | |
4142 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4143 | eval $xrun | |
a4f3eea9 | 4144 | elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\ |
4145 | eval $xscan;\ | |
4146 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4147 | eval $xrun | |
4148 | elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\ | |
4149 | eval $xscan;\ | |
4150 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4151 | eval $xrun | |
44a8e56a | 4152 | elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\ |
4153 | eval $xscan;\ | |
4154 | $contains '^fprintf$' libc.list >/dev/null 2>&1; then | |
4155 | eval $xrun | |
a4f3eea9 | 4156 | else |
4157 | nm -p $* 2>/dev/null >libc.tmp | |
4158 | $grep fprintf libc.tmp > libc.ptf | |
4159 | if com="$sed -n -e 's/^.* [ADTSIW] *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\ | |
4160 | eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1 | |
4161 | then | |
4162 | nm_opt='-p' | |
4163 | eval $xrun | |
4633a7c4 | 4164 | else |
a4f3eea9 | 4165 | echo " " |
4166 | echo "nm didn't seem to work right. Trying ar instead..." >&4 | |
4167 | com='' | |
4168 | if ar t $libc > libc.tmp; then | |
4169 | for thisname in $libnames; do | |
4170 | ar t $thisname >>libc.tmp | |
4171 | done | |
4172 | $sed -e 's/\.o$//' < libc.tmp > libc.list | |
4173 | echo "Ok." >&4 | |
4174 | else | |
4175 | echo "ar didn't seem to work right." >&4 | |
4176 | echo "Maybe this is a Cray...trying bld instead..." >&4 | |
4177 | if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list | |
4178 | then | |
4179 | for thisname in $libnames; do | |
4180 | bld t $libnames | \ | |
4181 | $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list | |
4182 | ar t $thisname >>libc.tmp | |
4183 | done | |
4184 | echo "Ok." >&4 | |
4185 | else | |
4186 | echo "That didn't work either. Giving up." >&4 | |
4187 | exit 1 | |
4188 | fi | |
4189 | fi | |
4633a7c4 | 4190 | fi |
4633a7c4 | 4191 | fi |
a4f3eea9 | 4192 | nm_extract="$com" |
4193 | if $test -f /lib/syscalls.exp; then | |
4633a7c4 | 4194 | echo " " |
a4f3eea9 | 4195 | echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4 |
4196 | $sed -n 's/^\([^ ]*\)[ ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list | |
4197 | fi | |
4198 | ;; | |
4199 | esac | |
4200 | $rm -f libnames libpath | |
4201 | ||
2afac517 | 4202 | : determine filename position in cpp output |
4633a7c4 | 4203 | echo " " |
2afac517 | 4204 | echo "Computing filename position in cpp output for #include directives..." >&4 |
4205 | echo '#include <stdio.h>' > foo.c | |
4206 | $cat >fieldn <<EOF | |
4207 | $startsh | |
4208 | $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \ | |
4209 | $grep '^[ ]*#.*stdio\.h' | \ | |
4210 | while read cline; do | |
4211 | pos=1 | |
4212 | set \$cline | |
4213 | while $test \$# -gt 0; do | |
4214 | if $test -r \`echo \$1 | $tr -d '"'\`; then | |
4215 | echo "\$pos" | |
4216 | exit 0 | |
4217 | fi | |
4218 | shift | |
4219 | pos=\`expr \$pos + 1\` | |
4220 | done | |
4633a7c4 | 4221 | done |
2afac517 | 4222 | EOF |
4223 | chmod +x fieldn | |
4224 | fieldn=`./fieldn` | |
4225 | $rm -f foo.c fieldn | |
4226 | case $fieldn in | |
4227 | '') pos='???';; | |
4228 | 1) pos=first;; | |
4229 | 2) pos=second;; | |
4230 | 3) pos=third;; | |
4231 | *) pos="${fieldn}th";; | |
4633a7c4 | 4232 | esac |
2afac517 | 4233 | echo "Your cpp writes the filename in the $pos field of the line." |
4633a7c4 | 4234 | |
2afac517 | 4235 | : locate header file |
4236 | $cat >findhdr <<EOF | |
4237 | $startsh | |
4238 | wanted=\$1 | |
4239 | name='' | |
4240 | if test -f $usrinc/\$wanted; then | |
4241 | echo "$usrinc/\$wanted" | |
4242 | exit 0 | |
4243 | fi | |
4244 | awkprg='{ print \$$fieldn }' | |
4245 | echo "#include <\$wanted>" > foo\$\$.c | |
4246 | $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \ | |
4247 | $grep "^[ ]*#.*\$wanted" | \ | |
4248 | while read cline; do | |
4249 | name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\` | |
4250 | case "\$name" in | |
4251 | */\$wanted) echo "\$name"; exit 0;; | |
4252 | *) name='';; | |
4253 | esac; | |
4254 | done; | |
4255 | $rm -f foo\$\$.c; | |
4256 | case "\$name" in | |
4257 | '') exit 1;; | |
4633a7c4 | 4258 | esac |
2afac517 | 4259 | EOF |
4260 | chmod +x findhdr | |
4633a7c4 | 4261 | |
2afac517 | 4262 | : define an alternate in-header-list? function |
4263 | inhdr='echo " "; td=$define; tu=$undef; yyy=$@; | |
4264 | cont=true; xxf="echo \"<\$1> found.\" >&4"; | |
4265 | case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";; | |
4266 | *) xxnf="echo \"<\$1> NOT found, ...\" >&4";; | |
4267 | esac; | |
4268 | case $# in 4) instead=instead;; *) instead="at last";; esac; | |
4269 | while $test "$cont"; do | |
4270 | xxx=`./findhdr $1` | |
4271 | var=$2; eval "was=\$$2"; | |
4272 | if $test "$xxx" && $test -r "$xxx"; | |
4273 | then eval $xxf; | |
4274 | eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td"; | |
4275 | cont=""; | |
4276 | else eval $xxnf; | |
4277 | eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi; | |
4278 | set $yyy; shift; shift; yyy=$@; | |
4279 | case $# in 0) cont="";; | |
4280 | 2) xxf="echo \"but I found <\$1> $instead.\" >&4"; | |
4281 | xxnf="echo \"and I did not find <\$1> either.\" >&4";; | |
4282 | *) xxf="echo \"but I found <\$1\> instead.\" >&4"; | |
4283 | xxnf="echo \"there is no <\$1>, ...\" >&4";; | |
4284 | esac; | |
4285 | done; | |
4286 | while $test "$yyy"; | |
4287 | do set $yyy; var=$2; eval "was=\$$2"; | |
4288 | eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; | |
4289 | set $yyy; shift; shift; yyy=$@; | |
4290 | done' | |
4633a7c4 | 4291 | |
2afac517 | 4292 | : see if dld is available |
4293 | set dld.h i_dld | |
4294 | eval $inhdr | |
4633a7c4 | 4295 | |
2afac517 | 4296 | : is a C symbol defined? |
4297 | csym='tlook=$1; | |
4298 | case "$3" in | |
4299 | -v) tf=libc.tmp; tc=""; tdc="";; | |
4300 | -a) tf=libc.tmp; tc="[0]"; tdc="[]";; | |
4301 | *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";; | |
4302 | esac; | |
4303 | tx=yes; | |
4304 | case "$reuseval-$4" in | |
4305 | true-) ;; | |
4306 | true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;; | |
4307 | esac; | |
4308 | case "$tx" in | |
4309 | yes) | |
4310 | case "$runnm" in | |
4311 | true) | |
4312 | if $contains $tlook $tf >/dev/null 2>&1; | |
4313 | then tval=true; | |
4314 | else tval=false; | |
4315 | fi;; | |
4316 | *) | |
4317 | echo "main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c; | |
4318 | if $cc $ccflags $ldflags -o t t.c $libs >/dev/null 2>&1; | |
4319 | then tval=true; | |
4320 | else tval=false; | |
4321 | fi; | |
4322 | $rm -f t t.c;; | |
4323 | esac;; | |
4324 | *) | |
4325 | case "$tval" in | |
4326 | $define) tval=true;; | |
4327 | *) tval=false;; | |
4328 | esac;; | |
4329 | esac; | |
4330 | eval "$2=$tval"' | |
4633a7c4 | 4331 | |
2afac517 | 4332 | : define an is-in-libc? function |
4333 | inlibc='echo " "; td=$define; tu=$undef; | |
4334 | sym=$1; var=$2; eval "was=\$$2"; | |
4335 | tx=yes; | |
4336 | case "$reuseval$was" in | |
4337 | true) ;; | |
4338 | true*) tx=no;; | |
4339 | esac; | |
4340 | case "$tx" in | |
4341 | yes) | |
4342 | set $sym tres -f; | |
4343 | eval $csym; | |
4344 | case "$tres" in | |
4345 | true) | |
4346 | echo "$sym() found." >&4; | |
4347 | case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";; | |
4348 | *) | |
4349 | echo "$sym() NOT found." >&4; | |
4350 | case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";; | |
4351 | esac;; | |
4352 | *) | |
4353 | case "$was" in | |
4354 | $define) echo "$sym() found." >&4;; | |
4355 | *) echo "$sym() NOT found." >&4;; | |
4356 | esac;; | |
4357 | esac' | |
4633a7c4 | 4358 | |
2afac517 | 4359 | : see if dlopen exists |
4360 | xxx_runnm="$runnm" | |
4361 | runnm=false | |
4362 | set dlopen d_dlopen | |
4363 | eval $inlibc | |
4364 | runnm="$xxx_runnm" | |
40a7a20a | 4365 | |
2afac517 | 4366 | : determine which dynamic loading, if any, to compile in |
4633a7c4 | 4367 | echo " " |
2afac517 | 4368 | dldir="ext/DynaLoader" |
4369 | case "$usedl" in | |
4370 | $define|y|true) | |
4371 | dflt='y' | |
4372 | usedl="$define" | |
4373 | ;; | |
4374 | $undef|n|false) | |
4375 | dflt='n' | |
4376 | usedl="$undef" | |
4377 | ;; | |
4378 | *) | |
4379 | dflt='n' | |
4380 | case "$d_dlopen" in | |
4381 | $define) dflt='y' ;; | |
4382 | esac | |
4383 | case "$i_dld" in | |
4384 | $define) dflt='y' ;; | |
4633a7c4 | 4385 | esac |
2afac517 | 4386 | : Does a dl_xxx.xs file exist for this operating system |
4387 | $test -f ../$dldir/dl_${osname}.xs && dflt='y' | |
4633a7c4 LW |
4388 | ;; |
4389 | esac | |
2afac517 | 4390 | rp="Do you wish to use dynamic loading?" |
4391 | . ./myread | |
4392 | usedl="$ans" | |
4393 | case "$ans" in | |
4394 | y*) usedl="$define" | |
4395 | case "$dlsrc" in | |
4396 | '') | |
4397 | if $test -f ../$dldir/dl_${osname}.xs ; then | |
4398 | dflt="$dldir/dl_${osname}.xs" | |
4399 | elif $test "$d_dlopen" = "$define" ; then | |
4400 | dflt="$dldir/dl_dlopen.xs" | |
4401 | elif $test "$i_dld" = "$define" ; then | |
4402 | dflt="$dldir/dl_dld.xs" | |
4633a7c4 | 4403 | else |
2afac517 | 4404 | dflt='' |
4633a7c4 | 4405 | fi |
4633a7c4 | 4406 | ;; |
2afac517 | 4407 | *) dflt="$dldir/$dlsrc" |
4408 | ;; | |
4633a7c4 | 4409 | esac |
2afac517 | 4410 | echo "The following dynamic loading files are available:" |
4411 | : Can not go over to $dldir because getfile has path hard-coded in. | |
4412 | cd ..; ls -C $dldir/dl*.xs; cd UU | |
4413 | rp="Source file to use for dynamic loading" | |
4414 | fn="fne" | |
4415 | . ./getfile | |
4416 | usedl="$define" | |
4417 | : emulate basename | |
4418 | dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'` | |
2304df62 | 4419 | |
2afac517 | 4420 | $cat << EOM |
2304df62 | 4421 | |
2afac517 | 4422 | Some systems may require passing special flags to $cc -c to |
4423 | compile modules that will be used to create a shared library. | |
4424 | To use no flags, say "none". | |
2304df62 AD |
4425 | |
4426 | EOM | |
2afac517 | 4427 | case "$cccdlflags" in |
4428 | '') case "$gccversion" in | |
4429 | '') case "$osname" in | |
4430 | hpux) dflt='+z' ;; | |
4431 | next) dflt='none' ;; | |
8cc95fdb | 4432 | svr4*|esix*) dflt='-Kpic' ;; |
4433 | irix*) dflt='-KPIC' ;; | |
4434 | solaris) case "$ccflags" in | |
4435 | *-DDEBUGGING*) dflt='-KPIC' ;; | |
4436 | *) dflt='-Kpic' ;; | |
4437 | esac ;; | |
2afac517 | 4438 | sunos) dflt='-pic' ;; |
4439 | *) dflt='none' ;; | |
4440 | esac ;; | |
81d89818 HF |
4441 | *) case "$osname/$ccflags" in |
4442 | solaris/*-DDEBUGGING*) dflt='-fPIC' ;; | |
4443 | *) dflt='-fpic' ;; | |
4444 | esac ;; | |
2afac517 | 4445 | esac ;; |
4446 | *) dflt="$cccdlflags" ;; | |
4447 | esac | |
4448 | rp="Any special flags to pass to $cc -c to compile shared library modules?" | |
4449 | . ./myread | |
4450 | case "$ans" in | |
4451 | none) cccdlflags=' ' ;; | |
4452 | *) cccdlflags="$ans" ;; | |
4453 | esac | |
2304df62 | 4454 | |
2afac517 | 4455 | cat << EOM |
ecfc5424 | 4456 | |
2afac517 | 4457 | Some systems use ld to create libraries that can be dynamically loaded, |
4458 | while other systems (such as those using ELF) use $cc. | |
a0f45b59 | 4459 | |
2afac517 | 4460 | EOM |
4461 | case "$ld" in | |
4462 | '') $cat >try.c <<'EOM' | |
4463 | /* Test for whether ELF binaries are produced */ | |
4464 | #include <fcntl.h> | |
4465 | #include <stdlib.h> | |
4466 | main() { | |
4467 | char b[4]; | |
4468 | int i = open("a.out",O_RDONLY); | |
4469 | if(i == -1) | |
4470 | exit(1); /* fail */ | |
4471 | if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F') | |
4472 | exit(0); /* succeed (yes, it's ELF) */ | |
2304df62 | 4473 | else |
2afac517 | 4474 | exit(1); /* fail */ |
4475 | } | |
4476 | EOM | |
4477 | if $cc $ccflags try.c >/dev/null 2>&1 && ./a.out; then | |
4478 | cat <<EOM | |
4479 | You appear to have ELF support. I'll use $cc to build dynamic libraries. | |
4480 | EOM | |
4481 | dflt="$cc" | |
2304df62 | 4482 | else |
2afac517 | 4483 | echo "I'll use ld to build dynamic libraries." |
4484 | dflt='ld' | |
2304df62 | 4485 | fi |
2afac517 | 4486 | rm -f try.c a.out |
4487 | ;; | |
4488 | *) dflt="$ld" | |
4489 | ;; | |
4490 | esac | |
4491 | ||
4492 | rp="What command should be used to create dynamic libraries?" | |
4493 | . ./myread | |
4494 | ld="$ans" | |
4495 | ||
4496 | cat << EOM | |
4497 | ||
4498 | Some systems may require passing special flags to $ld to create a | |
4499 | library that can be dynamically loaded. If your ld flags include | |
4500 | -L/other/path options to locate libraries outside your loader's normal | |
4501 | search path, you may need to specify those -L options here as well. To | |
4502 | use no flags, say "none". | |
4503 | ||
4504 | EOM | |
4505 | case "$lddlflags" in | |
4506 | '') case "$osname" in | |
4507 | hpux) dflt='-b' ;; | |
4508 | linux|irix*) dflt='-shared' ;; | |
4509 | next) dflt='none' ;; | |
4510 | solaris) dflt='-G' ;; | |
4511 | sunos) dflt='-assert nodefinitions' ;; | |
4512 | svr4*|esix*) dflt="-G $ldflags" ;; | |
4513 | *) dflt='none' ;; | |
4514 | esac | |
4515 | ;; | |
4516 | *) dflt="$lddlflags" ;; | |
4517 | esac | |
4518 | ||
4519 | : Try to guess additional flags to pick up local libraries. | |
4520 | for thisflag in $ldflags; do | |
4521 | case "$thisflag" in | |
4522 | -L*) | |
4523 | case " $dflt " in | |
4524 | *" $thisflag "*) ;; | |
4525 | *) dflt="$dflt $thisflag" ;; | |
4526 | esac | |
4527 | ;; | |
4528 | esac | |
4529 | done | |
4530 | ||
4531 | case "$dflt" in | |
4532 | '') dflt='none' ;; | |
4533 | esac | |
4534 | ||
4535 | rp="Any special flags to pass to $ld to create a dynamically loaded library?" | |
4536 | . ./myread | |
4537 | case "$ans" in | |
4538 | none) lddlflags=' ' ;; | |
4539 | *) lddlflags="$ans" ;; | |
4540 | esac | |
4541 | ||
4542 | cat <<EOM | |
4543 | ||
4544 | Some systems may require passing special flags to $cc to indicate that | |
4545 | the resulting executable will use dynamic linking. To use no flags, | |
4546 | say "none". | |
4547 | ||
4548 | EOM | |
4549 | case "$ccdlflags" in | |
4550 | '') case "$osname" in | |
4551 | hpux) dflt='-Wl,-E' ;; | |
4552 | linux) dflt='-rdynamic' ;; | |
4553 | next) dflt='none' ;; | |
4554 | sunos) dflt='none' ;; | |
4555 | *) dflt='none' ;; | |
4556 | esac ;; | |
4557 | *) dflt="$ccdlflags" ;; | |
4558 | esac | |
4559 | rp="Any special flags to pass to $cc to use dynamic loading?" | |
4560 | . ./myread | |
4561 | case "$ans" in | |
4562 | none) ccdlflags=' ' ;; | |
4563 | *) ccdlflags="$ans" ;; | |
4564 | esac | |
4565 | ;; | |
4566 | *) usedl="$undef" | |
4567 | ld='ld' | |
4568 | dlsrc='dl_none.xs' | |
4569 | lddlflags='' | |
4570 | ccdlflags='' | |
4571 | ;; | |
4572 | esac | |
4573 | ||
4574 | also='' | |
4575 | case "$usedl" in | |
4576 | $undef) | |
4577 | # No dynamic loading being used, so don't bother even to prompt. | |
4578 | useshrplib='false' | |
4579 | ;; | |
4580 | *) case "$useshrplib" in | |
4581 | '') case "$osname" in | |
2ae324a7 | 4582 | svr4*|dgux|dynixptx|esix|powerux) |
3e3baf6d | 4583 | dflt=y |
2afac517 | 4584 | also='Building a shared libperl is required for dynamic loading to work on your system.' |
4585 | ;; | |
4586 | next*) | |
4587 | case "$osvers" in | |
3e3baf6d | 4588 | 4*) dflt=y |
2afac517 | 4589 | also='Building a shared libperl is needed for MAB support.' |
4590 | ;; | |
3e3baf6d | 4591 | *) dflt=n |
2afac517 | 4592 | ;; |
4593 | esac | |
4594 | ;; | |
4595 | sunos) | |
3e3baf6d | 4596 | dflt=n |
2afac517 | 4597 | also='Building a shared libperl will definitely not work on SunOS 4.' |
4598 | ;; | |
3e3baf6d | 4599 | *) dflt=n |
2afac517 | 4600 | ;; |
4601 | esac | |
4602 | ;; | |
4603 | $define|true|[Yy]*) | |
3e3baf6d | 4604 | dflt=y |
2afac517 | 4605 | ;; |
3e3baf6d | 4606 | *) dflt=n |
2afac517 | 4607 | ;; |
4608 | esac | |
4609 | $cat << EOM | |
4610 | ||
4611 | The perl executable is normally obtained by linking perlmain.c with | |
4612 | libperl${lib_ext}, any static extensions (usually just DynaLoader), and | |
4613 | any other libraries needed on this system (such as -lm, etc.). Since | |
4614 | your system supports dynamic loading, it is probably possible to build | |
4615 | a shared libperl.$so. If you will have more than one executable linked | |
4616 | to libperl.$so, this will significantly reduce the size of each | |
4617 | executable, but it may have a noticeable affect on performance. The | |
4618 | default is probably sensible for your system. | |
4619 | $also | |
4620 | ||
4621 | EOM | |
4622 | rp="Build a shared libperl.$so (y/n)" | |
4623 | . ./myread | |
4624 | case "$ans" in | |
4625 | true|$define|[Yy]*) | |
4626 | useshrplib='true' | |
4627 | # Why does next4 have to be so different? | |
4628 | case "${osname}${osvers}" in | |
4629 | next4*) xxx='DYLD_LIBRARY_PATH' ;; | |
4630 | *) xxx='LD_LIBRARY_PATH' ;; | |
4631 | esac | |
4632 | $cat <<EOM >&4 | |
4633 | ||
4634 | To build perl, you must add the current working directory to your | |
4635 | $xxx environtment variable before running make. You can do | |
4636 | this with | |
4637 | $xxx=\`pwd\`; export $xxx | |
4638 | for Bourne-style shells, or | |
4639 | setenv $xxx \`pwd\` | |
4640 | for Csh-style shells. You *MUST* do this before running make. | |
4641 | ||
4642 | EOM | |
4643 | ;; | |
4644 | *) useshrplib='false' ;; | |
4645 | esac | |
4646 | ;; | |
4647 | esac | |
4648 | ||
4649 | case "$useshrplib" in | |
4650 | true) | |
4651 | case "$libperl" in | |
4652 | '') | |
4653 | # Figure out a good name for libperl.so. Since it gets stored in | |
4654 | # a version-specific architecture-dependent library, the version | |
4655 | # number isn't really that important, except for making cc/ld happy. | |
4656 | # | |
4657 | # A name such as libperl.so.3.1 | |
4658 | majmin="libperl.$so.$patchlevel.$subversion" | |
4659 | # A name such as libperl.so.301 | |
4660 | majonly=`echo $patchlevel $subversion | | |
4661 | $awk '{printf "%d%02d", $1, $2}'` | |
4662 | majonly=libperl.$so.$majonly | |
4663 | # I'd prefer to keep the os-specific stuff here to a minimum, and | |
4664 | # rely on figuring it out from the naming of libc. | |
4665 | case "${osname}${osvers}" in | |
4666 | next4*) | |
4667 | dflt=libperl.5.$so | |
4668 | # XXX How handle the --version stuff for MAB? | |
4669 | ;; | |
4670 | linux*) # ld won't link with a bare -lperl otherwise. | |
4671 | dflt=libperl.$so | |
4672 | ;; | |
4673 | *) # Try to guess based on whether libc has major.minor. | |
4674 | case "$libc" in | |
4675 | *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;; | |
4676 | *libc.$so.[0-9]*) dflt=$majonly ;; | |
4677 | *) dflt=libperl.$so ;; | |
4678 | esac | |
4679 | ;; | |
4680 | esac | |
4681 | ;; | |
4682 | *) dflt=$libperl | |
4683 | ;; | |
4684 | esac | |
4685 | cat << EOM | |
4686 | ||
4687 | I need to select a good name for the shared libperl. If your system uses | |
4688 | library names with major and minor numbers, then you might want something | |
4689 | like $majmin. Alternatively, if your system uses a single version | |
4690 | number for shared libraries, then you might want to use $majonly. | |
4691 | Or, your system might be quite happy with a simple libperl.$so. | |
4692 | ||
4693 | Since the shared libperl will get installed into a version-specific | |
4694 | architecture-dependent directory, the version number of the shared perl | |
4695 | library probably isn't important, so the default should be o.k. | |
4696 | ||
4697 | EOM | |
4698 | rp='What name do you want to give to the shared libperl?' | |
4699 | . ./myread | |
4700 | libperl=$ans | |
4701 | echo "Ok, I'll use $libperl" | |
4702 | ;; | |
4703 | *) | |
4704 | libperl="libperl${lib_ext}" | |
4705 | ;; | |
4706 | esac | |
4707 | ||
4708 | # Detect old use of shrpdir via undocumented Configure -Dshrpdir | |
4709 | case "$shrpdir" in | |
4710 | '') ;; | |
4711 | *) $cat >&4 <<EOM | |
4712 | WARNING: Use of the shrpdir variable for the installation location of | |
4713 | the shared $libperl is not supported. It was never documented and | |
284c50cc MDLR |
4714 | will not work in this version. Let me (chip@perl.com) know of any |
4715 | problems this may cause. | |
2afac517 | 4716 | |
4717 | EOM | |
4718 | case "$shrpdir" in | |
4719 | "$archlibexp/CORE") | |
4720 | $cat >&4 <<EOM | |
4721 | But your current setting of $shrpdir is | |
4722 | the default anyway, so it's harmless. | |
4723 | EOM | |
4724 | ;; | |
4725 | *) | |
4726 | $cat >&4 <<EOM | |
4727 | Further, your current attempted setting of $shrpdir | |
4728 | conflicts with the value of $archlibexp/CORE | |
4729 | that installperl will use. | |
4730 | EOM | |
4731 | ;; | |
4732 | esac | |
4733 | ;; | |
4734 | esac | |
4735 | ||
4736 | # How will the perl executable find the installed shared $libperl? | |
4737 | # Add $xxx to ccdlflags. | |
4738 | # If we can't figure out a command-line option, use $shrpenv to | |
4739 | # set env LD_RUN_PATH. The main perl makefile uses this. | |
4740 | shrpdir=$archlibexp/CORE | |
4741 | xxx='' | |
4742 | tmp_shrpenv='' | |
4743 | if "$useshrplib"; then | |
4744 | case "$osname" in | |
3c321fdc | 4745 | aix) |
4746 | # We'll set it in Makefile.SH... | |
4747 | ;; | |
2afac517 | 4748 | solaris|netbsd) |
4749 | xxx="-R $shrpdir" | |
4750 | ;; | |
28757baa | 4751 | freebsd) |
44a8e56a | 4752 | xxx="-Wl,-R$shrpdir" |
28757baa | 4753 | ;; |
b971f6e4 | 4754 | linux|irix*|dec_osf) |
2afac517 | 4755 | xxx="-Wl,-rpath,$shrpdir" |
4756 | ;; | |
7bac28a0 | 4757 | next) |
4758 | # next doesn't like the default... | |
4759 | ;; | |
2afac517 | 4760 | *) |
4761 | tmp_shrpenv="env LD_RUN_PATH=$shrpdir" | |
4762 | ;; | |
4763 | esac | |
4764 | case "$xxx" in | |
4765 | '') ;; | |
b971f6e4 | 4766 | *) |
4767 | # Only add $xxx if it isn't already in ccdlflags. | |
4768 | case " $ccdlflags " in | |
4769 | *" $xxx "*) ;; | |
4770 | *) ccdlflags="$ccdlflags $xxx" | |
4771 | cat <<EOM >&4 | |
2afac517 | 4772 | |
4773 | Adding $xxx to the flags | |
4774 | passed to $ld so that the perl executable will find the | |
4775 | installed shared $libperl. | |
4776 | ||
4777 | EOM | |
b971f6e4 | 4778 | ;; |
4779 | esac | |
2afac517 | 4780 | ;; |
4781 | esac | |
4782 | fi | |
4783 | # Respect a hint or command-line value. | |
4784 | case "$shrpenv" in | |
4785 | '') shrpenv="$tmp_shrpenv" ;; | |
4786 | esac | |
4787 | ||
4788 | : determine where manual pages go | |
4789 | set man1dir man1dir none | |
4790 | eval $prefixit | |
4791 | $cat <<EOM | |
4792 | ||
4793 | $spackage has manual pages available in source form. | |
4794 | EOM | |
4795 | case "$nroff" in | |
4796 | nroff) | |
4797 | echo "However, you don't have nroff, so they're probably useless to you." | |
4798 | case "$man1dir" in | |
4799 | '') man1dir="none";; | |
4800 | esac;; | |
4801 | esac | |
4802 | echo "If you don't want the manual sources installed, answer 'none'." | |
4803 | case "$man1dir" in | |
4804 | ' ') dflt=none | |
4805 | ;; | |
4806 | '') | |
4807 | lookpath="$prefixexp/man/man1 $prefixexp/man/l_man/man1" | |
4808 | lookpath="$lookpath $prefixexp/man/p_man/man1" | |
4809 | lookpath="$lookpath $prefixexp/man/u_man/man1" | |
4810 | lookpath="$lookpath $prefixexp/man/man.1" | |
4811 | : If prefix contains 'perl' then we want to keep the man pages | |
4812 | : under the prefix directory. Otherwise, look in a variety of | |
4813 | : other possible places. This is debatable, but probably a | |
4814 | : good compromise. Well, apparently not. | |
4815 | : Experience has shown people expect man1dir to be under prefix, | |
4816 | : so we now always put it there. Users who want other behavior | |
4817 | : can answer interactively or use a command line option. | |
4818 | : Does user have System V-style man paths. | |
4819 | case "$sysman" in | |
4820 | */?_man*) dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;; | |
4821 | *) dflt=`./loc . $prefixexp/man/man1 $lookpath` ;; | |
4822 | esac | |
4823 | set dflt | |
4824 | eval $prefixup | |
4825 | ;; | |
4826 | *) dflt="$man1dir" | |
4827 | ;; | |
4828 | esac | |
4829 | echo " " | |
4830 | fn=dn+~ | |
4831 | rp="Where do the main $spackage manual pages (source) go?" | |
4832 | . ./getfile | |
4833 | if $test "X$man1direxp" != "X$ansexp"; then | |
4834 | installman1dir='' | |
4835 | fi | |
4836 | man1dir="$ans" | |
4837 | man1direxp="$ansexp" | |
4838 | case "$man1dir" in | |
4839 | '') man1dir=' ' | |
4840 | installman1dir='';; | |
4841 | esac | |
4842 | if $afs; then | |
4843 | $cat <<EOM | |
4844 | ||
4845 | Since you are running AFS, I need to distinguish the directory in which | |
4846 | manual pages reside from the directory in which they are installed (and from | |
4847 | which they are presumably copied to the former directory by occult means). | |
4848 | ||
4849 | EOM | |
4850 | case "$installman1dir" in | |
4851 | '') dflt=`echo $man1direxp | sed 's#^/afs/#/afs/.#'`;; | |
4852 | *) dflt="$installman1dir";; | |
4853 | esac | |
4854 | fn=de~ | |
4855 | rp='Where will man pages be installed?' | |
4856 | . ./getfile | |
4857 | installman1dir="$ans" | |
4858 | else | |
4859 | installman1dir="$man1direxp" | |
4860 | fi | |
4861 | ||
4862 | : What suffix to use on installed man pages | |
4863 | ||
4864 | case "$man1dir" in | |
4865 | ' ') | |
4866 | man1ext='0' | |
4867 | ;; | |
4868 | *) | |
4869 | rp="What suffix should be used for the main $spackage man pages?" | |
4870 | case "$man1ext" in | |
4871 | '') case "$man1dir" in | |
4872 | *1) dflt=1 ;; | |
4873 | *1p) dflt=1p ;; | |
4874 | *1pm) dflt=1pm ;; | |
4875 | *l) dflt=l;; | |
4876 | *n) dflt=n;; | |
4877 | *o) dflt=o;; | |
4878 | *p) dflt=p;; | |
4879 | *C) dflt=C;; | |
4880 | *L) dflt=L;; | |
4881 | *L1) dflt=L1;; | |
4882 | *) dflt=1;; | |
4883 | esac | |
4884 | ;; | |
4885 | *) dflt="$man1ext";; | |
4886 | esac | |
4887 | . ./myread | |
4888 | man1ext="$ans" | |
4889 | ;; | |
4890 | esac | |
4891 | ||
4892 | : see if we can have long filenames | |
4893 | echo " " | |
4894 | rmlist="$rmlist /tmp/cf$$" | |
4895 | $test -d /tmp/cf$$ || mkdir /tmp/cf$$ | |
4896 | first=123456789abcdef | |
4897 | second=/tmp/cf$$/$first | |
4898 | $rm -f $first $second | |
4899 | if (echo hi >$first) 2>/dev/null; then | |
4900 | if $test -f 123456789abcde; then | |
4901 | echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4 | |
4902 | val="$undef" | |
4903 | else | |
4904 | if (echo hi >$second) 2>/dev/null; then | |
4905 | if $test -f /tmp/cf$$/123456789abcde; then | |
4906 | $cat <<'EOM' | |
4907 | That's peculiar... You can have filenames longer than 14 characters, but only | |
4908 | on some of the filesystems. Maybe you are using NFS. Anyway, to avoid problems | |
4909 | I shall consider your system cannot support long filenames at all. | |
4910 | EOM | |
4911 | val="$undef" | |
4912 | else | |
4913 | echo 'You can have filenames longer than 14 characters.' >&4 | |
4914 | val="$define" | |
4915 | fi | |
4916 | else | |
4917 | $cat <<'EOM' | |
4918 | How confusing! Some of your filesystems are sane enough to allow filenames | |
4919 | longer than 14 characters but some others like /tmp can't even think about them. | |
4920 | So, for now on, I shall assume your kernel does not allow them at all. | |
4921 | EOM | |
4922 | val="$undef" | |
4923 | fi | |
4924 | fi | |
4925 | else | |
4926 | $cat <<'EOM' | |
4927 | You can't have filenames longer than 14 chars. You can't even think about them! | |
4928 | EOM | |
4929 | val="$undef" | |
4930 | fi | |
4931 | set d_flexfnam | |
4932 | eval $setvar | |
4933 | $rm -rf /tmp/cf$$ 123456789abcde* | |
4934 | ||
4935 | : determine where library module manual pages go | |
4936 | set man3dir man3dir none | |
4937 | eval $prefixit | |
4938 | $cat <<EOM | |
4939 | ||
4940 | $spackage has manual pages for many of the library modules. | |
4941 | EOM | |
4942 | ||
4943 | case "$nroff" in | |
4944 | nroff) | |
4945 | $cat <<'EOM' | |
4946 | However, you don't have nroff, so they're probably useless to you. | |
4947 | You can use the supplied perldoc script instead. | |
4948 | EOM | |
4949 | case "$man3dir" in | |
4950 | '') man3dir="none";; | |
4951 | esac;; | |
4952 | esac | |
4953 | ||
4954 | case "$d_flexfnam" in | |
4955 | undef) | |
4956 | $cat <<'EOM' | |
4957 | However, your system can't handle the long file names like File::Basename.3. | |
4958 | You can use the supplied perldoc script instead. | |
4959 | EOM | |
4960 | case "$man3dir" in | |
4961 | '') man3dir="none";; | |
4962 | esac;; | |
4963 | esac | |
4964 | ||
4965 | echo "If you don't want the manual sources installed, answer 'none'." | |
4966 | : We dont use /usr/local/man/man3 because some man programs will | |
4967 | : only show the /usr/local/man/man3 contents, and not the system ones, | |
4968 | : thus man less will show the perl module less.pm, but not the system | |
4969 | : less command. We might also conflict with TCL man pages. | |
4970 | : However, something like /opt/perl/man/man3 is fine. | |
4971 | case "$man3dir" in | |
4972 | '') case "$prefix" in | |
4973 | *perl*) dflt=`echo $man1dir | | |
4974 | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'` ;; | |
4975 | *) dflt="$privlib/man/man3" ;; | |
4976 | esac | |
4977 | ;; | |
4978 | ' ') dflt=none;; | |
4979 | *) dflt="$man3dir" ;; | |
4980 | esac | |
4981 | echo " " | |
4982 | ||
4983 | fn=dn+~ | |
4984 | rp="Where do the $spackage library man pages (source) go?" | |
4985 | . ./getfile | |
4986 | if test "X$man3direxp" != "X$ansexp"; then | |
4987 | installman3dir='' | |
4988 | fi | |
4989 | ||
4990 | man3dir="$ans" | |
4991 | man3direxp="$ansexp" | |
4992 | case "$man3dir" in | |
4993 | '') man3dir=' ' | |
4994 | installman3dir='';; | |
4995 | esac | |
4996 | if $afs; then | |
4997 | $cat <<EOM | |
4998 | ||
4999 | Since you are running AFS, I need to distinguish the directory in which | |
5000 | manual pages reside from the directory in which they are installed (and from | |
5001 | which they are presumably copied to the former directory by occult means). | |
5002 | ||
5003 | EOM | |
5004 | case "$installman3dir" in | |
5005 | '') dflt=`echo $man3direxp | sed 's#^/afs/#/afs/.#'`;; | |
5006 | *) dflt="$installman3dir";; | |
5007 | esac | |
5008 | fn=de~ | |
5009 | rp='Where will man pages be installed?' | |
5010 | . ./getfile | |
5011 | installman3dir="$ans" | |
5012 | else | |
5013 | installman3dir="$man3direxp" | |
5014 | fi | |
5015 | ||
5016 | : What suffix to use on installed man pages | |
5017 | ||
5018 | case "$man3dir" in | |
5019 | ' ') | |
5020 | man3ext='0' | |
5021 | ;; | |
5022 | *) | |
5023 | rp="What suffix should be used for the $spackage library man pages?" | |
5024 | case "$man3ext" in | |
5025 | '') case "$man3dir" in | |
5026 | *3) dflt=3 ;; | |
5027 | *3p) dflt=3p ;; | |
5028 | *3pm) dflt=3pm ;; | |
5029 | *l) dflt=l;; | |
5030 | *n) dflt=n;; | |
5031 | *o) dflt=o;; | |
5032 | *p) dflt=p;; | |
5033 | *C) dflt=C;; | |
5034 | *L) dflt=L;; | |
5035 | *L3) dflt=L3;; | |
5036 | *) dflt=3;; | |
5037 | esac | |
5038 | ;; | |
5039 | *) dflt="$man3ext";; | |
5040 | esac | |
5041 | . ./myread | |
5042 | man3ext="$ans" | |
5043 | ;; | |
5044 | esac | |
5045 | ||
5046 | : see if we have to deal with yellow pages, now NIS. | |
5047 | if $test -d /usr/etc/yp || $test -d /etc/yp; then | |
5048 | if $test -f /usr/etc/nibindd; then | |
5049 | echo " " | |
5050 | echo "I'm fairly confident you're on a NeXT." | |
5051 | echo " " | |
5052 | rp='Do you get the hosts file via NetInfo?' | |
5053 | dflt=y | |
5054 | case "$hostcat" in | |
5055 | nidump*) ;; | |
5056 | '') ;; | |
5057 | *) dflt=n;; | |
5058 | esac | |
5059 | . ./myread | |
5060 | case "$ans" in | |
5061 | y*) hostcat='nidump hosts .';; | |
5062 | *) case "$hostcat" in | |
5063 | nidump*) hostcat='';; | |
5064 | esac | |
5065 | ;; | |
5066 | esac | |
5067 | fi | |
5068 | case "$hostcat" in | |
5069 | nidump*) ;; | |
5070 | *) | |
5071 | case "$hostcat" in | |
5072 | *ypcat*) dflt=y;; | |
5073 | '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then | |
5074 | dflt=y | |
5075 | else | |
5076 | dflt=n | |
5077 | fi;; | |
5078 | *) dflt=n;; | |
5079 | esac | |
5080 | echo " " | |
5081 | rp='Are you getting the hosts file via yellow pages?' | |
5082 | . ./myread | |
5083 | case "$ans" in | |
5084 | y*) hostcat='ypcat hosts';; | |
5085 | *) hostcat='cat /etc/hosts';; | |
5086 | esac | |
5087 | ;; | |
5088 | esac | |
5089 | fi | |
5090 | ||
5091 | : now get the host name | |
5092 | echo " " | |
5093 | echo "Figuring out host name..." >&4 | |
5094 | case "$myhostname" in | |
5095 | '') cont=true | |
5096 | echo 'Maybe "hostname" will work...' | |
5097 | if tans=`sh -c hostname 2>&1` ; then | |
5098 | myhostname=$tans | |
5099 | phostname=hostname | |
5100 | cont='' | |
5101 | fi | |
5102 | ;; | |
5103 | *) cont='';; | |
5104 | esac | |
5105 | if $test "$cont"; then | |
5106 | if ./xenix; then | |
5107 | echo 'Oh, dear. Maybe "/etc/systemid" is the key...' | |
5108 | if tans=`cat /etc/systemid 2>&1` ; then | |
5109 | myhostname=$tans | |
5110 | phostname='cat /etc/systemid' | |
5111 | echo "Whadyaknow. Xenix always was a bit strange..." | |
5112 | cont='' | |
5113 | fi | |
5114 | elif $test -r /etc/systemid; then | |
5115 | echo "(What is a non-Xenix system doing with /etc/systemid?)" | |
5116 | fi | |
5117 | fi | |
5118 | if $test "$cont"; then | |
5119 | echo 'No, maybe "uuname -l" will work...' | |
5120 | if tans=`sh -c 'uuname -l' 2>&1` ; then | |
5121 | myhostname=$tans | |
5122 | phostname='uuname -l' | |
5123 | else | |
5124 | echo 'Strange. Maybe "uname -n" will work...' | |
5125 | if tans=`sh -c 'uname -n' 2>&1` ; then | |
5126 | myhostname=$tans | |
5127 | phostname='uname -n' | |
5128 | else | |
5129 | echo 'Oh well, maybe I can mine it out of whoami.h...' | |
5130 | if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then | |
5131 | myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'` | |
5132 | phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h" | |
5133 | else | |
5134 | case "$myhostname" in | |
5135 | '') echo "Does this machine have an identity crisis or something?" | |
5136 | phostname='';; | |
5137 | *) | |
5138 | echo "Well, you said $myhostname before..." | |
5139 | phostname='echo $myhostname';; | |
5140 | esac | |
5141 | fi | |
5142 | fi | |
5143 | fi | |
5144 | fi | |
5145 | : you do not want to know about this | |
5146 | set $myhostname | |
5147 | myhostname=$1 | |
5148 | ||
5149 | : verify guess | |
5150 | if $test "$myhostname" ; then | |
5151 | dflt=y | |
5152 | rp='Your host name appears to be "'$myhostname'".'" Right?" | |
5153 | . ./myread | |
5154 | case "$ans" in | |
5155 | y*) ;; | |
5156 | *) myhostname='';; | |
5157 | esac | |
5158 | fi | |
5159 | ||
5160 | : bad guess or no guess | |
5161 | while $test "X$myhostname" = X ; do | |
5162 | dflt='' | |
5163 | rp="Please type the (one word) name of your host:" | |
5164 | . ./myread | |
5165 | myhostname="$ans" | |
5166 | done | |
5167 | ||
5168 | : translate upper to lower if necessary | |
5169 | case "$myhostname" in | |
5170 | *[A-Z]*) | |
5171 | echo "(Normalizing case in your host name)" | |
5172 | myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'` | |
5173 | ;; | |
5174 | esac | |
5175 | ||
5176 | case "$myhostname" in | |
5177 | *.*) | |
5178 | dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"` | |
5179 | myhostname=`expr "X$myhostname" : "X\([^.]*\)\."` | |
5180 | echo "(Trimming domain name from host name--host name is now $myhostname)" | |
5181 | ;; | |
5182 | *) case "$mydomain" in | |
5183 | '') | |
5184 | { | |
5185 | : If we use NIS, try ypmatch. | |
5186 | : Is there some reason why this was not done before? | |
5187 | test "X$hostcat" = "Xypcat hosts" && | |
5188 | ypmatch "$myhostname" hosts 2>/dev/null |\ | |
5189 | $sed -e 's/[ ]*#.*//; s/$/ /' > hosts && \ | |
5190 | $test -s hosts | |
5191 | } || { | |
5192 | : Extract only the relevant hosts, reducing file size, | |
5193 | : remove comments, insert trailing space for later use. | |
5194 | $hostcat | $sed -n -e "s/[ ]*#.*//; s/\$/ / | |
5195 | /[ ]$myhostname[ . ]/p" > hosts | |
5196 | } | |
5197 | tmp_re="[ . ]" | |
5198 | $test x`$awk "/[0-9].*[ ]$myhostname$tmp_re/ { sum++ } | |
5199 | END { print sum }" hosts` = x1 || tmp_re="[ ]" | |
5200 | dflt=.`$awk "/[0-9].*[ ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \ | |
5201 | hosts | $sort | $uniq | \ | |
5202 | $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"` | |
5203 | case `$echo X$dflt` in | |
5204 | X*\ *) echo "(Several hosts in /etc/hosts matched hostname)" | |
5205 | dflt=. | |
5206 | ;; | |
5207 | X.) echo "(You do not have fully-qualified names in /etc/hosts)" | |
5208 | ;; | |
5209 | esac | |
5210 | case "$dflt" in | |
5211 | .) | |
5212 | tans=`./loc resolv.conf X /etc /usr/etc` | |
5213 | if $test -f "$tans"; then | |
5214 | echo "(Attempting domain name extraction from $tans)" | |
5215 | : Why was there an Egrep here, when Sed works? | |
5216 | : Look for either a search or a domain directive. | |
a6006777 | 5217 | dflt=.`$sed -n -e 's/ / /g' \ |
28757baa | 5218 | -e 's/^search *\([^ ]*\).*/\1/p' $tans \ |
a6006777 | 5219 | | ./tr '[A-Z]' '[a-z]' 2>/dev/null` |
2afac517 | 5220 | case "$dflt" in |
a6006777 | 5221 | .) dflt=.`$sed -n -e 's/ / /g' \ |
28757baa | 5222 | -e 's/^domain *\([^ ]*\).*/\1/p' $tans \ |
a6006777 | 5223 | | ./tr '[A-Z]' '[a-z]' 2>/dev/null` |
774d564b | 5224 | ;; |
2afac517 | 5225 | esac |
5226 | fi | |
5227 | ;; | |
5228 | esac | |
5229 | case "$dflt" in | |
5230 | .) echo "(No help from resolv.conf either -- attempting clever guess)" | |
5231 | dflt=.`sh -c domainname 2>/dev/null` | |
5232 | case "$dflt" in | |
5233 | '') dflt='.';; | |
5234 | .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;; | |
5235 | esac | |
5236 | ;; | |
5237 | esac | |
5238 | case "$dflt" in | |
5239 | .) echo "(Lost all hope -- silly guess then)" | |
5240 | dflt='.uucp' | |
5241 | ;; | |
5242 | esac | |
5243 | $rm -f hosts | |
5244 | ;; | |
5245 | *) dflt="$mydomain";; | |
5246 | esac;; | |
5247 | esac | |
5248 | echo " " | |
5249 | rp="What is your domain name?" | |
5250 | . ./myread | |
5251 | tans="$ans" | |
5252 | case "$ans" in | |
5253 | '') ;; | |
5254 | .*) ;; | |
5255 | *) tans=".$tans";; | |
5256 | esac | |
5257 | mydomain="$tans" | |
5258 | ||
5259 | : translate upper to lower if necessary | |
5260 | case "$mydomain" in | |
5261 | *[A-Z]*) | |
5262 | echo "(Normalizing case in your domain name)" | |
5263 | mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'` | |
5264 | ;; | |
5265 | esac | |
5266 | ||
5267 | : a little sanity check here | |
5268 | case "$phostname" in | |
5269 | '') ;; | |
5270 | *) | |
5271 | case `$phostname | ./tr '[A-Z]' '[a-z]'` in | |
5272 | $myhostname$mydomain|$myhostname) ;; | |
5273 | *) | |
5274 | case "$phostname" in | |
5275 | sed*) | |
5276 | echo "(That doesn't agree with your whoami.h file, by the way.)" | |
5277 | ;; | |
5278 | *) | |
5279 | echo "(That doesn't agree with your $phostname command, by the way.)" | |
5280 | ;; | |
5281 | esac | |
5282 | ;; | |
5283 | esac | |
5284 | ;; | |
5285 | esac | |
5286 | ||
5287 | $cat <<EOM | |
5288 | ||
5289 | I need to get your e-mail address in Internet format if possible, i.e. | |
5290 | something like user@host.domain. Please answer accurately since I have | |
5291 | no easy means to double check it. The default value provided below | |
5292 | is most probably close to the reality but may not be valid from outside | |
5293 | your organization... | |
5294 | ||
5295 | EOM | |
5296 | cont=x | |
5297 | while test "$cont"; do | |
5298 | case "$cf_email" in | |
5299 | '') dflt="$cf_by@$myhostname$mydomain";; | |
5300 | *) dflt="$cf_email";; | |
5301 | esac | |
5302 | rp='What is your e-mail address?' | |
5303 | . ./myread | |
5304 | cf_email="$ans" | |
5305 | case "$cf_email" in | |
5306 | *@*.*) cont='' ;; | |
5307 | *) | |
5308 | rp='Address does not look like an Internet one. Use it anyway?' | |
5309 | case "$fastread" in | |
5310 | yes) dflt=y ;; | |
5311 | *) dflt=n ;; | |
5312 | esac | |
5313 | . ./myread | |
5314 | case "$ans" in | |
5315 | y*) cont='' ;; | |
5316 | *) echo " " ;; | |
5317 | esac | |
5318 | ;; | |
5319 | esac | |
5320 | done | |
5321 | ||
5322 | $cat <<EOM | |
5323 | ||
5324 | If you or somebody else will be maintaining perl at your site, please | |
5325 | fill in the correct e-mail address here so that they may be contacted | |
5326 | if necessary. Currently, the "perlbug" program included with perl | |
5327 | will send mail to this address in addition to perlbug@perl.com. You may | |
5328 | enter "none" for no administrator. | |
5329 | ||
5330 | EOM | |
5331 | case "$perladmin" in | |
5332 | '') dflt="$cf_email";; | |
5333 | *) dflt="$perladmin";; | |
5334 | esac | |
5335 | rp='Perl administrator e-mail address' | |
5336 | . ./myread | |
5337 | perladmin="$ans" | |
5338 | ||
5f05dabc | 5339 | : figure out how to guarantee perl startup |
5340 | case "$startperl" in | |
5341 | '') | |
5342 | case "$sharpbang" in | |
5343 | *!) | |
5344 | $cat <<EOH | |
5345 | ||
5346 | I can use the #! construct to start perl on your system. This will | |
5347 | make startup of perl scripts faster, but may cause problems if you | |
5348 | want to share those scripts and perl is not in a standard place | |
5349 | ($binexp/perl) on all your platforms. The alternative is to force | |
5350 | a shell by starting the script with a single ':' character. | |
5351 | ||
5352 | EOH | |
5353 | dflt="$binexp/perl" | |
5354 | rp='What shall I put after the #! to start up perl ("none" to not use #!)?' | |
5355 | . ./myread | |
5356 | case "$ans" in | |
68dc0745 | 5357 | none) startperl=": # use perl";; |
5358 | *) startperl="#!$ans" | |
3e3baf6d | 5359 | if $test 30 -lt `echo "$ans" | wc -c`; then |
68dc0745 | 5360 | $cat >&4 <<EOM |
5361 | ||
5362 | WARNING: Some systems limit the #! command to 32 characters. | |
5363 | If you experience difficulty running Perl scripts with #!, try | |
5364 | installing Perl in a directory with a shorter pathname. | |
5365 | ||
5366 | EOM | |
5367 | fi ;; | |
5f05dabc | 5368 | esac |
5369 | ;; | |
5370 | *) startperl=": # use perl" | |
5371 | ;; | |
5372 | esac | |
5373 | ;; | |
5374 | esac | |
5375 | echo "I'll use $startperl to start perl scripts." | |
5376 | ||
5377 | : figure best path for perl in scripts | |
5378 | case "$perlpath" in | |
5379 | '') | |
5380 | perlpath="$binexp/perl" | |
5381 | case "$startperl" in | |
5382 | *!*) ;; | |
5383 | *) | |
5384 | $cat <<EOH | |
5385 | ||
5386 | I will use the "eval 'exec'" idiom to start Perl on your system. | |
5387 | I can use the full path of your Perl binary for this purpose, but | |
5388 | doing so may cause problems if you want to share those scripts and | |
5389 | Perl is not always in a standard place ($binexp/perl). | |
5390 | ||
5391 | EOH | |
5392 | dflt="$binexp/perl" | |
5393 | rp="What path shall I use in \"eval 'exec'\"?" | |
5394 | . ./myread | |
5395 | perlpath="$ans" | |
5396 | ;; | |
5397 | esac | |
5398 | ;; | |
5399 | esac | |
5400 | case "$startperl" in | |
5401 | *!*) ;; | |
5402 | *) echo "I'll use $perlpath in \"eval 'exec'\"" ;; | |
5403 | esac | |
5404 | ||
2afac517 | 5405 | : determine where public executable scripts go |
5406 | set scriptdir scriptdir | |
5407 | eval $prefixit | |
5408 | case "$scriptdir" in | |
5409 | '') | |
5410 | dflt="$bin" | |
5411 | : guess some guesses | |
5412 | $test -d /usr/share/scripts && dflt=/usr/share/scripts | |
5413 | $test -d /usr/share/bin && dflt=/usr/share/bin | |
5414 | $test -d /usr/local/script && dflt=/usr/local/script | |
5415 | $test -d $prefixexp/script && dflt=$prefixexp/script | |
5416 | set dflt | |
5417 | eval $prefixup | |
5418 | ;; | |
5419 | *) dflt="$scriptdir" | |
5420 | ;; | |
5421 | esac | |
5422 | $cat <<EOM | |
5423 | ||
5424 | Some installations have a separate directory just for executable scripts so | |
5425 | that they can mount it across multiple architectures but keep the scripts in | |
5426 | one spot. You might, for example, have a subdirectory of /usr/share for this. | |
5427 | Or you might just lump your scripts in with all your other executables. | |
5428 | ||
5429 | EOM | |
5430 | fn=d~ | |
5431 | rp='Where do you keep publicly executable scripts?' | |
5432 | . ./getfile | |
5433 | if $test "X$ansexp" != "X$scriptdirexp"; then | |
5434 | installscript='' | |
5435 | fi | |
5436 | scriptdir="$ans" | |
5437 | scriptdirexp="$ansexp" | |
5438 | if $afs; then | |
5439 | $cat <<EOM | |
5440 | ||
5441 | Since you are running AFS, I need to distinguish the directory in which | |
5442 | scripts reside from the directory in which they are installed (and from | |
5443 | which they are presumably copied to the former directory by occult means). | |
5444 | ||
5445 | EOM | |
5446 | case "$installscript" in | |
5447 | '') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;; | |
5448 | *) dflt="$installscript";; | |
5449 | esac | |
5450 | fn=de~ | |
5451 | rp='Where will public scripts be installed?' | |
5452 | . ./getfile | |
5453 | installscript="$ans" | |
5454 | else | |
5455 | installscript="$scriptdirexp" | |
2304df62 | 5456 | fi |
2afac517 | 5457 | |
2afac517 | 5458 | cat <<EOM |
5459 | ||
5460 | Previous version of $package used the standard IO mechanisms as defined in | |
5461 | <stdio.h>. Versions 5.003_02 and later of perl allow alternate IO | |
5462 | mechanisms via a "PerlIO" abstraction, but the stdio mechanism is still | |
5463 | the default and is the only supported mechanism. This abstraction | |
5464 | layer can use AT&T's sfio (if you already have sfio installed) or | |
5465 | fall back on standard IO. This PerlIO abstraction layer is | |
5466 | experimental and may cause problems with some extension modules. | |
5467 | ||
5468 | If this doesn't make any sense to you, just accept the default 'n'. | |
5469 | EOM | |
5470 | case "$useperlio" in | |
5471 | $define|true|[yY]*) dflt='y';; | |
5472 | *) dflt='n';; | |
5473 | esac | |
5474 | rp='Use the experimental PerlIO abstraction layer?' | |
5475 | . ./myread | |
5476 | case "$ans" in | |
5477 | y|Y) | |
5478 | val="$define" | |
5479 | ;; | |
5480 | *) | |
5481 | echo "Ok, doing things the stdio way" | |
5482 | val="$undef" | |
5483 | ;; | |
5484 | esac | |
5485 | set useperlio | |
5486 | eval $setvar | |
2304df62 | 5487 | |
8e07c86e AD |
5488 | : Check how to convert floats to strings. |
5489 | echo " " | |
5490 | echo "Checking for an efficient way to convert floats to strings." | |
5491 | $cat >try.c <<'EOP' | |
5492 | #ifdef TRY_gconvert | |
5493 | #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b)) | |
8ff267be | 5494 | char *myname = "gconvert"; |
8e07c86e AD |
5495 | #endif |
5496 | #ifdef TRY_gcvt | |
5497 | #define Gconvert(x,n,t,b) gcvt((x),(n),(b)) | |
8ff267be | 5498 | char *myname = "gcvt"; |
8e07c86e AD |
5499 | #endif |
5500 | #ifdef TRY_sprintf | |
5501 | #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x)) | |
8ff267be | 5502 | char *myname = "sprintf"; |
8e07c86e | 5503 | #endif |
8ff267be | 5504 | |
5505 | #include <stdio.h> | |
5506 | ||
5507 | int | |
5508 | checkit(expect, got) | |
5509 | char *expect; | |
5510 | char *got; | |
5511 | { | |
5512 | if (strcmp(expect, got)) { | |
5513 | printf("%s oddity: Expected %s, got %s\n", | |
5514 | myname, expect, got); | |
5515 | exit(1); | |
5516 | } | |
5517 | } | |
5518 | ||
5519 | int | |
5520 | main() | |
5521 | { | |
ecfc5424 | 5522 | char buf[64]; |
8ff267be | 5523 | buf[63] = '\0'; |
5524 | ||
5525 | /* This must be 1st test on (which?) platform */ | |
5526 | /* Alan Burlison <AlanBurlsin@unn.unisys.com> */ | |
5527 | Gconvert(0.1, 8, 0, buf); | |
5528 | checkit("0.1", buf); | |
5529 | ||
8e07c86e | 5530 | Gconvert(1.0, 8, 0, buf); |
8ff267be | 5531 | checkit("1", buf); |
5532 | ||
8e07c86e | 5533 | Gconvert(0.0, 8, 0, buf); |
8ff267be | 5534 | checkit("0", buf); |
5535 | ||
8e07c86e | 5536 | Gconvert(-1.0, 8, 0, buf); |
8ff267be | 5537 | checkit("-1", buf); |
5538 | ||
5539 | /* Some Linux gcvt's give 1.e+5 here. */ | |
5540 | Gconvert(100000.0, 8, 0, buf); | |
5541 | checkit("100000", buf); | |
5542 | ||
5543 | /* Some Linux gcvt's give -1.e+5 here. */ | |
5544 | Gconvert(-100000.0, 8, 0, buf); | |
5545 | checkit("-100000", buf); | |
5546 | ||
ecfc5424 | 5547 | exit(0); |
a0d0e21e LW |
5548 | } |
5549 | EOP | |
8e07c86e AD |
5550 | case "$d_Gconvert" in |
5551 | gconvert*) xxx_list='gconvert gcvt sprintf' ;; | |
5552 | gcvt*) xxx_list='gcvt gconvert sprintf' ;; | |
5553 | sprintf*) xxx_list='sprintf gconvert gcvt' ;; | |
5554 | *) xxx_list='gconvert gcvt sprintf' ;; | |
5555 | esac | |
5556 | ||
5557 | for xxx_convert in $xxx_list; do | |
5558 | echo "Trying $xxx_convert" | |
5559 | $rm -f try try.o | |
5560 | if $cc $ccflags -DTRY_$xxx_convert $ldflags -o try \ | |
5561 | try.c $libs > /dev/null 2>&1 ; then | |
5562 | echo "$xxx_convert" found. >&4 | |
5563 | if ./try; then | |
8e07c86e AD |
5564 | echo "I'll use $xxx_convert to convert floats into a string." >&4 |
5565 | break; | |
2304df62 | 5566 | else |
8ff267be | 5567 | echo "...But $xxx_convert didn't work as I expected." |
2304df62 | 5568 | fi |
8e07c86e AD |
5569 | else |
5570 | echo "$xxx_convert NOT found." >&4 | |
5571 | fi | |
5572 | done | |
5573 | ||
5574 | case "$xxx_convert" in | |
5575 | gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;; | |
5576 | gcvt) d_Gconvert='gcvt((x),(n),(b))' ;; | |
5577 | *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;; | |
2304df62 AD |
5578 | esac |
5579 | ||
a0d0e21e LW |
5580 | : Initialize h_fcntl |
5581 | h_fcntl=false | |
5582 | ||
5583 | : Initialize h_sysfile | |
5584 | h_sysfile=false | |
2304df62 | 5585 | |
2304df62 AD |
5586 | : access call always available on UNIX |
5587 | set access d_access | |
5588 | eval $inlibc | |
5589 | ||
5590 | : locate the flags for 'access()' | |
5591 | case "$d_access" in | |
5592 | "$define") | |
5593 | echo " " | |
5594 | $cat >access.c <<'EOCP' | |
5595 | #include <sys/types.h> | |
5596 | #ifdef I_FCNTL | |
5597 | #include <fcntl.h> | |
5598 | #endif | |
5599 | #ifdef I_SYS_FILE | |
5600 | #include <sys/file.h> | |
5601 | #endif | |
5602 | #ifdef I_UNISTD | |
5603 | #include <unistd.h> | |
5604 | #endif | |
5605 | main() { | |
5606 | exit(R_OK); | |
5607 | } | |
8e07c86e AD |
5608 | EOCP |
5609 | : check sys/file.h first, no particular reason here | |
5610 | if $test `./findhdr sys/file.h` && \ | |
5611 | $cc $cppflags -DI_SYS_FILE access.c -o access >/dev/null 2>&1 ; then | |
5612 | h_sysfile=true; | |
5613 | echo "<sys/file.h> defines the *_OK access constants." >&4 | |
5614 | elif $test `./findhdr fcntl.h` && \ | |
5615 | $cc $cppflags -DI_FCNTL access.c -o access >/dev/null 2>&1 ; then | |
5616 | h_fcntl=true; | |
5617 | echo "<fcntl.h> defines the *_OK access constants." >&4 | |
5618 | elif $test `./findhdr unistd.h` && \ | |
5619 | $cc $cppflags -DI_UNISTD access.c -o access >/dev/null 2>&1 ; then | |
5620 | echo "<unistd.h> defines the *_OK access constants." >&4 | |
5621 | else | |
5622 | echo "I can't find the four *_OK access constants--I'll use mine." >&4 | |
5623 | fi | |
5624 | ;; | |
5625 | esac | |
5626 | $rm -f access* | |
a0d0e21e | 5627 | |
8e07c86e AD |
5628 | : see if alarm exists |
5629 | set alarm d_alarm | |
5630 | eval $inlibc | |
2304df62 | 5631 | |
ecfc5424 | 5632 | : Look for GNU-cc style attribute checking |
2304df62 | 5633 | echo " " |
a0d0e21e LW |
5634 | echo "Checking whether your compiler can handle __attribute__ ..." >&4 |
5635 | $cat >attrib.c <<'EOCP' | |
1aef975c | 5636 | #include <stdio.h> |
ecfc5424 | 5637 | void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn)); |
a0d0e21e LW |
5638 | EOCP |
5639 | if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then | |
5640 | if $contains 'warning' attrib.out >/dev/null 2>&1; then | |
ecfc5424 | 5641 | echo "Your C compiler doesn't fully support __attribute__." |
a0d0e21e LW |
5642 | val="$undef" |
5643 | else | |
ecfc5424 | 5644 | echo "Your C compiler supports __attribute__." |
a0d0e21e LW |
5645 | val="$define" |
5646 | fi | |
5647 | else | |
ecfc5424 | 5648 | echo "Your C compiler doesn't seem to understand __attribute__ at all." |
a0d0e21e LW |
5649 | val="$undef" |
5650 | fi | |
ecfc5424 | 5651 | set d_attribut |
a0d0e21e LW |
5652 | eval $setvar |
5653 | $rm -f attrib* | |
5654 | ||
5655 | : see if bcmp exists | |
5656 | set bcmp d_bcmp | |
5657 | eval $inlibc | |
5658 | ||
5659 | : see if bcopy exists | |
5660 | set bcopy d_bcopy | |
5661 | eval $inlibc | |
5662 | ||
2afac517 | 5663 | : see if this is a unistd.h system |
5664 | set unistd.h i_unistd | |
5665 | eval $inhdr | |
5666 | ||
5667 | : see if getpgrp exists | |
5668 | set getpgrp d_getpgrp | |
5669 | eval $inlibc | |
5670 | ||
5671 | echo "Checking to see which flavor of getpgrp is in use . . . " | |
5672 | case "$d_getpgrp" in | |
5673 | "$define") | |
5674 | echo " " | |
5675 | $cat >set.c <<EOP | |
5676 | #$i_unistd I_UNISTD | |
5677 | #include <sys/types.h> | |
5678 | #ifdef I_UNISTD | |
5679 | # include <unistd.h> | |
5680 | #endif | |
5681 | main() | |
5682 | { | |
5683 | if (getuid() == 0) { | |
5684 | printf("(I see you are running Configure as super-user...)\n"); | |
5685 | setuid(1); | |
5686 | } | |
5687 | #ifdef TRY_BSD_PGRP | |
5688 | if (getpgrp(1) == 0) | |
5689 | exit(0); | |
5690 | #else | |
5691 | if (getpgrp() > 0) | |
5692 | exit(0); | |
5693 | #endif | |
5694 | exit(1); | |
5695 | } | |
5696 | EOP | |
5697 | if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then | |
5698 | echo "You have to use getpgrp(pid) instead of getpgrp()." >&4 | |
5699 | val="$define" | |
5700 | elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then | |
5701 | echo "You have to use getpgrp() instead of getpgrp(pid)." >&4 | |
5702 | val="$undef" | |
5703 | else | |
5704 | echo "I can't seem to compile and run the test program." | |
5705 | if ./usg; then | |
5706 | xxx="a USG one, i.e. you use getpgrp()." | |
5707 | else | |
5708 | # SVR4 systems can appear rather BSD-ish. | |
5709 | case "$i_unistd" in | |
5710 | $undef) | |
5711 | xxx="a BSD one, i.e. you use getpgrp(pid)." | |
5712 | val="$define" | |
5713 | ;; | |
5714 | $define) | |
5715 | xxx="probably a USG one, i.e. you use getpgrp()." | |
5716 | val="$undef" | |
5717 | ;; | |
5718 | esac | |
5719 | fi | |
5720 | echo "Assuming your getpgrp is $xxx" >&4 | |
5721 | fi | |
5722 | ;; | |
5723 | *) val="$undef";; | |
5724 | esac | |
5725 | set d_bsdgetpgrp | |
5726 | eval $setvar | |
5727 | $rm -f set set.c | |
5728 | ||
a0d0e21e LW |
5729 | : see if setpgrp exists |
5730 | set setpgrp d_setpgrp | |
5731 | eval $inlibc | |
5732 | ||
2afac517 | 5733 | echo "Checking to see which flavor of setpgrp is in use . . . " |
a0d0e21e LW |
5734 | case "$d_setpgrp" in |
5735 | "$define") | |
5736 | echo " " | |
5737 | $cat >set.c <<EOP | |
2afac517 | 5738 | #$i_unistd I_UNISTD |
5739 | #include <sys/types.h> | |
5740 | #ifdef I_UNISTD | |
5741 | # include <unistd.h> | |
5742 | #endif | |
a0d0e21e LW |
5743 | main() |
5744 | { | |
5745 | if (getuid() == 0) { | |
5746 | printf("(I see you are running Configure as super-user...)\n"); | |
5747 | setuid(1); | |
5748 | } | |
2afac517 | 5749 | #ifdef TRY_BSD_PGRP |
a0d0e21e | 5750 | if (-1 == setpgrp(1, 1)) |
2afac517 | 5751 | exit(0); |
5752 | #else | |
5753 | if (setpgrp() != -1) | |
5754 | exit(0); | |
5755 | #endif | |
5756 | exit(1); | |
a0d0e21e LW |
5757 | } |
5758 | EOP | |
2afac517 | 5759 | if $cc -DTRY_BSD_PGRP $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then |
5760 | echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4 | |
5761 | val="$define" | |
5762 | elif $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1 && ./set; then | |
5763 | echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4 | |
5764 | val="$undef" | |
a0d0e21e | 5765 | else |
2afac517 | 5766 | echo "I can't seem to compile and run the test program." |
ecfc5424 | 5767 | if ./usg; then |
2afac517 | 5768 | xxx="a USG one, i.e. you use setpgrp()." |
a0d0e21e | 5769 | else |
2afac517 | 5770 | # SVR4 systems can appear rather BSD-ish. |
5771 | case "$i_unistd" in | |
5772 | $undef) | |
5773 | xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)." | |
5774 | val="$define" | |
5775 | ;; | |
5776 | $define) | |
5777 | xxx="probably a USG one, i.e. you use setpgrp()." | |
5778 | val="$undef" | |
5779 | ;; | |
5780 | esac | |
a0d0e21e | 5781 | fi |
2afac517 | 5782 | echo "Assuming your setpgrp is $xxx" >&4 |
a0d0e21e LW |
5783 | fi |
5784 | ;; | |
5785 | *) val="$undef";; | |
5786 | esac | |
2afac517 | 5787 | set d_bsdsetpgrp |
a0d0e21e | 5788 | eval $setvar |
2afac517 | 5789 | d_bsdpgrp=$d_bsdsetpgrp |
a0d0e21e | 5790 | $rm -f set set.c |
a0d0e21e LW |
5791 | : see if bzero exists |
5792 | set bzero d_bzero | |
5793 | eval $inlibc | |
5794 | ||
24fef2a7 | 5795 | : check for lengths of integral types |
a0d0e21e LW |
5796 | echo " " |
5797 | case "$intsize" in | |
5798 | '') | |
5799 | echo "Checking to see how big your integers are..." >&4 | |
24fef2a7 | 5800 | $cat >intsize.c <<'EOCP' |
a0d0e21e LW |
5801 | #include <stdio.h> |
5802 | main() | |
5803 | { | |
24fef2a7 AD |
5804 | printf("intsize=%d;\n", sizeof(int)); |
5805 | printf("longsize=%d;\n", sizeof(long)); | |
5806 | printf("shortsize=%d;\n", sizeof(short)); | |
5807 | fflush(stdout); | |
8e07c86e | 5808 | exit(0); |
a0d0e21e LW |
5809 | } |
5810 | EOCP | |
24fef2a7 AD |
5811 | # If $libs contains -lsfio, and sfio is mis-configured, then it |
5812 | # sometimes (apparently) runs and exits with a 0 status, but with no | |
5813 | # output!. Thus we check with test -s whether we actually got any | |
5814 | # output. I think it has to do with sfio's use of _exit vs. exit, | |
5815 | # but I don't know for sure. --Andy Dougherty 1/27/97. | |
5816 | if $cc $optimize $ccflags $ldflags -o intsize intsize.c $libs >/dev/null 2>&1 && | |
5817 | ./intsize > intsize.out 2>/dev/null && test -s intsize.out ; then | |
5818 | eval `$cat intsize.out` | |
8e07c86e | 5819 | echo "Your integers are $intsize bytes long." |
24fef2a7 AD |
5820 | echo "Your long integers are $longsize bytes long." |
5821 | echo "Your short integers are $shortsize bytes long." | |
a0d0e21e | 5822 | else |
24fef2a7 AD |
5823 | $cat >&4 <<EOM |
5824 | ||
5825 | Help! I can't compile and run the intsize test program: please enlighten me! | |
5826 | (This is probably a misconfiguration in your system or libraries, and | |
5827 | you really ought to fix it. Still, I'll try anyway.) | |
5828 | ||
5829 | EOM | |
5830 | dflt=4 | |
8e07c86e AD |
5831 | rp="What is the size of an integer (in bytes)?" |
5832 | . ./myread | |
5833 | intsize="$ans" | |
24fef2a7 AD |
5834 | dflt=$intsize |
5835 | rp="What is the size of a long integer (in bytes)?" | |
5836 | . ./myread | |
5837 | longsize="$ans" | |
5838 | dflt=2 | |
5839 | rp="What is the size of a short integer (in bytes)?" | |
5840 | . ./myread | |
5841 | shortsize="$ans" | |
a0d0e21e LW |
5842 | fi |
5843 | ;; | |
a0d0e21e | 5844 | esac |
24fef2a7 | 5845 | $rm -f intsize intsize.[co] intsize.out |
a0d0e21e | 5846 | |
ecfc5424 | 5847 | : see if signal is declared as pointer to function returning int or void |
a0d0e21e | 5848 | echo " " |
ecfc5424 AD |
5849 | xxx=`./findhdr signal.h` |
5850 | $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null | |
5851 | if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then | |
5852 | echo "You have int (*signal())() instead of void." >&4 | |
5853 | val="$undef" | |
5854 | elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then | |
5855 | echo "You have void (*signal())() instead of int." >&4 | |
5856 | val="$define" | |
5857 | elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then | |
5858 | echo "You have int (*signal())() instead of void." >&4 | |
5859 | val="$undef" | |
a0d0e21e | 5860 | else |
ecfc5424 AD |
5861 | case "$d_voidsig" in |
5862 | '') | |
5863 | echo "I can't determine whether signal handler returns void or int..." >&4 | |
5864 | dflt=void | |
5865 | rp="What type does your signal handler return?" | |
5866 | . ./myread | |
5867 | case "$ans" in | |
5868 | v*) val="$define";; | |
5869 | *) val="$undef";; | |
5870 | esac;; | |
5871 | "$define") | |
5872 | echo "As you already told me, signal handler returns void." >&4;; | |
5873 | *) | |
5874 | echo "As you already told me, signal handler returns int." >&4;; | |
5875 | esac | |
5876 | fi | |
5877 | set d_voidsig | |
5878 | eval $setvar | |
5879 | case "$d_voidsig" in | |
5880 | "$define") signal_t="void";; | |
5881 | *) signal_t="int";; | |
5882 | esac | |
5883 | $rm -f $$.tmp | |
5884 | ||
5885 | : check for ability to cast large floats to 32-bit ints. | |
5886 | echo " " | |
5887 | echo 'Checking whether your C compiler can cast large floats to int32.' >&4 | |
5888 | if $test "$intsize" -eq 4; then | |
5889 | xxx=int | |
5890 | else | |
5891 | xxx=long | |
5892 | fi | |
5893 | $cat >try.c <<EOCP | |
5894 | #include <sys/types.h> | |
5895 | #include <signal.h> | |
5896 | $signal_t blech() { exit(3); } | |
5897 | main() | |
2304df62 | 5898 | { |
a0d0e21e | 5899 | $xxx i32; |
2304df62 AD |
5900 | double f; |
5901 | int result = 0; | |
5902 | signal(SIGFPE, blech); | |
5903 | ||
5904 | f = (double) 0x7fffffff; | |
5905 | f = 10 * f; | |
a0d0e21e | 5906 | i32 = ($xxx) f; |
2304df62 | 5907 | |
a0d0e21e | 5908 | if (i32 != ($xxx) f) |
2304df62 AD |
5909 | result |= 1; |
5910 | exit(result); | |
5911 | } | |
5912 | EOCP | |
5913 | if $cc -o try $ccflags try.c >/dev/null 2>&1; then | |
5914 | ./try | |
5915 | yyy=$? | |
5916 | else | |
a0d0e21e | 5917 | echo "(I can't seem to compile the test program--assuming it can't)" |
2304df62 AD |
5918 | yyy=1 |
5919 | fi | |
5920 | case "$yyy" in | |
5921 | 0) val="$define" | |
5922 | echo "Yup, it can." | |
5923 | ;; | |
5924 | *) val="$undef" | |
5925 | echo "Nope, it can't." | |
5926 | ;; | |
5927 | esac | |
5928 | set d_casti32 | |
5929 | eval $setvar | |
85e6fe83 | 5930 | $rm -f try try.* |
a0d0e21e | 5931 | |
2304df62 AD |
5932 | : check for ability to cast negative floats to unsigned |
5933 | echo " " | |
5934 | echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4 | |
ecfc5424 AD |
5935 | $cat >try.c <<EOCP |
5936 | #include <sys/types.h> | |
2304df62 | 5937 | #include <signal.h> |
232e078e AD |
5938 | $signal_t blech() { exit(7); } |
5939 | $signal_t blech_in_list() { exit(4); } | |
5940 | unsigned long dummy_long(p) unsigned long p; { return p; } | |
5941 | unsigned int dummy_int(p) unsigned int p; { return p; } | |
5942 | unsigned short dummy_short(p) unsigned short p; { return p; } | |
2304df62 AD |
5943 | main() |
5944 | { | |
232e078e | 5945 | double f = -123.; |
2304df62 AD |
5946 | unsigned long along; |
5947 | unsigned int aint; | |
5948 | unsigned short ashort; | |
5949 | int result = 0; | |
5950 | ||
5951 | signal(SIGFPE, blech); | |
5952 | along = (unsigned long)f; | |
5953 | aint = (unsigned int)f; | |
5954 | ashort = (unsigned short)f; | |
5955 | if (along != (unsigned long)-123) | |
5956 | result |= 1; | |
5957 | if (aint != (unsigned int)-123) | |
5958 | result |= 1; | |
5959 | if (ashort != (unsigned short)-123) | |
5960 | result |= 1; | |
5961 | f = (double)0x40000000; | |
5962 | f = f + f; | |
5963 | along = 0; | |
5964 | along = (unsigned long)f; | |
5965 | if (along != 0x80000000) | |
5966 | result |= 2; | |
5967 | f -= 1.; | |
5968 | along = 0; | |
5969 | along = (unsigned long)f; | |
5970 | if (along != 0x7fffffff) | |
5971 | result |= 1; | |
5972 | f += 2.; | |
5973 | along = 0; | |
5974 | along = (unsigned long)f; | |
5975 | if (along != 0x80000001) | |
5976 | result |= 2; | |
232e078e AD |
5977 | if (result) |
5978 | exit(result); | |
5979 | signal(SIGFPE, blech_in_list); | |
5980 | f = 123.; | |
5981 | along = dummy_long((unsigned long)f); | |
5982 | aint = dummy_int((unsigned int)f); | |
5983 | ashort = dummy_short((unsigned short)f); | |
5984 | if (along != (unsigned long)123) | |
5985 | result |= 4; | |
5986 | if (aint != (unsigned int)123) | |
5987 | result |= 4; | |
5988 | if (ashort != (unsigned short)123) | |
5989 | result |= 4; | |
2304df62 AD |
5990 | exit(result); |
5991 | ||
5992 | } | |
5993 | EOCP | |
5994 | if $cc -o try $ccflags try.c >/dev/null 2>&1; then | |
5995 | ./try | |
5996 | castflags=$? | |
5997 | else | |
ecfc5424 | 5998 | echo "(I can't seem to compile the test program--assuming it can't)" |
232e078e | 5999 | castflags=7 |
2304df62 AD |
6000 | fi |
6001 | case "$castflags" in | |
6002 | 0) val="$define" | |
6003 | echo "Yup, it can." | |
6004 | ;; | |
6005 | *) val="$undef" | |
6006 | echo "Nope, it can't." | |
6007 | ;; | |
6008 | esac | |
6009 | set d_castneg | |
6010 | eval $setvar | |
6011 | $rm -f try.* | |
6012 | ||
2304df62 AD |
6013 | : see if vprintf exists |
6014 | echo " " | |
6015 | if set vprintf val -f d_vprintf; eval $csym; $val; then | |
6016 | echo 'vprintf() found.' >&4 | |
6017 | val="$define" | |
6018 | $cat >vprintf.c <<'EOF' | |
6019 | #include <varargs.h> | |
6020 | ||
6021 | main() { xxx("foo"); } | |
6022 | ||
6023 | xxx(va_alist) | |
6024 | va_dcl | |
6025 | { | |
6026 | va_list args; | |
6027 | char buf[10]; | |
6028 | ||
6029 | va_start(args); | |
6030 | exit((unsigned long)vsprintf(buf,"%s",args) > 10L); | |
6031 | } | |
6032 | EOF | |
6033 | if $cc $ccflags vprintf.c -o vprintf >/dev/null 2>&1 && ./vprintf; then | |
6034 | echo "Your vsprintf() returns (int)." >&4 | |
6035 | val2="$undef" | |
6036 | else | |
6037 | echo "Your vsprintf() returns (char*)." >&4 | |
6038 | val2="$define" | |
6039 | fi | |
6040 | else | |
6041 | echo 'vprintf() NOT found.' >&4 | |
6042 | val="$undef" | |
6043 | val2="$undef" | |
6044 | fi | |
6045 | set d_vprintf | |
6046 | eval $setvar | |
6047 | val=$val2 | |
6048 | set d_charvspr | |
6049 | eval $setvar | |
6050 | ||
a0d0e21e LW |
6051 | : see if chown exists |
6052 | set chown d_chown | |
6053 | eval $inlibc | |
6054 | ||
6055 | : see if chroot exists | |
6056 | set chroot d_chroot | |
6057 | eval $inlibc | |
6058 | ||
2304df62 AD |
6059 | : see if chsize exists |
6060 | set chsize d_chsize | |
6061 | eval $inlibc | |
6062 | ||
6063 | : check for const keyword | |
6064 | echo " " | |
6065 | echo 'Checking to see if your C compiler knows about "const"...' >&4 | |
6066 | $cat >const.c <<'EOCP' | |
6067 | typedef struct spug { int drokk; } spug; | |
6068 | main() | |
6069 | { | |
6070 | const char *foo; | |
6071 | const spug y; | |
6072 | } | |
6073 | EOCP | |
6074 | if $cc -c $ccflags const.c >/dev/null 2>&1 ; then | |
6075 | val="$define" | |
6076 | echo "Yup, it does." | |
6077 | else | |
6078 | val="$undef" | |
6079 | echo "Nope, it doesn't." | |
6080 | fi | |
6081 | set d_const | |
6082 | eval $setvar | |
6083 | ||
6084 | : see if crypt exists | |
6085 | echo " " | |
6086 | if set crypt val -f d_crypt; eval $csym; $val; then | |
6087 | echo 'crypt() found.' >&4 | |
6088 | val="$define" | |
6089 | cryptlib='' | |
6090 | else | |
5f05dabc | 6091 | cryptlib=`./loc Slibcrypt$lib_ext "" $xlibpth` |
2304df62 | 6092 | if $test -z "$cryptlib"; then |
5f05dabc | 6093 | cryptlib=`./loc Mlibcrypt$lib_ext "" $xlibpth` |
2304df62 AD |
6094 | else |
6095 | cryptlib=-lcrypt | |
6096 | fi | |
6097 | if $test -z "$cryptlib"; then | |
5f05dabc | 6098 | cryptlib=`./loc Llibcrypt$lib_ext "" $xlibpth` |
2304df62 AD |
6099 | else |
6100 | cryptlib=-lcrypt | |
6101 | fi | |
6102 | if $test -z "$cryptlib"; then | |
5f05dabc | 6103 | cryptlib=`./loc libcrypt$lib_ext "" $libpth` |
2304df62 AD |
6104 | else |
6105 | cryptlib=-lcrypt | |
6106 | fi | |
6107 | if $test -z "$cryptlib"; then | |
6108 | echo 'crypt() NOT found.' >&4 | |
6109 | val="$undef" | |
6110 | else | |
6111 | val="$define" | |
6112 | fi | |
6113 | fi | |
6114 | set d_crypt | |
6115 | eval $setvar | |
6116 | ||
6117 | : get csh whereabouts | |
6118 | case "$csh" in | |
ba7b5225 | 6119 | 'csh') val="$undef" ;; |
ba7b5225 | 6120 | *) val="$define" ;; |
2304df62 AD |
6121 | esac |
6122 | set d_csh | |
6123 | eval $setvar | |
46fc3d4c | 6124 | : Respect a hint or command line value for full_csh. |
6125 | case "$full_csh" in | |
6126 | '') full_csh=$csh ;; | |
6127 | esac | |
2304df62 | 6128 | |
a0d0e21e LW |
6129 | : see if cuserid exists |
6130 | set cuserid d_cuserid | |
2304df62 AD |
6131 | eval $inlibc |
6132 | ||
a0d0e21e LW |
6133 | : see if this is a limits.h system |
6134 | set limits.h i_limits | |
85e6fe83 LW |
6135 | eval $inhdr |
6136 | ||
a0d0e21e LW |
6137 | : see if this is a float.h system |
6138 | set float.h i_float | |
6139 | eval $inhdr | |
6140 | ||
6141 | : See if number of significant digits in a double precision number is known | |
6142 | echo " " | |
6143 | $cat >dbl_dig.c <<EOM | |
6144 | #$i_limits I_LIMITS | |
6145 | #$i_float I_FLOAT | |
6146 | #ifdef I_LIMITS | |
6147 | #include <limits.h> | |
85e6fe83 | 6148 | #endif |
a0d0e21e LW |
6149 | #ifdef I_FLOAT |
6150 | #include <float.h> | |
6151 | #endif | |
6152 | #ifdef DBL_DIG | |
6153 | printf("Contains DBL_DIG"); | |
85e6fe83 | 6154 | #endif |
85e6fe83 | 6155 | EOM |
a0d0e21e LW |
6156 | $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null |
6157 | if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then | |
6158 | echo "DBL_DIG found." >&4 | |
6159 | val="$define" | |
2304df62 | 6160 | else |
a0d0e21e LW |
6161 | echo "DBL_DIG NOT found." >&4 |
6162 | val="$undef" | |
2304df62 | 6163 | fi |
a0d0e21e LW |
6164 | $rm -f dbl_dig.? |
6165 | set d_dbl_dig | |
2304df62 | 6166 | eval $setvar |
2304df62 | 6167 | |
a0d0e21e LW |
6168 | : see if difftime exists |
6169 | set difftime d_difftime | |
2304df62 AD |
6170 | eval $inlibc |
6171 | ||
a0d0e21e LW |
6172 | : see if this is a dirent system |
6173 | echo " " | |
6174 | if xinc=`./findhdr dirent.h`; $test "$xinc"; then | |
6175 | val="$define" | |
6176 | echo "<dirent.h> found." >&4 | |
6177 | else | |
6178 | val="$undef" | |
6179 | if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then | |
6180 | echo "<sys/dir.h> found." >&4 | |
6181 | echo " " | |
6182 | else | |
6183 | xinc=`./findhdr sys/ndir.h` | |
6184 | fi | |
6185 | echo "<dirent.h> NOT found." >&4 | |
6186 | fi | |
6187 | set i_dirent | |
6188 | eval $setvar | |
6189 | ||
6190 | : Look for type of directory structure. | |
6191 | echo " " | |
6192 | $cppstdin $cppflags $cppminus < "$xinc" > try.c | |
6193 | ||
6194 | case "$direntrytype" in | |
6195 | ''|' ') | |
6196 | case "$i_dirent" in | |
6197 | $define) guess1='struct dirent' ;; | |
6198 | *) guess1='struct direct' ;; | |
2afac517 | 6199 | esac |
6200 | ;; | |
6201 | *) guess1="$direntrytype" | |
6202 | ;; | |
8e07c86e AD |
6203 | esac |
6204 | ||
2afac517 | 6205 | case "$guess1" in |
6206 | 'struct dirent') guess2='struct direct' ;; | |
6207 | *) guess2='struct dirent' ;; | |
6208 | esac | |
6209 | ||
6210 | if $contains "$guess1" try.c >/dev/null 2>&1; then | |
6211 | direntrytype="$guess1" | |
6212 | echo "Your directory entries are $direntrytype." >&4 | |
6213 | elif $contains "$guess2" try.c >/dev/null 2>&1; then | |
6214 | direntrytype="$guess2" | |
6215 | echo "Your directory entries seem to be $direntrytype." >&4 | |
6216 | else | |
6217 | echo "I don't recognize your system's directory entries." >&4 | |
6218 | rp="What type is used for directory entries on this system?" | |
6219 | dflt="$guess1" | |
6220 | . ./myread | |
6221 | direntrytype="$ans" | |
6222 | fi | |
6223 | $rm -f try.c | |
a0d0e21e | 6224 | |
a0d0e21e | 6225 | |
2afac517 | 6226 | : see if the directory entry stores field length |
6227 | echo " " | |
6228 | $cppstdin $cppflags $cppminus < "$xinc" > try.c | |
6229 | if $contains 'd_namlen' try.c >/dev/null 2>&1; then | |
6230 | echo "Good, your directory entry keeps length information in d_namlen." >&4 | |
6231 | val="$define" | |
6232 | else | |
6233 | echo "Your directory entry does not know about the d_namlen field." >&4 | |
6234 | val="$undef" | |
6235 | fi | |
6236 | set d_dirnamlen | |
6237 | eval $setvar | |
6238 | $rm -f try.c | |
a0d0e21e | 6239 | |
2afac517 | 6240 | : see if dlerror exists |
6241 | xxx_runnm="$runnm" | |
6242 | runnm=false | |
6243 | set dlerror d_dlerror | |
6244 | eval $inlibc | |
6245 | runnm="$xxx_runnm" | |
a0d0e21e LW |
6246 | |
6247 | : see if dlfcn is available | |
6248 | set dlfcn.h i_dlfcn | |
6249 | eval $inhdr | |
6250 | ||
6251 | case "$usedl" in | |
6252 | $define|y|true) | |
6253 | $cat << EOM | |
6254 | ||
6255 | On a few systems, the dynamically loaded modules that perl generates and uses | |
6256 | will need a different extension then shared libs. The default will probably | |
6257 | be appropriate. | |
6258 | ||
6259 | EOM | |
6260 | case "$dlext" in | |
6261 | '') dflt="$so" ;; | |
6262 | *) dflt="$dlext" ;; | |
6263 | esac | |
6264 | rp='What is the extension of dynamically loaded modules' | |
6265 | . ./myread | |
6266 | dlext="$ans" | |
6267 | ;; | |
6268 | *) | |
6269 | dlext="none" | |
6270 | ;; | |
6271 | esac | |
6272 | ||
6273 | : Check if dlsym need a leading underscore | |
6274 | echo " " | |
6275 | val="$undef" | |
6276 | ||
6277 | case "$dlsrc" in | |
6278 | dl_dlopen.xs) | |
6279 | echo "Checking whether your dlsym() needs a leading underscore ..." >&4 | |
6280 | $cat >dyna.c <<'EOM' | |
6281 | fred () { } | |
6282 | EOM | |
6283 | ||
6284 | $cat >fred.c<<EOM | |
6285 | ||
6286 | #include <stdio.h> | |
6287 | #$i_dlfcn I_DLFCN | |
6288 | #ifdef I_DLFCN | |
6289 | #include <dlfcn.h> /* the dynamic linker include file for Sunos/Solaris */ | |
6290 | #else | |
6291 | #include <sys/types.h> | |
6292 | #include <nlist.h> | |
6293 | #include <link.h> | |
6294 | #endif | |
6295 | ||
6296 | extern int fred() ; | |
6297 | ||
6298 | main() | |
6299 | { | |
6300 | void * handle ; | |
6301 | void * symbol ; | |
6302 | #ifndef RTLD_LAZY | |
6303 | int mode = 1 ; | |
6304 | #else | |
6305 | int mode = RTLD_LAZY ; | |
6306 | #endif | |
6307 | handle = dlopen("./dyna.$dlext", mode) ; | |
6308 | if (handle == NULL) { | |
5f05dabc | 6309 | printf ("1\n") ; |
6310 | fflush (stdout) ; | |
6311 | exit(0); | |
a0d0e21e LW |
6312 | } |
6313 | symbol = dlsym(handle, "fred") ; | |
6314 | if (symbol == NULL) { | |
5f05dabc | 6315 | /* try putting a leading underscore */ |
6316 | symbol = dlsym(handle, "_fred") ; | |
6317 | if (symbol == NULL) { | |
6318 | printf ("2\n") ; | |
6319 | fflush (stdout) ; | |
6320 | exit(0); | |
6321 | } | |
6322 | printf ("3\n") ; | |
a0d0e21e LW |
6323 | } |
6324 | else | |
5f05dabc | 6325 | printf ("4\n") ; |
36477c24 | 6326 | fflush (stdout) ; |
6327 | exit(0); | |
a0d0e21e LW |
6328 | } |
6329 | EOM | |
760ac839 | 6330 | : Call the object file tmp-dyna.o in case dlext=o. |
a0d0e21e | 6331 | if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && |
8ff267be | 6332 | mv dyna${obj_ext} tmp-dyna${obj_ext} > /dev/null 2>&1 && |
6333 | $ld $lddlflags -o dyna.$dlext tmp-dyna${obj_ext} > /dev/null 2>&1 && | |
a0d0e21e LW |
6334 | $cc $ccflags $ldflags $cccdlflags $ccdlflags fred.c -o fred $libs > /dev/null 2>&1; then |
6335 | xxx=`./fred` | |
6336 | case $xxx in | |
6337 | 1) echo "Test program failed using dlopen." >&4 | |
6338 | echo "Perhaps you should not use dynamic loading." >&4;; | |
6339 | 2) echo "Test program failed using dlsym." >&4 | |
6340 | echo "Perhaps you should not use dynamic loading." >&4;; | |
6341 | 3) echo "dlsym needs a leading underscore" >&4 | |
6342 | val="$define" ;; | |
6343 | 4) echo "dlsym doesn't need a leading underscore." >&4;; | |
6344 | esac | |
6345 | else | |
6346 | echo "I can't compile and run the test program." >&4 | |
6347 | fi | |
6348 | ;; | |
6349 | esac | |
6350 | ||
a78b0d02 | 6351 | $rm -f fred fred.? dyna.$dlext dyna.? tmp-dyna.? |
a0d0e21e LW |
6352 | |
6353 | set d_dlsymun | |
6354 | eval $setvar | |
6355 | ||
a0d0e21e LW |
6356 | : see if dup2 exists |
6357 | set dup2 d_dup2 | |
6358 | eval $inlibc | |
6359 | ||
8e07c86e AD |
6360 | : Locate the flags for 'open()' |
6361 | echo " " | |
6362 | $cat >open3.c <<'EOCP' | |
6363 | #include <sys/types.h> | |
6364 | #ifdef I_FCNTL | |
6365 | #include <fcntl.h> | |
6366 | #endif | |
6367 | #ifdef I_SYS_FILE | |
6368 | #include <sys/file.h> | |
6369 | #endif | |
6370 | main() { | |
6371 | if(O_RDONLY); | |
6372 | #ifdef O_TRUNC | |
6373 | exit(0); | |
6374 | #else | |
6375 | exit(1); | |
6376 | #endif | |
6377 | } | |
6378 | EOCP | |
6379 | : check sys/file.h first to get FREAD on Sun | |
6380 | if $test `./findhdr sys/file.h` && \ | |
90248788 | 6381 | $cc $ccflags "-DI_SYS_FILE" -o open3 $ldflags open3.c $libs >/dev/null 2>&1 ; then |
8e07c86e AD |
6382 | h_sysfile=true; |
6383 | echo "<sys/file.h> defines the O_* constants..." >&4 | |
6384 | if ./open3; then | |
6385 | echo "and you have the 3 argument form of open()." >&4 | |
6386 | val="$define" | |
6387 | else | |
6388 | echo "but not the 3 argument form of open(). Oh, well." >&4 | |
6389 | val="$undef" | |
6390 | fi | |
6391 | elif $test `./findhdr fcntl.h` && \ | |
90248788 | 6392 | $cc $ccflags "-DI_FCNTL" -o open3 $ldflags open3.c $libs >/dev/null 2>&1 ; then |
8e07c86e AD |
6393 | h_fcntl=true; |
6394 | echo "<fcntl.h> defines the O_* constants..." >&4 | |
6395 | if ./open3; then | |
6396 | echo "and you have the 3 argument form of open()." >&4 | |
6397 | val="$define" | |
6398 | else | |
6399 | echo "but not the 3 argument form of open(). Oh, well." >&4 | |
6400 | val="$undef" | |
6401 | fi | |
6402 | else | |
6403 | val="$undef" | |
6404 | echo "I can't find the O_* constant definitions! You got problems." >&4 | |
6405 | fi | |
6406 | set d_open3 | |
6407 | eval $setvar | |
6408 | $rm -f open3* | |
6409 | ||
6410 | : check for non-blocking I/O stuff | |
6411 | case "$h_sysfile" in | |
6412 | true) echo "#include <sys/file.h>" > head.c;; | |
6413 | *) | |
6414 | case "$h_fcntl" in | |
6415 | true) echo "#include <fcntl.h>" > head.c;; | |
6416 | *) echo "#include <sys/fcntl.h>" > head.c;; | |
6417 | esac | |
6418 | ;; | |
6419 | esac | |
6420 | echo " " | |
6421 | echo "Figuring out the flag used by open() for non-blocking I/O..." >&4 | |
6422 | case "$o_nonblock" in | |
6423 | '') | |
6424 | $cat head.c > try.c | |
6425 | $cat >>try.c <<'EOCP' | |
6426 | main() { | |
6427 | #ifdef O_NONBLOCK | |
6428 | printf("O_NONBLOCK\n"); | |
6429 | exit(0); | |
6430 | #endif | |
6431 | #ifdef O_NDELAY | |
6432 | printf("O_NDELAY\n"); | |
6433 | exit(0); | |
6434 | #endif | |
6435 | #ifdef FNDELAY | |
6436 | printf("FNDELAY\n"); | |
6437 | exit(0); | |
6438 | #endif | |
6439 | exit(0); | |
6440 | } | |
6441 | EOCP | |
6442 | if $cc $ccflags $ldflags try.c -o try >/dev/null 2>&1; then | |
6443 | o_nonblock=`./try` | |
6444 | case "$o_nonblock" in | |
6445 | '') echo "I can't figure it out, assuming O_NONBLOCK will do.";; | |
6446 | *) echo "Seems like we can use $o_nonblock.";; | |
6447 | esac | |
6448 | else | |
6449 | echo "(I can't compile the test program; pray O_NONBLOCK is right!)" | |
6450 | fi | |
6451 | ;; | |
6452 | *) echo "Using $hint value $o_nonblock.";; | |
6453 | esac | |
6454 | $rm -f try try.* .out core | |
6455 | ||
6456 | echo " " | |
6457 | echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4 | |
6458 | case "$eagain" in | |
6459 | '') | |
6460 | $cat head.c > try.c | |
6461 | $cat >>try.c <<EOCP | |
6462 | #include <errno.h> | |
6463 | #include <sys/types.h> | |
6464 | #include <signal.h> | |
4633a7c4 | 6465 | #define MY_O_NONBLOCK $o_nonblock |
8e07c86e AD |
6466 | extern int errno; |
6467 | $signal_t blech(x) int x; { exit(3); } | |
4633a7c4 LW |
6468 | EOCP |
6469 | $cat >> try.c <<'EOCP' | |
8e07c86e AD |
6470 | main() |
6471 | { | |
6472 | int pd[2]; | |
6473 | int pu[2]; | |
6474 | char buf[1]; | |
6475 | char string[100]; | |
6476 | ||
6477 | pipe(pd); /* Down: child -> parent */ | |
6478 | pipe(pu); /* Up: parent -> child */ | |
6479 | if (0 != fork()) { | |
6480 | int ret; | |
6481 | close(pd[1]); /* Parent reads from pd[0] */ | |
6482 | close(pu[0]); /* Parent writes (blocking) to pu[1] */ | |
4633a7c4 | 6483 | if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK)) |
8e07c86e AD |
6484 | exit(1); |
6485 | signal(SIGALRM, blech); | |
6486 | alarm(5); | |
6487 | if ((ret = read(pd[0], buf, 1)) > 0) /* Nothing to read! */ | |
6488 | exit(2); | |
6489 | sprintf(string, "%d\n", ret); | |
6490 | write(2, string, strlen(string)); | |
6491 | alarm(0); | |
6492 | #ifdef EAGAIN | |
6493 | if (errno == EAGAIN) { | |
6494 | printf("EAGAIN\n"); | |
6495 | goto ok; | |
6496 | } | |
6497 | #endif | |
6498 | #ifdef EWOULDBLOCK | |
6499 | if (errno == EWOULDBLOCK) | |
6500 | printf("EWOULDBLOCK\n"); | |
6501 | #endif | |
6502 | ok: | |
6503 | write(pu[1], buf, 1); /* Unblocks child, tell it to close our pipe */ | |
6504 | sleep(2); /* Give it time to close our pipe */ | |
6505 | alarm(5); | |
6506 | ret = read(pd[0], buf, 1); /* Should read EOF */ | |
6507 | alarm(0); | |
6508 | sprintf(string, "%d\n", ret); | |
6509 | write(3, string, strlen(string)); | |
6510 | exit(0); | |
6511 | } | |
6512 | ||
6513 | close(pd[0]); /* We write to pd[1] */ | |
6514 | close(pu[1]); /* We read from pu[0] */ | |
6515 | read(pu[0], buf, 1); /* Wait for parent to signal us we may continue */ | |
6516 | close(pd[1]); /* Pipe pd is now fully closed! */ | |
6517 | exit(0); /* Bye bye, thank you for playing! */ | |
6518 | } | |
6519 | EOCP | |
25f94b33 | 6520 | if $cc $ccflags $ldflags try.c -o try >/dev/null 2>&1; then |
774d564b | 6521 | echo "$startsh" >mtry |
40a7a20a | 6522 | echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry |
8e07c86e AD |
6523 | chmod +x mtry |
6524 | ./mtry >/dev/null 2>&1 | |
6525 | case $? in | |
6526 | 0) eagain=`$cat try.out`;; | |
6527 | 1) echo "Could not perform non-blocking setting!";; | |
6528 | 2) echo "I did a successful read() for something that was not there!";; | |
6529 | 3) echo "Hmm... non-blocking I/O does not seem to be working!";; | |
6530 | *) echo "Something terribly wrong happened during testing.";; | |
6531 | esac | |
6532 | rd_nodata=`$cat try.ret` | |
6533 | echo "A read() system call with no data present returns $rd_nodata." | |
6534 | case "$rd_nodata" in | |
6535 | 0|-1) ;; | |
6536 | *) | |
6537 | echo "(That's peculiar, fixing that to be -1.)" | |
6538 | rd_nodata=-1 | |
6539 | ;; | |
6540 | esac | |
6541 | case "$eagain" in | |
6542 | '') | |
6543 | echo "Forcing errno EAGAIN on read() with no data available." | |
6544 | eagain=EAGAIN | |
6545 | ;; | |
6546 | *) | |
6547 | echo "Your read() sets errno to $eagain when no data is available." | |
6548 | ;; | |
6549 | esac | |
6550 | status=`$cat try.err` | |
6551 | case "$status" in | |
6552 | 0) echo "And it correctly returns 0 to signal EOF.";; | |
6553 | -1) echo "But it also returns -1 to signal EOF, so be careful!";; | |
6554 | *) echo "However, your read() returns '$status' on EOF??";; | |
6555 | esac | |
6556 | val="$define" | |
28757baa | 6557 | if test "$status" = "$rd_nodata"; then |
8e07c86e AD |
6558 | echo "WARNING: you can't distinguish between EOF and no data!" |
6559 | val="$undef" | |
6560 | fi | |
6561 | else | |
6562 | echo "I can't compile the test program--assuming errno EAGAIN will do." | |
6563 | eagain=EAGAIN | |
6564 | fi | |
6565 | set d_eofnblk | |
6566 | eval $setvar | |
6567 | ;; | |
6568 | *) | |
6569 | echo "Using $hint value $eagain." | |
6570 | echo "Your read() returns $rd_nodata when no data is present." | |
6571 | case "$d_eofnblk" in | |
6572 | "$define") echo "And you can see EOF because read() returns 0.";; | |
6573 | "$undef") echo "But you can't see EOF status from read() returned value.";; | |
6574 | *) | |
6575 | echo "(Assuming you can't see EOF status from read anyway.)" | |
6576 | d_eofnblk=$undef | |
6577 | ;; | |
6578 | esac | |
6579 | ;; | |
6580 | esac | |
6581 | $rm -f try try.* .out core head.c mtry | |
6582 | ||
a0d0e21e LW |
6583 | : see if fchmod exists |
6584 | set fchmod d_fchmod | |
6585 | eval $inlibc | |
6586 | ||
6587 | : see if fchown exists | |
6588 | set fchown d_fchown | |
6589 | eval $inlibc | |
6590 | ||
6591 | : see if this is an fcntl system | |
6592 | set fcntl d_fcntl | |
6593 | eval $inlibc | |
6594 | ||
6595 | : see if fgetpos exists | |
6596 | set fgetpos d_fgetpos | |
6597 | eval $inlibc | |
6598 | ||
a0d0e21e LW |
6599 | : see if flock exists |
6600 | set flock d_flock | |
6601 | eval $inlibc | |
6602 | ||
a0d0e21e LW |
6603 | : see if fork exists |
6604 | set fork d_fork | |
6605 | eval $inlibc | |
6606 | ||
6607 | : see if pathconf exists | |
6608 | set pathconf d_pathconf | |
6609 | eval $inlibc | |
6610 | ||
6611 | : see if fpathconf exists | |
6612 | set fpathconf d_fpathconf | |
6613 | eval $inlibc | |
6614 | ||
6615 | : see if fsetpos exists | |
6616 | set fsetpos d_fsetpos | |
6617 | eval $inlibc | |
6618 | ||
3fd537d4 JH |
6619 | : see if gethostbyaddr exists |
6620 | set gethostbyaddr d_gethbadd | |
6621 | eval $inlibc | |
6622 | ||
a0d0e21e LW |
6623 | : see if gethostent exists |
6624 | set gethostent d_gethent | |
6625 | eval $inlibc | |
6626 | ||
6627 | : see if getlogin exists | |
6628 | set getlogin d_getlogin | |
6629 | eval $inlibc | |
6630 | ||
ce637636 JH |
6631 | : see if getnetbyaddr exists |
6632 | set getnetbyaddr d_getnbadd | |
6633 | eval $inlibc | |
6634 | ||
2afac517 | 6635 | : see if getpgid exists |
6636 | set getpgid d_getpgid | |
a0d0e21e LW |
6637 | eval $inlibc |
6638 | ||
6639 | : see if getpgrp2 exists | |
6640 | set getpgrp2 d_getpgrp2 | |
6641 | eval $inlibc | |
6642 | ||
6643 | : see if getppid exists | |
6644 | set getppid d_getppid | |
6645 | eval $inlibc | |
6646 | ||
6647 | : see if getpriority exists | |
6648 | set getpriority d_getprior | |
6649 | eval $inlibc | |
6650 | ||
5f05dabc | 6651 | : see if gettimeofday or ftime exists |
6652 | set gettimeofday d_gettimeod | |
6653 | eval $inlibc | |
6654 | case "$d_gettimeod" in | |
6655 | "$undef") | |
6656 | set ftime d_ftime | |
6657 | eval $inlibc | |
6658 | ;; | |
6659 | *) | |
6660 | val="$undef"; set d_ftime; eval $setvar | |
6661 | ;; | |
6662 | esac | |
6663 | case "$d_gettimeod$d_ftime" in | |
6664 | "$undef$undef") | |
6665 | echo " " | |
6666 | echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4 | |
6667 | ;; | |
6668 | esac | |
6669 | ||
a0d0e21e LW |
6670 | : see if this is a netinet/in.h or sys/in.h system |
6671 | set netinet/in.h i_niin sys/in.h i_sysin | |
6672 | eval $inhdr | |
6673 | ||
6674 | : see if htonl --and friends-- exists | |
6675 | val='' | |
6676 | set htonl val | |
6677 | eval $inlibc | |
6678 | ||
6679 | : Maybe they are macros. | |
6680 | case "$val" in | |
6681 | $undef) | |
6682 | $cat >htonl.c <<EOM | |
6683 | #include <stdio.h> | |
6684 | #include <sys/types.h> | |
6685 | #$i_niin I_NETINET_IN | |
6686 | #$i_sysin I_SYS_IN | |
6687 | #ifdef I_NETINET_IN | |
6688 | #include <netinet/in.h> | |
6689 | #endif | |
6690 | #ifdef I_SYS_IN | |
6691 | #include <sys/in.h> | |
6692 | #endif | |
6693 | #ifdef htonl | |
6694 | printf("Defined as a macro."); | |
6695 | #endif | |
6696 | EOM | |
6697 | $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null | |
6698 | if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then | |
6699 | val="$define" | |
6700 | echo "But it seems to be defined as a macro." >&4 | |
6701 | fi | |
6702 | $rm -f htonl.? | |
6703 | ;; | |
6704 | esac | |
6705 | set d_htonl | |
6706 | eval $setvar | |
6707 | ||
6708 | : see which of string.h or strings.h is needed | |
6709 | echo " " | |
6710 | strings=`./findhdr string.h` | |
6711 | if $test "$strings" && $test -r "$strings"; then | |
6712 | echo "Using <string.h> instead of <strings.h>." >&4 | |
6713 | val="$define" | |
6714 | else | |
6715 | val="$undef" | |
6716 | strings=`./findhdr strings.h` | |
6717 | if $test "$strings" && $test -r "$strings"; then | |
6718 | echo "Using <strings.h> instead of <string.h>." >&4 | |
6719 | else | |
6720 | echo "No string header found -- You'll surely have problems." >&4 | |
6721 | fi | |
6722 | fi | |
6723 | set i_string | |
6724 | eval $setvar | |
6725 | case "$i_string" in | |
6726 | "$undef") strings=`./findhdr strings.h`;; | |
6727 | *) strings=`./findhdr string.h`;; | |
6728 | esac | |
6729 | ||
6730 | : index or strchr | |
6731 | echo " " | |
6732 | if set index val -f; eval $csym; $val; then | |
6733 | if set strchr val -f d_strchr; eval $csym; $val; then | |
6734 | if $contains strchr "$strings" >/dev/null 2>&1 ; then | |
6735 | val="$define" | |
6736 | vali="$undef" | |
6737 | echo "strchr() found." >&4 | |
6738 | else | |
6739 | val="$undef" | |
6740 | vali="$define" | |
6741 | echo "index() found." >&4 | |
6742 | fi | |
6743 | else | |
6744 | val="$undef" | |
6745 | vali="$define" | |
6746 | echo "index() found." >&4 | |
6747 | fi | |
6748 | else | |
6749 | if set strchr val -f d_strchr; eval $csym; $val; then | |
6750 | val="$define" | |
6751 | vali="$undef" | |
6752 | echo "strchr() found." >&4 | |
6753 | else | |
6754 | echo "No index() or strchr() found!" >&4 | |
6755 | val="$undef" | |
6756 | vali="$undef" | |
6757 | fi | |
6758 | fi | |
6759 | set d_strchr; eval $setvar | |
6760 | val="$vali" | |
6761 | set d_index; eval $setvar | |
6762 | ||
7e1af8bc | 6763 | : check whether inet_aton exists |
6764 | set inet_aton d_inetaton | |
6765 | eval $inlibc | |
6766 | ||
a0d0e21e LW |
6767 | : Look for isascii |
6768 | echo " " | |
6769 | $cat >isascii.c <<'EOCP' | |
6770 | #include <stdio.h> | |
6771 | #include <ctype.h> | |
6772 | main() { | |
6773 | int c = 'A'; | |
6774 | if (isascii(c)) | |
6775 | exit(0); | |
6776 | else | |
6777 | exit(1); | |
6778 | } | |
6779 | EOCP | |
6780 | if $cc $ccflags $ldflags -o isascii isascii.c $libs >/dev/null 2>&1 ; then | |
6781 | echo "isascii() found." >&4 | |
6782 | val="$define" | |
6783 | else | |
6784 | echo "isascii() NOT found." >&4 | |
6785 | val="$undef" | |
6786 | fi | |
6787 | set d_isascii | |
6788 | eval $setvar | |
6789 | $rm -f isascii* | |
6790 | ||
6791 | : see if killpg exists | |
6792 | set killpg d_killpg | |
6793 | eval $inlibc | |
6794 | ||
6795 | : see if link exists | |
6796 | set link d_link | |
6797 | eval $inlibc | |
6798 | ||
a0d0e21e LW |
6799 | : see if localeconv exists |
6800 | set localeconv d_locconv | |
6801 | eval $inlibc | |
6802 | ||
6803 | : see if lockf exists | |
6804 | set lockf d_lockf | |
6805 | eval $inlibc | |
6806 | ||
6807 | : see if lstat exists | |
6808 | set lstat d_lstat | |
6809 | eval $inlibc | |
6810 | ||
6811 | : see if mblen exists | |
6812 | set mblen d_mblen | |
6813 | eval $inlibc | |
6814 | ||
6815 | : see if mbstowcs exists | |
6816 | set mbstowcs d_mbstowcs | |
6817 | eval $inlibc | |
6818 | ||
6819 | : see if mbtowc exists | |
6820 | set mbtowc d_mbtowc | |
6821 | eval $inlibc | |
6822 | ||
6823 | : see if memcmp exists | |
6824 | set memcmp d_memcmp | |
6825 | eval $inlibc | |
6826 | ||
6827 | : see if memcpy exists | |
6828 | set memcpy d_memcpy | |
6829 | eval $inlibc | |
6830 | ||
6831 | : see if memmove exists | |
6832 | set memmove d_memmove | |
2304df62 AD |
6833 | eval $inlibc |
6834 | ||
6835 | : see if memset exists | |
6836 | set memset d_memset | |
6837 | eval $inlibc | |
6838 | ||
6839 | : see if mkdir exists | |
6840 | set mkdir d_mkdir | |
6841 | eval $inlibc | |
6842 | ||
a0d0e21e LW |
6843 | : see if mkfifo exists |
6844 | set mkfifo d_mkfifo | |
6845 | eval $inlibc | |
6846 | ||
6847 | : see if mktime exists | |
6848 | set mktime d_mktime | |
6849 | eval $inlibc | |
6850 | ||
2304df62 AD |
6851 | : see if msgctl exists |
6852 | set msgctl d_msgctl | |
6853 | eval $inlibc | |
6854 | ||
6855 | : see if msgget exists | |
6856 | set msgget d_msgget | |
6857 | eval $inlibc | |
6858 | ||
6859 | : see if msgsnd exists | |
6860 | set msgsnd d_msgsnd | |
6861 | eval $inlibc | |
6862 | ||
6863 | : see if msgrcv exists | |
6864 | set msgrcv d_msgrcv | |
6865 | eval $inlibc | |
6866 | ||
6867 | : see how much of the 'msg*(2)' library is present. | |
6868 | h_msg=true | |
6869 | echo " " | |
6870 | case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in | |
6871 | *"$undef"*) h_msg=false;; | |
6872 | esac | |
6873 | : we could also check for sys/ipc.h ... | |
6874 | if $h_msg && $test `./findhdr sys/msg.h`; then | |
6875 | echo "You have the full msg*(2) library." >&4 | |
6876 | val="$define" | |
6877 | else | |
6878 | echo "You don't have the full msg*(2) library." >&4 | |
6879 | val="$undef" | |
6880 | fi | |
6881 | set d_msg | |
6882 | eval $setvar | |
6883 | ||
a0d0e21e LW |
6884 | : see if this is a malloc.h system |
6885 | set malloc.h i_malloc | |
6886 | eval $inhdr | |
6887 | ||
94b6baf5 AD |
6888 | : see if stdlib is available |
6889 | set stdlib.h i_stdlib | |
6890 | eval $inhdr | |
6891 | ||
85e6fe83 | 6892 | : determine which malloc to compile in |
85e6fe83 LW |
6893 | echo " " |
6894 | case "$usemymalloc" in | |
a0d0e21e LW |
6895 | ''|y*|true) dflt='y' ;; |
6896 | n*|false) dflt='n' ;; | |
6897 | *) dflt="$usemymalloc" ;; | |
85e6fe83 LW |
6898 | esac |
6899 | rp="Do you wish to attempt to use the malloc that comes with $package?" | |
6900 | . ./myread | |
6901 | usemymalloc="$ans" | |
6902 | case "$ans" in | |
a0d0e21e LW |
6903 | y*|true) |
6904 | usemymalloc='y' | |
6905 | mallocsrc='malloc.c' | |
6906 | mallocobj='malloc.o' | |
6907 | d_mymalloc="$define" | |
6908 | case "$libs" in | |
6909 | *-lmalloc*) | |
6910 | : Remove malloc from list of libraries to use | |
6911 | echo "Removing unneeded -lmalloc from library list" >&4 | |
6912 | set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'` | |
6913 | shift | |
6914 | libs="$*" | |
6915 | echo "libs = $libs" >&4 | |
6916 | ;; | |
6917 | esac | |
6918 | ;; | |
6919 | *) | |
6920 | usemymalloc='n' | |
6921 | mallocsrc='' | |
6922 | mallocobj='' | |
6923 | d_mymalloc="$undef" | |
6924 | ;; | |
85e6fe83 LW |
6925 | esac |
6926 | ||
94b6baf5 | 6927 | : compute the return types of malloc and free |
85e6fe83 | 6928 | echo " " |
94b6baf5 | 6929 | $cat >malloc.c <<END |
a0d0e21e | 6930 | #$i_malloc I_MALLOC |
94b6baf5 | 6931 | #$i_stdlib I_STDLIB |
a0d0e21e LW |
6932 | #include <stdio.h> |
6933 | #include <sys/types.h> | |
6934 | #ifdef I_MALLOC | |
85e6fe83 | 6935 | #include <malloc.h> |
a0d0e21e | 6936 | #endif |
94b6baf5 AD |
6937 | #ifdef I_STDLIB |
6938 | #include <stdlib.h> | |
6939 | #endif | |
6940 | #ifdef TRY_MALLOC | |
85e6fe83 | 6941 | void *malloc(); |
94b6baf5 AD |
6942 | #endif |
6943 | #ifdef TRY_FREE | |
6944 | void free(); | |
6945 | #endif | |
85e6fe83 | 6946 | END |
94b6baf5 AD |
6947 | case "$malloctype" in |
6948 | '') | |
6949 | if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then | |
85e6fe83 LW |
6950 | malloctype='void *' |
6951 | else | |
6952 | malloctype='char *' | |
6953 | fi | |
85e6fe83 LW |
6954 | ;; |
6955 | esac | |
6956 | echo "Your system wants malloc to return '$malloctype', it would seem." >&4 | |
6957 | ||
94b6baf5 AD |
6958 | case "$freetype" in |
6959 | '') | |
6960 | if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then | |
6961 | freetype='void' | |
6962 | else | |
6963 | freetype='int' | |
6964 | fi | |
6965 | ;; | |
8e07c86e AD |
6966 | esac |
6967 | echo "Your system uses $freetype free(), it would seem." >&4 | |
6968 | $rm -f malloc.[co] | |
6969 | : see if nice exists | |
6970 | set nice d_nice | |
6971 | eval $inlibc | |
2304df62 | 6972 | |
a0d0e21e LW |
6973 | : see if pause exists |
6974 | set pause d_pause | |
6975 | eval $inlibc | |
6976 | ||
6977 | : see if pipe exists | |
6978 | set pipe d_pipe | |
6979 | eval $inlibc | |
6980 | ||
8e07c86e AD |
6981 | : see if poll exists |
6982 | set poll d_poll | |
6983 | eval $inlibc | |
6984 | ||
4aa0a1f7 AD |
6985 | : see if this is a pwd.h system |
6986 | set pwd.h i_pwd | |
6987 | eval $inhdr | |
6988 | ||
6989 | case "$i_pwd" in | |
6990 | $define) | |
6991 | xxx=`./findhdr pwd.h` | |
85e6fe83 | 6992 | $cppstdin $cppflags $cppminus < $xxx >$$.h |
4aa0a1f7 | 6993 | |
2304df62 | 6994 | if $contains 'pw_quota' $$.h >/dev/null 2>&1; then |
4aa0a1f7 | 6995 | val="$define" |
2304df62 | 6996 | else |
4aa0a1f7 | 6997 | val="$undef" |
2304df62 | 6998 | fi |
4aa0a1f7 AD |
6999 | set d_pwquota |
7000 | eval $setvar | |
7001 | ||
2304df62 | 7002 | if $contains 'pw_age' $$.h >/dev/null 2>&1; then |
4aa0a1f7 | 7003 | val="$define" |
2304df62 | 7004 | else |
4aa0a1f7 | 7005 | val="$undef" |
2304df62 | 7006 | fi |
4aa0a1f7 AD |
7007 | set d_pwage |
7008 | eval $setvar | |
7009 | ||
2304df62 | 7010 | if $contains 'pw_change' $$.h >/dev/null 2>&1; then |
4aa0a1f7 | 7011 | val="$define" |
2304df62 | 7012 | else |
4aa0a1f7 | 7013 | val="$undef" |
2304df62 | 7014 | fi |
4aa0a1f7 AD |
7015 | set d_pwchange |
7016 | eval $setvar | |
7017 | ||
2304df62 | 7018 | if $contains 'pw_class' $$.h >/dev/null 2>&1; then |
4aa0a1f7 | 7019 | val="$define" |
2304df62 | 7020 | else |
4aa0a1f7 | 7021 | val="$undef" |
2304df62 | 7022 | fi |
4aa0a1f7 AD |
7023 | set d_pwclass |
7024 | eval $setvar | |
7025 | ||
2304df62 | 7026 | if $contains 'pw_expire' $$.h >/dev/null 2>&1; then |
4aa0a1f7 | 7027 | val="$define" |
2304df62 | 7028 | else |
4aa0a1f7 | 7029 | val="$undef" |
2304df62 | 7030 | fi |
4aa0a1f7 AD |
7031 | set d_pwexpire |
7032 | eval $setvar | |
7033 | ||
2304df62 | 7034 | if $contains 'pw_comment' $$.h >/dev/null 2>&1; then |
4aa0a1f7 | 7035 | val="$define" |
2304df62 | 7036 | else |
4aa0a1f7 | 7037 | val="$undef" |
2304df62 | 7038 | fi |
4aa0a1f7 AD |
7039 | set d_pwcomment |
7040 | eval $setvar | |
7041 | ||
2304df62 | 7042 | $rm -f $$.h |
4aa0a1f7 AD |
7043 | ;; |
7044 | *) | |
7045 | val="$undef"; | |
7046 | set d_pwquota; eval $setvar | |
7047 | set d_pwage; eval $setvar | |
7048 | set d_pwchange; eval $setvar | |
7049 | set d_pwclass; eval $setvar | |
7050 | set d_pwexpire; eval $setvar | |
7051 | set d_pwcomment; eval $setvar | |
7052 | ;; | |
7053 | esac | |
2304df62 | 7054 | |
85e6fe83 | 7055 | : see if readdir and friends exist |
2304df62 AD |
7056 | set readdir d_readdir |
7057 | eval $inlibc | |
85e6fe83 LW |
7058 | set seekdir d_seekdir |
7059 | eval $inlibc | |
7060 | set telldir d_telldir | |
7061 | eval $inlibc | |
7062 | set rewinddir d_rewinddir | |
7063 | eval $inlibc | |
2304df62 | 7064 | |
a0d0e21e LW |
7065 | : see if readlink exists |
7066 | set readlink d_readlink | |
7067 | eval $inlibc | |
7068 | ||
2304df62 AD |
7069 | : see if rename exists |
7070 | set rename d_rename | |
7071 | eval $inlibc | |
7072 | ||
7073 | : see if rmdir exists | |
7074 | set rmdir d_rmdir | |
7075 | eval $inlibc | |
7076 | ||
8ff267be | 7077 | : see if memory.h is available. |
7078 | val='' | |
7079 | set memory.h val | |
7080 | eval $inhdr | |
7081 | ||
7082 | : See if it conflicts with string.h | |
7083 | case "$val" in | |
7084 | $define) | |
7085 | case "$strings" in | |
7086 | '') ;; | |
7087 | *) | |
7088 | $cppstdin $cppflags $cppminus < $strings > mem.h | |
7089 | if $contains 'memcpy' mem.h >/dev/null 2>&1; then | |
7090 | echo " " | |
7091 | echo "We won't be including <memory.h>." | |
7092 | val="$undef" | |
7093 | fi | |
7094 | $rm -f mem.h | |
7095 | ;; | |
7096 | esac | |
7097 | esac | |
7098 | set i_memory | |
7099 | eval $setvar | |
7100 | ||
2304df62 AD |
7101 | : can bcopy handle overlapping blocks? |
7102 | val="$undef" | |
7103 | case "$d_bcopy" in | |
7104 | "$define") | |
7105 | echo " " | |
7106 | echo "Checking to see if your bcopy() can do overlapping copies..." >&4 | |
8ff267be | 7107 | $cat >foo.c <<EOCP |
7108 | #$i_memory I_MEMORY | |
7109 | #$i_stdlib I_STDLIB | |
7110 | #$i_string I_STRING | |
7111 | #$i_unistd I_UNISTD | |
7112 | EOCP | |
7113 | $cat >>foo.c <<'EOCP' | |
7114 | #include <stdio.h> | |
7115 | ||
7116 | #ifdef I_MEMORY | |
7117 | # include <memory.h> | |
7118 | #endif | |
7119 | #ifdef I_STDLIB | |
7120 | # include <stdlib.h> | |
7121 | #endif | |
7122 | #ifdef I_STRING | |
7123 | # include <string.h> | |
7124 | #else | |
7125 | # include <strings.h> | |
7126 | #endif | |
7127 | #ifdef I_UNISTD | |
7128 | # include <unistd.h> /* Needed for NetBSD */ | |
7129 | #endif | |
2304df62 AD |
7130 | main() |
7131 | { | |
85e6fe83 LW |
7132 | char buf[128], abc[128]; |
7133 | char *b; | |
7134 | int len; | |
7135 | int off; | |
7136 | int align; | |
a0d0e21e | 7137 | |
8ff267be | 7138 | /* Copy "abcde..." string to char abc[] so that gcc doesn't |
7139 | try to store the string in read-only memory. */ | |
85e6fe83 | 7140 | bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36); |
2304df62 AD |
7141 | |
7142 | for (align = 7; align >= 0; align--) { | |
7143 | for (len = 36; len; len--) { | |
7144 | b = buf+align; | |
85e6fe83 | 7145 | bcopy(abc, b, len); |
2304df62 AD |
7146 | for (off = 1; off <= len; off++) { |
7147 | bcopy(b, b+off, len); | |
7148 | bcopy(b+off, b, len); | |
85e6fe83 | 7149 | if (bcmp(b, abc, len)) |
2304df62 AD |
7150 | exit(1); |
7151 | } | |
7152 | } | |
7153 | } | |
7154 | exit(0); | |
7155 | } | |
7156 | EOCP | |
774d564b | 7157 | if $cc $optimize $ccflags $ldflags foo.c \ |
7158 | -o safebcpy $libs >/dev/null 2>&1; then | |
2304df62 AD |
7159 | if ./safebcpy 2>/dev/null; then |
7160 | echo "Yes, it can." | |
7161 | val="$define" | |
7162 | else | |
7163 | echo "It can't, sorry." | |
8ff267be | 7164 | case "$d_memmove" in |
7165 | "$define") echo "But that's Ok since you have memmove()." ;; | |
7166 | esac | |
2304df62 AD |
7167 | fi |
7168 | else | |
7169 | echo "(I can't compile the test program, so we'll assume not...)" | |
8ff267be | 7170 | case "$d_memmove" in |
7171 | "$define") echo "But that's Ok since you have memmove()." ;; | |
7172 | esac | |
2304df62 AD |
7173 | fi |
7174 | ;; | |
7175 | esac | |
7176 | $rm -f foo.* safebcpy core | |
7177 | set d_safebcpy | |
7178 | eval $setvar | |
7179 | ||
7180 | : can memcpy handle overlapping blocks? | |
7181 | val="$undef" | |
7182 | case "$d_memcpy" in | |
7183 | "$define") | |
7184 | echo " " | |
7185 | echo "Checking to see if your memcpy() can do overlapping copies..." >&4 | |
8ff267be | 7186 | $cat >foo.c <<EOCP |
7187 | #$i_memory I_MEMORY | |
7188 | #$i_stdlib I_STDLIB | |
7189 | #$i_string I_STRING | |
7190 | #$i_unistd I_UNISTD | |
7191 | EOCP | |
7192 | $cat >>foo.c <<'EOCP' | |
7193 | #include <stdio.h> | |
7194 | ||
7195 | #ifdef I_MEMORY | |
7196 | # include <memory.h> | |
7197 | #endif | |
7198 | #ifdef I_STDLIB | |
7199 | # include <stdlib.h> | |
7200 | #endif | |
7201 | #ifdef I_STRING | |
7202 | # include <string.h> | |
7203 | #else | |
7204 | # include <strings.h> | |
7205 | #endif | |
7206 | #ifdef I_UNISTD | |
7207 | # include <unistd.h> /* Needed for NetBSD */ | |
7208 | #endif | |
2304df62 AD |
7209 | main() |
7210 | { | |
85e6fe83 LW |
7211 | char buf[128], abc[128]; |
7212 | char *b; | |
7213 | int len; | |
7214 | int off; | |
7215 | int align; | |
7216 | ||
8ff267be | 7217 | /* Copy "abcde..." string to char abc[] so that gcc doesn't |
7218 | try to store the string in read-only memory. */ | |
85e6fe83 | 7219 | memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36); |
2304df62 AD |
7220 | |
7221 | for (align = 7; align >= 0; align--) { | |
7222 | for (len = 36; len; len--) { | |
7223 | b = buf+align; | |
232e078e | 7224 | memcpy(b, abc, len); |
2304df62 | 7225 | for (off = 1; off <= len; off++) { |
2304df62 | 7226 | memcpy(b+off, b, len); |
232e078e | 7227 | memcpy(b, b+off, len); |
85e6fe83 | 7228 | if (memcmp(b, abc, len)) |
2304df62 AD |
7229 | exit(1); |
7230 | } | |
7231 | } | |
7232 | } | |
7233 | exit(0); | |
7234 | } | |
7235 | EOCP | |
774d564b | 7236 | if $cc $optimize $ccflags $ldflags foo.c \ |
7237 | -o safemcpy $libs >/dev/null 2>&1; then | |
2304df62 AD |
7238 | if ./safemcpy 2>/dev/null; then |
7239 | echo "Yes, it can." | |
7240 | val="$define" | |
7241 | else | |
7242 | echo "It can't, sorry." | |
8ff267be | 7243 | case "$d_memmove" in |
7244 | "$define") echo "But that's Ok since you have memmove()." ;; | |
7245 | esac | |
2304df62 AD |
7246 | fi |
7247 | else | |
7248 | echo "(I can't compile the test program, so we'll assume not...)" | |
8ff267be | 7249 | case "$d_memmove" in |
7250 | "$define") echo "But that's Ok since you have memmove()." ;; | |
7251 | esac | |
2304df62 AD |
7252 | fi |
7253 | ;; | |
7254 | esac | |
7255 | $rm -f foo.* safemcpy core | |
7256 | set d_safemcpy | |
7257 | eval $setvar | |
7258 | ||
36477c24 | 7259 | : can memcmp be trusted to compare relative magnitude? |
7260 | val="$undef" | |
7261 | case "$d_memcmp" in | |
7262 | "$define") | |
7263 | echo " " | |
5f05dabc | 7264 | echo "Checking to see if your memcmp() can compare relative magnitude..." >&4 |
36477c24 | 7265 | $cat >foo.c <<EOCP |
7266 | #$i_memory I_MEMORY | |
7267 | #$i_stdlib I_STDLIB | |
7268 | #$i_string I_STRING | |
7269 | #$i_unistd I_UNISTD | |
7270 | EOCP | |
7271 | $cat >>foo.c <<'EOCP' | |
7272 | #include <stdio.h> | |
7273 | ||
7274 | #ifdef I_MEMORY | |
7275 | # include <memory.h> | |
7276 | #endif | |
7277 | #ifdef I_STDLIB | |
7278 | # include <stdlib.h> | |
7279 | #endif | |
7280 | #ifdef I_STRING | |
7281 | # include <string.h> | |
7282 | #else | |
7283 | # include <strings.h> | |
7284 | #endif | |
7285 | #ifdef I_UNISTD | |
7286 | # include <unistd.h> /* Needed for NetBSD */ | |
7287 | #endif | |
7288 | main() | |
7289 | { | |
7290 | char a = -1; | |
7291 | char b = 0; | |
7292 | if ((a < b) && memcmp(&a, &b, 1) < 0) | |
7293 | exit(1); | |
7294 | exit(0); | |
7295 | } | |
7296 | EOCP | |
774d564b | 7297 | if $cc $optimize $ccflags $ldflags foo.c \ |
7298 | -o sanemcmp $libs >/dev/null 2>&1; then | |
36477c24 | 7299 | if ./sanemcmp 2>/dev/null; then |
7300 | echo "Yes, it can." | |
7301 | val="$define" | |
7302 | else | |
7303 | echo "No, it can't (it uses signed chars)." | |
7304 | fi | |
7305 | else | |
7306 | echo "(I can't compile the test program, so we'll assume not...)" | |
7307 | fi | |
7308 | ;; | |
7309 | esac | |
7310 | $rm -f foo.* sanemcmp core | |
7311 | set d_sanemcmp | |
7312 | eval $setvar | |
7313 | ||
2304df62 AD |
7314 | : see if select exists |
7315 | set select d_select | |
7316 | eval $inlibc | |
7317 | ||
7318 | : see if semctl exists | |
7319 | set semctl d_semctl | |
7320 | eval $inlibc | |
7321 | ||
7322 | : see if semget exists | |
7323 | set semget d_semget | |
7324 | eval $inlibc | |
7325 | ||
7326 | : see if semop exists | |
7327 | set semop d_semop | |
7328 | eval $inlibc | |
7329 | ||
7330 | : see how much of the 'sem*(2)' library is present. | |
7331 | h_sem=true | |
7332 | echo " " | |
7333 | case "$d_semctl$d_semget$d_semop" in | |
7334 | *"$undef"*) h_sem=false;; | |
7335 | esac | |
7336 | : we could also check for sys/ipc.h ... | |
7337 | if $h_sem && $test `./findhdr sys/sem.h`; then | |
7338 | echo "You have the full sem*(2) library." >&4 | |
7339 | val="$define" | |
7340 | else | |
7341 | echo "You don't have the full sem*(2) library." >&4 | |
7342 | val="$undef" | |
7343 | fi | |
7344 | set d_sem | |
7345 | eval $setvar | |
7346 | ||
7347 | : see if setegid exists | |
7348 | set setegid d_setegid | |
7349 | eval $inlibc | |
7350 | ||
7351 | : see if seteuid exists | |
7352 | set seteuid d_seteuid | |
7353 | eval $inlibc | |
7354 | ||
a0d0e21e LW |
7355 | : see if setlinebuf exists |
7356 | set setlinebuf d_setlinebuf | |
7357 | eval $inlibc | |
7358 | ||
2304df62 AD |
7359 | : see if setlocale exists |
7360 | set setlocale d_setlocale | |
7361 | eval $inlibc | |
a0d0e21e | 7362 | |
2304df62 AD |
7363 | : see if setpgid exists |
7364 | set setpgid d_setpgid | |
7365 | eval $inlibc | |
7366 | ||
2304df62 AD |
7367 | : see if setpgrp2 exists |
7368 | set setpgrp2 d_setpgrp2 | |
7369 | eval $inlibc | |
7370 | ||
7371 | : see if setpriority exists | |
7372 | set setpriority d_setprior | |
7373 | eval $inlibc | |
7374 | ||
7375 | : see if setregid exists | |
7376 | set setregid d_setregid | |
7377 | eval $inlibc | |
7378 | set setresgid d_setresgid | |
7379 | eval $inlibc | |
7380 | ||
7381 | : see if setreuid exists | |
7382 | set setreuid d_setreuid | |
7383 | eval $inlibc | |
7384 | set setresuid d_setresuid | |
7385 | eval $inlibc | |
7386 | ||
7387 | : see if setrgid exists | |
7388 | set setrgid d_setrgid | |
7389 | eval $inlibc | |
7390 | ||
7391 | : see if setruid exists | |
7392 | set setruid d_setruid | |
7393 | eval $inlibc | |
7394 | ||
7395 | : see if setsid exists | |
7396 | set setsid d_setsid | |
7397 | eval $inlibc | |
7398 | ||
760ac839 LW |
7399 | : see if sfio.h is available |
7400 | set sfio.h i_sfio | |
7401 | eval $inhdr | |
7402 | ||
7403 | ||
8ff267be | 7404 | : see if sfio library is available |
760ac839 LW |
7405 | case "$i_sfio" in |
7406 | $define) | |
7407 | val='' | |
7408 | set sfreserve val | |
7409 | eval $inlibc | |
7410 | ;; | |
7411 | *) | |
7412 | val="$undef" | |
7413 | ;; | |
7414 | esac | |
8ff267be | 7415 | : Ok, but do we want to use it. |
760ac839 LW |
7416 | case "$val" in |
7417 | $define) | |
7418 | case "$usesfio" in | |
8ff267be | 7419 | true|$define|[yY]*) dflt='y';; |
760ac839 LW |
7420 | *) dflt='n';; |
7421 | esac | |
8ff267be | 7422 | echo "$package can use the sfio library, but it is experimental." |
760ac839 LW |
7423 | rp="You seem to have sfio available, do you want to try using it?" |
7424 | . ./myread | |
7425 | case "$ans" in | |
8ff267be | 7426 | y|Y) ;; |
7427 | *) echo "Ok, avoiding sfio this time. I'll use stdio instead." | |
760ac839 | 7428 | val="$undef" |
ff0cee69 | 7429 | : Remove sfio from list of libraries to use |
7430 | set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'` | |
7431 | shift | |
7432 | libs="$*" | |
7433 | echo "libs = $libs" >&4 | |
760ac839 LW |
7434 | ;; |
7435 | esac | |
7436 | ;; | |
8ff267be | 7437 | *) case "$usesfio" in |
7438 | true|$define|[yY]*) | |
7439 | echo "Sorry, cannot find sfio on this machine" >&4 | |
7440 | echo "Ignoring your setting of usesfio=$usesfio" >&4 | |
760ac839 LW |
7441 | ;; |
7442 | esac | |
7443 | ;; | |
7444 | esac | |
8ff267be | 7445 | set d_sfio |
7446 | eval $setvar | |
760ac839 LW |
7447 | case "$d_sfio" in |
7448 | $define) usesfio='true';; | |
7449 | *) usesfio='false';; | |
7450 | esac | |
7451 | ||
2304df62 AD |
7452 | : see if shmctl exists |
7453 | set shmctl d_shmctl | |
7454 | eval $inlibc | |
7455 | ||
7456 | : see if shmget exists | |
7457 | set shmget d_shmget | |
7458 | eval $inlibc | |
7459 | ||
a0d0e21e LW |
7460 | : see if shmat exists |
7461 | set shmat d_shmat | |
7462 | eval $inlibc | |
7463 | : see what shmat returns | |
7464 | case "$d_shmat" in | |
7465 | "$define") | |
7466 | $cat >shmat.c <<'END' | |
7467 | #include <sys/shm.h> | |
7468 | void *shmat(); | |
7469 | END | |
7470 | if $cc $ccflags -c shmat.c >/dev/null 2>&1; then | |
7471 | shmattype='void *' | |
7472 | else | |
7473 | shmattype='char *' | |
7474 | fi | |
7475 | echo "and it returns ($shmattype)." >&4 | |
7476 | : see if a prototype for shmat is available | |
e50aee73 AD |
7477 | xxx=`./findhdr sys/shm.h` |
7478 | $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null | |
a0d0e21e LW |
7479 | if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then |
7480 | val="$define" | |
7481 | else | |
7482 | val="$undef" | |
7483 | fi | |
7484 | $rm -f shmat.[co] | |
7485 | ;; | |
7486 | *) | |
7487 | val="$undef" | |
7488 | ;; | |
7489 | esac | |
7490 | set d_shmatprototype | |
7491 | eval $setvar | |
7492 | ||
7493 | : see if shmdt exists | |
7494 | set shmdt d_shmdt | |
7495 | eval $inlibc | |
7496 | ||
7497 | : see how much of the 'shm*(2)' library is present. | |
7498 | h_shm=true | |
7499 | echo " " | |
7500 | case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in | |
7501 | *"$undef"*) h_shm=false;; | |
7502 | esac | |
7503 | : we could also check for sys/ipc.h ... | |
7504 | if $h_shm && $test `./findhdr sys/shm.h`; then | |
7505 | echo "You have the full shm*(2) library." >&4 | |
7506 | val="$define" | |
7507 | else | |
7508 | echo "You don't have the full shm*(2) library." >&4 | |
7509 | val="$undef" | |
7510 | fi | |
7511 | set d_shm | |
7512 | eval $setvar | |
7513 | ||
2c7991dc | 7514 | echo " " |
8ff267be | 7515 | : see if we have sigaction |
7516 | if set sigaction val -f d_sigaction; eval $csym; $val; then | |
7517 | echo 'sigaction() found.' >&4 | |
7518 | val="$define" | |
2c7991dc | 7519 | else |
8ff267be | 7520 | echo 'sigaction NOT found.' >&4 |
7521 | val="$undef" | |
2c7991dc | 7522 | fi |
7523 | ||
8ff267be | 7524 | $cat > set.c <<'EOP' |
7525 | /* Solaris 2.5_x86 with SunWorks Pro C 3.0.1 doesn't have a complete | |
7526 | sigaction structure if compiled with cc -Xc. This compile test | |
7527 | will fail then. <doughera@lafcol.lafayette.edu> | |
7528 | */ | |
7529 | #include <stdio.h> | |
7530 | #include <sys/types.h> | |
7531 | #include <signal.h> | |
7532 | main() | |
7533 | { | |
7534 | struct sigaction act, oact; | |
7535 | } | |
7536 | EOP | |
7537 | ||
7538 | if $cc $ccflags $ldflags -o set set.c $libs >/dev/null 2>&1; then | |
7539 | : | |
7540 | else | |
7541 | echo "But you don't seem to have a useable struct sigaction." >&4 | |
7542 | val="$undef" | |
7543 | fi | |
7544 | set d_sigaction; eval $setvar | |
7545 | $rm -f set set.o set.c | |
2c7991dc | 7546 | |
a5f75d66 AD |
7547 | : see if sigsetjmp exists |
7548 | echo " " | |
7549 | case "$d_sigsetjmp" in | |
7550 | '') | |
760ac839 | 7551 | $cat >set.c <<'EOP' |
a5f75d66 AD |
7552 | #include <setjmp.h> |
7553 | sigjmp_buf env; | |
7554 | int set = 1; | |
7555 | main() | |
7556 | { | |
7557 | if (sigsetjmp(env,1)) | |
7558 | exit(set); | |
7559 | set = 0; | |
7560 | siglongjmp(env, 1); | |
7561 | exit(1); | |
7562 | } | |
7563 | EOP | |
760ac839 | 7564 | if $cc $ccflags $ldflags -o set set.c $libs > /dev/null 2>&1 ; then |
a5f75d66 AD |
7565 | if ./set >/dev/null 2>&1; then |
7566 | echo "POSIX sigsetjmp found." >&4 | |
7567 | val="$define" | |
7568 | else | |
760ac839 | 7569 | $cat >&4 <<EOM |
a5f75d66 | 7570 | Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!! |
760ac839 | 7571 | I'll ignore them. |
a5f75d66 AD |
7572 | EOM |
7573 | val="$undef" | |
7574 | fi | |
7575 | else | |
760ac839 | 7576 | echo "sigsetjmp not found." >&4 |
a5f75d66 AD |
7577 | val="$undef" |
7578 | fi | |
7579 | ;; | |
7580 | *) val="$d_sigsetjmp" | |
7581 | case "$d_sigsetjmp" in | |
7582 | $define) echo "POSIX sigsetjmp found." >&4;; | |
760ac839 | 7583 | $undef) echo "sigsetjmp not found." >&4;; |
a5f75d66 AD |
7584 | esac |
7585 | ;; | |
7586 | esac | |
7587 | set d_sigsetjmp | |
7588 | eval $setvar | |
7589 | $rm -f set.c set | |
7590 | ||
a0d0e21e LW |
7591 | socketlib='' |
7592 | sockethdr='' | |
7593 | : see whether socket exists | |
7594 | echo " " | |
7595 | $echo $n "Hmm... $c" >&4 | |
7596 | if set socket val -f d_socket; eval $csym; $val; then | |
7597 | echo "Looks like you have Berkeley networking support." >&4 | |
7598 | d_socket="$define" | |
7599 | if set setsockopt val -f; eval $csym; $val; then | |
7600 | d_oldsock="$undef" | |
7601 | else | |
7602 | echo "...but it uses the old 4.1c interface, rather than 4.2" >&4 | |
7603 | d_oldsock="$define" | |
7604 | fi | |
7605 | else | |
7606 | if $contains socklib libc.list >/dev/null 2>&1; then | |
7607 | echo "Looks like you have Berkeley networking support." >&4 | |
7608 | d_socket="$define" | |
7609 | : we will have to assume that it supports the 4.2 BSD interface | |
7610 | d_oldsock="$undef" | |
7611 | else | |
5f05dabc | 7612 | echo "You don't have Berkeley networking in libc$lib_ext..." >&4 |
7613 | if test -f /usr/lib/libnet$lib_ext; then | |
7614 | ( (nm $nm_opt /usr/lib/libnet$lib_ext | eval $nm_extract) || \ | |
7615 | ar t /usr/lib/libnet$lib_ext) 2>/dev/null >> libc.list | |
a0d0e21e LW |
7616 | if $contains socket libc.list >/dev/null 2>&1; then |
7617 | echo "...but the Wollongong group seems to have hacked it in." >&4 | |
7618 | socketlib="-lnet" | |
7619 | sockethdr="-I/usr/netinclude" | |
7620 | d_socket="$define" | |
7621 | if $contains setsockopt libc.list >/dev/null 2>&1; then | |
7622 | d_oldsock="$undef" | |
7623 | else | |
7624 | echo "...using the old 4.1c interface, rather than 4.2" >&4 | |
7625 | d_oldsock="$define" | |
7626 | fi | |
7627 | else | |
5f05dabc | 7628 | echo "or even in libnet$lib_ext, which is peculiar." >&4 |
a0d0e21e LW |
7629 | d_socket="$undef" |
7630 | d_oldsock="$undef" | |
7631 | fi | |
7632 | else | |
7633 | echo "or anywhere else I see." >&4 | |
7634 | d_socket="$undef" | |
7635 | d_oldsock="$undef" | |
7636 | fi | |
7637 | fi | |
7638 | fi | |
7639 | ||
7640 | : see if socketpair exists | |
7641 | set socketpair d_sockpair | |
2304df62 AD |
7642 | eval $inlibc |
7643 | ||
2304df62 AD |
7644 | : see if stat knows about block sizes |
7645 | echo " " | |
7646 | xxx=`./findhdr sys/stat.h` | |
7647 | if $contains 'st_blocks;' "$xxx" >/dev/null 2>&1 ; then | |
7648 | if $contains 'st_blksize;' "$xxx" >/dev/null 2>&1 ; then | |
7649 | echo "Your stat() knows about block sizes." >&4 | |
7650 | val="$define" | |
7651 | else | |
7652 | echo "Your stat() doesn't know about block sizes." >&4 | |
7653 | val="$undef" | |
7654 | fi | |
7655 | else | |
7656 | echo "Your stat() doesn't know about block sizes." >&4 | |
7657 | val="$undef" | |
7658 | fi | |
7659 | set d_statblks | |
7660 | eval $setvar | |
7661 | ||
16d20bd9 AD |
7662 | : see if _ptr and _cnt from stdio act std |
7663 | echo " " | |
7664 | if $contains '_IO_fpos_t' `./findhdr stdio.h` >/dev/null 2>&1 ; then | |
7665 | echo "(Looks like you have stdio.h from Linux.)" | |
7666 | case "$stdio_ptr" in | |
c2960299 AD |
7667 | '') stdio_ptr='((fp)->_IO_read_ptr)' |
7668 | ptr_lval=$define | |
7669 | ;; | |
8e07c86e | 7670 | *) ptr_lval=$d_stdio_ptr_lval;; |
16d20bd9 AD |
7671 | esac |
7672 | case "$stdio_cnt" in | |
c2960299 AD |
7673 | '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)' |
7674 | cnt_lval=$undef | |
7675 | ;; | |
8e07c86e | 7676 | *) cnt_lval=$d_stdio_cnt_lval;; |
16d20bd9 AD |
7677 | esac |
7678 | case "$stdio_base" in | |
7679 | '') stdio_base='((fp)->_IO_read_base)';; | |
7680 | esac | |
7681 | case "$stdio_bufsiz" in | |
c2960299 | 7682 | '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';; |
16d20bd9 AD |
7683 | esac |
7684 | else | |
7685 | case "$stdio_ptr" in | |
c2960299 AD |
7686 | '') stdio_ptr='((fp)->_ptr)' |
7687 | ptr_lval=$define | |
7688 | ;; | |
8e07c86e | 7689 | *) ptr_lval=$d_stdio_ptr_lval;; |
16d20bd9 AD |
7690 | esac |
7691 | case "$stdio_cnt" in | |
c2960299 AD |
7692 | '') stdio_cnt='((fp)->_cnt)' |
7693 | cnt_lval=$define | |
7694 | ;; | |
8e07c86e | 7695 | *) cnt_lval=$d_stdio_cnt_lval;; |
16d20bd9 AD |
7696 | esac |
7697 | case "$stdio_base" in | |
7698 | '') stdio_base='((fp)->_base)';; | |
7699 | esac | |
7700 | case "$stdio_bufsiz" in | |
7701 | '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';; | |
7702 | esac | |
7703 | fi | |
7704 | : test whether _ptr and _cnt really work | |
7705 | echo "Checking how std your stdio is..." >&4 | |
7706 | $cat >try.c <<EOP | |
7707 | #include <stdio.h> | |
7708 | #define FILE_ptr(fp) $stdio_ptr | |
7709 | #define FILE_cnt(fp) $stdio_cnt | |
8ff267be | 7710 | main() { |
16d20bd9 AD |
7711 | FILE *fp = fopen("try.c", "r"); |
7712 | char c = getc(fp); | |
7713 | if ( | |
7714 | 18 <= FILE_cnt(fp) && | |
7715 | strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0 | |
7716 | ) | |
7717 | exit(0); | |
7718 | exit(1); | |
7719 | } | |
7720 | EOP | |
7721 | val="$undef" | |
7722 | if $cc $ccflags $ldflags -o try try.c $libs >/dev/null 2>&1; then | |
7723 | if ./try; then | |
7724 | echo "Your stdio acts pretty std." | |
7725 | val="$define" | |
7726 | else | |
7727 | echo "Your stdio isn't very std." | |
7728 | fi | |
7729 | else | |
7730 | echo "Your stdio doesn't appear very std." | |
7731 | fi | |
7732 | $rm -f try.c try | |
7733 | set d_stdstdio | |
7734 | eval $setvar | |
7735 | ||
8e07c86e | 7736 | : Can _ptr be used as an lvalue? |
e50aee73 AD |
7737 | case "$d_stdstdio$ptr_lval" in |
7738 | $define$define) val=$define ;; | |
c2960299 AD |
7739 | *) val=$undef ;; |
7740 | esac | |
7741 | set d_stdio_ptr_lval | |
7742 | eval $setvar | |
7743 | ||
8e07c86e | 7744 | : Can _cnt be used as an lvalue? |
e50aee73 AD |
7745 | case "$d_stdstdio$cnt_lval" in |
7746 | $define$define) val=$define ;; | |
c2960299 AD |
7747 | *) val=$undef ;; |
7748 | esac | |
7749 | set d_stdio_cnt_lval | |
7750 | eval $setvar | |
7751 | ||
8ff267be | 7752 | |
16d20bd9 AD |
7753 | : see if _base is also standard |
7754 | val="$undef" | |
7755 | case "$d_stdstdio" in | |
7756 | $define) | |
7757 | $cat >try.c <<EOP | |
7758 | #include <stdio.h> | |
7759 | #define FILE_base(fp) $stdio_base | |
7760 | #define FILE_bufsiz(fp) $stdio_bufsiz | |
8ff267be | 7761 | main() { |
16d20bd9 AD |
7762 | FILE *fp = fopen("try.c", "r"); |
7763 | char c = getc(fp); | |
7764 | if ( | |
7765 | 19 <= FILE_bufsiz(fp) && | |
7766 | strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0 | |
7767 | ) | |
7768 | exit(0); | |
7769 | exit(1); | |
7770 | } | |
7771 | EOP | |
7772 | if $cc $ccflags $ldflags -o try try.c $libs > /dev/null 2>&1; then | |
7773 | if ./try; then | |
8ff267be | 7774 | echo "And its _base field acts std." |
16d20bd9 AD |
7775 | val="$define" |
7776 | else | |
7777 | echo "But its _base field isn't std." | |
7778 | fi | |
7779 | else | |
7780 | echo "However, it seems to be lacking the _base field." | |
7781 | fi | |
7782 | $rm -f try.c try | |
7783 | ;; | |
7784 | esac | |
7785 | set d_stdiobase | |
7786 | eval $setvar | |
7787 | ||
a0d0e21e LW |
7788 | : see if strcoll exists |
7789 | set strcoll d_strcoll | |
7790 | eval $inlibc | |
2304df62 AD |
7791 | |
7792 | : check for structure copying | |
7793 | echo " " | |
7794 | echo "Checking to see if your C compiler can copy structs..." >&4 | |
7795 | $cat >try.c <<'EOCP' | |
7796 | main() | |
7797 | { | |
7798 | struct blurfl { | |
7799 | int dyick; | |
7800 | } foo, bar; | |
7801 | ||
7802 | foo = bar; | |
7803 | } | |
7804 | EOCP | |
7805 | if $cc -c try.c >/dev/null 2>&1 ; then | |
7806 | val="$define" | |
7807 | echo "Yup, it can." | |
7808 | else | |
7809 | val="$undef" | |
7810 | echo "Nope, it can't." | |
7811 | fi | |
7812 | set d_strctcpy | |
7813 | eval $setvar | |
7814 | $rm -f try.* | |
7815 | ||
7816 | : see if strerror and/or sys_errlist[] exist | |
7817 | echo " " | |
7818 | if set strerror val -f d_strerror; eval $csym; $val; then | |
7819 | echo 'strerror() found.' >&4 | |
7820 | d_strerror="$define" | |
a0d0e21e | 7821 | d_strerrm='strerror(e)' |
2304df62 AD |
7822 | if set sys_errlist val -a d_syserrlst; eval $csym; $val; then |
7823 | echo "(You also have sys_errlist[], so we could roll our own strerror.)" | |
7824 | d_syserrlst="$define" | |
7825 | else | |
7826 | echo "(Since you don't have sys_errlist[], sterror() is welcome.)" | |
7827 | d_syserrlst="$undef" | |
7828 | fi | |
7829 | elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \ | |
7830 | $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then | |
7831 | echo 'strerror() found in string header.' >&4 | |
7832 | d_strerror="$define" | |
a0d0e21e | 7833 | d_strerrm='strerror(e)' |
2304df62 AD |
7834 | if set sys_errlist val -a d_syserrlst; eval $csym; $val; then |
7835 | echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)" | |
7836 | d_syserrlst="$define" | |
7837 | else | |
7838 | echo "(You don't appear to have any sys_errlist[], how can this be?)" | |
7839 | d_syserrlst="$undef" | |
7840 | fi | |
7841 | elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then | |
7842 | echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4 | |
7843 | d_strerror="$undef" | |
7844 | d_syserrlst="$define" | |
a0d0e21e | 7845 | d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])' |
2304df62 AD |
7846 | else |
7847 | echo 'strerror() and sys_errlist[] NOT found.' >&4 | |
7848 | d_strerror="$undef" | |
7849 | d_syserrlst="$undef" | |
a0d0e21e | 7850 | d_strerrm='"unknown"' |
2304df62 AD |
7851 | fi |
7852 | ||
a89d8a78 DH |
7853 | : see if strtod exists |
7854 | set strtod d_strtod | |
7855 | eval $inlibc | |
7856 | ||
7857 | : see if strtol exists | |
7858 | set strtol d_strtol | |
7859 | eval $inlibc | |
7860 | ||
7861 | : see if strtoul exists | |
7862 | set strtoul d_strtoul | |
7863 | eval $inlibc | |
7864 | ||
a0d0e21e LW |
7865 | : see if strxfrm exists |
7866 | set strxfrm d_strxfrm | |
7867 | eval $inlibc | |
7868 | ||
2304df62 AD |
7869 | : see if symlink exists |
7870 | set symlink d_symlink | |
7871 | eval $inlibc | |
7872 | ||
7873 | : see if syscall exists | |
7874 | set syscall d_syscall | |
7875 | eval $inlibc | |
7876 | ||
a0d0e21e LW |
7877 | : see if sysconf exists |
7878 | set sysconf d_sysconf | |
7879 | eval $inlibc | |
7880 | ||
2304df62 AD |
7881 | : see if system exists |
7882 | set system d_system | |
7883 | eval $inlibc | |
7884 | ||
a0d0e21e LW |
7885 | : see if tcgetpgrp exists |
7886 | set tcgetpgrp d_tcgetpgrp | |
7887 | eval $inlibc | |
7888 | ||
2c7991dc | 7889 | : see if tcsetpgrp exists |
7890 | set tcsetpgrp d_tcsetpgrp | |
7891 | eval $inlibc | |
4633a7c4 | 7892 | |
2c7991dc | 7893 | : define an is-a-typedef? function |
7894 | typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@; | |
7895 | case "$inclist" in | |
7896 | "") inclist="sys/types.h";; | |
7897 | esac; | |
7898 | eval "varval=\$$var"; | |
7899 | case "$varval" in | |
7900 | "") | |
7901 | $rm -f temp.c; | |
7902 | for inc in $inclist; do | |
7903 | echo "#include <$inc>" >>temp.c; | |
7904 | done; | |
7905 | $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null; | |
7906 | if $contains $type temp.E >/dev/null 2>&1; then | |
7907 | eval "$var=\$type"; | |
7908 | else | |
7909 | eval "$var=\$def"; | |
7910 | fi; | |
7911 | $rm -f temp.?;; | |
7912 | *) eval "$var=\$varval";; | |
7913 | esac' | |
4633a7c4 | 7914 | |
2c7991dc | 7915 | : see if this is a sys/times.h system |
7916 | set sys/times.h i_systimes | |
7917 | eval $inhdr | |
4633a7c4 | 7918 | |
2c7991dc | 7919 | : see if times exists |
4633a7c4 | 7920 | echo " " |
2c7991dc | 7921 | if set times val -f d_times; eval $csym; $val; then |
7922 | echo 'times() found.' >&4 | |
7923 | d_times="$define" | |
7924 | inc='' | |
7925 | case "$i_systimes" in | |
7926 | "$define") inc='sys/times.h';; | |
7927 | esac | |
7928 | set clock_t clocktype long stdio.h sys/types.h $inc | |
7929 | eval $typedef | |
7930 | dflt="$clocktype" | |
7931 | echo " " | |
7932 | rp="What type is returned by times() on this system?" | |
7933 | . ./myread | |
7934 | clocktype="$ans" | |
7935 | else | |
7936 | echo 'times() NOT found, hope that will do.' >&4 | |
7937 | d_times="$undef" | |
7938 | clocktype='int' | |
7939 | fi | |
2304df62 | 7940 | |
2c7991dc | 7941 | : see if truncate exists |
7942 | set truncate d_truncate | |
7943 | eval $inlibc | |
2304df62 | 7944 | |
2c7991dc | 7945 | : see if tzname[] exists |
7946 | echo " " | |
7947 | if set tzname val -a d_tzname; eval $csym; $val; then | |
7948 | val="$define" | |
7949 | echo 'tzname[] found.' >&4 | |
7950 | else | |
7951 | val="$undef" | |
7952 | echo 'tzname[] NOT found.' >&4 | |
7953 | fi | |
7954 | set d_tzname | |
7955 | eval $setvar | |
7956 | ||
7957 | : see if umask exists | |
7958 | set umask d_umask | |
7959 | eval $inlibc | |
85e6fe83 | 7960 | |
4633a7c4 | 7961 | : see how we will look up host name |
a0d0e21e | 7962 | echo " " |
4633a7c4 LW |
7963 | if false; then |
7964 | : dummy stub to allow use of elif | |
7965 | elif set uname val -f d_uname; eval $csym; $val; then | |
7966 | if ./xenix; then | |
7967 | $cat <<'EOM' | |
7968 | uname() was found, but you're running xenix, and older versions of xenix | |
7969 | have a broken uname(). If you don't really know whether your xenix is old | |
7970 | enough to have a broken system call, use the default answer. | |
7971 | ||
85e6fe83 | 7972 | EOM |
4633a7c4 LW |
7973 | dflt=y |
7974 | case "$d_uname" in | |
7975 | "$define") dflt=n;; | |
7976 | esac | |
7977 | rp='Is your uname() broken?' | |
7978 | . ./myread | |
7979 | case "$ans" in | |
7980 | n*) d_uname="$define"; call=uname;; | |
7981 | esac | |
7982 | else | |
7983 | echo 'uname() found.' >&4 | |
7984 | d_uname="$define" | |
7985 | call=uname | |
7986 | fi | |
a0d0e21e | 7987 | fi |
4633a7c4 LW |
7988 | case "$d_gethname" in |
7989 | '') d_gethname="$undef";; | |
7990 | esac | |
7991 | case "$d_uname" in | |
7992 | '') d_uname="$undef";; | |
7993 | esac | |
7994 | case "$d_phostname" in | |
7995 | '') d_phostname="$undef";; | |
7996 | esac | |
ecfc5424 | 7997 | |
4633a7c4 LW |
7998 | : backward compatibility for d_hvfork |
7999 | if test X$d_hvfork != X; then | |
8000 | d_vfork="$d_hvfork" | |
8001 | d_hvfork='' | |
8002 | fi | |
8003 | : see if there is a vfork | |
8004 | val='' | |
8005 | set vfork val | |
8006 | eval $inlibc | |
ecfc5424 | 8007 | |
4633a7c4 LW |
8008 | : Ok, but do we want to use it. vfork is reportedly unreliable in |
8009 | : perl on Solaris 2.x, and probably elsewhere. | |
8010 | case "$val" in | |
8011 | $define) | |
16d20bd9 | 8012 | echo " " |
4633a7c4 LW |
8013 | case "$usevfork" in |
8014 | false) dflt='n';; | |
8015 | *) dflt='y';; | |
8016 | esac | |
8017 | rp="Some systems have problems with vfork(). Do you want to use it?" | |
8018 | . ./myread | |
8019 | case "$ans" in | |
8020 | y|Y) ;; | |
8021 | *) | |
8022 | echo "Ok, we won't use vfork()." | |
8023 | val="$undef" | |
8024 | ;; | |
8025 | esac | |
ecfc5424 AD |
8026 | ;; |
8027 | esac | |
4633a7c4 LW |
8028 | set d_vfork |
8029 | eval $setvar | |
8030 | case "$d_vfork" in | |
8031 | $define) usevfork='true';; | |
8032 | *) usevfork='false';; | |
8033 | esac | |
ecfc5424 | 8034 | |
4633a7c4 LW |
8035 | : see if this is an sysdir system |
8036 | set sys/dir.h i_sysdir | |
8037 | eval $inhdr | |
8038 | ||
8039 | : see if this is an sysndir system | |
8040 | set sys/ndir.h i_sysndir | |
8041 | eval $inhdr | |
8042 | ||
8043 | : see if closedir exists | |
8044 | set closedir d_closedir | |
8045 | eval $inlibc | |
8046 | ||
8047 | case "$d_closedir" in | |
8048 | "$define") | |
16d20bd9 | 8049 | echo " " |
4633a7c4 LW |
8050 | echo "Checking whether closedir() returns a status..." >&4 |
8051 | cat > closedir.c <<EOM | |
8052 | #$i_dirent I_DIRENT /**/ | |
8053 | #$i_sysdir I_SYS_DIR /**/ | |
8054 | #$i_sysndir I_SYS_NDIR /**/ | |
8055 | ||
8056 | #if defined(I_DIRENT) | |
8057 | #include <dirent.h> | |
8058 | #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */ | |
8059 | #include <sys/dir.h> | |
4aa0a1f7 | 8060 | #endif |
4633a7c4 LW |
8061 | #else |
8062 | #ifdef I_SYS_NDIR | |
8063 | #include <sys/ndir.h> | |
8064 | #else | |
8065 | #ifdef I_SYS_DIR | |
8066 | #ifdef hp9000s500 | |
8067 | #include <ndir.h> /* may be wrong in the future */ | |
8068 | #else | |
8069 | #include <sys/dir.h> | |
8070 | #endif | |
8071 | #endif | |
8072 | #endif | |
8073 | #endif | |
8074 | int main() { return closedir(opendir(".")); } | |
8075 | EOM | |
8076 | if $cc $ccflags $ldflags -o closedir closedir.c $libs > /dev/null 2>&1; then | |
8077 | if ./closedir > /dev/null 2>&1 ; then | |
8078 | echo "Yes, it does." | |
8079 | val="$undef" | |
ecfc5424 | 8080 | else |
4633a7c4 LW |
8081 | echo "No, it doesn't." |
8082 | val="$define" | |
ecfc5424 AD |
8083 | fi |
8084 | else | |
4633a7c4 LW |
8085 | echo "(I can't seem to compile the test program--assuming it doesn't)" |
8086 | val="$define" | |
ecfc5424 | 8087 | fi |
ecfc5424 | 8088 | ;; |
4633a7c4 LW |
8089 | *) |
8090 | val="$undef"; | |
ecfc5424 AD |
8091 | ;; |
8092 | esac | |
4633a7c4 LW |
8093 | set d_void_closedir |
8094 | eval $setvar | |
8095 | $rm -f closedir* | |
8096 | : check for volatile keyword | |
ecfc5424 | 8097 | echo " " |
4633a7c4 LW |
8098 | echo 'Checking to see if your C compiler knows about "volatile"...' >&4 |
8099 | $cat >try.c <<'EOCP' | |
8100 | main() | |
8101 | { | |
8102 | typedef struct _goo_struct goo_struct; | |
8103 | goo_struct * volatile goo = ((goo_struct *)0); | |
8104 | struct _goo_struct { | |
8105 | long long_int; | |
8106 | int reg_int; | |
8107 | char char_var; | |
8108 | }; | |
8109 | typedef unsigned short foo_t; | |
8110 | char *volatile foo; | |
8111 | volatile int bar; | |
8112 | volatile foo_t blech; | |
8113 | foo = foo; | |
a0d0e21e LW |
8114 | } |
8115 | EOCP | |
4633a7c4 LW |
8116 | if $cc -c $ccflags try.c >/dev/null 2>&1 ; then |
8117 | val="$define" | |
8118 | echo "Yup, it does." | |
8119 | else | |
8120 | val="$undef" | |
8121 | echo "Nope, it doesn't." | |
8122 | fi | |
8123 | set d_volatile | |
8124 | eval $setvar | |
8125 | $rm -f try.* | |
a0d0e21e | 8126 | |
4633a7c4 LW |
8127 | : see if there is a wait4 |
8128 | set wait4 d_wait4 | |
8e07c86e AD |
8129 | eval $inlibc |
8130 | ||
4633a7c4 LW |
8131 | : see if waitpid exists |
8132 | set waitpid d_waitpid | |
8133 | eval $inlibc | |
8134 | ||
8135 | : see if wcstombs exists | |
8136 | set wcstombs d_wcstombs | |
8137 | eval $inlibc | |
8138 | ||
8139 | : see if wctomb exists | |
8140 | set wctomb d_wctomb | |
8141 | eval $inlibc | |
8142 | ||
8143 | : preserve RCS keywords in files with variable substitution, grrr | |
8144 | Date='$Date' | |
8145 | Id='$Id' | |
8146 | Log='$Log' | |
8147 | RCSfile='$RCSfile' | |
8148 | Revision='$Revision' | |
8149 | ||
8150 | : check for alignment requirements | |
8151 | echo " " | |
8152 | case "$alignbytes" in | |
8153 | '') echo "Checking alignment constraints..." >&4 | |
8154 | $cat >try.c <<'EOCP' | |
8155 | struct foobar { | |
8156 | char foo; | |
8157 | double bar; | |
8158 | } try; | |
8159 | main() | |
8160 | { | |
8161 | printf("%d\n", (char *)&try.bar - (char *)&try.foo); | |
8162 | } | |
8163 | EOCP | |
8164 | if $cc $ccflags try.c -o try >/dev/null 2>&1; then | |
8165 | dflt=`./try` | |
8166 | else | |
8167 | dflt='8' | |
41992daf | 8168 | echo "(I can't seem to compile the test program...)" |
4633a7c4 | 8169 | fi |
ecfc5424 | 8170 | ;; |
4633a7c4 | 8171 | *) dflt="$alignbytes" |
8e07c86e | 8172 | ;; |
ecfc5424 | 8173 | esac |
4633a7c4 LW |
8174 | rp="Doubles must be aligned on a how-many-byte boundary?" |
8175 | . ./myread | |
8176 | alignbytes="$ans" | |
8177 | $rm -f try.c try | |
85e6fe83 | 8178 | |
4633a7c4 LW |
8179 | : check for ordering of bytes in a long |
8180 | case "$byteorder" in | |
8181 | '') | |
8182 | $cat <<'EOM' | |
8183 | ||
8184 | In the following, larger digits indicate more significance. A big-endian | |
8185 | machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A | |
8186 | little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other | |
8187 | machines may have weird orders like 3412. A Cray will report 87654321. If | |
8188 | the test program works the default is probably right. | |
8189 | I'm now running the test program... | |
8190 | EOM | |
8191 | $cat >try.c <<'EOCP' | |
8192 | #include <stdio.h> | |
8193 | main() | |
8194 | { | |
8195 | int i; | |
8196 | union { | |
8197 | unsigned long l; | |
8198 | char c[sizeof(long)]; | |
8199 | } u; | |
8200 | ||
8201 | if (sizeof(long) > 4) | |
8202 | u.l = (0x08070605L << 32) | 0x04030201L; | |
8203 | else | |
8204 | u.l = 0x04030201L; | |
8205 | for (i = 0; i < sizeof(long); i++) | |
8206 | printf("%c", u.c[i]+'0'); | |
8207 | printf("\n"); | |
8208 | exit(0); | |
8209 | } | |
8210 | EOCP | |
8211 | xxx_prompt=y | |
8212 | if $cc $ccflags try.c -o try >/dev/null 2>&1 && ./try > /dev/null; then | |
8213 | dflt=`./try` | |
8214 | case "$dflt" in | |
8215 | [1-4][1-4][1-4][1-4]|12345678|87654321) | |
8216 | echo "(The test program ran ok.)" | |
8217 | echo "byteorder=$dflt" | |
8218 | xxx_prompt=n | |
8219 | ;; | |
8220 | ????|????????) echo "(The test program ran ok.)" ;; | |
8221 | *) echo "(The test program didn't run right for some reason.)" ;; | |
8222 | esac | |
8223 | else | |
8224 | dflt='4321' | |
8225 | cat <<'EOM' | |
8226 | (I can't seem to compile the test program. Guessing big-endian...) | |
8227 | EOM | |
8228 | fi | |
8229 | case "$xxx_prompt" in | |
8230 | y) | |
8231 | rp="What is the order of bytes in a long?" | |
8232 | . ./myread | |
8233 | byteorder="$ans" | |
8234 | ;; | |
8235 | *) byteorder=$dflt | |
ecfc5424 AD |
8236 | ;; |
8237 | esac | |
8238 | ;; | |
8239 | esac | |
4633a7c4 | 8240 | $rm -f try.c try |
85e6fe83 | 8241 | |
4633a7c4 | 8242 | : how do we catenate cpp tokens here? |
2304df62 | 8243 | echo " " |
4633a7c4 LW |
8244 | echo "Checking to see how your cpp does stuff like catenate tokens..." >&4 |
8245 | $cat >cpp_stuff.c <<'EOCP' | |
8246 | #define RCAT(a,b)a/**/b | |
8247 | #define ACAT(a,b)a ## b | |
8248 | RCAT(Rei,ser) | |
8249 | ACAT(Cir,cus) | |
8250 | EOCP | |
8251 | $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1 | |
8252 | if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then | |
8253 | echo "Oh! Smells like ANSI's been here." | |
8254 | echo "We can catify or stringify, separately or together!" | |
8255 | cpp_stuff=42 | |
8256 | elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then | |
8257 | echo "Ah, yes! The good old days!" | |
8258 | echo "However, in the good old days we don't know how to stringify and" | |
8259 | echo "catify at the same time." | |
8260 | cpp_stuff=1 | |
8261 | else | |
8262 | $cat >&4 <<EOM | |
8263 | Hmm, I don't seem to be able to catenate tokens with your cpp. You're going | |
8264 | to have to edit the values of CAT[2-5] in config.h... | |
a0d0e21e | 8265 | EOM |
4633a7c4 LW |
8266 | cpp_stuff="/* Help! How do we handle cpp_stuff? */*/" |
8267 | fi | |
8268 | $rm -f cpp_stuff.* | |
a0d0e21e | 8269 | |
4633a7c4 LW |
8270 | : see if this is a db.h system |
8271 | set db.h i_db | |
8272 | eval $inhdr | |
8273 | ||
8274 | case "$i_db" in | |
68dc0745 | 8275 | $define) |
1f70e1ea | 8276 | : Check db version. |
68dc0745 | 8277 | echo " " |
8278 | echo "Checking Berkeley DB version ..." >&4 | |
8279 | $cat >try.c <<EOCP | |
8280 | #$d_const HASCONST | |
8281 | #ifndef HASCONST | |
8282 | #define const | |
8283 | #endif | |
8284 | #include <sys/types.h> | |
8285 | #include <stdio.h> | |
8286 | #include <db.h> | |
8287 | main() | |
8288 | { | |
1f70e1ea PM |
8289 | #ifdef DB_VERSION_MAJOR /* DB version >= 2 */ |
8290 | int Major, Minor, Patch ; | |
8291 | (void)db_version(&Major, &Minor, &Patch) ; | |
8292 | printf("You have Berkeley DB Version 2 or greater\n"); | |
8293 | ||
8294 | printf("db.h is from Berkeley DB Version %d.%d.%d\n", | |
8295 | DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH); | |
8296 | printf("libdb is from Berkeley DB Version %d.%d.%d\n", | |
8297 | Major, Minor, Patch) ; | |
8298 | ||
8299 | /* check that db.h & libdb are compatible */ | |
8300 | if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) { | |
8301 | printf("db.h and libdb are incompatible\n") ; | |
8302 | exit(3); | |
8303 | } | |
8304 | ||
8305 | printf("db.h and libdb are compatible\n") ; | |
8306 | /* needs to be >= 2.05 */ | |
8307 | if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { | |
8308 | printf("but Perl needs Berkeley DB 2.0.5 or greater\n") ; | |
8309 | exit(2); | |
8310 | } | |
8311 | ||
8312 | exit(0); | |
68dc0745 | 8313 | #else |
6a1b87e5 | 8314 | #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC) |
1f70e1ea | 8315 | printf("You have Berkeley DB Version 1\n"); |
6a1b87e5 JH |
8316 | exit(0); /* DB version < 2: the coast is clear. */ |
8317 | #else | |
8318 | exit(1); /* <db.h> not Berkeley DB? */ | |
8319 | #endif | |
68dc0745 | 8320 | #endif |
8321 | } | |
8322 | EOCP | |
8323 | if $cc $optimize $ccflags $ldflags -o try try.c $libs && ./try; then | |
1f70e1ea | 8324 | echo 'Looks OK.' >&4 |
68dc0745 | 8325 | else |
c90c0ff4 | 8326 | echo "I can't use Berkeley DB with your <db.h>. I'll disable Berkeley DB." >&4 |
68dc0745 | 8327 | i_db=$undef |
8328 | case " $libs " in | |
8329 | *"-ldb "*) | |
8330 | : Remove db from list of libraries to use | |
8331 | echo "Removing unusable -ldb from library list" >&4 | |
8332 | set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'` | |
8333 | shift | |
8334 | libs="$*" | |
8335 | echo "libs = $libs" >&4 | |
8336 | ;; | |
8337 | esac | |
8338 | fi | |
8339 | $rm -f try.* | |
8340 | ;; | |
8341 | esac | |
8342 | ||
8343 | case "$i_db" in | |
4633a7c4 LW |
8344 | define) |
8345 | : Check the return type needed for hash | |
8346 | echo " " | |
8347 | echo "Checking return type needed for hash for Berkeley DB ..." >&4 | |
8348 | $cat >try.c <<EOCP | |
8349 | #$d_const HASCONST | |
8350 | #ifndef HASCONST | |
8351 | #define const | |
8352 | #endif | |
8353 | #include <sys/types.h> | |
8354 | #include <db.h> | |
1f70e1ea PM |
8355 | |
8356 | #ifndef DB_VERSION_MAJOR | |
4633a7c4 LW |
8357 | u_int32_t hash_cb (ptr, size) |
8358 | const void *ptr; | |
8359 | size_t size; | |
8360 | { | |
8361 | } | |
8362 | HASHINFO info; | |
8363 | main() | |
8364 | { | |
8365 | info.hash = hash_cb; | |
8366 | } | |
1f70e1ea | 8367 | #endif |
4633a7c4 LW |
8368 | EOCP |
8369 | if $cc $ccflags -c try.c >try.out 2>&1 ; then | |
8370 | if $contains warning try.out >>/dev/null 2>&1 ; then | |
8371 | db_hashtype='int' | |
8372 | else | |
8373 | db_hashtype='u_int32_t' | |
8374 | fi | |
8375 | else | |
68dc0745 | 8376 | : XXX Maybe we should just give up here. |
8377 | db_hashtype=u_int32_t | |
8378 | echo "Help: I can't seem to compile the db test program." >&4 | |
8379 | echo "Something's wrong, but I'll assume you use $db_hashtype." >&4 | |
4633a7c4 LW |
8380 | fi |
8381 | $rm -f try.* | |
8382 | echo "Your version of Berkeley DB uses $db_hashtype for hash." | |
8383 | ;; | |
68dc0745 | 8384 | *) db_hashtype=u_int32_t |
4633a7c4 LW |
8385 | ;; |
8386 | esac | |
a0d0e21e | 8387 | |
4633a7c4 LW |
8388 | case "$i_db" in |
8389 | define) | |
8390 | : Check the return type needed for prefix | |
8391 | echo " " | |
8392 | echo "Checking return type needed for prefix for Berkeley DB ..." >&4 | |
8393 | cat >try.c <<EOCP | |
8394 | #$d_const HASCONST | |
8395 | #ifndef HASCONST | |
8396 | #define const | |
8397 | #endif | |
8398 | #include <sys/types.h> | |
8399 | #include <db.h> | |
1f70e1ea PM |
8400 | |
8401 | #ifndef DB_VERSION_MAJOR | |
4633a7c4 LW |
8402 | size_t prefix_cb (key1, key2) |
8403 | const DBT *key1; | |
8404 | const DBT *key2; | |
8405 | { | |
8406 | } | |
8407 | BTREEINFO info; | |
8408 | main() | |
8409 | { | |
8410 | info.prefix = prefix_cb; | |
8411 | } | |
1f70e1ea | 8412 | #endif |
4633a7c4 LW |
8413 | EOCP |
8414 | if $cc $ccflags -c try.c >try.out 2>&1 ; then | |
8415 | if $contains warning try.out >>/dev/null 2>&1 ; then | |
8416 | db_prefixtype='int' | |
8417 | else | |
8418 | db_prefixtype='size_t' | |
8419 | fi | |
8420 | else | |
68dc0745 | 8421 | db_prefixtype='size_t' |
8422 | : XXX Maybe we should just give up here. | |
8423 | echo "Help: I can't seem to compile the db test program." >&4 | |
8424 | echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4 | |
4633a7c4 LW |
8425 | fi |
8426 | $rm -f try.* | |
8427 | echo "Your version of Berkeley DB uses $db_prefixtype for prefix." | |
a0d0e21e | 8428 | ;; |
68dc0745 | 8429 | *) db_prefixtype='size_t' |
4633a7c4 LW |
8430 | ;; |
8431 | esac | |
a0d0e21e | 8432 | |
4633a7c4 LW |
8433 | : check for void type |
8434 | echo " " | |
8435 | echo "Checking to see how well your C compiler groks the void type..." >&4 | |
8436 | echo " " | |
8437 | $cat >&4 <<EOM | |
8438 | Support flag bits are: | |
8439 | 1: basic void declarations. | |
8440 | 2: arrays of pointers to functions returning void. | |
8441 | 4: operations between pointers to and addresses of void functions. | |
8442 | 8: generic void pointers. | |
a0d0e21e | 8443 | EOM |
4633a7c4 LW |
8444 | echo " " |
8445 | case "$voidflags" in | |
8446 | '') | |
8447 | $cat >try.c <<'EOCP' | |
8448 | #if TRY & 1 | |
760ac839 | 8449 | void sub() { |
4633a7c4 | 8450 | #else |
760ac839 | 8451 | sub() { |
4633a7c4 LW |
8452 | #endif |
8453 | extern void moo(); /* function returning void */ | |
8454 | void (*goo)(); /* ptr to func returning void */ | |
8455 | #if TRY & 8 | |
8456 | void *hue; /* generic ptr */ | |
8457 | #endif | |
8458 | #if TRY & 2 | |
8459 | void (*foo[10])(); | |
8460 | #endif | |
a0d0e21e | 8461 | |
4633a7c4 LW |
8462 | #if TRY & 4 |
8463 | if(goo == moo) { | |
8464 | exit(0); | |
8465 | } | |
8466 | #endif | |
8467 | exit(0); | |
8468 | } | |
760ac839 | 8469 | main() { sub(); } |
4633a7c4 | 8470 | EOCP |
760ac839 | 8471 | if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then |
4633a7c4 LW |
8472 | voidflags=$defvoidused |
8473 | echo "It appears to support void to the level $package wants ($defvoidused)." | |
8474 | if $contains warning .out >/dev/null 2>&1; then | |
8475 | echo "However, you might get some warnings that look like this:" | |
8476 | $cat .out | |
8477 | fi | |
8478 | else | |
8479 | echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4 | |
760ac839 | 8480 | if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then |
4633a7c4 | 8481 | echo "It supports 1..." |
760ac839 | 8482 | if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then |
4633a7c4 | 8483 | echo "It also supports 2..." |
760ac839 | 8484 | if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then |
4633a7c4 LW |
8485 | voidflags=7 |
8486 | echo "And it supports 4 but not 8 definitely." | |
8487 | else | |
8488 | echo "It doesn't support 4..." | |
760ac839 | 8489 | if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then |
4633a7c4 LW |
8490 | voidflags=11 |
8491 | echo "But it supports 8." | |
8492 | else | |
8493 | voidflags=3 | |
8494 | echo "Neither does it support 8." | |
8495 | fi | |
8496 | fi | |
8497 | else | |
8498 | echo "It does not support 2..." | |
760ac839 | 8499 | if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then |
4633a7c4 LW |
8500 | voidflags=13 |
8501 | echo "But it supports 4 and 8." | |
8502 | else | |
760ac839 | 8503 | if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then |
4633a7c4 LW |
8504 | voidflags=5 |
8505 | echo "And it supports 4 but has not heard about 8." | |
8506 | else | |
8507 | echo "However it supports 8 but not 4." | |
8508 | fi | |
8509 | fi | |
8510 | fi | |
8511 | else | |
8512 | echo "There is no support at all for void." | |
8513 | voidflags=0 | |
8514 | fi | |
8515 | fi | |
8516 | esac | |
2c7991dc | 8517 | : Only prompt user if support does not match the level we want |
4633a7c4 | 8518 | case "$voidflags" in |
2c7991dc | 8519 | "$defvoidused") ;; |
8520 | *) | |
8521 | dflt="$voidflags"; | |
4633a7c4 | 8522 | rp="Your void support flags add up to what?" |
a0d0e21e | 8523 | . ./myread |
4633a7c4 | 8524 | voidflags="$ans" |
a0d0e21e LW |
8525 | ;; |
8526 | esac | |
4633a7c4 | 8527 | $rm -f try.* .out |
a0d0e21e LW |
8528 | |
8529 | : see what type file positions are declared as in the library | |
8530 | set fpos_t fpostype long stdio.h sys/types.h | |
8531 | eval $typedef | |
8532 | echo " " | |
8533 | dflt="$fpostype" | |
8534 | rp="What is the type for file position used by fsetpos()?" | |
2304df62 | 8535 | . ./myread |
a0d0e21e | 8536 | fpostype="$ans" |
2304df62 | 8537 | |
1aef975c AD |
8538 | : Store the full pathname to the sed program for use in the C program |
8539 | full_sed=$sed | |
8540 | ||
2304df62 | 8541 | : see what type gids are declared as in the kernel |
a0d0e21e LW |
8542 | set gid_t gidtype xxx stdio.h sys/types.h |
8543 | eval $typedef | |
2304df62 | 8544 | case "$gidtype" in |
a0d0e21e LW |
8545 | xxx) |
8546 | xxx=`./findhdr sys/user.h` | |
8547 | set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short | |
8548 | case $1 in | |
8549 | unsigned) dflt="$1 $2" ;; | |
8550 | *) dflt="$1" ;; | |
8551 | esac | |
2304df62 | 8552 | ;; |
a0d0e21e | 8553 | *) dflt="$gidtype";; |
2304df62 AD |
8554 | esac |
8555 | echo " " | |
8556 | rp="What is the type for group ids returned by getgid()?" | |
8557 | . ./myread | |
a0d0e21e LW |
8558 | gidtype="$ans" |
8559 | ||
2304df62 AD |
8560 | : see if getgroups exists |
8561 | set getgroups d_getgrps | |
8562 | eval $inlibc | |
8563 | ||
5cd24f17 | 8564 | : see if setgroups exists |
8565 | set setgroups d_setgrps | |
8566 | eval $inlibc | |
8567 | ||
8cc95fdb | 8568 | : Find type of 2nd arg to 'getgroups()' and 'setgroups()' |
a0d0e21e | 8569 | echo " " |
5cd24f17 | 8570 | case "$d_getgrps$d_setgrps" in |
8571 | *define*) | |
a0d0e21e | 8572 | case "$groupstype" in |
2304df62 AD |
8573 | '') dflt="$gidtype" ;; |
8574 | *) dflt="$groupstype" ;; | |
a0d0e21e LW |
8575 | esac |
8576 | $cat <<EOM | |
5cd24f17 | 8577 | What is the type of the second argument to getgroups() and setgroups()? |
8578 | Usually this is the same as group ids, $gidtype, but not always. | |
2304df62 AD |
8579 | |
8580 | EOM | |
5cd24f17 | 8581 | rp='What type is the second argument to getgroups() and setgroups()?' |
a0d0e21e LW |
8582 | . ./myread |
8583 | groupstype="$ans" | |
8584 | ;; | |
8585 | *) groupstype="$gidtype";; | |
2304df62 | 8586 | esac |
2304df62 | 8587 | |
85e6fe83 | 8588 | : see what type lseek is declared as in the kernel |
a0d0e21e LW |
8589 | set off_t lseektype long stdio.h sys/types.h |
8590 | eval $typedef | |
2304df62 | 8591 | echo " " |
a0d0e21e | 8592 | dflt="$lseektype" |
85e6fe83 LW |
8593 | rp="What type is lseek's offset on this system declared as?" |
8594 | . ./myread | |
8595 | lseektype="$ans" | |
2304df62 | 8596 | |
8ff267be | 8597 | echo " " |
8598 | case "$make" in | |
8599 | '') | |
8600 | make=`./loc make make $pth` | |
8601 | case "$make" in | |
8602 | /*) echo make is in $make. ;; | |
8603 | ?:[\\/]*) echo make is in $make. ;; | |
8604 | *) echo "I don't know where 'make' is, and my life depends on it." >&4 | |
8605 | echo "Go find a make program or fix your PATH setting!" >&4 | |
8606 | exit 1 | |
8607 | ;; | |
8608 | esac | |
8609 | ;; | |
8610 | *) echo make is in $make. ;; | |
8611 | esac | |
8612 | ||
8613 | $echo $n "Checking if your $make program sets \$(MAKE)... $c" >&4 | |
8614 | case "$make_set_make" in | |
8615 | '') | |
8616 | $sed 's/^X //' > testmake.mak << 'EOF' | |
8617 | Xall: | |
8618 | X @echo 'ac_maketemp="$(MAKE)"' | |
8619 | EOF | |
8620 | : GNU make sometimes prints "make[1]: Entering...", which would confuse us. | |
8621 | case "`$make -f testmake.mak 2>/dev/null`" in | |
8622 | *ac_maketemp=*) make_set_make='#' ;; | |
8623 | *) make_set_make="MAKE=$make" ;; | |
8624 | esac | |
8625 | $rm -f testmake.mak | |
8626 | ;; | |
8627 | esac | |
8628 | case "$make_set_make" in | |
8629 | '#') echo "Yup, it does." >&4 ;; | |
8630 | *) echo "Nope, it doesn't." >&4 ;; | |
8631 | esac | |
8632 | ||
a0d0e21e LW |
8633 | : see what type is used for mode_t |
8634 | set mode_t modetype int stdio.h sys/types.h | |
8635 | eval $typedef | |
8636 | dflt="$modetype" | |
85e6fe83 | 8637 | echo " " |
a0d0e21e | 8638 | rp="What type is used for file modes?" |
85e6fe83 | 8639 | . ./myread |
a0d0e21e | 8640 | modetype="$ans" |
85e6fe83 | 8641 | |
2c7991dc | 8642 | : locate the preferred pager for this system |
8643 | case "$pager" in | |
8644 | '') | |
8645 | dflt='' | |
8646 | case "$pg" in | |
8647 | /*) dflt=$pg;; | |
8648 | esac | |
8649 | case "$more" in | |
8650 | /*) dflt=$more;; | |
8651 | esac | |
8652 | case "$less" in | |
8653 | /*) dflt=$less;; | |
8654 | esac | |
8655 | case "$dflt" in | |
8656 | '') dflt=/usr/ucb/more;; | |
8657 | esac | |
8658 | ;; | |
8659 | *) dflt="$pager";; | |
8660 | esac | |
8661 | echo " " | |
8662 | fn=f/ | |
8663 | rp='What pager is used on your system?' | |
8664 | . ./getfile | |
8665 | pager="$ans" | |
8666 | ||
2304df62 AD |
8667 | : Cruising for prototypes |
8668 | echo " " | |
8669 | echo "Checking out function prototypes..." >&4 | |
8670 | $cat >prototype.c <<'EOCP' | |
8671 | main(int argc, char *argv[]) { | |
8672 | exit(0);} | |
8673 | EOCP | |
a0d0e21e | 8674 | if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then |
2304df62 AD |
8675 | echo "Your C compiler appears to support function prototypes." |
8676 | val="$define" | |
8677 | else | |
8678 | echo "Your C compiler doesn't seem to understand function prototypes." | |
8679 | val="$undef" | |
8680 | fi | |
8681 | set prototype | |
8682 | eval $setvar | |
8683 | $rm -f prototype* | |
8684 | ||
8685 | : check for size of random number generator | |
8686 | echo " " | |
8687 | case "$randbits" in | |
8688 | '') | |
8689 | echo "Checking to see how many bits your rand function produces..." >&4 | |
8ff267be | 8690 | $cat >try.c <<EOCP |
8691 | #$i_unistd I_UNISTD | |
8692 | #$i_stdlib I_STDLIB | |
2304df62 | 8693 | #include <stdio.h> |
8ff267be | 8694 | #ifdef I_UNISTD |
8695 | # include <unistd.h> | |
8696 | #endif | |
8697 | #ifdef I_STDLIB | |
8698 | # include <stdlib.h> | |
8699 | #endif | |
8700 | EOCP | |
8701 | $cat >>try.c <<'EOCP' | |
2304df62 AD |
8702 | main() |
8703 | { | |
8704 | register int i; | |
8705 | register unsigned long tmp; | |
8706 | register unsigned long max = 0L; | |
8707 | ||
8708 | for (i = 1000; i; i--) { | |
8709 | tmp = (unsigned long)rand(); | |
8710 | if (tmp > max) max = tmp; | |
8711 | } | |
8712 | for (i = 0; max; i++) | |
8713 | max /= 2; | |
8714 | printf("%d\n",i); | |
1e422769 | 8715 | fflush(stdout); |
2304df62 AD |
8716 | } |
8717 | EOCP | |
b971f6e4 | 8718 | if $cc $ccflags $ldflags -o try try.c $libs >/dev/null 2>&1 ; then |
2304df62 AD |
8719 | dflt=`try` |
8720 | else | |
8721 | dflt='?' | |
8722 | echo "(I can't seem to compile the test program...)" | |
8723 | fi | |
8724 | ;; | |
8725 | *) | |
8726 | dflt="$randbits" | |
8727 | ;; | |
8728 | esac | |
a0d0e21e LW |
8729 | rp='How many bits does your rand() function produce?' |
8730 | . ./myread | |
8731 | randbits="$ans" | |
b971f6e4 | 8732 | $rm -f try.c try.o try |
a0d0e21e LW |
8733 | |
8734 | : see if ar generates random libraries by itself | |
8735 | echo " " | |
8736 | echo "Checking how to generate random libraries on your machine..." >&4 | |
8737 | echo 'int bar1() { return bar2(); }' > bar1.c | |
8738 | echo 'int bar2() { return 2; }' > bar2.c | |
8739 | $cat > foo.c <<'EOP' | |
8740 | main() { printf("%d\n", bar1()); exit(0); } | |
8741 | EOP | |
8742 | $cc $ccflags -c bar1.c >/dev/null 2>&1 | |
8743 | $cc $ccflags -c bar2.c >/dev/null 2>&1 | |
8744 | $cc $ccflags -c foo.c >/dev/null 2>&1 | |
5f05dabc | 8745 | ar rc bar$lib_ext bar2.o bar1.o >/dev/null 2>&1 |
8746 | if $cc $ccflags $ldflags -o foobar foo.o bar$lib_ext $libs > /dev/null 2>&1 && | |
a0d0e21e LW |
8747 | ./foobar >/dev/null 2>&1; then |
8748 | echo "ar appears to generate random libraries itself." | |
8749 | orderlib=false | |
8750 | ranlib=":" | |
5f05dabc | 8751 | elif ar ts bar$lib_ext >/dev/null 2>&1 && |
8752 | $cc $ccflags $ldflags -o foobar foo.o bar$lib_ext $libs > /dev/null 2>&1 && | |
a0d0e21e LW |
8753 | ./foobar >/dev/null 2>&1; then |
8754 | echo "a table of contents needs to be added with 'ar ts'." | |
8755 | orderlib=false | |
8756 | ranlib="ar ts" | |
8757 | else | |
ecfc5424 AD |
8758 | case "$ranlib" in |
8759 | :) ranlib='';; | |
8760 | '') | |
8761 | ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin` | |
8762 | $test -f $ranlib || ranlib='' | |
8763 | ;; | |
8764 | esac | |
a0d0e21e | 8765 | if $test -n "$ranlib"; then |
ecfc5424 | 8766 | echo "your system has '$ranlib'; we'll use that." |
a0d0e21e LW |
8767 | orderlib=false |
8768 | else | |
8769 | echo "your system doesn't seem to support random libraries" | |
8770 | echo "so we'll use lorder and tsort to order the libraries." | |
8771 | orderlib=true | |
8772 | ranlib=":" | |
8773 | fi | |
8774 | fi | |
8775 | $rm -f foo* bar* | |
8776 | ||
a0d0e21e LW |
8777 | : see if sys/select.h has to be included |
8778 | set sys/select.h i_sysselct | |
8779 | eval $inhdr | |
8780 | ||
8781 | : see if we should include time.h, sys/time.h, or both | |
8782 | echo " " | |
8783 | echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4 | |
8784 | $echo $n "I'm now running the test program...$c" | |
8785 | $cat >try.c <<'EOCP' | |
8786 | #include <sys/types.h> | |
8787 | #ifdef I_TIME | |
8788 | #include <time.h> | |
8789 | #endif | |
8790 | #ifdef I_SYSTIME | |
8791 | #ifdef SYSTIMEKERNEL | |
8792 | #define KERNEL | |
8793 | #endif | |
8794 | #include <sys/time.h> | |
8795 | #endif | |
8796 | #ifdef I_SYSSELECT | |
8797 | #include <sys/select.h> | |
8798 | #endif | |
8799 | main() | |
8800 | { | |
8801 | struct tm foo; | |
8802 | #ifdef S_TIMEVAL | |
8803 | struct timeval bar; | |
8804 | #endif | |
8805 | #ifdef S_TIMEZONE | |
8806 | struct timezone tzp; | |
8807 | #endif | |
8808 | if (foo.tm_sec == foo.tm_sec) | |
8809 | exit(0); | |
8810 | #ifdef S_TIMEVAL | |
8811 | if (bar.tv_sec == bar.tv_sec) | |
8812 | exit(0); | |
8813 | #endif | |
8814 | exit(1); | |
8815 | } | |
8816 | EOCP | |
8817 | flags='' | |
40a7a20a | 8818 | for s_timezone in '-DS_TIMEZONE' ''; do |
a0d0e21e LW |
8819 | sysselect='' |
8820 | for s_timeval in '-DS_TIMEVAL' ''; do | |
8821 | for i_systimek in '' '-DSYSTIMEKERNEL'; do | |
8822 | for i_time in '' '-DI_TIME'; do | |
8823 | for i_systime in '-DI_SYSTIME' ''; do | |
8824 | case "$flags" in | |
8825 | '') $echo $n ".$c" | |
8826 | if $cc $ccflags \ | |
8827 | $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone \ | |
8828 | try.c -o try >/dev/null 2>&1 ; then | |
8829 | set X $i_time $i_systime $i_systimek $sysselect $s_timeval | |
8830 | shift | |
8831 | flags="$*" | |
8832 | echo " " | |
8833 | $echo $n "Succeeded with $flags$c" | |
8834 | fi | |
8835 | ;; | |
8836 | esac | |
8837 | done | |
8838 | done | |
8839 | done | |
8840 | done | |
40a7a20a | 8841 | done |
a0d0e21e LW |
8842 | timeincl='' |
8843 | echo " " | |
8844 | case "$flags" in | |
8845 | *SYSTIMEKERNEL*) i_systimek="$define" | |
8846 | timeincl=`./findhdr sys/time.h` | |
8847 | echo "We'll include <sys/time.h> with KERNEL defined." >&4;; | |
8848 | *) i_systimek="$undef";; | |
8849 | esac | |
8850 | case "$flags" in | |
8851 | *I_TIME*) i_time="$define" | |
8852 | timeincl=`./findhdr time.h`" $timeincl" | |
8853 | echo "We'll include <time.h>." >&4;; | |
8854 | *) i_time="$undef";; | |
8855 | esac | |
8856 | case "$flags" in | |
8857 | *I_SYSTIME*) i_systime="$define" | |
8858 | timeincl=`./findhdr sys/time.h`" $timeincl" | |
8859 | echo "We'll include <sys/time.h>." >&4;; | |
8860 | *) i_systime="$undef";; | |
8861 | esac | |
2304df62 AD |
8862 | $rm -f try.c try |
8863 | ||
a0d0e21e LW |
8864 | : check for fd_set items |
8865 | $cat <<EOM | |
8866 | ||
8867 | Checking to see how well your C compiler handles fd_set and friends ... | |
8868 | EOM | |
8869 | $cat >fd_set.c <<EOCP | |
8870 | #$i_systime I_SYS_TIME | |
8871 | #$i_sysselct I_SYS_SELECT | |
8872 | #$d_socket HAS_SOCKET | |
8873 | #include <sys/types.h> | |
8874 | #ifdef HAS_SOCKET | |
8875 | #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */ | |
8876 | #endif | |
8877 | #ifdef I_SYS_TIME | |
8878 | #include <sys/time.h> | |
a4f3eea9 | 8879 | #endif |
a0d0e21e LW |
8880 | #ifdef I_SYS_SELECT |
8881 | #include <sys/select.h> | |
8882 | #endif | |
a0d0e21e LW |
8883 | main() { |
8884 | fd_set fds; | |
8885 | ||
8886 | #ifdef TRYBITS | |
8887 | if(fds.fds_bits); | |
8888 | #endif | |
8889 | ||
8890 | #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO) | |
8891 | exit(0); | |
8892 | #else | |
8893 | exit(1); | |
8894 | #endif | |
8895 | } | |
8896 | EOCP | |
8897 | if $cc $ccflags -DTRYBITS fd_set.c -o fd_set >fd_set.out 2>&1 ; then | |
8898 | d_fds_bits="$define" | |
8899 | d_fd_set="$define" | |
8900 | echo "Well, your system knows about the normal fd_set typedef..." >&4 | |
8901 | if ./fd_set; then | |
8902 | echo "and you have the normal fd_set macros (just as I'd expect)." >&4 | |
8903 | d_fd_macros="$define" | |
85e6fe83 | 8904 | else |
a0d0e21e LW |
8905 | $cat >&4 <<'EOM' |
8906 | but not the normal fd_set macros! Gaaack! I'll have to cover for you. | |
8907 | EOM | |
8908 | d_fd_macros="$undef" | |
85e6fe83 LW |
8909 | fi |
8910 | else | |
a0d0e21e LW |
8911 | $cat <<'EOM' |
8912 | Hmm, your compiler has some difficulty with fd_set. Checking further... | |
8913 | EOM | |
8914 | if $cc $ccflags fd_set.c -o fd_set >fd_set.out 2>&1 ; then | |
8915 | d_fds_bits="$undef" | |
8916 | d_fd_set="$define" | |
8917 | echo "Well, your system has some sort of fd_set available..." >&4 | |
8918 | if ./fd_set; then | |
8919 | echo "and you have the normal fd_set macros." >&4 | |
8920 | d_fd_macros="$define" | |
8921 | else | |
8922 | $cat <<'EOM' | |
8923 | but not the normal fd_set macros! Gross! More work for me... | |
8924 | EOM | |
8925 | d_fd_macros="$undef" | |
8926 | fi | |
85e6fe83 | 8927 | else |
a0d0e21e LW |
8928 | echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4 |
8929 | d_fd_set="$undef" | |
8930 | d_fds_bits="$undef" | |
8931 | d_fd_macros="$undef" | |
85e6fe83 LW |
8932 | fi |
8933 | fi | |
a0d0e21e LW |
8934 | $rm -f fd_set* |
8935 | ||
8936 | ||
8937 | : check for type of arguments to select. This will only really | |
8938 | : work if the system supports prototypes and provides one for | |
8939 | : select. | |
8940 | case "$d_select" in | |
8941 | $define) | |
8942 | : Make initial guess | |
8943 | case "$selecttype" in | |
8944 | ''|' ') | |
8945 | case "$d_fd_set" in | |
8946 | $define) xxx='fd_set *' ;; | |
8947 | *) xxx='int *' ;; | |
8948 | esac | |
8949 | ;; | |
8950 | *) xxx="$selecttype" | |
8951 | ;; | |
8952 | esac | |
8953 | : backup guess | |
8954 | case "$xxx" in | |
8955 | 'fd_set *') yyy='int *' ;; | |
8956 | 'int *') yyy='fd_set *' ;; | |
8957 | esac | |
85e6fe83 | 8958 | |
2304df62 AD |
8959 | $cat <<EOM |
8960 | ||
a0d0e21e | 8961 | Checking to see what type of arguments are expected by select(). |
2304df62 | 8962 | EOM |
a0d0e21e LW |
8963 | $cat >try.c <<EOCP |
8964 | #$i_systime I_SYS_TIME | |
8965 | #$i_sysselct I_SYS_SELECT | |
8966 | #$d_socket HAS_SOCKET | |
8967 | #include <sys/types.h> | |
8968 | #ifdef HAS_SOCKET | |
8969 | #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */ | |
8970 | #endif | |
8971 | #ifdef I_SYS_TIME | |
8972 | #include <sys/time.h> | |
8ff267be | 8973 | #endif |
a0d0e21e LW |
8974 | #ifdef I_SYS_SELECT |
8975 | #include <sys/select.h> | |
8976 | #endif | |
a0d0e21e LW |
8977 | main() |
8978 | { | |
8979 | int width; | |
8980 | Select_fd_set_t readfds; | |
8981 | Select_fd_set_t writefds; | |
8982 | Select_fd_set_t exceptfds; | |
8983 | struct timeval timeout; | |
8984 | select(width, readfds, writefds, exceptfds, &timeout); | |
8985 | exit(0); | |
8986 | } | |
8987 | EOCP | |
8988 | if $cc $ccflags -c -DSelect_fd_set_t="$xxx" try.c >/dev/null 2>&1 ; then | |
8989 | selecttype="$xxx" | |
8990 | echo "Your system uses $xxx for the arguments to select." >&4 | |
8991 | elif $cc $ccflags -c -DSelect_fd_set_t="$yyy" try.c >/dev/null 2>&1 ; then | |
8992 | selecttype="$yyy" | |
8993 | echo "Your system uses $yyy for the arguments to select." >&4 | |
8994 | else | |
8995 | rp='What is the type for the 2nd, 3rd, and 4th arguments to select?' | |
8996 | dflt="$xxx" | |
8997 | . ./myread | |
8998 | selecttype="$ans" | |
8999 | fi | |
9000 | $rm -f try.[co] | |
9001 | ;; | |
8e07c86e | 9002 | *) selecttype='int *' |
a0d0e21e LW |
9003 | ;; |
9004 | esac | |
2304df62 | 9005 | |
8e07c86e AD |
9006 | : Trace out the files included by signal.h, then look for SIGxxx names. |
9007 | : Remove SIGARRAYSIZE used by HPUX. | |
4633a7c4 | 9008 | : Remove SIGTYP void lines used by OS2. |
8e07c86e AD |
9009 | xxx=`echo '#include <signal.h>' | |
9010 | $cppstdin $cppminus $cppflags 2>/dev/null | | |
9011 | $grep '^[ ]*#.*include' | | |
9012 | $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq` | |
9013 | : Check this list of files to be sure we have parsed the cpp output ok. | |
9014 | : This will also avoid potentially non-existent files, such | |
9015 | : as ../foo/bar.h | |
9016 | xxxfiles='' | |
9017 | for xx in $xxx /dev/null ; do | |
9018 | $test -f "$xx" && xxxfiles="$xxxfiles $xx" | |
9019 | done | |
9020 | : If we have found no files, at least try signal.h | |
9021 | case "$xxxfiles" in | |
9022 | '') xxxfiles=`./findhdr signal.h` ;; | |
9023 | esac | |
9024 | xxx=`awk ' | |
4633a7c4 | 9025 | $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $3 !~ /void/ { |
8e07c86e AD |
9026 | print substr($2, 4, 20) |
9027 | } | |
4633a7c4 | 9028 | $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ { |
8e07c86e AD |
9029 | print substr($3, 4, 20) |
9030 | }' $xxxfiles` | |
9031 | : Append some common names just in case the awk scan failed. | |
9032 | xxx="$xxx ABRT ALRM BUS CHLD CLD CONT DIL EMT FPE HUP ILL INT IO IOT KILL" | |
9033 | xxx="$xxx LOST PHONE PIPE POLL PROF PWR QUIT SEGV STKFLT STOP SYS TERM TRAP" | |
9034 | xxx="$xxx TSTP TTIN TTOU URG USR1 USR2 USR3 USR4 VTALRM" | |
9035 | xxx="$xxx WINCH WIND WINDOW XCPU XFSZ" | |
9036 | : generate a few handy files for later | |
4633a7c4 LW |
9037 | $cat > signal.c <<'EOP' |
9038 | #include <sys/types.h> | |
9039 | #include <signal.h> | |
9040 | int main() { | |
760ac839 LW |
9041 | |
9042 | /* Strange style to avoid deeply-nested #if/#else/#endif */ | |
9043 | #ifndef NSIG | |
9044 | # ifdef _NSIG | |
9045 | # define NSIG (_NSIG) | |
9046 | # endif | |
9047 | #endif | |
9048 | ||
9049 | #ifndef NSIG | |
9050 | # ifdef SIGMAX | |
9051 | # define NSIG (SIGMAX+1) | |
9052 | # endif | |
9053 | #endif | |
9054 | ||
9055 | #ifndef NSIG | |
9056 | # ifdef SIG_MAX | |
9057 | # define NSIG (SIG_MAX+1) | |
9058 | # endif | |
9059 | #endif | |
9060 | ||
9061 | #ifndef NSIG | |
9062 | # ifdef MAXSIG | |
9063 | # define NSIG (MAXSIG+1) | |
9064 | # endif | |
4633a7c4 | 9065 | #endif |
760ac839 LW |
9066 | |
9067 | #ifndef NSIG | |
9068 | # ifdef MAX_SIG | |
9069 | # define NSIG (MAX_SIG+1) | |
9070 | # endif | |
9071 | #endif | |
9072 | ||
9073 | #ifndef NSIG | |
9074 | # ifdef SIGARRAYSIZE | |
9075 | # define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */ | |
9076 | # endif | |
9077 | #endif | |
9078 | ||
9079 | #ifndef NSIG | |
9080 | # ifdef _sys_nsig | |
9081 | # define NSIG (_sys_nsig) /* Solaris 2.5 */ | |
9082 | # endif | |
9083 | #endif | |
9084 | ||
9085 | /* Default to some arbitrary number that's big enough to get most | |
9086 | of the common signals. | |
9087 | */ | |
9088 | #ifndef NSIG | |
9089 | # define NSIG 50 | |
4633a7c4 | 9090 | #endif |
760ac839 LW |
9091 | |
9092 | printf("NSIG %d\n", NSIG); | |
9093 | ||
4633a7c4 LW |
9094 | EOP |
9095 | echo $xxx | $tr ' ' '\012' | $sort | $uniq | $awk ' | |
8e07c86e AD |
9096 | { |
9097 | printf "#ifdef SIG"; printf $1; printf "\n" | |
9098 | printf "printf(\""; printf $1; printf " %%d\\n\",SIG"; | |
9099 | printf $1; printf ");\n" | |
9100 | printf "#endif\n" | |
2304df62 | 9101 | } |
2304df62 | 9102 | END { |
8e07c86e | 9103 | printf "}\n"; |
2304df62 | 9104 | } |
4633a7c4 LW |
9105 | ' >>signal.c |
9106 | $cat >signal.awk <<'EOP' | |
9107 | BEGIN { ndups = 0 } | |
9108 | $1 ~ /^NSIG$/ { nsig = $2 } | |
9109 | ($1 !~ /^NSIG$/) && (NF == 2) { | |
9110 | if ($2 > maxsig) { maxsig = $2 } | |
9111 | if (sig_name[$2]) { | |
9112 | dup_name[ndups] = $1 | |
9113 | dup_num[ndups] = $2 | |
9114 | ndups++ | |
9115 | } | |
9116 | else { | |
9117 | sig_name[$2] = $1 | |
9118 | sig_num[$2] = $2 | |
9119 | } | |
9120 | ||
9121 | } | |
9122 | END { | |
9123 | if (nsig == 0) { nsig = maxsig + 1 } | |
9124 | for (n = 1; n < nsig; n++) { | |
9125 | if (sig_name[n]) { | |
9126 | printf("%s %d\n", sig_name[n], sig_num[n]) | |
9127 | } | |
9128 | else { | |
9129 | printf("NUM%d %d\n", n, n) | |
9130 | } | |
9131 | } | |
9132 | for (n = 0; n < ndups; n++) { | |
9133 | printf("%s %d\n", dup_name[n], dup_num[n]) | |
9134 | } | |
9135 | } | |
9136 | EOP | |
9137 | $cat >signal_cmd <<EOS | |
8e07c86e AD |
9138 | $startsh |
9139 | $test -s signal.lst && exit 0 | |
3e3baf6d | 9140 | if $cc $ccflags $ldflags signal.c -o signal >/dev/null 2>&1; then |
4633a7c4 | 9141 | ./signal | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst |
8e07c86e AD |
9142 | else |
9143 | echo "(I can't seem be able to compile the test program -- Guessing)" | |
9144 | echo 'kill -l' >signal | |
9145 | set X \`csh -f <signal\` | |
9146 | $rm -f signal | |
2304df62 | 9147 | shift |
8e07c86e AD |
9148 | case \$# in |
9149 | 0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;; | |
2304df62 | 9150 | esac |
8e07c86e | 9151 | echo \$@ | $tr ' ' '\012' | \ |
3e3baf6d | 9152 | $awk '{ printf \$1; printf " %d\n", ++s; }' >signal.lst |
8e07c86e AD |
9153 | fi |
9154 | $rm -f signal.c signal signal.o | |
9155 | EOS | |
4633a7c4 LW |
9156 | chmod a+x signal_cmd |
9157 | $eunicefix signal_cmd | |
8e07c86e AD |
9158 | |
9159 | : generate list of signal names | |
9160 | echo " " | |
9161 | case "$sig_name" in | |
4633a7c4 LW |
9162 | '') sig_num='' ;; |
9163 | esac | |
9164 | case "$sig_num" in | |
9165 | '') sig_name='' ;; | |
9166 | esac | |
9167 | case "$sig_name" in | |
8e07c86e | 9168 | '') |
4633a7c4 LW |
9169 | echo "Generating a list of signal names and numbers..." >&4 |
9170 | ./signal_cmd | |
8e07c86e AD |
9171 | sig_name=`$awk '{printf "%s ", $1}' signal.lst` |
9172 | sig_name="ZERO $sig_name" | |
4633a7c4 LW |
9173 | sig_num=`$awk '{printf "%d ", $2}' signal.lst` |
9174 | sig_num="0 $sig_num" | |
a0d0e21e | 9175 | ;; |
2304df62 | 9176 | esac |
a0d0e21e LW |
9177 | echo "The following signals are available:" |
9178 | echo " " | |
9179 | echo $sig_name | $awk \ | |
9180 | 'BEGIN { linelen = 0 } | |
9181 | { | |
8e07c86e | 9182 | for (i = 1; i <= NF; i++) { |
a0d0e21e LW |
9183 | name = "SIG" $i " " |
9184 | linelen = linelen + length(name) | |
9185 | if (linelen > 70) { | |
9186 | printf "\n" | |
9187 | linelen = length(name) | |
9188 | } | |
9189 | printf "%s", name | |
9190 | } | |
8e07c86e | 9191 | printf "\n" |
a0d0e21e | 9192 | }' |
4633a7c4 | 9193 | $rm -f signal signal.c signal.awk signal.lst signal_cmd |
a0d0e21e LW |
9194 | |
9195 | : see what type is used for size_t | |
9196 | set size_t sizetype 'unsigned int' stdio.h sys/types.h | |
9197 | eval $typedef | |
9198 | dflt="$sizetype" | |
9199 | echo " " | |
9200 | rp="What type is used for the length parameter for string functions?" | |
2304df62 | 9201 | . ./myread |
a0d0e21e LW |
9202 | sizetype="$ans" |
9203 | ||
9204 | : see what type is used for signed size_t | |
9205 | set ssize_t ssizetype int stdio.h sys/types.h | |
9206 | eval $typedef | |
9207 | dflt="$ssizetype" | |
9208 | $cat > ssize.c <<EOM | |
9209 | #include <stdio.h> | |
9210 | #include <sys/types.h> | |
9211 | #define Size_t $sizetype | |
9212 | #define SSize_t $dflt | |
9213 | main() | |
9214 | { | |
9215 | if (sizeof(Size_t) == sizeof(SSize_t)) | |
9216 | printf("$dflt\n"); | |
9217 | else if (sizeof(Size_t) == sizeof(int)) | |
9218 | printf("int\n"); | |
9219 | else | |
9220 | printf("long\n"); | |
d97d40b5 | 9221 | fflush(stdout); |
760ac839 | 9222 | exit(0); |
a0d0e21e LW |
9223 | } |
9224 | EOM | |
9225 | echo " " | |
24fef2a7 AD |
9226 | # If $libs contains -lsfio, and sfio is mis-configured, then it |
9227 | # sometimes (apparently) runs and exits with a 0 status, but with no | |
9228 | # output!. Thus we check with test -s whether we actually got any | |
9229 | # output. I think it has to do with sfio's use of _exit vs. exit, | |
9230 | # but I don't know for sure. --Andy Dougherty 1/27/97. | |
9231 | if $cc $optimize $ccflags $ldflags -o ssize ssize.c $libs > /dev/null 2>&1 && | |
9232 | ./ssize > ssize.out 2>/dev/null && test -s ssize.out ; then | |
9233 | ssizetype=`$cat ssize.out` | |
a0d0e21e LW |
9234 | echo "I'll be using $ssizetype for functions returning a byte count." >&4 |
9235 | else | |
24fef2a7 AD |
9236 | $cat >&4 <<EOM |
9237 | ||
9238 | Help! I can't compile and run the ssize_t test program: please enlighten me! | |
9239 | (This is probably a misconfiguration in your system or libraries, and | |
9240 | you really ought to fix it. Still, I'll try anyway.) | |
a0d0e21e LW |
9241 | |
9242 | I need a type that is the same size as $sizetype, but is guaranteed to | |
24fef2a7 | 9243 | be signed. Common values are ssize_t, int and long. |
a0d0e21e LW |
9244 | |
9245 | EOM | |
9246 | rp="What signed type is the same size as $sizetype?" | |
9247 | . ./myread | |
9248 | ssizetype="$ans" | |
9249 | fi | |
24fef2a7 | 9250 | $rm -f ssize ssize.[co] ssize.out |
a0d0e21e | 9251 | |
3fd537d4 JH |
9252 | : see if this is a netdb.h system |
9253 | set netdb.h i_netdb | |
9254 | eval $inhdr | |
9255 | ||
9256 | : check for type of arguments to gethostbyaddr. This will only really | |
9257 | : work if the system supports prototypes and provides one for | |
9258 | : gethostbyaddr. | |
9259 | case "$d_gethbadd" in | |
9260 | $define) | |
9261 | if test "X$gethbadd_addr_type" = X -o "X$gethbadd_alen_type" = X; then | |
9262 | $cat <<EOM | |
9263 | ||
9264 | Checking to see what type of arguments are expected by gethostbyaddr(). | |
9265 | EOM | |
9266 | $cat >try.c <<EOCP | |
9267 | #include <sys/types.h> | |
9268 | #$i_niin I_NIIN | |
9269 | #$i_netdb I_NETDB | |
9270 | #$i_unistd I_UNISTD | |
9271 | #$d_socket HAS_SOCKET | |
9272 | #$d_socket HAS_SOCKET | |
9273 | #ifdef HAS_SOCKET | |
9274 | #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */ | |
9275 | #endif | |
9276 | #ifdef I_NIIN | |
9277 | #include <netinet/in.h> | |
9278 | #endif | |
9279 | #ifdef I_NETDB | |
9280 | #include <netdb.h> | |
9281 | #endif | |
9282 | #ifdef I_UNISTD | |
9283 | #include <unistd.h> | |
9284 | #endif | |
9285 | #define Size_t $sizetype | |
9286 | main() | |
9287 | { | |
9288 | Gethbadd_addr_t addr; | |
9289 | Gethbadd_alen_t alen; | |
9290 | struct hostent* hent; | |
9291 | ||
9292 | extern struct hostent *gethostbyaddr(const Gethbadd_addr_t, Gethbadd_alen_t, int); | |
9293 | ||
9294 | alen = sizeof(struct in_addr); | |
9295 | addr = (Gethbadd_addr_t)malloc(alen); | |
9296 | /* We do not execute this so the contents of the addr matter not. */ | |
9297 | hent = gethostbyaddr(addr, alen, AF_INET); | |
9298 | ||
9299 | exit(0); | |
9300 | } | |
9301 | EOCP | |
9302 | for xxx in "void *" "char *"; do | |
9303 | for yyy in Size_t int; do | |
9304 | if $cc $ccflags -c -DGethbadd_addr_t="$xxx" -DGethbadd_alen_t="$yyy" try.c >/dev/null 2>&1 ; then | |
9305 | gethbadd_addr_type="$xxx" | |
9306 | gethbadd_alen_type="$yyy" | |
ce637636 JH |
9307 | $cat >&4 <<EOM |
9308 | Your system uses $xxx for the 1st argument to gethostbyaddr. | |
9309 | and the 2nd argument to gethostbyaddr is $yyy. | |
9310 | EOM | |
3fd537d4 JH |
9311 | break |
9312 | fi | |
9313 | done | |
9314 | test "X$gethbadd_addr_type" != X && break | |
9315 | done | |
9316 | if test "X$gethbadd_addr_type" = X; then | |
9317 | rp='What is the type for the 1st argument to gethostbyaddr?' | |
9318 | dflt="void *" | |
9319 | . ./myread | |
9320 | gethbadd_addr_type="$ans" | |
9321 | ||
9322 | # Remove the "const" if needed. | |
9323 | gethbadd_addr_type=`echo $gethbadd_addr_type | sed 's/^const //'` | |
9324 | ||
9325 | rp='What is the type for the 2nd argument to gethostbyaddr ?' | |
9326 | dflt="Size_t" | |
9327 | . ./myread | |
9328 | gethbadd_alen_type="$ans" | |
9329 | fi | |
9330 | $rm -f try.[co] | |
ce637636 JH |
9331 | else |
9332 | $cat >&4 <<EOM | |
9333 | Your system uses $gethbadd_addr_type for the 1st argument to gethostbyaddr. | |
9334 | and the 2nd argument to gethostbyaddr is $gethbadd_alen_type. | |
9335 | EOM | |
3fd537d4 JH |
9336 | fi |
9337 | ;; | |
9338 | *) gethbadd_addr_type='void *' | |
9339 | gethbadd_alen_type='Size_t' | |
9340 | ;; | |
9341 | esac | |
9342 | ||
9343 | : check for type of arguments to getnetbyaddr. This will only really | |
9344 | : work if the system supports prototypes and provides one for | |
9345 | : getnetbyaddr. | |
9346 | case "$d_getnbadd" in | |
9347 | $define) | |
ce637636 | 9348 | if test "X$getnbadd_net_type" = X; then |
3fd537d4 JH |
9349 | $cat <<EOM |
9350 | ||
9351 | Checking to see what type of arguments are expected by getnetbyaddr(). | |
9352 | EOM | |
9353 | $cat >try.c <<EOCP | |
9354 | #$i_niin I_NIIN | |
9355 | #$i_netdb I_NETDB | |
9356 | #$d_socket HAS_SOCKET | |
9357 | #$d_socket HAS_SOCKET | |
9358 | #include <sys/types.h> | |
9359 | #ifdef HAS_SOCKET | |
9360 | #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */ | |
9361 | #endif | |
9362 | #ifdef I_NIIN | |
9363 | #include <netinet/in.h> | |
9364 | #endif | |
9365 | #ifdef I_NETDB | |
9366 | #include <netdb.h> | |
9367 | #endif | |
9368 | main() | |
9369 | { | |
9370 | Getnbadd_net_t net; | |
9371 | struct netent* nent; | |
9372 | ||
9373 | extern struct netent *getnetbyaddr(Getnbadd_net_t, int); | |
9374 | ||
9375 | /* We do not execute this so the contents of the net matter not. */ | |
9376 | nent = getnetbyaddr(net, AF_INET); | |
9377 | ||
9378 | exit(0); | |
9379 | } | |
9380 | EOCP | |
9381 | for xxx in in_addr_t long int; do | |
9382 | if $cc $ccflags -c -DGetnbadd_net_t="$xxx" try.c >/dev/null 2>&1 ; then | |
9383 | getnbadd_net_type="$xxx" | |
9384 | echo "Your system uses $xxx for the 1st argument to getnetbyaddr." >&4 | |
9385 | break | |
9386 | fi | |
9387 | done | |
9388 | if test "X$getnbadd_net_type" = X; then | |
9389 | rp='What is the type for the 1st argument to getnetbyaddr?' | |
9390 | dflt="long" | |
9391 | . ./myread | |
9392 | getnbadd_net_type="$ans" | |
9393 | fi | |
9394 | $rm -f try.[co] | |
ce637636 JH |
9395 | else |
9396 | echo "Your system uses $getnbadd_net_type for the 1st argument to getnetbyaddr." >&4 | |
3fd537d4 JH |
9397 | fi |
9398 | ;; | |
9399 | *) getnbadd_net_type='long' | |
9400 | ;; | |
9401 | esac | |
9402 | ||
a0d0e21e LW |
9403 | : see what type of char stdio uses. |
9404 | echo " " | |
9405 | if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then | |
9406 | echo "Your stdio uses unsigned chars." >&4 | |
9407 | stdchar="unsigned char" | |
9408 | else | |
9409 | echo "Your stdio uses signed chars." >&4 | |
9410 | stdchar="char" | |
9411 | fi | |
9412 | ||
9413 | : see if time exists | |
9414 | echo " " | |
ecfc5424 | 9415 | if set time val -f d_time; eval $csym; $val; then |
a0d0e21e | 9416 | echo 'time() found.' >&4 |
ecfc5424 | 9417 | val="$define" |
a0d0e21e LW |
9418 | set time_t timetype long stdio.h sys/types.h |
9419 | eval $typedef | |
9420 | dflt="$timetype" | |
9421 | echo " " | |
c2960299 | 9422 | rp="What type is returned by time() on this system?" |
a0d0e21e LW |
9423 | . ./myread |
9424 | timetype="$ans" | |
9425 | else | |
9426 | echo 'time() not found, hope that will do.' >&4 | |
ecfc5424 | 9427 | val="$undef" |
a0d0e21e LW |
9428 | timetype='int'; |
9429 | fi | |
a0d0e21e LW |
9430 | set d_time |
9431 | eval $setvar | |
9432 | ||
9433 | : see what type uids are declared as in the kernel | |
9434 | set uid_t uidtype xxx stdio.h sys/types.h | |
9435 | eval $typedef | |
9436 | case "$uidtype" in | |
9437 | xxx) | |
9438 | xxx=`./findhdr sys/user.h` | |
9439 | set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short | |
9440 | case $1 in | |
9441 | unsigned) dflt="$1 $2" ;; | |
9442 | *) dflt="$1" ;; | |
9443 | esac | |
9444 | ;; | |
4633a7c4 LW |
9445 | *) dflt="$uidtype";; |
9446 | esac | |
9447 | echo " " | |
9448 | rp="What is the type for user ids returned by getuid()?" | |
9449 | . ./myread | |
9450 | uidtype="$ans" | |
9451 | ||
9452 | : see if dbm.h is available | |
9453 | : see if dbmclose exists | |
9454 | set dbmclose d_dbmclose | |
9455 | eval $inlibc | |
9456 | ||
9457 | case "$d_dbmclose" in | |
9458 | $define) | |
9459 | set dbm.h i_dbm | |
9460 | eval $inhdr | |
9461 | case "$i_dbm" in | |
9462 | $define) | |
9463 | val="$undef" | |
9464 | set i_rpcsvcdbm | |
9465 | eval $setvar | |
9466 | ;; | |
9467 | *) set rpcsvc/dbm.h i_rpcsvcdbm | |
9468 | eval $inhdr | |
9469 | ;; | |
9470 | esac | |
9471 | ;; | |
9472 | *) echo "We won't be including <dbm.h>" | |
9473 | val="$undef" | |
9474 | set i_dbm | |
9475 | eval $setvar | |
9476 | val="$undef" | |
9477 | set i_rpcsvcdbm | |
9478 | eval $setvar | |
9479 | ;; | |
a0d0e21e | 9480 | esac |
2304df62 | 9481 | |
2304df62 AD |
9482 | : see if this is a sys/file.h system |
9483 | val='' | |
9484 | set sys/file.h val | |
9485 | eval $inhdr | |
9486 | ||
8e07c86e | 9487 | : do we need to include sys/file.h ? |
2304df62 AD |
9488 | case "$val" in |
9489 | "$define") | |
9490 | echo " " | |
9491 | if $h_sysfile; then | |
9492 | val="$define" | |
9493 | echo "We'll be including <sys/file.h>." >&4 | |
9494 | else | |
9495 | val="$undef" | |
9496 | echo "We won't be including <sys/file.h>." >&4 | |
9497 | fi | |
9498 | ;; | |
9499 | *) | |
9500 | h_sysfile=false | |
9501 | ;; | |
9502 | esac | |
9503 | set i_sysfile | |
9504 | eval $setvar | |
9505 | ||
9506 | : see if fcntl.h is there | |
9507 | val='' | |
9508 | set fcntl.h val | |
9509 | eval $inhdr | |
9510 | ||
9511 | : see if we can include fcntl.h | |
9512 | case "$val" in | |
9513 | "$define") | |
9514 | echo " " | |
9515 | if $h_fcntl; then | |
9516 | val="$define" | |
9517 | echo "We'll be including <fcntl.h>." >&4 | |
9518 | else | |
9519 | val="$undef" | |
9520 | if $h_sysfile; then | |
9521 | echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4 | |
9522 | else | |
9523 | echo "We won't be including <fcntl.h>." >&4 | |
9524 | fi | |
9525 | fi | |
9526 | ;; | |
9527 | *) | |
9528 | h_fcntl=false | |
9529 | val="$undef" | |
9530 | ;; | |
9531 | esac | |
9532 | set i_fcntl | |
9533 | eval $setvar | |
9534 | ||
2304df62 AD |
9535 | : see if this is an grp system |
9536 | set grp.h i_grp | |
9537 | eval $inhdr | |
9538 | ||
4633a7c4 LW |
9539 | : see if locale.h is available |
9540 | set locale.h i_locale | |
9541 | eval $inhdr | |
9542 | ||
a0d0e21e LW |
9543 | : see if this is a math.h system |
9544 | set math.h i_math | |
9545 | eval $inhdr | |
9546 | ||
4633a7c4 LW |
9547 | : see if ndbm.h is available |
9548 | set ndbm.h t_ndbm | |
9549 | eval $inhdr | |
9550 | case "$t_ndbm" in | |
9551 | $define) | |
9552 | : see if dbm_open exists | |
9553 | set dbm_open d_dbm_open | |
9554 | eval $inlibc | |
9555 | case "$d_dbm_open" in | |
9556 | $undef) | |
9557 | t_ndbm="$undef" | |
9558 | echo "We won't be including <ndbm.h>" | |
9559 | ;; | |
9560 | esac | |
9561 | ;; | |
9562 | esac | |
9563 | val="$t_ndbm" | |
9564 | set i_ndbm | |
9565 | eval $setvar | |
9566 | ||
85e6fe83 | 9567 | : see if net/errno.h is available |
a0d0e21e LW |
9568 | val='' |
9569 | set net/errno.h val | |
2304df62 | 9570 | eval $inhdr |
a0d0e21e | 9571 | |
85e6fe83 | 9572 | : Unfortunately, it causes problems on some systems. Arrgh. |
a0d0e21e LW |
9573 | case "$val" in |
9574 | $define) | |
9575 | cat > try.c <<'EOM' | |
85e6fe83 LW |
9576 | #include <stdio.h> |
9577 | #include <errno.h> | |
9578 | #include <net/errno.h> | |
9579 | int func() | |
9580 | { | |
a0d0e21e | 9581 | return ENOTSOCK; |
85e6fe83 LW |
9582 | } |
9583 | EOM | |
a0d0e21e LW |
9584 | if $cc $ccflags -c try.c >/dev/null 2>&1; then |
9585 | echo "We'll be including <net/errno.h>." >&4 | |
9586 | else | |
9587 | echo "We won't be including <net/errno.h>." >&4 | |
9588 | val="$undef" | |
9589 | fi | |
9590 | $rm -f try.* try | |
9591 | ;; | |
85e6fe83 | 9592 | esac |
a0d0e21e LW |
9593 | set i_neterrno |
9594 | eval $setvar | |
2304df62 AD |
9595 | |
9596 | : get C preprocessor symbols handy | |
9597 | echo " " | |
ecfc5424 | 9598 | $echo $n "Hmm... $c" |
a0d0e21e | 9599 | echo $al | $tr ' ' '\012' >Cppsym.know |
2304df62 AD |
9600 | $cat <<EOSS >Cppsym |
9601 | $startsh | |
9602 | case "\$1" in | |
9603 | -l) list=true | |
9604 | shift | |
9605 | ;; | |
9606 | esac | |
9607 | unknown='' | |
9608 | case "\$list\$#" in | |
9609 | 1|2) | |
9610 | for sym do | |
9611 | if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then | |
9612 | exit 0 | |
9613 | elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then | |
9614 | : | |
9615 | else | |
9616 | unknown="\$unknown \$sym" | |
9617 | fi | |
9618 | done | |
9619 | set X \$unknown | |
9620 | shift | |
9621 | ;; | |
9622 | esac | |
9623 | case \$# in | |
9624 | 0) exit 1;; | |
9625 | esac | |
9626 | echo \$* | $tr ' ' '\012' | $sed -e 's/\(.*\)/\\ | |
9627 | #ifdef \1\\ | |
9628 | exit 0; _ _ _ _\1\\ \1\\ | |
9629 | #endif\\ | |
9630 | /' >Cppsym\$\$ | |
9631 | echo "exit 1; _ _ _" >>Cppsym\$\$ | |
9632 | $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _' >Cppsym2\$\$ | |
9633 | case "\$list" in | |
9634 | true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;; | |
9635 | *) | |
9636 | sh Cppsym2\$\$ | |
9637 | status=\$? | |
9638 | ;; | |
9639 | esac | |
9640 | $rm -f Cppsym\$\$ Cppsym2\$\$ | |
9641 | exit \$status | |
9642 | EOSS | |
9643 | chmod +x Cppsym | |
9644 | $eunicefix Cppsym | |
ecfc5424 AD |
9645 | ./Cppsym -l $al | $sort | $grep -v '^$' >Cppsym.true |
9646 | ||
9647 | : now check the C compiler for additional symbols | |
9648 | $cat >ccsym <<EOS | |
9649 | $startsh | |
9650 | $cat >tmp.c <<EOF | |
9651 | extern int foo; | |
9652 | EOF | |
9653 | for i in \`$cc -v -c tmp.c 2>&1\` | |
9654 | do | |
9655 | case "\$i" in | |
9656 | -D*) echo "\$i" | $sed 's/^-D//';; | |
9657 | -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A\(.*\)(\(.*\))/\1=\2/';; | |
9658 | esac | |
9659 | done | |
9660 | $rm -f try.c | |
9661 | EOS | |
9662 | chmod +x ccsym | |
9663 | $eunicefix ccsym | |
9664 | ./ccsym | $sort | $uniq >ccsym.raw | |
f0b7e567 AD |
9665 | $awk '/\=/ { print $0; next } |
9666 | { print $0"=1" }' ccsym.raw >ccsym.list | |
ecfc5424 AD |
9667 | $awk '{ print $0"=1" }' Cppsym.true >ccsym.true |
9668 | $comm -13 ccsym.true ccsym.list >ccsym.own | |
9669 | $comm -12 ccsym.true ccsym.list >ccsym.com | |
9670 | $comm -23 ccsym.true ccsym.list >ccsym.cpp | |
9671 | also='' | |
9672 | symbols='symbols' | |
9673 | if $test -z ccsym.raw; then | |
9674 | echo "Your C compiler doesn't seem to define any symbol!" >&4 | |
9675 | echo " " | |
9676 | echo "However, your C preprocessor defines the following ones:" | |
9677 | $cat Cppsym.true | |
9678 | else | |
9679 | if $test -s ccsym.com; then | |
9680 | echo "Your C compiler and pre-processor define these symbols:" | |
9681 | $sed -e 's/\(.*\)=.*/\1/' ccsym.com | |
9682 | also='also ' | |
9683 | symbols='ones' | |
9684 | $test "$silent" || sleep 1 | |
9685 | fi | |
9686 | if $test -s ccsym.cpp; then | |
9687 | $test "$also" && echo " " | |
9688 | echo "Your C pre-processor ${also}defines the following $symbols:" | |
9689 | $sed -e 's/\(.*\)=.*/\1/' ccsym.cpp | |
9690 | also='further ' | |
9691 | $test "$silent" || sleep 1 | |
9692 | fi | |
9693 | if $test -s ccsym.own; then | |
9694 | $test "$also" && echo " " | |
9695 | echo "Your C compiler ${also}defines the following cpp variables:" | |
9696 | $sed -e 's/\(.*\)=1/\1/' ccsym.own | |
9697 | $sed -e 's/\(.*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true | |
9698 | $test "$silent" || sleep 1 | |
9699 | fi | |
9700 | fi | |
9701 | $rm -f ccsym* | |
2304df62 AD |
9702 | |
9703 | : see if this is a termio system | |
9704 | val="$undef" | |
9705 | val2="$undef" | |
9706 | val3="$undef" | |
9707 | if $test `./findhdr termios.h`; then | |
9708 | set tcsetattr i_termios | |
9709 | eval $inlibc | |
9710 | val3="$i_termios" | |
9711 | fi | |
9712 | echo " " | |
9713 | case "$val3" in | |
9714 | "$define") echo "You have POSIX termios.h... good!" >&4;; | |
ecfc5424 | 9715 | *) if ./Cppsym pyr; then |
2304df62 AD |
9716 | case "`/bin/universe`" in |
9717 | ucb) if $test `./findhdr sgtty.h`; then | |
9718 | val2="$define" | |
9719 | echo "<sgtty.h> found." >&4 | |
9720 | else | |
9721 | echo "System is pyramid with BSD universe." | |
9722 | echo "<sgtty.h> not found--you could have problems." >&4 | |
9723 | fi;; | |
9724 | *) if $test `./findhdr termio.h`; then | |
9725 | val="$define" | |
9726 | echo "<termio.h> found." >&4 | |
9727 | else | |
9728 | echo "System is pyramid with USG universe." | |
9729 | echo "<termio.h> not found--you could have problems." >&4 | |
9730 | fi;; | |
9731 | esac | |
ecfc5424 | 9732 | elif ./usg; then |
2304df62 AD |
9733 | if $test `./findhdr termio.h`; then |
9734 | echo "<termio.h> found." >&4 | |
9735 | val="$define" | |
9736 | elif $test `./findhdr sgtty.h`; then | |
9737 | echo "<sgtty.h> found." >&4 | |
9738 | val2="$define" | |
9739 | else | |
9740 | echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4 | |
9741 | fi | |
9742 | else | |
9743 | if $test `./findhdr sgtty.h`; then | |
9744 | echo "<sgtty.h> found." >&4 | |
9745 | val2="$define" | |
9746 | elif $test `./findhdr termio.h`; then | |
9747 | echo "<termio.h> found." >&4 | |
9748 | val="$define" | |
9749 | else | |
9750 | echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4 | |
9751 | fi | |
9752 | fi;; | |
9753 | esac | |
9754 | set i_termio; eval $setvar | |
9755 | val=$val2; set i_sgtty; eval $setvar | |
9756 | val=$val3; set i_termios; eval $setvar | |
9757 | ||
a0d0e21e | 9758 | : see if stdarg is available |
2304df62 | 9759 | echo " " |
a0d0e21e LW |
9760 | if $test `./findhdr stdarg.h`; then |
9761 | echo "<stdarg.h> found." >&4 | |
9762 | valstd="$define" | |
2304df62 | 9763 | else |
a0d0e21e LW |
9764 | echo "<stdarg.h> NOT found." >&4 |
9765 | valstd="$undef" | |
2304df62 | 9766 | fi |
85e6fe83 | 9767 | |
a0d0e21e | 9768 | : see if varags is available |
2304df62 AD |
9769 | echo " " |
9770 | if $test `./findhdr varargs.h`; then | |
2304df62 AD |
9771 | echo "<varargs.h> found." >&4 |
9772 | else | |
2304df62 AD |
9773 | echo "<varargs.h> NOT found, but that's ok (I hope)." >&4 |
9774 | fi | |
2304df62 AD |
9775 | |
9776 | : set up the varargs testing programs | |
9777 | $cat > varargs.c <<EOP | |
9778 | #ifdef I_STDARG | |
9779 | #include <stdarg.h> | |
9780 | #endif | |
9781 | #ifdef I_VARARGS | |
9782 | #include <varargs.h> | |
9783 | #endif | |
9784 | ||
9785 | #ifdef I_STDARG | |
9786 | int f(char *p, ...) | |
9787 | #else | |
9788 | int f(va_alist) | |
9789 | va_dcl | |
9790 | #endif | |
9791 | { | |
9792 | va_list ap; | |
9793 | #ifndef I_STDARG | |
9794 | char *p; | |
9795 | #endif | |
9796 | #ifdef I_STDARG | |
9797 | va_start(ap,p); | |
9798 | #else | |
9799 | va_start(ap); | |
9800 | p = va_arg(ap, char *); | |
9801 | #endif | |
9802 | va_end(ap); | |
9803 | } | |
9804 | EOP | |
9805 | $cat > varargs <<EOP | |
40a7a20a | 9806 | $startsh |
2304df62 AD |
9807 | if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then |
9808 | echo "true" | |
9809 | else | |
9810 | echo "false" | |
9811 | fi | |
9812 | $rm -f varargs.o | |
9813 | EOP | |
9814 | chmod +x varargs | |
9815 | ||
9816 | : now check which varargs header should be included | |
9817 | echo " " | |
9818 | i_varhdr='' | |
a0d0e21e | 9819 | case "$valstd" in |
2304df62 AD |
9820 | "$define") |
9821 | if `./varargs I_STDARG`; then | |
a0d0e21e | 9822 | val='stdarg.h' |
2304df62 | 9823 | elif `./varargs I_VARARGS`; then |
a0d0e21e | 9824 | val='varargs.h' |
2304df62 AD |
9825 | fi |
9826 | ;; | |
9827 | *) | |
9828 | if `./varargs I_VARARGS`; then | |
a0d0e21e | 9829 | val='varargs.h' |
2304df62 AD |
9830 | fi |
9831 | ;; | |
9832 | esac | |
a0d0e21e | 9833 | case "$val" in |
2304df62 AD |
9834 | '') |
9835 | echo "I could not find the definition for va_dcl... You have problems..." >&4 | |
a0d0e21e LW |
9836 | val="$undef"; set i_stdarg; eval $setvar |
9837 | val="$undef"; set i_varargs; eval $setvar | |
2304df62 | 9838 | ;; |
a0d0e21e LW |
9839 | *) |
9840 | set i_varhdr | |
9841 | eval $setvar | |
9842 | case "$i_varhdr" in | |
9843 | stdarg.h) | |
9844 | val="$define"; set i_stdarg; eval $setvar | |
9845 | val="$undef"; set i_varargs; eval $setvar | |
9846 | ;; | |
9847 | varargs.h) | |
9848 | val="$undef"; set i_stdarg; eval $setvar | |
9849 | val="$define"; set i_varargs; eval $setvar | |
9850 | ;; | |
9851 | esac | |
9852 | echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;; | |
2304df62 AD |
9853 | esac |
9854 | $rm -f varargs* | |
9855 | ||
a0d0e21e LW |
9856 | : see if stddef is available |
9857 | set stddef.h i_stddef | |
9858 | eval $inhdr | |
9859 | ||
a0d0e21e LW |
9860 | : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl |
9861 | set sys/filio.h i_sysfilio | |
9862 | eval $inhdr | |
9863 | echo " " | |
9864 | if $test `./findhdr sys/ioctl.h`; then | |
9865 | val="$define" | |
9866 | echo '<sys/ioctl.h> found.' >&4 | |
9867 | else | |
9868 | val="$undef" | |
9869 | if $test $i_sysfilio = "$define"; then | |
9870 | echo '<sys/ioctl.h> NOT found.' >&4 | |
9871 | else | |
9872 | $test $i_sgtty = "$define" && xxx="sgtty.h" | |
9873 | $test $i_termio = "$define" && xxx="termio.h" | |
9874 | $test $i_termios = "$define" && xxx="termios.h" | |
9875 | echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4 | |
9876 | fi | |
9877 | fi | |
9878 | set i_sysioctl | |
9879 | eval $setvar | |
9880 | ||
9881 | : see if this is a sys/param system | |
9882 | set sys/param.h i_sysparam | |
9883 | eval $inhdr | |
9884 | ||
8ff267be | 9885 | : see if sys/resource.h has to be included |
9886 | set sys/resource.h i_sysresrc | |
9887 | eval $inhdr | |
9888 | ||
1aef975c AD |
9889 | : see if sys/stat.h is available |
9890 | set sys/stat.h i_sysstat | |
9891 | eval $inhdr | |
9892 | ||
fed7345c AD |
9893 | : see if sys/types.h has to be included |
9894 | set sys/types.h i_systypes | |
9895 | eval $inhdr | |
9896 | ||
25f94b33 AD |
9897 | : see if this is a sys/un.h system |
9898 | set sys/un.h i_sysun | |
9899 | eval $inhdr | |
9900 | ||
8ff267be | 9901 | : see if this is a syswait system |
9902 | set sys/wait.h i_syswait | |
a0d0e21e LW |
9903 | eval $inhdr |
9904 | ||
9905 | : see if this is an utime system | |
9906 | set utime.h i_utime | |
9907 | eval $inhdr | |
9908 | ||
760ac839 LW |
9909 | : see if this is a values.h system |
9910 | set values.h i_values | |
9911 | eval $inhdr | |
9912 | ||
2304df62 | 9913 | : see if this is a vfork system |
85e6fe83 | 9914 | case "$d_vfork" in |
a0d0e21e LW |
9915 | "$define") |
9916 | set vfork.h i_vfork | |
85e6fe83 LW |
9917 | eval $inhdr |
9918 | ;; | |
a0d0e21e LW |
9919 | *) |
9920 | i_vfork="$undef" | |
9921 | ;; | |
85e6fe83 | 9922 | esac |
a0d0e21e | 9923 | |
4633a7c4 LW |
9924 | : see if gdbm.h is available |
9925 | set gdbm.h t_gdbm | |
9926 | eval $inhdr | |
9927 | case "$t_gdbm" in | |
9928 | $define) | |
9929 | : see if gdbm_open exists | |
9930 | set gdbm_open d_gdbm_open | |
9931 | eval $inlibc | |
9932 | case "$d_gdbm_open" in | |
9933 | $undef) | |
9934 | t_gdbm="$undef" | |
9935 | echo "We won't be including <gdbm.h>" | |
9936 | ;; | |
9937 | esac | |
9938 | ;; | |
9939 | esac | |
9940 | val="$t_gdbm" | |
9941 | set i_gdbm | |
9942 | eval $setvar | |
9943 | ||
52e1cb5e JH |
9944 | : test whether pthreads are created in joinable -- aka undetached -- state |
9945 | if test "X$usethreads" != X; then | |
ce637636 JH |
9946 | if test "X$d_pthreads_created_joinable" = X; then |
9947 | echo >&4 "Checking whether pthreads are created joinable." | |
52e1cb5e | 9948 | $cat >try.c <<EOCP |
52e1cb5e JH |
9949 | #include <pthread.h> |
9950 | #include <stdio.h> | |
9951 | int main() { | |
9952 | pthread_attr_t attr; | |
9953 | int detachstate; | |
52e1cb5e | 9954 | printf("%s\n", |
ce637636 JH |
9955 | pthread_attr_init(&attr) == 0 && |
9956 | pthread_attr_getdetachstate(&attr, &detachstate) == 0 && | |
9957 | detachstate == PTHREAD_CREATE_DETACHED ? | |
9958 | "detached" : "joinable"); | |
52e1cb5e JH |
9959 | exit(0); |
9960 | } | |
9961 | EOCP | |
ce637636 JH |
9962 | : Compile and link separately because the used cc might not be |
9963 | : able to link the right CRT and libs for pthreading. | |
9964 | if $cc $ccflags -c try.c >/dev/null 2>&1 && | |
c6ee37c5 | 9965 | $ld $ldflags -o try try$obj_ext $libs >/dev/null 2>&1; then |
ce637636 JH |
9966 | yyy=`./try` |
9967 | else | |
9968 | echo "(I can't execute the test program--assuming they are.)" | |
9969 | yyy=joinable | |
9970 | fi | |
9971 | case "$yyy" in | |
c6ee37c5 MB |
9972 | detached) |
9973 | val="$undef" | |
9974 | echo "Nope, they aren't." | |
9975 | ;; | |
9976 | *) | |
ce637636 JH |
9977 | val="$define" |
9978 | echo "Yup, they are." | |
9979 | ;; | |
ce637636 JH |
9980 | esac |
9981 | set d_pthreads_created_joinable | |
9982 | eval $setvar | |
9983 | $rm -f try try.* | |
52e1cb5e | 9984 | fi |
52e1cb5e JH |
9985 | else |
9986 | d_pthreads_created_joinable=$undef | |
9987 | fi | |
9988 | ||
ce637636 JH |
9989 | : see whether the various POSIXish _yields exist within given cccmd |
9990 | $cat >try.c <<EOP | |
9991 | #include <pthread.h> | |
9992 | main() { | |
9993 | YIELD(); | |
9994 | exit(0); | |
9995 | } | |
9996 | EOP | |
9997 | : see if pthread_yield exists within given cccmd, | |
9998 | : if we do not usethreads this may well end up undef. | |
9999 | if $cc $ccflags -DYIELD=pthread_yield $ldflags -o try try.c $libs > /dev/null 2>&1; then | |
10000 | val="$define" | |
10001 | echo 'pthread_yield() found.' >&4 | |
10002 | else | |
10003 | val="$undef" | |
10004 | echo 'pthread_yield() NOT found.' >&4 | |
10005 | fi | |
10006 | set d_pthread_yield | |
10007 | eval $setvar | |
10008 | ||
10009 | : see if sched_yield exists within given cccmd, | |
10010 | : if we do not usethreads this may well end up undef. | |
10011 | if $cc $ccflags -DYIELD=sched_yield $ldflags -o try try.c $libs > /dev/null 2>&1; then | |
10012 | val="$define" | |
10013 | echo 'sched_yield() found.' >&4 | |
10014 | else | |
10015 | val="$undef" | |
10016 | echo 'sched_yield() NOT found.' >&4 | |
10017 | fi | |
10018 | set d_sched_yield | |
10019 | eval $setvar | |
10020 | ||
10021 | : common to both the pthread_yield and sched_yield tests | |
10022 | rm -f try try.* | |
10023 | ||
4633a7c4 LW |
10024 | echo " " |
10025 | echo "Looking for extensions..." >&4 | |
10026 | cd ../ext | |
10027 | : If we are using the old config.sh, known_extensions may contain | |
10028 | : old or inaccurate or duplicate values. | |
10029 | known_extensions='' | |
10030 | : We do not use find because it might not be available. | |
10031 | : We do not just use MANIFEST because the user may have dropped | |
10032 | : some additional extensions into the source tree and expect them | |
10033 | : to be built. | |
10034 | for xxx in * ; do | |
5f05dabc | 10035 | case "$xxx" in |
10036 | DynaLoader) ;; | |
10037 | *) if $test -f $xxx/$xxx.xs; then | |
10038 | known_extensions="$known_extensions $xxx" | |
10039 | else | |
10040 | if $test -d $xxx; then | |
10041 | cd $xxx | |
10042 | for yyy in * ; do | |
10043 | if $test -f $yyy/$yyy.xs; then | |
10044 | known_extensions="$known_extensions $xxx/$yyy" | |
10045 | fi | |
10046 | done | |
10047 | cd .. | |
10048 | fi | |
10049 | fi ;; | |
10050 | esac | |
4633a7c4 LW |
10051 | done |
10052 | set X $known_extensions | |
10053 | shift | |
10054 | known_extensions="$*" | |
10055 | cd ../UU | |
10056 | ||
10057 | : Now see which are supported on this system. | |
10058 | avail_ext='' | |
10059 | for xxx in $known_extensions ; do | |
10060 | case "$xxx" in | |
10061 | DB_File) case "$i_db" in | |
10062 | $define) avail_ext="$avail_ext $xxx" ;; | |
10063 | esac | |
10064 | ;; | |
10065 | GDBM_File) case "$i_gdbm" in | |
10066 | $define) avail_ext="$avail_ext $xxx" ;; | |
10067 | esac | |
10068 | ;; | |
10069 | NDBM_File) case "$i_ndbm" in | |
10070 | $define) avail_ext="$avail_ext $xxx" ;; | |
10071 | esac | |
10072 | ;; | |
10073 | ODBM_File) case "${i_dbm}${i_rpcsvcdbm}" in | |
10074 | *"${define}"*) avail_ext="$avail_ext $xxx" ;; | |
10075 | esac | |
10076 | ;; | |
10077 | POSIX) case "$useposix" in | |
10078 | true|define|y) avail_ext="$avail_ext $xxx" ;; | |
10079 | esac | |
10080 | ;; | |
8ff267be | 10081 | Opcode) case "$useopcode" in |
2c7991dc | 10082 | true|define|y) avail_ext="$avail_ext $xxx" ;; |
10083 | esac | |
10084 | ;; | |
4633a7c4 LW |
10085 | Socket) case "$d_socket" in |
10086 | $define) avail_ext="$avail_ext $xxx" ;; | |
10087 | esac | |
10088 | ;; | |
c1f32930 MB |
10089 | Thread) case "$usethreads" in |
10090 | $define) avail_ext="$avail_ext $xxx" ;; | |
10091 | esac | |
10092 | ;; | |
4633a7c4 LW |
10093 | *) avail_ext="$avail_ext $xxx" |
10094 | ;; | |
10095 | esac | |
10096 | done | |
10097 | ||
10098 | set X $avail_ext | |
10099 | shift | |
10100 | avail_ext="$*" | |
10101 | ||
10102 | case $usedl in | |
10103 | $define) | |
10104 | $cat <<EOM | |
10105 | A number of extensions are supplied with $package. You may choose to | |
10106 | compile these extensions for dynamic loading (the default), compile | |
10107 | them into the $package executable (static loading), or not include | |
10108 | them at all. Answer "none" to include no extensions. | |
10109 | ||
10110 | EOM | |
10111 | case "$dynamic_ext" in | |
10112 | '') dflt="$avail_ext" ;; | |
10113 | *) dflt="$dynamic_ext" ;; | |
10114 | esac | |
10115 | case "$dflt" in | |
10116 | '') dflt=none;; | |
10117 | esac | |
10118 | rp="What extensions do you wish to load dynamically?" | |
10119 | . ./myread | |
10120 | case "$ans" in | |
10121 | none) dynamic_ext=' ' ;; | |
10122 | *) dynamic_ext="$ans" ;; | |
10123 | esac | |
10124 | ||
10125 | case "$static_ext" in | |
10126 | '') | |
10127 | : Exclude those already listed in dynamic linking | |
10128 | dflt='' | |
10129 | for xxx in $avail_ext; do | |
10130 | case " $dynamic_ext " in | |
10131 | *" $xxx "*) ;; | |
10132 | *) dflt="$dflt $xxx" ;; | |
10133 | esac | |
10134 | done | |
10135 | set X $dflt | |
10136 | shift | |
10137 | dflt="$*" | |
10138 | ;; | |
10139 | *) dflt="$static_ext" | |
10140 | ;; | |
10141 | esac | |
10142 | ||
10143 | case "$dflt" in | |
10144 | '') dflt=none;; | |
10145 | esac | |
10146 | rp="What extensions do you wish to load statically?" | |
10147 | . ./myread | |
10148 | case "$ans" in | |
10149 | none) static_ext=' ' ;; | |
10150 | *) static_ext="$ans" ;; | |
10151 | esac | |
10152 | ;; | |
10153 | *) | |
10154 | $cat <<EOM | |
10155 | A number of extensions are supplied with $package. Answer "none" | |
10156 | to include no extensions. | |
10157 | ||
10158 | EOM | |
10159 | case "$static_ext" in | |
10160 | '') dflt="$avail_ext" ;; | |
10161 | *) dflt="$static_ext" ;; | |
10162 | esac | |
10163 | ||
10164 | case "$dflt" in | |
10165 | '') dflt=none;; | |
10166 | esac | |
10167 | rp="What extensions do you wish to include?" | |
10168 | . ./myread | |
10169 | case "$ans" in | |
10170 | none) static_ext=' ' ;; | |
10171 | *) static_ext="$ans" ;; | |
10172 | esac | |
10173 | ;; | |
10174 | esac | |
10175 | ||
10176 | set X $dynamic_ext $static_ext | |
10177 | shift | |
10178 | extensions="$*" | |
10179 | ||
16d20bd9 AD |
10180 | : Remove build directory name from cppstdin so it can be used from |
10181 | : either the present location or the final installed location. | |
10182 | echo " " | |
10183 | : Get out of the UU directory to get correct path name. | |
10184 | cd .. | |
10185 | case "$cppstdin" in | |
10186 | `pwd`/cppstdin) | |
10187 | echo "Stripping down cppstdin path name" | |
10188 | cppstdin=cppstdin | |
10189 | ;; | |
10190 | esac | |
10191 | cd UU | |
10192 | ||
2304df62 AD |
10193 | : end of configuration questions |
10194 | echo " " | |
10195 | echo "End of configuration questions." | |
10196 | echo " " | |
10197 | ||
10198 | : back to where it started | |
10199 | if test -d ../UU; then | |
10200 | cd .. | |
10201 | fi | |
10202 | ||
10203 | : configuration may be patched via a 'config.over' file | |
10204 | if $test -f config.over; then | |
10205 | echo " " | |
10206 | dflt=y | |
10207 | rp='I see a config.over file. Do you wish to load it?' | |
10208 | . UU/myread | |
10209 | case "$ans" in | |
10210 | n*) echo "OK, I'll ignore it.";; | |
10211 | *) . ./config.over | |
10212 | echo "Configuration override changes have been loaded." | |
10213 | ;; | |
10214 | esac | |
10215 | fi | |
10216 | ||
ecfc5424 AD |
10217 | : in case they want portability, strip down executable paths |
10218 | case "$d_portable" in | |
10219 | "$define") | |
10220 | echo " " | |
10221 | echo "Stripping down executable paths..." >&4 | |
10222 | for file in $loclist $trylist; do | |
10223 | eval $file="\$file" | |
10224 | done | |
10225 | ;; | |
10226 | esac | |
10227 | ||
2304df62 AD |
10228 | : create config.sh file |
10229 | echo " " | |
10230 | echo "Creating config.sh..." >&4 | |
10231 | $spitshell <<EOT >config.sh | |
10232 | $startsh | |
10233 | # | |
5cd24f17 | 10234 | # This file was produced by running the Configure script. It holds all |
10235 | # the definitions figured out by Configure. Should you modify any of | |
10236 | # these values, do not forget to propagate your changes by running | |
10237 | # "Configure -S"; or, equivalently, you may run each .SH file yourself. | |
2304df62 AD |
10238 | # |
10239 | ||
10240 | # Configuration time: $cf_time | |
10241 | # Configured by: $cf_by | |
10242 | # Target system: $myuname | |
10243 | ||
2304df62 AD |
10244 | Author='$Author' |
10245 | Date='$Date' | |
10246 | Header='$Header' | |
10247 | Id='$Id' | |
10248 | Locker='$Locker' | |
10249 | Log='$Log' | |
ecfc5424 | 10250 | Mcc='$Mcc' |
2304df62 AD |
10251 | RCSfile='$RCSfile' |
10252 | Revision='$Revision' | |
10253 | Source='$Source' | |
10254 | State='$State' | |
10255 | afs='$afs' | |
a0d0e21e | 10256 | alignbytes='$alignbytes' |
ecfc5424 | 10257 | aphostname='$aphostname' |
4633a7c4 | 10258 | ar='$ar' |
a0d0e21e LW |
10259 | archlib='$archlib' |
10260 | archlibexp='$archlibexp' | |
10261 | archname='$archname' | |
4633a7c4 | 10262 | archobjs='$archobjs' |
ecfc5424 AD |
10263 | awk='$awk' |
10264 | baserev='$baserev' | |
10265 | bash='$bash' | |
2304df62 | 10266 | bin='$bin' |
5f05dabc | 10267 | bincompat3='$bincompat3' |
2304df62 | 10268 | binexp='$binexp' |
ecfc5424 AD |
10269 | bison='$bison' |
10270 | byacc='$byacc' | |
2304df62 | 10271 | byteorder='$byteorder' |
ecfc5424 AD |
10272 | c='$c' |
10273 | castflags='$castflags' | |
10274 | cat='$cat' | |
2304df62 | 10275 | cc='$cc' |
ecfc5424 AD |
10276 | cccdlflags='$cccdlflags' |
10277 | ccdlflags='$ccdlflags' | |
2304df62 | 10278 | ccflags='$ccflags' |
2304df62 | 10279 | cf_by='$cf_by' |
8e07c86e | 10280 | cf_email='$cf_email' |
2304df62 | 10281 | cf_time='$cf_time' |
ecfc5424 AD |
10282 | chgrp='$chgrp' |
10283 | chmod='$chmod' | |
10284 | chown='$chown' | |
10285 | clocktype='$clocktype' | |
10286 | comm='$comm' | |
10287 | compress='$compress' | |
2304df62 | 10288 | contains='$contains' |
ecfc5424 AD |
10289 | cp='$cp' |
10290 | cpio='$cpio' | |
10291 | cpp='$cpp' | |
a0d0e21e | 10292 | cpp_stuff='$cpp_stuff' |
ecfc5424 | 10293 | cppflags='$cppflags' |
2304df62 AD |
10294 | cpplast='$cpplast' |
10295 | cppminus='$cppminus' | |
10296 | cpprun='$cpprun' | |
10297 | cppstdin='$cppstdin' | |
ecfc5424 AD |
10298 | cryptlib='$cryptlib' |
10299 | csh='$csh' | |
10300 | d_Gconvert='$d_Gconvert' | |
2304df62 | 10301 | d_access='$d_access' |
a0d0e21e | 10302 | d_alarm='$d_alarm' |
ecfc5424 AD |
10303 | d_archlib='$d_archlib' |
10304 | d_attribut='$d_attribut' | |
2304df62 AD |
10305 | d_bcmp='$d_bcmp' |
10306 | d_bcopy='$d_bcopy' | |
5f05dabc | 10307 | d_bincompat3='$d_bincompat3' |
ecfc5424 | 10308 | d_bsd='$d_bsd' |
2afac517 | 10309 | d_bsdgetpgrp='$d_bsdgetpgrp' |
ecfc5424 | 10310 | d_bsdpgrp='$d_bsdpgrp' |
2afac517 | 10311 | d_bsdsetpgrp='$d_bsdsetpgrp' |
2304df62 AD |
10312 | d_bzero='$d_bzero' |
10313 | d_casti32='$d_casti32' | |
2304df62 | 10314 | d_castneg='$d_castneg' |
ecfc5424 | 10315 | d_charvspr='$d_charvspr' |
a0d0e21e LW |
10316 | d_chown='$d_chown' |
10317 | d_chroot='$d_chroot' | |
2304df62 | 10318 | d_chsize='$d_chsize' |
a0d0e21e | 10319 | d_closedir='$d_closedir' |
2304df62 | 10320 | d_const='$d_const' |
2304df62 AD |
10321 | d_crypt='$d_crypt' |
10322 | d_csh='$d_csh' | |
a0d0e21e LW |
10323 | d_cuserid='$d_cuserid' |
10324 | d_dbl_dig='$d_dbl_dig' | |
10325 | d_difftime='$d_difftime' | |
ecfc5424 | 10326 | d_dirnamlen='$d_dirnamlen' |
a0d0e21e LW |
10327 | d_dlerror='$d_dlerror' |
10328 | d_dlopen='$d_dlopen' | |
10329 | d_dlsymun='$d_dlsymun' | |
2304df62 AD |
10330 | d_dosuid='$d_dosuid' |
10331 | d_dup2='$d_dup2' | |
8e07c86e | 10332 | d_eofnblk='$d_eofnblk' |
40a7a20a | 10333 | d_eunice='$d_eunice' |
2304df62 AD |
10334 | d_fchmod='$d_fchmod' |
10335 | d_fchown='$d_fchown' | |
10336 | d_fcntl='$d_fcntl' | |
a0d0e21e LW |
10337 | d_fd_macros='$d_fd_macros' |
10338 | d_fd_set='$d_fd_set' | |
10339 | d_fds_bits='$d_fds_bits' | |
10340 | d_fgetpos='$d_fgetpos' | |
2304df62 AD |
10341 | d_flexfnam='$d_flexfnam' |
10342 | d_flock='$d_flock' | |
a0d0e21e | 10343 | d_fork='$d_fork' |
ecfc5424 | 10344 | d_fpathconf='$d_fpathconf' |
a0d0e21e | 10345 | d_fsetpos='$d_fsetpos' |
5f05dabc | 10346 | d_ftime='$d_ftime' |
2304df62 | 10347 | d_getgrps='$d_getgrps' |
5cd24f17 | 10348 | d_setgrps='$d_setgrps' |
3fd537d4 JH |
10349 | d_gethbadd='$d_gethbadd' |
10350 | gethbadd_addr_type='$gethbadd_addr_type' | |
10351 | gethbadd_alen_type='$gethbadd_alen_type' | |
2304df62 | 10352 | d_gethent='$d_gethent' |
2304df62 | 10353 | d_gethname='$d_gethname' |
a0d0e21e | 10354 | d_getlogin='$d_getlogin' |
3fd537d4 JH |
10355 | d_getnbadd='$d_getnbadd' |
10356 | getnbadd_net_type='$getnbadd_net_type' | |
2afac517 | 10357 | d_getpgid='$d_getpgid' |
2304df62 AD |
10358 | d_getpgrp2='$d_getpgrp2' |
10359 | d_getpgrp='$d_getpgrp' | |
a0d0e21e | 10360 | d_getppid='$d_getppid' |
2304df62 | 10361 | d_getprior='$d_getprior' |
5f05dabc | 10362 | d_gettimeod='$d_gettimeod' |
a4f3eea9 | 10363 | d_gnulibc='$d_gnulibc' |
2304df62 | 10364 | d_htonl='$d_htonl' |
ecfc5424 | 10365 | d_index='$d_index' |
7e1af8bc | 10366 | d_inetaton='$d_inetaton' |
2304df62 AD |
10367 | d_isascii='$d_isascii' |
10368 | d_killpg='$d_killpg' | |
10369 | d_link='$d_link' | |
a0d0e21e LW |
10370 | d_locconv='$d_locconv' |
10371 | d_lockf='$d_lockf' | |
2304df62 | 10372 | d_lstat='$d_lstat' |
a0d0e21e LW |
10373 | d_mblen='$d_mblen' |
10374 | d_mbstowcs='$d_mbstowcs' | |
10375 | d_mbtowc='$d_mbtowc' | |
2304df62 AD |
10376 | d_memcmp='$d_memcmp' |
10377 | d_memcpy='$d_memcpy' | |
10378 | d_memmove='$d_memmove' | |
10379 | d_memset='$d_memset' | |
10380 | d_mkdir='$d_mkdir' | |
a0d0e21e LW |
10381 | d_mkfifo='$d_mkfifo' |
10382 | d_mktime='$d_mktime' | |
2304df62 AD |
10383 | d_msg='$d_msg' |
10384 | d_msgctl='$d_msgctl' | |
10385 | d_msgget='$d_msgget' | |
10386 | d_msgrcv='$d_msgrcv' | |
10387 | d_msgsnd='$d_msgsnd' | |
ecfc5424 | 10388 | d_mymalloc='$d_mymalloc' |
a0d0e21e | 10389 | d_nice='$d_nice' |
4633a7c4 | 10390 | d_oldarchlib='$d_oldarchlib' |
ecfc5424 | 10391 | d_oldsock='$d_oldsock' |
2304df62 | 10392 | d_open3='$d_open3' |
a0d0e21e LW |
10393 | d_pathconf='$d_pathconf' |
10394 | d_pause='$d_pause' | |
ecfc5424 | 10395 | d_phostname='$d_phostname' |
a0d0e21e | 10396 | d_pipe='$d_pipe' |
8e07c86e | 10397 | d_poll='$d_poll' |
2304df62 | 10398 | d_portable='$d_portable' |
52e1cb5e | 10399 | d_pthread_yield='$d_pthread_yield' |
ce637636 | 10400 | d_pthreads_created_joinable='$d_pthreads_created_joinable' |
ecfc5424 AD |
10401 | d_pwage='$d_pwage' |
10402 | d_pwchange='$d_pwchange' | |
10403 | d_pwclass='$d_pwclass' | |
10404 | d_pwcomment='$d_pwcomment' | |
10405 | d_pwexpire='$d_pwexpire' | |
10406 | d_pwquota='$d_pwquota' | |
2304df62 | 10407 | d_readdir='$d_readdir' |
a0d0e21e | 10408 | d_readlink='$d_readlink' |
2304df62 | 10409 | d_rename='$d_rename' |
ecfc5424 | 10410 | d_rewinddir='$d_rewinddir' |
2304df62 AD |
10411 | d_rmdir='$d_rmdir' |
10412 | d_safebcpy='$d_safebcpy' | |
10413 | d_safemcpy='$d_safemcpy' | |
36477c24 | 10414 | d_sanemcmp='$d_sanemcmp' |
52e1cb5e | 10415 | d_sched_yield='$d_sched_yield' |
ecfc5424 | 10416 | d_seekdir='$d_seekdir' |
2304df62 AD |
10417 | d_select='$d_select' |
10418 | d_sem='$d_sem' | |
10419 | d_semctl='$d_semctl' | |
10420 | d_semget='$d_semget' | |
10421 | d_semop='$d_semop' | |
10422 | d_setegid='$d_setegid' | |
10423 | d_seteuid='$d_seteuid' | |
a0d0e21e | 10424 | d_setlinebuf='$d_setlinebuf' |
2304df62 AD |
10425 | d_setlocale='$d_setlocale' |
10426 | d_setpgid='$d_setpgid' | |
10427 | d_setpgrp2='$d_setpgrp2' | |
2304df62 AD |
10428 | d_setpgrp='$d_setpgrp' |
10429 | d_setprior='$d_setprior' | |
10430 | d_setregid='$d_setregid' | |
10431 | d_setresgid='$d_setresgid' | |
10432 | d_setresuid='$d_setresuid' | |
10433 | d_setreuid='$d_setreuid' | |
10434 | d_setrgid='$d_setrgid' | |
10435 | d_setruid='$d_setruid' | |
10436 | d_setsid='$d_setsid' | |
760ac839 | 10437 | d_sfio='$d_sfio' |
2304df62 AD |
10438 | d_shm='$d_shm' |
10439 | d_shmat='$d_shmat' | |
a0d0e21e | 10440 | d_shmatprototype='$d_shmatprototype' |
2304df62 AD |
10441 | d_shmctl='$d_shmctl' |
10442 | d_shmdt='$d_shmdt' | |
10443 | d_shmget='$d_shmget' | |
2c7991dc | 10444 | d_sigaction='$d_sigaction' |
a5f75d66 | 10445 | d_sigsetjmp='$d_sigsetjmp' |
2304df62 AD |
10446 | d_socket='$d_socket' |
10447 | d_sockpair='$d_sockpair' | |
2304df62 | 10448 | d_statblks='$d_statblks' |
c2960299 AD |
10449 | d_stdio_cnt_lval='$d_stdio_cnt_lval' |
10450 | d_stdio_ptr_lval='$d_stdio_ptr_lval' | |
16d20bd9 | 10451 | d_stdiobase='$d_stdiobase' |
2304df62 | 10452 | d_stdstdio='$d_stdstdio' |
2304df62 | 10453 | d_strchr='$d_strchr' |
a0d0e21e | 10454 | d_strcoll='$d_strcoll' |
2304df62 AD |
10455 | d_strctcpy='$d_strctcpy' |
10456 | d_strerrm='$d_strerrm' | |
10457 | d_strerror='$d_strerror' | |
a89d8a78 DH |
10458 | d_strtod='$d_strtod' |
10459 | d_strtol='$d_strtol' | |
10460 | d_strtoul='$d_strtoul' | |
a0d0e21e | 10461 | d_strxfrm='$d_strxfrm' |
ecfc5424 | 10462 | d_suidsafe='$d_suidsafe' |
2304df62 AD |
10463 | d_symlink='$d_symlink' |
10464 | d_syscall='$d_syscall' | |
a0d0e21e | 10465 | d_sysconf='$d_sysconf' |
ecfc5424 AD |
10466 | d_sysernlst='$d_sysernlst' |
10467 | d_syserrlst='$d_syserrlst' | |
2304df62 | 10468 | d_system='$d_system' |
a0d0e21e LW |
10469 | d_tcgetpgrp='$d_tcgetpgrp' |
10470 | d_tcsetpgrp='$d_tcsetpgrp' | |
ecfc5424 | 10471 | d_telldir='$d_telldir' |
85e6fe83 | 10472 | d_time='$d_time' |
2304df62 AD |
10473 | d_times='$d_times' |
10474 | d_truncate='$d_truncate' | |
a0d0e21e LW |
10475 | d_tzname='$d_tzname' |
10476 | d_umask='$d_umask' | |
ecfc5424 | 10477 | d_uname='$d_uname' |
2304df62 | 10478 | d_vfork='$d_vfork' |
ecfc5424 | 10479 | d_void_closedir='$d_void_closedir' |
2304df62 | 10480 | d_voidsig='$d_voidsig' |
ecfc5424 | 10481 | d_voidtty='$d_voidtty' |
2304df62 | 10482 | d_volatile='$d_volatile' |
2304df62 AD |
10483 | d_vprintf='$d_vprintf' |
10484 | d_wait4='$d_wait4' | |
10485 | d_waitpid='$d_waitpid' | |
a0d0e21e LW |
10486 | d_wcstombs='$d_wcstombs' |
10487 | d_wctomb='$d_wctomb' | |
ecfc5424 AD |
10488 | d_xenix='$d_xenix' |
10489 | date='$date' | |
10490 | db_hashtype='$db_hashtype' | |
10491 | db_prefixtype='$db_prefixtype' | |
10492 | defvoidused='$defvoidused' | |
10493 | direntrytype='$direntrytype' | |
a0d0e21e | 10494 | dlext='$dlext' |
2304df62 | 10495 | dlsrc='$dlsrc' |
ecfc5424 | 10496 | dynamic_ext='$dynamic_ext' |
8e07c86e | 10497 | eagain='$eagain' |
ecfc5424 AD |
10498 | echo='$echo' |
10499 | egrep='$egrep' | |
10500 | emacs='$emacs' | |
10501 | eunicefix='$eunicefix' | |
4633a7c4 | 10502 | exe_ext='$exe_ext' |
ecfc5424 AD |
10503 | expr='$expr' |
10504 | extensions='$extensions' | |
10505 | find='$find' | |
4633a7c4 | 10506 | firstmakefile='$firstmakefile' |
ecfc5424 | 10507 | flex='$flex' |
a0d0e21e | 10508 | fpostype='$fpostype' |
94b6baf5 | 10509 | freetype='$freetype' |
1aef975c AD |
10510 | full_csh='$full_csh' |
10511 | full_sed='$full_sed' | |
ecfc5424 AD |
10512 | gcc='$gcc' |
10513 | gccversion='$gccversion' | |
2304df62 | 10514 | gidtype='$gidtype' |
ecfc5424 AD |
10515 | glibpth='$glibpth' |
10516 | grep='$grep' | |
10517 | groupcat='$groupcat' | |
2304df62 | 10518 | groupstype='$groupstype' |
8ff267be | 10519 | gzip='$gzip' |
2304df62 AD |
10520 | h_fcntl='$h_fcntl' |
10521 | h_sysfile='$h_sysfile' | |
ecfc5424 AD |
10522 | hint='$hint' |
10523 | hostcat='$hostcat' | |
10524 | huge='$huge' | |
10525 | i_bsdioctl='$i_bsdioctl' | |
a0d0e21e | 10526 | i_db='$i_db' |
2304df62 | 10527 | i_dbm='$i_dbm' |
2304df62 | 10528 | i_dirent='$i_dirent' |
a0d0e21e | 10529 | i_dld='$i_dld' |
2304df62 AD |
10530 | i_dlfcn='$i_dlfcn' |
10531 | i_fcntl='$i_fcntl' | |
a0d0e21e | 10532 | i_float='$i_float' |
2304df62 AD |
10533 | i_gdbm='$i_gdbm' |
10534 | i_grp='$i_grp' | |
a0d0e21e | 10535 | i_limits='$i_limits' |
4633a7c4 | 10536 | i_locale='$i_locale' |
a0d0e21e LW |
10537 | i_malloc='$i_malloc' |
10538 | i_math='$i_math' | |
85e6fe83 | 10539 | i_memory='$i_memory' |
2304df62 | 10540 | i_ndbm='$i_ndbm' |
3fd537d4 | 10541 | i_netdb='$i_netdb' |
85e6fe83 | 10542 | i_neterrno='$i_neterrno' |
2304df62 | 10543 | i_niin='$i_niin' |
2304df62 | 10544 | i_pwd='$i_pwd' |
8e07c86e | 10545 | i_rpcsvcdbm='$i_rpcsvcdbm' |
760ac839 | 10546 | i_sfio='$i_sfio' |
ecfc5424 AD |
10547 | i_sgtty='$i_sgtty' |
10548 | i_stdarg='$i_stdarg' | |
2304df62 | 10549 | i_stddef='$i_stddef' |
a0d0e21e | 10550 | i_stdlib='$i_stdlib' |
2304df62 | 10551 | i_string='$i_string' |
2304df62 AD |
10552 | i_sysdir='$i_sysdir' |
10553 | i_sysfile='$i_sysfile' | |
a0d0e21e | 10554 | i_sysfilio='$i_sysfilio' |
ecfc5424 | 10555 | i_sysin='$i_sysin' |
2304df62 | 10556 | i_sysioctl='$i_sysioctl' |
2304df62 | 10557 | i_sysndir='$i_sysndir' |
a0d0e21e | 10558 | i_sysparam='$i_sysparam' |
8ff267be | 10559 | i_sysresrc='$i_sysresrc' |
2304df62 | 10560 | i_sysselct='$i_sysselct' |
ecfc5424 | 10561 | i_syssockio='$i_syssockio' |
1aef975c | 10562 | i_sysstat='$i_sysstat' |
ecfc5424 AD |
10563 | i_systime='$i_systime' |
10564 | i_systimek='$i_systimek' | |
a0d0e21e | 10565 | i_systimes='$i_systimes' |
fed7345c | 10566 | i_systypes='$i_systypes' |
25f94b33 | 10567 | i_sysun='$i_sysun' |
8ff267be | 10568 | i_syswait='$i_syswait' |
2304df62 AD |
10569 | i_termio='$i_termio' |
10570 | i_termios='$i_termios' | |
2304df62 | 10571 | i_time='$i_time' |
85e6fe83 | 10572 | i_unistd='$i_unistd' |
2304df62 | 10573 | i_utime='$i_utime' |
760ac839 | 10574 | i_values='$i_values' |
2304df62 AD |
10575 | i_varargs='$i_varargs' |
10576 | i_varhdr='$i_varhdr' | |
10577 | i_vfork='$i_vfork' | |
ecfc5424 AD |
10578 | incpath='$incpath' |
10579 | inews='$inews' | |
10580 | installarchlib='$installarchlib' | |
10581 | installbin='$installbin' | |
16d20bd9 AD |
10582 | installman1dir='$installman1dir' |
10583 | installman3dir='$installman3dir' | |
ecfc5424 AD |
10584 | installprivlib='$installprivlib' |
10585 | installscript='$installscript' | |
4633a7c4 | 10586 | installsitearch='$installsitearch' |
25f94b33 | 10587 | installsitelib='$installsitelib' |
2304df62 | 10588 | intsize='$intsize' |
ecfc5424 AD |
10589 | known_extensions='$known_extensions' |
10590 | ksh='$ksh' | |
10591 | large='$large' | |
232e078e | 10592 | ld='$ld' |
ecfc5424 AD |
10593 | lddlflags='$lddlflags' |
10594 | ldflags='$ldflags' | |
10595 | less='$less' | |
4633a7c4 | 10596 | lib_ext='$lib_ext' |
2304df62 | 10597 | libc='$libc' |
8ff267be | 10598 | libperl='$libperl' |
2304df62 | 10599 | libpth='$libpth' |
2304df62 | 10600 | libs='$libs' |
ecfc5424 AD |
10601 | libswanted='$libswanted' |
10602 | line='$line' | |
10603 | lint='$lint' | |
10604 | lkflags='$lkflags' | |
10605 | ln='$ln' | |
85e6fe83 | 10606 | lns='$lns' |
8e07c86e AD |
10607 | locincpth='$locincpth' |
10608 | loclibpth='$loclibpth' | |
24fef2a7 | 10609 | longsize='$longsize' |
ecfc5424 AD |
10610 | lp='$lp' |
10611 | lpr='$lpr' | |
10612 | ls='$ls' | |
85e6fe83 | 10613 | lseektype='$lseektype' |
ecfc5424 AD |
10614 | mail='$mail' |
10615 | mailx='$mailx' | |
10616 | make='$make' | |
8ff267be | 10617 | make_set_make='$make_set_make' |
2304df62 AD |
10618 | mallocobj='$mallocobj' |
10619 | mallocsrc='$mallocsrc' | |
10620 | malloctype='$malloctype' | |
16d20bd9 AD |
10621 | man1dir='$man1dir' |
10622 | man1direxp='$man1direxp' | |
10623 | man1ext='$man1ext' | |
10624 | man3dir='$man3dir' | |
10625 | man3direxp='$man3direxp' | |
10626 | man3ext='$man3ext' | |
2304df62 | 10627 | medium='$medium' |
ecfc5424 AD |
10628 | mips='$mips' |
10629 | mips_type='$mips_type' | |
10630 | mkdir='$mkdir' | |
2304df62 | 10631 | models='$models' |
a0d0e21e | 10632 | modetype='$modetype' |
ecfc5424 AD |
10633 | more='$more' |
10634 | mv='$mv' | |
40000a8c | 10635 | myarchname='$myarchname' |
2304df62 AD |
10636 | mydomain='$mydomain' |
10637 | myhostname='$myhostname' | |
ecfc5424 | 10638 | myuname='$myuname' |
2304df62 | 10639 | n='$n' |
ecfc5424 | 10640 | nm_opt='$nm_opt' |
40a7a20a | 10641 | nm_so_opt='$nm_so_opt' |
ecfc5424 | 10642 | nroff='$nroff' |
8e07c86e | 10643 | o_nonblock='$o_nonblock' |
4633a7c4 LW |
10644 | obj_ext='$obj_ext' |
10645 | oldarchlib='$oldarchlib' | |
10646 | oldarchlibexp='$oldarchlibexp' | |
ecfc5424 | 10647 | optimize='$optimize' |
85e6fe83 | 10648 | orderlib='$orderlib' |
ecfc5424 AD |
10649 | osname='$osname' |
10650 | osvers='$osvers' | |
2304df62 | 10651 | package='$package' |
2c7991dc | 10652 | pager='$pager' |
ecfc5424 AD |
10653 | passcat='$passcat' |
10654 | patchlevel='$patchlevel' | |
4633a7c4 | 10655 | path_sep='$path_sep' |
ecfc5424 | 10656 | perl='$perl' |
8e07c86e | 10657 | perladmin='$perladmin' |
4633a7c4 | 10658 | perlpath='$perlpath' |
ecfc5424 AD |
10659 | pg='$pg' |
10660 | phostname='$phostname' | |
10661 | plibpth='$plibpth' | |
10662 | pmake='$pmake' | |
10663 | pr='$pr' | |
a0d0e21e | 10664 | prefix='$prefix' |
1aef975c | 10665 | prefixexp='$prefixexp' |
2304df62 AD |
10666 | privlib='$privlib' |
10667 | privlibexp='$privlibexp' | |
10668 | prototype='$prototype' | |
10669 | randbits='$randbits' | |
ecfc5424 | 10670 | ranlib='$ranlib' |
8e07c86e | 10671 | rd_nodata='$rd_nodata' |
ecfc5424 AD |
10672 | rm='$rm' |
10673 | rmail='$rmail' | |
10674 | runnm='$runnm' | |
2304df62 AD |
10675 | scriptdir='$scriptdir' |
10676 | scriptdirexp='$scriptdirexp' | |
ecfc5424 | 10677 | sed='$sed' |
a0d0e21e | 10678 | selecttype='$selecttype' |
ecfc5424 AD |
10679 | sendmail='$sendmail' |
10680 | sh='$sh' | |
10681 | shar='$shar' | |
10682 | sharpbang='$sharpbang' | |
10683 | shmattype='$shmattype' | |
24fef2a7 | 10684 | shortsize='$shortsize' |
2afac517 | 10685 | shrpenv='$shrpenv' |
ecfc5424 | 10686 | shsharp='$shsharp' |
2304df62 | 10687 | sig_name='$sig_name' |
8e07c86e | 10688 | sig_num='$sig_num' |
ecfc5424 | 10689 | signal_t='$signal_t' |
4633a7c4 LW |
10690 | sitearch='$sitearch' |
10691 | sitearchexp='$sitearchexp' | |
25f94b33 AD |
10692 | sitelib='$sitelib' |
10693 | sitelibexp='$sitelibexp' | |
a0d0e21e | 10694 | sizetype='$sizetype' |
ecfc5424 AD |
10695 | sleep='$sleep' |
10696 | smail='$smail' | |
10697 | small='$small' | |
a0d0e21e | 10698 | so='$so' |
ecfc5424 AD |
10699 | sockethdr='$sockethdr' |
10700 | socketlib='$socketlib' | |
10701 | sort='$sort' | |
10702 | spackage='$spackage' | |
2304df62 | 10703 | spitshell='$spitshell' |
ecfc5424 | 10704 | split='$split' |
a0d0e21e | 10705 | ssizetype='$ssizetype' |
4633a7c4 | 10706 | startperl='$startperl' |
2304df62 | 10707 | startsh='$startsh' |
ecfc5424 | 10708 | static_ext='$static_ext' |
2304df62 | 10709 | stdchar='$stdchar' |
16d20bd9 AD |
10710 | stdio_base='$stdio_base' |
10711 | stdio_bufsiz='$stdio_bufsiz' | |
10712 | stdio_cnt='$stdio_cnt' | |
10713 | stdio_ptr='$stdio_ptr' | |
ecfc5424 AD |
10714 | strings='$strings' |
10715 | submit='$submit' | |
f55a7265 | 10716 | subversion='$subversion' |
2304df62 | 10717 | sysman='$sysman' |
ecfc5424 AD |
10718 | tail='$tail' |
10719 | tar='$tar' | |
10720 | tbl='$tbl' | |
10721 | test='$test' | |
10722 | timeincl='$timeincl' | |
10723 | timetype='$timetype' | |
10724 | touch='$touch' | |
10725 | tr='$tr' | |
10726 | troff='$troff' | |
2304df62 | 10727 | uidtype='$uidtype' |
ecfc5424 AD |
10728 | uname='$uname' |
10729 | uniq='$uniq' | |
10730 | usedl='$usedl' | |
10731 | usemymalloc='$usemymalloc' | |
2304df62 | 10732 | usenm='$usenm' |
8ff267be | 10733 | useopcode='$useopcode' |
10734 | useperlio='$useperlio' | |
ecfc5424 | 10735 | useposix='$useposix' |
8ff267be | 10736 | usesfio='$usesfio' |
10737 | useshrplib='$useshrplib' | |
ecfc5424 | 10738 | usevfork='$usevfork' |
2304df62 | 10739 | usrinc='$usrinc' |
ecfc5424 AD |
10740 | uuname='$uuname' |
10741 | vi='$vi' | |
2304df62 | 10742 | voidflags='$voidflags' |
ecfc5424 AD |
10743 | xlibpth='$xlibpth' |
10744 | zcat='$zcat' | |
8ff267be | 10745 | zip='$zip' |
2304df62 AD |
10746 | EOT |
10747 | ||
10748 | : add special variables | |
10749 | $test -f patchlevel.h && \ | |
10750 | awk '/^#define/ {printf "%s=%s\n",$2,$3}' patchlevel.h >>config.sh | |
10751 | echo "CONFIG=true" >>config.sh | |
10752 | ||
10753 | : propagate old symbols | |
10754 | if $test -f UU/config.sh; then | |
10755 | <UU/config.sh sort | uniq >UU/oldconfig.sh | |
10756 | sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\ | |
10757 | sort | uniq -u >UU/oldsyms | |
10758 | set X `cat UU/oldsyms` | |
10759 | shift | |
10760 | case $# in | |
10761 | 0) ;; | |
10762 | *) | |
10763 | cat <<EOM | |
10764 | Hmm...You had some extra variables I don't know about...I'll try to keep 'em... | |
10765 | EOM | |
10766 | echo "# Variables propagated from previous config.sh file." >>config.sh | |
10767 | for sym in `cat UU/oldsyms`; do | |
10768 | echo " Propagating $hint variable "'$'"$sym..." | |
10769 | eval 'tmp="$'"${sym}"'"' | |
10770 | echo "$tmp" | \ | |
10771 | sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh | |
10772 | done | |
10773 | ;; | |
10774 | esac | |
10775 | fi | |
10776 | ||
10777 | : Finish up by extracting the .SH files | |
10778 | case "$alldone" in | |
10779 | exit) | |
10780 | $rm -rf UU | |
10781 | echo "Done." | |
10782 | exit 0 | |
10783 | ;; | |
10784 | cont) | |
10785 | ;; | |
10786 | '') | |
2304df62 AD |
10787 | dflt='' |
10788 | nostick=true | |
40000a8c AD |
10789 | $cat <<EOM |
10790 | ||
10791 | If you'd like to make any changes to the config.sh file before I begin | |
10792 | to configure things, do it as a shell escape now (e.g. !vi config.sh). | |
10793 | ||
10794 | EOM | |
10795 | rp="Press return or use a shell escape to edit config.sh:" | |
2304df62 AD |
10796 | . UU/myread |
10797 | nostick='' | |
10798 | case "$ans" in | |
10799 | '') ;; | |
10800 | *) : in case they cannot read | |
10801 | sh 1>&4 -c "$ans";; | |
10802 | esac | |
10803 | ;; | |
10804 | esac | |
10805 | ||
10806 | : if this fails, just run all the .SH files by hand | |
10807 | . ./config.sh | |
10808 | ||
10809 | echo " " | |
10810 | exec 1>&4 | |
10811 | . ./UU/extract | |
10812 | ||
10813 | if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then | |
10814 | dflt=y | |
10815 | case "$silent" in | |
10816 | true) ;; | |
10817 | *) | |
10818 | $cat <<EOM | |
10819 | ||
10820 | Now you need to generate make dependencies by running "make depend". | |
10821 | You might prefer to run it in background: "make depend > makedepend.out &" | |
10822 | It can take a while, so you might not want to run it right now. | |
10823 | ||
10824 | EOM | |
10825 | ;; | |
10826 | esac | |
10827 | rp="Run make depend now?" | |
10828 | . UU/myread | |
10829 | case "$ans" in | |
10830 | y*) | |
10831 | make depend && echo "Now you must run a make." | |
10832 | ;; | |
10833 | *) | |
10834 | echo "You must run 'make depend' then 'make'." | |
10835 | ;; | |
10836 | esac | |
10837 | elif test -f [Mm]akefile; then | |
10838 | echo " " | |
10839 | echo "Now you must run a make." | |
10840 | else | |
10841 | echo "Done." | |
10842 | fi | |
10843 | ||
10844 | $rm -f kit*isdone ark*isdone | |
10845 | $rm -rf UU | |
a0d0e21e | 10846 | |
2304df62 | 10847 | : End of Configure |
a0d0e21e | 10848 |